/* ==========================================================================
   /live/ — audience voting page for "The Gray Area" (phone first)

   Token names and hex values mirror presentations/the-gray-area/style.css
   (--ga-*) so the phone page and the projected deck speak one vocabulary.
   Values are duplicated here on purpose: this page is served by Astro from
   /assets/, outside the deck, and must not depend on the deck build, on a
   font download, or on the venue wifi. System fonts only, no @font-face.
   ========================================================================== */

:root {
  --ga-ground: #05070d;
  --ga-ground-deep: #03050a;
  --ga-surface: #0a0f18;
  --ga-surface-2: #0f1726;
  --ga-text: #eef3fa;
  --ga-text-2: #9fb0c4;
  --ga-text-3: #74879d;
  --ga-line: #5c6b80;
  --ga-blue: #5b9fe0;
  --ga-cyan: #63d8e6;
  --ga-amber: #d8b866;
  --ga-amber-deep: #b8933f;
  --ga-danger: #e2685f;

  --ga-font-display: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --ga-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, 'DejaVu Sans Mono', monospace;

  --ga-line-soft: rgba(92, 107, 128, 0.34);
  --ga-hair: rgba(238, 243, 250, 0.09);
  --ga-ghost: rgba(238, 243, 250, 0.05);
  --ga-amber-12: rgba(216, 184, 102, 0.12);
  --ga-surface-79: rgba(10, 15, 24, 0.79);

  --ga-radius: 4px;
  --ga-radius-lg: 8px;
  --ga-radius-pill: 999px;
  --ga-dur-micro: 160ms;
  --ga-dur-slow: 640ms;
  --ga-ease-out: cubic-bezier(0.22, 0.7, 0.2, 1);
  --ga-ease-emphasis: cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--ga-ground);
  color: var(--ga-text);
  font-family: var(--ga-font-display);
  font-size: 16px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: none;
}

/* Atmosphere: one warm glow from the top and grain-free vignette. Kept flat
   and cheap: no images, no filters that cost frames on old phones. */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(115% 62% at 50% -12%, rgba(216, 184, 102, 0.11), transparent 62%),
    radial-gradient(90% 45% at 50% 108%, rgba(91, 159, 224, 0.09), transparent 60%);
}

.app {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 100%;
  max-width: 520px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 16px) 18px calc(env(safe-area-inset-bottom, 0px) + 16px);
}

/* ------------------------------------------------------------------ header */

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

/* the eyebrow is the one thing in the header allowed to give way: at 360px
   it wraps to two short lines, which still fit the height the pills set */
.eyebrow {
  flex: 1 1 auto;
  min-width: 0;
  margin: 0;
  font-family: var(--ga-font-mono);
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ga-text-3);
}

.top-end {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

/* TR | EN — the same pill as the connection chip, split in two. Each half is
   26px to the eye and 44px to the thumb (the ::before reaches past the pill),
   so the header keeps its height and the switch stays easy to hit. */
.lang {
  display: inline-flex;
  flex: none;
  border: 1px solid var(--ga-line-soft);
  border-radius: var(--ga-radius-pill);
}

.lang-btn {
  position: relative;
  min-width: 44px;
  height: 24px;
  margin: 0;
  /* the trailing letter-space would push the label off centre */
  padding: 0 calc(10px - 0.14em) 0 10px;
  border: 0;
  border-radius: var(--ga-radius-pill);
  background: transparent;
  color: var(--ga-text-3);
  font-family: var(--ga-font-mono);
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: 0.14em;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color var(--ga-dur-micro) var(--ga-ease-out),
    background-color var(--ga-dur-micro) var(--ga-ease-out);
}

.lang-btn::before {
  content: '';
  position: absolute;
  inset: -10px 0;
}

.lang-btn[aria-pressed='true'] {
  background: var(--ga-amber-12);
  color: var(--ga-amber);
}

.lang-btn:focus-visible {
  outline: 2px solid var(--ga-cyan);
  outline-offset: 2px;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  padding: 5px 10px;
  border: 1px solid var(--ga-line-soft);
  border-radius: var(--ga-radius-pill);
  font-family: var(--ga-font-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ga-text-3);
}

.conn i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ga-cyan);
}

