/* GARGANTUA — mission terminal styling */

:root {
  --cyan: #7fdcff;
  --amber: #ffb454;
  --dim: rgba(127, 220, 255, .45);
  --white: #eafaff;
  --hair: rgba(127, 220, 255, .28);
  --navy: rgba(7, 17, 30, .82);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
  overscroll-behavior: none;
}

body {
  font-family: var(--mono);
  color: var(--white);
  position: fixed;
  inset: 0;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

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

/* ---------- post decoration ---------- */

#fx {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  opacity: .6;
  mix-blend-mode: screen;
  background-image:
    radial-gradient(ellipse at center, transparent 0%, transparent 55%, rgba(0, 0, 0, .55) 100%),
    repeating-linear-gradient(to bottom,
      rgba(255, 255, 255, .025) 0px, rgba(255, 255, 255, .025) 1px,
      transparent 1px, transparent 3px);
}

/* ---------- HUD ---------- */

#hud {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  transition: opacity .6s ease;
}
#hud.off { opacity: 0; }
#hud.off #deck { pointer-events: none; }

.bracket {
  position: fixed;
  width: 34px;
  height: 34px;
  border: 0 solid var(--dim);
  animation: bracketFlick 6s step-end infinite;
}
.bracket.tl { top: 22px; left: 22px; border-top-width: 1px; border-left-width: 1px; }
.bracket.tr { top: 22px; right: 22px; border-top-width: 1px; border-right-width: 1px; }
.bracket.bl { bottom: 22px; left: 22px; border-bottom-width: 1px; border-left-width: 1px; }
.bracket.br { bottom: 22px; right: 22px; border-bottom-width: 1px; border-right-width: 1px; }

@keyframes bracketFlick {
  0%     { opacity: 1; }
  97.5%  { opacity: .2; }
  98.1%  { opacity: 1; }
  98.7%  { opacity: .45; }
  99.2%  { opacity: 1; }
  100%   { opacity: 1; }
}

#title-block { position: fixed; top: 30px; left: 42px; }
#title-block h1 {
  font-size: 34px;
  font-weight: 700;
  letter-spacing: .42em;
  color: var(--white);
  text-shadow: 0 0 18px rgba(127, 220, 255, .35), 0 0 46px rgba(127, 220, 255, .18);
}
#title-block .sub {
  margin-top: 7px;
  font-size: 11px;
  letter-spacing: .30em;
  color: var(--amber);
}
#title-block .tag {
  margin-top: 5px;
  font-size: 9.5px;
  letter-spacing: .24em;
  color: var(--dim);
}

#met { position: fixed; top: 32px; right: 44px; text-align: right; }
#met .met-label { font-size: 9px; letter-spacing: .3em; color: var(--dim); }
#met #met-time { margin-top: 4px; font-size: 17px; letter-spacing: .18em; color: var(--cyan); }

#telemetry {
  position: fixed;
  bottom: 34px;
  left: 42px;
  font-size: 10.5px;
  line-height: 1.95;
  color: var(--cyan);
}
#telemetry .tlabel {
  display: inline-block;
  min-width: 190px;
  color: var(--dim);
  letter-spacing: .14em;
}

/* ---------- control deck ---------- */

#deck {
  position: fixed;
  bottom: 30px;
  right: 40px;
  width: 260px;
  padding: 14px 14px 10px;
  pointer-events: auto;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: linear-gradient(135deg, rgba(6, 16, 30, .80) 0%, rgba(10, 26, 44, .58) 100%);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#deck-title {
  font-size: 9px;
  letter-spacing: .3em;
  color: var(--dim);
  margin-bottom: 10px;
}
.dbtn {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--cyan);
  background: transparent;
  border: 1px solid rgba(127, 220, 255, .35);
  border-radius: 1px;
  padding: 8px 4px;
  cursor: pointer;
  min-height: 30px;
  transition: box-shadow .15s ease, border-color .15s ease, color .15s ease, background .15s ease;
}
.dbtn:hover { box-shadow: 0 0 10px rgba(127, 220, 255, .35), inset 0 0 6px rgba(127, 220, 255, .12); border-color: var(--cyan); }
.dbtn:focus-visible { outline: 1px solid var(--amber); outline-offset: 2px; }
.dbtn.active {
  border-color: var(--amber);
  color: var(--amber);
  background: rgba(255, 180, 84, .15);
}
.dbtn.full { display: block; width: 100%; margin-bottom: 8px; }
.drow { display: grid; gap: 8px; margin-bottom: 8px; }
.drow.presets { grid-template-columns: 1fr 1fr; }
.drow.quads { grid-template-columns: 1fr 1fr 1fr 1fr; gap: 6px; }
.drow.quads .dbtn { padding: 8px 2px; font-size: 8.5px; }
#deck-hint {
  font-size: 8px;
  letter-spacing: .12em;
  color: var(--dim);
  text-align: center;
  padding-top: 2px;
}

#hint {
  position: fixed;
  bottom: 34px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: .22em;
  color: var(--dim);
  opacity: 0;
  transition: opacity .8s ease;
  white-space: nowrap;
}
#hint.show { opacity: 1; }

/* ---------- parameter console ---------- */

#params {
  position: fixed;
  top: 88px;
  right: 40px;
  width: 284px;
  z-index: 15;
  max-height: 420px;
  overflow-y: auto;
  padding: 12px 14px 14px;
  border: 1px solid var(--hair);
  border-radius: 2px;
  background: linear-gradient(160deg, rgba(6, 16, 30, .82) 0%, rgba(9, 22, 40, .72) 100%);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  scrollbar-width: thin;
}
#params.hidden { display: none; }
#params::-webkit-scrollbar { width: 5px; }
#params::-webkit-scrollbar-track { background: rgba(127, 220, 255, .06); }
#params::-webkit-scrollbar-thumb { background: rgba(127, 220, 255, .35); }

