/* Odd Word Out: a card table. Light: warm card stock on a felt-green tint. Dark: a dim card room. house/theme.js sets
   data-theme="dark" on <html>. Teal is "the group", coral "the odd one out", mustard the turn and the winner. Role
   cards have a patterned back (three dots, like the logo) and flip in 3D while held. */
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 600; font-display: swap; src: url(/fonts/fredoka-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Fredoka"; font-style: normal; font-weight: 700; font-display: swap; src: url(/fonts/fredoka-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Nunito"; font-style: normal; font-weight: 200 1000; font-display: swap; src: url(/fonts/nunito-latin-wght-normal.woff2) format("woff2"); }

:root {
  --bg: #F7F1E6;
  --bg2: #EDE4D3;
  --card: #FFFDF8;
  --ink: #1F2333;
  --muted: #646474;
  --line: #DDD2BE;
  --felt: rgba(18, 128, 127, .06);
  --teal: #12807F;
  --teal-hi: #D5EEEC;
  --on-teal: #FFFFFF;
  --coral: #D9483A;
  --coral-hi: #FBE0DB;
  --mustard: #E3A82B;
  --mustard-hi: #FFF1CC;
  --back1: #1F5D73;
  --back2: #2A7A8C;
  --bad: #B2332A;
  --backdrop: rgba(20, 22, 34, .45);
  --font: "Nunito", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --head: "Fredoka", "Nunito", system-ui, sans-serif;
  --lb-panel: var(--card); --lb-panel2: var(--bg2); --lb-text: var(--ink); --lb-muted: var(--muted); --lb-line: var(--line);
  --lb-accent: var(--teal); --lb-ink: var(--on-teal); --lb-bad: var(--bad); --lb-font: var(--font); --lb-head: var(--head);
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #15141E;
  --bg2: #201F2C;
  --card: #1E1D29;
  --ink: #F1EEE6;
  --muted: #A9A6B6;
  --line: #34323F;
  --felt: rgba(60, 200, 190, .05);
  --teal: #4FC7BE;
  --teal-hi: #173A3B;
  --on-teal: #0B1A1A;
  --coral: #FF7A68;
  --coral-hi: #43221F;
  --mustard: #F2C14E;
  --mustard-hi: #3A3017;
  --back1: #163E4D;
  --back2: #21596A;
  --bad: #FF8A7D;
  --backdrop: rgba(0, 0, 0, .6);
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { touch-action: manipulation; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); line-height: 1.45; min-height: 100vh; min-height: 100dvh;
  -webkit-text-size-adjust: 100%; padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right);
  background-image: radial-gradient(120% 70% at 50% 0%, var(--felt), transparent 70%); background-repeat: no-repeat; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
:focus-visible { outline: 3px solid var(--teal); outline-offset: 2px; }

/* ------------------------------------------------------------ page frame */
.wrap { max-width: 640px; margin: 0 auto; padding: 0 16px; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 10px 0 0; }
.back { text-decoration: none; color: var(--muted); font-size: .95rem; white-space: nowrap; }
.top-actions { display: flex; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 0; background: transparent; cursor: pointer; display: grid; place-items: center; font-weight: 700; font-size: 1.1rem; color: var(--ink); }
@media (hover: hover) { .icon-btn:hover { background: var(--bg2); } }
.icon-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.title-row { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; padding: 4px 0 10px; gap: 4px 10px; }
h1 { font-family: var(--head); font-weight: 700; font-size: 2rem; margin: 0; line-height: 1; display: flex; align-items: center; gap: 10px; }
.h-mark { display: inline-flex; gap: 3px; }
.h-mark i { width: 10px; height: 14px; border-radius: 3px; background: var(--teal); display: block; }
.h-mark i:nth-child(2) { background: var(--coral); transform: translateY(-3px) rotate(8deg); }
.sub { margin: 0; color: var(--muted); font-size: .95rem; }

