/* style.css for Power Game - 灵犀家树 */

/* -------------------------------------------------- */
/* 全局和基础样式 (Global and Base Styles) */
/* -------------------------------------------------- */

body {
    font-family: 'Inter', sans-serif, 'Microsoft YaHei', 'PingFang SC', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    overscroll-behavior: none; /* 防止移动端拖动页面导致意外的滚动或刷新 */
    background-color: #EFF6FF; /* Tailwind blue-50, 我们的宝宝蓝背景 */
    color: #374151; /* Tailwind gray-700, 默认文字颜色 */
    line-height: 1.6; /* 提升阅读舒适度 */
    display: flex; /* 用于垂直居中game-container */
    justify-content: center;
    align-items: flex-start; /* 从顶部开始对齐 */
    min-height: 100vh;
    padding-top: 2rem; /* 给顶部一些空间 */
    padding-bottom: 2rem; /* 给底部一些空间 */
}

.game-container {
    max-width: 800px; /* 限制游戏容器的最大宽度 */
    width: 100%; /* 确保在小屏幕上占满宽度 */
    margin: 0 auto; /* 水平居中 */
    background-color: #FFFFFF; /* 游戏主要内容区域的白色背景 */
    border-radius: 12px; /* 圆角 */
    box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04); /* 更柔和的阴影 */
    display: flex;
    flex-direction: column;
}

/* -------------------------------------------------- */
/* 头部样式 (Header Styles) */
/* -------------------------------------------------- */
header.text-center {
    padding: 1.5rem 1rem; /* 头部内边距 */
    border-bottom: 1px solid #FCE7F3; /* Tailwind pink-100, 宝宝粉色分割线 */
}

header h1 {
    /* text-4xl font-bold text-pink-600 */
    font-size: 2.5rem; /* 调整标题大小 */
    font-weight: 700;
    color: #DB2777; /* Tailwind pink-600 */
    margin-bottom: 0.25rem;
}

header p.text-xl {
    /* text-xl text-blue-700 */
    font-size: 1.25rem;
    color: #1D4ED8; /* Tailwind blue-700 */
    margin-bottom: 0.5rem;
}

#userInfo {
    /* mt-2 text-sm */
    margin-top: 0.5rem;
    font-size: 0.875rem;
    color: #4B5563; /* Tailwind gray-600 */
}

#userName, #familyName {
    font-weight: 600;
    color: #DB2777; /* 宝宝粉 */
}

/* -------------------------------------------------- */
/* 主游戏区域样式 (Main Game Area Styles) */
/* -------------------------------------------------- */
main.flex-grow {
    padding: 1rem; /* 主内容区内边距 */
}

/* 左侧游戏画面和控制区 */
.game-play-area { /* 对应HTML中的 flex-grow md:w-2/3 bg-white p-4 rounded-lg shadow-lg */
    background-color: #FFFFFF;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.game-play-area h2 {
    /* text-2xl font-semibold mb-3 text-center text-gray-700 */
    font-size: 1.75rem; /* 调整标题大小 */
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
    color: #374151; /* Tailwind gray-700 */
    border-bottom: 2px solid #BFDBFE; /* Tailwind blue-200, 宝宝蓝下划线 */
    padding-bottom: 0.5rem;
}

/* 摄像头和游戏画布 */
.video-canvas-container { /* 对应HTML中的 relative mb-4 aspect-video ... */
    position: relative;
    margin-bottom: 1rem;
    aspect-ratio: 16 / 9; /* 保持16:9的宽高比 */
    background-color: #E5E7EB; /* Tailwind gray-200 */
    border-radius: 0.5rem;
    overflow: hidden;
    border: 2px solid #DB2777; /* 宝宝粉边框 */
}

#videoFeed {
    width: 100%;
    height: 100%;
    object-fit: cover; /* 视频覆盖整个容器 */
}

#gameCanvas {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: transparent !important; /* 画布背景透明，以便看到视频 */
    border: none; /* 移除HTML内联的边框，如果需要边框，在这里统一管理 */
}

