/* ============ 游戏公共样式 ============ */

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body.games-page {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: #0f0f1a;
    color: #fff;
    min-height: 100vh;
    -webkit-tap-highlight-color: transparent;
}

body.games-entry {
    background: linear-gradient(135deg, #0f0f1a 0%, #1a1a2e 50%, #16213e 100%);
}

a {
    color: inherit;
    text-decoration: none;
}

/* ============ 游戏顶栏 ============ */

.game-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(255, 192, 203, 0.15);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    z-index: 100;
}

.game-topbar-left,
.game-topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 80px;
}

.game-topbar-right {
    justify-content: flex-end;
}

.game-topbar-center {
    text-align: center;
    flex: 1;
}

.game-topbar-title {
    color: #ffc0cb;
    font-size: 15px;
    font-weight: 600;
}

.game-topbar-sub {
    color: #888;
    font-size: 11px;
    margin-top: 2px;
}

.game-exit-btn {
    padding: 6px 12px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 6px;
    background: transparent;
    color: #ccc;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.game-exit-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.3);
}

.game-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 11px;
}

.game-stat-label {
    color: #888;
    font-size: 10px;
}

.game-stat-value {
    color: #ffc0cb;
    font-size: 15px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

/* ============ 游戏主体 ============ */

.game-main {
    padding: 72px 20px 80px;
    max-width: 720px;
    margin: 0 auto;
    min-height: 100vh;
}

/* ============ 题目区 ============ */

.game-question-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 32px 24px;
    margin-bottom: 20px;
    text-align: center;
}

.game-question {
    color: #fff;
    font-size: 36px;
    font-weight: 700;
    word-break: break-word;
    line-height: 1.3;
}

.game-phonetic {
    color: #ffd700;
    font-size: 18px;
    margin-top: 10px;
    font-style: italic;
}

/* 内联音标（答题反馈行内显示） */
.game-phonetic-inline {
    color: #ffd700;
    font-style: italic;
    font-size: 15px;
    font-family: Arial, sans-serif;
}

/* 音标旁的小型播放按钮 */
.game-play-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-left: 6px;
    padding: 0;
    border: 1px solid rgba(255, 192, 203, 0.4);
    border-radius: 50%;
    background: rgba(255, 192, 203, 0.12);
    color: #ffc0cb;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
    transition: background 0.2s, transform 0.1s;
    font-family: inherit;
}

.game-play-btn:hover {
    background: rgba(255, 192, 203, 0.25);
}

.game-play-btn:active {
    transform: scale(0.9);
}

/* 听音选词答题后揭示区 */
.game-listen-reveal {
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    min-height: 0;
}

.game-listen-reveal:empty {
    display: none;
}

.game-listen-answer {
    color: #ffc0cb;
    font-size: 14px;
    margin-bottom: 6px;
}

.game-listen-word {
    color: #fff;
    font-size: 22px;
    font-weight: 600;
}

.game-audio-icon {
    font-size: 56px;
    cursor: pointer;
    user-select: none;
    display: inline-block;
    transition: transform 0.2s;
}

.game-audio-icon:hover {
    transform: scale(1.1);
}

.game-audio-icon.playing {
    animation: pulse 0.8s ease-in-out infinite;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.15); opacity: 0.7; }
}

.game-replay-btn {
    margin-top: 16px;
    padding: 8px 20px;
    border: 1px solid rgba(255, 192, 203, 0.3);
    border-radius: 8px;
    background: rgba(255, 192, 203, 0.08);
    color: #ffc0cb;
    font-size: 13px;
    cursor: pointer;
    transition: all 0.2s;
}

.game-replay-btn:hover {
    background: rgba(255, 192, 203, 0.15);
}

/* ============ 选项 ============ */

.game-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-bottom: 20px;
}

.game-option {
    padding: 18px 16px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.04);
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    word-break: break-word;
    line-height: 1.4;
    font-family: inherit;
}

