/* 黑洞 · 吞噬 —— 深空配色，尽量安静 */
:root {
  --bg: #05060a;
  --panel: #0c0f16;
  --line: #1d2331;
  --ink: #e7ecf7;
  --dim: #8a93a8;
  --hot: #ffb46b;
  --hot2: #ff6a3d;
  --cool: #7fb6ff;
  --radius: 14px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans CJK SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: var(--font); -webkit-text-size-adjust: 100%;
}
body { min-height: 100vh; background: radial-gradient(1200px 700px at 50% -20%, #0d1020 0%, transparent 60%), var(--bg); }
#wrap { max-width: 1040px; margin: 0 auto; padding: 14px clamp(10px, 2.5vw, 22px) 40px; }

#bar { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; }
#bar h1 { font-size: clamp(17px, 3.6vw, 23px); margin: 0; letter-spacing: .04em; font-weight: 800; }
#bar h1 span {
  font-family: var(--mono); font-weight: 500; letter-spacing: .16em;
  background: linear-gradient(90deg, var(--hot), #ff5f8f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
#back { color: var(--dim); text-decoration: none; font-size: 13px; border: 1px solid var(--line); border-radius: 999px; padding: 5px 11px; transition: .18s; }
#back:hover { color: var(--ink); border-color: var(--hot); }
#bar-btns { margin-left: auto; display: flex; gap: 8px; }

button {
  font: inherit; cursor: pointer; border-radius: 10px; padding: 9px 16px;
  border: 1px solid var(--line); background: #131826; color: var(--ink);
  transition: .16s transform, .16s background, .16s border-color;
}
button:hover { border-color: var(--hot); }
button:active { transform: translateY(1px); }
button.ghost { background: transparent; padding: 7px 11px; font-size: 14px; }
button.primary {
  background: linear-gradient(135deg, var(--hot2), var(--hot)); border-color: transparent;
  font-weight: 700; color: #1a0f06; box-shadow: 0 6px 22px -8px var(--hot2);
}
button.ghost[aria-pressed="false"] { opacity: .45; }

#hud {
  display: flex; align-items: center; gap: clamp(8px, 2vw, 20px);
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0; padding: 9px clamp(10px, 2vw, 16px);
  font-size: clamp(12px, 2.4vw, 14px);
}
.hud-cell { display: flex; flex-direction: column; gap: 2px; min-width: 56px; }
.hud-cell.grow { flex: 1; min-width: 130px; }
.hud-cell .k { color: var(--dim); font-size: 11px; letter-spacing: .06em; }
.hud-cell .k b { color: var(--hot); font-family: var(--mono); }
.hud-cell .v { font-family: var(--mono); font-weight: 700; }
#disk { height: 9px; border-radius: 999px; background: #161a25; overflow: hidden; border: 1px solid var(--line); }
#disk i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, #7a3a12, var(--hot), #fff0d0); transition: width .12s linear; }

#stage { position: relative; margin-left: auto; margin-right: auto; border: 1px solid var(--line); border-top: 0; overflow: hidden; background: #04050a; touch-action: none; }
#game { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; cursor: none; }

.overlay {
  position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 14px; text-align: center;
  padding: clamp(16px, 4vw, 36px); background: rgba(5, 6, 10, .84);
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.overlay.hidden { display: none; }
.overlay h2 { margin: 0; font-size: clamp(20px, 4.4vw, 30px); letter-spacing: .03em; }
.overlay h2 em {
  font-family: var(--mono); font-style: normal; letter-spacing: .16em;
  background: linear-gradient(90deg, var(--hot), #ff5f8f);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.lead { margin: 0; max-width: 40em; color: #c2c9dd; font-size: clamp(13px, 2.6vw, 15px); line-height: 1.75; }
.keys { display: grid; gap: 7px; font-size: clamp(11.5px, 2.3vw, 13px); color: #b6bdd4; text-align: left;
  background: #0b0e17; border: 1px solid var(--line); border-radius: 12px; padding: 12px 15px; max-width: 520px; }
.keys b { color: var(--hot); }
.tiny { margin: 0; color: var(--dim); font-size: clamp(11px, 2.2vw, 12.5px); line-height: 1.7; }
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }

#controls {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 6px 20px; margin-top: 8px; padding: 10px 12px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.slider { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 10px;
  font-size: 12.5px; color: #b9c1d6; }
.slider span { white-space: nowrap; }
.slider b { font-family: var(--mono); font-size: 12px; color: var(--hot); min-width: 42px; text-align: right; }
.slider input[type=range] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: transparent; margin: 0;
}
.slider input[type=range]::-webkit-slider-runnable-track {
  height: 4px; border-radius: 999px; background: linear-gradient(90deg, #6a4a2a, #c98b45);
}
.slider input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 18px; height: 18px; margin-top: -7px;
  border-radius: 50%; background: #ffd9a8; border: 2px solid #7a4a1c; cursor: pointer;
}
.slider input[type=range]::-moz-range-track { height: 4px; border-radius: 999px; background: #6a4a2a; }
.slider input[type=range]::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%;
  background: #ffd9a8; border: 2px solid #7a4a1c; cursor: pointer; }
.presets { display: flex; align-items: center; gap: 8px; }
.presets .dim { color: var(--dim); font-size: 11.5px; }
button.mini {
  padding: 5px 12px; font-size: 12.5px; border-radius: 999px;
  background: #141a28; border: 1px solid var(--line); color: #c6cee4;
}
button.mini.on { background: #2a1a0e; border-color: var(--hot); color: #ffe6cf; font-weight: 700; }

.check { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: #b9c1d6; }
.check input { width: 16px; height: 16px; accent-color: #ffb46b; }
.check .dim { color: var(--dim); font-size: 11.5px; }
#wrap.zen #controls { opacity: .18; transition: opacity 1s; }

#legend {
  display: flex; flex-wrap: wrap; gap: 6px 16px; align-items: center;
  padding: 9px 12px; margin-top: 8px; font-size: 12px; color: #b9c1d6;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  font-family: var(--mono);
}
#legend.hidden { display: none; }
#legend span { display: inline-flex; align-items: center; gap: 6px; }
#legend i { display: inline-block; width: 20px; height: 0; border-top: 2px dashed; }
#legend .dim { color: var(--dim); font-family: var(--font); }

#pad {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px;
  margin-top: 8px; padding: 9px; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); position: sticky; bottom: 6px; z-index: 4;
  box-shadow: 0 -8px 24px -18px #000;
}
.ctl {
  min-height: 48px; padding: 6px 8px; font-size: clamp(12px, 2.6vw, 14px); font-weight: 600;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  border-radius: 11px; background: #141a28; touch-action: none; user-select: none;
  -webkit-user-select: none; -webkit-tap-highlight-color: transparent;
}
.ctl kbd { font-size: 9.5px; opacity: .55; padding: 0 4px; border: 1px solid #2a3245; border-radius: 5px; }
.ctl.on { background: #2a1a0e; border-color: var(--hot); color: #ffe6cf; }
.ctl.cool { opacity: .5; }
.ctl:disabled { cursor: default; }

#wrap.zen #hud, #wrap.zen #legend, #wrap.zen #foot { opacity: .18; transition: opacity 1s; }
#wrap.zen #game { cursor: none; }

#foot { margin-top: 18px; color: var(--dim); font-size: 12px; line-height: 1.9; }
#foot a { color: #9fb2dd; }
#foot b { color: #c8d2ec; }
#foot i { font-style: italic; }
#foot .sep { margin: 0 6px; opacity: .5; }

@media (max-width: 560px) { .hud-cell .k { font-size: 10px; } #foot { font-size: 11.5px; } }
