@import url('https://fonts.googleapis.com/css2?family=Orbitron:wght@400;700;900&display=swap');

:root {
    --candy-pink: #e8a8c0;
    --candy-purple: #b8a1d9;
    --candy-blue: #a8c5d9;
    --candy-green: #b8d9bf;
    --candy-yellow: #e8d9a8;
    --candy-orange: #e8c0a0;
    --candy-red: #e8b0b0;
    --dark-bg: #1a1a2e;
    --dark-card: #252540;
    --dark-border: #2d2d44;
}

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

html {
    overflow-x: hidden;
    overflow-y: auto;
    overscroll-behavior-y: none;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Orbitron', sans-serif;
    background: linear-gradient(135deg, #0f0f23 0%, #1a1a2e 50%, #16213e 100%);
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    position: relative;
    touch-action: pan-y;
}

body::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: 
        radial-gradient(circle at 20% 80%, rgba(96, 165, 250, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(192, 132, 252, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 50% 50%, rgba(255, 107, 157, 0.05) 0%, transparent 70%);
    pointer-events: none;
}

.game-container {
    position: relative;
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    padding-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
    z-index: 1;
}

.bgm-toggle-btn {
    position: absolute;
    top: calc(12px + env(safe-area-inset-top, 0px));
    right: calc(12px + env(safe-area-inset-right, 0px));
    z-index: 30;
    width: 40px;
    height: 40px;
    padding: 0;
    border-radius: 50%;
    border: 1px solid rgba(96, 165, 250, 0.45);
    background: linear-gradient(135deg, rgba(37, 37, 64, 0.95), rgba(26, 26, 46, 0.95));
    color: #93c5fd;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(96, 165, 250, 0.2);
    transition: transform 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.bgm-toggle-btn .bgm-icon {
    display: block;
}

.bgm-toggle-btn .bgm-icon-off {
    display: none;
}

.bgm-toggle-btn.is-muted .bgm-icon-on {
    display: none;
}

.bgm-toggle-btn.is-muted .bgm-icon-off {
    display: block;
}

.bgm-toggle-btn:hover {
    transform: scale(1.06);
    border-color: rgba(147, 197, 253, 0.7);
}

.bgm-toggle-btn:active {
    transform: scale(0.96);
}

.bgm-toggle-btn.is-muted {
    border-color: rgba(248, 113, 113, 0.45);
    color: rgba(255, 255, 255, 0.5);
    box-shadow: none;
}

.game-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 8px 10px;
    margin-bottom: 20px;
    width: 100%;
}

.header-row-secondary {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    min-width: 0;
}

.score-panel {
    display: flex;
    gap: 10px;
    flex-shrink: 1;
    min-width: 0;
    grid-column: 1;
    grid-row: 1;
    justify-self: start;
}

.timer-container {
    display: none;
    grid-column: 2;
    grid-row: 1;
}

.score, .combo {
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    padding: 8px 14px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.score .label, .combo .label {
    display: block;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score .value, .combo .value {
    display: block;
    font-size: clamp(18px, 5vw, 24px);
    font-weight: 700;
    color: #fff;
    font-variant-numeric: tabular-nums;
    line-height: 1.1;
}

.combo .value {
    color: #fbbf24;
}

.difficulty-badge {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 10px;
    font-weight: 700;
    color: #0f0f23;
    text-transform: uppercase;
    letter-spacing: 1px;
    box-shadow: 0 0 15px rgba(74, 222, 128, 0.4);
}

.difficulty-badge.intermediate {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.difficulty-badge.advanced {
    background: linear-gradient(135deg, #f87171, #ef4444);
}

.difficulty-badge.expert {
    background: linear-gradient(135deg, #c084fc, #a855f7);
}

.difficulty-badge.master {
    background: linear-gradient(135deg, #22d3ee, #06b6d4);
    box-shadow: 0 0 20px rgba(34, 211, 238, 0.5);
}

.timer-ring {
    position: relative;
    width: 60px;
    height: 60px;
}

.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: url(#timer-gradient);
    stroke-width: 6;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 0.3s ease;
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.timer-text span {
    display: block;
    font-size: 22px;
    font-weight: 900;
    color: #fff;
}

.timer-text .unit {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.5);
}

.hint-timer {
    font-size: 12px;
    color: #f87171;
    animation: pulse 1s infinite;
}

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

.hint-section {
    text-align: center;
    margin-bottom: 8px;
}

.chinese-hint {
    font-size: 28px;
    font-weight: 900;
    color: #f8fafc;
    text-shadow:
        0 2px 6px rgba(0, 0, 0, 0.45),
        0 0 14px rgba(96, 165, 250, 0.22);
    margin-bottom: 12px;
    line-height: 1.2;
}

.chinese-hint .pos-tag {
    font-family: 'Helvetica Neue', 'Arial', sans-serif;
    font-weight: 700;
    font-size: 0.82em;
    letter-spacing: 0;
}

.english-hint {
    font-size: 20px;
    font-weight: 400;
    color: rgba(241, 245, 249, 0.98);
    margin-top: -2px;
    margin-bottom: 10px;
    line-height: 1.35;
    letter-spacing: 0.15px;
    font-family: 'Helvetica Neue', 'Arial', sans-serif;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.35);
}

.english-hint.is-hidden {
    display: none;
    margin: 0;
}

.header-switch-bank {
    grid-column: 2;
    grid-row: 1;
    justify-self: center;
    align-self: center;
    width: auto;
    height: auto;
    padding: 8px 16px;
    border-radius: 12px;
    border: 1px solid rgba(99, 102, 241, 0.5);
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(79, 70, 229, 0.3));
    color: #e0e7ff;
    font-size: 15px;
    font-weight: 700;
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    letter-spacing: 0.5px;
    line-height: 1.2;
    white-space: nowrap;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.2);
    transition: transform 0.15s ease, border-color 0.15s ease;
}

.header-switch-bank:hover {
    transform: scale(1.05);
    border-color: rgba(129, 140, 248, 0.7);
}

.header-switch-bank:active {
    transform: scale(0.96);
}

.word-length {
    display: none;
}

.word-progress {
    font-size: 16px;
    font-weight: 700;
    color: #a8c5d9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    grid-column: 3;
    grid-row: 1;
    justify-self: end;
    align-self: center;
    margin-right: 44px;
}

.word-remaining {
    font-size: 14px;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.6);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    margin-top: 2px;
}

.input-mode-hint {
    font-size: 16px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.8);
    margin-top: 8px;
    letter-spacing: 0.5px;
    transition: all 0.3s ease;
}

.input-mode-hint.active {
    color: rgba(255, 255, 255, 0.7);
}

.input-mode-hint .mode-keyboard {
    color: #60a5fa;
}

.input-mode-hint .mode-drag {
    color: #4ade80;
}

.input-mode-hint.mode-hint-pulsing .mode-hint-breathe {
    display: inline-block;
    color: #fbbf24;
    transform-origin: center center;
    -webkit-animation: mode-hint-breathe 1.8s ease-in-out infinite;
    animation: mode-hint-breathe 1.8s ease-in-out infinite;
    will-change: transform, opacity;
}

.input-mode-hint.mode-hint-pulsing .mode-hint-breathe:nth-of-type(2) {
    -webkit-animation-delay: 0.35s;
    animation-delay: 0.35s;
}

.input-mode-hint.mode-hint-pulsing .mode-hint-breathe:nth-of-type(3) {
    -webkit-animation-delay: 0.7s;
    animation-delay: 0.7s;
}

@keyframes mode-hint-breathe {
    0%, 100% {
        transform: scale(1);
        opacity: 0.85;
    }
    50% {
        transform: scale(1.18);
        opacity: 1;
    }
}

.word-length .first-letter {
    font-size: 24px;
    font-weight: 700;
    color: #fbbf24;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.4),
        0 0 10px rgba(251, 191, 36, 0.5);
    font-family: 'Arial', 'Helvetica Neue', sans-serif;
    letter-spacing: 1px;
}

.level-display {
    font-size: 16px;
    font-weight: 600;
    color: #a8c5d9;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
    background: rgba(26, 26, 46, 0.8);
    backdrop-filter: blur(10px);
    padding: 6px 12px;
    border-radius: 12px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    white-space: nowrap;
    max-width: 100%;
    box-sizing: border-box;
    text-align: center;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
}

@media (min-width: 601px) {
    .level-display {
        font-size: 14px;
        font-weight: 600;
        padding: 7px 14px;
        letter-spacing: 0.3px;
    }

    .header-switch-bank {
        font-size: 14px;
        padding: 7px 14px;
    }

    .chinese-hint {
        font-size: 32px;
    }

    .chinese-hint .pos-tag {
        font-size: 0.8em;
    }

    .english-hint {
        font-size: 17px;
        line-height: 1.4;
        margin-bottom: 8px;
    }
}

.letter-matrix {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    margin-bottom: 20px;
    padding: 16px;
    background: rgba(26, 26, 46, 0.6);
    backdrop-filter: blur(10px);
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    touch-action: none;
    user-select: none;
    -webkit-user-select: none;
    position: relative;
    transition: opacity 0.14s ease;
    min-height: 200px;
}

.letter-matrix.is-loading::after {
    content: '加载字母中…';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    font-weight: 600;
    color: rgba(255, 255, 255, 0.75);
    background: rgba(26, 26, 46, 0.88);
    border-radius: 16px;
    z-index: 30;
    pointer-events: none;
}

.letter-matrix.matrix-refresh {
    opacity: 0.35;
}

.path-line {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 10;
}

.path-line line {
    stroke: rgba(255, 255, 255, 0.7);
    stroke-width: 4;
    stroke-linecap: round;
    filter: drop-shadow(0 0 6px rgba(255, 255, 255, 0.5));
}

.finger-guide-overlay {
    position: absolute;
    inset: 0;
    pointer-events: none;
    z-index: 25;
    overflow: visible;
    transition: opacity 0.38s ease;
}

.finger-guide-overlay.is-fading {
    opacity: 0;
}

.finger-guide-overlay.is-pending {
    opacity: 0;
    visibility: hidden;
}

.guide-trail-svg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.guide-trail-path {
    fill: none;
    stroke: rgba(251, 191, 36, 0.42);
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
    filter: drop-shadow(0 0 5px rgba(251, 191, 36, 0.25));
}

.guide-finger {
    position: absolute;
    left: 0;
    top: 0;
    width: 34px;
    height: 34px;
    opacity: 0.52;
    pointer-events: none;
    will-change: transform;
    z-index: 2;
}

.guide-finger::before {
    content: '';
    display: block;
    width: 26px;
    height: 26px;
    margin: 4px auto 0;
    border-radius: 50% 50% 45% 18%;
    background: radial-gradient(circle at 35% 28%, rgba(255, 228, 196, 0.82), rgba(255, 183, 140, 0.55));
    border: 1.5px solid rgba(255, 255, 255, 0.28);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    transform: rotate(-28deg);
}

.letter-tile {
    aspect-ratio: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    cursor: pointer;
    position: relative;
    min-width: 44px;
    min-height: 44px;
    overflow: hidden;
    -webkit-tap-highlight-color: transparent;
    isolation: isolate;
}

.letter-tile::before {
    display: none;
}

.letter-img {
    width: 108%;
    height: 108%;
    max-width: 108%;
    max-height: 108%;
    display: block;
    object-fit: contain;
    object-position: center bottom;
    image-rendering: auto;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
    background: transparent;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.2));
}

.letter-fallback {
    font-family: 'Arial', 'Helvetica Neue', sans-serif;
    font-size: clamp(26px, 9vw, 38px);
    font-weight: 900;
    line-height: 1;
    pointer-events: none;
    user-select: none;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.letter-fallback[data-candy="candy-pink"] { color: #ff6b9d; }
.letter-fallback[data-candy="candy-purple"] { color: #c084fc; }
.letter-fallback[data-candy="candy-blue"] { color: #60a5fa; }
.letter-fallback[data-candy="candy-green"] { color: #4ade80; }
.letter-fallback[data-candy="candy-yellow"] { color: #fbbf24; }
.letter-fallback[data-candy="candy-orange"] { color: #fb923c; }
.letter-fallback[data-candy="candy-red"] { color: #f87171; }

.letter-tile:hover .letter-img {
    transform: scale(1.2);
}

.letter-tile.pressing .letter-img,
.letter-tile:active:not(.selected) .letter-img {
    transform: scale(0.82);
    transition-duration: 0.1s;
    transition-timing-function: ease-in;
}

.letter-tile.selected .letter-img {
    transform: scale(1.1) translateY(-3px);
    filter: drop-shadow(0 4px 12px rgba(255, 255, 255, 0.45));
    animation: letter-selected-bounce 0.55s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes letter-selected-bounce {
    0% { transform: scale(1) translateY(0); }
    45% { transform: scale(1.22) translateY(-5px); }
    100% { transform: scale(1.1) translateY(-3px); }
}

.letter-tile.hint .letter-img {
    animation: hint-pulse 0.5s ease-in-out infinite;
    filter: drop-shadow(0 0 14px rgba(251, 191, 36, 0.9));
}

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

.letter-tile.matched .letter-img {
    animation: match-pop 0.4s ease forwards;
}

@keyframes match-pop {
    0% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.8; }
    100% { transform: scale(0); opacity: 0; }
}

.letter-tile.crushing .letter-img {
    animation: crush-shake 0.4s ease forwards;
    transition: none;
}

@keyframes crush-shake {
    0% { transform: scale(1) rotate(0deg); opacity: 1; }
    20% { transform: scale(1.3) rotate(8deg); opacity: 1; }
    40% { transform: scale(1.4) rotate(-5deg); opacity: 0.9; }
    60% { transform: scale(0.6) rotate(5deg); opacity: 0.5; }
    80% { transform: scale(0.3) rotate(-3deg); opacity: 0.2; }
    100% { transform: scale(0) rotate(0deg); opacity: 0; }
}

.letter-tile.crumbled .letter-img {
    animation: crumble-away 0.8s ease forwards;
    transition: none;
}

@keyframes crumble-away {
    0% { transform: scale(1) translateY(0) rotate(0deg); opacity: 1; }
    30% { transform: scale(0.9) translateY(-5px) rotate(2deg); opacity: 0.7; }
    60% { transform: scale(0.5) translateY(10px) rotate(-5deg); opacity: 0.3; }
    100% { transform: scale(0) translateY(30px) rotate(10deg); opacity: 0; }
}

.selected-word {
    margin-bottom: 8px;
    width: 100%;
}

.word-slot {
    display: flex;
    gap: clamp(4px, 1.5vw, 8px);
    justify-content: center;
    flex-wrap: nowrap;
    width: 100%;
    max-width: 100%;
    margin: 0 auto;
    container-type: inline-size;
}

.slot {
    flex: 1 1 0;
    min-width: 18px;
    max-width: 45px;
    aspect-ratio: 1;
    width: auto;
    height: auto;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(11px, 11cqi, 24px);
    font-weight: 700;
    font-family: 'Arial', 'Helvetica Neue', sans-serif;
    letter-spacing: 1px;
    background: rgba(255, 255, 255, 0.05);
    border: 2px solid rgba(255, 255, 255, 0.2);
    color: #fff;
    transition: all 0.2s ease;
}

.slot.filled {
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    border-color: #60a5fa;
    box-shadow: 0 0 15px rgba(96, 165, 250, 0.5);
}

.slot.locked {
    background: rgba(255, 255, 255, 0.03);
    border-color: rgba(255, 255, 255, 0.1);
}

.slot.pending {
    border-color: rgba(251, 191, 36, 0.4);
    color: rgba(255, 255, 255, 0.45);
}

.slot.first-hint {
    background: linear-gradient(135deg, rgba(96, 165, 250, 0.35), rgba(59, 130, 246, 0.2));
    border-color: rgba(147, 197, 253, 0.55);
    color: #f8fafc;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.25);
}

.controls {
    display: flex;
    gap: 12px;
    justify-content: center;
    align-items: flex-start;
    margin-bottom: 20px;
    flex-wrap: wrap;
    touch-action: manipulation;
}

.controls .btn,
.full-reset .btn {
    font-family: 'Helvetica Neue', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
    font-size: 17px;
    letter-spacing: 0.02em;
    text-transform: none;
}

.hint-wrapper {
    position: relative;
    display: inline-flex;
}

.hint-note {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 4px;
    font-size: 10px;
    color: rgba(255, 255, 255, 0.4);
    white-space: nowrap;
    pointer-events: none;
}

.btn {
    padding: 14px 28px;
    border-radius: 12px;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    cursor: pointer;
    transition: all 0.2s ease;
    border: none;
    font-family: 'Orbitron', sans-serif;
}

.btn-primary {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #0f0f23;
    box-shadow: 0 4px 15px rgba(74, 222, 128, 0.4);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(74, 222, 128, 0.5);
}

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

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: translateY(-2px);
}

.btn-hint {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    color: #0f0f23;
    box-shadow: 0 4px 15px rgba(251, 191, 36, 0.4);
}

.btn-hint:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(251, 191, 36, 0.5);
}

.btn-answer {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: white;
    box-shadow: 0 4px 15px rgba(248, 113, 113, 0.4);
}

.btn-answer:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(248, 113, 113, 0.5);
}

.btn-reset {
    background: linear-gradient(135deg, #6b7280, #4b5563);
    color: white;
    box-shadow: 0 4px 15px rgba(107, 114, 128, 0.4);
}

.btn-reset:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(107, 114, 128, 0.5);
}

.full-reset {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    align-items: center;
    text-align: center;
    padding: 12px 0 24px;
}

.feedback {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    padding: 20px 40px;
    border-radius: 16px;
    font-size: 24px;
    font-weight: 900;
    text-transform: uppercase;
    z-index: 100;
    transition: transform 0.3s ease;
    pointer-events: none;
}

.feedback.show {
    transform: translate(-50%, -50%) scale(1);
}

.feedback.correct {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    color: #0f0f23;
    box-shadow: 0 0 30px rgba(74, 222, 128, 0.6);
}

.feedback.wrong {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff;
    box-shadow: 0 0 30px rgba(248, 113, 113, 0.6);
}

.particles {
    --firework-duration: 1.65s;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 2000;
    overflow: visible;
}

.particle {
    position: absolute;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    animation: particle-explode 0.8s ease forwards;
}

.mega-particle {
    border-radius: 50%;
    box-shadow: 0 0 16px rgba(255, 255, 255, 0.9), 0 0 32px rgba(96, 165, 250, 0.5);
    animation: firework-explode var(--firework-duration, 1.65s) cubic-bezier(0.14, 0.72, 0.22, 1) forwards;
    will-change: transform, opacity;
    z-index: 2001;
}

.firework-spark {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
    box-shadow: none;
    filter: none;
    animation: firework-spark-fly var(--firework-duration, 1.65s) cubic-bezier(0.14, 0.72, 0.22, 1) forwards;
    will-change: transform, opacity;
    z-index: 2001;
}

.screen-blast-flash {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 998;
    opacity: 0;
    background: radial-gradient(circle at center, rgba(255, 255, 255, 0.65) 0%, rgba(192, 132, 252, 0.35) 18%, rgba(96, 165, 250, 0.2) 40%, rgba(15, 15, 35, 0) 78%);
    transition: opacity 0.12s ease;
}

.screen-blast-flash.show {
    opacity: 1;
    animation: blast-flash-fade 0.42s ease-out forwards;
}

.screen-blast-flash.soft.show {
    animation-duration: 0.58s;
}

.screen-blast-flash.soft {
    background: radial-gradient(
        circle at center,
        rgba(255, 255, 255, 0.28) 0%,
        rgba(192, 132, 252, 0.18) 22%,
        rgba(96, 165, 250, 0.1) 45%,
        rgba(15, 15, 35, 0) 72%
    );
}

@keyframes blast-flash-fade {
    0% { opacity: 0.92; }
    100% { opacity: 0; }
}

.crush-shard {
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    z-index: 100;
    will-change: transform, opacity;
    transition: transform 0.28s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.28s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.26);
    filter: saturate(1.1) brightness(1.02);
}

.dust-particle {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 99;
    background: rgba(226, 232, 240, 0.7);
    animation: dust-fly 0.5s ease-out forwards;
}

@keyframes dust-fly {
    0% {
        transform: translate(0, 0) scale(1);
        opacity: 0.8;
    }
    100% {
        transform: translate(var(--dx), var(--dy)) scale(0.25);
        opacity: 0;
    }
}

@keyframes particle-explode {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    100% {
        transform: scale(0) translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

.game-over {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.game-over.show {
    opacity: 1;
    visibility: visible;
}

.game-over-content {
    text-align: center;
    background: rgba(26, 26, 46, 0.9);
    padding: 40px 60px;
    border-radius: 20px;
    border: 2px solid #f87171;
    box-shadow: 0 0 40px rgba(248, 113, 113, 0.3);
}

.game-over-content h2 {
    font-size: 36px;
    font-weight: 900;
    color: #f87171;
    margin-bottom: 20px;
}

.game-over-content p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.game-over-content p:nth-child(3) {
    color: #4ade80;
    font-weight: 700;
    font-size: 28px;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.4),
        0 0 10px rgba(74, 222, 128, 0.5);
    font-family: 'Arial', 'Helvetica Neue', sans-serif;
}

.game-over-stats {
    white-space: nowrap;
    font-size: 16px !important;
    color: rgba(255, 255, 255, 0.7) !important;
}

.game-over-stats span {
    color: #4ade80;
    font-weight: 700;
    font-size: 18px;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.4),
        0 0 10px rgba(74, 222, 128, 0.5);
    font-family: 'Arial', 'Helvetica Neue', sans-serif;
}

@media (max-width: 600px) {
    html, body {
        height: 100%;
        overflow: hidden;
    }

    .game-container {
        height: 100dvh;
        max-height: 100dvh;
        overflow-y: auto;
        overflow-x: hidden;
        -webkit-overflow-scrolling: touch;
        overscroll-behavior-y: contain;
        padding: 12px 12px calc(24px + env(safe-area-inset-bottom, 0px));
    }

    .game-container.scroll-locked {
        overflow: hidden;
        touch-action: none;
    }

    .game-header {
        padding-right: 0;
        gap: 6px 6px;
        margin-bottom: 10px;
        grid-template-columns: 1fr auto 1fr;
        grid-template-rows: auto auto;
    }

    .header-switch-bank {
        grid-column: 2;
        grid-row: 1;
        justify-self: center;
        align-self: center;
        padding: 8px 14px;
        font-size: 15px;
        font-weight: 700;
        border-radius: 12px;
    }

    .score-panel {
        grid-column: 1;
        grid-row: 1;
        justify-self: start;
    }

    .word-progress {
        grid-column: 3;
        grid-row: 1;
        justify-self: end;
        font-size: 14px;
        padding: 5px 10px;
        margin-right: 42px;
    }

    .level-display {
        font-size: 15px;
        font-weight: 700;
        padding: 8px 12px;
        letter-spacing: 0.3px;
    }

    .score, .combo {
        padding: 6px 10px;
    }

    .score .label, .combo .label {
        font-size: 10px;
    }

    .input-mode-hint {
        font-size: 16px;
        font-weight: 600;
        margin-top: 10px;
        letter-spacing: 0.5px;
    }

    .guide-finger {
        width: 42px;
        height: 42px;
        opacity: 0.62;
    }

    .guide-finger::before {
        width: 32px;
        height: 32px;
    }

    .guide-trail-path {
        stroke: rgba(251, 191, 36, 0.5);
        stroke-width: 6;
    }

    .bgm-toggle-btn {
        width: 36px;
        height: 36px;
    }

    .bgm-toggle-btn svg {
        width: 20px;
        height: 20px;
    }

    .timer-container {
        transform: scale(0.88);
        transform-origin: center;
    }

    .hint-section {
        margin-bottom: 6px;
    }
    
    .chinese-hint {
        font-size: 28px;
        margin-bottom: 6px;
    }

    .chinese-hint .pos-tag {
        display: inline;
        font-size: 0.78em;
        margin-right: 0.35em;
        opacity: 0.9;
    }

    .chinese-hint .chinese-main {
        display: inline;
        line-height: 1.25;
    }

    .english-hint {
        font-size: 17px;
        margin-top: 2px;
        margin-bottom: 8px;
        line-height: 1.35;
        display: -webkit-box;
        -webkit-line-clamp: 2;
        -webkit-box-orient: vertical;
        overflow: hidden;
        color: rgba(226, 232, 240, 0.88);
    }

    .letter-matrix {
        gap: 4px;
        padding: 8px;
        margin-bottom: 10px;
        min-height: 0;
    }

    .letter-tile {
        min-width: 36px;
        min-height: 36px;
    }
    
    .letter-img {
        width: 108%;
        height: 108%;
        max-width: 108%;
        max-height: 108%;
    }
    
    .slot {
        min-width: 16px;
        max-width: 35px;
        font-size: clamp(10px, 10cqi, 18px);
    }

    .controls {
        gap: 8px;
        margin-bottom: 12px;
    }
    
    .btn {
        padding: 11px 16px;
        font-size: 12px;
    }

    .controls .btn,
    .full-reset .btn {
        font-size: 16px;
        padding: 13px 18px;
        min-height: 48px;
    }

    .hint-note {
        font-size: 11px;
    }

    .full-reset {
        padding: 8px 0 16px;
    }

    .crush-shard {
        transition: transform 0.22s cubic-bezier(0.25, 0.46, 0.45, 0.94), opacity 0.22s ease;
    }

    .particles {
        --firework-duration: 2.4s;
    }

    .screen-blast-flash.soft.show {
        animation-duration: 0.72s;
    }
}

/* 答案弹窗样式 */
.answer-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.answer-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 40px rgba(74, 222, 128, 0.3);
    border: 2px solid #4ade80;
}

.answer-content h3 {
    color: #4ade80;
    font-size: 24px;
    margin-bottom: 20px;
}

.answer-content .chinese {
    font-size: 28px;
    color: #fff;
    margin-bottom: 10px;
    line-height: 1.35;
}

.answer-content .answer-pos-tag {
    font-size: 0.82em;
    font-weight: 700;
    opacity: 0.9;
    margin-right: 0.25em;
}

.answer-english-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin-bottom: 25px;
}

.answer-english-row .english {
    margin: 0;
}

.answer-content .english {
    font-size: 36px;
    font-weight: 700;
    color: #e8d9a8;
    letter-spacing: 1px;
    text-shadow: 
        0 2px 4px rgba(0, 0, 0, 0.3),
        0 0 10px rgba(232, 217, 168, 0.4);
    font-family: 'Helvetica Neue', 'Arial', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.answer-wrong-bank-note {
    font-size: 16px;
    color: rgba(251, 191, 36, 0.95);
    margin: -8px 0 22px;
    line-height: 1.45;
    font-family: 'PingFang SC', 'Microsoft YaHei', 'Helvetica Neue', sans-serif;
    font-weight: 600;
}

.btn-speak {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 2px solid rgba(96, 165, 250, 0.5);
    border-radius: 50%;
    background: rgba(96, 165, 250, 0.15);
    color: #93c5fd;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, transform 0.15s ease, box-shadow 0.2s ease;
}

.btn-speak:hover {
    background: rgba(96, 165, 250, 0.35);
    color: #dbeafe;
    box-shadow: 0 0 12px rgba(96, 165, 250, 0.45);
}

.btn-speak:active,
.btn-speak.speaking {
    transform: scale(0.94);
    background: rgba(96, 165, 250, 0.5);
    color: #fff;
}

.btn-speak .speak-icon {
    width: 22px;
    height: 22px;
}

.answer-content #skip-next-btn {
    font-size: 22px;
    padding: 18px 40px;
    letter-spacing: 2px;
}

/* 确认弹窗 */
.confirm-popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: fadeIn 0.3s ease;
}

.confirm-content {
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 0 40px rgba(248, 113, 113, 0.3);
    border: 2px solid #f87171;
    max-width: 420px;
}

.confirm-content h3 {
    color: #f87171;
    font-size: 24px;
    margin-bottom: 16px;
}

.confirm-content p {
    color: #cbd5e1;
    font-size: 16px;
    line-height: 1.6;
    margin-bottom: 28px;
}

.confirm-buttons {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.confirm-buttons .btn {
    min-width: 100px;
}

/* 关卡升级弹窗 */
.level-up {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.level-up.show {
    opacity: 1;
    visibility: visible;
}

.level-up-content {
    text-align: center;
    background: rgba(26, 26, 46, 0.9);
    padding: 40px 60px;
    border-radius: 20px;
    border: 2px solid #60a5fa;
    box-shadow: 0 0 40px rgba(96, 165, 250, 0.3);
    animation: victory-border-pulse 1.5s ease-in-out infinite;
}

.level-up-content h2 {
    font-size: 36px;
    font-weight: 900;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 20px;
}

.level-up-content p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.level-up-content p span {
    color: #60a5fa;
    font-weight: 700;
    font-size: 28px;
}

.level-up-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
    margin-bottom: 20px;
}

.level-up-sub span {
    font-size: 18px !important;
    color: #fbbf24 !important;
}

/* 等级通关弹窗 */
.level-victory,
.game-complete {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(15, 15, 35, 0.95);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.level-victory.show,
.game-complete.show {
    opacity: 1;
    visibility: visible;
}

.level-victory-content,
.game-complete-content {
    text-align: center;
    background: rgba(26, 26, 46, 0.9);
    padding: 40px 60px;
    border-radius: 20px;
    border: 2px solid;
    animation: victory-border-pulse 1.5s ease-in-out infinite;
}

.level-victory-content {
    border-color: #4ade80;
    box-shadow: 0 0 40px rgba(74, 222, 128, 0.3);
}

.game-complete-content {
    border-color: #fbbf24;
    box-shadow: 0 0 40px rgba(251, 191, 36, 0.3);
}

@keyframes victory-border-pulse {
    0%, 100% { box-shadow: 0 0 20px var(--shadow-color, rgba(74, 222, 128, 0.3)); }
    50% { box-shadow: 0 0 60px var(--shadow-color, rgba(74, 222, 128, 0.6)); }
}

.level-victory-content h2,
.game-complete-content h2 {
    font-size: 36px;
    font-weight: 900;
    margin-bottom: 20px;
}

.level-victory-content h2 {
    background: linear-gradient(135deg, #4ade80, #22c55e);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-complete-content h2 {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.level-victory-content p,
.game-complete-content p {
    font-size: 18px;
    color: rgba(255, 255, 255, 0.7);
    margin-bottom: 10px;
}

.level-victory-content p span {
    color: #4ade80;
    font-weight: 700;
    font-size: 28px;
}

.game-complete-content p span {
    color: #fbbf24;
    font-weight: 700;
    font-size: 28px;
}

.level-victory-sub,
.game-complete-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    margin-top: 4px;
}

.firework-particle {
    border-radius: 50%;
    animation: firework-explode var(--firework-duration, 1.65s) cubic-bezier(0.14, 0.72, 0.22, 1) forwards;
    will-change: transform, opacity;
}

@keyframes firework-explode {
    0% {
        transform: scale(1) translate(0, 0);
        opacity: 1;
    }
    20% {
        transform: scale(0.95) translate(calc(var(--tx) * 0.12), calc(var(--ty) * 0.12));
        opacity: 1;
    }
    65% {
        transform: scale(0.45) translate(calc(var(--tx) * 0.75), calc(var(--ty) * 0.75));
        opacity: 0.85;
    }
    100% {
        transform: scale(0.08) translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

@keyframes firework-spark-fly {
    0% {
        transform: scale(0.7) translate(0, 0);
        opacity: 1;
    }
    25% {
        transform: scale(0.55) translate(calc(var(--tx) * 0.15), calc(var(--ty) * 0.15));
        opacity: 0.95;
    }
    100% {
        transform: scale(0.15) translate(var(--tx), var(--ty));
        opacity: 0;
    }
}

.bank-picker {
    position: fixed;
    inset: 0;
    background: rgba(15, 15, 35, 0.97);
    backdrop-filter: blur(12px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
    padding: 20px;
    box-sizing: border-box;
}

.bank-picker.show {
    opacity: 1;
    visibility: visible;
}

.bank-picker-content {
    width: min(480px, 100%);
    background: rgba(26, 26, 46, 0.95);
    border: 2px solid rgba(99, 102, 241, 0.5);
    border-radius: 20px;
    padding: 28px 24px 24px;
    box-shadow: 0 0 50px rgba(99, 102, 241, 0.25);
    text-align: center;
}

.bank-picker-content h2 {
    font-size: 28px;
    font-weight: 900;
    margin: 0 0 8px;
    background: linear-gradient(135deg, #a5b4fc, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.bank-picker-sub {
    font-size: 14px;
    color: rgba(255, 255, 255, 0.55);
    margin: 0 0 20px;
    line-height: 1.5;
}

.bank-picker-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 20px;
    max-height: min(52vh, 420px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.bank-picker-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 2px solid rgba(255, 255, 255, 0.08);
    background: rgba(15, 15, 35, 0.6);
    color: #fff;
    cursor: pointer;
    text-align: left;
    transition: border-color 0.2s ease, background 0.2s ease, transform 0.15s ease;
}

.bank-picker-item:hover {
    border-color: rgba(99, 102, 241, 0.45);
    background: rgba(99, 102, 241, 0.12);
}

.bank-picker-item.selected {
    border-color: #818cf8;
    background: rgba(99, 102, 241, 0.22);
    box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.bank-picker-name {
    font-size: 17px;
    font-weight: 700;
    color: #e0e7ff;
}

.bank-picker-meta {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.55);
    line-height: 1.4;
}

.bank-picker-confirm {
    width: 100%;
    font-size: 18px;
    padding: 14px 24px;
}

.bank-picker-confirm:disabled {
    opacity: 0.65;
    cursor: wait;
}

@media (max-width: 600px) {
    .bank-picker-content {
        padding: 22px 16px 18px;
    }

    .bank-picker-content h2 {
        font-size: 24px;
    }

    .bank-picker-item {
        padding: 12px 14px;
    }

    .bank-picker-name {
        font-size: 16px;
    }
}