.game-option:hover:not(.disabled) {
    border-color: rgba(255, 192, 203, 0.4);
    background: rgba(255, 192, 203, 0.08);
}

.game-option.correct {
    border-color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
    color: #4ade80;
}

.game-option.wrong {
    border-color: #f87171;
    background: rgba(248, 113, 113, 0.15);
    color: #f87171;
}

.game-option.disabled {
    cursor: default;
    opacity: 0.6;
}

/* ============ 拼写输入 ============ */

.game-input-row {
    display: flex;
    gap: 10px;
    margin-bottom: 16px;
}

.game-input {
    flex: 1;
    padding: 14px 18px;
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 20px;
    font-family: monospace;
    letter-spacing: 1px;
    transition: border-color 0.2s;
}

.game-input:focus {
    outline: none;
    border-color: #ffc0cb;
}

.game-input.correct {
    border-color: #4ade80;
    color: #4ade80;
}

.game-input.wrong {
    border-color: #f87171;
    color: #f87171;
}

.game-btn {
    padding: 14px 24px;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #ffc0cb, #ff9aa8);
    color: #1a1a1a;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    font-family: inherit;
    white-space: nowrap;
}

.game-btn:hover {
    opacity: 0.85;
}

.game-btn:active {
    transform: scale(0.97);
}

.game-btn-secondary {
    background: rgba(255, 255, 255, 0.1);
    color: #ccc;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.game-hint-text {
    text-align: center;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: 14px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.game-hint-text.correct {
    background: rgba(74, 222, 128, 0.1);
    color: #4ade80;
}

.game-hint-text.wrong {
    background: rgba(248, 113, 113, 0.1);
    color: #f87171;
}

.game-hint-text .answer {
    color: #ffd700;
    font-weight: 600;
    margin-left: 6px;
}

.game-hint-row {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-bottom: 16px;
}

.game-letter-display {
    text-align: center;
    font-family: monospace;
    font-size: 22px;
    letter-spacing: 4px;
    color: #ffc0cb;
    padding: 10px;
    background: rgba(255, 192, 203, 0.05);
    border-radius: 8px;
    margin-bottom: 16px;
    min-height: 44px;
}

/* ============ 闪卡 ============ */

.flashcard-canvas-wrap {
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}

.flashcard-canvas-wrap canvas {
    max-width: 100%;
    max-height: 60vh;
    border-radius: 12px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.flashcard-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.flashcard-actions .game-btn {
    flex: 1;
    max-width: 200px;
}

.flashcard-btn-unknown {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff;
}

.flashcard-btn-known {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #fff;
}

/* ============ 进度条 ============ */

.game-progress {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(26, 26, 46, 0.95);
    backdrop-filter: blur(8px);
    padding: 12px 20px;
    border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.game-progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 3px;
    overflow: hidden;
}

.game-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #ffc0cb, #ff9aa8);
    border-radius: 3px;
    transition: width 0.3s ease;
}

.game-progress-text {
    text-align: center;
    color: #888;
    font-size: 12px;
    margin-bottom: 6px;
}

/* ============ 结束页 ============ */

.game-result {
    text-align: center;
    padding: 40px 20px;
}

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

.game-result-title {
    color: #ffc0cb;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 24px;
}

.game-result-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
    margin-bottom: 32px;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
}

.game-result-stat {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 16px 8px;
}

.game-result-stat-value {
    color: #ffc0cb;
    font-size: 28px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.game-result-stat-label {
    color: #888;
    font-size: 12px;
    margin-top: 4px;
}

.game-result-best {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(255, 215, 0, 0.1);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 20px;
    color: #ffd700;
    font-size: 13px;
    margin-bottom: 24px;
}

.game-result-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}

/* ============ 开始遮罩 ============ */

.game-start-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 26, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    padding: 20px;
}

.game-start-card {
    text-align: center;
    max-width: 400px;
}

