/*
 * Lobby skin: a game entrance at night.
 *
 * Cold indigo + sodium-vapour amber, the colours of a street after dark. The
 * last screen answers at the opposite temperature, so both halves share one
 * monospaced grammar while feeling nothing alike.
 * Nothing in this file may hint at what the last step does.
 */

:root {
  --night: #0C1019;
  --panel: #121826;
  --panel-2: #0F1522;
  --ink: #DFE6F2;
  --muted: #6E7C93;
  --line: #1E2637;
  --amber: #FFB03A;
  --amber-dim: rgba(255, 176, 58, .16);

  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

/* A display rule on a class must never outrank the hidden attribute: every
   step of the flow is shown and hidden through it. */
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--night);
  color: var(--ink);
  font: 15px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body { overflow-x: hidden; }

/* -------------------------------------------------------- the living field */

#field {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  /* Fades out before the headline, so no dot ever sits behind the type. */
  -webkit-mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 50%);
  mask-image: linear-gradient(180deg, #000 0%, #000 30%, transparent 50%);
}

.vignette {
  position: fixed;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    radial-gradient(130% 60% at 50% 4%, rgba(12, 16, 25, 0) 40%, rgba(12, 16, 25, .75) 100%),
    linear-gradient(180deg,
      rgba(12, 16, 25, 0) 0%,
      rgba(12, 16, 25, .18) 34%,
      rgba(12, 16, 25, .88) 56%,
      var(--night) 74%);
}

/* ------------------------------------------------------------------ layout */

#app {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 24.5rem;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 16px calc(28px + env(safe-area-inset-bottom));
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

.screen { display: none; }
/*
 * An auto margin pushes the screen down to the thumb's reach, but collapses to
 * zero when the content is taller than the viewport - unlike justify-content,
 * which would crop the top off with no way to scroll to it.
 */
.screen.is-active { display: block; margin-top: auto; }

/* -------------------------------------------------------------- typography */

.display {
  font-family: var(--mono);
  font-size: clamp(2rem, 9.5vw, 2.85rem);
  font-weight: 700;
  line-height: 1.04;
  letter-spacing: -.045em;
  margin: 0 0 18px;
}
.display em {
  font-style: normal;
  color: var(--amber);
}

h2 {
  font-family: var(--mono);
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -.035em;
  margin: 0 0 10px;
}

.lede { color: var(--muted); margin: 0 0 26px; max-width: 34ch; }

.fineprint { color: var(--muted); font-size: .78rem; margin: 16px 0 0; }
.error { color: #FF7A6B; font-size: .85rem; margin: 0 0 14px; }

/* -------------------------------------------------------------- presence */

.ping {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-family: var(--mono);
  font-size: .76rem;
  letter-spacing: .02em;
  color: var(--muted);
  margin: 0 0 22px;
}
.ping-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 0 var(--amber-dim);
  animation: ping 2.4s ease-out infinite;
}
@keyframes ping {
  0% { box-shadow: 0 0 0 0 rgba(255, 176, 58, .5); }
  70%, 100% { box-shadow: 0 0 0 9px rgba(255, 176, 58, 0); }
}

/* ------------------------------------------------------------ requirements */

.needs {
  border: 1px solid var(--line);
  border-left: 2px solid var(--amber);
  background: linear-gradient(180deg, rgba(18, 24, 38, .82), rgba(15, 21, 34, .82));
  backdrop-filter: blur(8px);
  padding: 16px 16px 14px;
  margin-bottom: 22px;
}
.needs-title {
  font-family: var(--mono);
  font-size: .78rem;
  color: var(--ink);
  margin: 0 0 12px;
}
.needs ul { list-style: none; margin: 0; padding: 0; }
.needs li {
  display: flex;
  gap: 11px;
  padding: 9px 0;
  border-top: 1px solid var(--line);
  font-size: .88rem;
  color: var(--muted);
  line-height: 1.5;
}
.needs li b {
  display: block;
  color: var(--ink);
  font-family: var(--mono);
  font-weight: 600;
  font-size: .82rem;
  margin-bottom: 2px;
}
.glyph { color: var(--amber); font-size: .8rem; line-height: 1.7; flex: 0 0 auto; }
.needs-note {
  margin: 12px 0 0;
  padding-top: 11px;
  border-top: 1px solid var(--line);
  font-size: .76rem;
  color: var(--muted);
}

