/* ============================================
   字母小英雄 - 打字学习游戏样式
   v2: 35关 + 阶段分组 + 大小写支持
   ============================================ */

/* ---------- 全局基础 ---------- */
.typing-app {
    position: relative;
    width: 100%;
    min-height: 100vh;
    overflow: hidden;
    user-select: none;
    -webkit-user-select: none;
    font-family: 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

/* ---------- 背景氛围 ---------- */
.typing-bg {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    background-size: 400% 400%;
    animation: bgShift 15s ease infinite;
}

@keyframes bgShift {
    0%   { background-position: 0% 50%; }
    50%  { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* 漂浮字母云朵 */
.floating-letters {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
    overflow: hidden;
}

.floating-letter {
    position: absolute;
    font-size: 2rem;
    opacity: 0.1;
    color: #fff;
    animation: cloudFloat linear infinite;
}

@keyframes cloudFloat {
    0%   { transform: translateX(-100px) translateY(0); }
    50%  { transform: translateX(50vw) translateY(-30px); }
    100% { transform: translateX(110vw) translateY(0); }
}

/* ---------- 顶部栏 ---------- */
.game-header {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255,255,255,0.2);
    min-height: 48px;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.2rem;
    cursor: pointer;
    border: none;
    transition: background 0.2s;
}
.btn-back:hover { background: rgba(255,255,255,0.35); }

.level-title {
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
    text-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* 分数环 */
.score-ring {
    position: relative;
    width: 48px; height: 48px;
}
.score-ring svg {
    transform: rotate(-90deg);
}
.score-ring-bg {
    fill: none;
    stroke: rgba(255,255,255,0.2);
    stroke-width: 4;
}
.score-ring-progress {
    fill: none;
    stroke-width: 4;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease, stroke 0.5s ease;
}
.score-ring-text {
    position: absolute;
    top: 50%; left: 50%;
    transform: translate(-50%, -50%);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 700;
}

/* 音效按钮 */
.btn-audio {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: rgba(255,255,255,0.2);
    color: #fff;
    border: none;
    cursor: pointer;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.btn-audio:hover { background: rgba(255,255,255,0.35); }
.btn-audio.muted { opacity: 0.5; }

/* ---------- 字符展示区 ---------- */
.char-display {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    padding: 40px 20px 20px;
    gap: 8px;
    min-height: 180px;
}

.char-item {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 56px; height: 56px;
    border-radius: 14px;
    font-size: 1.8rem;
    font-weight: 700;
    transition: all 0.3s ease;
    background: rgba(255,255,255,0.1);
    color: rgba(255,255,255,0.4);
}

.char-completed {
    background: rgba(46, 204, 113, 0.3);
    color: rgba(46, 204, 113, 0.8);
    transform: scale(0.9);
    animation: charComplete 0.4s ease;
}

@keyframes charComplete {
    0%   { transform: scale(1.2); opacity: 0.5; }
    100% { transform: scale(0.9); opacity: 1; }
}

.char-current {
    background: rgba(255,255,255,0.25);
    color: #fff;
    transform: scale(1.5);
    animation: breath 1.5s ease-in-out infinite;
    box-shadow: 0 0 20px rgba(255,255,255,0.3), 0 0 40px rgba(255,255,255,0.1);
}

@keyframes breath {
    0%, 100% { box-shadow: 0 0 20px rgba(255,255,255,0.3), 0 0 40px rgba(255,255,255,0.1); }
    50%      { box-shadow: 0 0 30px rgba(255,255,255,0.5), 0 0 60px rgba(255,255,255,0.2); }
}

.char-error {
    animation: errorBounce 0.3s ease;
    background: rgba(230, 126, 34, 0.5) !important;
    color: #e67e22 !important;
}

@keyframes errorBounce {
    0%   { transform: scale(1.5) translateY(0); }
    30%  { transform: scale(1.3) translateY(-10px); }
    60%  { transform: scale(1.6) translateY(5px); }
    100% { transform: scale(1.5) translateY(0); }
}

.char-pending {
    background: rgba(255,255,255,0.06);
    color: rgba(255,255,255,0.3);
}

/* ---------- 单词模式 ---------- */
.word-group {
    display: inline-flex;
    gap: 4px;
    margin: 0 10px;
    padding: 6px 8px;
    border-radius: 12px;
    background: rgba(255,255,255,0.05);
    transition: background 0.3s;
}
.word-group:has(.char-current) {
    background: rgba(255,255,255,0.12);
    box-shadow: 0 0 12px rgba(255,255,255,0.1);
}
.word-group:has(.char-completed):not(:has(.char-pending)) {
    background: rgba(46, 204, 113, 0.12);
}
.char-display.word-mode {
    gap: 4px;
    align-items: center;
}
.char-display.word-mode .char-item {
    width: 52px;
    height: 52px;
    font-size: 1.7rem;
    border-radius: 10px;
}
.char-display.word-mode .char-current {
    transform: scale(1.3);
}

/* ---------- 连击计数器 ---------- */
.combo-counter {
    position: relative;
    z-index: 10;
    text-align: center;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- 大小写模式提示 ---------- */
.case-mode-hint {
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 8px 0 4px;
    color: rgba(255,255,255,0.5);
    font-size: 1.2rem;
}
.case-mode-hint .active {
    color: #fff;
    font-weight: 700;
}
.case-switch {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.4rem;
    cursor: pointer;
    transition: background 0.2s;
}
.case-switch:hover {
    background: rgba(255,255,255,0.35);
}

.combo-text {
    color: #f1c40f;
    font-size: 1.3rem;
    font-weight: 700;
    text-shadow: 0 0 10px rgba(241, 196, 15, 0.5);
    animation: comboPop 0.6s ease;
}

@keyframes comboPop {
    0%   { transform: scale(0.5); opacity: 0; }
    50%  { transform: scale(1.3); opacity: 1; }
    100% { transform: scale(1); opacity: 1; }
}

/* ---------- 虚拟键盘 ---------- */
.virtual-keyboard {
    position: relative;
    z-index: 10;
    padding: 16px 8px 24px;
    max-width: 640px;
    margin: 0 auto;
}

.keyboard-row {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 6px;
}

.key-cap {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
    border-radius: 10px;
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: transform 0.1s, filter 0.1s, background 0.1s;
    color: #fff;
}

.key-in-pool {
    background: linear-gradient(135deg, #f093fb, #f5576c);
    box-shadow: 0 3px 0 #c0392b, 0 4px 8px rgba(0,0,0,0.15);
}
.key-in-pool:active {
    transform: scale(0.9) translateY(2px);
    box-shadow: 0 1px 0 #c0392b;
    filter: brightness(0.85);
}

.key-normal {
    background: rgba(255,255,255,0.2);
    box-shadow: 0 3px 0 rgba(0,0,0,0.15), 0 4px 8px rgba(0,0,0,0.1);
}
.key-normal:active {
    transform: scale(0.9) translateY(2px);
    box-shadow: 0 1px 0 rgba(0,0,0,0.1);
    filter: brightness(0.85);
}

.key-special {
    background: linear-gradient(135deg, #667eea, #764ba2);
    box-shadow: 0 3px 0 #4a3a8a, 0 4px 8px rgba(0,0,0,0.15);
    min-width: 52px;
    font-size: 1.2rem;
}
.key-special:active {
    transform: scale(0.9) translateY(2px);
    box-shadow: 0 1px 0 #4a3a8a;
    filter: brightness(0.85);
}

/* PC端隐藏虚拟键盘 */
@media (min-width: 1025px) {
    .virtual-keyboard {
        display: none;
    }
}

/* ---------- 引导层 ---------- */
.guide-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px);
}

.guide-box {
    background: #fff;
    border-radius: 20px;
    padding: 32px 28px;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}

.guide-avatar {
    font-size: 3rem;
    margin-bottom: 12px;
}

.guide-text {
    font-size: 1.1rem;
    color: #333;
    line-height: 1.6;
    margin-bottom: 20px;
}

.guide-key-hint {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 48px; height: 48px;
    border-radius: 12px;
    background: linear-gradient(135deg, #f093fb, #f5576c);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 4px;
    animation: breath 1.5s ease-in-out infinite;
}

.guide-key-demo {
    margin: 12px 0;
    display: flex;
    justify-content: center;
}

.guide-step-dots {
    display: flex;
    justify-content: center;
    gap: 6px;
    margin-bottom: 16px;
}
.guide-step-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ddd;
    transition: background 0.3s;
}
.guide-step-dot.active {
    background: #764ba2;
}

.btn-guide-start {
    display: inline-block;
    padding: 14px 42px;
    border-radius: 28px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    letter-spacing: 0.5px;
}
.btn-guide-start:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

.btn-guide-skip {
    display: inline-block;
    margin-top: 10px;
    padding: 0;
    background: none;
    color: #999;
    font-size: 0.9rem;
    border: none;
    cursor: pointer;
    transition: color 0.2s;
    text-decoration: underline;
    text-underline-offset: 3px;
}
.btn-guide-skip:hover {
    color: #666;
}

/* ---------- 通关结算弹窗 ---------- */
.result-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.7);
    backdrop-filter: blur(6px);
    animation: fadeIn 0.3s ease;
}

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

.result-box {
    background: #fff;
    border-radius: 24px;
    padding: 36px 32px;
    max-width: 380px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: resultSlideUp 0.5s ease;
}

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

.result-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 16px;
}

.result-stars {
    font-size: 2.5rem;
    margin-bottom: 16px;
    letter-spacing: 8px;
}

.result-star {
    display: inline-block;
    transition: all 0.4s ease;
}
.result-star.active {
    color: #f1c40f;
    animation: starFlyIn 0.5s ease;
}
.result-star.inactive {
    color: #ddd;
}

@keyframes starFlyIn {
    0%   { transform: scale(0) rotate(-180deg); opacity: 0; }
    60%  { transform: scale(1.3) rotate(10deg); opacity: 1; }
    100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.result-msg {
    font-size: 1rem;
    color: #666;
    margin-bottom: 8px;
}

.result-stats {
    display: flex;
    justify-content: center;
    gap: 24px;
    margin: 16px 0;
    font-size: 0.9rem;
    color: #888;
}

.result-stats span {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.result-stats .val {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
}

.result-avatars {
    margin: 16px 0;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
}

.result-avatar-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin: 4px;
    padding: 6px 12px;
    border-radius: 20px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    animation: avatarUnlock 0.5s ease;
}

@keyframes avatarUnlock {
    0%   { transform: scale(0); }
    60%  { transform: scale(1.2); }
    100% { transform: scale(1); }
}

.result-avatar-item.surprise {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
}

.result-actions {
    display: flex;
    gap: 10px;
    justify-content: center;
    margin-top: 20px;
}

.btn-result {
    padding: 10px 20px;
    border-radius: 25px;
    font-size: 0.95rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
}

.btn-retry {
    background: linear-gradient(135deg, #2ecc71, #27ae60);
    color: #fff;
    box-shadow: 0 3px 12px rgba(46, 204, 113, 0.4);
}
.btn-retry:hover { transform: translateY(-2px); }

.btn-next {
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.4);
}
.btn-next:hover { transform: translateY(-2px); }

.btn-map {
    background: #f0f0f0;
    color: #666;
}
.btn-map:hover { background: #e0e0e0; transform: translateY(-2px); }

/* ---------- 关卡地图页 ---------- */
.map-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    padding: 24px 16px;
    font-size: 20px;
}

.map-header {
    text-align: center;
    padding: 28px 0 40px;
}
.map-header h1 {
    color: #fff;
    font-size: 2.8rem;
    font-weight: 700;
    text-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
.map-header p {
    color: rgba(255,255,255,0.75);
    font-size: 1.35rem;
    margin-top: 12px;
}

/* 总进度条 */
.map-total-progress {
    margin-top: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
}
.map-total-bar {
    width: 200px;
    height: 10px;
    background: rgba(255,255,255,0.2);
    border-radius: 5px;
    overflow: hidden;
}
.map-total-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f);
    border-radius: 5px;
    transition: width 0.5s ease;
}
.map-total-text {
    color: rgba(255,255,255,0.7);
    font-size: 0.9rem;
}

.map-container {
    max-width: 1400px;
    margin: 0 auto;
}

.chapter-section {
    margin-bottom: 40px;
}

.chapter-title {
    color: #fff;
    font-size: 1.75rem;
    font-weight: 700;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 2px solid rgba(255,255,255,0.25);
    display: flex;
    align-items: center;
    gap: 12px;
}
.chapter-icon {
    font-size: 1.8rem;
}
.chapter-progress {
    margin-left: auto;
    font-size: 1rem;
    color: rgba(255,255,255,0.6);
    font-weight: 400;
}

/* ---------- 阶段折叠面板 ---------- */
.stage-section {
    margin-bottom: 16px;
}

.stage-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 14px 14px 0 0;
    cursor: pointer;
    transition: background 0.2s;
    gap: 16px;
}
.stage-header:hover {
    background: rgba(255,255,255,0.18);
}
.stage-header-left {
    display: flex;
    align-items: center;
    gap: 10px;
}

.stage-arrow {
    font-size: 0.75rem;
    color: rgba(255,255,255,0.6);
    transition: transform 0.3s ease;
    display: inline-block;
}
.stage-arrow.expanded {
    transform: rotate(90deg);
}

.stage-name {
    color: #fff;
    font-size: 1.2rem;
    font-weight: 600;
}

.stage-progress-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255,255,255,0.15);
    color: rgba(255,255,255,0.7);
    font-size: 0.8rem;
    font-weight: 600;
    padding: 2px 10px;
    border-radius: 12px;
    min-width: 36px;
}

