/* ==========================================================================
   Midnight Gate 0 — UI stylesheet
   build 20260920-114212
   --------------------------------------------------------------------------
   Layout model
     - #game-canvas      : fixed, full viewport, z 0
     - #screen-fx        : CSS post effects, z 5,  pointer-events none
     - #hud              : in-game HUD + mobile controls, z 20
     - .overlay          : menus / result / pause, z 40..60
     - #veil, #rotate-nudge : transitions & nudges, z 70+
   ========================================================================== */

/* ---------- design tokens ------------------------------------------------ */
:root {
  --c-bg:          #04070c;
  --c-bg-2:        #080d16;
  --c-ink:         #dfe8f2;
  --c-ink-dim:     #8b9bb0;
  --c-ink-faint:   #56677d;
  --c-line:        rgba(126, 168, 205, 0.16);
  --c-line-strong: rgba(126, 168, 205, 0.34);

  --c-accent:      #54e0c8;   /* airport sign teal   */
  --c-accent-2:    #7ab8ff;   /* taxiway blue        */
  --c-warn:        #ffc24d;   /* delayed amber       */
  --c-danger:      #ff5a6e;   /* cancelled red       */
  --c-green:       #49d67a;   /* emergency exit      */

  --glass:         rgba(9, 15, 24, 0.82);
  --glass-2:       rgba(12, 20, 31, 0.92);
  --glass-line:    rgba(140, 190, 230, 0.14);

  --shadow-lg:     0 24px 70px rgba(0, 0, 0, 0.72);
  --shadow-md:     0 10px 30px rgba(0, 0, 0, 0.55);
  --glow-accent:   0 0 18px rgba(84, 224, 200, 0.42);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;

  --f-sans: "Helvetica Neue", "Hiragino Kaku Gothic ProN", "Hiragino Sans",
            "Noto Sans JP", "Yu Gothic", Meiryo, system-ui, sans-serif;
  --f-mono: "SFMono-Regular", "DejaVu Sans Mono", Menlo, Consolas, monospace;

  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);

  --hud-scale: 1;
}

/* ---------- reset -------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  background: var(--c-bg);
  color: var(--c-ink);
  font-family: var(--f-sans);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  touch-action: none;
}

body { position: fixed; inset: 0; width: 100%; }

button, input, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
table { border-collapse: collapse; width: 100%; }
kbd {
  display: inline-block;
  padding: 1px 6px;
  margin: 0 2px;
  border: 1px solid var(--c-line-strong);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  font: 600 0.82em/1.5 var(--f-mono);
  color: var(--c-ink);
}
::selection { background: rgba(84, 224, 200, 0.3); }

/* ---------- canvas ------------------------------------------------------- */
#game-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
  background: #000;
  touch-action: none;
}

/* ==========================================================================
   SCREEN FX — CSS-side post processing
   ========================================================================== */
#screen-fx {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  mix-blend-mode: normal;
}
.fx-layer { position: absolute; inset: 0; }

.fx-vignette {
  background:
    radial-gradient(ellipse 120% 85% at 50% 50%,
      rgba(0,0,0,0) 38%, rgba(0,0,0,0.42) 74%, rgba(0,0,0,0.82) 100%);
}

.fx-scanlines {
  background-image: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.16) 0px,
    rgba(0, 0, 0, 0.16) 1px,
    rgba(0, 0, 0, 0) 1px,
    rgba(0, 0, 0, 0) 3px);
  opacity: 0.5;
}

.fx-grain {
  opacity: 0.09;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.9'/%3E%3C/svg%3E");
  animation: grain-shift 0.55s steps(4) infinite;
}
@keyframes grain-shift {
  0%   { transform: translate(0, 0); }
  25%  { transform: translate(-2%, 1%); }
  50%  { transform: translate(1%, -2%); }
  75%  { transform: translate(-1%, -1%); }
  100% { transform: translate(0, 0); }
}

.fx-chroma {
  box-shadow:
    inset  2px 0 0 rgba(255, 60, 90, 0.045),
    inset -2px 0 0 rgba(60, 170, 255, 0.045);
}

.fx-flash {
  background: #fff;
  opacity: 0;
  transition: opacity 90ms linear;
}
.fx-flash.is-on { opacity: 0.85; transition: none; }

.fx-anomaly-pulse {
  box-shadow: inset 0 0 0 0 rgba(255, 90, 110, 0);
  transition: box-shadow 420ms ease-out;
}
.fx-anomaly-pulse.is-on {
  box-shadow: inset 0 0 130px 22px rgba(255, 60, 90, 0.34);
}
.fx-anomaly-pulse.is-good {
  box-shadow: inset 0 0 130px 22px rgba(84, 224, 200, 0.28);
}

body.fx-off .fx-scanlines,
body.fx-off .fx-grain,
body.fx-off .fx-chroma { display: none; }

/* heartbeat shake on scare */
body.shake #game-canvas { animation: cam-shake 420ms cubic-bezier(.36,.07,.19,.97); }
@keyframes cam-shake {
  10%, 90% { transform: translate(-1px, 1px); }
  20%, 80% { transform: translate(2px, -2px); }
  30%, 50%, 70% { transform: translate(-3px, 2px); }
  40%, 60% { transform: translate(3px, -1px); }
}

