/* ========================================
   深海吞噬之王 - 游戏样式表 v2
   全屏适配 + UI 美化
   ======================================== */

/* 全局样式重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
}

body {
    font-family: 'Microsoft YaHei', 'PingFang SC', -apple-system, sans-serif;
    background: #000a1a;
    color: #ffffff;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}

/* ========================================
   加载画面
   ======================================== */
#loading-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, #001833 0%, #000511 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
}

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

.loading-content h1 {
    font-size: clamp(2em, 5vw, 3.5em);
    margin-bottom: 30px;
    background: linear-gradient(135deg, #00d4ff, #0099ff, #00ffcc);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    filter: drop-shadow(0 0 20px rgba(0, 200, 255, 0.5));
}

.loading-bar {
    width: min(400px, 80vw);
    height: 6px;
    background: rgba(255,255,255,0.08);
    border-radius: 3px;
    overflow: hidden;
    margin: 20px auto;
}

.loading-progress {
    height: 100%;
    background: linear-gradient(90deg, #00d4ff, #00ffcc);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 3px;
    box-shadow: 0 0 12px rgba(0, 212, 255, 0.6);
}

#loading-text {
    font-size: 1em;
    color: #6699bb;
    margin-top: 15px;
    letter-spacing: 2px;
}

/* ========================================
   主菜单
   ======================================== */
#main-menu {
    position: fixed;
    inset: 0;
    background: 
        radial-gradient(ellipse at 50% 120%, rgba(0, 100, 180, 0.15) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(0, 180, 220, 0.08) 0%, transparent 50%),
        linear-gradient(180deg, #000d1a 0%, #001428 40%, #000a14 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 900;
}

/* 深海粒子背景动画 */
#main-menu::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: 
        radial-gradient(2px 2px at 10% 20%, rgba(0,200,255,0.4) 0%, transparent 100%),
        radial-gradient(2px 2px at 30% 60%, rgba(0,200,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 50% 30%, rgba(0,255,200,0.5) 0%, transparent 100%),
        radial-gradient(2px 2px at 70% 70%, rgba(0,180,255,0.3) 0%, transparent 100%),
        radial-gradient(1px 1px at 90% 40%, rgba(0,255,180,0.4) 0%, transparent 100%),
        radial-gradient(2px 2px at 20% 80%, rgba(0,150,255,0.2) 0%, transparent 100%),
        radial-gradient(1px 1px at 60% 85%, rgba(0,220,200,0.35) 0%, transparent 100%),
        radial-gradient(2px 2px at 85% 15%, rgba(0,190,255,0.25) 0%, transparent 100%);
    animation: particlesFloat 20s ease-in-out infinite;
    pointer-events: none;
}

@keyframes particlesFloat {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.menu-content {
    text-align: center;
    padding: 40px;
    position: relative;
    z-index: 1;
}

.game-title {
    font-size: clamp(2.5em, 6vw, 4.5em);
    font-weight: 900;
    letter-spacing: 6px;
    margin-bottom: 8px;
    background: linear-gradient(135deg, #00d4ff 0%, #0099ff 30%, #00ffc8 60%, #00d4ff 100%);
    background-size: 200% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: titleShimmer 4s linear infinite;
    filter: drop-shadow(0 0 30px rgba(0, 200, 255, 0.4));
}

@keyframes titleShimmer {
    to { background-position: 200% center; }
}

.game-subtitle {
    font-size: clamp(1em, 2vw, 1.4em);
    color: #5588aa;
    margin-bottom: clamp(30px, 5vh, 50px);
    letter-spacing: 4px;
    text-transform: uppercase;
    font-weight: 300;
}

.menu-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
    align-items: center;
}

.menu-btn {
    padding: 14px 48px;
    font-size: clamp(1em, 1.5vw, 1.2em);
    font-weight: 600;
    letter-spacing: 2px;
    color: white;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(.4, 0, .2, 1);
    min-width: clamp(260px, 35vw, 340px);
    position: relative;
    overflow: hidden;
}

.menu-btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.15) 0%, transparent 50%);
    opacity: 0;
    transition: opacity 0.25s;
}

.menu-btn:hover::after { opacity: 1; }

.menu-btn:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 8px 32px rgba(0, 170, 255, 0.35);
}

.menu-btn:active {
    transform: translateY(0) scale(0.98);
}

