/* ==================== 基础样式 ==================== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #6366f1;
    --primary-hover: #4f46e5;
    --success-color: #22c55e;
    --error-color: #ef4444;
    --warning-color: #f59e0b;
    --bg-gradient: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
    --card-bg: rgba(255, 255, 255, 0.05);
    --card-border: rgba(255, 255, 255, 0.1);
    --text-primary: #ffffff;
    --text-secondary: rgba(255, 255, 255, 0.7);
    --text-muted: rgba(255, 255, 255, 0.4);
    --shadow-glow: 0 0 40px rgba(99, 102, 241, 0.3);
}

body {
    font-family: 'Poppins', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-gradient);
    height: 100vh;
    height: 100dvh;
    color: var(--text-primary);
    overflow: hidden;
    touch-action: manipulation;
}

.container {
    max-width: 800px;
    margin: 0 auto;
    padding: 10px 15px;
    height: 100vh;
    height: 100dvh;
    position: relative;
    overflow: hidden;
}

/* ==================== 屏幕切换 ==================== */
.screen {
    display: none;
    animation: fadeIn 0.4s ease-out;
}

.screen.active {
    display: flex;
    flex-direction: column;
}

.screen.overlay {
    display: none;
}

.screen.overlay.active {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ==================== 开始界面 ==================== */
#start-screen {
    align-items: center;
    justify-content: center;
    height: 100%;
    gap: 20px;
}

.logo-container {
    text-align: center;
    margin-bottom: 10px;
}

.logo {
    font-size: 3rem;
    font-weight: 700;
    background: linear-gradient(135deg, #fff 0%, #a5b4fc 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    text-shadow: 0 0 60px rgba(165, 180, 252, 0.5);
    letter-spacing: 8px;
    animation: glow 2s ease-in-out infinite alternate;
}

@keyframes glow {
    from {
        filter: drop-shadow(0 0 20px rgba(99, 102, 241, 0.4));
    }

    to {
        filter: drop-shadow(0 0 40px rgba(99, 102, 241, 0.8));
    }
}

.subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-top: 5px;
    letter-spacing: 3px;
}

.settings-panel {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 20px;
    width: 100%;
    max-width: 360px;
    backdrop-filter: blur(10px);
}

.setting-item {
    margin-bottom: 12px;
}

.setting-item:last-child {
    margin-bottom: 0;
}

.setting-item label {
    display: block;
    margin-bottom: 5px;
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.setting-item select,
.setting-item input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--card-border);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: all 0.3s ease;
}

.setting-item select:focus,
.setting-item input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.3);
}

.setting-item select option {
    background: #1a1a2e;
}

/* ==================== 按钮样式 ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 32px;
    border: none;
    border-radius: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s ease;
}

.btn:hover::before {
    left: 100%;
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 10px 30px rgba(99, 102, 241, 0.4);
}

.btn-primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 40px rgba(99, 102, 241, 0.5);
}

.btn-primary:active {
    transform: translateY(-1px);
}

.btn-secondary {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    color: var(--text-primary);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-2px);
}

/* 操作按钮容器 */
.action-buttons {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 5px;
    flex-shrink: 0;
}

.btn-hint {
    background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
    color: white;
    padding: 8px 20px;
    font-size: 0.85rem;
}

.btn-hint:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none !important;
}

.btn-danger {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: white;
    padding: 8px 20px;
    font-size: 0.85rem;
}

.btn-danger:hover {
    background: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
    transform: translateY(-2px);
}

.high-score-display {
    margin-top: 10px;
    color: var(--text-secondary);
    font-size: 0.85rem;
    display: flex;
    align-items: center;
    gap: 8px;
}

#high-score-value {
    color: #fbbf24;
    font-weight: 600;
}

.btn-reset {
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 0.85rem;
    opacity: 0.6;
    transition: opacity 0.2s, transform 0.2s;
    padding: 2px 6px;
}

.btn-reset:hover {
    opacity: 1;
    transform: scale(1.1);
}

