/* TTHOF interface: red, white, minimal. Stroked outlines and transparency,
   DOS-style mono type with inverse-video highlights (after
   reference-images/dos-poster.png). The 3D canvas renders at its own
   resolution underneath; everything here renders crisp at native resolution. */

@font-face {
  font-family: 'Share Tech Mono';
  src: url('assets/fonts/ShareTechMono-Regular.ttf') format('truetype');
  font-display: swap;
}

:root {
  --red: #ff2414;
  --red-dim: rgba(255, 36, 20, 0.55);
  --white: #ffffff;
  --vcr: var(--red);                       /* the HUD's hover highlight: the brand red (was VCR blue #1b2bd6) */
  --vcr-deep: #c0150c;                     /* the landing screen: a deeper red, so its small white type reads (~6:1) */
  --glass: rgba(255, 255, 255, 0.74);      /* panels over the 3D view */
  --glass-strong: rgba(255, 255, 255, 0.92);
  --stroke: 1.5px solid var(--red);
  --mono: 'Share Tech Mono', 'Courier New', ui-monospace, monospace;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }   /* iOS: don't inflate type when the phone turns */
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #000; color: var(--red);
  font-family: var(--mono);
  text-transform: uppercase;
  -webkit-user-select: none; user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  -webkit-font-smoothing: antialiased;
}

#view {
  position: fixed; inset: 0; width: 100%; height: 100%;
  display: block; touch-action: none; outline: none;
}
#view.pixelated { image-rendering: pixelated; image-rendering: crisp-edges; }

.hidden { display: none !important; }
.inv { background: var(--red); color: var(--white); padding: 0 0.35em; }
button { font-family: var(--mono); text-transform: uppercase; cursor: pointer; }
button:focus-visible, input:focus-visible, textarea:focus-visible { outline: 2px dashed var(--red); outline-offset: 2px; }

/* ---------------- full-screen panels: white page, red type ---------------- */
.screen {
  position: fixed; inset: 0; z-index: 30;
  display: flex; align-items: center; justify-content: center;
  background: var(--white); color: var(--red);
}

/* the landing (password) and loading pages: a VCR-colour screen with the title card in white,
   Liam's wordmark over "PRESENTS", the Techno Hall of Fame wordmark and the line under it; the
   same small mono type and underlined, invert-on-hover actions as the in-game screen */
.landing {
  flex-direction: column; gap: clamp(10px, 3.5vh, 30px);
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
  justify-content: center; justify-content: safe center; overflow: hidden auto;   /* never cut off: scrolls if it must (keyboard up) */
  --ink: #ffffff; --inverse: var(--vcr-deep);
  background: var(--vcr-deep); color: var(--ink);
  font-family: 'Overpass Mono', var(--mono); font-size: clamp(12px, 1.25vw, 16px); letter-spacing: 0.04em; line-height: 1.3;
}
.landing > * { flex-shrink: 0; }
/* the title card is sized by the screen's height as well as its width, so a phone turned on its
   side still fits the whole page, password line and all */
.landing-brand {
  width: min(620px, 88vw, 100vh); width: clamp(200px, 100dvh, min(620px, 88vw));
  display: flex; flex-direction: column; align-items: center; gap: clamp(8px, 3.5vh, 28px);
}
.landing-by { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 39%; }
.landing-liam, .landing-title img { display: block; width: 100%; height: auto; filter: brightness(0) invert(1); }   /* the red wordmarks, in white */
.landing-presents, .landing-tag { margin: 0; text-align: center; }
.landing-title { width: 100%; margin: 0; font-size: inherit; font-weight: normal; }
#gate-form { margin-top: clamp(4px, 2vh, 20px); }
.gate-field { display: flex; gap: 0.8em; align-items: baseline; }
#gate-input {
  width: 11em; min-width: 0; border: 0; border-bottom: 1px solid var(--ink); outline: 0; padding: 0 0.2em;
  background: transparent; color: var(--ink); font: inherit; letter-spacing: 0.3em; text-transform: none;
}
#gate-go, .landing button {
  font: inherit; letter-spacing: inherit; color: var(--ink); background: none; border: 0; padding: 0 0.25em;
  text-decoration: underline; text-underline-offset: 0.18em;
}
#gate-go:hover, #gate-go:focus-visible { background: var(--ink); color: var(--inverse); text-decoration: none; outline: none; }
.gate-foot { position: absolute; left: 0; right: 0; bottom: max(24px, env(safe-area-inset-bottom)); margin: 0; text-align: center; font-size: 0.75em; }
/* while one of these pages is up, everything behind it is the same red: iPhone Safari's bars and
   keyboard can leave a strip of the page showing, which was black */
