/* === 基础重置 === */
* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body {
    width: 100%; height: 100%; overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
    background: #000; color: #fff;
    user-select: none; -webkit-user-select: none;
}
canvas#scene { position: fixed; inset: 0; display: block; cursor: none; }

/* === 加载页 === */
.loader {
    position: fixed; inset: 0; z-index: 1000;
    background: radial-gradient(ellipse at center, #1a3a2a 0%, #050a07 70%);
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    transition: opacity 1.2s ease, visibility 1.2s ease;
}
.loader.hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.loader-ring {
    width: 64px; height: 64px; border-radius: 50%;
    border: 2px solid rgba(255,255,255,.12);
    border-top-color: rgba(180, 230, 200, .9);
    animation: spin 1.6s linear infinite;
    margin-bottom: 28px;
}
.loader-text {
    font-size: 18px; letter-spacing: 6px; opacity: .85;
    font-weight: 300;
}
.loader-hint {
    margin-top: 16px; font-size: 12px; opacity: .4;
    letter-spacing: 2px;
    animation: pulse 2.4s ease-in-out infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { opacity: .8; } }

/* === HUD 通用 === */
.hud {
    position: fixed; z-index: 50;
    pointer-events: none; /* 内部元素再单独开启 */
}
.hud > * { pointer-events: auto; }

.hud-top {
    top: 20px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 40px; align-items: center;
    padding: 12px 24px;
    background: rgba(8,16,12,.35);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 18px;
}
.hud-title { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.title-main {
    font-size: 18px; font-weight: 600; letter-spacing: 8px;
    background: linear-gradient(180deg, #fff, #b8d8c0);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.title-sub { font-size: 10px; letter-spacing: 4px; opacity: .55; margin-top: 2px; }
.hud-stats { display: flex; gap: 14px; align-items: center; font-size: 11px; opacity: .7; letter-spacing: 1px; }
.hud-stats span { padding: 4px 10px; background: rgba(255,255,255,.05); border-radius: 10px; }

.hudBottom {
    bottom: 24px; left: 50%; transform: translateX(-50%);
    display: flex; gap: 8px;
    padding: 8px;
    background: rgba(8,16,12,.4);
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid rgba(255,255,255,.08);
    border-radius: 22px;
}
.weather-btn {
    background: transparent; border: none; cursor: pointer;
    padding: 10px 16px; border-radius: 16px;
    color: rgba(255,255,255,.55);
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    font-size: 11px; letter-spacing: 1px;
    transition: all .35s cubic-bezier(.2,.7,.2,1);
}
.weather-btn:hover { color: rgba(255,255,255,.9); background: rgba(255,255,255,.05); }
.weather-btn.active {
    color: #fff;
    background: linear-gradient(160deg, rgba(120,200,160,.25), rgba(60,100,80,.15));
    box-shadow: 0 0 24px rgba(120,200,160,.18) inset;
}

.hud-right {
    right: 20px; top: 50%; transform: translateY(-50%);
    display: flex; flex-direction: column; gap: 10px;
}
.ctrl-btn {
    width: 46px; height: 46px; border-radius: 14px;
    background: rgba(8,16,12,.45);
    backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255,255,255,.08);
    color: rgba(255,255,255,.65);
    display: grid; place-items: center; cursor: pointer;
    transition: all .3s ease;
}
.ctrl-btn:hover { color: #fff; transform: scale(1.05); }
.ctrl-btn.active { color: #b8d8c0; border-color: rgba(180,230,200,.3); }
.ctrl-btn.vr { background: linear-gradient(160deg, rgba(120,80,200,.3), rgba(40,20,80,.2)); }

/* === 十字准星 === */
#crosshair {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 8px; height: 8px; border-radius: 50%;
    background: rgba(255,255,255,.7); mix-blend-mode: difference;
    pointer-events: none; z-index: 30;
    box-shadow: 0 0 8px rgba(255,255,255,.4);
    transition: opacity .3s;
}
body.vr #crosshair { display: none; }

/* === 呼吸引导 === */
#breath-guide {
    position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%);
    width: 220px; height: 220px;
    display: grid; place-items: center;
    pointer-events: none; z-index: 25;
}
#breath-guide.hidden { display: none; }
.breath-circle {
    width: 80px; height: 80px; border-radius: 50%;
    border: 1.5px solid rgba(255,255,255,.6);
    background: radial-gradient(circle, rgba(180,230,200,.15), transparent 70%);
    animation: breath 11s ease-in-out infinite;
}
.breath-text {
    position: absolute; bottom: 30px;
    font-size: 11px; letter-spacing: 6px; opacity: .65;
    animation: breathText 11s ease-in-out infinite;
}
@keyframes breath {
    0%, 100% { transform: scale(.4); opacity: .4; }
    36.36% { transform: scale(1.4); opacity: .9; }    /* 吸气 4s = 36.36% of 11s */
    100% { transform: scale(.4); opacity: .4; }
}
@keyframes breathText {
    0% { content: '吸气'; }
    36.36% { content: '屏息'; }
    63.64% { content: '呼气'; }
}

/* === 操作提示 === */
.instructions {
    position: fixed; inset: 0; z-index: 100;
    background: rgba(0,0,0,.55); backdrop-filter: blur(8px);
    display: grid; place-items: center;
    transition: opacity .4s;
}
.instructions.hidden { opacity: 0; pointer-events: none; }
.ins-card {
    background: rgba(12,20,16,.85);
    border: 1px solid rgba(255,255,255,.1);
    border-radius: 22px;
    padding: 32px 36px; max-width: 420px;
    box-shadow: 0 24px 60px rgba(0,0,0,.5);
}
.ins-card h3 {
    font-size: 18px; font-weight: 500; letter-spacing: 4px;
    margin-bottom: 22px; color: #b8d8c0;
}
.ins-card ul { list-style: none; }
.ins-card li {
    font-size: 13px; opacity: .8; padding: 7px 0;
    display: flex; align-items: center; gap: 10px;
    border-bottom: 1px solid rgba(255,255,255,.04);
}
.ins-card li:last-child { border-bottom: none; }
kbd {
    display: inline-block; padding: 2px 8px; min-width: 28px; text-align: center;
    background: rgba(255,255,255,.08); border-radius: 6px;
    font-family: ui-monospace, monospace; font-size: 11px;
    border: 1px solid rgba(255,255,255,.1);
}
#close-ins {
    margin-top: 22px; width: 100%; padding: 12px;
    background: linear-gradient(160deg, #4a8060, #2d5040);
    border: none; border-radius: 12px;
    color: #fff; font-size: 14px; letter-spacing: 4px;
    cursor: pointer; transition: transform .2s;
}
#close-ins:hover { transform: translateY(-1px); }

/* === 移动端摇杆 === */
.joystick {
    position: fixed; bottom: 100px; left: 30px; z-index: 40;
    width: 120px; height: 120px;
    touch-action: none;
}
.joystick.hidden { display: none; }
.joystick-base {
    position: absolute; inset: 0; border-radius: 50%;
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.12);
    backdrop-filter: blur(10px);
}
.joystick-thumb {
    position: absolute; left: 50%; top: 50%;
    width: 50px; height: 50px; transform: translate(-50%, -50%);
    border-radius: 50%;
    background: rgba(180,230,200,.4);
    border: 1px solid rgba(255,255,255,.2);
    transition: background .2s;
}

/* === 响应式 === */
@media (max-width: 700px) {
    .hud-top { gap: 20px; padding: 10px 16px; }
    .title-sub { display: none; }
    .hud-stats { display: none; }
    .weather-btn span { display: none; }
    .weather-btn { padding: 10px; }
    .ins-card { padding: 24px; max-width: 90vw; }
}
@media (pointer: fine) {
    .joystick { display: none; }
}