.stage-progress-bar {
    flex: 1;
    max-width: 160px;
    height: 6px;
    background: rgba(255,255,255,0.15);
    border-radius: 3px;
    overflow: hidden;
}
.stage-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #2ecc71, #f1c40f);
    border-radius: 3px;
    transition: width 0.5s ease;
}

/* 阶段内关卡列表 */
.stage-levels {
    background: rgba(0,0,0,0.08);
    border-radius: 0 0 14px 14px;
    padding: 16px 12px;
    animation: stageExpand 0.3s ease;
}

@keyframes stageExpand {
    from { opacity: 0; max-height: 0; padding: 0 12px; }
    to   { opacity: 1; max-height: 1000px; padding: 16px 12px; }
}

.level-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

.level-card {
    background: rgba(255,255,255,0.1);
    backdrop-filter: blur(10px);
    border-radius: 20px;
    padding: 20px 18px;
    cursor: pointer;
    border: 2px solid rgba(255,255,255,0.15);
    transition: transform 0.2s, background 0.2s, border-color 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: relative;
}
.level-card:hover {
    transform: translateY(-4px);
    background: rgba(255,255,255,0.2);
}

/* ---- 已通关关卡：金色边框 + 光晕 ---- */
.level-card.level-completed {
    background: rgba(241,196,15,0.12);
    border-color: rgba(241,196,15,0.5);
    box-shadow: 0 0 16px rgba(241,196,15,0.15);
}
.level-card.level-completed:hover {
    background: rgba(241,196,15,0.22);
    border-color: rgba(241,196,15,0.7);
    box-shadow: 0 0 24px rgba(241,196,15,0.25);
}

