/* ========================================
   小兔口算成长记 - 游戏界面样式
   面向8岁儿童，大字体、明亮配色、可爱风格
   ======================================== */

/* 全局变量 */
:root {
    --primary: #FF8C00;
    --primary-light: #FFA940;
    --primary-dark: #E07800;
    --gold: #FFD700;
    --green: #90EE90;
    --green-dark: #5CB85C;
    --red: #FF6B6B;
    --bg-warm: #FFF8DC;
    --bg-warm2: #FFEFD5;
    --text-dark: #333;
    --text-gray: #666;
    --card-bg: #fff;
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --radius: 12px;
    --radius-lg: 25px;
}

/* 重置与基础 */
* {
    box-sizing: border-box;
}

body {
    font-family: "Microsoft YaHei", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
    background: linear-gradient(135deg, var(--bg-warm), var(--bg-warm2));
    color: var(--text-dark);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    font-size: 16px;
    line-height: 1.6;
}

/* 游戏容器 */
.game-container {
    max-width: 480px;
    margin: 0 auto;
    padding: 20px;
    min-height: 100vh;
}

/* 顶部导航栏 */
.game-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 16px;
    background: white;
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    margin-bottom: 20px;
}

.game-nav .nav-title {
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
}

.game-nav .nav-links {
    display: flex;
    gap: 12px;
}

.game-nav .nav-links a {
    color: var(--text-gray);
    text-decoration: none;
    font-size: 14px;
    padding: 4px 8px;
    border-radius: 8px;
    transition: all 0.2s;
}

.game-nav .nav-links a:hover,
.game-nav .nav-links a.active {
    color: var(--primary);
    background: #FFF3E0;
}

/* 卡片样式 */
.game-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 16px;
}

.game-card-title {
    font-size: 20px;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 12px;
}

/* 大按钮 */
.btn-game {
    display: inline-block;
    padding: 14px 32px;
    font-size: 20px;
    font-weight: bold;
    border: none;
    border-radius: var(--radius-lg);
    cursor: pointer;
    text-align: center;
    transition: all 0.3s;
    text-decoration: none;
    line-height: 1.4;
}

.btn-game-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    box-shadow: 0 4px 12px rgba(255, 140, 0, 0.4);
}

.btn-game-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(255, 140, 0, 0.5);
}

.btn-game-primary:active {
    transform: translateY(0);
}

.btn-game-success {
    background: linear-gradient(135deg, var(--green-dark), var(--green));
    color: white;
    box-shadow: 0 4px 12px rgba(92, 184, 92, 0.4);
}

.btn-game-warning {
    background: linear-gradient(135deg, var(--gold), #FFC107);
    color: var(--text-dark);
    box-shadow: 0 4px 12px rgba(255, 215, 0, 0.4);
}

.btn-game-outline {
    background: white;
    color: var(--primary);
    border: 2px solid var(--primary);
}

.btn-game-sm {
    padding: 8px 16px;
    font-size: 14px;
    border-radius: 16px;
}

.btn-game-lg {
    padding: 18px 48px;
    font-size: 24px;
}

.btn-game-block {
    display: block;
    width: 100%;
}

/* 兔子形象区域 */
.rabbit-image-area {
    text-align: center;
    padding: 20px;
}

.rabbit-image-area img {
    max-width: 200px;
    max-height: 200px;
    object-fit: contain;
    transition: transform 0.3s;
}

.rabbit-image-area img:hover {
    transform: scale(1.05);
}

.rabbit-image-area .rabbit-placeholder {
    width: 160px;
    height: 160px;
    margin: 0 auto;
    background: linear-gradient(135deg, #FFE4B5, #FFDAB9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 80px;
}

/* 进度条 */
.progress-bar-container {
    background: #f0f0f0;
    border-radius: 20px;
    height: 16px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    height: 100%;
    border-radius: 20px;
    background: linear-gradient(90deg, var(--primary), var(--gold));
    transition: width 0.5s ease;
}

.progress-bar-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 11px;
    font-weight: bold;
    color: var(--text-dark);
}

/* 闯关游戏区域 */
.game-area {
    text-align: center;
    padding: 20px 0;
}

.question-display {
    font-size: 48px;
    font-weight: bold;
    color: var(--text-dark);
    margin: 30px 0;
    min-height: 70px;
    line-height: 1.3;
}

.answer-input-area {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 20px 0;
}

.answer-input-area input {
    width: 120px;
    height: 56px;
    font-size: 32px;
    text-align: center;
    border: 3px solid var(--primary);
    border-radius: var(--radius);
    outline: none;
    color: var(--text-dark);
}

.answer-input-area input:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(255, 140, 0, 0.2);
}

