/* Phrase Potato styles.
   Layout: one column, one job per screen. Pick a mode, set up (or join a room),
   then a full-colour play screen tinted by whichever team holds the potato,
   then a score screen, then a winner. */

:root { color-scheme: light; }
body { margin: 0; }
[hidden] { display: none !important; }  /* screens use display:flex, so hidden needs this */

:root {
  --bg: #EDF0F5;
  --surface: #FFFFFF;
  --fg: #12151F;
  --muted: #566074;
  --line: #C6CEDB;
  --focus: #2F5BEA;
  --t0: #0A7F73;
  --t1: #C81E64;
  --t0-text: #0A7F73;
  --t1-text: #C81E64;
  --display: 'Bricolage Grotesque', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: 'DM Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0E1118;
    --surface: #171B26;
    --fg: #EEF1F7;
    --muted: #9AA4B8;
    --line: #2C3445;
    --focus: #8FA8FF;
    --t0-text: #3CC9B8;
    --t1-text: #FF6B9F;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0E1118;
  --surface: #171B26;
  --fg: #EEF1F7;
  --muted: #9AA4B8;
  --line: #2C3445;
  --focus: #8FA8FF;
  --t0-text: #3CC9B8;
  --t1-text: #FF6B9F;
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--display);
  font-size: 17px;
  line-height: 1.4;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}
#app { min-height: 100%; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; }
.inner {
  width: 100%;
  max-width: 34rem;
  margin: 0 auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding-block: 22px;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
}

.t0 { --team: var(--t0); }
.t1 { --team: var(--t1); }
.tint { background: var(--team); color: #fff; transition: background-color .2s ease; }

h1, h2 { margin: 0; font-weight: 800; letter-spacing: -0.025em; text-wrap: balance; }
h1 { font-size: clamp(2.8rem, 13vw, 4rem); line-height: .92; }
h2 { font-size: clamp(2rem, 9vw, 2.8rem); line-height: 1; }
p { margin: 0; }
.lede { font-size: 1.15rem; max-width: 30ch; }
.mono, legend, .bar, .hint {
  font-family: var(--mono);
  font-size: .78rem;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.hint { color: var(--muted); text-transform: none; letter-spacing: .02em; font-size: .82rem; }

/* Divider between the intro and the rules */
.bar-rule { width: 100%; height: 4px; margin: 0; border: 0; border-radius: 2px; background: var(--fg); }
.tip { color: var(--muted); }
.tip strong { color: var(--fg); }

ol.rules { margin: 0; padding-left: 1.4rem; display: grid; gap: 8px; }
ol.rules li::marker { font-family: var(--mono); color: var(--muted); }

fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 10px; }
legend { padding: 0; color: var(--muted); margin-bottom: 2px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.chip { position: relative; display: block; min-width: 0; }
.chip span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 48px; padding: 6px 16px;
  border: 2px solid var(--line); border-radius: 999px;
  background: var(--surface); color: var(--fg);
  font-weight: 600; cursor: pointer;
}
.chip input:checked + span { background: var(--fg); color: var(--bg); border-color: var(--fg); }
.chip input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }
.vh {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; opacity: 0;
}

.btn {
  display: block; width: 100%; min-height: 62px; padding: 12px 18px;
  border: 2px solid transparent; border-radius: 12px;
  font-family: var(--display); font-weight: 800; font-size: 1.2rem; line-height: 1.15;
  cursor: pointer; text-align: center;
}
.btn:active { transform: scale(.985); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.solid { background: var(--fg); color: var(--bg); }
.btn.onteam { background: #fff; color: var(--team); }
.btn.ghost { background: transparent; color: var(--fg); border-color: var(--line); min-height: 52px; font-size: 1rem; font-weight: 600; }
.tint .btn.ghost { color: #fff; border-color: rgba(255,255,255,.75); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
.tint :focus-visible { outline-color: #fff; }

/* Play screen */
.bar { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px 16px; }
.stage { flex: 1; display: flex; flex-direction: column; justify-content: center; gap: 14px; min-width: 0; }
.cat { font-family: var(--mono); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.phrase { margin: 0; font-weight: 800; line-height: 1.02; letter-spacing: -0.025em; text-wrap: balance; overflow-wrap: break-word; }
.phrase[data-size="l"] { font-size: clamp(3rem, 16vw, 5.5rem); }
.phrase[data-size="m"] { font-size: clamp(2.4rem, 12.5vw, 4.4rem); }
.phrase[data-size="s"] { font-size: clamp(2rem, 10vw, 3.4rem); }
.dot { width: 18px; height: 18px; border-radius: 50%; background: #fff; opacity: .55; }
.actions { display: grid; gap: 12px; }

/* Score screens */
.board { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.score { background: var(--team); color: #fff; border-radius: 16px; padding: 16px; display: grid; gap: 6px; min-width: 0; }
.score .name { font-family: var(--mono); font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; }
.score .num { font-size: 4rem; font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; }
.pips { display: flex; flex-wrap: wrap; gap: 5px; }
.pip { width: 12px; height: 12px; border-radius: 50%; border: 2px solid rgba(255,255,255,.8); }
.pip.on { background: #fff; }
.who-line { font-size: 1.15rem; max-width: 32ch; }
.spacer { flex: 1; }
.final { font-family: var(--mono); font-size: 1rem; letter-spacing: .04em; }

/* Online: room code, text boxes, team lists */
.field { display: grid; gap: 8px; }
.field > span { color: var(--muted); }
.input {
  width: 100%; min-height: 56px; padding: 10px 16px;
  border: 2px solid var(--line); border-radius: 12px;
  background: var(--surface); color: var(--fg);
  font-family: var(--display); font-size: 1.2rem; font-weight: 600;
}
.input.code { font-family: var(--mono); font-weight: 500; font-size: 1.6rem; letter-spacing: .3em; text-transform: uppercase; }
.room-code { font-family: var(--mono); font-weight: 500; font-size: clamp(3rem, 18vw, 5rem); letter-spacing: .15em; line-height: 1; }
.seg.two { grid-template-columns: 1fr 1fr; }
.score ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; font-weight: 600; overflow-wrap: anywhere; }
.score li.you::after { content: ' (you)'; font-weight: 400; opacity: .8; }
.score li.empty { font-weight: 400; opacity: .8; }
.tint .hint { color: rgba(255,255,255,.9); }
.hint.error { color: var(--t1-text); }

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