/* ---- 满星通关：更华丽 ---- */
.level-card.level-perfect {
    background: linear-gradient(135deg, rgba(241,196,15,0.15), rgba(255,165,0,0.15));
    border-color: rgba(255,165,0,0.6);
    box-shadow: 0 0 20px rgba(255,165,0,0.2);
}
.level-card.level-perfect:hover {
    background: linear-gradient(135deg, rgba(241,196,15,0.28), rgba(255,165,0,0.28));
    border-color: rgba(255,165,0,0.85);
    box-shadow: 0 0 30px rgba(255,165,0,0.3);
}

/* ---- 未通关：暗色 + 虚线边框 ---- */
.level-card:not(.level-completed):not(.level-locked) {
    background: rgba(0,0,0,0.2);
    border: 2px dashed rgba(255,255,255,0.2);
}
.level-card:not(.level-completed):not(.level-locked):hover {
    background: rgba(255,255,255,0.12);
    border-color: rgba(255,255,255,0.4);
}

/* ---- 锁定关卡：更深暗 ---- */
.level-card.level-locked {
    background: rgba(0,0,0,0.35);
    border: 2px solid rgba(255,255,255,0.08);
    cursor: not-allowed;
    opacity: 0.6;
}
.level-card.level-locked:hover {
    transform: none;
    background: rgba(0,0,0,0.35);
}