/* 倒计时环形进度 */
.timer-circle {
    width: 60px;
    height: 60px;
    position: relative;
    display: inline-block;
}

.timer-circle svg {
    transform: rotate(-90deg);
}

.timer-circle .timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 18px;
    font-weight: bold;
    color: var(--primary);
}

.timer-circle.urgent .timer-text {
    color: var(--red);
    animation: pulse 0.5s infinite;
}

/* 题目进度圆点 */
.question-dots {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin: 16px 0;
}

.question-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: #e0e0e0;
    transition: all 0.3s;
}

.question-dot.current {
    background: var(--primary);
    transform: scale(1.3);
}

.question-dot.correct {
    background: var(--green-dark);
}

.question-dot.wrong {
    background: var(--red);
}

/* 反馈动画 */
.feedback-correct {
    animation: bounceIn 0.5s;
    color: var(--green-dark);
    font-size: 28px;
    font-weight: bold;
}

.feedback-wrong {
    animation: shake 0.5s;
    color: var(--red);
    font-size: 28px;
    font-weight: bold;
}

/* 食物图标 */
.food-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 16px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    font-size: 18px;
}

.food-icon-carrot {
    font-size: 24px;
}

.food-icon-milk {
    font-size: 24px;
}

/* 喂食按钮 */
.feed-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 24px;
    border: 2px solid var(--primary);
    background: white;
    border-radius: var(--radius);
    cursor: pointer;
    font-size: 18px;
    transition: all 0.2s;
    color: var(--primary);
}

.feed-btn:hover {
    background: #FFF3E0;
    transform: translateY(-2px);
}

.feed-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* 收集物品卡片 */
.collection-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
}

.collection-item {
    text-align: center;
    padding: 16px 8px;
    background: white;
    border-radius: var(--radius);
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    transition: all 0.3s;
}

.collection-item.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

.collection-item .item-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 8px;
    background: #FFF3E0;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
}

.collection-item .item-name {
    font-size: 13px;
    color: var(--text-dark);
}

/* 分类标签 */
.tab-bar {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 0;
    margin-bottom: 16px;
    -webkit-overflow-scrolling: touch;
}

.tab-item {
    padding: 6px 16px;
    border-radius: 20px;
    background: white;
    color: var(--text-gray);
    font-size: 14px;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid #e0e0e0;
}