/* ==========================================================================
   OVERLAYS
   ========================================================================== */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: none;
  align-items: center;
  justify-content: center;
  padding: calc(16px + var(--safe-t)) calc(16px + var(--safe-r))
           calc(16px + var(--safe-b)) calc(16px + var(--safe-l));
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.overlay.is-visible { display: flex; animation: overlay-in 240ms ease-out; }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

.overlay--solid {
  background:
    radial-gradient(ellipse at 50% 20%, rgba(18, 32, 48, 0.9) 0%, rgba(4, 7, 12, 0.98) 62%),
    var(--c-bg);
}
.overlay--blur {
  background: rgba(3, 6, 11, 0.74);
  backdrop-filter: blur(14px) saturate(0.8);
  -webkit-backdrop-filter: blur(14px) saturate(0.8);
}

#loading-screen { z-index: 60; }
#error-screen   { z-index: 65; }
#result-screen  { z-index: 55; }
#pause-screen   { z-index: 50; }

/* ---------- generic panel ----------------------------------------------- */
.panel {
  width: min(560px, 100%);
  padding: clamp(20px, 3.4vw, 34px);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  background:
    linear-gradient(160deg, rgba(20, 32, 48, 0.94), rgba(7, 12, 20, 0.96));
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,0.05);
  animation: panel-in 300ms cubic-bezier(.2,.9,.25,1);
}
.panel--wide   { width: min(920px, 100%); }
.panel--result { width: min(660px, 100%); text-align: center; }
.panel--error  { width: min(520px, 100%); border-color: rgba(255,90,110,0.4); }
@keyframes panel-in {
  from { opacity: 0; transform: translateY(18px) scale(0.985); }
  to   { opacity: 1; transform: none; }
}

.panel__title {
  margin: 0 0 18px;
  font-size: clamp(19px, 2.4vw, 26px);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--c-ink);
  text-transform: uppercase;
}
.panel__title::after {
  content: "";
  display: block;
  width: 46px;
  height: 2px;
  margin-top: 10px;
  background: linear-gradient(90deg, var(--c-accent), transparent);
}
.panel__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 22px;
}
.panel__actions--stack { flex-direction: column; }
.panel__actions--stack .btn { width: 100%; }

/* ---------- buttons ------------------------------------------------------ */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 11px 20px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(255,255,255,0.07), rgba(255,255,255,0.02));
  color: var(--c-ink);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.06em;
  transition: transform 120ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
  user-select: none;
}
.btn:hover  { border-color: var(--c-accent); background: rgba(84,224,200,0.1); }
.btn:active { transform: translateY(1px) scale(0.99); }
.btn:focus-visible { outline: 2px solid var(--c-accent); outline-offset: 2px; }
.btn[disabled] { opacity: 0.45; pointer-events: none; }

.btn--primary {
  border-color: rgba(84,224,200,0.55);
  background: linear-gradient(180deg, rgba(84,224,200,0.26), rgba(84,224,200,0.08));
  color: #eafff9;
  box-shadow: var(--glow-accent);
}
.btn--primary:hover { background: linear-gradient(180deg, rgba(84,224,200,0.38), rgba(84,224,200,0.14)); }

.btn--danger {
  border-color: rgba(255,90,110,0.5);
  background: linear-gradient(180deg, rgba(255,90,110,0.2), rgba(255,90,110,0.05));
  color: #ffdde2;
}
.btn--danger:hover { background: rgba(255,90,110,0.3); border-color: var(--c-danger); }

.btn--xl { min-height: 56px; padding: 16px 30px; font-size: 16px; letter-spacing: 0.1em; }
.btn--sm { min-height: 34px; padding: 6px 13px; font-size: 12px; }
.btn__icon { font-size: 0.86em; opacity: 0.9; }

/* ---------- fields ------------------------------------------------------- */
.field { display: block; margin-bottom: 18px; }
.field--inline { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.field__label {
  display: block;
  margin-bottom: 7px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--c-ink-dim);
}
.field--inline .field__label { margin-bottom: 0; white-space: nowrap; }
.field__input {
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--c-line-strong);
  border-radius: var(--r-md);
  background: rgba(0, 0, 0, 0.45);
  color: var(--c-ink);
  font: 600 15px/1.4 var(--f-mono);
  letter-spacing: 0.06em;
  transition: border-color 160ms ease, box-shadow 160ms ease;
}
.field__input::placeholder { color: var(--c-ink-faint); }
.field__input:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 3px rgba(84,224,200,0.14);
}
.field__input--select {
  appearance: none;
  padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b9bb0' stroke-width='1.6' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
}

/* ---------- segmented control ------------------------------------------- */
.seg {
  display: flex;
  gap: 6px;
  padding: 5px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.4);
}
.seg__btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-height: 46px;
  padding: 8px 6px;
  border-radius: var(--r-sm);
  color: var(--c-ink-dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.1em;
  transition: all 160ms ease;
}
.seg__btn:hover { background: rgba(255,255,255,0.06); color: var(--c-ink); }
.seg__btn.is-active {
  background: linear-gradient(180deg, rgba(84,224,200,0.26), rgba(84,224,200,0.08));
  color: #eafff9;
  box-shadow: inset 0 0 0 1px rgba(84,224,200,0.42);
}
.seg__name { font-size: 12px; }
.seg__desc { font-size: 9.5px; opacity: 0.66; letter-spacing: 0.04em; font-weight: 500; }
.seg--sm .seg__btn { min-height: 34px; font-size: 11px; padding: 6px 10px; }