/* 主按钮 - 深海蓝渐变 */
.menu-btn:not(.secondary-btn):not(.abyss-btn) {
    background: linear-gradient(135deg, #0077bb 0%, #00a0dd 50%, #0088cc 100%);
    box-shadow: 0 4px 20px rgba(0, 140, 220, 0.3), inset 0 1px 0 rgba(255,255,255,0.15);
}

.menu-btn:not(.secondary-btn):not(.abyss-btn):hover {
    background: linear-gradient(135deg, #0088cc 0%, #00bbee 50%, #0099dd 100%);
}

/* 深渊模式 - 暗红紫渐变 */
.abyss-btn {
    background: linear-gradient(135deg, #880055 0%, #bb0077 50%, #990066 100%);
    box-shadow: 0 4px 20px rgba(180, 0, 120, 0.25), inset 0 1px 0 rgba(255,255,255,0.1);
}

.abyss-btn:hover {
    background: linear-gradient(135deg, #aa0066 0%, #dd0088 50%, #bb0077 100%);
    box-shadow: 0 8px 32px rgba(200, 0, 130, 0.4);
}

/* 次要按钮 */
.secondary-btn {
    background: linear-gradient(135deg, #2a3040 0%, #3a4555 100%);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
    min-width: clamp(200px, 28vw, 280px);
    padding: 12px 36px;
}

.secondary-btn:hover {
    background: linear-gradient(135deg, #3a4555 0%, #4a5565 100%);
    box-shadow: 0 4px 16px rgba(255, 255, 255, 0.08);
}

.version-info {
    margin-top: clamp(30px, 4vh, 40px);
    color: #334455;
    font-size: 0.8em;
    letter-spacing: 1px;
}

/* ========================================
   模态框
   ======================================== */
.modal {
    position: fixed;
    inset: 0;
    background: rgba(0, 5, 15, 0.85);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 800;
}

.modal-content {
    background: linear-gradient(160deg, #0a1628 0%, #0d1e35 100%);
    padding: clamp(24px, 4vw, 48px);
    border-radius: 20px;
    max-width: min(600px, 88vw);
    max-height: 85vh;
    overflow-y: auto;
    border: 1px solid rgba(0, 170, 255, 0.25);
    box-shadow: 
        0 0 60px rgba(0, 100, 200, 0.15),
        0 24px 80px rgba(0, 0, 0, 0.5);
}

.modal-content h2 {
    font-size: clamp(1.4em, 3vw, 2em);
    margin-bottom: 20px;
    text-align: center;
    color: #00c8ff;
    font-weight: 700;
}

.instructions {
    text-align: left;
    line-height: 1.7;
}

.instructions h3 {
    color: #0099cc;
    margin-top: 24px;
    margin-bottom: 10px;
    font-size: 1.15em;
    font-weight: 600;
    padding-left: 12px;
    border-left: 3px solid #0088cc;
}

.instructions ul {
    list-style: none;
    padding-left: 12px;
}

.instructions li {
    margin-bottom: 7px;
    padding-left: 18px;
    position: relative;
    color: #bbccee;
    font-size: 0.95em;
}

.instructions li::before {
    content: '›';
    position: absolute;
    left: 0;
    color: #00aaff;
    font-weight: bold;
}

/* ========================================
   游戏容器 — 全屏
   ======================================== */
#game-container {
    position: fixed;
    inset: 0;
    width: 100vw;
    height: 100vh;
}

#game-canvas {
    width: 100%;
    height: 100%;
    display: block;
}

#game-canvas canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

/* ========================================
   HUD 界面 — 美化版
   ======================================== */
#game-hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
}

#game-hud > div {
    pointer-events: auto;
}

.hud-top-left,
.hud-top-right,
.hud-bottom-left,
.hud-bottom-right {
    position: absolute;
    padding: 12px 16px;
}

.hud-top-left { top: 0; left: 0; }
.hud-top-right { top: 0; right: 0; }
.hud-bottom-left { bottom: 0; left: 0; }
.hud-bottom-right { bottom: 0; right: 0; }

/* === 等级 + 称号 === */
.level-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
}

#player-level {
    background: linear-gradient(135deg, #0099dd, #00bbff);
    padding: 4px 14px;
    border-radius: 20px;
    font-weight: 800;
    font-size: 1em;
    letter-spacing: 1px;
    box-shadow: 0 2px 12px rgba(0, 150, 220, 0.4);
}

#player-title {
    color: #77aacc;
    font-size: 0.95em;
    font-weight: 500;
}

/* === 进度条通用 === */
.exp-bar,
.hunger-bar,
.health-bar,
.energy-bar {
    width: clamp(160px, 22vw, 240px);
    height: 18px;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 9px;
    position: relative;
    overflow: hidden;
    margin-bottom: 6px;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(4px);
}

.exp-fill {
    height: 100%;
    background: linear-gradient(90deg, #00dd77, #00ff99);
    width: 0%;
    transition: width 0.25s ease;
    border-radius: 9px;
    box-shadow: 0 0 8px rgba(0, 230, 120, 0.4);
}

.hunger-fill {
    height: 100%;
    background: linear-gradient(90deg, #ff9900, #ffbb00);
    width: 100%;
    transition: width 0.25s ease;
    border-radius: 9px;
    box-shadow: 0 0 8px rgba(255, 170, 0, 0.4);
}

.health-fill {
    height: 100%;
    background: linear-gradient(90deg, #ee3333, #ff4455);
    width: 100%;
    transition: width 0.25s ease;
    border-radius: 9px;
    box-shadow: 0 0 8px rgba(240, 60, 60, 0.4);
}

.energy-fill {
    height: 100%;
    background: linear-gradient(90deg, #9933ff, #bb55ff);
    width: 100%;
    transition: width 0.25s ease;
    border-radius: 9px;
    box-shadow: 0 0 8px rgba(160, 60, 255, 0.4);
}

.exp-text,
.hunger-text,
.health-text,
.energy-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 0.7em;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
    color: #fff;
}

/* === 技能槽 === */
.skill-slots {
    display: flex;
    gap: 6px;
    margin-bottom: 8px;
}

.skill-slot {
    width: 46px;
    height: 46px;
    background: rgba(10, 20, 35, 0.75);
    backdrop-filter: blur(4px);
    border: 1.5px solid rgba(0, 170, 255, 0.35);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 1.1em;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #aaccee;
}

.skill-slot:hover {
    background: rgba(0, 140, 220, 0.25);
    border-color: #00bbff;
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 160, 255, 0.3);
}

.skill-slot.active {
    border-color: #00ffa0;
    background: rgba(0, 255, 160, 0.15);
    color: #00ffa0;
    box-shadow: 0 0 16px rgba(0, 255, 160, 0.3);
}

.skill-slot.cooldown {
    border-color: #334455;
    background: rgba(20, 25, 35, 0.8);
    opacity: 0.45;
    color: #556677;
}

/* === 区域/分数信息 === */
.zone-info,
.score-info {
    background: rgba(10, 18, 30, 0.7);
    backdrop-filter: blur(4px);
    padding: 6px 14px;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: 0.9em;
    font-weight: 500;
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #99bbdd;
    letter-spacing: 0.5px;
}

/* === 灾害警告 === */
.disaster-warning {
    background: rgba(220, 40, 40, 0.88);
    backdrop-filter: blur(8px);
    padding: 10px 20px;
    border-radius: 10px;
    animation: disasterPulse 0.8s ease-in-out infinite;
    font-weight: 700;
    font-size: 1.05em;
    letter-spacing: 1px;
    border: 1px solid rgba(255, 100, 100, 0.4);
    box-shadow: 0 0 24px rgba(255, 40, 40, 0.35);
}

@keyframes disasterPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.75; transform: scale(1.02); }
}

/* ========================================
   暂停菜单
   ======================================== */
#pause-menu {
    position: fixed;
    inset: 0;
    background: rgba(0, 5, 15, 0.8);
    backdrop-filter: blur(6px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 200;
}

.pause-content {
    text-align: center;
    background: linear-gradient(160deg, #0a1828 0%, #0f2038 100%);
    padding: clamp(30px, 5vw, 56px) clamp(30px, 5vw, 56px);
    border-radius: 20px;
    border: 1px solid rgba(0, 170, 255, 0.2);
    box-shadow: 0 0 60px rgba(0, 80, 160, 0.2);
}

.pause-content h2 {
    font-size: clamp(1.6em, 3vw, 2.4em);
    margin-bottom: 28px;
    color: #00bbff;
    font-weight: 700;
}

/* ========================================
   进化弹窗
   ======================================== */
.evolution-content {
    text-align: center;
}

.evolution-info {
    margin: 24px 0;
    padding: 28px;
    background: rgba(0, 200, 255, 0.06);
    border-radius: 16px;
    border: 1.5px solid rgba(0, 255, 170, 0.35);
}

.evolution-level {
    font-size: clamp(2em, 5vw, 3.2em);
    color: #00ffa0;
    font-weight: 900;
    margin-bottom: 8px;
    text-shadow: 0 0 20px rgba(0, 255, 160, 0.4);
}

.evolution-title {
    font-size: clamp(1.3em, 2.5vw, 1.8em);
    color: #66bbdd;
    margin-bottom: 8px;
    font-weight: 600;
}

.evolution-desc {
    font-size: 1.05em;
    color: #8899aa;
}

.skill-points-info {
    margin: 18px 0;
    font-size: 1.15em;
    color: #ffbb00;
    font-weight: 600;
}

/* ========================================
   游戏结束
   ======================================== */
#game-over-screen {
    position: fixed;
    inset: 0;
    background: rgba(5, 0, 10, 0.9);
    backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 300;
}

.game-over-content {
    text-align: center;
    background: linear-gradient(160deg, #140a18 0%, #1a0c20 100%);
    padding: clamp(30px, 5vw, 56px);
    border-radius: 20px;
    border: 1px solid rgba(255, 60, 80, 0.25);
    max-width: min(480px, 88vw);
    box-shadow: 0 0 80px rgba(200, 30, 50, 0.15);
}

#game-over-title {
    font-size: clamp(2em, 4vw, 3em);
    color: #ff4466;
    margin-bottom: 24px;
    font-weight: 900;
}

.final-stats {
    margin: 24px 0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 16px;
    margin-bottom: 8px;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 10px;
    border: 1px solid rgba(255, 255, 255, 0.05);
}

.stat-label {
    color: #7788aa;
    font-size: 0.95em;
}

.stat-value {
    color: #ddeeff;
    font-weight: 700;
    font-size: 1.15em;
}

.game-over-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 24px;
}

/* ========================================
   工具类
   ======================================== */
.hidden {
    display: none !important;
}
