/* The PyLadies room. The palette and type follow Kai's session flow deck, which
   is the visual reference for every state. Why: docs/room-display.md. */

:root {
  --ground: #14181f;
  --deep: #0f1318;
  --card: #1e242e;
  --line: #2b3440;
  --text: #eaeef4;
  --soft: #cdd6e2;
  --dim: #98a4b4;
  --pass: #7cc79a;
  --fail: #da656f;
  --presenter: #da656f;
  --closing: #b3be49;
  --focus: #9083f9;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--ground);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.45;
}
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* Each surface sets its own scale. The shared screen reads from the back of a
   room at an unknown aspect, so it scales off the short side. */
html.screen { font-size: clamp(18px, 2.4vmin, 46px); }
html.attendee { font-size: 18px; }
html.present { font-size: 16px; }

.wrap { max-width: 64rem; margin: 0 auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 1.25rem; }
.screen .wrap { max-width: none; min-height: 100dvh; padding: 3vmin 4vmin; gap: 2.5vmin; }

.eyebrow {
  margin: 0;
  font-family: var(--mono);
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}
.eyebrow--open { color: var(--pass); }
.eyebrow--live { color: var(--presenter); }
.eyebrow--closing { color: var(--closing); }
h1, h2, h3 { margin: 0; line-height: 1.12; }
h1 { font-size: 2rem; font-weight: 600; }
.screen h1 { font-size: 2.4rem; }
h2 { font-size: 1.4rem; font-weight: 700; }
p { margin: 0; }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }

.banner {
  margin: 0;
  padding: 0.6rem 1.25rem;
  background: var(--card);
  border-bottom: 2px solid var(--presenter);
  color: var(--text);
}
.demo-chip {
  position: fixed;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 3;
  margin: 0;
  padding: 0.15em 0.7em;
  border: 1.5px dashed var(--dim);
  border-radius: 999px;
  background: var(--ground);
  color: var(--dim);
  font-size: 0.8rem;
}

.panel { background: var(--deep); border: 2px solid var(--line); border-radius: 16px; padding: 1.4rem; display: flex; flex-direction: column; gap: 0.9rem; }
.panel--open { border-color: var(--pass); }
.panel--live { border-color: var(--presenter); }
.panel--closing { border-color: var(--closing); }

/* ------------------------------------------------------------ subjects */
.cast { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: 0.8rem; }
.cast li { background: var(--card); border-top: 6px solid var(--c); border-radius: 12px; padding: 0.9rem 1rem; display: flex; flex-direction: column; gap: 0.2rem; }
.who { display: inline-flex; align-items: center; gap: 0.45em; font-weight: 700; color: var(--c); }
.cast__role { font-weight: 600; font-size: 1rem; }
.cast__line { color: var(--soft); font-size: 0.95rem; }

/* ------------------------------------------------------ opening, closer */
/* The whole session is on /screen, so these two carry the start and the end. */
.opening, .closer { justify-content: center; }
.opening__title { font-size: 3rem; font-weight: 700; }
.opening__lead { font-size: 1.25rem; color: var(--soft); max-width: 48rem; }
.cast--full { grid-template-columns: repeat(4, minmax(0, 1fr)); }
@media (max-aspect-ratio: 4/3) { .cast--full { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.opening__join { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.3rem 1rem; font-size: 1.1rem; }
.opening__join .mono { font-size: 1.8rem; color: var(--pass); }
.closer { gap: 2rem; }
.closer__line { font-size: 1.6rem; line-height: 1.4; max-width: 50rem; }
.closer__link { font-size: 1.8rem; }
.closer__link a { color: var(--closing); text-decoration: none; }
.emblem { font-size: 1.25em; line-height: 1; }

/* ------------------------------------------------------------- answers */
.answers { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 15rem), 1fr)); gap: 0.9rem; }
.answer { background: var(--card); border-top: 6px solid var(--c); border-radius: 14px; padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.7rem; min-width: 0; }
.answer__head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline; gap: 0.2rem 0.8rem; }
.answer__state { font-size: 0.85rem; color: var(--dim); font-variant-numeric: tabular-nums; }
.answer__state[data-tone="trouble"] { color: var(--text); font-weight: 700; }
.answer__text { color: var(--soft); overflow-wrap: anywhere; white-space: pre-wrap; }
.answer__reason { color: var(--dim); }
.answer[data-state="failed"], .answer[data-state="empty"] { border-top-style: dashed; background: var(--deep); }
.answer[data-state="failed"] .answer__reason, .answer[data-state="empty"] .answer__reason { color: var(--soft); }
.track { height: 0.35rem; background: var(--line); border-radius: 999px; overflow: hidden; }
.track span { display: block; height: 100%; background: var(--c); transition: width 1s linear; }