.game-start-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.game-start-title {
    color: #ffc0cb;
    font-size: 24px;
    font-weight: 700;
    margin-bottom: 8px;
}

.game-start-desc {
    color: #aaa;
    font-size: 14px;
    margin-bottom: 28px;
    line-height: 1.6;
}

.game-start-btn {
    padding: 14px 40px;
    border: none;
    border-radius: 12px;
    background: linear-gradient(135deg, #ffc0cb, #ff9aa8);
    color: #1a1a1a;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.1s;
    font-family: inherit;
}

.game-start-btn:hover {
    opacity: 0.85;
}

.game-start-btn:active {
    transform: scale(0.97);
}

/* ============ 入口页 ============ */

.games-entry-container {
    max-width: 960px;
    margin: 0 auto;
    padding: 24px 20px 60px;
}

.games-entry-header {
    text-align: center;
    padding: 40px 0 32px;
}

.games-entry-title {
    color: #ffc0cb;
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 8px;
}

.games-entry-subtitle {
    color: #888;
    font-size: 14px;
}

.games-entry-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.games-group-select-wrap {
    display: flex;
    align-items: center;
    gap: 10px;
}

.games-group-select-wrap label {
    color: #aaa;
    font-size: 14px;
}

.games-group-select {
    padding: 8px 14px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 14px;
    cursor: pointer;
    font-family: inherit;
}

.games-group-select:focus {
    outline: none;
    border-color: #ffc0cb;
}

.games-user-area {
    font-size: 14px;
}

.games-user-area a {
    color: #ffc0cb;
    text-decoration: underline;
}

.games-cards {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.game-card {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 28px 24px;
    cursor: pointer;
    transition: all 0.25s;
    text-align: center;
    position: relative;
    overflow: hidden;
}

.game-card::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255, 192, 203, 0.08), transparent);
    opacity: 0;
    transition: opacity 0.25s;
}

.game-card:hover {
    border-color: rgba(255, 192, 203, 0.3);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
}

.game-card:hover::before {
    opacity: 1;
}

.game-card-icon {
    font-size: 48px;
    margin-bottom: 14px;
    position: relative;
}

.game-card-name {
    color: #fff;
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    position: relative;
}

.game-card-desc {
    color: #888;
    font-size: 13px;
    line-height: 1.5;
    margin-bottom: 18px;
    min-height: 40px;
    position: relative;
}

.game-card-btn {
    display: inline-block;
    padding: 9px 28px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #ffc0cb, #ff9aa8);
    color: #1a1a1a;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    position: relative;
    transition: opacity 0.2s;
}

.game-card:hover .game-card-btn {
    opacity: 0.95;
}

.game-card-best {
    position: absolute;
    top: 12px;
    right: 12px;
    padding: 3px 10px;
    background: rgba(255, 215, 0, 0.12);
    border: 1px solid rgba(255, 215, 0, 0.3);
    border-radius: 12px;
    color: #ffd700;
    font-size: 11px;
    font-weight: 600;
}

.games-back-link {
    display: inline-block;
    color: #888;
    font-size: 13px;
    margin-top: 32px;
    transition: color 0.2s;
}

.games-back-link:hover {
    color: #ffc0cb;
}

/* ============ 响应式 ============ */

@media (max-width: 600px) {
    .game-main {
        padding: 68px 12px 80px;
    }

    .game-question {
        font-size: 28px;
    }

    .game-options {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .game-option {
        padding: 14px;
        font-size: 15px;
    }

    .game-topbar {
        height: 48px;
        padding: 0 10px;
    }

    .game-topbar-left,
    .game-topbar-right {
        min-width: 60px;
        gap: 8px;
    }

    .game-topbar-title {
        font-size: 13px;
    }

    .game-stat-value {
        font-size: 13px;
    }

    .game-input {
        font-size: 18px;
    }

    .games-cards {
        grid-template-columns: 1fr;
    }

    .flashcard-actions {
        flex-direction: column;
    }

    .game-result-stats {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}
