/* Another Booth — patron room-tablet UI.
   Visual language from the Figma handoff: soft pink->lilac gradient,
   magenta primary, white rounded surfaces, rounded geometric sans. */

:root {
  --magenta: #c01e6f;
  --magenta-dark: #a8155f;
  --magenta-soft: #e79cc2;       /* disabled / muted primary */
  --ink: #6a5d72;                /* muted slate-purple headings */
  --ink-strong: #574a60;
  --muted: #a596ad;              /* secondary text */
  --surface: #ffffff;
  --surface-radius: 18px;
  --shadow: 0 10px 40px rgba(150, 70, 120, 0.12);
  --pin-pink: #f6d3e6;           /* toast / soft chips */
  /* Typography mirrors anotherbooth-web: Inter (body/UI), Space Grotesk (display/
     headings), Space Mono (small uppercase labels). Loaded via Google Fonts in the
     HTML; the system fallbacks keep things legible if the booth is offline. */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", var(--font-sans);
  --font-mono: "Space Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --font: var(--font-sans); /* default body/UI */
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  font-family: var(--font);
  color: var(--ink);
  -webkit-tap-highlight-color: transparent;
}

body {
  min-height: 100dvh;
  background:
    radial-gradient(120% 90% at 12% 10%, #ffd9ea 0%, rgba(255, 217, 234, 0) 55%),
    radial-gradient(120% 100% at 88% 8%, #fdeef6 0%, rgba(253, 238, 246, 0) 60%),
    linear-gradient(135deg, #ffe3f0 0%, #fdeff6 45%, #ece1f4 100%);
  background-attachment: fixed;
  overflow: hidden;
}

.hidden { display: none !important; }

#app { height: 100dvh; }

.view { height: 100dvh; }

.view-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
  padding: 6vh 6vw;
  text-align: center;
}

/* ---- Typography ---- */

.hero {
  font-family: var(--font-display);
  font-size: clamp(1.8rem, 4.4vw, 3rem);
  font-weight: 700;
  line-height: 1.15;
  color: var(--ink);
  margin: 0;
}
.hero em { color: var(--magenta); font-style: italic; }

.waiting-title {
  font-family: var(--font-display);
  font-size: clamp(1.5rem, 3.6vw, 2.4rem);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  max-width: 18ch;
}

.hint {
  color: var(--magenta);
  font-size: clamp(0.9rem, 1.8vw, 1.05rem);
  margin: 0;
  max-width: 60ch;
}

/* ---- Buttons ---- */

.btn {
  font-family: inherit;
  font-weight: 600;
  letter-spacing: 0.06em;
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.05s ease, opacity 0.15s ease;
}
.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--magenta); color: #fff; }
.btn-primary:hover { background: var(--magenta-dark); }
.btn-primary:disabled { background: var(--magenta-soft); color: #fff; cursor: default; }

.btn-block {
  width: min(560px, 88vw);
  padding: 20px 24px;
  font-size: 1rem;
}

/* ---- PIN entry ---- */

.pin-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 28px;
}
.pin-boxes { display: flex; gap: clamp(10px, 2vw, 18px); }
.pin-box {
  width: clamp(64px, 13vw, 116px);
  height: clamp(70px, 13vw, 104px);
  border: 1px solid #f0d3e3;
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-size: clamp(1.6rem, 4vw, 2.4rem);
  font-family: inherit;
  text-align: center;
  color: #2a2330;
  outline: none;
}
.pin-box:focus { border-color: var(--magenta); box-shadow: 0 0 0 3px rgba(192, 30, 111, 0.18); }

/* ---- NOW SHOOTING layout ---- */

.view-shoot {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(16px, 3vh, 32px) clamp(20px, 4vw, 56px);
  gap: clamp(12px, 2vh, 24px);
}

.shoot-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
}
.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.room-name {
  font-size: clamp(1.1rem, 2.4vw, 1.5rem);
  font-weight: 700;
  font-style: italic;
  color: var(--ink-strong);
}
.time-left {
  justify-self: end;
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.25rem);
}
.time-left b { color: var(--magenta); }

