/* 基础视觉系统重置与全局样式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
}

body {
    background: #0f0a1c;
    font-family: 'Outfit', 'Fredoka One', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    color: #ffffff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* 游戏整体容器，锁定 4:3 比例，在大屏上等比缩放 */
#game-container {
    position: relative;
    width: 1024px;
    height: 768px;
    background: radial-gradient(circle at center, #2b1a4a 0%, #0d071b 100%);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    border-radius: 24px;
    overflow: hidden;
    border: 4px solid rgba(255, 255, 255, 0.08);
}

/* 磨砂玻璃通用效果 */
.glass-panel {
    background: rgba(255, 255, 255, 0.07);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.glass-card {
    background: rgba(23, 15, 41, 0.75);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 2px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    border-radius: 28px;
}

/* 顶部右上角 HUD 悬浮面板 */
#hud {
    position: absolute;
    top: 15px;
    right: 20px;
    left: auto; /* 靠右定位 */
    width: auto;
    height: 42px; /* 扁平小巧 */
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    padding: 0 16px;
    gap: 16px; /* 各项之间的横向间距 */
    z-index: 10;
}

.hud-item {
    display: flex;
    flex-direction: row; /* 横向排布标签和数字 */
    align-items: center;
    gap: 4px;
}

.hud-label {
    font-size: 11px;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.5);
    font-weight: 600;
}

.hud-value {
    font-family: 'Fredoka One', sans-serif;
    font-size: 18px; /* 字体小巧 */
    color: #ffd043;
    text-shadow: 0 2px 8px rgba(255, 208, 67, 0.3);
    line-height: 1;
}

#combo-container .hud-value {
    color: #4df0ff;
    text-shadow: 0 2px 8px rgba(77, 240, 255, 0.3);
}

/* 生命值爱心 */
.hearts-row {
    display: flex;
    gap: 4px;
    font-size: 18px;
    flex-wrap: wrap;
    max-width: 220px;
}

.heart {
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: inline-block;
}

.heart.active {
    animation: heart-pulse 2s infinite ease-in-out;
}

.heart.lost {
    transform: scale(0);
    opacity: 0.2;
    filter: grayscale(100%);
}

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

/* 技能 Badge */
#skills-hud {
    display: flex;
    gap: 10px;
    flex-direction: row;
}

.skill-badge {
    padding: 6px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 800;
    color: #ffffff;
    box-shadow: 0 4px 10px rgba(0,0,0,0.2);
    animation: badge-pulse 1.5s infinite alternate ease-in-out;
    display: inline-flex;
    align-items: center;
}

.skill-badge.hidden {
    display: none !important;
}