/* 限时标签 */
.level-card-badge {
    position: absolute;
    top: 10px;
    right: 10px;
    background: rgba(231,76,60,0.7);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 8px;
}

.level-card-top {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.level-number {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: rgba(255,255,255,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.75rem;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
}
.level-completed .level-number {
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    color: #fff;
}
.level-perfect .level-number {
    background: linear-gradient(135deg, #ff9f43, #ee5a24);
    color: #fff;
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% { box-shadow: 0 0 8px rgba(255,165,0,0.3); }
    50% { box-shadow: 0 0 20px rgba(255,165,0,0.6); }
}

.level-card-info h3 {
    color: #fff;
    font-size: 1.4rem;
    font-weight: 600;
    margin: 0 0 6px;
}
.level-card-info p {
    color: rgba(255,255,255,0.65);
    font-size: 1.05rem;
    margin: 0;
    line-height: 1.4;
}
.level-completed .level-card-info p {
    color: rgba(241,196,15,0.7);
}

.level-card-bottom {
    text-align: center;
    margin-top: auto;
    width: 100%;
}

.level-card-stars {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    flex-wrap: wrap;
}
.star {
    font-size: 1.8rem;
}
.star-on { color: #f1c40f; text-shadow: 0 0 8px rgba(241,196,15,0.5); }
.star-off { color: rgba(255,255,255,0.2); }

.level-card-stats {
    color: rgba(255,255,255,0.5);
    font-size: 1rem;
    margin-left: 6px;
}

.level-card-unplayed {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    color: rgba(255,255,255,0.4);
    font-size: 1.1rem;
}
.lock-icon {
    font-size: 1.6rem;
    opacity: 0.6;
}

.map-footer {
    text-align: center;
    margin-top: 40px;
    padding-bottom: 48px;
}
.btn-avatar-page {
    display: inline-block;
    padding: 16px 40px;
    border-radius: 30px;
    background: rgba(255,255,255,0.2);
    color: #fff;
    font-size: 1.3rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255,255,255,0.3);
    transition: background 0.2s;
}
.btn-avatar-page:hover { background: rgba(255,255,255,0.35); }

/* ---------- 头像册页 ---------- */
.avatar-page {
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    padding: 24px 16px;
    font-size: 18px;
}

.avatar-header {
    text-align: center;
    padding: 24px 0 36px;
}
.avatar-header h1 {
    color: #fff;
    font-size: 2.4rem;
    font-weight: 700;
}
.avatar-header p {
    color: rgba(255,255,255,0.7);
    font-size: 1.15rem;
    margin-top: 8px;
}

.avatar-grid {
    max-width: 680px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
}

.avatar-card {
    background: rgba(255,255,255,0.15);
    backdrop-filter: blur(10px);
    border-radius: 18px;
    padding: 24px 14px;
    text-align: center;
    border: 1px solid rgba(255,255,255,0.2);
    transition: transform 0.2s;
    cursor: pointer;
}
.avatar-card:hover { transform: translateY(-3px); }

.avatar-card.locked {
    opacity: 0.4;
    filter: grayscale(1);
}

.avatar-emoji {
    font-size: 3.5rem;
    margin-bottom: 10px;
}
.locked .avatar-emoji { filter: brightness(0.5); }

.avatar-name {
    color: #fff;
    font-size: 1.15rem;
    font-weight: 600;
}
.avatar-source {
    color: rgba(255,255,255,0.5);
    font-size: 0.9rem;
    margin-top: 6px;
}

.avatar-back {
    text-align: center;
    margin-top: 36px;
    padding-bottom: 48px;
}

/* ---------- 倒计时显示 ---------- */
.timer-display {
    color: #fff;
    font-size: 1.1rem;
    font-weight: 700;
    background: rgba(255,255,255,0.2);
    border-radius: 20px;
    padding: 4px 14px;
    min-width: 64px;
    text-align: center;
}
.timer-warning {
    color: #e74c3c;
    background: rgba(231,76,60,0.2);
    animation: timerPulse 0.5s ease-in-out infinite;
}

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

/* ---------- 暂停弹窗 ---------- */
.pause-progress {
    margin: 20px 0;
    background: #eee;
    border-radius: 10px;
    height: 12px;
    overflow: hidden;
}
.pause-progress-bar {
    height: 100%;
    background: linear-gradient(90deg, #667eea, #764ba2);
    border-radius: 10px;
    transition: width 0.3s ease;
}
.pause-stats {
    display: flex;
    justify-content: center;
    gap: 20px;
    font-size: 1rem;
    color: #888;
    margin-bottom: 8px;
}

/* ---------- 头像详情弹窗 ---------- */
.avatar-detail-box {
    padding: 36px 32px;
}
.avatar-detail-emoji {
    font-size: 5rem;
    margin-bottom: 16px;
}
.avatar-detail-name {
    font-size: 1.5rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}
.avatar-detail-source {
    font-size: 1rem;
    color: #888;
    margin-bottom: 12px;
}
.avatar-detail-time {
    font-size: 0.9rem;
    color: #2ecc71;
    background: #f0fff4;
    border-radius: 8px;
    padding: 8px 16px;
}
.avatar-detail-locked {
    font-size: 0.95rem;
    color: #e67e22;
    background: #fef9e7;
    border-radius: 8px;
    padding: 8px 16px;
}

/* ---------- PC端左侧头像墙 ---------- */
.pc-avatar-wall {
    display: none;
}

@media (min-width: 1025px) {
    .typing-app {
        display: flex;
        flex-direction: row;
    }
    .typing-app > .typing-bg,
    .typing-app > .floating-letters {
        position: fixed;
        width: 100%; height: 100%;
    }
    .typing-main {
        flex: 1;
        display: flex;
        flex-direction: column;
        min-height: 100vh;
        position: relative;
        z-index: 10;
    }
    .pc-avatar-wall {
        display: flex;
        flex-direction: column;
        width: 80px;
        background: rgba(0,0,0,0.2);
        backdrop-filter: blur(8px);
        padding: 16px 8px;
        align-items: center;
        gap: 8px;
        position: relative;
        z-index: 10;
        overflow-y: auto;
    }
    .pc-avatar-item {
        width: 52px;
        height: 52px;
        border-radius: 14px;
        background: rgba(255,255,255,0.15);
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 1.8rem;
        transition: transform 0.2s;
    }
    .pc-avatar-item:hover {
        transform: scale(1.15);
    }
    .pc-avatar-item.locked {
        opacity: 0.3;
        filter: grayscale(1);
    }
    .pc-avatar-title {
        color: rgba(255,255,255,0.6);
        font-size: 0.9rem;
        text-align: center;
        margin-bottom: 8px;
        letter-spacing: 1px;
    }
}

/* ---------- 加载状态 ---------- */
.loading-spinner {
    text-align: center;
    padding: 40px;
    color: rgba(255,255,255,0.6);
    font-size: 1rem;
}
.loading-spinner::before {
    content: '';
    display: inline-block;
    width: 30px; height: 30px;
    border: 3px solid rgba(255,255,255,0.2);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin-right: 8px;
    vertical-align: middle;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ---------- 响应式适配 ---------- */

/* 手机版 (<640px) */
@media (max-width: 639px) {
    .char-item {
        width: 44px; height: 44px;
        font-size: 1.4rem;
        border-radius: 10px;
    }
    .char-current {
        transform: scale(1.4);
    }
    .char-display {
        padding: 30px 12px 16px;
        min-height: 140px;
    }
    .virtual-keyboard {
        padding: 12px 4px 20px;
    }
    .key-cap {
        min-width: 32px;
        min-height: 42px;
        font-size: 0.95rem;
        border-radius: 8px;
    }
    .keyboard-row { gap: 4px; }
    .level-title { font-size: 1.05rem; }
    .char-display.word-mode .char-item {
        width: 42px;
        height: 42px;
        font-size: 1.4rem;
    }

    /* 地图页手机适配 */
    .map-header h1 { font-size: 2rem; }
    .map-header p { font-size: 1.1rem; }
    .chapter-title { font-size: 1.35rem; }
    .level-list { grid-template-columns: repeat(2, 1fr); gap: 12px; }
    .level-card { padding: 16px 14px; }
    .level-number { width: 44px; height: 44px; font-size: 1.3rem; border-radius: 12px; }
    .level-card-info h3 { font-size: 1.15rem; }
    .level-card-info p { font-size: 0.9rem; }
    .star { font-size: 1.4rem; }
    .level-card-stats { font-size: 0.85rem; }
    .level-card-unplayed { font-size: 0.95rem; }
    .lock-icon { font-size: 1.3rem; }
    .avatar-grid { grid-template-columns: repeat(3, 1fr); gap: 12px; }
    .stage-header { padding: 10px 14px; }
    .stage-name { font-size: 1rem; }
    .stage-progress-bar { max-width: 80px; }
}

/* 平板版 (640-1024px) */
@media (min-width: 640px) and (max-width: 1024px) {
    .char-item {
        width: 52px; height: 52px;
        font-size: 1.6rem;
    }
    .char-current {
        transform: scale(1.5);
    }
}

/* PC版 (>1024px) */
@media (min-width: 1025px) {
    .char-item {
        width: 64px; height: 64px;
        font-size: 2.2rem;
    }
    .char-current {
        transform: scale(1.5);
    }
    .char-display {
        min-height: 220px;
    }
    .char-display.word-mode .char-item {
        width: 60px;
        height: 60px;
        font-size: 2rem;
    }

    /* PC端关卡卡片5列 */
    .level-list { grid-template-columns: repeat(5, 1fr); }

    /* PC端键盘参考横条 */
    .keyboard-ref-bar {
        position: relative;
        z-index: 10;
        max-width: 640px;
        margin: 0 auto;
        padding: 8px;
        opacity: 0.5;
    }
    .keyboard-ref-bar .key-cap {
        min-width: 36px;
        min-height: 32px;
        font-size: 0.85rem;
        cursor: default;
        pointer-events: none;
    }
}

/* ---------- 动画工具类 ---------- */
.fade-enter-active, .fade-leave-active {
    transition: opacity 0.3s ease;
}
.fade-enter-from, .fade-leave-to {
    opacity: 0;
}

/* 隐藏 vue 模板闪烁 */
[v-cloak] {
    display: none !important;
}

/* ---------- 未选择用户提示弹窗 ---------- */
.user-tip-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.user-tip-box {
    background: #fff;
    border-radius: 24px;
    padding: 36px 32px;
    max-width: 340px;
    width: 90%;
    text-align: center;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: resultSlideUp 0.3s ease;
}

.user-tip-emoji {
    font-size: 3.5rem;
    margin-bottom: 12px;
}

.user-tip-text {
    font-size: 1.3rem;
    font-weight: 700;
    color: #333;
    margin-bottom: 8px;
}

.user-tip-sub {
    font-size: 1rem;
    color: #888;
    margin-bottom: 20px;
}

.user-tip-btn {
    display: inline-block;
    padding: 12px 40px;
    border-radius: 30px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    font-size: 1.1rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
    transition: transform 0.2s;
}
.user-tip-btn:hover {
    transform: translateY(-2px);
}

/* ---------- 等级弹窗 ---------- */
.level-modal-overlay {
    position: fixed;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 300;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    animation: fadeIn 0.2s ease;
}

.level-modal-box {
    background: #fff;
    border-radius: 20px;
    width: 95%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: resultSlideUp 0.3s ease;
    overflow: hidden;
}

.level-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 24px 32px 16px;
    flex-shrink: 0;
}

.level-modal-title {
    font-size: 1.6rem;
    font-weight: 700;
    color: #333;
}

.level-modal-close {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: none;
    background: #f0f0f0;
    color: #666;
    font-size: 1.2rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}
.level-modal-close:hover {
    background: #ddd;
}

/* 当前用户等级卡片 */
.level-current-card {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 0 32px 20px;
    padding: 24px 28px;
    border-radius: 16px;
    background: linear-gradient(135deg, #667eea, #764ba2);
    color: #fff;
    flex-shrink: 0;
}

.level-current-emoji {
    font-size: 4rem;
    flex-shrink: 0;
}

.level-current-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.level-current-name {
    font-size: 1.5rem;
    font-weight: 700;
}

.level-current-count {
    font-size: 1.15rem;
    opacity: 0.9;
}
.level-current-count strong {
    font-size: 1.6rem;
    margin: 0 2px;
}

/* 等级网格容器 */
.level-list-scroll {
    flex: 1;
    overflow-y: auto;
    padding: 0 32px 24px;
    -webkit-overflow-scrolling: touch;
}

.level-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
}

/* 等级卡片 */
.level-list-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 16px 14px;
    border-radius: 14px;
    background: #f9f9f9;
    transition: transform 0.15s, box-shadow 0.15s;
}

.level-list-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.level-list-item.level-reached {
    background: rgba(46, 204, 113, 0.1);
}

.level-list-item.level-current-item {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border: 2px solid rgba(102, 126, 234, 0.4);
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.15);
}

.level-list-emoji {
    font-size: 4rem;
    line-height: 1;
    flex-shrink: 0;
}

.level-list-letter {
    font-size: 1.3rem;
    font-weight: 700;
    color: #555;
}

.level-list-item.level-reached .level-list-letter {
    color: #27ae60;
}

.level-list-item.level-current-item .level-list-letter {
    color: #764ba2;
}

.level-list-threshold {
    font-size: 1.15rem;
    color: #999;
    font-weight: 500;
    white-space: nowrap;
}

.level-list-item.level-reached .level-list-threshold {
    color: #27ae60;
}

/* 移动端等级弹窗适配 */
@media (max-width: 639px) {
    .level-modal-box {
        max-width: 95vw;
    }
    .level-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    .level-list-item {
        padding: 10px 8px;
        border-radius: 10px;
        gap: 6px;
    }
    .level-list-emoji {
        font-size: 2.2rem;
    }
    .level-list-letter {
        font-size: 0.9rem;
    }
    .level-list-threshold {
        font-size: 0.8rem;
    }
    .level-current-card {
        margin: 0 16px 16px;
        padding: 16px 18px;
    }
    .level-current-emoji {
        font-size: 2.8rem;
    }
    .level-current-name {
        font-size: 1.15rem;
    }
    .level-modal-header {
        padding: 16px 16px 10px;
    }
    .level-modal-title {
        font-size: 1.3rem;
    }
    .level-list-scroll {
        padding: 0 16px 16px;
    }
}

/* ============================================
   悬浮导航条
   50px 高度，毛玻璃背景，固定顶部
   ============================================ */
.typing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 50px;
    z-index: 50;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 50%, #f093fb 100%);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-sizing: border-box;
}

.typing-nav-left {
    flex-shrink: 0;
}

.typing-nav-title {
    color: #fff;
    font-size: 1.8rem;
    font-weight: 700;
    white-space: nowrap;
    text-decoration: none;
    cursor: pointer;
    transition: opacity 0.2s;
}
.typing-nav-title:hover {
    opacity: 0.8;
    color: #fff;
}

.typing-nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    flex: 1;
}