body:has(.landing:not(.hidden)) { background: var(--vcr-deep); }
html:has(.landing:not(.hidden)) { background: var(--vcr-deep); }
body:has(.landing:not(.hidden)) #view { visibility: hidden; }
/* a phone on its side with the keyboard up: just the password line, in the strip still showing (main.js) */
#gate.typing { bottom: auto; padding-top: 0; padding-bottom: 0; }
#gate.typing .landing-brand, #gate.typing .gate-foot { display: none; }
#gate.typing #gate-form { margin: 0; }
@media (max-height: 560px) { .gate-foot { position: static; } }   /* short screens: in line, so it can't sit on the password */
/* iPhones zoom the page into any field with type under 16px, and stay zoomed when turned */
@media (pointer: coarse) { #gate-input, #member .m-fields input, #member .m-fields textarea { font-size: 16px; } }
.shake { animation: shake 0.42s cubic-bezier(.36,.07,.19,.97); }
@keyframes shake {
  10%, 90% { transform: translateX(-1px); }
  20%, 80% { transform: translateX(3px); }
  30%, 50%, 70% { transform: translateX(-5px); }
  40%, 60% { transform: translateX(5px); }
}

/* loader: one line: LOADING, a hairline that fills solid, the percent */
#loader { z-index: 31; }
.loader-box { display: flex; gap: 1em; align-items: center; margin-top: clamp(4px, 2vh, 20px); }
.loader-track { width: 14em; height: 2px; position: relative; background: rgba(255, 255, 255, 0.3); }
#loader-fill { position: absolute; inset: 0; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform 0.25s ease-out; }
#loader-text { min-width: 3em; font-variant-numeric: tabular-nums; }

/* busy: a small turning ring and LOADING over the black between places. It turns on the
   compositor, so it keeps turning while the next place is built; it comes up straight away,
   as the dark falls */
#busy {
  position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); z-index: 41; pointer-events: none;
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  font-family: 'Overpass Mono', var(--mono); font-size: 11px; letter-spacing: 0.2em; color: rgba(255, 255, 255, 0.75);
  opacity: 0; animation: busy-in 0.15s ease-out forwards;
}
.busy-ring { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid rgba(255, 255, 255, 0.2); border-top-color: #fff;
  animation: busy-turn 0.9s linear infinite; will-change: transform; }
@keyframes busy-in { to { opacity: 1; } }
@keyframes busy-turn { to { transform: rotate(360deg); } }

/* fade-to-black overlay (also the dissolve between rooms) */
#fade { position: fixed; inset: 0; z-index: 40; background: #000; opacity: 0; pointer-events: none; }

#rotate { z-index: 60; font-size: 15px; letter-spacing: 0.2em; text-align: center; line-height: 2.2; }
#rotate span { font-size: 44px; letter-spacing: 0; }

/* ---------------- HUD over the 3D view: VCR on-screen display ----------------
   Plain small mono type (Overpass Mono) straight on the picture (no panels, borders or labels), white
   with a faint shadow. Anything you can press inverts to a solid block when hovered. */
#hud {
  position: fixed; inset: 0; z-index: 10; pointer-events: none;
  --ink: #ffffff; --inverse: var(--vcr);
  font-family: 'Overpass Mono', var(--mono); font-size: clamp(11px, 0.62vw, 12px); line-height: 1.3; letter-spacing: 0.04em;
  color: var(--ink); text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.3);
}
#hud > * { pointer-events: auto; }
/* the inverted block hugs the capitals: a little room above, almost none below (this face's
   capitals sit high, over a deep space for descenders the HUD never uses) */
#hud button, #album-list li { line-height: 1.02; padding: 0.16em 0.25em 0; }
#hud button {
  font: inherit; line-height: 1.02; letter-spacing: inherit; text-transform: inherit; color: inherit; text-shadow: inherit;
  background: none; border: 0; cursor: pointer;
}
/* pause: two solid bars, drawn */
.pause-ico { display: inline-block; width: 0.66em; height: 0.74em; box-sizing: border-box; border-left: 0.24em solid currentColor; border-right: 0.24em solid currentColor; vertical-align: -0.02em; }
#hud button:hover, #hud button:focus-visible { background: var(--ink); color: var(--inverse); text-shadow: none; text-decoration: none; outline: none; }

