/* ========== 基础样式和变量 ========== */
:root {
    --primary-color: #667eea;
    --primary-dark: #5a67d8;
    --secondary-color: #764ba2;
    --accent-color: #f093fb;
    --success-color: #4ade80;
    --warning-color: #fbbf24;
    --danger-color: #f87171;
    --bg-dark: #0f0f23;
    --bg-card: rgba(30, 30, 60, 0.9);
    --bg-card-light: rgba(50, 50, 100, 0.8);
    --text-primary: #ffffff;
    --text-secondary: #a0a0c0;
    --text-muted: #606080;
    --border-color: rgba(255, 255, 255, 0.1);
    --shadow-glow: 0 0 30px rgba(102, 126, 234, 0.5);
    --gradient-main: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    --gradient-gold: linear-gradient(135deg, #fbbf24 0%, #f59e0b 100%);
    --gradient-success: linear-gradient(135deg, #4ade80 0%, #22c55e 100%);
    --gradient-danger: linear-gradient(135deg, #f87171 0%, #ef4444 100%);
}

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

html, body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background: var(--bg-dark);
    color: var(--text-primary);
}

#app {
    width: 100%;
    height: 100%;
    position: relative;
    background: 
        radial-gradient(ellipse at top, rgba(102, 126, 234, 0.15) 0%, transparent 50%),
        radial-gradient(ellipse at bottom, rgba(118, 75, 162, 0.15) 0%, transparent 50%),
        var(--bg-dark);
}

/* ========== 屏幕切换 ========== */
/* 修复布局：强制竖直流式布局 */
.screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.5s ease, visibility 0.5s ease;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.screen.active {
    opacity: 1 !important;
    visibility: visible !important;
    z-index: 10;
    display: flex !important;
}

/* ========== 开始界面 ========== */
#start-screen {
    display: flex;
    flex-direction: column;
    align-items: center !important;
    justify-content: center;
    background: 
        radial-gradient(ellipse at center, rgba(102, 126, 234, 0.2) 0%, transparent 60%),
        var(--bg-dark);
}

.title-container {
    position: relative;
    text-align: center;
    margin-bottom: 60px;
}

.game-title {
    font-size: 3rem;
    font-weight: bold;
    text-shadow: 0 0 30px rgba(102, 126, 234, 0.8);
    animation: titleGlow 2s ease-in-out infinite;
}

.game-title .title-jp {
    display: block;
    font-size: 4rem;
    background: var(--gradient-main);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.game-title .title-cn {
    display: block;
    font-size: 2rem;
    color: var(--text-secondary);
    margin-top: 10px;
}

@keyframes titleGlow {
    0%, 100% { text-shadow: 0 0 30px rgba(102, 126, 234, 0.8); }
    50% { text-shadow: 0 0 50px rgba(102, 126, 234, 1); }
}

.title-decoration {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    height: 100px;
    pointer-events: none;
}

.sakura {
    position: absolute;
    font-size: 24px;
    animation: sakuraFall 3s ease-in-out infinite;
    opacity: 0.8;
}

.sakura1 { left: 0; animation-delay: 0s; }
.sakura2 { left: 50px; animation-delay: 0.5s; }
.sakura3 { right: 50px; animation-delay: 1s; }
.sakura4 { right: 0; animation-delay: 1.5s; }

@keyframes sakuraFall {
    0%, 100% { transform: translateY(0) rotate(0deg); opacity: 0.8; }
    50% { transform: translateY(30px) rotate(180deg); opacity: 0.4; }
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 18px;
    width: min(320px, 90vw);
    align-items: center;
    padding: 0 20px;
    margin: 0 auto;
}

.menu-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
    min-height: 58px;
    padding: 16px 24px;
    font-size: 1.1rem;
    font-weight: bold;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 999px;
    cursor: pointer;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.menu-btn:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
    border-color: var(--primary-color);
}

.menu-btn:active {
    transform: translateY(-2px);
}

.btn-icon {
    font-size: 1.5rem;
}