/* ---------- range / switch ---------------------------------------------- */
.range {
  width: 100%;
  height: 30px;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.range::-webkit-slider-runnable-track {
  height: 5px;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--c-accent), rgba(122,184,255,0.3));
}
.range::-webkit-slider-thumb {
  appearance: none;
  width: 20px; height: 20px;
  margin-top: -7.5px;
  border-radius: 50%;
  background: #eafff9;
  box-shadow: 0 0 10px rgba(84,224,200,0.7);
}
.range::-moz-range-track { height: 5px; border-radius: 3px; background: rgba(84,224,200,0.5); }
.range::-moz-range-thumb {
  width: 20px; height: 20px; border: 0; border-radius: 50%;
  background: #eafff9; box-shadow: 0 0 10px rgba(84,224,200,0.7);
}

.switch {
  appearance: none;
  position: relative;
  width: 50px; height: 28px;
  border-radius: 14px;
  background: rgba(255,255,255,0.12);
  border: 1px solid var(--c-line-strong);
  cursor: pointer;
  transition: background 200ms ease, border-color 200ms ease;
  flex: 0 0 auto;
}
.switch::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--c-ink-dim);
  transition: transform 200ms cubic-bezier(.3,.9,.3,1), background 200ms ease;
}
.switch:checked { background: rgba(84,224,200,0.3); border-color: var(--c-accent); }
.switch:checked::after { transform: translateX(22px); background: var(--c-accent); }

.settings-list { display: flex; flex-direction: column; gap: 4px; }
.setting {
  display: block;
  padding: 13px 4px;
  border-bottom: 1px solid var(--c-line);
}
.setting:last-child { border-bottom: 0; }
.setting__label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--c-ink);
}
.setting__label b { color: var(--c-accent); font-family: var(--f-mono); }
.setting__note { display: block; margin-top: 6px; font-size: 11px; color: var(--c-ink-faint); }
.setting--switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.setting--switch .setting__label { margin-bottom: 0; }

/* ==========================================================================
   LOADING
   ========================================================================== */
.loading-inner { width: min(460px, 100%); text-align: center; }

.loading-sign {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 26px;
  padding: 9px 22px;
  border-radius: 5px;
  background: linear-gradient(180deg, #0c6f5c, #07463a);
  box-shadow: 0 0 34px rgba(73, 214, 175, 0.42), inset 0 1px 0 rgba(255,255,255,0.18);
}
.loading-sign__arrow { font-size: 22px; color: #d8fff4; }
.loading-sign__text {
  font: 700 19px/1 var(--f-mono);
  letter-spacing: 0.24em;
  color: #eafff9;
  text-shadow: 0 0 12px rgba(180,255,240,0.7);
}

.loading-title {
  margin: 0 0 6px;
  font-size: clamp(25px, 6.4vw, 40px);
  font-weight: 200;
  letter-spacing: 0.24em;
  color: var(--c-ink);
}
.loading-sub {
  margin: 0 0 30px;
  font-size: 12px;
  letter-spacing: 0.3em;
  color: var(--c-ink-faint);
}
.loading-bar {
  height: 3px;
  margin-bottom: 14px;
  border-radius: 2px;
  background: rgba(255,255,255,0.09);
  overflow: hidden;
}
.loading-bar__fill {
  height: 100%;
  width: 0%;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--c-accent), var(--c-accent-2));
  box-shadow: 0 0 14px var(--c-accent);
  transition: width 280ms ease-out;
}
.loading-status {
  margin: 0 0 8px;
  font: 500 12px/1.6 var(--f-mono);
  letter-spacing: 0.1em;
  color: var(--c-ink-dim);
  min-height: 1.6em;
}
.loading-hint { margin: 0; font-size: 11px; letter-spacing: 0.16em; color: var(--c-ink-faint); }