/* ==================== 帮助按钮 ==================== */
.btn-help {
    margin-top: 15px;
    background: transparent;
    border: 1px solid var(--card-border);
    color: var(--text-secondary);
    padding: 8px 16px;
    font-size: 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-help:hover {
    background: var(--card-bg);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

/* ==================== 帮助弹窗 ==================== */
.help-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(8px);
}

.help-overlay.active {
    display: flex;
}

.help-modal {
    background: linear-gradient(180deg, rgba(30, 30, 50, 0.98) 0%, rgba(20, 20, 40, 0.98) 100%);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 25px 30px;
    max-width: 480px;
    width: 90%;
    max-height: 85vh;
    overflow-y: auto;
    position: relative;
    animation: modalIn 0.4s ease-out;
}

.help-modal h2 {
    text-align: center;
    font-size: 1.4rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.help-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--card-bg);
    border-radius: 50%;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.help-close:hover {
    background: var(--error-color);
    color: white;
}

.help-section {
    margin-bottom: 20px;
}

.help-section h3 {
    font-size: 1rem;
    color: var(--primary-color);
    margin-bottom: 10px;
    padding-bottom: 5px;
    border-bottom: 1px solid var(--card-border);
}

.help-section ul {
    list-style: none;
    padding: 0;
}

.help-section li {
    padding: 6px 0;
    padding-left: 20px;
    position: relative;
    color: var(--text-secondary);
    font-size: 0.9rem;
    line-height: 1.5;
}

.help-section li::before {
    content: '•';
    position: absolute;
    left: 5px;
    color: var(--primary-color);
}

.score-rules {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.rule-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 0.9rem;
}

.rule-item.positive {
    background: rgba(34, 197, 94, 0.1);
    border-left: 3px solid var(--success-color);
}

.rule-item.negative {
    background: rgba(239, 68, 68, 0.1);
    border-left: 3px solid var(--error-color);
}

.rule-action {
    color: var(--text-secondary);
}

.rule-item.positive .rule-score {
    color: var(--success-color);
    font-weight: 600;
}

.rule-item.negative .rule-score {
    color: var(--error-color);
    font-weight: 600;
}

.help-modal .btn-primary {
    display: block;
    width: 100%;
    margin-top: 20px;
}

/* ==================== 游戏界面 ==================== */
#game-screen {
    padding-top: 5px;
    gap: 8px;
    align-items: center;
    height: 100%;
    justify-content: space-between;
    position: relative;
}

/* ==================== 暂停按钮 ==================== */
.pause-btn {
    width: 36px;
    height: 36px;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    flex-shrink: 0;
}

.pause-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
}

/* ==================== 倒计时 ==================== */
.timer-container {
    position: relative;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
}

.timer-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 6;
}

.timer-progress {
    fill: none;
    stroke: var(--success-color);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.1s linear, stroke 0.3s;
}

.timer-progress.warning {
    stroke: var(--warning-color);
}

.timer-progress.danger {
    stroke: var(--error-color);
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
}

.timer-text.warning {
    color: var(--warning-color);
}

.timer-text.danger {
    color: var(--error-color);
    animation: timerPulse 0.5s ease-in-out infinite;
}

@keyframes timerPulse {

    0%,
    100% {
        transform: translate(-50%, -50%) scale(1);
    }

    50% {
        transform: translate(-50%, -50%) scale(1.1);
    }
}

/* ==================== 暂停界面 ==================== */
.pause-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.pause-overlay.active {
    display: flex;
}

.pause-modal {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 30px 40px;
    text-align: center;
    backdrop-filter: blur(20px);
}

.pause-modal h2 {
    color: var(--text-primary);
    margin-bottom: 25px;
    font-size: 1.5rem;
}

.pause-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.pause-buttons .btn {
    min-width: 160px;
}

/* ==================== 背景反馈图标 ==================== */
.bg-feedback {
    position: fixed;
    top: 35%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 50vh;
    font-weight: 700;
    pointer-events: none;
    opacity: 0;
    z-index: -10;
    line-height: 1;
    transition: none;
}

.bg-feedback.show {
    animation: bgFeedbackFade 0.5s ease-out forwards;
}

.bg-feedback.correct {
    color: rgba(34, 197, 94, 0.12);
    text-shadow: none;
}

.bg-feedback.wrong {
    color: rgba(239, 68, 68, 0.12);
    text-shadow: none;
}

@keyframes bgFeedbackFade {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    15% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}

.game-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 8px 12px;
    backdrop-filter: blur(10px);
    flex-shrink: 0;
    gap: 10px;
}

.stat-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    flex: 1;
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
}

.stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.stat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
}

.lives-container {
    flex: 1;
    max-width: 200px;
}

.lives {
    display: flex;
    gap: 5px;
    justify-content: center;
}

.heart {
    font-size: 1rem;
    transition: all 0.3s ease;
}