#back-btn { position: absolute; top: max(18px, env(safe-area-inset-top)); right: max(22px, env(safe-area-inset-right)); }

/* the action you can take: underlined, the same size as everything else */
#prompt {
  position: absolute; left: 50%; bottom: 20%; transform: translateX(-50%);
  text-decoration: underline; text-underline-offset: 0.18em;
}

#look-hint { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-50%); text-align: center; pointer-events: none !important; }

/* top left: the way back to your cursor, with the controls (shown on arrival) under it */
#hud > #corner { position: absolute; top: max(18px, env(safe-area-inset-top)); left: max(22px, env(safe-area-inset-left)); display: flex; flex-direction: column; align-items: flex-start; gap: 1.4em; pointer-events: none; }
#esc-hint { padding: 0 0.25em; opacity: 0.85; }
#esc-hint kbd { font: inherit; padding: 0 0.35em; border: 1px solid currentColor; border-radius: 3px; margin-right: 0.35em; }
#controls { padding: 0 0.25em; transition: opacity 0.6s; }
#controls.fading { opacity: 0; }
.c-arrows { letter-spacing: 0.35em; margin-right: -0.31em; }   /* the four arrow glyphs otherwise touch */
.c-keys { display: grid; grid-template-columns: auto auto; gap: 0 1.2em; margin: 0; }
.c-keys dd { margin: 0; white-space: pre; }
.c-touch { display: none; }
.touch .c-touch { display: grid; }
.touch .c-desktop { display: none; }

/* the song playing: icon, track; time, progress */
#player {
  position: absolute; left: max(22px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom));
  display: grid; grid-template-columns: auto auto; gap: 0 0.6em; align-items: baseline;
}
#pl-time { text-align: center; font-variant-numeric: tabular-nums; }
#pl-meter { letter-spacing: 0; white-space: pre; }

/* full album mode */
/* the same corner switches between the two: into the album, and from it back to exploring */
#album-btn, #al-explore { position: absolute; right: max(22px, env(safe-area-inset-right)); bottom: max(18px, env(safe-area-inset-bottom)); }
/* the album screen: its name top left, the way back top right, the tracks and the player bottom left */
#album { position: absolute; inset: 0; pointer-events: none; animation: album-in 0.6s ease-out; }   /* fades in with the first room */
@keyframes album-in { from { opacity: 0; } to { opacity: 1; } }
#album > * { pointer-events: auto; }
.al-label { position: absolute; top: max(18px, env(safe-area-inset-top)); left: max(22px, env(safe-area-inset-left)); margin: 0; padding: 0 0.25em; }
#al-return { position: absolute; top: max(18px, env(safe-area-inset-top)); right: max(22px, env(safe-area-inset-right)); }
.al-player { position: absolute; left: max(22px, env(safe-area-inset-left)); bottom: max(18px, env(safe-area-inset-bottom)); }
#album-list { list-style: none; margin: 0 0 1.2em; padding: 0; counter-reset: t; display: flex; flex-direction: column; align-items: flex-start; }
#album-list li { cursor: pointer; white-space: pre; }
#album-list li::before { counter-increment: t; content: counter(t, decimal-leading-zero) "  "; }
#album-list li:hover, #album-list li.on { background: var(--ink); color: var(--inverse); text-shadow: none; }
.al-line { display: flex; gap: 0.6em; align-items: baseline; }
.al-controls { display: flex; gap: 0.2em; }
#al-time { font-variant-numeric: tabular-nums; }
#al-meter { letter-spacing: 0; white-space: pre; }

/* touch controls */
#touch-ui { position: absolute; inset: 0; pointer-events: none; }
#joy-base {
  position: absolute; width: 116px; height: 116px; margin: -58px 0 0 -58px;
  border-radius: 50%; border: 1.5px solid var(--red); background: rgba(255, 255, 255, 0.18);
  opacity: 0; transition: opacity 0.15s; pointer-events: none;
}
#joy-base.on { opacity: 1; }
#joy-knob {
  position: absolute; left: 50%; top: 50%; width: 46px; height: 46px; margin: -23px 0 0 -23px;
  border-radius: 50%; border: 1.5px solid var(--red); background: var(--glass);
}
#action-btn {
  position: absolute; right: max(22px, env(safe-area-inset-right)); bottom: max(60px, env(safe-area-inset-bottom));
  pointer-events: auto; min-width: 88px; min-height: 48px; padding: 0 0.6em !important;
  font-size: 1.3em !important; text-decoration: underline; text-underline-offset: 0.18em;
  touch-action: none;
}
#action-btn:active { background: var(--ink) !important; color: var(--inverse) !important; text-shadow: none !important; }