.error-message { margin: 0 0 14px; font-size: 14px; line-height: 1.7; color: #ffd9de; }
.error-details { margin-bottom: 18px; font-size: 12px; color: var(--c-ink-dim); }
.error-details summary { cursor: pointer; padding: 6px 0; }
.error-details pre {
  max-height: 180px;
  overflow: auto;
  padding: 10px;
  border-radius: var(--r-sm);
  background: rgba(0,0,0,0.5);
  font: 400 11px/1.6 var(--f-mono);
  white-space: pre-wrap;
  word-break: break-all;
}

/* ==========================================================================
   TITLE SCREEN
   ========================================================================== */
.title-wrap { width: min(1080px, 100%); }

.title-header { text-align: center; margin-bottom: clamp(18px, 3vw, 34px); }
.title-kicker {
  margin: 0 0 10px;
  font: 600 10px/1 var(--f-mono);
  letter-spacing: 0.42em;
  color: var(--c-accent);
  opacity: 0.8;
}
.title-logo {
  margin: 0;
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: clamp(8px, 1.6vw, 18px);
  flex-wrap: wrap;
  line-height: 0.96;
}
.title-logo__mid {
  font-size: clamp(28px, 7vw, 66px);
  font-weight: 200;
  letter-spacing: 0.15em;
  color: #cddced;
}
.title-logo__gate {
  font-size: clamp(28px, 7vw, 66px);
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #fff;
  text-shadow: 0 0 26px rgba(122,184,255,0.5);
}
.title-logo__zero {
  font-size: clamp(34px, 8.4vw, 80px);
  font-weight: 700;
  color: var(--c-accent);
  text-shadow: 0 0 34px rgba(84,224,200,0.85), 0 0 70px rgba(84,224,200,0.4);
  animation: zero-flicker 5.5s infinite;
}
@keyframes zero-flicker {
  0%, 93%, 100% { opacity: 1; }
  94% { opacity: 0.25; }
  95% { opacity: 1; }
  96.5% { opacity: 0.45; }
  97.5% { opacity: 1; }
}
.title-jp {
  margin: 12px 0 0;
  font-size: 11px;
  letter-spacing: 0.4em;
  color: var(--c-ink-faint);
}
.title-tagline {
  margin: 16px auto 0;
  max-width: 560px;
  font-size: 13px;
  line-height: 2;
  color: var(--c-ink-dim);
}
.title-tagline strong { color: var(--c-warn); font-weight: 700; }
.hl { color: var(--c-accent); font-weight: 700; }

.title-body {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  gap: clamp(16px, 2.4vw, 30px);
  align-items: start;
}
.title-col {
  padding: clamp(18px, 2.4vw, 26px);
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  background: linear-gradient(160deg, rgba(20,32,48,0.9), rgba(7,12,20,0.94));
  box-shadow: var(--shadow-md);
}
.title-actions { margin-top: 6px; }
.title-actions .btn--xl { width: 100%; margin-bottom: 10px; }
.title-actions__row { display: flex; gap: 8px; }
.title-actions__row .btn { flex: 1; min-height: 42px; padding: 10px 8px; font-size: 12.5px; }

/* departures board ------------------------------------------------------- */
.board {
  margin-bottom: 16px;
  border: 1px solid rgba(122,184,255,0.2);
  border-radius: var(--r-md);
  background: #030609;
  overflow: hidden;
}
.board__head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: linear-gradient(180deg, rgba(122,184,255,0.16), rgba(122,184,255,0.04));
  font: 700 10px/1 var(--f-mono);
  letter-spacing: 0.22em;
  color: #b9d6f5;
}
.board__led {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--c-green);
  box-shadow: 0 0 9px var(--c-green);
  animation: led-blink 2.4s infinite;
}
@keyframes led-blink { 0%,72%,100% { opacity: 1; } 78% { opacity: 0.2; } }

.board__table { font: 600 11.5px/1 var(--f-mono); }
.board__table td {
  padding: 9px 12px;
  border-top: 1px solid rgba(122,184,255,0.1);
  color: #9fc4e8;
  letter-spacing: 0.08em;
  white-space: nowrap;
}
.board__table td:first-child { color: var(--c-warn); }
.board__st { text-align: right; color: var(--c-ink-faint) !important; }
.board__st--ok  { color: var(--c-green) !important; }
.board__st--bad { color: var(--c-danger) !important; animation: led-blink 1.8s infinite; }

.world-stats {
  padding: 14px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.35);
}
.world-stats__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
  font-size: 12px;
  color: var(--c-ink-dim);
}
.world-stats__row + .world-stats__row { border-top: 1px solid var(--c-line); }
.world-stats__row b { font: 700 13px/1 var(--f-mono); color: var(--c-accent); }

.build-tag {
  margin: 14px 0 0;
  font: 400 10px/1.6 var(--f-mono);
  letter-spacing: 0.1em;
  color: var(--c-ink-faint);
  text-align: center;
  word-break: break-all;
}

/* ==========================================================================
   HOW TO PLAY
   ========================================================================== */
.howto-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(258px, 1fr));
  gap: 14px;
}
.howto-card {
  padding: 16px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.32);
}
.howto-card h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0 0 10px;
  font-size: 14px;
  letter-spacing: 0.06em;
  color: var(--c-ink);
}
.howto-num {
  display: grid;
  place-items: center;
  width: 22px; height: 22px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: rgba(84,224,200,0.2);
  border: 1px solid rgba(84,224,200,0.45);
  font: 700 11px/1 var(--f-mono);
  color: var(--c-accent);
}
.howto-card p { margin: 0 0 10px; font-size: 12.5px; line-height: 1.85; color: var(--c-ink-dim); }
.rules { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 2; color: var(--c-ink-dim); }
.rules li::marker { color: var(--c-accent); }
.rules b { color: var(--c-ink); }
.rules em { color: var(--c-warn); font-style: normal; font-weight: 700; }

.ctrl-table { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.ctrl-table__col h4 {
  margin: 0 0 8px;
  font: 700 10px/1 var(--f-mono);
  letter-spacing: 0.2em;
  color: var(--c-accent);
}
.ctrl-table__col p { margin: 0 0 6px; font-size: 11.5px; line-height: 1.9; color: var(--c-ink-dim); }
.ctrl-table__col b { color: var(--c-ink); }

/* ==========================================================================
   RANKING
   ========================================================================== */
.rank-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 14px;
}
.rank-controls .seg { flex: 1 1 auto; }