/* ------------------------------------------------------------ cards, buttons, fields */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 20px; padding: 16px; margin: 14px 0 0; }
.card-h { font-family: var(--head); font-weight: 600; font-size: 1.15rem; margin: 0 0 4px; }
.fine { margin: 4px 0; color: var(--muted); font-size: .9rem; }
.fine:empty { display: none; }
.err { margin: 6px 0 0; color: var(--bad); font-size: .92rem; min-height: 1.2em; }
.err:empty { min-height: 0; margin: 0; }
.btn { border: 0; background: var(--teal); color: var(--on-teal); border-radius: 999px; padding: 0 22px; min-height: 48px; font-weight: 800; cursor: pointer; font-size: 1.02rem;
  display: block; margin: 12px auto 0; max-width: 100%; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--line); }
.btn.small { min-height: 40px; font-size: .92rem; font-weight: 700; padding: 0 16px; }
.btn:disabled { opacity: .5; cursor: default; }
@media (hover: hover) { .btn:not(:disabled):hover { filter: brightness(1.06); } .btn.ghost:not(:disabled):hover { border-color: var(--teal); } }
.under { display: block; margin: 10px auto 0; background: none; border: 0; color: var(--muted); text-decoration: underline; cursor: pointer; min-height: 40px; }
.in, .sel, .ta { width: 100%; min-width: 0; border: 1.5px solid var(--line); background: var(--bg); color: var(--ink); border-radius: 14px; padding: 10px 14px; font-size: 1.05rem; }
.in:focus, .sel:focus, .ta:focus { outline: none; border-color: var(--teal); }
.ta { resize: vertical; min-height: 110px; line-height: 1.4; font-size: 1rem; }
.row { display: flex; gap: 8px; align-items: stretch; margin-top: 10px; }
.row .btn { margin: 0; flex: none; }
.lbl { display: block; margin: 0 0 4px; font-weight: 700; font-size: .92rem; }

/* settings */
.opts { display: grid; gap: 12px; margin-top: 8px; }
.seg { display: flex; flex-wrap: wrap; gap: 6px; }
.seg button { flex: 1 1 auto; min-height: 40px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--bg); cursor: pointer; padding: 6px 12px; font-weight: 700; font-size: .92rem; }
.seg button.on { background: var(--teal); border-color: var(--teal); color: var(--on-teal); }
.seg button:disabled { cursor: default; }
.seg button:disabled:not(.on) { opacity: .55; }
.custom { margin-top: 12px; }

/* one phone */
.pass-list { list-style: none; margin: 10px 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; counter-reset: p; }
.pass-list li { display: inline-flex; align-items: center; gap: 2px; padding: 4px 4px 4px 12px; border-radius: 999px; background: var(--bg2); font-weight: 700; counter-increment: p; }
.pass-list li::before { content: counter(p); font-size: .75rem; color: var(--muted); margin-right: 6px; }
.pass-list .x { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; cursor: pointer; font-size: 1.2rem; line-height: 1; color: var(--muted); }