.tab-item.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* 错题卡片 */
.wrong-question-card {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 12px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.wrong-question-card .question-text {
    font-size: 22px;
    font-weight: bold;
    margin-bottom: 8px;
}

.wrong-question-card .wrong-answer {
    color: var(--red);
    font-size: 16px;
}

.wrong-question-card .correct-answer {
    color: var(--green-dark);
    font-size: 16px;
}

.wrong-question-card .occurrence {
    color: var(--text-gray);
    font-size: 13px;
    margin-top: 4px;
}

/* 统计信息区域 */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.stat-item {
    background: white;
    border-radius: var(--radius);
    padding: 16px;
    text-align: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.stat-item .stat-value {
    font-size: 28px;
    font-weight: bold;
    color: var(--primary);
}

.stat-item .stat-label {
    font-size: 13px;
    color: var(--text-gray);
    margin-top: 4px;
}

/* 信息展示条 */
.info-bar {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 16px;
    background: #FFF3E0;
    border-radius: 20px;
    font-size: 16px;
    color: var(--primary-dark);
    margin-bottom: 16px;
}

/* 登录/注册表单 */
.auth-form {
    max-width: 360px;
    margin: 0 auto;
    padding: 20px;
}

.auth-form .form-group {
    margin-bottom: 20px;
}

.auth-form .form-group label {
    display: block;
    font-size: 18px;
    font-weight: bold;
    color: var(--text-dark);
    margin-bottom: 8px;
}

.auth-form .form-group input {
    width: 100%;
    height: 52px;
    font-size: 20px;
    padding: 0 16px;
    border: 2px solid #e0e0e0;
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.2s;
}

.auth-form .form-group input:focus {
    border-color: var(--primary);
}

/* 动画 */
@keyframes bounceIn {
    0% { transform: scale(0.3); opacity: 0; }
    50% { transform: scale(1.1); }
    70% { transform: scale(0.9); }
    100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    10%, 30%, 50%, 70%, 90% { transform: translateX(-5px); }
    20%, 40%, 60%, 80% { transform: translateX(5px); }
}

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: 0.5; }
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

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

/* 结果面板 */
.result-panel {
    text-align: center;
    padding: 24px;
    animation: fadeIn 0.5s;
}

.result-panel .result-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.result-panel .result-title {
    font-size: 28px;
    font-weight: bold;
    margin-bottom: 12px;
}

.result-panel .result-desc {
    font-size: 18px;
    color: var(--text-gray);
    margin-bottom: 20px;
}

/* 休息提醒弹窗 */
.rest-reminder {
    text-align: center;
    padding: 24px;
}

.rest-reminder .rest-icon {
    font-size: 48px;
    animation: bounce 1s infinite;
}

/* 底部导航 */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    background: white;
    box-shadow: 0 -2px 8px rgba(0,0,0,0.06);
    border-radius: 16px 16px 0 0;
    z-index: 100;
}

.bottom-nav a {
    flex: 1;
    text-align: center;
    padding: 8px 0;
    color: var(--text-gray);
    text-decoration: none;
    font-size: 12px;
    transition: color 0.2s;
}

.bottom-nav a.active {
    color: var(--primary);
}

.bottom-nav a .nav-icon {
    font-size: 20px;
    display: block;
    margin-bottom: 2px;
}

/* 响应式 */
@media (max-width: 480px) {
    .game-container {
        padding: 12px;
    }

    .question-display {
        font-size: 36px;
    }

    .stats-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }

    .collection-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
    }
}

/* ===== 顶部导航栏移动端适配 ===== */
@media (max-width: 768px) {
    .top-nav {
        flex-wrap: wrap;
        padding: 10px 15px;
    }
    .nav-title {
        font-size: 18px !important;
    }
    .nav-links {
        display: none;
        flex-basis: 100%;
        gap: 4px !important;
        padding: 8px 0 0;
        flex-wrap: wrap;
        justify-content: center;
    }
    .nav-links.show {
        display: flex;
    }
    .nav-links a {
        font-size: 14px !important;
        padding: 5px 10px !important;
    }
    .btn-logout {
        font-size: 14px !important;
        padding: 5px 12px !important;
    }
    .nav-toggle {
        display: inline-flex !important;
        background: rgba(255,255,255,0.2);
        border: none;
        color: #fff;
        font-size: 22px;
        padding: 6px 10px;
        border-radius: 8px;
        cursor: pointer;
    }
}
@media (min-width: 769px) {
    .nav-toggle {
        display: none !important;
    }
}

/* 欢迎页特殊样式 */
.welcome-page {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    text-align: center;
    padding: 20px;
}

.welcome-page .welcome-title {
    font-size: 36px;
    font-weight: bold;
    color: var(--primary);
    margin-bottom: 16px;
}

.welcome-page .welcome-desc {
    font-size: 20px;
    color: var(--text-gray);
    margin-bottom: 32px;
}

.welcome-page .welcome-buttons {
    display: flex;
    gap: 16px;
}

/* 升级动画 */
.upgrade-animation {
    animation: bounceIn 0.8s;
    text-align: center;
}

.upgrade-animation .upgrade-badge {
    font-size: 64px;
    margin-bottom: 16px;
}

.upgrade-animation .upgrade-text {
    font-size: 24px;
    font-weight: bold;
    color: var(--gold);
}