.rank-table-wrap {
  max-height: min(48vh, 430px);
  overflow-y: auto;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.3);
}
.rank-table { font: 600 12.5px/1 var(--f-mono); }
.rank-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 10px 12px;
  background: #0b1420;
  border-bottom: 1px solid var(--c-line-strong);
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--c-ink-faint);
  text-align: left;
  white-space: nowrap;
}
.rank-table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid rgba(126,168,205,0.07);
  color: var(--c-ink-dim);
  white-space: nowrap;
}
.rank-table tbody tr:hover td { background: rgba(84,224,200,0.05); }
.rank-table tbody tr.is-me td { background: rgba(84,224,200,0.12); color: var(--c-ink); }
.rank-table tbody tr.is-me .col-name { color: var(--c-accent); }
.col-rank { width: 46px; color: var(--c-ink-faint); }
.col-name { color: var(--c-ink); max-width: 180px; overflow: hidden; text-overflow: ellipsis; }
.col-score { color: var(--c-accent); font-weight: 700; }
.col-miss, .col-plat { text-align: center; }
.rank-medal { color: var(--c-warn); font-weight: 700; }
.rank-perfect {
  margin-left: 6px;
  padding: 1px 5px;
  border-radius: 3px;
  background: rgba(255,194,77,0.2);
  border: 1px solid rgba(255,194,77,0.45);
  font-size: 9px;
  color: var(--c-warn);
}
.rank-empty { padding: 34px 12px !important; text-align: center; color: var(--c-ink-faint); }
.rank-note {
  margin: 10px 0 0;
  font-size: 11px;
  line-height: 1.8;
  color: var(--c-ink-faint);
  text-align: center;
  min-height: 1.8em;
}

/* ==========================================================================
   HUD
   ========================================================================== */
#hud {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
  display: none;
  font-size: calc(1rem * var(--hud-scale));
}
#hud.is-visible { display: block; }
#hud button { pointer-events: auto; }

/* gate progress ---------------------------------------------------------- */
.hud-gate {
  position: absolute;
  top: calc(14px + var(--safe-t));
  left: calc(16px + var(--safe-l));
  padding: 10px 16px 12px;
  border: 1px solid var(--glass-line);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-md);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
}
.hud-gate__label {
  font: 700 9px/1 var(--f-mono);
  letter-spacing: 0.24em;
  color: var(--c-ink-faint);
  margin-bottom: 4px;
}
.hud-gate__num {
  font: 200 40px/1 var(--f-mono);
  color: #fff;
  text-shadow: 0 0 22px rgba(84,224,200,0.55);
  transition: color 200ms ease, text-shadow 200ms ease;
}
.hud-gate__num.is-zero {
  color: var(--c-accent);
  text-shadow: 0 0 34px var(--c-accent);
  animation: zero-pop 700ms ease-out;
}
@keyframes zero-pop {
  0% { transform: scale(1.5); opacity: 0.4; }
  100% { transform: scale(1); opacity: 1; }
}
.hud-gate__pips { display: flex; gap: 3px; margin-top: 8px; }
.pip {
  width: 12px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.14);
  transition: background 260ms ease, box-shadow 260ms ease;
}
.pip.is-done { background: var(--c-accent); box-shadow: 0 0 7px rgba(84,224,200,0.8); }

/* run telemetry ---------------------------------------------------------- */
.hud-meta {
  position: absolute;
  top: calc(14px + var(--safe-t));
  right: calc(16px + var(--safe-r));
  min-width: 128px;
  padding: 10px 14px;
  border: 1px solid var(--glass-line);
  border-radius: var(--r-md);
  background: var(--glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--shadow-md);
}
.hud-meta__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
  padding: 2.5px 0;
  font: 700 9px/1.5 var(--f-mono);
  letter-spacing: 0.18em;
  color: var(--c-ink-faint);
}
.hud-meta__row b { font-size: 13px; letter-spacing: 0.04em; color: var(--c-ink); }
.hud-meta__row--dim { opacity: 0.55; }
.hud-meta__row.is-warn b { color: var(--c-danger); }

/* crosshair + prompt ----------------------------------------------------- */
.hud-center {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.crosshair {
  position: relative;
  width: 20px; height: 20px;
  opacity: 0.5;
  transition: opacity 180ms ease, transform 180ms ease;
}
.crosshair span {
  position: absolute;
  background: rgba(255,255,255,0.82);
  box-shadow: 0 0 4px rgba(0,0,0,0.9);
}
.crosshair span:nth-child(1) { top: 50%; left: 0; width: 100%; height: 1px; margin-top: -0.5px; }
.crosshair span:nth-child(2) { left: 50%; top: 0; height: 100%; width: 1px; margin-left: -0.5px; }
.crosshair.is-focus { opacity: 1; transform: scale(1.45); }
.crosshair.is-focus span { background: var(--c-accent); box-shadow: 0 0 8px var(--c-accent); }

.prompt {
  padding: 8px 18px;
  border: 1px solid rgba(84,224,200,0.4);
  border-radius: 40px;
  background: rgba(6,12,20,0.9);
  font: 600 12.5px/1 var(--f-sans);
  letter-spacing: 0.08em;
  color: #eafff9;
  white-space: nowrap;
  box-shadow: 0 0 22px rgba(84,224,200,0.22);
  animation: prompt-in 200ms ease-out;
}
.prompt kbd { margin-right: 4px; }
@keyframes prompt-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* decision bar ----------------------------------------------------------- */
.decision-bar {
  position: absolute;
  left: 50%;
  bottom: calc(26px + var(--safe-b));
  transform: translateX(-50%);
  display: flex;
  align-items: stretch;
  gap: 0;
  border: 1px solid var(--glass-line);
  border-radius: var(--r-lg);
  background: var(--glass-2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: dec-in 280ms cubic-bezier(.2,.9,.25,1);
  max-width: calc(100vw - 32px);
}
@keyframes dec-in {
  from { opacity: 0; transform: translate(-50%, 18px); }
  to   { opacity: 1; transform: translate(-50%, 0); }
}
.decision-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 13px clamp(16px, 3.6vw, 30px);
  min-width: 118px;
  transition: background 160ms ease;
}
.decision-btn:hover  { background: rgba(255,255,255,0.07); }
.decision-btn:active { background: rgba(255,255,255,0.13); }
.decision-btn__arrow { font-size: 19px; line-height: 1; }
.decision-btn__text { font-size: 14px; font-weight: 700; letter-spacing: 0.1em; }
.decision-btn__sub { font-size: 9.5px; letter-spacing: 0.06em; color: var(--c-ink-faint); }
.decision-btn--back .decision-btn__arrow,
.decision-btn--back .decision-btn__text { color: var(--c-warn); }
.decision-btn--fwd .decision-btn__arrow,
.decision-btn--fwd .decision-btn__text { color: var(--c-accent); }
.decision-btn--back:hover { background: rgba(255,194,77,0.13); }
.decision-btn--fwd:hover  { background: rgba(84,224,200,0.13); }

.decision-bar__divider {
  display: grid;
  place-items: center;
  padding: 0 12px;
  border-left: 1px solid var(--c-line);
  border-right: 1px solid var(--c-line);
  max-width: 132px;
}
#decision-hint {
  font: 500 10px/1.5 var(--f-mono);
  letter-spacing: 0.08em;
  color: var(--c-ink-faint);
  text-align: center;
}