.blue-active {
    background: linear-gradient(135deg, #00bfff 0%, #1e90ff 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
}

.pink-active {
    background: linear-gradient(135deg, #ff69b4 0%, #ff1493 100%);
    border: 1.5px solid rgba(255, 255, 255, 0.4);
}

@keyframes badge-pulse {
    0% { transform: translateY(0); box-shadow: 0 4px 10px rgba(0,0,0,0.2); }
    100% { transform: translateY(-4px); box-shadow: 0 8px 16px rgba(0,0,0,0.4); }
}

/* 核心 Canvas */
#game-canvas {
    display: block;
    width: 100%;
    height: 100%;
    border-radius: 20px;
}

/* 开始及结束屏幕叠加层 */
.overlay-screen {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    transition: opacity 0.5s ease;
    padding: 40px;
}

.overlay-screen.hidden {
    opacity: 0;
    pointer-events: none;
}

.screen-content {
    width: 100%;
    max-width: 650px;
    padding: 40px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    animation: zoom-in 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes zoom-in {
    from { transform: scale(0.85); opacity: 0; }
    to { transform: scale(1); opacity: 1; }
}

.game-title {
    font-family: 'Fredoka One', sans-serif;
    font-size: 48px;
    color: #ffffff;
    text-shadow: 0 4px 12px rgba(0,0,0,0.5);
    margin-bottom: 2px;
    background: linear-gradient(180deg, #ffffff 0%, #a285eb 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.game-subtitle {
    font-size: 16px;
    color: #ffd043;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 4px;
    margin-bottom: 30px;
}

/* 主题预览小怪兽 */
.cute-preview-monster {
    position: relative;
    width: 100px;
    height: 100px;
    background: linear-gradient(135deg, #a255ff 0%, #6830cc 100%);
    border-radius: 35%;
    margin-bottom: 30px;
    box-shadow: 0 10px 25px rgba(104, 48, 204, 0.5), inset 0 -8px 0 rgba(0,0,0,0.2);
    animation: float-monster 3s infinite ease-in-out;
}

.preview-eye {
    position: absolute;
    top: 25px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
}

.preview-eye::after {
    content: '';
    width: 8px;
    height: 8px;
    background: #000;
    border-radius: 50%;
}

.preview-eye.left { left: 24px; }
.preview-eye.right { right: 24px; }

.preview-mouth {
    position: absolute;
    top: 48px;
    left: 50%;
    transform: translateX(-50%);
    width: 20px;
    height: 10px;
    background: #ff5e7e;
    border-radius: 0 0 10px 10px;
}

.preview-letter {
    position: absolute;
    bottom: -15px;
    left: 50%;
    transform: translateX(-50%);
    background: #ffd043;
    color: #000;
    font-family: 'Fredoka One', sans-serif;
    font-size: 20px;
    padding: 4px 12px;
    border-radius: 8px;
    box-shadow: 0 4px 8px rgba(0,0,0,0.3);
    border: 2px solid #ffffff;
}

@keyframes float-monster {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-12px) rotate(3deg); }
}

/* 玩法教程框 */
.tutorial-box {
    width: 100%;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255,255,255,0.06);
    border-radius: 16px;
    padding: 18px 24px;
    margin-bottom: 30px;
    text-align: left;
}

.tutorial-box h3 {
    font-size: 16px;
    margin-bottom: 12px;
    color: #4df0ff;
}

.tutorial-modes {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
}

.mode-desc {
    font-size: 13px;
    line-height: 1.5;
    color: rgba(255, 255, 255, 0.85);
}

.mode-desc strong {
    display: block;
    font-size: 14px;
    margin-bottom: 6px;
    color: #ffffff;
}

/* 主按钮 */
.btn-primary {
    font-family: 'Fredoka One', 'Outfit', sans-serif;
    background: linear-gradient(135deg, #ffd043 0%, #ff9800 100%);
    border: 3px solid #ffffff;
    color: #3e2000;
    font-size: 24px;
    font-weight: 800;
    padding: 12px 48px;
    border-radius: 20px;
    cursor: pointer;
    box-shadow: 0 10px 25px rgba(255, 152, 0, 0.4), inset 0 -4px 0 rgba(0,0,0,0.15);
    transition: transform 0.1s ease, box-shadow 0.3s ease;
    outline: none;
}

.btn-primary:hover {
    transform: scale(1.05);
    box-shadow: 0 14px 30px rgba(255, 152, 0, 0.6);
}

.btn-primary:active {
    transform: scale(0.98);
    box-shadow: 0 5px 12px rgba(255, 152, 0, 0.4);
}

/* 结算面板样式 */
.game-over-title {
    font-family: 'Fredoka One', sans-serif;
    font-size: 54px;
    color: #ff5e7e;
    text-shadow: 0 4px 12px rgba(0,0,0,0.5);
    margin-bottom: 2px;
}

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

.final-score-box {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255,255,255,0.08);
    border-radius: 20px;
    padding: 20px 40px;
    margin-bottom: 24px;
    width: 100%;
}

.final-label {
    display: block;
    font-size: 14px;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 4px;
}

.final-value {
    font-family: 'Fredoka One', sans-serif;
    font-size: 50px;
    color: #ffd043;
    text-shadow: 0 0 15px rgba(255, 208, 67, 0.4);
    line-height: 1;
}

.stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    width: 100%;
    margin-bottom: 36px;
}

.stat-box {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid rgba(255, 255, 255, 0.05);
    border-radius: 16px;
    padding: 14px;
}

.stat-lbl {
    display: block;
    font-size: 12px;
    color: rgba(255, 255, 255, 0.4);
    margin-bottom: 4px;
}

.stat-val {
    font-family: 'Fredoka One', sans-serif;
    font-size: 24px;
    color: #ffffff;
}

/* 26字母解锁面板样式 (缩为底部极窄镶边，避免遮挡熊猫射手和游戏画面) */
#alphabet-checklist {
    position: absolute;
    bottom: 3px; /* 紧贴底部边缘 */
    top: auto; /* 清除 top 顶端定位 */
    left: 10px;
    right: 10px;
    height: 14px; /* 极其微型高度 */
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 4px;
    z-index: 10;
    gap: 1.5px;
    box-shadow: none; /* 移除强烈的磨砂玻璃阴影 */
    border: 1px solid rgba(255, 255, 255, 0.05); /* 极窄边框 */
    background: rgba(255, 255, 255, 0.03); /* 降低背景对比度 */
}

.letter-badge {
    flex: 1;
    height: 8px; /* 极度收窄 */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 1px; /* 极其微缩的圆角 */
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.02);
    color: rgba(255, 255, 255, 0.15);
    font-family: 'Fredoka One', 'Outfit', sans-serif;
    font-size: 6px; /* 字体缩小至 6px */
    font-weight: 800;
    transition: all 0.3s ease;
}

.letter-badge.unlocked {
    background: linear-gradient(135deg, #ffd043 0%, #ff9800 100%);
    border-color: rgba(255, 255, 255, 0.8);
    color: #3e2000;
    transform: scale(1.03); /* 轻微缩放 */
    box-shadow: 0 0 3px rgba(255, 208, 67, 0.3);
}