/* -------------------------------------------------------------- step rail */

.rail { display: flex; gap: 5px; margin-bottom: 26px; }
.rail i { height: 2px; flex: 1; background: var(--line); }
.rail i.on { background: var(--amber); }
.rail i.done { background: rgba(255, 176, 58, .4); }

/* ---------------------------------------------------------------- camera */

.frame {
  position: relative;
  aspect-ratio: 3 / 4;
  /* Never taller than half the screen, so the buttons stay reachable without
     scrolling on a phone. The 3:4 ratio is what the saved photo is cropped to. */
  width: min(100%, calc(46dvh * 3 / 4));
  margin-inline: auto;
  background: #05070C;
  border: 1px solid var(--line);
  overflow: hidden;
  margin-bottom: 18px;
}
.frame::before, .frame::after {
  content: "";
  position: absolute;
  width: 18px; height: 18px;
  border: 1px solid var(--amber);
  pointer-events: none;
  z-index: 2;
}
.frame::before { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.frame::after { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }

/* No filter, no overlay, no effect: the camera shows exactly what it sees. */
#video, #preview { width: 100%; height: 100%; object-fit: cover; display: block; }
#video { transform: scaleX(-1); }
/* display:block above would otherwise defeat the [hidden] attribute. */
#video[hidden], #preview[hidden] { display: none; }

/* ----------------------------------------------------------- text field */

.field-input {
  appearance: none;
  width: 100%;
  padding: 15px 14px;
  margin-bottom: 14px;
  background: rgba(18, 24, 38, .82);
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink);
  font: 500 1rem/1 var(--mono);
  letter-spacing: .02em;
}
.field-input:focus { outline: none; border-color: var(--amber); }
/* 16px keeps iOS from zooming the page when the field takes focus. */
@supports (-webkit-touch-callout: none) { .field-input { font-size: 16px; } }
.field-input::placeholder { color: var(--muted); font-family: var(--sans); letter-spacing: 0; }

/* --------------------------------------------------------------- buttons */

.actions { display: flex; flex-direction: column; gap: 9px; }
.actions-row { flex-direction: row; }
.actions-row .btn { flex: 1; }

.btn {
  appearance: none;
  width: 100%;
  min-height: 52px;
  padding: 15px 18px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  border: 1px solid transparent;
  border-radius: 2px;
  font: 600 .93rem/1 var(--sans);
  cursor: pointer;
  transition: background-color .16s ease, color .16s ease, border-color .16s ease;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
.btn:disabled { opacity: .45; cursor: default; }

.btn-primary { background: var(--amber); color: #120C02; }
.btn-primary:hover { background: #FFC163; }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--muted); }
.btn-quiet { background: transparent; color: var(--muted); font-weight: 500; }
.btn-quiet:hover { color: var(--ink); }

/* -------------------------------------------------------------- progress */

.log {
  list-style: none; padding: 0; margin: 0;
  font: .78rem/2 var(--mono);
  color: var(--muted);
}
.log li { opacity: 0; animation: line-in .3s ease forwards; }
.log li::before { content: "· "; color: var(--amber); }
@keyframes line-in { to { opacity: 1; } }

.dots::after { content: ""; animation: dots 1.3s steps(4, end) infinite; }
@keyframes dots {
  0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; }
}

/* Short screens: tighten the vertical rhythm so a step still fits in one view. */
@media (max-height: 720px) {
  .display { font-size: clamp(1.7rem, 8vw, 2.2rem); margin-bottom: 12px; }
  .lede { margin-bottom: 16px; }
  .needs { padding: 13px; margin-bottom: 16px; }
  .needs li { padding: 7px 0; }
  .ping { margin-bottom: 14px; }
  .rail { margin-bottom: 18px; }
  h2 { font-size: 1.3rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
  .log li { opacity: 1; }
}