.typing-nav-user {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 14px 4px 6px;
    border-radius: 22px;
    background: rgba(255, 255, 255, 0.08);
    border: 2px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: all 0.25s ease;
    white-space: nowrap;
}

.typing-nav-user:hover {
    opacity: 0.8;
    color: #fff;
}

.typing-nav-user.active {
    background: rgba(255, 255, 255, 0.18);
    border-color: rgba(255, 255, 255, 0.5);
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.15), inset 0 0 8px rgba(255, 255, 255, 0.05);
    transform: scale(1.05);
}

.nav-user-avatar {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.nav-user-emoji {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    font-size: 1.5rem;
    background: rgba(255, 255, 255, 0.85);
    border-radius: 50%;
}

.nav-user-level {
    position: absolute;
    bottom: -3px;
    right: -5px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    line-height: 16px;
    border-radius: 50%;
    background: linear-gradient(135deg, #f1c40f, #e67e22);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
}

.nav-user-name {
    color: #fff;
    font-size: 1.35rem;
    font-weight: 600;
    line-height: 1;
}

.typing-nav-right {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}

.typing-nav-avatar-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.2s;
    position: relative;
    white-space: nowrap;
}

.typing-nav-avatar-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    color: #fff;
}

.typing-nav-level-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 6px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.2s, text-shadow 0.2s;
    white-space: nowrap;
    cursor: pointer;
}
.typing-nav-level-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}