.player-preview {
    position: absolute;
    bottom: 40px;
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px 25px;
    background: var(--bg-card);
    border-radius: 50px;
    border: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
}

.avatar-frame {
    width: 50px;
    height: 50px;
    border-radius: 50%;
    overflow: hidden;
    border: 2px solid var(--primary-color);
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.5);
}

.avatar-frame .avatar {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-info-mini {
    display: flex;
    flex-direction: column;
}

.player-name {
    font-weight: bold;
    color: var(--text-primary);
}

.player-level {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

/* ========== 通用头部 ========== */
.screen-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    backdrop-filter: blur(10px);
    position: sticky;
    top: 0;
    z-index: 100;
    width: 100%;
    max-width: 100%;
}

.screen-header h2 {
    font-size: 1.3rem;
    color: var(--text-primary);
    margin: 0;
    flex-shrink: 0;
}

.back-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 15px;
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-primary);
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.back-btn:hover {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.header-spacer {
    flex: 1;
    min-width: 80px;
}

.header-progress {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.progress-bar {
    width: 100px;
    height: 8px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 4px;
    overflow: hidden;
}

.progress-fill {
    height: 100%;
    background: var(--gradient-main);
    border-radius: 4px;
    transition: width 0.5s ease;
}

/* ========== 地图选择界面 ========== */
.map-list {
    flex: 1;
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 20px;
    overflow-y: auto;
}

.map-card {
    position: relative;
    padding: 25px;
    background: var(--bg-card);
    border: 2px solid var(--border-color);
    border-radius: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    overflow: hidden;
}

.map-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--gradient-main);
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 0;
}

.map-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-glow);
}

.map-card:hover::before {
    opacity: 0.1;
}

.map-card.locked {
    opacity: 0.6;
    cursor: not-allowed;
}

.map-card-content {
    position: relative;
    z-index: 1;
}

.map-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 15px;
}

.map-card-title {
    font-size: 1.3rem;
    font-weight: bold;
}

.map-card-icon {
    font-size: 2.5rem;
    width: 88px;
    height: 58px;
    flex: 0 0 88px;
    overflow: hidden;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.12);
}

.map-card-icon img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.map-card-stats {
    display: flex;
    gap: 20px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.map-card-lock {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 4rem;
    z-index: 2;
}

/* ========== 地图界面 ========== */
.map-container {
    flex: 1;
    position: relative;
    padding: 0;
    overflow-y: auto;
}

/* 悬浮在地图右上角的轻量音乐开关，不占用手机顶部标题栏空间。 */
.map-bgm-toggle {
    position: absolute;
    top: 88px;
    right: 14px;
    z-index: 101;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, 0.65);
    border-radius: 50%;
    background: rgba(15, 23, 42, 0.76);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.3);
    color: #fff;
    cursor: pointer;
    font-size: 0.95rem;
}

.map-bgm-toggle.muted {
    opacity: 0.72;
    background: rgba(51, 65, 85, 0.88);
}

/* 地图中的关卡按相对坐标定位，确保不同手机宽度下仍保持路线关系。 */
.level-map-path {
    position: relative;
    z-index: 1;
    min-height: max(620px, calc(100vh - 76px));
}

.map-stage-node {
    position: absolute;
    z-index: 2;
    width: 90px;
    height: 112px;
    padding: 0;
    border: 0;
    color: #fff;
    background: transparent;
    transform: translate(-50%, -50%);
    cursor: pointer;
    font: inherit;
    text-align: center;
    transition: transform 0.2s ease, filter 0.2s ease;
}

.map-stage-node:not(:disabled):hover,
.map-stage-node:not(:disabled):focus-visible {
    transform: translate(-50%, -50%) scale(1.02);
    filter: brightness(1.12);
    outline: none;
}

.map-stage-node:not(:disabled):active {
    transform: translate(-50%, -50%) scale(0.98);
}

.stage-emblem {
    width: 82px;
    height: 82px;
    margin: 0 auto 7px;
    display: block;
    position: relative;
}

.stage-castle {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    filter: drop-shadow(0 5px 5px rgba(15, 23, 42, 0.4));
}