.conn[data-k='live'] i {
  animation: pulse 2.4s var(--ga-ease-out) infinite;
}

.conn[data-k='wait'] i {
  background: var(--ga-amber);
}

.conn[data-k='stale'] i {
  background: var(--ga-danger);
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}

.prompt {
  margin: 0;
  font-size: clamp(25px, 7.2vw, 33px);
  font-weight: 800;
  line-height: 1.08;
  letter-spacing: -0.02em;
  text-wrap: balance;
  overflow-wrap: anywhere;
}

.prompt--quiet {
  color: var(--ga-text-2);
  font-size: clamp(20px, 5.6vw, 25px);
}

/* -------------------------------------------------------------------- body */

.panel {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 10px;
  justify-content: center;
  padding: 4px 0 10px;
}

.panel--top {
  justify-content: flex-start;
}

.stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hint {
  margin: 0;
  font-family: var(--ga-font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ga-text-3);
}

.card {
  padding: 20px 18px;
  border: 1px solid var(--ga-line-soft);
  border-radius: var(--ga-radius-lg);
  background: var(--ga-surface-79);
  text-align: center;
}

.card h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.card p {
  margin: 8px 0 0;
  font-size: 15px;
  color: var(--ga-text-2);
  text-wrap: pretty;
  overflow-wrap: anywhere;
}

.card--wait {
  border-color: rgba(216, 184, 102, 0.4);
}

/* waiting is a state, not an empty box: one slow dot says the room is still
   listening. The number and the words carry the meaning without it. */
.card--wait h2::before {
  content: '';
  display: inline-block;
  width: 8px;
  height: 8px;
  margin-right: 9px;
  border-radius: 50%;
  background: var(--ga-amber);
  vertical-align: middle;
  animation: pulse 2.4s var(--ga-ease-out) infinite;
}

.card--warn {
  border-color: rgba(226, 104, 95, 0.42);
}

/* a line the page has to say right now: it lands, it stays six seconds, it
   goes. Amber for information, red for something that did not work. */
.flash {
  margin: 0;
  padding: 14px 16px;
  border-color: rgba(216, 184, 102, 0.45);
  background: var(--ga-amber-12);
  color: var(--ga-text);
  font-size: 15px;
  line-height: 1.35;
  text-align: left;
  overflow-wrap: anywhere;
  animation: flash-in 280ms var(--ga-ease-emphasis) both;
}