/* subtitle --------------------------------------------------------------- */
.subtitle {
  position: absolute;
  left: 50%;
  bottom: calc(126px + var(--safe-b));
  transform: translateX(-50%);
  max-width: min(660px, calc(100vw - 40px));
  padding: 9px 20px;
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.76);
  border-left: 2px solid var(--c-accent-2);
  font-size: 13px;
  line-height: 1.75;
  letter-spacing: 0.03em;
  color: #d5e4f5;
  text-align: center;
  text-shadow: 0 1px 4px #000;
  animation: sub-in 260ms ease-out;
}
.subtitle.is-eerie {
  border-left-color: var(--c-danger);
  color: #ffd9de;
  font-style: italic;
  letter-spacing: 0.12em;
}
@keyframes sub-in { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* toasts ----------------------------------------------------------------- */
.toast-stack {
  position: absolute;
  top: calc(96px + var(--safe-t));
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  width: min(440px, calc(100vw - 32px));
}
.toast {
  padding: 11px 20px;
  border: 1px solid var(--glass-line);
  border-left: 3px solid var(--c-accent);
  border-radius: var(--r-md);
  background: var(--glass-2);
  backdrop-filter: blur(9px);
  -webkit-backdrop-filter: blur(9px);
  box-shadow: var(--shadow-md);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-align: center;
  animation: toast-in 300ms cubic-bezier(.2,.9,.25,1);
}
.toast.is-good { border-left-color: var(--c-green); color: #d6ffe4; }
.toast.is-bad  { border-left-color: var(--c-danger); color: #ffd9de; }
.toast.is-warn { border-left-color: var(--c-warn); color: #fff1d3; }
.toast.is-out  { animation: toast-out 260ms ease-in forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-14px) scale(0.97); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(-10px); } }

/* hints + lock invite ---------------------------------------------------- */
.hud-hints {
  position: absolute;
  left: calc(16px + var(--safe-l));
  bottom: calc(14px + var(--safe-b));
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 10.5px;
  letter-spacing: 0.06em;
  color: var(--c-ink-faint);
  text-shadow: 0 1px 3px #000;
  max-width: 44vw;
}
.lock-invite {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, 46px);
  padding: 12px 26px;
  border: 1px solid rgba(84,224,200,0.45);
  border-radius: 40px;
  background: rgba(6,12,20,0.9);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #eafff9;
  box-shadow: 0 0 26px rgba(84,224,200,0.26);
  animation: pulse-invite 2.4s ease-in-out infinite;
}
@keyframes pulse-invite {
  0%, 100% { opacity: 0.68; }
  50% { opacity: 1; box-shadow: 0 0 40px rgba(84,224,200,0.44); }
}

/* ==========================================================================
   MOBILE VIRTUAL CONTROLS
   ========================================================================== */
#mobile-controls { position: absolute; inset: 0; pointer-events: none; }

.joystick {
  position: absolute;
  left: calc(22px + var(--safe-l));
  bottom: calc(24px + var(--safe-b));
  width: 132px; height: 132px;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}
body.lefty .joystick { left: auto; right: calc(22px + var(--safe-r)); }

.joystick__ring {
  position: absolute;
  inset: 0;
  border: 2px solid rgba(255,255,255,0.18);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(10,18,28,0.5) 0%, rgba(10,18,28,0.26) 70%, transparent 100%);
  box-shadow: inset 0 0 26px rgba(0,0,0,0.5);
}
.joystick__knob {
  position: absolute;
  top: 50%; left: 50%;
  width: 56px; height: 56px;
  margin: -28px 0 0 -28px;
  border: 1.5px solid rgba(84,224,200,0.62);
  border-radius: 50%;
  background: radial-gradient(circle at 36% 32%, rgba(120,255,235,0.5), rgba(20,90,84,0.72));
  box-shadow: 0 5px 18px rgba(0,0,0,0.6), 0 0 22px rgba(84,224,200,0.34);
  transition: transform 90ms ease-out;
  will-change: transform;
}
.joystick.is-active .joystick__knob { transition: none; box-shadow: 0 0 30px rgba(84,224,200,0.6); }
.joystick__hint {
  position: absolute;
  left: 0; right: 0;
  bottom: -19px;
  text-align: center;
  font: 700 8.5px/1 var(--f-mono);
  letter-spacing: 0.24em;
  color: rgba(255,255,255,0.3);
}