.stage-emblem-mark {
    position: absolute;
    top: 2px;
    right: -3px;
    z-index: 2;
    min-width: 27px;
    height: 27px;
    padding: 0 4px;
    display: grid;
    place-items: center;
    border: 2px solid #fff;
    border-radius: 50%;
    background: #2563eb;
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.35);
    font-size: 0.92rem;
    font-weight: 800;
    line-height: 1;
    text-shadow: 0 2px 3px rgba(15, 23, 42, 0.45);
}

.stage-emblem-number {
    position: absolute;
    z-index: 2;
    bottom: 3px;
    left: 50%;
    transform: translateX(-50%);
    padding: 2px 5px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.72);
    font-size: 0.55rem;
    font-weight: 800;
    letter-spacing: 0.04em;
}

.stage-name {
    display: inline-block;
    max-width: 112px;
    padding: 4px 8px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.82);
    border: 1px solid rgba(255, 255, 255, 0.55);
    box-shadow: 0 2px 5px rgba(15, 23, 42, 0.28);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.map-stage-node.completed .stage-emblem-mark {
    background: #f59e0b;
}

.map-stage-node.current .stage-castle {
    animation: stageBeacon 1.5s ease-in-out infinite;
}

.map-stage-node.locked {
    cursor: not-allowed;
}

.map-stage-node.locked .stage-castle {
    opacity: 0.62;
    filter: grayscale(1) brightness(0.68) drop-shadow(0 5px 5px rgba(15, 23, 42, 0.4));
}

.map-stage-node.locked .stage-emblem-mark {
    top: 18px;
    right: 50%;
    transform: translateX(50%);
    min-width: 36px;
    height: 36px;
    background: #475569;
    font-size: 1.25rem;
}

.map-stage-node.locked .stage-name {
    background: rgba(30, 41, 59, 0.82);
    color: #cbd5e1;
}

@keyframes stageBeacon {
    0%, 100% { filter: drop-shadow(0 5px 5px rgba(15, 23, 42, 0.4)); }
    50% { filter: drop-shadow(0 5px 8px rgba(96, 165, 250, 0.85)); }
}

.level-path {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 60px;
    padding: 20px 0;
}

.level-path::before {
    content: '';
    position: absolute;
    top: 50px;
    left: 50%;
    transform: translateX(-50%);
    width: 4px;
    height: calc(100% - 100px);
    background: linear-gradient(to bottom, var(--primary-color), var(--secondary-color));
    border-radius: 2px;
    z-index: 0;
}

.level-node {
    position: relative;
    z-index: 1;
    cursor: pointer;
    transition: all 0.3s ease;
}

.level-node.locked {
    cursor: not-allowed;
    opacity: 0.6;
}

.level-node.completed {
    filter: drop-shadow(0 0 15px var(--success-color));
}

.level-node.current {
    animation: levelPulse 1.5s ease-in-out infinite;
}

@keyframes levelPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.level-circle {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: var(--bg-card);
    border: 3px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: bold;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.level-node.completed .level-circle {
    background: var(--gradient-success);
    border-color: var(--success-color);
}

.level-node.current .level-circle {
    background: var(--gradient-main);
    border-color: var(--primary-color);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.6);
}

.level-node.locked .level-circle {
    background: rgba(0, 0, 0, 0.3);
}

.level-lock {
    font-size: 1.5rem;
}

.level-label {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 10px;
    padding: 5px 15px;
    background: var(--bg-card);
    border-radius: 15px;
    font-size: 0.85rem;
    white-space: nowrap;
    border: 1px solid var(--border-color);
}

.level-stars {
    position: absolute;
    top: -25px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 3px;
}

.level-star {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.level-star.earned {
    color: var(--warning-color);
    text-shadow: 0 0 10px var(--warning-color);
}

/* ========== 答题界面 ========== */
.quiz-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    padding: 15px 20px;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-color);
    width: 100%;
    max-width: 100%;
}