.flash.card--warn {
  border-color: rgba(226, 104, 95, 0.5);
  background: rgba(226, 104, 95, 0.13);
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* ----------------------------------------------------------------- options */

.options {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.opt {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 64px;
  padding: 15px 16px;
  border: 1px solid var(--ga-line-soft);
  border-radius: var(--ga-radius-lg);
  background: var(--ga-surface);
  color: var(--ga-text);
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  line-height: 1.25;
  text-align: left;
  cursor: pointer;
  transition: border-color var(--ga-dur-micro) var(--ga-ease-out),
    background-color var(--ga-dur-micro) var(--ga-ease-out), transform var(--ga-dur-micro) var(--ga-ease-out);
}

.opt:active {
  transform: scale(0.985);
}

.opt[aria-pressed='true'] {
  border-color: var(--ga-amber);
  background: var(--ga-amber-12);
}

/* One tap, one answer: the moment the tap lands the option says what it is.
   Single choice disables the row while the answer is in flight, multi choice
   keeps it live for editing — so `:disabled` is exactly the sent vote. */
.opt[aria-pressed='true']:disabled::after {
  content: 'your vote';
  margin-left: auto;
  flex: none;
  font-family: var(--ga-font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ga-amber);
}

.opt[aria-pressed='true']:disabled:lang(tr)::after {
  content: 'oyunuz';
}

/* the label owns the width so a long option wraps instead of pushing the mark
   off the screen at 390px */
.opt-label {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.opt:focus-visible {
  outline: 2px solid var(--ga-cyan);
  outline-offset: 2px;
}

.opt-mark {
  display: grid;
  place-items: center;
  flex: none;
  width: 26px;
  height: 26px;
  border: 1.5px solid var(--ga-line);
  border-radius: 7px;
  font-size: 14px;
  color: var(--ga-amber);
}

.opt[aria-pressed='true'] .opt-mark {
  border-color: var(--ga-amber);
}

.opt[disabled] {
  opacity: 0.6;
}

/* ------------------------------------------------------------------ input */

.field {
  width: 100%;
  min-height: 56px;
  padding: 14px 15px;
  border: 1px solid var(--ga-line-soft);
  border-radius: var(--ga-radius-lg);
  background: var(--ga-surface-2);
  color: var(--ga-text);
  font: inherit;
  font-size: 17px;
  line-height: 1.4;
  resize: none;
}

.field::placeholder {
  color: var(--ga-text-3);
}

.field:focus {
  outline: none;
  border-color: var(--ga-cyan);
}

.counter {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--ga-font-mono);
  font-size: 11.5px;
  color: var(--ga-text-3);
}

.counter span:last-child {
  text-align: right;
}

.counter--over {
  color: var(--ga-danger);
}

.btn {
  width: 100%;
  min-height: 60px;
  padding: 15px 18px;
  border: 1px solid var(--ga-line-soft);
  border-radius: var(--ga-radius-lg);
  background: var(--ga-surface);
  color: var(--ga-text);
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--ga-dur-micro) var(--ga-ease-out), opacity var(--ga-dur-micro) var(--ga-ease-out);
}

.btn:active {
  transform: scale(0.99);
}

.btn:disabled {
  opacity: 0.4;
}

.btn--primary {
  border: 0;
  background: linear-gradient(90deg, var(--ga-amber-deep), var(--ga-amber));
  color: #151a23;
}

.btn:focus-visible {
  outline: 2px solid var(--ga-cyan);
  outline-offset: 2px;
}

/* ---------------------------------------------------------------- results */

.results-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  font-family: var(--ga-font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ga-text-3);
}

.results {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.row {
  display: grid;
  gap: 6px;
  animation: rise 420ms var(--ga-ease-emphasis) both;
}

.row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 15px;
}

.row-label {
  overflow-wrap: anywhere;
}

.row-num {
  flex: none;
  font-family: var(--ga-font-mono);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--ga-text-2);
}

.row-bar {
  height: 9px;
  border-radius: var(--ga-radius-pill);
  background: var(--ga-hair);
  overflow: hidden;
}

.row-fill {
  height: 100%;
  border-radius: var(--ga-radius-pill);
  background: linear-gradient(90deg, var(--ga-blue), var(--ga-cyan));
  transition: width var(--ga-dur-slow) var(--ga-ease-emphasis);
}

.row--mine .row-top {
  color: var(--ga-amber);
}

.row--mine .row-fill {
  background: linear-gradient(90deg, var(--ga-amber-deep), var(--ga-amber));
}

.row--empty .row-fill {
  background: var(--ga-hair);
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.chip {
  max-width: 100%;
  padding: 7px 11px;
  border-radius: var(--ga-radius-pill);
  background: var(--ga-ghost);
  color: var(--ga-text-2);
  font-size: 13px;
  line-height: 1.3;
  overflow-wrap: anywhere;
  animation: rise 380ms var(--ga-ease-emphasis) both;
}

/* the approved list is a column: the heading and its chips are one block */
.screenlist {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 0;
  padding-top: 2px;
  font-family: var(--ga-font-mono);
  font-size: 11.5px;
  letter-spacing: 0.06em;
  color: var(--ga-text-3);
}

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* somebody new walked in: the count takes one step, then holds still */
.meta .is-fresh {
  animation: meta-fresh 560ms var(--ga-ease-out) both;
}

@keyframes meta-fresh {
  0% {
    transform: translateY(0);
    color: var(--ga-amber);
  }
  55% {
    transform: translateY(-2px);
    color: var(--ga-amber);
  }
  100% {
    transform: translateY(0);
    color: var(--ga-text-3);
  }
}

/* --------------------------------------------------------------- no-script */

.fallback {
  max-width: 420px;
  margin: 15vh auto;
  padding: 24px 20px;
  text-align: center;
  color: var(--ga-text-2);
}

/* without script there is no switch, so the fallback says it in both */
.fallback-alt {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid var(--ga-hair);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