/* 控制按钮 */
.controls #startButton {
    /* bg-pink-500 hover:bg-pink-600 text-white font-bold py-3 px-6 rounded-lg text-lg shadow transition duration-150 ease-in-out */
    background-color: #EC4899; /* Tailwind pink-500 */
    color: white;
    font-weight: 700;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 1.125rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: background-color 0.15s ease-in-out, transform 0.1s ease-in-out;
}

.controls #startButton:hover {
    background-color: #DB2777; /* Tailwind pink-600 */
}
.controls #startButton:active {
    transform: scale(0.98); /* 点击时轻微缩小 */
}


/* 游戏信息 */
.game-info {
    margin-top: 1rem; /* 与按钮的间距 */
}
.game-info p.text-sm {
    /* text-sm text-gray-500 */
    font-size: 0.875rem;
    color: #6B7280; /* Tailwind gray-500 */
    margin-bottom: 0.25rem;
}
.game-info #healthZScore {
    /* text-3xl font-bold text-blue-600 */
    font-size: 2.25rem; /* 调整分数大小 */
    font-weight: 700;
    color: #2563EB; /* Tailwind blue-600 */
}
.game-info #dailyGoal {
    /* text-lg text-gray-700 */
    font-size: 1.125rem;
    color: #374151; /* Tailwind gray-700 */
}

/* -------------------------------------------------- */
/* 右侧AIGC反馈区域样式 (Aside AIGC Feedback Styles) */
/* -------------------------------------------------- */
aside.aigc-area { /* 对应HTML中的 md:w-1/3 flex flex-col gap-6 */
    /* Tailwind类已经处理了大部分布局，这里可以添加特定样式 */
}

.aigc-feedback { /* 对应HTML中的 aigc-feedback bg-white ... */
    background-color: #FFFFFF;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    display: flex; /* 使用flex布局使内容充满 */
    flex-direction: column;
}

.aigc-feedback h3 {
    /* text-xl font-semibold mb-3 text-center text-pink-500 */
    font-size: 1.5rem; /* 调整标题大小 */
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
    color: #EC4899; /* Tailwind pink-500 */
    border-bottom: 2px solid #FBCFE8; /* Tailwind pink-200, 宝宝粉下划线 */
    padding-bottom: 0.5rem;
}

#aigcPoemContainer {
    /* mb-4 p-3 bg-pink-50 border border-pink-200 rounded min-h-[100px] */
    margin-bottom: 1rem;
    padding: 0.75rem;
    background-color: #FFF1F2; /* Tailwind pink-50 */
    border: 1px solid #FECDD3; /* Tailwind pink-200 */
    border-radius: 0.375rem;
    min-height: 120px; /* 增加最小高度 */
    display: flex; /* 用于垂直居中占位符文本 */
    flex-direction: column;
    justify-content: center;
}
#aigcPoemContainer p.italic { /* 占位符文本 */
    font-style: italic;
    color: #9CA3AF; /* Tailwind gray-400 */
    text-align: center;
}
#acrosticPoem {
    /* whitespace-pre-wrap text-center font-serif */
    white-space: pre-wrap; /* 保持诗歌格式 */
    text-align: center;
    font-family: 'KaiTi', 'STKaiti', serif; /* 尝试使用楷体显示诗歌 */
    font-size: 1rem;
    color: #BE185D; /* Tailwind pink-700 */
    line-height: 1.8;
}

#aigcImageContainer {
    /* aigc-content flex justify-center items-center mb-4 min-h-[150px] bg-blue-50 border border-blue-200 rounded */
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 1rem;
    min-height: 150px;
    background-color: #EFF6FF; /* Tailwind blue-50 */
    border: 1px solid #DBEAFE; /* Tailwind blue-200 */
    border-radius: 0.375rem;
    padding: 0.5rem;
}
#classicalAvatar {
    /* max-width: 150px; border-radius: 8px; border: 2px solid #FADCD9; */
    max-width: 100%; /* 让图片在容器内自适应 */
    max-height: 140px; /* 限制最大高度 */
    object-fit: contain; /* 保持图片比例 */
    border-radius: 0.5rem;
    border: 2px solid #FBCFE8; /* Tailwind pink-200 */
}