.nav-avatar-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    background: #e74c3c;
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    padding: 0 4px;
}

.typing-nav-home-btn {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 6px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.15);
    color: #fff;
    font-size: 1.5rem;
    font-weight: 600;
    text-decoration: none;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: background 0.2s, text-shadow 0.2s;
    white-space: nowrap;
}
.typing-nav-home-btn:hover {
    background: rgba(255, 255, 255, 0.3);
    text-shadow: 0 0 8px rgba(255, 255, 255, 0.5);
}


/* ---------- 导航条偏移：所有页面内容下移50px ---------- */
.map-page {
    padding-top: 74px; /* 50px导航 + 24px原有间距 */
}

.avatar-page {
    padding-top: 74px;
}

/* 手机端导航条适配 */
@media (max-width: 639px) {
    .typing-nav {
        padding: 0 8px;
        gap: 4px;
    }
    .typing-nav-left {
        display: none;
    }
    .typing-nav-title {
        font-size: 1.5rem;
    }
    .typing-nav-user {
        padding: 3px 10px 3px 4px;
        gap: 4px;
    }
    .nav-user-emoji {
        width: 26px;
        height: 26px;
        font-size: 1.25rem;
    }
    .nav-user-name {
        font-size: 0.9rem;
    }
    .nav-user-level {
        width: 16px;
        height: 16px;
        font-size: 0.55rem;
        bottom: -2px;
        right: -4px;
    }
    .nav-user-avatar {
        width: 26px;
        height: 26px;
    }
    .typing-nav-avatar-btn {
        padding: 4px 10px;
        font-size: 0.9rem;
    }
    .typing-nav-home-btn {
        padding: 4px 10px;
        font-size: 0.9rem;
    }
    .typing-nav-level-btn {
        padding: 4px 10px;
        font-size: 0.9rem;
    }
}

/* 平板端导航条适配 */
@media (min-width: 640px) and (max-width: 1024px) {
    .typing-nav-user {
        padding: 4px 14px;
        gap: 5px;
    }
}