.quiz-info {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.level-name {
    font-weight: bold;
    color: var(--primary-color);
}

.question-counter {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.quiz-timer {
    position: relative;
}

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

.timer-circle svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.timer-bg {
    fill: none;
    stroke: rgba(255, 255, 255, 0.1);
    stroke-width: 8;
}

.timer-progress {
    fill: none;
    stroke: var(--primary-color);
    stroke-width: 8;
    stroke-linecap: round;
    stroke-dasharray: 283;
    stroke-dashoffset: 0;
    transition: stroke-dashoffset 1s linear;
}

.timer-circle.warning .timer-progress {
    stroke: var(--warning-color);
}

.timer-circle.danger .timer-progress {
    stroke: var(--danger-color);
}

.timer-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.1rem;
    font-weight: bold;
}

.quiz-score {
    text-align: right;
}

.score-label {
    display: block;
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.score-value {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--warning-color);
}

.quiz-body {
    flex: 1;
    overflow-y: auto;
    padding: 20px;
}

.question-card {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 25px;
    border: 1px solid var(--border-color);
    margin-bottom: 20px;
}

.question-type {
    display: inline-block;
    padding: 5px 15px;
    background: var(--gradient-main);
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: bold;
    margin-bottom: 20px;
}

.question-content {
    font-size: 1.2rem;
    line-height: 1.8;
    margin-bottom: 25px;
    color: var(--text-primary);
}

.reading-passage {
    margin-bottom: 22px;
    white-space: pre-line;
    font-size: 1rem;
    line-height: 1.9;
    text-align: left;
}

.question-prompt {
    font-weight: 700;
}

.speech-reference {
    max-height: 330px;
    overflow-y: auto;
    padding: 18px;
    margin-bottom: 12px;
    white-space: pre-line;
    line-height: 1.8;
    font-size: 0.95rem;
    color: var(--text-primary);
    background: rgba(102, 126, 234, 0.09);
    border: 1px solid rgba(102, 126, 234, 0.32);
    border-radius: 14px;
}

.speech-reference-hint {
    margin: 0 0 4px;
    text-align: center;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.assessment-script {
    line-height: 1.9;
    font-size: 1rem;
}

.assessment-mic-status {
    display: none;
    margin: 0 0 14px;
    color: var(--danger-color);
    font-size: 0.95rem;
    font-weight: 700;
}

.assessment-mic-status.visible {
    display: block;
}

.assessment-line {
    margin: 0 0 10px;
    padding: 4px 8px;
    border-radius: 8px;
    transition: background 0.25s ease, color 0.25s ease;
}

.assessment-line.active {
    background: rgba(102, 126, 234, 0.2);
    color: var(--text-primary);
}

.assessment-line.player-turn {
    background: rgba(251, 191, 36, 0.27);
    color: #f59e0b;
    box-shadow: inset 3px 0 0 #f59e0b;
}

.question-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.option-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 18px 20px;
    background: var(--bg-card-light);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    color: #fff;
}

.option-item:hover {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.1);
}