#aiPalComment {
    /* text-sm text-gray-600 p-3 bg-gray-100 rounded */
    font-size: 0.875rem;
    color: #4B5563; /* Tailwind gray-600 */
    padding: 0.75rem;
    background-color: #F3F4F6; /* Tailwind gray-100 */
    border-radius: 0.375rem;
    margin-top: auto; /* 如果内容不足，将此部分推到底部 */
}
#aiPalComment strong {
    color: #1D4ED8; /* Tailwind blue-700 */
}

/* -------------------------------------------------- */
/* 家族“灵犀家树”区域样式 (Family Tree Section Styles) */
/* -------------------------------------------------- */
.family-tree-section { /* 对应HTML中的 family-tree-section bg-white ... */
    background-color: #FFFFFF;
    padding: 1.5rem;
    border-radius: 0.5rem;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    margin-bottom: 1.5rem;
}

.family-tree-section h2 {
    /* text-2xl font-semibold mb-3 text-center text-green-600 */
    font-size: 1.75rem; /* 调整标题大小 */
    font-weight: 600;
    margin-bottom: 1rem;
    text-align: center;
    color: #059669; /* Tailwind green-600 */
    border-bottom: 2px solid #A7F3D0; /* Tailwind green-200 下划线 */
    padding-bottom: 0.5rem;
}

.family-tree-visual {
    width: 100%;
    height: 180px; /* 增加高度 */
    background-color: #D1FAE5; /* Tailwind green-100 作为树的占位符 */
    border: 2px dashed #6EE7B7; /* Tailwind green-300 */
    border-radius: 0.5rem;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #065F46; /* Tailwind green-800 */
    font-size: 1.125rem; /* 调整占位符文字大小 */
    margin-bottom: 1rem; /* 与下方统计数据的间距 */
}

.family-stats {
    /* text-center mt-4 grid grid-cols-2 md:grid-cols-4 gap-2 text-sm */
    text-align: center;
    margin-top: 1rem;
    font-size: 0.875rem;
    color: #4B5563; /* Tailwind gray-600 */
}
.family-stats > div {
    padding: 0.25rem;
}
.family-stats span.font-bold {
    font-weight: 700;
}
#inviteButton {
    /* text-xs bg-green-500 hover:bg-green-600 text-white py-1 px-2 rounded */
    font-size: 0.75rem;
    background-color: #10B981; /* Tailwind green-500 */
    color: white;
    padding: 0.25rem 0.75rem; /* 调整内边距 */
    border-radius: 0.375rem;
    transition: background-color 0.15s ease-in-out;
}
#inviteButton:hover {
    background-color: #059669; /* Tailwind green-600 */
}

/* -------------------------------------------------- */
/* 页脚样式 (Footer Styles) */
/* -------------------------------------------------- */
footer.text-center {
    /* text-xs text-gray-500 py-4 border-t border-gray-200 */
    font-size: 0.75rem;
    color: #6B7280; /* Tailwind gray-500 */
    padding: 1rem 0;
    border-top: 1px solid #E5E7EB; /* Tailwind gray-200 */
    margin-top: auto; /* 确保页脚在内容不足时也位于底部 */
}

/* -------------------------------------------------- */
/* 响应式调整 (Responsive Adjustments) - Tailwind已处理大部分 */
/* -------------------------------------------------- */
@media (max-width: 768px) { /* md断点以下 */
    main.md\:flex-row {
        flex-direction: column; /* 在小屏幕上，主内容区垂直排列 */
    }
    .game-play-area, aside.aigc-area {
        width: 100%; /* 在小屏幕上占满宽度 */
    }
    header h1 {
        font-size: 2rem; /* 缩小标题 */
    }
    header p.text-xl {
        font-size: 1.125rem; /* 缩小副标题 */
    }
    .game-play-area h2, .family-tree-section h2, .aigc-feedback h3 {
        font-size: 1.5rem; /* 缩小各区块标题 */
    }
    .family-stats {
        grid-template-columns: repeat(2, 1fr); /* 小屏幕上家族统计两列 */
    }
}
/* 分享模态框动画 */
.share-modal {
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* 分享按钮呼吸效果 */
#shareButton {
    animation: breath 1.5s ease-in-out infinite;
}

@keyframes breath {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.05); }
}
#shareButton:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    animation: none;
}
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 100%;
    max-width: 1200px;
    position: relative;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
}

.close:hover {
    color: black;
    cursor: pointer;
}