
:root {
  --glass: rgba(14, 20, 34, 0.52);
  --glass-strong: rgba(10, 14, 26, 0.72);
  --stroke: rgba(255, 255, 255, 0.14);
  --text: #f4f6fb;
  --muted: rgba(236, 240, 250, 0.66);
  --accent: #ffb547;
  --accent-2: #3fd0c9;
  --danger: #ff5a6e;
  --radius: 16px;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
  --font: "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei", -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --glass: rgba(18, 24, 40, 0.5); }
}
:root[data-theme="dark"] { --glass: rgba(14, 20, 34, 0.52); }
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; background: #0d1424; color: var(--text); font-family: var(--font); -webkit-font-smoothing: antialiased; touch-action: none; user-select: none; -webkit-user-select: none; }
#app, #app canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }
button { font: inherit; color: inherit; }

/* ---------- 开场 ---------- */
#intro { position: fixed; inset: 0; z-index: 50; display: flex; flex-direction: column; overflow-y: auto; padding: 24px 16px; touch-action: pan-y; background: radial-gradient(120% 90% at 70% 10%, rgba(255, 150, 90, 0.28), transparent 60%), linear-gradient(180deg, rgba(10, 14, 30, 0.55), rgba(8, 10, 22, 0.82)); backdrop-filter: blur(3px); transition: opacity 0.9s ease, visibility 0.9s; }
body.started #intro { opacity: 0; visibility: hidden; pointer-events: none; }
.intro-card { width: min(640px, 100%); text-align: center; margin: auto; }
.intro-art { width: min(300px, 70vw); height: auto; margin: 0 auto 6px; display: block; filter: drop-shadow(0 12px 30px rgba(0,0,0,0.4)); }
.intro-art .wheel { transform-box: fill-box; transform-origin: center; animation: spin 1.1s linear infinite; }
.intro-art .road { stroke-dasharray: 18 14; animation: road 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes road { to { stroke-dashoffset: -32; } }
.intro-art .bob { animation: bob 0.55s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(2px); } }
h1 { margin: 0; font-size: clamp(34px, 7vw, 60px); letter-spacing: 0.04em; font-weight: 900; background: linear-gradient(92deg, #fff7e6, #ffc27a 45%, #ff8a5b); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sub { margin: 8px 0 18px; color: var(--muted); font-size: clamp(14px, 2.4vw, 17px); line-height: 1.6; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 0 0 24px; }
.chip { padding: 5px 11px; border-radius: 999px; font-size: 12.5px; background: rgba(255, 255, 255, 0.08); border: 1px solid var(--stroke); color: rgba(255,255,255,0.86); }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.btn-primary { border: 0; cursor: pointer; padding: 14px 30px; border-radius: 999px; font-size: 17px; font-weight: 800; letter-spacing: 0.05em; color: #2a1400; background: linear-gradient(135deg, #ffd27a, #ff9a4d); box-shadow: 0 10px 30px rgba(255, 140, 60, 0.45), inset 0 1px 0 rgba(255,255,255,0.6); transition: transform 0.15s ease, box-shadow 0.2s; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 14px 36px rgba(255, 140, 60, 0.55); }
.btn-ghost { cursor: pointer; padding: 14px 22px; border-radius: 999px; font-size: 15px; background: rgba(255,255,255,0.08); border: 1px solid var(--stroke); }
.btn-ghost:hover { background: rgba(255,255,255,0.14); }
.keys-hint { margin-top: 20px; color: var(--muted); font-size: 12.5px; line-height: 1.9; }
.intro-links { margin-top: 16px; display: flex; gap: 20px; justify-content: center; }
.intro-links a { color: var(--muted); text-decoration: none; font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; transition: color 0.15s; }
.intro-links a:hover { color: #fff; }
.intro-links svg { width: 14px; height: 14px; fill: currentColor; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; margin: 0 2px; border-radius: 6px; font: 600 11.5px/18px ui-monospace, Menlo, monospace; text-align: center; background: rgba(255,255,255,0.12); border: 1px solid rgba(255,255,255,0.2); border-bottom-width: 2px; color: #fff; }

/* ---------- HUD ---------- */
.hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; opacity: 0; transition: opacity 0.8s ease 0.3s; }
body.started .hud { opacity: 1; }
body.hide-ui .hud, body.hide-ui .hud * { opacity: 0 !important; visibility: hidden !important; }
.panel { pointer-events: auto; background: var(--glass); border: 1px solid var(--stroke); border-radius: var(--radius); box-shadow: var(--shadow); backdrop-filter: blur(14px) saturate(1.3); -webkit-backdrop-filter: blur(14px) saturate(1.3); }
.brand { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 16px; padding: 10px 14px; display: flex; gap: 10px; align-items: center; }
.brand b { font-size: 15px; letter-spacing: 0.03em; }
.brand small { display: block; font-size: 11px; color: var(--muted); margin-top: 2px; }
.brand .logo { font-size: 24px; }
.tools { position: absolute; top: max(14px, env(safe-area-inset-top)); right: 16px; display: flex; gap: 6px; padding: 6px; }
.icon-btn { pointer-events: auto; width: 38px; height: 38px; border-radius: 11px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; font-size: 17px; transition: background 0.15s; position: relative; color: inherit; text-decoration: none; }
.icon-btn svg { width: 18px; height: 18px; fill: currentColor; display: block; }
.icon-btn:hover { background: rgba(255,255,255,0.12); }
.icon-btn.off::after { content: ""; position: absolute; width: 22px; height: 2px; background: var(--danger); transform: rotate(-45deg); border-radius: 2px; }
.icon-btn.on { background: rgba(63, 208, 201, 0.22); }
.cams { position: absolute; top: max(14px, env(safe-area-inset-top)); left: 50%; transform: translateX(-50%); display: flex; gap: 4px; padding: 5px; }
.cams button { pointer-events: auto; border: 0; background: transparent; cursor: pointer; padding: 7px 12px; border-radius: 10px; font-size: 13px; color: var(--muted); white-space: nowrap; transition: all 0.15s; }
.cams button:hover { color: #fff; background: rgba(255,255,255,0.08); }
.cams button.on { color: #1a1206; background: linear-gradient(135deg, #ffd27a, #ffab5e); font-weight: 700; }
.dash { position: absolute; left: 16px; bottom: max(16px, env(safe-area-inset-bottom)); padding: 12px 16px 12px 12px; display: flex; gap: 14px; align-items: center; }
.gauge { position: relative; width: 124px; height: 124px; flex: none; }
.gauge svg { width: 100%; height: 100%; transform: rotate(135deg); }
.gauge .bg { fill: none; stroke: rgba(255,255,255,0.12); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 245 400; }
.gauge .fg { fill: none; stroke: url(#gGrad); stroke-width: 9; stroke-linecap: round; stroke-dasharray: 245 400; transition: stroke-dashoffset 0.12s linear; }
.gauge .val { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; }
.gauge .val b { font-size: 36px; font-weight: 800; font-variant-numeric: tabular-nums; line-height: 1; }
.gauge .val small { display: block; font-size: 11px; color: var(--muted); margin-top: 3px; letter-spacing: 0.08em; }
.stats { display: grid; grid-template-columns: auto auto; gap: 5px 14px; font-size: 12.5px; align-items: baseline; }
.stats span { color: var(--muted); }
.stats b { font-variant-numeric: tabular-nums; font-size: 15px; text-align: right; }
.score { position: absolute; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); padding: 12px 16px; min-width: 210px; }
.score .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fish { display: flex; align-items: center; gap: 8px; }
.fish .ico { font-size: 26px; }
#fishCount { font-size: 34px; font-weight: 900; font-variant-numeric: tabular-nums; color: var(--accent); display: inline-block; }
#fishCount.bump { animation: bump 0.45s ease; }
@keyframes bump { 30% { transform: scale(1.35); color: #fff3c4; } }
.ach { font-size: 12px; color: var(--muted); text-align: right; }
.ach b { color: var(--text); font-size: 14px; }
.timebar { margin-top: 10px; display: flex; align-items: center; gap: 8px; }
.timebar input { flex: 1; accent-color: var(--accent); pointer-events: auto; cursor: pointer; }
#clockVal { font-variant-numeric: tabular-nums; font-weight: 700; min-width: 44px; }
.hints { position: absolute; left: 50%; transform: translateX(-50%); bottom: max(16px, env(safe-area-inset-bottom)); padding: 8px 14px; font-size: 12px; color: var(--muted); display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; max-width: calc(100vw - 560px); }
.hints span { white-space: nowrap; }
#fps { position: absolute; top: 72px; right: 18px; font: 11px ui-monospace, Menlo, monospace; color: var(--muted); padding: 4px 8px; }
#toasts { position: fixed; top: 118px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 30; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 10px 16px 10px 12px; border-radius: 14px; background: var(--glass-strong); border: 1px solid rgba(255, 210, 122, 0.35); box-shadow: var(--shadow); backdrop-filter: blur(12px); transform: translateY(-14px) scale(0.96); opacity: 0; transition: all 0.45s cubic-bezier(.2,1.4,.4,1); }
.toast.in { transform: none; opacity: 1; }
.toast .emo { font-size: 24px; }
.toast b { display: block; font-size: 14px; }
.toast small { color: var(--muted); font-size: 12px; }
.pop { position: fixed; z-index: 25; pointer-events: none; font-weight: 900; font-size: 22px; color: #bff4ff; text-shadow: 0 2px 10px rgba(0, 180, 255, 0.8); transform: translate(-50%, -50%); animation: pop 1.1s ease-out forwards; }
.pop.gold { color: #ffe08a; font-size: 26px; text-shadow: 0 2px 14px rgba(255, 160, 0, 0.9); }
@keyframes pop { to { transform: translate(-50%, -160%); opacity: 0; } }
#guiHost { position: fixed; top: 70px; right: 16px; z-index: 20; max-height: calc(100vh - 220px); overflow-y: auto; border-radius: 12px; }
#guiHost .lil-gui.lil-root { --background-color: rgba(12, 16, 28, 0.78); --title-background-color: rgba(255, 181, 71, 0.16); --title-text-color: #ffe3b3; --widget-color: rgba(255,255,255,0.1); --hover-color: rgba(255,255,255,0.16); --focus-color: rgba(255,255,255,0.22); --number-color: #ffc27a; --string-color: #8ce8e2; --font-family: var(--font); --font-size: 12px; --input-font-size: 12px; --width: 270px; border-radius: 12px; overflow: hidden; backdrop-filter: blur(14px); border: 1px solid var(--stroke); }
body:not(.started) #guiHost { display: none; }
/* 电影模式黑边 */
.bars::before, .bars::after { content: ""; position: fixed; left: 0; right: 0; height: 0; background: #000; z-index: 5; transition: height 0.8s cubic-bezier(.6,0,.2,1); pointer-events: none; }
.bars::before { top: 0; }
.bars::after { bottom: 0; }
body.cinematic.bars::before, body.cinematic.bars::after { height: 9vh; }
body.cinematic.started .dash, body.cinematic.started .score, body.cinematic.started .hints { opacity: 0.35; }
#cut { position: fixed; inset: 0; background: #000; opacity: 0; pointer-events: none; z-index: 6; }
#cut.go { animation: cut 0.38s ease; }
@keyframes cut { 0% { opacity: 0; } 35% { opacity: 0.85; } 100% { opacity: 0; } }
/* 帮助 */
#help { position: fixed; inset: 0; z-index: 40; display: none; place-items: center; background: rgba(0,0,0,0.45); padding: 16px; }
#help.show { display: grid; }
#help .panel { max-width: 560px; width: 100%; padding: 22px 24px; }
#help h3 { margin: 0 0 12px; }
#help ul { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 13.5px; }
#help li { color: var(--muted); }
#help .close { margin-top: 16px; }
#help p { color: var(--muted); font-size: 12.5px; line-height: 1.7; margin: 14px 0 0; }
/* 触屏控制 */
.touch { display: none; }
@media (pointer: coarse) {
  .touch { display: block; }
  .hints { display: none; }
}
.touch .pad { position: absolute; bottom: 150px; display: flex; gap: 10px; pointer-events: auto; }
.touch .left { left: 16px; }
.touch .right { right: 16px; flex-direction: column; align-items: flex-end; }
.touch .rowb { display: flex; gap: 10px; }
.tbtn { pointer-events: auto; width: 60px; height: 60px; border-radius: 50%; border: 1px solid var(--stroke); background: var(--glass); backdrop-filter: blur(10px); font-size: 22px; display: grid; place-items: center; touch-action: none; }
.tbtn.on, .tbtn:active { background: rgba(255, 181, 71, 0.4); }
.tbtn.big { width: 72px; height: 72px; }
#fallback { position: fixed; inset: 0; display: grid; place-items: center; z-index: 99; background: #0d1424; padding: 24px; text-align: center; }
@media (max-width: 900px) {
  .cams { top: calc(max(14px, env(safe-area-inset-top)) + 58px); left: 16px; right: 16px; transform: none; overflow-x: auto; scrollbar-width: none; }
  .cams::-webkit-scrollbar { display: none; }
  .cams button { padding: 6px 9px; font-size: 12px; }
  .brand small { display: none; }
  .gauge { width: 96px; height: 96px; }
  .gauge .val b { font-size: 28px; }
  .score { min-width: 0; padding: 10px 12px; }
  .stats { font-size: 11.5px; gap: 3px 10px; }
  .stats b { font-size: 13px; }
  .timebar { display: none; }
  #help ul { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .brand > div { display: none; }
  .dash { padding: 8px 10px 8px 8px; gap: 8px; }
  .stats { display: none; }
  .tools { gap: 4px; padding: 5px; }
  .tools .icon-btn { width: 32px; height: 32px; font-size: 14px; }
  .tools .icon-btn svg { width: 16px; height: 16px; }
  .brand { padding: 8px 10px; }
  .brand b { font-size: 13px; }
}
@media (max-width: 1180px) { .hints { display: none; } }
@media (max-height: 620px) {
  .intro-art { width: 150px; }
  h1 { font-size: 30px; }
  .sub { margin: 4px 0 10px; font-size: 13px; }
  .chips { display: none; }
  .keys-hint { margin-top: 10px; font-size: 11px; line-height: 1.7; }
  .btn-primary { padding: 11px 24px; font-size: 15px; }
  .btn-ghost { padding: 11px 18px; font-size: 13px; }
}
@media (max-height: 420px) { .keys-hint, .intro-art { display: none; } }
@media (prefers-reduced-motion: reduce) { .intro-art * { animation: none !important; } }