/* ------------------------------------------------------------ the game */
.bar { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.rnd { font-weight: 800; font-size: .92rem; color: var(--muted); white-space: nowrap; }
.ph { font-family: var(--head); font-weight: 600; font-size: 1.1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clock { position: relative; width: 44px; height: 44px; flex: none; display: grid; place-items: center; }
.clock svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ck-bg, .ck-fg { fill: none; stroke-width: 3.5; }
.ck-bg { stroke: var(--line); }
.ck-fg { stroke: var(--teal); stroke-linecap: round; stroke-dasharray: 94.25; stroke-dashoffset: calc(94.25 * (1 - var(--p, 1))); transition: stroke-dashoffset .2s linear; }
.clock b { position: relative; font-size: .95rem; font-variant-numeric: tabular-nums; }
.clock.low .ck-fg { stroke: var(--coral); }
.clock.low b { color: var(--coral); animation: pulse .5s ease-in-out infinite alternate; }
@keyframes pulse { to { transform: scale(1.15); } }

.seats { list-style: none; margin: 4px 0 10px; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.seat { position: relative; display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 999px; background: var(--card); border: 1.5px solid var(--line); font-size: .9rem; max-width: 100%; transition: border-color .2s, background .2s; }
.seat .nm { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 9em; }
.seat .sc { font-variant-numeric: tabular-nums; color: var(--muted); font-weight: 700; }
.seat.me { border-color: var(--teal); }
.seat.ok::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--teal); }
.seat.turn { border-color: var(--mustard); background: var(--mustard-hi); animation: bob 1s ease-in-out infinite alternate; }
@keyframes bob { to { transform: translateY(-2px); } }
.seat.gone { opacity: .45; border-style: dashed; }
.seat.spec { opacity: .7; border-style: dotted; }
.seat.acc { border-color: var(--coral); }
.seat.odd { background: var(--coral-hi); border-color: var(--coral); }
.seat .plus { position: absolute; top: -10px; right: -6px; background: var(--mustard); color: #2A1E02; font-weight: 900; font-size: .75rem; border-radius: 999px; padding: 1px 6px; animation: rise .6s .9s both cubic-bezier(.2, 1.6, .4, 1); }
@keyframes rise { from { opacity: 0; transform: translateY(8px) scale(.6); } }

/* the role card: press and hold to look */
.rolecard { margin: 4px auto 6px; max-width: 360px; text-align: center; perspective: 900px; }
.flip { position: relative; display: block; width: 100%; height: 150px; border: 0; padding: 0; background: none; cursor: pointer; touch-action: none;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; transform-style: preserve-3d; transition: transform .38s cubic-bezier(.3, 1.3, .5, 1); }
.flip.peek { transform: rotateY(180deg) scale(1.03); }
.face { position: absolute; inset: 0; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 10px 14px;
  backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 6px 18px rgba(20, 30, 40, .16); }
.face.back { color: #F4FBFA; background: repeating-linear-gradient(45deg, var(--back1) 0 10px, var(--back2) 10px 20px); border: 4px solid var(--card); outline: 1.5px solid var(--line); }
.face.back b { font-family: var(--head); font-weight: 600; font-size: 1.3rem; }
.face.back small { opacity: .85; }
.mono { display: inline-flex; gap: 4px; margin-bottom: 4px; }
.mono i { width: 12px; height: 16px; border-radius: 3px; background: #F4FBFA; display: block; }
.mono i:nth-child(2) { background: #FFB4A8; transform: translateY(-3px) rotate(8deg); }
.face.front { transform: rotateY(180deg); background: var(--card); border: 2px solid var(--teal); }
.face.front small { color: var(--muted); font-size: .85rem; }
.face.front b { font-family: var(--head); font-weight: 700; font-size: 2.2rem; line-height: 1.05; overflow-wrap: anywhere; }
.face.front b.long { font-size: 1.6rem; }
.flip.odd .face.front { border-color: var(--coral); background: var(--coral-hi); }
.flip.odd .face.front b { font-size: 1.5rem; color: var(--coral); }
.rolecard .fine { font-size: .82rem; }

.stage { text-align: center; padding: 4px 0 8px; min-height: 120px; }
.stage .big { font-family: var(--head); font-weight: 600; font-size: 1.5rem; margin: 6px 0 4px; line-height: 1.15; animation: in .35s both; }
.stage .big.turn { color: var(--teal); }
.stage .kick { margin: 0; text-transform: uppercase; letter-spacing: .1em; font-size: .75rem; font-weight: 800; color: var(--muted); }
.stage .line { margin: 4px 0; }
.stage .row { max-width: 420px; margin-left: auto; margin-right: auto; }
@keyframes in { from { opacity: 0; transform: translateY(6px); } }

.clues { list-style: none; margin: 12px auto 0; padding: 0; max-width: 460px; display: grid; gap: 6px; text-align: left; }
.clues li { display: flex; gap: 10px; align-items: baseline; padding: 8px 12px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); }
.clues li.now { border-color: var(--mustard); background: var(--mustard-hi); }
.clues .who { font-weight: 800; flex: 0 0 auto; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clues .what { color: var(--muted); font-style: normal; overflow-wrap: anywhere; }
.clues .what.said { color: var(--ink); font-family: var(--head); font-weight: 600; font-size: 1.08rem; animation: pop .35s both cubic-bezier(.2, 1.5, .4, 1); }
@keyframes pop { from { opacity: 0; transform: scale(.7); } }
.order { list-style: none; counter-reset: o; margin: 12px auto 0; padding: 0; max-width: 360px; display: grid; gap: 6px; }
.order li { counter-increment: o; padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); font-weight: 800; text-align: left; display: flex; gap: 10px; }
.order li::before { content: counter(o); color: var(--teal); }
.order li.me { border-color: var(--teal); }

.votes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; margin: 12px auto 0; max-width: 520px; }
.vote { min-height: 64px; border-radius: 16px; border: 2px solid var(--line); background: var(--card); cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 8px; transition: transform .15s, border-color .15s; }
.vote b { font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; max-width: 100%; white-space: nowrap; }
.vote small { color: var(--muted); font-size: .8rem; overflow-wrap: anywhere; }
.vote.on { border-color: var(--coral); background: var(--coral-hi); transform: scale(1.03); }
.vote.on b::before { content: "\261D  "; }
.vote:disabled { opacity: .45; cursor: default; }
@media (hover: hover) { .vote:not(:disabled):hover { border-color: var(--coral); } }

/* the accusation: each accused card flips over after a drum roll */
.accused { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin: 14px 0 0; perspective: 900px; }
.acc-card { width: 200px; max-width: 100%; height: 120px; }
.acc-in { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; animation: accflip .8s calc(2s + var(--i, 0) * .6s) both cubic-bezier(.3, 1.4, .5, 1); }
.acc-f, .acc-b { position: absolute; inset: 0; border-radius: 18px; display: flex; flex-direction: column; align-items: center; justify-content: center; backface-visibility: hidden; -webkit-backface-visibility: hidden; padding: 8px; }
.acc-f { background: var(--card); border: 2px solid var(--line); font-family: var(--head); font-weight: 600; font-size: 1.4rem; animation: shake .12s 6 alternate; }
.acc-b { transform: rotateY(180deg); font-weight: 800; }
.acc-b b { font-family: var(--head); font-size: 1.3rem; }
.acc-b.is-odd { background: var(--coral); color: #FFF; }
.acc-b.not-odd { background: var(--teal-hi); color: var(--ink); border: 2px solid var(--teal); }
@keyframes accflip { from { transform: rotateY(0); } to { transform: rotateY(180deg); } }
@keyframes shake { from { transform: rotate(-2deg); } to { transform: rotate(2deg); } }
.dots { font-size: 1.6rem; color: var(--muted); letter-spacing: .2em; animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .3; } }

/* the reveal */
.reveal { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; margin: 8px 0 4px; perspective: 900px; }
.word-card { min-width: 160px; padding: 14px 22px; border-radius: 18px; background: var(--card); border: 2px solid var(--teal); display: flex; flex-direction: column; align-items: center; animation: deal .7s both cubic-bezier(.2, 1.3, .4, 1); }
.word-card small { color: var(--muted); font-size: .82rem; }
.word-card b { font-family: var(--head); font-weight: 700; font-size: 2rem; line-height: 1.1; overflow-wrap: anywhere; }
.word-card.decoy { border-color: var(--coral); background: var(--coral-hi); animation-delay: .25s; }
@keyframes deal { from { opacity: 0; transform: rotateY(-90deg) translateY(10px); } }
.odd-line { font-weight: 800; font-size: 1.08rem; margin: 10px 0 4px; }
.odd-line.pop { animation: in .4s .5s both; }
.res { list-style: none; margin: 8px auto; padding: 0; max-width: 480px; display: grid; gap: 6px; }
.res li { padding: 10px 14px; border-radius: 14px; font-weight: 700; animation: in .4s calc(.8s + var(--i, 0) * .25s) both; }
.res .slip, .res .steal { background: var(--coral-hi); border: 1.5px solid var(--coral); }
.res .caught { background: var(--teal-hi); border: 1.5px solid var(--teal); }
.res .void { background: var(--bg2); }
.votes-line { max-width: 480px; margin-left: auto; margin-right: auto; }

.podium { list-style: none; margin: 12px auto 0; padding: 0; max-width: 420px; display: grid; gap: 6px; }
.podium li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 14px; background: var(--card); border: 1px solid var(--line); animation: in .4s calc(var(--i, 0) * .12s) both; }
.podium li.first { background: var(--mustard-hi); border-color: var(--mustard); }
.podium .pl { font-family: var(--head); font-weight: 700; width: 1.6em; color: var(--muted); }
.podium li.first .pl { color: var(--mustard); }
.podium .nm { flex: 1; text-align: left; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium .sc { font-variant-numeric: tabular-nums; font-weight: 800; }

/* ------------------------------------------------------------ dialogs, toast, footer */
dialog.dlg { border: 1px solid var(--line); border-radius: 20px; background: var(--card); color: var(--ink); max-width: min(460px, calc(100vw - 24px)); width: 100%; padding: 24px 22px;
  max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow: auto; }
dialog.dlg::backdrop { background: var(--backdrop); }
dialog.dlg h2 { margin: 0 0 10px; font-family: var(--head); font-weight: 600; font-size: 1.35rem; }
dialog.dlg h3 { margin: 14px 0 4px; font-size: 1.02rem; }
dialog.dlg p { margin: 6px 0; }
dialog.dlg form:first-child { position: sticky; top: 0; height: 0; z-index: 3; }
.x { position: absolute; top: -14px; right: -12px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--bg2); font-size: 1.5rem; cursor: pointer; line-height: 1; }
dialog.dlg .go { display: block; margin: 14px auto 0; border: 0; background: var(--teal); color: var(--on-teal); border-radius: 999px; min-height: 44px; padding: 0 24px; font-weight: 800; cursor: pointer; }
.toast { position: fixed; left: 50%; bottom: max(24px, env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 10px 18px; border-radius: 999px;
  font-weight: 700; opacity: 0; pointer-events: none; transition: opacity .25s, transform .25s; z-index: 50; max-width: calc(100vw - 32px); text-align: center; }
.toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }
.ad-inline { margin: 18px 0; }
.foot { display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: center; padding: 18px 0 30px; color: var(--muted); font-size: .85rem; border-top: 1px solid var(--line); margin-top: 10px; text-align: center; }
.foot a { color: var(--muted); }

@media (max-width: 400px) {
  h1 { font-size: 1.7rem; }
  .card { padding: 14px; }
  .flip { height: 136px; }
  .face.front b { font-size: 1.9rem; }
  .stage .big { font-size: 1.3rem; }
  .votes { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .acc-card { width: 150px; height: 104px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0s !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
  .acc-in { animation: none; transform: rotateY(180deg); }
}

/* during play: a slimmer title, and the role card shrinks to a strip outside the deal (it still flips while held) */
body.in-game .title-row { padding-bottom: 2px; }
body.in-game h1 { font-size: 1.3rem; gap: 8px; }
body.in-game .h-mark i { width: 7px; height: 10px; }
body.in-game .sub { display: none; }
.rolecard.mini .flip { height: 78px; }
.rolecard.mini .face { flex-direction: row; gap: 10px; border-radius: 14px; padding: 6px 12px; }
.rolecard.mini .face.back { border-width: 3px; }
.rolecard.mini .face.back small, .rolecard.mini .face.front small, .rolecard.mini + .fine, .rolecard.mini .fine { display: none; }
.rolecard.mini .face.back b { font-size: 1.1rem; }
.rolecard.mini .mono { margin: 0; }
.rolecard.mini .face.front b { font-size: 1.7rem; }
.rolecard.mini .flip.odd .face.front b { font-size: 1.15rem; }