.heart.lost {
    opacity: 0.2;
    transform: scale(0.8);
    filter: grayscale(1);
}

.heart.losing {
    animation: heartBreak 0.5s ease-out;
}

@keyframes heartBreak {
    0% {
        transform: scale(1);
    }

    25% {
        transform: scale(1.3);
    }

    50% {
        transform: scale(0.8) rotate(15deg);
    }

    75% {
        transform: scale(0.9) rotate(-10deg);
    }

    100% {
        transform: scale(0.8);
        opacity: 0.2;
    }
}

/* ==================== 绞刑架 ==================== */
.hangman-container {
    width: 100%;
    max-width: 180px;
    margin: 0;
    flex-shrink: 0;
}

.hangman-svg {
    width: 100%;
    height: auto;
}

.gallows {
    stroke: #64748b;
    stroke-width: 4;
    stroke-linecap: round;
}

.hangman-part {
    stroke: var(--error-color);
    stroke-width: 4;
    stroke-linecap: round;
    fill: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.hangman-part.visible {
    opacity: 1;
    animation: showPart 0.5s ease-out;
}

.head {
    fill: none;
}

@keyframes showPart {
    0% {
        opacity: 0;
        transform: scale(0.5);
    }

    50% {
        opacity: 1;
        transform: scale(1.1);
    }

    100% {
        opacity: 1;
        transform: scale(1);
    }
}

/* ==================== 单词显示 ==================== */
.word-section {
    text-align: center;
    margin: 5px 0;
    flex-shrink: 0;
}

.word-display {
    display: flex;
    gap: 8px;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 8px;
}

.letter-box {
    width: 36px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    font-weight: 700;
    border-bottom: 3px solid var(--text-secondary);
    color: var(--text-primary);
    text-transform: uppercase;
    transition: all 0.3s ease;
}

.letter-box.revealed {
    animation: revealLetter 0.4s ease-out;
    color: var(--success-color);
    border-bottom-color: var(--success-color);
}

.letter-box.wrong-reveal {
    animation: wrongReveal 0.4s ease-out;
    color: var(--error-color);
    border-bottom-color: var(--error-color);
}

@keyframes revealLetter {
    0% {
        transform: scale(0.5) rotateX(90deg);
        opacity: 0;
    }

    100% {
        transform: scale(1) rotateX(0);
        opacity: 1;
    }
}

@keyframes wrongReveal {
    0% {
        transform: translateY(-20px);
        opacity: 0;
    }

    100% {
        transform: translateY(0);
        opacity: 1;
    }
}

.definition-display {
    color: var(--text-secondary);
    font-size: 0.85rem;
    padding: 6px 14px;
    background: var(--card-bg);
    border-radius: 8px;
    display: block;
    max-width: 100%;
    text-align: center;
    word-wrap: break-word;
    white-space: normal;
    line-height: 1.4;
}

/* ==================== 词性标记高亮 ==================== */
.pos-tag {
    font-weight: 600;
    padding: 1px 4px;
    border-radius: 3px;
    font-size: 0.8em;
    margin-right: 2px;
}

.pos-noun {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.15);
}

.pos-verb {
    color: #f472b6;
    background: rgba(244, 114, 182, 0.15);
}

.pos-adj {
    color: #4ade80;
    background: rgba(74, 222, 128, 0.15);
}

.pos-adv {
    color: #facc15;
    background: rgba(250, 204, 21, 0.15);
}

.pos-prep {
    color: #c084fc;
    background: rgba(192, 132, 252, 0.15);
}

.pos-conj {
    color: #fb923c;
    background: rgba(251, 146, 60, 0.15);
}

.pos-pron {
    color: #2dd4bf;
    background: rgba(45, 212, 191, 0.15);
}

.pos-num {
    color: #a78bfa;
    background: rgba(167, 139, 250, 0.15);
}

.pos-int {
    color: #f87171;
    background: rgba(248, 113, 113, 0.15);
}

.pos-art {
    color: #94a3b8;
    background: rgba(148, 163, 184, 0.15);
}

.pos-other {
    color: #9ca3af;
    background: rgba(156, 163, 175, 0.15);
}

.phonetic-display {
    color: var(--text-muted);
    font-size: 0.85rem;
    font-family: 'Noto Sans', sans-serif;
    font-style: italic;
    margin-top: 4px;
    opacity: 0.8;
}