.stage {
  background: var(--surface);
  border-radius: var(--surface-radius);
  box-shadow: var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 0;
}
.stage-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 24px;
}
.stage-lead { font-size: clamp(1.3rem, 3vw, 2rem); font-weight: 600; color: var(--ink); }
.stage-big {
  font-size: clamp(3rem, 14vh, 9rem);
  font-weight: 700;
  color: var(--magenta);
  line-height: 1;
}
.stage-big.neutral { color: #2a2330; }
.stage-shot-label { font-size: clamp(0.9rem, 1.8vw, 1.1rem); color: var(--muted); letter-spacing: 0.04em; }
.stage-captured { font-size: clamp(2rem, 6vw, 3.5rem); font-weight: 700; color: var(--magenta); }
.stage-fail { font-size: clamp(1.2rem, 2.6vw, 1.6rem); font-weight: 600; color: var(--magenta-dark); }

@keyframes pop { 0% { transform: scale(0.8); opacity: 0; } 60% { transform: scale(1.08); } 100% { transform: scale(1); opacity: 1; } }
.pop { animation: pop 0.28s ease-out; }

.shoot-footer {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
}
.photo-count { color: var(--ink-strong); font-size: clamp(1rem, 2vw, 1.3rem); }
.photo-count b { color: var(--magenta); }
.btn-take {
  width: min(560px, 46vw);
  padding: 22px 24px;
  font-size: 0.95rem;
}
.assist {
  justify-self: end;
  text-align: right;
  font-size: 0.85rem;
  color: var(--magenta);
  line-height: 1.3;
}
.assist a, .assist-center a { color: var(--magenta); text-decoration: underline; }

/* ---- Stepper ---- */

.stepper {
  list-style: none;
  display: flex;
  align-items: center;
  gap: 0;
  margin: 0;
  padding: 0;
  justify-self: center;
}
.stepper-top { margin: clamp(12px, 4vh, 40px) auto 0; }
.step {
  display: flex;
  align-items: center;
}
.step-node {
  width: clamp(40px, 5.2vw, 52px);
  height: clamp(40px, 5.2vw, 52px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.05rem;
  background: var(--surface);
  border: 2px solid #f0d3e3;
  color: var(--magenta-soft);
  box-shadow: var(--shadow);
}
.step-connector {
  width: clamp(28px, 4vw, 56px);
  height: 2px;
  background: #f0d3e3;
}
.step.done .step-node { background: var(--magenta); border-color: var(--magenta); color: #fff; }
.step.current .step-node { background: var(--surface); border-color: var(--magenta); color: var(--magenta); }
.step.done .step-connector,
.step.current .step-connector { background: var(--magenta); }

/* ---- Transition (booth ended / all done) ---- */

.view-transition {
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: clamp(16px, 3vh, 32px);
  text-align: center;
}
.transition-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
}
.transition-title {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 4vw, 2.6rem);
  font-weight: 700;
  color: var(--ink);
  margin: 0;
}
.transition-title em { color: var(--magenta); font-style: normal; }
.transition-sub {
  font-size: clamp(1.2rem, 3vw, 2rem);
  color: var(--ink);
  margin: 0;
  font-weight: 500;
}
.transition-timer {
  margin-top: 22px;
  color: var(--magenta);
  font-size: clamp(1rem, 2.2vw, 1.3rem);
}
.assist-center { color: var(--magenta); font-size: 0.9rem; align-self: center; }

/* ---- Toast ---- */

.toast {
  position: fixed;
  top: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(-12px);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  z-index: 50;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.toast-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: var(--pin-pink);
  color: var(--magenta);
}
.toast-text { font-size: clamp(1.1rem, 2.4vw, 1.5rem); font-weight: 600; color: var(--magenta); }

/* ---- Net banner ---- */

.net-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px;
  background: rgba(168, 21, 95, 0.92);
  color: #fff;
  font-size: 0.85rem;
  letter-spacing: 0.03em;
}
.net-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #fff;
  animation: blink 1s steps(2, start) infinite;
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.3; } }

/* ---- Selection station ---------------------------------------------------- */
.view-select {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 16px clamp(12px, 4vw, 40px);
  gap: 12px;
}

/* layout: photo grid on the left, the "Your strip" preview as a column on the right */
.select-body { flex: 1; min-height: 0; display: flex; flex-direction: row; gap: 16px; }