.option-item.selected {
    border-color: var(--primary-color);
    background: rgba(102, 126, 234, 0.2);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.option-item.correct {
    border-color: var(--success-color);
    background: rgba(74, 222, 128, 0.2);
}

.option-item.wrong {
    border-color: var(--danger-color);
    background: rgba(248, 113, 113, 0.2);
}

.option-checkbox {
    width: 24px;
    height: 24px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.option-item.selected .option-checkbox {
    border-color: var(--primary-color);
    background: var(--primary-color);
}

.option-item.selected .option-checkbox::after {
    content: '✓';
    color: white;
    font-size: 14px;
}

.option-text {
    flex: 1;
    color: #fff;
}

.question-input {
    margin-top: 20px;
}

.input-field {
    width: 100%;
    padding: 15px 20px;
    font-size: 1.1rem;
    background: var(--bg-card-light);
    border: 2px solid var(--border-color);
    border-radius: 15px;
    color: var(--text-primary);
    outline: none;
    transition: all 0.3s ease;
}

.input-field:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 20px rgba(102, 126, 234, 0.3);
}

.voice-input {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 20px;
    padding: 30px;
}

.voice-btn {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    background: var(--gradient-main);
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    transition: all 0.3s ease;
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.voice-btn:hover {
    transform: scale(1.1);
}

.voice-btn.recording {
    animation: voicePulse 1s ease-in-out infinite;
    background: var(--gradient-danger);
}

@keyframes voicePulse {
    0%, 100% { transform: scale(1); box-shadow: 0 10px 30px rgba(248, 113, 113, 0.4); }
    50% { transform: scale(1.1); box-shadow: 0 10px 50px rgba(248, 113, 113, 0.6); }
}

.voice-status {
    font-size: 1rem;
    color: var(--text-secondary);
}

.ai-evaluation {
    width: 100%;
    margin-top: 12px;
    padding: 16px;
    color: var(--text-primary);
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: 16px;
}

.ai-evaluation-title {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-weight: 700;
    color: var(--primary-color);
}

.ai-evaluation-title span {
    color: var(--warning-color);
}

.radar-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    margin: 10px 0;
}

.speech-radar {
    width: 155px;
    height: 155px;
    overflow: visible;
}

.speech-radar line {
    stroke: rgba(148, 163, 184, 0.45);
    stroke-width: 1;
}

.radar-grid {
    fill: none;
    stroke: rgba(148, 163, 184, 0.5);
    stroke-width: 1;
}

.radar-score {
    fill: rgba(102, 126, 234, 0.35);
    stroke: var(--primary-color);
    stroke-width: 3;
}

.radar-labels {
    display: flex;
    flex-direction: column;
    gap: 5px;
    font-size: 0.76rem;
    color: var(--text-secondary);
}

.radar-labels b {
    color: var(--primary-color);
}

.ai-evaluation-analysis,
.recognized-text {
    margin: 8px 0 0;
    line-height: 1.65;
}

.evaluation-insights {
    display: grid;
    gap: 8px;
    margin: 14px 0 0;
    padding: 0;
    list-style: none;
}

.evaluation-insights li {
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding: 9px 11px;
    background: rgba(102, 126, 234, 0.08);
    border-radius: 10px;
    font-size: 0.84rem;
}

.evaluation-insights b {
    color: var(--primary-color);
}

.evaluation-insights span {
    color: var(--text-secondary);
    line-height: 1.45;
}

.recognized-text {
    padding-top: 8px;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.82rem;
    word-break: break-word;
}

@media (max-width: 420px) {
    .radar-wrap { align-items: flex-start; }
    .speech-radar { width: 130px; height: 130px; }
    .radar-labels { font-size: 0.7rem; }
}

.voice-wave {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    height: 40px;
}

.voice-bar {
    width: 6px;
    height: 10px;
    background: var(--primary-color);
    border-radius: 3px;
    animation: voiceWave 0.5s ease-in-out infinite;
}

.voice-bar:nth-child(1) { animation-delay: 0s; }
.voice-bar:nth-child(2) { animation-delay: 0.1s; }
.voice-bar:nth-child(3) { animation-delay: 0.2s; }
.voice-bar:nth-child(4) { animation-delay: 0.3s; }
.voice-bar:nth-child(5) { animation-delay: 0.4s; }

@keyframes voiceWave {
    0%, 100% { height: 10px; }
    50% { height: 40px; }
}

.answer-feedback {
    display: flex;
    gap: 20px;
    padding: 25px;
    background: var(--bg-card);
    border-radius: 20px;
    border: 2px solid;
    margin-bottom: 20px;
}

.answer-feedback.correct {
    border-color: var(--success-color);
    background: rgba(74, 222, 128, 0.1);
}

.answer-feedback.wrong {
    border-color: var(--danger-color);
    background: rgba(248, 113, 113, 0.1);
}

.answer-feedback.voice-evaluation {
    position: relative;
    display: block;
    padding: 25px;
}

.answer-feedback.voice-evaluation .feedback-icon {
    position: absolute;
    top: 18px;
    right: 20px;
    display: grid;
    width: 44px;
    height: 44px;
    place-items: center;
    font-size: 1.65rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    box-shadow: 0 5px 16px rgba(102, 126, 234, 0.2);
}

.answer-feedback.voice-evaluation .feedback-content {
    width: 100%;
}

.answer-feedback.voice-evaluation .feedback-title {
    padding-right: 54px;
}

.feedback-icon {
    font-size: 3rem;
    flex-shrink: 0;
}

.feedback-content {
    flex: 1;
}

.feedback-title {
    font-size: 1.3rem;
    font-weight: bold;
    margin-bottom: 10px;
}

.answer-feedback.correct .feedback-title {
    color: var(--success-color);
}

.answer-feedback.wrong .feedback-title {
    color: var(--danger-color);
}

.feedback-answer {
    padding: 10px 15px;
    background: var(--bg-card-light);
    border-radius: 10px;
    margin-bottom: 10px;
}

.feedback-explanation {
    color: var(--text-secondary);
    line-height: 1.6;
}

.quiz-footer {
    padding: 20px;
    background: var(--bg-card);
    border-top: 1px solid var(--border-color);
}

.quiz-btn {
    width: 100%;
    padding: 18px;
    font-size: 1.1rem;
    font-weight: bold;
    color: white;
    background: var(--gradient-main);
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.quiz-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 30px rgba(102, 126, 234, 0.4);
}

.quiz-btn:active {
    transform: translateY(-1px);
}

.quiz-btn.btn-next {
    background: var(--gradient-success);
}

.quiz-footer.voice-actions {
    display: flex;
    gap: 12px;
}

.quiz-footer.voice-actions .quiz-btn.voice-action {
    flex: 1;
    width: auto;
    padding: 14px 8px;
    font-size: 0.92rem;
}

.quiz-footer.voice-actions #btn-next {
    order: 1;
}

