/* ===== 基础重置 ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #0a0a14;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
    color: #fff;
    user-select: none;
}

#game-canvas {
    display: block;
    width: 100vw;
    height: 100vh;
    outline: none;
}

/* ===== 加载屏 ===== */
.loading-screen {
    position: fixed;
    inset: 0;
    background: linear-gradient(180deg, #2a1f3d 0%, #4a3260 40%, #d49a8a 80%, #f5d4a8 100%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 100;
    transition: opacity 1.2s ease;
}

.loading-orb {
    position: relative;
    width: 80px;
    height: 80px;
    margin-bottom: 30px;
}

.orb-core {
    position: absolute;
    inset: 25px;
    background: radial-gradient(circle, #fff 0%, #ffe9b8 40%, transparent 70%);
    border-radius: 50%;
    animation: pulse 2s ease-in-out infinite;
    filter: blur(2px);
}

.orb-ring {
    position: absolute;
    inset: 0;
    border: 2px solid rgba(255, 220, 150, 0.6);
    border-radius: 50%;
    animation: spin 4s linear infinite;
}

.orb-ring-2 {
    inset: 10px;
    border-color: rgba(255, 240, 200, 0.4);
    animation-duration: 3s;
    animation-direction: reverse;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); opacity: 1; }
    50% { transform: scale(1.3); opacity: 0.7; }
}

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

.loading-text {
    font-size: 18px;
    letter-spacing: 8px;
    color: rgba(255, 240, 220, 0.95);
    margin-bottom: 24px;
    text-shadow: 0 0 20px rgba(255, 200, 150, 0.6);
}

.loading-progress {
    width: 200px;
    height: 2px;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 2px;
    overflow: hidden;
}

.loading-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(90deg, #ffd89b, #ffeec0);
    box-shadow: 0 0 12px rgba(255, 220, 150, 0.8);
    transition: width 0.3s ease;
}

/* ===== 开始屏 ===== */
.start-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(50, 30, 70, 0.55) 0%, rgba(20, 15, 35, 0.85) 100%);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 50;
    transition: opacity 0.8s ease;
}

.title-card {
    text-align: center;
    padding: 40px;
    max-width: 560px;
    animation: fadeUp 1.4s ease;
}

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

.title-glyph {
    font-size: 48px;
    color: #ffe9b8;
    text-shadow: 0 0 30px rgba(255, 200, 130, 0.9), 0 0 60px rgba(255, 180, 100, 0.5);
    margin-bottom: 18px;
    animation: float 3s ease-in-out infinite;
}

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

.game-title {
    font-size: 56px;
    font-weight: 200;
    letter-spacing: 16px;
    color: #fff;
    margin-bottom: 6px;
    text-shadow: 0 0 30px rgba(255, 220, 180, 0.5);
}

.game-subtitle {
    font-size: 14px;
    letter-spacing: 6px;
    color: rgba(255, 220, 180, 0.7);
    font-weight: 300;
    margin-bottom: 28px;
}

.title-divider {
    width: 60px;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 220, 180, 0.8), transparent);
    margin: 0 auto 28px;
}

.game-desc {
    font-size: 15px;
    line-height: 2;
    color: rgba(255, 255, 255, 0.75);
    font-weight: 300;
    margin-bottom: 36px;
    letter-spacing: 1px;
}

.start-btn {
    background: linear-gradient(135deg, rgba(255, 220, 160, 0.15), rgba(255, 180, 130, 0.1));
    border: 1px solid rgba(255, 220, 180, 0.5);
    color: #ffe9b8;
    padding: 14px 56px;
    font-size: 16px;
    letter-spacing: 8px;
    cursor: pointer;
    border-radius: 40px;
    transition: all 0.4s ease;
    backdrop-filter: blur(4px);
    position: relative;
    overflow: hidden;
}

.start-btn::before {
    content: '';
    position: absolute;
    top: 0; left: -100%;
    width: 100%; height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 240, 200, 0.3), transparent);
    transition: left 0.6s ease;
}

.start-btn:hover {
    background: linear-gradient(135deg, rgba(255, 220, 160, 0.25), rgba(255, 180, 130, 0.2));
    border-color: rgba(255, 240, 200, 0.8);
    box-shadow: 0 0 30px rgba(255, 200, 130, 0.4);
    transform: translateY(-2px);
}

.start-btn:hover::before { left: 100%; }

.start-btn:active { transform: translateY(0); }

.start-btn span { position: relative; z-index: 1; }

.controls-hint {
    margin-top: 36px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    align-items: center;
}

.ctrl-row {
    font-size: 12px;
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 2px;
}

kbd {
    display: inline-block;
    padding: 2px 8px;
    margin: 0 4px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    font-family: inherit;
    font-size: 11px;
    color: rgba(255, 240, 220, 0.9);
}

/* ===== HUD ===== */
.hud {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 20;
}

.hud-top-left {
    position: absolute;
    top: 24px;
    left: 24px;
}

.light-counter {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px 10px 14px;
    background: rgba(20, 15, 30, 0.45);
    border: 1px solid rgba(255, 220, 180, 0.25);
    border-radius: 30px;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
}

.light-icon {
    font-size: 20px;
    color: #ffe9b8;
    text-shadow: 0 0 12px rgba(255, 200, 130, 0.9);
    animation: pulse 2.5s ease-in-out infinite;
}

.light-count {
    font-size: 18px;
    font-weight: 300;
    color: #fff;
    line-height: 1;
}

.light-total {
    font-size: 12px;
    color: rgba(255, 220, 180, 0.6);
    margin-left: 2px;
}