/* left: pick area */
.select-pick { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.select-header { flex: 0 0 auto; text-align: center; }
.select-title { margin: 0 0 2px; font-size: clamp(1.3rem, 3.5vw, 1.9rem); color: var(--ink-strong); }
.select-title em { color: var(--magenta); font-style: italic; }
.select-sub { margin: 0 0 8px; color: var(--muted); font-size: 0.95rem; }

/* 2 columns of square photos; scroll down for the rest. squareSelectGrid() sets the
   row height (grid-auto-rows) to the cell width in JS — aspect-ratio on a grid item
   doesn't reserve row-track height, so rows would otherwise overlap. */
.select-grid {
  flex: 1; min-height: 0; overflow-y: auto;
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px;
  align-content: start; padding: 4px;
}
.select-cell {
  position: relative; padding: 0; border: 3px solid transparent;
  border-radius: 12px; overflow: hidden; background: var(--surface);
  box-shadow: var(--shadow); cursor: pointer;
}

/* right: live strip preview, square slots stacked to fill the column height */
.select-preview { flex: 0 0 auto; display: flex; flex-direction: column; min-height: 0; }
.preview-title { margin: 0 0 8px; text-align: center; color: var(--ink-strong); font-size: 1.05rem; }
.strip {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 8px; background: #fff; border-radius: 14px; box-shadow: var(--shadow);
}
.strip-slot {
  flex: 1 1 0; min-height: 0; aspect-ratio: 1 / 1;
  border-radius: 8px; overflow: hidden;
  background: #f6e6f0; display: flex; align-items: center; justify-content: center;
  color: var(--magenta-soft); font-size: 1.4rem; font-weight: 700;
}
.strip-slot img { width: 100%; height: 100%; object-fit: cover; }
.select-cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.select-cell.selected { border-color: var(--magenta); }
.select-num {
  position: absolute; top: 8px; right: 8px;
  min-width: 34px; height: 34px; padding: 0 6px; border-radius: 17px;
  background: var(--magenta); color: #fff; font-weight: 700; font-size: 1.1rem;
  display: none; align-items: center; justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.select-footer { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.select-hint { margin: 0; text-align: center; color: var(--ink); font-size: 1.02rem; }
#select-confirm { width: min(520px, 100%); padding: 18px 24px; font-size: 1rem; }

.select-message {
  flex: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; color: var(--muted);
}
.select-message h2 { color: var(--ink-strong); margin: 0 0 6px; }

/* post-print thank-you screen */
.done-title { color: var(--ink-strong); margin: 0 0 4px; font-size: clamp(1.4rem, 4vw, 2rem); }
.done-sub { margin: 0 0 18px; color: var(--ink); }
.done-qr {
  width: clamp(150px, 34vmin, 260px); aspect-ratio: 1 / 1; padding: 12px;
  background: #fff; border-radius: 16px; box-shadow: var(--shadow);
}
.done-qr svg, .done-qr img { width: 100%; height: 100%; display: block; }
.done-qr-cap { margin: 12px 0 0; color: var(--ink-strong); font-weight: 600; }
.done-countdown { margin: 18px 0 0; color: var(--muted); font-size: 0.98rem; }
.done-countdown b { color: var(--magenta); font-variant-numeric: tabular-nums; }
.done-skip { margin-top: 18px; width: min(420px, 100%); padding: 18px 24px; font-size: 1rem; }

/* ---- Shell mode: live camera feed behind the UI, ONLY during the shoot ----------- */
/* The native Android shell (?shell=1) sets body.feed while #view-shoot is active. Only
   then does the background go transparent so the UVC feed shows through; every other
   screen (PIN, waiting, transition, selection) keeps the normal coloured background.
   Plain browsers never get these classes, so the web UI is unchanged. */
body.shell.feed { background: transparent; }

/* gentle top/bottom scrim so the shoot chrome stays readable; centre stays clear for the
   subject + countdown */
body.shell.feed::before {
  content: "";
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background: linear-gradient(180deg,
    rgba(0, 0, 0, 0.6) 0%, rgba(0, 0, 0, 0.22) 30%,
    rgba(0, 0, 0, 0.22) 70%, rgba(0, 0, 0, 0.62) 100%);
}
body.shell.feed #app { position: relative; z-index: 1; }

/* shoot-view chrome + countdown go light over the feed */
body.shell.feed .eyebrow,
body.shell.feed .room-name,
body.shell.feed .time-left,
body.shell.feed .photo-count,
body.shell.feed .stage-lead,
body.shell.feed .stage-shot-label {
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.9), 0 2px 16px rgba(0, 0, 0, 0.65);
}
body.shell.feed .time-left b,
body.shell.feed .photo-count b { color: #ff9ed0; }

/* drop the white card so the countdown floats over the feed */
body.shell.feed .stage { background: transparent; box-shadow: none; }
body.shell.feed .stage-big { text-shadow: 0 2px 6px rgba(0, 0, 0, 0.85), 0 6px 28px rgba(0, 0, 0, 0.6); }
body.shell.feed .stage-big.neutral { color: #fff; }