/* The shared screen shows four answers at once, so each fades rather than
   spilling past its card. */
.screen .answers { flex: 1; min-height: 0; grid-template-columns: repeat(4, minmax(0, 1fr)); grid-auto-rows: minmax(0, 1fr); }
@media (max-aspect-ratio: 4/3) { .screen .answers { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.screen .answer { min-height: 0; overflow: hidden; }
.screen .answer__text { mask-image: linear-gradient(to bottom, #000 82%, transparent); overflow: hidden; }

/* ------------------------------------------------------------- verdicts */
.verdicts { display: grid; grid-template-columns: 1fr 1fr; gap: 0.6rem; }
.verdict {
  min-height: 3rem;
  border-radius: 10px;
  border: 2px solid var(--line);
  background: var(--line);
  color: var(--dim);
  font-weight: 700;
  letter-spacing: 0.04em;
}
.verdict[aria-pressed="true"][data-verdict="pass"] { background: var(--pass); border-color: var(--pass); color: var(--deep); }
.verdict[aria-pressed="true"][data-verdict="fail"] { background: var(--fail); border-color: var(--fail); color: var(--deep); }
.verdict:disabled { cursor: progress; opacity: 0.7; }
.verdict { white-space: nowrap; }
@media (max-width: 480px) {
  .wrap { padding: 0.75rem; }
  .panel { padding: 1rem; }
  .answer { padding: 0.9rem; }
}
.reason { display: flex; flex-direction: column; gap: 0.3rem; }
.reason textarea { min-height: 4.2rem; resize: vertical; padding: 0.6rem 0.7rem; border-radius: 10px; border: 1px solid var(--line); background: var(--deep); }
.saved { font-size: 0.85rem; color: var(--dim); min-height: 1.2em; }
.saved[data-tone="error"] { color: var(--text); font-weight: 700; }

/* ---------------------------------------------------------------- forms */
.field { display: flex; flex-direction: column; gap: 0.4rem; }
.field textarea { min-height: 7rem; resize: vertical; padding: 0.9rem 1rem; border-radius: 12px; border: 1px dashed #3d4856; background: #1a1f26; font-size: 1.1rem; }
.field__meta { display: flex; justify-content: space-between; gap: 1rem; font-size: 0.85rem; color: var(--dim); }
.field__meta [data-over="true"] { color: var(--text); font-weight: 700; }
.send { min-height: 3.2rem; border: 0; border-radius: 10px; background: var(--pass); color: var(--deep); font-weight: 700; font-size: 1.1rem; letter-spacing: 0.06em; }
.send:disabled { opacity: 0.6; cursor: not-allowed; }
.note { padding: 0.7rem 0.9rem; border-radius: 10px; background: var(--card); }
.note[data-tone="error"] { border-left: 4px solid var(--fail); }
.note[data-tone="ok"] { border-left: 4px solid var(--pass); }

/* ---------------------------------------------------------- leaderboard */
.board { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.5rem; }
.board li { display: grid; grid-template-columns: 2ch minmax(0, 1fr) auto; grid-template-areas: "rank text score" "rank meter meter"; gap: 0.25rem 0.8rem; padding: 0.6rem 0.8rem; border-radius: 10px; background: var(--card); }
.board li[data-mine="true"] { box-shadow: inset 4px 0 0 var(--pass); }
.board__rank { grid-area: rank; color: var(--dim); font-variant-numeric: tabular-nums; }
.board__text { grid-area: text; overflow-wrap: anywhere; }
.board__score { grid-area: score; font-family: var(--mono); font-weight: 700; }
.board .meter { grid-area: meter; }
.meter { height: 0.45rem; background: var(--line); border-radius: 999px; overflow: hidden; }
.meter span { display: block; height: 100%; background: var(--soft); }

/* ----------------------------------------------------------------- split */
.split { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1.2rem; align-items: end; }
.split__col { display: flex; flex-direction: column; align-items: center; gap: 0.5rem; min-width: 0; }
.split__share { font-family: var(--mono); font-weight: 700; font-size: 1.8rem; color: var(--c); }
.split__bar { width: min(100%, 9rem); background: var(--c); border-radius: 10px; }
.split__counts { font-size: 0.85rem; color: var(--dim); }
.screen .split { flex: 1; }
.screen .split__share { font-size: 3rem; }
@media (max-width: 480px) { .split { gap: 0.5rem; } .split__share { font-size: 1.3rem; } }

/* ------------------------------------------------------------- closing */
.failures { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.failures li { display: flex; gap: 0.8rem; align-items: baseline; padding: 0.8rem 1rem; border-radius: 10px; background: var(--card); border-left: 6px solid var(--c); }
.failures .who { min-width: 6.5rem; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