.quiz-footer.voice-actions #btn-submit {
    order: 2;
}

.recording-indicator {
    display: none;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 58px;
    padding: 12px 18px;
    overflow: hidden;
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.04em;
    background: linear-gradient(120deg, #8b5cf6, #ec4899, #f97316);
    border-radius: 18px;
    box-shadow: 0 8px 28px rgba(236, 72, 153, 0.38);
}

.recording-indicator.active {
    display: flex;
    animation: recordingGlow 1.4s ease-in-out infinite;
}

.recording-orb {
    display: grid;
    width: 34px;
    height: 34px;
    place-items: center;
    font-size: 1.25rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.22);
    animation: recordingOrb 1s ease-in-out infinite;
}

.recording-indicator i {
    width: 3px;
    height: 12px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 4px;
    animation: recordingWave 0.7s ease-in-out infinite alternate;
}

.recording-indicator i:nth-of-type(2) { height: 22px; animation-delay: 0.18s; }
.recording-indicator i:nth-of-type(3) { height: 16px; animation-delay: 0.36s; }

@keyframes recordingGlow {
    50% { box-shadow: 0 8px 36px rgba(139, 92, 246, 0.7); }
}

@keyframes recordingOrb {
    50% { transform: scale(1.14); }
}

@keyframes recordingWave {
    to { transform: scaleY(1.8); }
}

/* ========== 完成界面 ========== */
#level-complete-screen,
#map-complete-screen {
    display: flex;
    align-items: center !important;
    justify-content: center !important;
    background: rgba(0, 0, 0, 0.9);
    padding: 24px;
}

.complete-content,
.map-complete-content {
    width: min(430px, 100%);
    text-align: center;
    padding: 40px 28px;
    max-width: 430px;
    border-radius: 24px;
    background: rgba(30, 30, 60, 0.95);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.complete-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: bounceIn 0.8s ease;
}