.light-label {
    font-size: 10px;
    letter-spacing: 3px;
    color: rgba(255, 220, 180, 0.7);
    margin-top: 2px;
}

.hud-top-right {
    position: absolute;
    top: 24px;
    right: 24px;
    pointer-events: auto;
}

.icon-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(20, 15, 30, 0.45);
    border: 1px solid rgba(255, 220, 180, 0.25);
    color: #ffe9b8;
    font-size: 18px;
    cursor: pointer;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: all 0.3s ease;
}

.icon-btn:hover {
    background: rgba(40, 30, 50, 0.6);
    border-color: rgba(255, 240, 200, 0.6);
}

.hud-tip {
    position: absolute;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%);
    padding: 8px 20px;
    background: rgba(20, 15, 30, 0.5);
    border: 1px solid rgba(255, 220, 180, 0.25);
    border-radius: 20px;
    font-size: 13px;
    letter-spacing: 2px;
    color: rgba(255, 240, 220, 0.9);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    opacity: 0;
    transition: opacity 0.4s ease;
    white-space: nowrap;
}

.hud-tip.show { opacity: 1; }

.hud-message {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 22px;
    font-weight: 200;
    letter-spacing: 8px;
    color: #ffe9b8;
    text-shadow: 0 0 20px rgba(255, 200, 130, 0.8);
    opacity: 0;
    transition: opacity 0.6s ease;
    pointer-events: none;
    text-align: center;
}

.hud-message.show { opacity: 1; }

.hud-bottom-center {
    position: absolute;
    bottom: 30px;
    left: 50%;
    transform: translateX(-50%);
    width: 200px;
    opacity: 0;
    transition: opacity 0.4s ease;
}

.hud-bottom-center.show { opacity: 1; }

.flight-bar {
    width: 100%;
    height: 3px;
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
    overflow: hidden;
}

.flight-fill {
    height: 100%;
    width: 100%;
    background: linear-gradient(90deg, #ffd89b, #ffeec0);
    box-shadow: 0 0 10px rgba(255, 220, 150, 0.8);
    transition: width 0.1s linear;
}

/* ===== 完成屏 ===== */
.complete-screen {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, rgba(60, 40, 80, 0.6) 0%, rgba(20, 15, 35, 0.92) 100%);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 60;
    transition: opacity 1s ease;
}

.complete-card {
    text-align: center;
    padding: 50px;
    animation: fadeUp 1.2s ease;
}

.complete-glyph {
    font-size: 64px;
    color: #ffe9b8;
    text-shadow: 0 0 40px rgba(255, 200, 130, 1), 0 0 80px rgba(255, 180, 100, 0.6);
    margin-bottom: 24px;
    animation: float 3s ease-in-out infinite;
}

.complete-card h2 {
    font-size: 36px;
    font-weight: 200;
    letter-spacing: 12px;
    color: #fff;
    margin-bottom: 16px;
    text-shadow: 0 0 30px rgba(255, 220, 180, 0.6);
}

.complete-card p {
    font-size: 15px;
    color: rgba(255, 255, 255, 0.75);
    line-height: 1.8;
    margin-bottom: 36px;
    letter-spacing: 2px;
}

/* ===== 工具类 ===== */
.hidden {
    opacity: 0 !important;
    pointer-events: none !important;
}

.hidden-full {
    display: none !important;
}

/* ===== 移动端适配 ===== */
@media (max-width: 768px) {
    .game-title { font-size: 38px; letter-spacing: 10px; }
    .game-subtitle { font-size: 12px; letter-spacing: 4px; }
    .game-desc { font-size: 13px; line-height: 1.9; }
    .title-glyph { font-size: 38px; }
    .start-btn { padding: 12px 42px; font-size: 14px; letter-spacing: 6px; }
    .controls-hint { font-size: 11px; }
    .hud-top-left { top: 16px; left: 16px; }
    .hud-top-right { top: 16px; right: 16px; }
    .light-counter { padding: 8px 14px 8px 10px; }
    .light-count { font-size: 16px; }
    .hud-message { font-size: 18px; letter-spacing: 6px; }
    .hud-tip { font-size: 12px; bottom: 140px; }
}

/* ===== 触屏控制 ===== */
.touch-controls {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 200px;
    z-index: 30;
    pointer-events: none;
    display: none;
}

.touch-controls.show { display: block; }

.touch-pad {
    position: absolute;
    bottom: 30px;
    left: 30px;
    width: 130px;
    height: 130px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 220, 180, 0.2);
    pointer-events: auto;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.touch-pad-knob {
    position: absolute;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 220, 180, 0.3);
    border: 1px solid rgba(255, 240, 200, 0.5);
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    transition: transform 0.05s ease;
}

.touch-jump {
    position: absolute;
    bottom: 50px;
    right: 40px;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: rgba(255, 220, 180, 0.18);
    border: 1px solid rgba(255, 240, 200, 0.5);
    color: #ffe9b8;
    font-size: 12px;
    letter-spacing: 2px;
    pointer-events: auto;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.touch-jump:active {
    background: rgba(255, 220, 180, 0.4);
}

.touch-run {
    position: absolute;
    bottom: 140px;
    right: 40px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: rgba(255, 220, 180, 0.1);
    border: 1px solid rgba(255, 240, 200, 0.3);
    color: rgba(255, 240, 220, 0.8);
    font-size: 11px;
    pointer-events: auto;
}

.touch-run.active {
    background: rgba(255, 220, 180, 0.3);
}

/* 移动端显示触屏控制 */
@media (pointer: coarse) {
    .touch-controls { display: block; }
    .controls-hint { display: none; }
}