#params-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  position: sticky;
  top: -12px;
  padding: 6px 0;
  background: rgba(7, 17, 30, .94);
  z-index: 1;
}
#params-head span { font-size: 9.5px; letter-spacing: .3em; color: var(--cyan); }
#btn-reset {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: .18em;
  color: var(--amber);
  background: transparent;
  border: 1px solid rgba(255, 180, 84, .4);
  padding: 3px 8px;
  cursor: pointer;
}
#btn-reset:hover { box-shadow: 0 0 8px rgba(255, 180, 84, .4); }
#btn-reset:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }

.prow { margin-bottom: 9px; }
.prow .phead {
  display: flex;
  justify-content: space-between;
  font-size: 8.5px;
  letter-spacing: .14em;
  color: var(--dim);
  margin-bottom: 3px;
}
.prow .pval { color: var(--cyan); }
.prow input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 14px;
  background: transparent;
  cursor: pointer;
}
.prow input[type="range"]::-webkit-slider-runnable-track {
  height: 3px;
  background: rgba(127, 220, 255, .22);
}
.prow input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  margin-top: -4px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(127, 220, 255, .8);
}
.prow input[type="range"]::-moz-range-track {
  height: 3px;
  background: rgba(127, 220, 255, .22);
}
.prow input[type="range"]::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border: none;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px rgba(127, 220, 255, .8);
}
.prow input[type="range"]:focus-visible { outline: 1px solid var(--amber); outline-offset: 1px; }

/* ---------- intro ---------- */

#intro {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}
body.ready #intro {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 1.6s ease, visibility 0s linear 1.6s;
}
body.shot #intro { display: none; }

#intro .card { animation: introCard 5.2s ease both; }
@keyframes introCard {
  0%   { opacity: 0; transform: scale(1.06); filter: blur(8px); }
  25%  { opacity: 1; transform: scale(1);    filter: blur(0); }
  80%  { opacity: 1; transform: scale(1);    filter: blur(0); }
  100% { opacity: 0; transform: scale(.99);  filter: blur(0); }
}
#intro .pre {
  font-size: 10px;
  letter-spacing: .5em;
  color: var(--dim);
}
#intro .big {
  margin: 18px 0 14px;
  font-size: clamp(44px, 9vw, 104px);
  font-weight: 700;
  letter-spacing: .36em;
  padding-left: .36em; /* optical centering versus trailing tracking */
  color: #fff;
  text-shadow: 0 0 26px rgba(127, 220, 255, .55), 0 0 90px rgba(127, 220, 255, .30);
}
#intro .quote {
  font-size: 12px;
  font-style: italic;
  letter-spacing: .22em;
  color: rgba(255, 180, 84, .75);
}

/* ---------- notice + recovery ---------- */

#notice {
  position: fixed;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 30;
  font-size: 10px;
  letter-spacing: .2em;
  color: var(--amber);
  border: 1px solid rgba(255, 180, 84, .4);
  background: rgba(10, 8, 2, .85);
  padding: 8px 16px;
  pointer-events: none;
  transition: opacity .4s ease;
}
#notice.hidden { opacity: 0; visibility: hidden; }

#recover {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, .78);
}
#recover.hidden { display: none; }
#recover .rbox {
  width: min(360px, calc(100vw - 48px));
  border: 1px solid rgba(255, 180, 84, .5);
  background: linear-gradient(160deg, rgba(20, 10, 2, .95), rgba(10, 6, 2, .95));
  padding: 20px 22px;
  text-align: center;
}
#recover .rtitle { font-size: 12px; letter-spacing: .3em; color: var(--amber); margin-bottom: 12px; }
#recover #recover-msg { font-size: 10px; letter-spacing: .14em; line-height: 1.8; color: var(--white); margin-bottom: 16px; }
#recover .rrow { display: flex; gap: 10px; justify-content: center; }
#recover button {
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: .18em;
  color: var(--cyan);
  background: transparent;
  border: 1px solid rgba(127, 220, 255, .45);
  padding: 8px 14px;
  cursor: pointer;
  min-height: 32px;
}
#recover button:hover { box-shadow: 0 0 10px rgba(127, 220, 255, .35); }

/* ---------- responsive ---------- */

@media (max-width: 900px) {
  #hint { display: none; }
}

@media (max-width: 720px) {
  #title-block { top: 24px; left: 24px; }
  #title-block h1 { font-size: 22px; }
  #met { top: 26px; right: 24px; }
  #telemetry { bottom: 26px; left: 24px; font-size: 9px; }
  #telemetry .tlabel { min-width: 140px; }
  .bracket { width: 24px; height: 24px; }
  .bracket.tl { top: 14px; left: 14px; }
  .bracket.tr { top: 14px; right: 14px; }
  .bracket.bl { bottom: 14px; left: 14px; }
  .bracket.br { bottom: 14px; right: 14px; }
  #deck { width: 210px; right: 20px; bottom: 24px; padding: 10px 10px 8px; }
  #params { right: 12px; width: min(284px, calc(100vw - 24px)); top: 76px; }
}

/* ---------- touch ---------- */

@media (pointer: coarse) {
  .dbtn { min-height: 40px; }
  #btn-reset { min-height: 40px; min-width: 64px; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .bracket { animation: none; }
  #intro .card { animation: introCardStatic 5.2s ease both; }
  @keyframes introCardStatic {
    0%   { opacity: 0; }
    25%  { opacity: 1; }
    80%  { opacity: 1; }
    100% { opacity: 0; }
  }
}