@keyframes bounceIn {
    0% { transform: scale(0); }
    50% { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.complete-title {
    font-size: 2rem;
    margin-bottom: 30px;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.complete-stats {
    display: flex;
    justify-content: space-around;
    margin-bottom: 30px;
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 1.8rem;
    font-weight: bold;
    color: var(--primary-color);
}

.complete-stars {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-bottom: 30px;
    font-size: 2.5rem;
}

.complete-stars .star {
    color: var(--text-muted);
    transition: all 0.5s ease;
}

.complete-stars .star.earned {
    color: var(--warning-color);
    text-shadow: 0 0 20px var(--warning-color);
    animation: starEarn 0.5s ease forwards;
}

@keyframes starEarn {
    0% { transform: scale(0) rotate(-180deg); }
    100% { transform: scale(1) rotate(0deg); }
}

.complete-btn,
.map-complete-btn {
    padding: 18px 50px;
    font-size: 1.2rem;
    font-weight: bold;
    color: white;
    background: var(--gradient-main);
    border: none;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.complete-btn:hover,
.map-complete-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 10px 40px rgba(102, 126, 234, 0.5);
}

.map-complete-animation {
    position: relative;
    margin-bottom: 30px;
}

.trophy {
    font-size: 6rem;
    animation: trophyShine 2s ease-in-out infinite;
}

@keyframes trophyShine {
    0%, 100% { filter: drop-shadow(0 0 20px rgba(251, 191, 36, 0.5)); }
    50% { filter: drop-shadow(0 0 40px rgba(251, 191, 36, 1)); }
}

.confetti {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
}

.confetti-piece {
    position: absolute;
    width: 10px;
    height: 10px;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% { transform: translateY(-100px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(400px) rotate(720deg); opacity: 0; }
}

.map-complete-title {
    font-size: 2.5rem;
    margin-bottom: 10px;
    background: var(--gradient-gold);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.map-complete-subtitle {
    font-size: 1.2rem;
    color: var(--text-secondary);
    margin-bottom: 30px;
}

.map-complete-reward {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: 15px;
    margin-bottom: 30px;
    border: 2px solid var(--warning-color);
}

.reward-icon {
    font-size: 2.5rem;
}

.reward-text {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--warning-color);
}

/* ========== 仪表板 ========== */
.dashboard-content {
    padding: 20px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 25px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

.dashboard-section {
    background: var(--bg-card);
    border-radius: 20px;
    padding: 20px;
    border: 1px solid var(--border-color);
}

.section-title {
    font-size: 1.2rem;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.profile-card {
    display: flex;
    gap: 20px;
    align-items: center;
}

.profile-avatar {
    flex-shrink: 0;
}

.profile-avatar .avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    border: 3px solid var(--primary-color);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

.profile-info {
    flex: 1;
}

.profile-name {
    font-size: 1.5rem;
    margin-bottom: 5px;
}

.profile-level {
    color: var(--text-secondary);
    margin-bottom: 15px;
}

.profile-stats {
    display: flex;
    gap: 20px;
}

.profile-stat {
    display: flex;
    flex-direction: column;
}

.stat-num {
    font-size: 1.5rem;
    font-weight: bold;
    color: var(--primary-color);
}

.stat-desc {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

.leaderboard {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leaderboard-item {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 15px;
    background: var(--bg-card-light);
    border-radius: 15px;
    transition: all 0.3s ease;
}

.leaderboard-item:hover {
    transform: translateX(5px);
}

.leaderboard-rank {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    flex-shrink: 0;
}

.leaderboard-rank.rank-1 {
    background: var(--gradient-gold);
    color: #000;
}

.leaderboard-rank.rank-2 {
    background: linear-gradient(135deg, #c0c0c0, #a0a0a0);
    color: #000;
}

.leaderboard-rank.rank-3 {
    background: linear-gradient(135deg, #cd7f32, #b87333);
    color: #fff;
}

.leaderboard-rank.rank-other {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
}

.leaderboard-info {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 15px;
}

.leaderboard-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
}

.leaderboard-details {
    flex: 1;
}

.leaderboard-name {
    font-weight: bold;
    margin-bottom: 3px;
}

.leaderboard-score {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.leaderboard-points {
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--warning-color);
}

.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.chart-card {
    background: linear-gradient(135deg, rgba(80, 80, 140, 0.95), rgba(30, 30, 60, 0.95));
    border-radius: 16px;
    padding: 18px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.06), 0 10px 25px rgba(0, 0, 0, 0.2);
}

.chart-card h4 {
    margin-bottom: 12px;
    color: #e2e8f0;
    font-size: 0.95rem;
    font-weight: 600;
}

.chart-card canvas {
    width: 100% !important;
    height: 220px !important;
    display: block;
    background: rgba(8, 15, 35, 0.35);
    border-radius: 12px;
    padding: 6px;
}

/* ========== 设置界面 ========== */
.settings-content {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 25px;
}

.setting-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-color);
}

.setting-label {
    font-size: 1rem;
    color: var(--text-primary);
}

.setting-input,
.setting-select {
    padding: 12px 20px;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
}

.setting-input:focus,
.setting-select:focus {
    border-color: var(--primary-color);
}

.setting-toggle {
    display: flex;
    align-items: center;
}

.setting-toggle input[type="checkbox"] {
    display: none;
}

.toggle-switch {
    width: 60px;
    height: 32px;
    background: var(--bg-card-light);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    position: relative;
    cursor: pointer;
    transition: all 0.3s ease;
}

.toggle-switch::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: all 0.3s ease;
}

.setting-toggle input[type="checkbox"]:checked + .toggle-switch {
    background: var(--primary-color);
    border-color: var(--primary-color);
}

.setting-toggle input[type="checkbox"]:checked + .toggle-switch::after {
    left: 31px;
    background: white;
}

.setting-actions {
    display: flex;
    flex-direction: column;
    gap: 15px;
    margin-top: 20px;
}

.setting-btn {
    padding: 15px;
    font-size: 1rem;
    font-weight: bold;
    border: none;
    border-radius: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-save {
    background: var(--gradient-main);
    color: white;
}

.btn-reset {
    background: var(--bg-card-light);
    color: var(--danger-color);
    border: 1px solid var(--danger-color);
}

.setting-btn:hover {
    transform: translateY(-2px);
}

/* ========== 转场动画 ========== */
.transition-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
}

.transition-overlay.fade {
    background: rgba(0, 0, 0, 0.8);
    animation: fadeInOut 1s ease forwards;
}

.transition-overlay.slide {
    background: var(--gradient-main);
    animation: slideIn 0.5s ease forwards;
}

.transition-content {
    text-align: center;
}

.transition-icon {
    font-size: 5rem;
    margin-bottom: 20px;
    animation: transitionBounce 0.8s ease;
}

.transition-text {
    font-size: 2rem;
    font-weight: bold;
    color: white;
}

@keyframes fadeInOut {
    0% { opacity: 0; }
    50% { opacity: 1; }
    100% { opacity: 0; visibility: hidden; }
}

@keyframes slideIn {
    0% { transform: translateX(-100%); }
    50% { transform: translateX(0); }
    100% { transform: translateX(100%); visibility: hidden; }
}

@keyframes transitionBounce {
    0% { transform: scale(0) rotate(-180deg); }
    50% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0deg); }
}

/* ========== 响应式设计 ========== */
@media (max-width: 768px) {
    html, body {
        height: 100%;
        overflow-x: hidden;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    #app {
        height: 100%;
    }

    .screen {
        position: absolute;
        height: 100%;
        overflow-y: auto;
        overflow-x: hidden;
    }

    .game-title .title-jp {
        font-size: 2.5rem;
    }
    
    .game-title .title-cn {
        font-size: 1.5rem;
    }
    
    .menu-btn {
        padding: 15px 30px;
        font-size: 1rem;
    }
    
    .level-circle {
        width: 70px;
        height: 70px;
        font-size: 1.5rem;
    }
    
    .profile-card {
        flex-direction: column;
        text-align: center;
    }
    
    .profile-stats {
        justify-content: center;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 480px) {
    .game-title .title-jp {
        font-size: 2rem;
    }
    
    .complete-stats {
        flex-direction: column;
        gap: 20px;
    }
    
    .stat-item {
        flex-direction: row;
        justify-content: center;
        gap: 10px;
    }
}