.look-pad {
  position: absolute;
  right: 0;
  top: 0;
  width: 58%;
  height: 100%;
  pointer-events: auto;
  touch-action: none;
}
body.lefty .look-pad { right: auto; left: 0; }
.look-pad__hint {
  position: absolute;
  right: calc(20px + var(--safe-r));
  top: 50%;
  transform: translateY(-50%) rotate(90deg);
  transform-origin: center;
  font: 700 8.5px/1 var(--f-mono);
  letter-spacing: 0.26em;
  color: rgba(255,255,255,0.14);
  white-space: nowrap;
  transition: opacity 400ms ease;
}
.look-pad.is-used .look-pad__hint { opacity: 0; }

.touch-buttons {
  position: absolute;
  right: calc(20px + var(--safe-r));
  bottom: calc(26px + var(--safe-b));
  display: flex;
  flex-direction: column;
  gap: 11px;
  pointer-events: none;
  align-items: flex-end;
}
body.lefty .touch-buttons { right: auto; left: calc(20px + var(--safe-l)); align-items: flex-start; }

.tbtn {
  display: grid;
  place-items: center;
  width: 62px; height: 62px;
  pointer-events: auto;
  border: 1.5px solid rgba(255,255,255,0.22);
  border-radius: 50%;
  background: rgba(10,18,28,0.62);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  font: 700 12px/1 var(--f-mono);
  letter-spacing: 0.08em;
  color: rgba(255,255,255,0.86);
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  transition: transform 100ms ease, background 140ms ease, border-color 140ms ease;
  user-select: none;
}
.tbtn:active, .tbtn.is-held {
  transform: scale(0.93);
  background: rgba(84,224,200,0.3);
  border-color: var(--c-accent);
}
.tbtn--act {
  width: 74px; height: 74px;
  border-color: rgba(84,224,200,0.62);
  background: rgba(20,90,84,0.6);
  font-size: 17px;
  color: #eafff9;
  box-shadow: 0 0 24px rgba(84,224,200,0.34);
}
.tbtn--pause {
  position: absolute;
  top: calc(14px + var(--safe-t));
  right: calc(16px + var(--safe-r));
  width: 46px; height: 46px;
  font-size: 15px;
  pointer-events: auto;
}
body[data-platform="mobile"] .hud-meta { top: calc(70px + var(--safe-t)); }

/* ==========================================================================
   PAUSE / RESULT
   ========================================================================== */
.pause-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 4px;
}
.pause-stat {
  padding: 11px 13px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.3);
}
.pause-stat__k {
  font: 700 9px/1 var(--f-mono);
  letter-spacing: 0.2em;
  color: var(--c-ink-faint);
  margin-bottom: 5px;
}
.pause-stat__v { font: 600 17px/1 var(--f-mono); color: var(--c-ink); }

.result-badge {
  display: inline-block;
  margin-bottom: 14px;
  padding: 7px 24px;
  border-radius: 40px;
  font: 700 11px/1 var(--f-mono);
  letter-spacing: 0.3em;
  border: 1px solid rgba(84,224,200,0.55);
  background: rgba(84,224,200,0.16);
  color: var(--c-accent);
}
.result-badge.is-fail {
  border-color: rgba(255,90,110,0.55);
  background: rgba(255,90,110,0.16);
  color: var(--c-danger);
}
.panel--result .panel__title::after { margin-left: auto; margin-right: auto; }
.result-lead {
  margin: 0 0 20px;
  font-size: 13px;
  line-height: 1.95;
  color: var(--c-ink-dim);
}
.result-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 9px;
  margin-bottom: 20px;
}
.result-cell {
  padding: 12px 8px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.32);
}
.result-cell__k {
  font: 700 9px/1 var(--f-mono);
  letter-spacing: 0.16em;
  color: var(--c-ink-faint);
  margin-bottom: 6px;
}
.result-cell__v { font: 600 17px/1 var(--f-mono); color: var(--c-ink); }
.result-cell__v.is-hl { color: var(--c-accent); }
.result-cell__v.is-bad { color: var(--c-danger); }

.result-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 18px;
  margin-bottom: 18px;
  border: 1px solid rgba(84,224,200,0.28);
  border-radius: var(--r-md);
  background: linear-gradient(180deg, rgba(84,224,200,0.12), rgba(84,224,200,0.02));
}
.result-score__label {
  font: 700 10px/1 var(--f-mono);
  letter-spacing: 0.3em;
  color: var(--c-ink-dim);
}
.result-score__value {
  font: 200 44px/1 var(--f-mono);
  color: #fff;
  text-shadow: 0 0 26px rgba(84,224,200,0.55);
}
.result-score__rank {
  font: 600 12px/1 var(--f-mono);
  letter-spacing: 0.1em;
  color: var(--c-accent);
  min-height: 1em;
}

