/* GARGANTUA — HUD styling: scientific-instrument monospace on pure black */
:root {
  --accent: #ee9b01;
  --accent-dim: rgba(238, 155, 1, 0.55);
  --ink: #e8e4da;
  --ink-dim: rgba(232, 228, 218, 0.55);
  --line: rgba(232, 228, 218, 0.14);
  --bg-panel: rgba(6, 6, 8, 0.72);
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas,
          "PingFang SC", "Microsoft YaHei", monospace;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body {
  width: 100%; height: 100%;
  background: #000;
  overflow: hidden;
  font-family: var(--mono);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
#view {
  position: fixed; inset: 0;
  width: 100vw; height: 100vh;
  display: block;
  touch-action: none;
}

/* ------------------------------- HUD frame ------------------------------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 5; }
#hud.hidden { display: none; }
#hud button, #hud input { pointer-events: auto; }

#masthead {
  position: absolute; top: 18px; left: 22px;
  user-select: none;
}
#masthead h1 {
  font-size: 22px; font-weight: 600;
  letter-spacing: 0.42em;
  color: var(--ink);
  text-shadow: 0 0 18px rgba(238, 155, 1, 0.35);
}
#masthead .sub {
  margin-top: 4px;
  font-size: 9px; letter-spacing: 0.28em;
  color: var(--accent);
}
#stats {
  margin-top: 12px;
  font-size: 10px; letter-spacing: 0.12em;
  color: var(--ink-dim);
}
#debugLabel {
  margin-top: 3px;
  font-size: 10px; letter-spacing: 0.12em;
  color: var(--accent-dim);
}

/* ----------------------------- parameter panel ---------------------------- */
#panel {
  position: absolute; top: 18px; right: 18px;
  width: 292px; max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  padding: 12px 14px 16px;
  pointer-events: auto;
  transform: translateX(calc(100% + 24px));
  transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1);
  scrollbar-width: thin;
  scrollbar-color: var(--accent-dim) transparent;
}
#panel.open { transform: translateX(0); }
.pgroup { margin-bottom: 14px; }
.pgroup-title {
  font-size: 9px; letter-spacing: 0.3em;
  color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px; margin-bottom: 8px;
}
.prow {
  display: grid;
  grid-template-columns: 92px 1fr 40px;
  align-items: center; gap: 8px;
  margin-bottom: 6px;
}
.prow label {
  font-size: 10px; color: var(--ink-dim);
  letter-spacing: 0.04em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.prow .pval {
  font-size: 10px; color: var(--ink);
  text-align: right; font-variant-numeric: tabular-nums;
}
.prow input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 2px;
  background: var(--line);
  outline: none; cursor: ew-resize;
}
.prow input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 10px; height: 10px;
  background: var(--accent);
  border: none; border-radius: 0;
}
.prow input[type="range"]::-moz-range-thumb {
  width: 10px; height: 10px;
  background: var(--accent);
  border: none; border-radius: 0;
}

/* --------------------------------- dock ---------------------------------- */
#dock {
  position: absolute; left: 50%; bottom: 16px;
  transform: translateX(-50%);
  display: flex; gap: 18px; flex-wrap: wrap; justify-content: center;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  padding: 8px 14px;
  pointer-events: auto;
  max-width: calc(100vw - 24px);
}
.dock-group { display: flex; align-items: center; gap: 6px; }
.dock-label {
  font-size: 9px; letter-spacing: 0.24em;
  color: var(--ink-dim); margin-right: 2px;
}
#dock button {
  font-family: var(--mono);
  font-size: 10px; letter-spacing: 0.12em;
  color: var(--ink-dim);
  background: transparent;
  border: 1px solid var(--line);
  padding: 5px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
#dock button:hover { color: var(--ink); border-color: var(--ink-dim); }
#dock button.active {
  color: #0a0a0a;
  background: var(--accent);
  border-color: var(--accent);
}

/* --------------------------------- help ---------------------------------- */
#help {
  position: absolute; inset: 0;
  display: none;
  align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.6);
  pointer-events: auto;
}
#help.open { display: flex; }
.help-card {
  width: min(560px, calc(100vw - 40px));
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  background: #0a0a0c;
  border: 1px solid var(--line);
  padding: 18px 20px;
}
.help-head {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; letter-spacing: 0.3em; color: var(--accent);
  border-bottom: 1px solid var(--line);
  padding-bottom: 10px; margin-bottom: 12px;
}
.help-head button {
  background: none; border: none; color: var(--ink-dim);
  font-size: 18px; cursor: pointer; font-family: var(--mono);
}
.help-head button:hover { color: var(--ink); }
.help-card table { width: 100%; border-collapse: collapse; }
.help-card td {
  font-size: 11px; padding: 5px 4px;
  border-bottom: 1px solid rgba(232, 228, 218, 0.07);
  vertical-align: top;
}
.help-card td:first-child {
  color: var(--accent); white-space: nowrap;
  width: 86px; letter-spacing: 0.08em;
}
.help-note {
  margin-top: 12px; font-size: 10px; line-height: 1.7;
  color: var(--ink-dim); word-break: break-all;
}
.help-note code { color: var(--accent-dim); }

/* ------------------------------- overlays -------------------------------- */
.overlay {
  position: fixed; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  background: #000;
  font-size: 12px; letter-spacing: 0.2em;
  color: var(--accent);
  text-align: center; padding: 24px;
}
.overlay.hidden { display: none; }
#fallback h2 { font-size: 16px; margin-bottom: 12px; color: var(--ink); }
#fallback p { color: var(--ink-dim); letter-spacing: 0.05em; line-height: 1.8; }

/* -------------------------------- mobile --------------------------------- */
@media (max-width: 720px) {
  #masthead h1 { font-size: 16px; }
  #masthead .sub { font-size: 8px; }
  #panel { width: min(292px, calc(100vw - 36px)); }
  #dock { gap: 8px; padding: 6px 8px; bottom: 10px; }
  #dock button { font-size: 9px; padding: 4px 7px; }
  .dock-label { display: none; }
}