/* ==================== 已猜字母 ==================== */
.guessed-section {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 6px 12px;
    background: var(--card-bg);
    border-radius: 10px;
    min-height: 36px;
    flex-shrink: 0;
}

.guessed-label {
    color: var(--text-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.guessed-letters {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.guessed-letter {
    padding: 3px 7px;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
}

.guessed-letter.correct {
    background: rgba(34, 197, 94, 0.2);
    color: var(--success-color);
}

.guessed-letter.wrong {
    background: rgba(239, 68, 68, 0.2);
    color: var(--error-color);
    text-decoration: line-through;
}

/* ==================== 虚拟键盘 ==================== */
.keyboard {
    display: flex;
    flex-direction: column;
    gap: 5px;
    width: 100%;
    max-width: 500px;
    flex-shrink: 0;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 4px;
}

.key {
    width: 34px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%);
    border: 1px solid var(--card-border);
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
}

.key:hover:not(.used) {
    background: linear-gradient(180deg, rgba(99, 102, 241, 0.3) 0%, rgba(99, 102, 241, 0.2) 100%);
    border-color: var(--primary-color);
    transform: translateY(-3px);
    box-shadow: 0 5px 20px rgba(99, 102, 241, 0.3);
}

.key:active:not(.used) {
    transform: translateY(-1px);
}

.key.correct {
    background: linear-gradient(180deg, rgba(34, 197, 94, 0.4) 0%, rgba(34, 197, 94, 0.2) 100%);
    border-color: var(--success-color);
    color: var(--success-color);
    animation: keyCorrect 0.4s ease-out;
}

.key.wrong {
    background: linear-gradient(180deg, rgba(239, 68, 68, 0.3) 0%, rgba(239, 68, 68, 0.1) 100%);
    border-color: var(--error-color);
    color: var(--error-color);
    animation: keyWrong 0.4s ease-out;
}

.key.used {
    opacity: 0.4;
    cursor: not-allowed;
}

@keyframes keyCorrect {
    0% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes keyWrong {

    0%,
    100% {
        transform: translateX(0);
    }

    20% {
        transform: translateX(-5px);
    }

    40% {
        transform: translateX(5px);
    }

    60% {
        transform: translateX(-5px);
    }

    80% {
        transform: translateX(5px);
    }
}

/* 提示高亮 */
.key.hint-highlight {
    background: linear-gradient(180deg, rgba(251, 191, 36, 0.5) 0%, rgba(245, 158, 11, 0.3) 100%);
    border-color: var(--warning-color);
    color: var(--warning-color);
    animation: hintPulse 0.5s ease-in-out infinite;
    transform: scale(1.1);
    box-shadow: 0 0 20px rgba(251, 191, 36, 0.5);
}

@keyframes hintPulse {

    0%,
    100% {
        box-shadow: 0 0 15px rgba(251, 191, 36, 0.4);
    }

    50% {
        box-shadow: 0 0 25px rgba(251, 191, 36, 0.7);
    }
}

/* ==================== 模态框 ==================== */
.modal {
    background: linear-gradient(180deg, rgba(30, 30, 50, 0.98) 0%, rgba(20, 20, 40, 0.98) 100%);
    border: 1px solid var(--card-border);
    border-radius: 20px;
    padding: 30px;
    text-align: center;
    max-width: 380px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalIn 0.4s ease-out;
}

@keyframes modalIn {
    from {
        opacity: 0;
        transform: scale(0.9) translateY(20px);
    }

    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.result-icon {
    font-size: 4rem;
    margin-bottom: 10px;
    animation: bounce 0.6s ease-out;
}

@keyframes bounce {
    0% {
        transform: scale(0);
    }

    50% {
        transform: scale(1.2);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
    }
}

.result-word {
    font-size: 1rem;
    color: var(--text-secondary);
    margin: 10px 0;
    padding: 12px;
    background: var(--card-bg);
    border-radius: 10px;
}

.result-word strong {
    color: var(--primary-color);
    font-size: 1.15rem;
}

.bonus-list {
    margin: 12px 0;
}

.bonus-item {
    padding: 6px 12px;
    margin: 5px 0;
    background: rgba(34, 197, 94, 0.1);
    border-left: 3px solid var(--success-color);
    border-radius: 0 8px 8px 0;
    color: var(--success-color);
    font-weight: 600;
    animation: slideIn 0.4s ease-out;
}

.bonus-item.penalty {
    background: rgba(239, 68, 68, 0.1);
    border-left-color: var(--error-color);
    color: var(--error-color);
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 25px;
    margin: 15px 0;
}

.result-stat {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.result-stat span:first-child {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.result-stat span:last-child {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-color);
}

/* ==================== 游戏结束界面 ==================== */
.game-over-modal {
    max-width: 680px;
}

.game-over-modal h2 {
    font-size: 1.6rem;
    margin-bottom: 18px;
}

.final-stats {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-bottom: 18px;
}

.final-stat {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 16px;
    background: var(--card-bg);
    border-radius: 12px;
}

.final-stat.big {
    padding: 15px 22px;
}

.final-stat-value {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
}

.final-stat.big .final-stat-value {
    font-size: 2.5rem;
    background: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.final-stat-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 5px;
}

.rating {
    font-size: 1.2rem;
    padding: 10px 24px;
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.2) 0%, rgba(245, 158, 11, 0.1) 100%);
    border-radius: 10px;
    margin-bottom: 18px;
}

.game-over-buttons {
    display: flex;
    gap: 15px;
    justify-content: center;
}

/* ==================== 词汇历史回顾 ==================== */
.word-history-section {
    margin-bottom: 18px;
    width: 100%;
}

.word-history-section h3 {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    font-weight: 600;
}

.word-history {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
}

.word-history::-webkit-scrollbar {
    width: 5px;
}

.word-history::-webkit-scrollbar-track {
    background: var(--card-bg);
    border-radius: 3px;
}

.word-history::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.history-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 10px 12px;
    background: var(--card-bg);
    border-radius: 10px;
    border-left: 4px solid var(--success-color);
    animation: historySlideIn 0.3s ease forwards;
    opacity: 0;
    transform: translateX(-15px);
}

.history-item.lost {
    border-left-color: var(--error-color);
}

.history-item.timeout {
    border-left-color: var(--warning-color);
}

@keyframes historySlideIn {
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.history-result-icon {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: bold;
    flex-shrink: 0;
    background: var(--success-color);
    color: white;
}

.history-item.lost .history-result-icon {
    background: var(--error-color);
}

.history-item.timeout .history-result-icon {
    background: var(--warning-color);
}

.history-content {
    flex: 1;
    min-width: 0;
    text-align: left;
}

.history-word {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 4px;
}

.history-word-text {
    font-weight: 700;
    font-size: 1rem;
    color: var(--text-primary);
}

.history-phonetic {
    font-family: 'Noto Sans', sans-serif;
    font-size: 0.8rem;
    color: var(--text-muted);
}

.history-score {
    font-size: 0.75rem;
    font-weight: 600;
    padding: 2px 6px;
    border-radius: 4px;
    background: rgba(239, 68, 68, 0.15);
    color: var(--error-color);
    margin-left: auto;
}

.history-score.positive {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success-color);
}

.history-definition {
    font-size: 0.8rem;
    color: var(--text-secondary);
    line-height: 1.4;
    word-break: break-word;
}

/* ==================== 响应式设计 ==================== */
@media (max-width: 600px) {
    .container {
        padding: 8px 10px;
    }

    .logo {
        font-size: 2.2rem;
        letter-spacing: 3px;
    }

    .subtitle {
        font-size: 0.85rem;
    }

    .settings-panel {
        padding: 15px;
        max-width: 320px;
    }

    .setting-item {
        margin-bottom: 10px;
    }

    .setting-item label {
        font-size: 0.8rem;
    }

    .setting-item select,
    .setting-item input {
        padding: 8px 12px;
        font-size: 0.9rem;
    }

    .btn {
        padding: 10px 24px;
        font-size: 0.9rem;
    }

    .game-header {
        padding: 8px 12px;
    }

    .stat-label {
        font-size: 0.65rem;
    }

    .stat-value {
        font-size: 1rem;
    }

    .heart {
        font-size: 0.85rem;
    }

    .hangman-container {
        max-width: 140px;
    }

    .key {
        width: 28px;
        height: 36px;
        font-size: 0.85rem;
        border-radius: 6px;
    }

    .keyboard {
        gap: 4px;
    }

    .keyboard-row {
        gap: 3px;
    }

    .letter-box {
        width: 28px;
        height: 36px;
        font-size: 1.2rem;
        gap: 5px;
    }

    .word-display {
        gap: 5px;
    }

    .definition-display {
        font-size: 0.75rem;
        padding: 5px 10px;
    }

    .guessed-section {
        padding: 5px 10px;
        min-height: 32px;
    }

    .guessed-label {
        font-size: 0.7rem;
    }

    .guessed-letter {
        padding: 2px 5px;
        font-size: 0.7rem;
    }

    .btn-hint {
        padding: 6px 16px;
        font-size: 0.8rem;
    }

    .modal {
        padding: 20px;
        border-radius: 20px;
    }

    .result-icon {
        font-size: 3.5rem;
        margin-bottom: 10px;
    }

    .result-word {
        font-size: 0.95rem;
        padding: 10px;
    }

    .result-stats {
        gap: 20px;
        margin: 15px 0;
    }

    .result-stat span:last-child {
        font-size: 1.4rem;
    }

    .game-over-buttons {
        flex-direction: column;
        gap: 10px;
    }

    .final-stats {
        flex-wrap: wrap;
        gap: 10px;
    }

    .final-stat {
        padding: 10px 15px;
    }

    .final-stat-value {
        font-size: 1.4rem;
    }

    .final-stat.big .final-stat-value {
        font-size: 2rem;
    }

    .rating {
        font-size: 1.2rem;
        padding: 10px 20px;
    }

    .game-over-modal {
        max-height: 95vh;
        padding: 20px 15px;
    }

    .game-over-modal h2 {
        font-size: 1.5rem;
        margin-bottom: 12px;
    }

    .word-history {
        grid-template-columns: 1fr;
        max-height: 35vh;
        overflow-y: auto;
    }

    .history-item {
        padding: 8px 10px;
    }

    .history-word-text {
        font-size: 0.9rem;
    }

    .history-definition {
        font-size: 0.75rem;
    }
}

/* 超窄屏适配 */
@media (max-width: 380px) {
    .key {
        width: 24px;
        height: 32px;
        font-size: 0.75rem;
    }

    .letter-box {
        width: 24px;
        height: 32px;
        font-size: 1rem;
    }

    .hangman-container {
        max-width: 120px;
    }

    .logo {
        font-size: 1.8rem;
    }
}

/* ==================== 加载动画 ==================== */
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.loading-dot {
    width: 12px;
    height: 12px;
    background: var(--primary-color);
    border-radius: 50%;
    animation: loadingBounce 1.4s infinite ease-in-out both;
}

.loading-dot:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dot:nth-child(2) {
    animation-delay: -0.16s;
}

.loading-dot:nth-child(3) {
    animation-delay: 0s;
}

@keyframes loadingBounce {

    0%,
    80%,
    100% {
        transform: scale(0);
    }

    40% {
        transform: scale(1);
    }
}

/* ==================== 分数飘动画 ==================== */
.score-popup {
    position: fixed;
    font-size: 1.5rem;
    font-weight: 700;
    pointer-events: none;
    z-index: 200;
    animation: scoreFloat 1.5s ease-out forwards;
}

.score-popup.positive {
    color: var(--success-color);
}

.score-popup.negative {
    color: var(--error-color);
}

@keyframes scoreFloat {
    0% {
        opacity: 1;
        transform: translateY(0) scale(1);
    }

    100% {
        opacity: 0;
        transform: translateY(-80px) scale(1.2);
    }
}

/* ==================== 胜利/失败动画 ==================== */
@keyframes winShake {

    0%,
    100% {
        transform: rotate(0);
    }

    25% {
        transform: rotate(-5deg);
    }

    75% {
        transform: rotate(5deg);
    }
}

.win-animation {
    animation: winShake 0.5s ease-in-out 3;
}

@keyframes loseShake {

    0%,
    100% {
        transform: translateX(0);
    }

    10%,
    30%,
    50%,
    70%,
    90% {
        transform: translateX(-10px);
    }

    20%,
    40%,
    60%,
    80% {
        transform: translateX(10px);
    }
}

.lose-animation {
    animation: loseShake 0.8s ease-in-out;
}

/* ==================== 连击特效 ==================== */
.combo-effect {
    position: fixed;
    font-size: 4rem;
    font-weight: 700;
    color: rgba(251, 191, 36, 0.2);
    text-shadow: none;
    pointer-events: none;
    z-index: -10;
    animation: comboIn 1s ease-out forwards;
    transform: translate(-50%, -50%);
    white-space: nowrap;
}

@keyframes comboIn {
    0% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(0.5);
    }

    20% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1.1);
    }

    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1);
    }
}