#debug {
  position: absolute; top: 10px; left: 10px; margin: 0; pointer-events: none;
  font-family: var(--mono); font-size: 12px; line-height: 1.45; text-transform: none;
  color: var(--red); background: var(--glass); border: var(--stroke); padding: 6px 9px;
}

/* ---------------- membership dialogue ----------------
   An old-school game dialogue box over the room: Liam on the left, what he says
   (then the form, then the thanks) on the right. */
#member {
  position: fixed; inset: 0; z-index: 20;
  --ink: #ffffff; --inverse: #000000;
  font-family: 'Overpass Mono', var(--mono); font-size: clamp(11px, 0.62vw, 12px); line-height: 1.45; letter-spacing: 0.04em;
  color: var(--ink);
  -webkit-user-select: text; user-select: text;
}
#member button {
  font: inherit; line-height: 1.02; letter-spacing: inherit; text-transform: inherit; color: inherit;
  background: none; border: 0; padding: 0.16em 0.25em 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 0.18em;
}
#member button:hover, #member button:focus-visible { background: var(--ink); color: var(--inverse); text-decoration: none; outline: none; }
#member button:disabled { opacity: 0.5; cursor: default; }
.m-box {
  position: absolute; left: 50%; bottom: 7vh; transform: translateX(-50%);
  width: min(600px, calc(100% - 32px)); max-height: calc(100% - 32px); overflow: auto;
  display: flex; gap: 22px; align-items: flex-start;
  padding: 18px 20px 16px; border: 1px solid var(--ink); background: rgba(0, 0, 0, 0.9);
}
/* the card he's offering, large in the middle of the view above the box (question only) */
.m-hero {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  animation: m-bob 3.2s ease-in-out infinite;
  width: min(460px, 56vw, 60vh); aspect-ratio: 3 / 2; object-fit: cover; display: block;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.6), 0 4px 12px rgba(0, 0, 0, 0.4);
  pointer-events: none;
}
@keyframes m-bob { 50% { transform: translate(-50%, calc(-50% - 8px)); } }
@media (prefers-reduced-motion: reduce) { .m-hero { animation: none; } }
.m-who { margin: 0; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.m-who img { width: 96px; height: 96px; display: block; }
.m-who figcaption { letter-spacing: 0.3em; padding-left: 0.3em; }
.m-step { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 16px; }
.m-line { margin: 0; text-transform: none; }
.m-actions { display: flex; gap: 2.4em; flex-wrap: wrap; }
.m-note { margin: 0; white-space: pre-line; }
.m-note a { color: inherit; text-underline-offset: 0.18em; }
.m-note a:hover { background: var(--ink); color: var(--inverse); text-decoration: none; }
.m-fields { display: grid; grid-template-columns: 7.5em 1fr; gap: 10px 1.2em; align-items: baseline; }
.m-fields input, .m-fields textarea {
  font: inherit; letter-spacing: 0.04em; text-transform: none; color: inherit;
  background: transparent; border: 0; border-bottom: 1px solid currentColor; border-radius: 0;
  padding: 0.15em 0.2em; outline: none; resize: none; min-width: 0;
}
.m-fields input:focus, .m-fields textarea:focus { border-bottom-width: 2px; }
.m-short { width: 10em; }
.m-small { margin: 0; opacity: 0.7; }
.m-small:empty { display: none; }
.m-hp { position: absolute; left: -9999px; }
.m-done { flex: 1; display: flex; gap: 22px; align-items: flex-start; }
.m-card { flex: none; width: 130px; margin: 12px 6px 8px; aspect-ratio: 3 / 2; object-fit: cover; display: block; transform: rotate(-4deg); box-shadow: 0 8px 26px rgba(0, 0, 0, 0.35); }

@media (max-width: 700px), (max-height: 520px) {
  .m-box { flex-direction: column; align-items: stretch; gap: 12px; padding: 16px; bottom: 16px; }
  .m-who { flex-direction: row; gap: 12px; }
  .m-who img { width: 64px; height: 64px; }
  .m-fields { grid-template-columns: 1fr; gap: 4px; }
  .m-fields input, .m-fields textarea { margin-bottom: 10px; }
  .m-done { flex-direction: column; }
  .m-hero { top: 30%; width: min(460px, 80vw); }
}
}