.result-submit {
  padding: 16px;
  margin-bottom: 4px;
  border: 1px solid var(--c-line);
  border-radius: var(--r-md);
  background: rgba(0,0,0,0.3);
  text-align: left;
}
.result-submit .btn { width: 100%; }
.result-submit__msg {
  margin: 10px 0 0;
  font: 500 11.5px/1.7 var(--f-mono);
  color: var(--c-ink-faint);
  text-align: center;
  min-height: 1.7em;
}
.result-submit__msg.is-good { color: var(--c-green); }
.result-submit__msg.is-bad  { color: var(--c-danger); }
.result-submit.is-done { opacity: 0.6; }

/* ==========================================================================
   VEIL / ROTATE NUDGE / NOSCRIPT
   ========================================================================== */
#veil {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  background: #000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 420ms ease;
}
#veil.is-on { opacity: 1; }
.veil__text {
  font: 200 clamp(17px, 3.6vw, 30px)/1.5 var(--f-mono);
  letter-spacing: 0.32em;
  color: var(--c-ink-dim);
  text-align: center;
  padding: 0 24px;
  opacity: 0;
  transition: opacity 320ms ease 120ms;
}
#veil.is-on .veil__text { opacity: 1; }

#rotate-nudge {
  position: fixed;
  inset: 0;
  z-index: 75;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 28px;
  background: rgba(3,6,11,0.96);
  text-align: center;
}
#rotate-nudge.is-visible { display: flex; }
.rotate-nudge__icon {
  font-size: 54px;
  animation: rotate-wiggle 2.2s ease-in-out infinite;
}
@keyframes rotate-wiggle {
  0%, 100% { transform: rotate(0deg); }
  50% { transform: rotate(-90deg); }
}
#rotate-nudge p { margin: 0; font-size: 14px; letter-spacing: 0.1em; color: var(--c-ink-dim); }

.noscript-warn {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: grid;
  place-items: center;
  background: var(--c-bg);
  color: var(--c-ink);
  font-size: 15px;
  padding: 24px;
  text-align: center;
}

/* ==========================================================================
   RESPONSIVE
   ========================================================================== */

/* tablets / small laptops */
@media (max-width: 900px) {
  .title-body { grid-template-columns: 1fr; }
  .title-col--side { order: -1; }
  .ctrl-table { grid-template-columns: 1fr; }
}

/* phones (portrait & small landscape) */
@media (max-width: 640px) {
  :root { --hud-scale: 0.9; }

  .overlay { padding: calc(12px + var(--safe-t)) calc(12px + var(--safe-r))
                      calc(12px + var(--safe-b)) calc(12px + var(--safe-l)); }
  .panel, .title-col { padding: 16px; border-radius: 12px; }
  .panel__title { font-size: 17px; margin-bottom: 14px; }

  .title-logo { gap: 8px; }
  .title-tagline { font-size: 12px; line-height: 1.9; }
  .title-actions__row { flex-wrap: wrap; }
  .title-actions__row .btn { flex: 1 1 30%; font-size: 11.5px; }

  .howto-grid { grid-template-columns: 1fr; }
  .rank-controls { gap: 7px; }
  .rank-controls .seg { flex: 1 1 100%; }
  .rank-table { font-size: 11px; }
  .rank-table thead th, .rank-table tbody td { padding: 8px 8px; }
  .col-miss, .col-plat { display: none; }

  .hud-gate { padding: 7px 12px 9px; }
  .hud-gate__num { font-size: 30px; }
  .hud-meta { min-width: 106px; padding: 7px 11px; }
  .hud-meta__row b { font-size: 11.5px; }
  .hud-hints { display: none; }

  .decision-btn { min-width: 92px; padding: 11px 13px; }
  .decision-btn__text { font-size: 12.5px; }
  .decision-btn__sub { font-size: 8.5px; }
  .decision-bar__divider { max-width: 88px; padding: 0 7px; }
  #decision-hint { font-size: 9px; }

  .subtitle { bottom: calc(112px + var(--safe-b)); font-size: 12px; padding: 7px 14px; }
  .result-score__value { font-size: 34px; }
  .pause-stats { grid-template-columns: 1fr 1fr; }
}

/* short landscape phones: shrink virtual controls, pull HUD in */
@media (max-height: 460px) {
  .joystick { width: 104px; height: 104px; bottom: calc(14px + var(--safe-b)); }
  .joystick__knob { width: 46px; height: 46px; margin: -23px 0 0 -23px; }
  .joystick__hint { display: none; }
  .tbtn { width: 50px; height: 50px; font-size: 11px; }
  .tbtn--act { width: 60px; height: 60px; font-size: 15px; }
  .touch-buttons { gap: 8px; bottom: calc(14px + var(--safe-b)); }
  .decision-bar { bottom: calc(12px + var(--safe-b)); }
  .decision-btn { padding: 8px 14px; }
  .subtitle { bottom: calc(86px + var(--safe-b)); }
  .toast-stack { top: calc(62px + var(--safe-t)); }
  .hud-gate__num { font-size: 26px; }
}

/* very small height: hide the decorative pips */
@media (max-height: 380px) {
  .hud-gate__pips { display: none; }
}

/* pointer-less devices get bigger tap targets */
@media (hover: none) {
  .btn { min-height: 48px; }
  .seg__btn { min-height: 48px; }
}

/* reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .fx-grain { animation: none; }
}

/* high-contrast preference */
@media (prefers-contrast: more) {
  :root { --c-ink-dim: #c3d2e2; --c-ink-faint: #93a5b8; --c-line: rgba(160,200,235,0.3); }
  .fx-vignette { opacity: 0.5; }
}
