/*
VOICE: loud, friendly game night; short sentences, big buttons.
IDEA: a cobalt game table scattered with sticky notes (Guess Who) and a stamped secret file (Imposter).
PICTURE: a tilted pile of yellow sticky notes with a red IMPOSTER stamp; in play, the notes ARE the board.
COLOUR and TYPE: cobalt table #1e3ad8, sticky yellow #ffd43b, stamp coral #ff4f3f, ink #14162b; Lilita One + Nunito.
LAYOUT: one column on phones; setup panel + room card side by side above 900px.
*/
:root {
  color-scheme: light dark;
  --table: light-dark(#1e3ad8, #0d1a63);
  --table-2: light-dark(#2a48f0, #13237a);
  --paper: light-dark(#ffffff, #171a2e);
  --paper-2: light-dark(#eef1ff, #22264a);
  --ink: light-dark(#14162b, #f1f2ff);
  --muted: light-dark(#5a5f80, #a6abd2);
  --line: light-dark(#14162b, #050713);
  --note: #ffd43b;
  --note-ink: #2b2200;
  --coral: #ff4f3f;
  --ok: light-dark(#0b7a43, #4fd08a);
  --r: 18px;
  --shadow: 0 5px 0 var(--line);
}
* { box-sizing: border-box; min-width: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; color: var(--ink);
  background: radial-gradient(1200px 600px at 80% -10%, var(--table-2), transparent 60%), var(--table);
  font: 16px/1.5 Nunito, system-ui, sans-serif; overflow-x: clip;
}
h1, h2, h3, .ptitle, .brand, .bigcode b, .word, .sword, .fword { font-family: 'Lilita One', 'Arial Black', sans-serif; font-weight: 400; letter-spacing: .2px; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.08; text-wrap: balance; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: inherit; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
code { background: var(--paper-2); padding: 1px 5px; border-radius: 6px; overflow-wrap: anywhere; }
.boot { color: #fff; padding: 40px; font-weight: 800; }

/* ---------- top bar */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px max(4vw, 16px); color: #fff; flex-wrap: wrap; }
.top-r { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-size: 26px; }
.brand.small { font-size: 21px; }
.logo { display: grid; place-items: center; width: 38px; height: 38px; background: var(--note); color: var(--note-ink); border: 3px solid var(--line); border-radius: 7px; transform: rotate(-6deg); box-shadow: 0 3px 0 var(--line); font-size: 22px; }
.codechip { background: #fff; color: #14162b; border: 3px solid var(--line); border-radius: 999px; padding: 4px 12px; font-weight: 800; }
.codechip b { letter-spacing: 2px; }

/* ---------- buttons & fields */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 18px;
  border: 3px solid var(--line); border-radius: 14px; background: var(--paper); color: var(--ink); font-weight: 900;
  box-shadow: 0 4px 0 var(--line); cursor: pointer; transition: transform .08s, box-shadow .08s; text-align: center;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(3px); box-shadow: 0 1px 0 var(--line); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--note); color: var(--note-ink); }
.btn.big { min-height: 58px; font-size: 19px; width: 100%; }
.btn.sm { min-height: 40px; padding: 6px 14px; font-size: 15px; border-radius: 12px; box-shadow: 0 3px 0 var(--line); }
.btn.ghost { background: transparent; color: inherit; border-color: currentColor; box-shadow: none; }
.top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.7); }
.link { background: none; border: 0; padding: 0 4px; color: var(--table); color: light-dark(#1e3ad8, #9fb0ff); font-weight: 800; text-decoration: underline; cursor: pointer; }
:focus-visible { outline: 3px solid var(--note); outline-offset: 3px; }
input[type=text], input[type=password], select, textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; font-size: 16px; border: 3px solid var(--line); border-radius: 12px;
  background: var(--paper); color: var(--ink);
}
textarea { resize: vertical; }
.field { display: grid; gap: 6px; margin: 0 0 14px; font-weight: 800; }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.btns.end { justify-content: flex-end; }

/* ---------- panels */
.panel, .card { background: var(--paper); border: 3px solid var(--line); border-radius: var(--r); box-shadow: 0 8px 0 var(--line); padding: clamp(18px, 3vw, 28px); }
.ptitle { font-size: clamp(28px, 4vw, 40px); }
.h2 { font-size: 28px; }
.h3 { font-size: 22px; margin-top: 18px; }
.banner { border: 3px solid var(--line); border-radius: 14px; padding: 10px 14px; margin: 12px 0; font-weight: 700; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.banner.err { background: #ffe1dd; color: #5a0d06; }
.banner.warn { background: #fff1c2; color: #3a2d00; }
main > .banner, .top + .banner { margin: 0 max(4vw, 16px) 12px; }

/* ---------- home */
.home { max-width: 1180px; margin: 0 auto; padding: 8px max(4vw, 16px) 48px; }
.hero { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: 28px; align-items: center; color: #fff; padding: 12px 0 30px; }
.hero h1 { font-size: clamp(38px, 6vw, 64px); margin-bottom: 16px; }
.lead { font-size: 18px; max-width: 60ch; }
.hero .lead b { background: rgba(255, 212, 59, .22); padding: 0 4px; border-radius: 4px; }
.pile { position: relative; height: 300px; }
.pile .note { position: absolute; width: 150px; height: 130px; }
.pile .n0 { left: 6%; top: 12%; --r: -8deg; }
.pile .n1 { left: 40%; top: 0; --r: 6deg; }
.pile .n2 { left: 22%; top: 46%; --r: 3deg; }
.pile .n3 { left: 56%; top: 42%; --r: -5deg; }
.pile .n4 { left: 72%; top: 8%; --r: 10deg; width: 110px; height: 100px; }
.pile .stamp { position: absolute; right: 2%; bottom: 4%; transform: rotate(-14deg); font-size: 26px; }
.note {
  background: var(--note); color: var(--note-ink); border: 3px solid var(--line); border-radius: 6px 6px 18px 6px;
  box-shadow: 0 6px 0 var(--line); transform: rotate(var(--r, 0deg)); display: grid; place-items: center; text-align: center; padding: 12px;
  font-family: 'Lilita One', sans-serif; font-size: 22px; line-height: 1.1;
}
.note::before { content: ''; position: absolute; top: -10px; left: 50%; width: 56px; height: 18px; transform: translateX(-50%) rotate(-3deg); background: rgba(255, 255, 255, .55); border: 2px solid rgba(20, 22, 43, .25); }
.pile .note { animation: drop .6s cubic-bezier(.2, 1.4, .5, 1) both; }
.pile .n1 { animation-delay: .08s } .pile .n2 { animation-delay: .16s } .pile .n3 { animation-delay: .24s } .pile .n4 { animation-delay: .32s }
@keyframes drop { from { opacity: 0; transform: translateY(-30px) rotate(calc(var(--r) * 3)); } }
.stamp { display: inline-block; font-family: 'Lilita One', sans-serif; color: var(--coral); border: 4px solid var(--coral); border-radius: 10px; padding: 2px 14px; letter-spacing: 3px; background: rgba(255, 255, 255, .92); }
.stamp.inline { transform: rotate(-6deg); font-size: 26px; margin-bottom: 12px; }

.start { background: var(--paper); border: 3px solid var(--line); border-radius: 24px; box-shadow: 0 10px 0 var(--line); padding: clamp(18px, 3vw, 32px); }
.field.name { max-width: 360px; }
.cards3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.cards3 .card { box-shadow: 0 5px 0 var(--line); background: var(--paper-2); display: flex; flex-direction: column; }
.cards3 .card h2 { font-size: 26px; }
.cards3 .card p { flex: 1; color: var(--muted); }
.joinrow { display: flex; gap: 8px; }
#joincode { text-transform: uppercase; letter-spacing: 4px; font-weight: 900; text-align: center; }
.how { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-top: 28px; }
.how-card { border: 3px solid var(--line); border-radius: var(--r); padding: 22px; box-shadow: 0 6px 0 var(--line); }
.how-card.gw { background: var(--note); color: var(--note-ink); }
.how-card.imp { background: #fff; color: #14162b; border-top: 10px solid var(--coral); }
.how-card h2 { font-size: 30px; }
.foot { color: rgba(255, 255, 255, .85); text-align: center; margin-top: 24px; font-size: 14px; }

/* ---------- lobby & setup */
.lobby { max-width: 1180px; margin: 0 auto; padding: 4px max(4vw, 16px) 48px; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 22px; align-items: start; }
.form { display: grid; gap: 14px; margin-bottom: 16px; }
.seg { display: flex; flex-wrap: wrap; border: 3px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--paper-2); width: fit-content; max-width: 100%; }
.seg button { border: 0; background: none; padding: 10px 18px; min-height: 46px; font-weight: 900; cursor: pointer; }
.seg button + button { border-left: 3px solid var(--line); }
.seg button.on { background: var(--ink); color: var(--paper); }
.bigq { font-family: 'Lilita One', sans-serif; font-size: 24px; margin-top: 6px; }
.catinput { font-size: 22px !important; min-height: 64px !important; font-weight: 800; border-width: 4px !important; background: var(--note) !important; color: var(--note-ink) !important; }
.catinput::placeholder { color: rgba(43, 34, 0, .55); font-weight: 700; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 2px solid var(--line); background: var(--paper-2); border-radius: 999px; padding: 6px 12px; min-height: 36px; font-weight: 800; font-size: 14px; cursor: pointer; }
.chip:hover { background: var(--note); color: var(--note-ink); }
.chip.dice { background: var(--ink); color: var(--paper); }
.row { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.lbl { font-weight: 900; min-width: 110px; }
.row select { width: auto; flex: 1; min-width: 220px; }
.stepper { display: flex; align-items: center; gap: 12px; font-size: 22px; }
.stepper .btn { width: 44px; padding: 0; }
.switch { cursor: pointer; position: relative; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.knob { width: 58px; height: 34px; border: 3px solid var(--line); border-radius: 999px; background: var(--paper-2); position: relative; transition: background .15s; }
.knob::after { content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: var(--ink); transition: transform .15s; }
.switch input:checked + .knob { background: var(--note); }
.switch input:checked + .knob::after { transform: translateX(24px); }
.switch input:focus-visible + .knob { outline: 3px solid var(--note); outline-offset: 3px; }
.aibox { border: 2px dashed var(--muted); border-radius: 14px; padding: 12px 14px; margin-bottom: 16px; display: grid; gap: 8px; }
.aibox .btn { justify-self: start; }
.ok { color: var(--ok); font-weight: 900; }
.warn { color: light-dark(#8a3b00, #ffb27a); font-weight: 700; }
.prog .bar { height: 14px; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; background: var(--paper-2); }
.prog .bar i { display: block; height: 100%; background: var(--note); transition: width .3s; }
.roomcard { position: sticky; top: 16px; }
.bigcode { background: var(--note); color: var(--note-ink); border: 3px solid var(--line); border-radius: 14px; text-align: center; padding: 10px; margin-bottom: 12px; transform: rotate(-1.5deg); }
.bigcode span { display: block; font-weight: 900; font-size: 14px; }
.bigcode b { font-size: 48px; letter-spacing: 6px; line-height: 1.1; }
.plist { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.plist li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 2px solid var(--line); border-radius: 12px; background: var(--paper-2); }
.plist li.off { opacity: .55; }
.pname { flex: 1; font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--ok); border: 2px solid var(--line); flex: none; }
.off .dot { background: #999; }
.badge { background: var(--ink); color: var(--paper); font-size: 12px; font-weight: 900; padding: 2px 8px; border-radius: 999px; }
.x { width: 34px; height: 34px; border-radius: 10px; border: 2px solid var(--line); background: var(--paper); cursor: pointer; font-size: 20px; line-height: 1; flex: none; }
.waiting .summary { margin: 16px 0; }
.summary { border: 3px solid var(--line); border-radius: 16px; padding: 16px; background: var(--paper-2); }
.sumcat { font-family: 'Lilita One', sans-serif; font-size: 30px; line-height: 1.1; margin: 8px 0 4px; }
.tag { display: inline-block; font-weight: 900; font-size: 13px; padding: 3px 10px; border-radius: 999px; border: 2px solid var(--line); }
.tag.guesswho { background: var(--note); color: var(--note-ink); }
.tag.imposter { background: var(--coral); color: #fff; }
.lplayers { display: grid; gap: 8px; margin-bottom: 12px; }
.lp { display: flex; gap: 8px; align-items: center; }
.lp .x { height: 48px; width: 44px; }

/* ---------- generating */
.center { min-height: calc(100vh - 90px); display: grid; place-items: center; padding: 16px max(4vw, 16px) 48px; }
.card.wide { width: min(560px, 100%); text-align: center; }
.gen p { font-weight: 700; }
.shuffle { position: relative; height: 120px; margin: 6px auto 18px; width: 140px; }
.shuffle i { position: absolute; inset: 0 20px; background: var(--note); border: 3px solid var(--line); border-radius: 8px; box-shadow: 0 4px 0 var(--line); animation: shuffle 1.2s ease-in-out infinite; }
.shuffle i:nth-child(2) { animation-delay: .2s; } .shuffle i:nth-child(3) { animation-delay: .4s; }
@keyframes shuffle { 0%, 100% { transform: rotate(-8deg) translateX(-14px); } 50% { transform: rotate(8deg) translateX(14px); } }
.spinner { width: 46px; height: 46px; border: 5px solid var(--paper-2); border-top-color: var(--ink); border-radius: 50%; margin: 0 auto 14px; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- play */
.play { max-width: 1180px; margin: 0 auto; padding: 4px max(4vw, 16px) 48px; color: #fff; }
.play .ptitle { color: #fff; }
.roundtag { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; font-size: 18px; }
.play .roundtag .muted, .play > .muted, .play > p.muted { color: rgba(255, 255, 255, .78); }
.card .roundtag { justify-content: center; }
.turnbanner { background: #fff; color: #14162b; border: 3px solid var(--line); border-radius: 16px; padding: 14px 18px; font-size: 20px; box-shadow: 0 5px 0 var(--line); }
.turnbanner.me { background: var(--note); color: var(--note-ink); animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.015); } }
.notes { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 26px 20px; margin: 26px 0; }
.card-note { position: relative; min-height: 170px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; padding: 18px 14px 12px; }
.card-note .who { font-family: Nunito, sans-serif; font-weight: 900; font-size: 15px; opacity: .8; }
.card-note .word { font-size: clamp(22px, 2.6vw, 30px); overflow-wrap: anywhere; }
.card-note .word.q { font-size: 64px; }
.card-note .meta { font-family: Nunito, sans-serif; font-size: 14px; font-weight: 900; min-height: 20px; }
.card-note.mine { background: #fff; color: #14162b; }
.card-note.turn { outline: 5px solid #fff; outline-offset: 4px; }
.card-note.solved { background: #b8f2cf; }
.card-note.big { margin: 18px auto; max-width: 360px; min-height: 220px; justify-content: center; gap: 14px; }
.card-note.big .word { font-size: 40px; }
.mini { font-family: Nunito, sans-serif; font-size: 13px; font-weight: 900; border: 2px solid var(--line); background: rgba(255, 255, 255, .7); border-radius: 999px; padding: 4px 10px; cursor: pointer; align-self: center; }
.hostbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 24px; padding: 12px; border: 2px dashed rgba(255, 255, 255, .5); border-radius: 16px; }
.hostbar .muted { color: rgba(255, 255, 255, .8); margin-right: 6px; }
.play .btns .btn:not(.primary) { background: #fff; color: #14162b; }

/* imposter */
.impgrid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 26px; align-items: start; }
.secret { display: block; width: 100%; border: 0; padding: 0; background: none; cursor: pointer; text-align: center; color: #14162b; }
.sback, .sface { border: 3px solid var(--line); border-radius: 22px; box-shadow: 0 8px 0 var(--line); min-height: 300px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 24px; }
.sback { background: repeating-linear-gradient(45deg, #e9e2cf 0 14px, #f3eddc 14px 28px); color: #14162b; }
.sback b { font-size: 22px; }
.seal { width: 86px; height: 86px; border-radius: 50%; background: var(--coral); color: #fff; display: grid; place-items: center; font: 48px 'Lilita One', sans-serif; border: 4px solid var(--line); }
.sface { background: #fff; }
.secret.imposter .sface { background: #ffe6e2; }
.slabel { font-weight: 900; font-size: 14px; text-transform: none; color: #5a5f80; }
.sword { font-size: clamp(32px, 5vw, 52px); line-height: 1.05; overflow-wrap: anywhere; }
.sword.long { font-size: clamp(24px, 3vw, 32px); }
.impside { background: rgba(255, 255, 255, .08); border: 2px solid rgba(255, 255, 255, .35); border-radius: 18px; padding: 20px; }
.votes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 12px 0; }
.vote { min-height: 56px; border: 3px solid var(--line); border-radius: 14px; background: #fff; color: #14162b; font-weight: 900; font-size: 17px; cursor: pointer; box-shadow: 0 4px 0 var(--line); }
.vote.on { background: var(--coral); color: #fff; }
.reveal { background: #fff; color: #14162b; border: 3px solid var(--line); border-radius: 22px; box-shadow: 0 8px 0 var(--line); padding: clamp(20px, 4vw, 36px); text-align: center; }
.reveal .ptitle { color: #14162b; }
.reveal.won .ptitle { color: var(--ok); }
.pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin: 10px 0; }
.vbars { display: grid; gap: 8px; max-width: 520px; margin: 20px auto 6px; text-align: left; }
.vbar { display: grid; grid-template-columns: 120px minmax(0, 1fr) 30px; align-items: center; gap: 10px; font-weight: 800; }
.vbar span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vbar div { height: 18px; background: #eef1ff; border: 2px solid var(--line); border-radius: 999px; overflow: hidden; }
.vbar i { display: block; height: 100%; background: #9aa6c8; }
.vbar.imp i { background: var(--coral); }
.vbar b { text-align: right; }
.pass .ptitle { font-size: clamp(26px, 4vw, 34px); }
.pass .secret { margin: 16px 0; cursor: default; }
.forehead { position: fixed; inset: 0; background: var(--note); color: var(--note-ink); display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 24px; z-index: 50; cursor: pointer; }
.fword { font-size: clamp(48px, 13vw, 140px); line-height: 1; overflow-wrap: anywhere; margin-bottom: 20px; }

/* ---------- modal & toast */
.scrim { position: fixed; inset: 0; background: rgba(5, 8, 30, .6); z-index: 60; }
.dialog { position: fixed; z-index: 61; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); overflow: auto; background: var(--paper); border: 3px solid var(--line); border-radius: 22px; box-shadow: 0 10px 0 var(--line); padding: 24px; }
.dialog h2 { font-size: 30px; }
.engines, .models { display: grid; gap: 8px; margin: 10px 0 14px; }
.opt { display: flex; gap: 12px; align-items: flex-start; border: 2px solid var(--line); border-radius: 14px; padding: 10px 12px; cursor: pointer; background: var(--paper-2); }
.opt.on { background: var(--note); color: var(--note-ink); }
.opt.on .muted { color: inherit; opacity: .75; }
.opt input { margin-top: 5px; width: 18px; height: 18px; accent-color: #14162b; }
.opt > span { display: grid; }
#toast { position: fixed; left: 50%; bottom: 20px; transform: translate(-50%, 140%); background: #14162b; color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 800; z-index: 80; max-width: calc(100vw - 24px); overflow-wrap: anywhere; transition: transform .25s; border: 2px solid #fff; }
#toast.show { transform: translate(-50%, 0); }

/* ---------- narrow */
@media (max-width: 900px) {
  .lobby { grid-template-columns: minmax(0, 1fr); }
  .roomcard { position: static; order: -1; }
  .cards3 { grid-template-columns: minmax(0, 1fr); }
  .impgrid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 600px) {
  .hero { grid-template-columns: minmax(0, 1fr); padding-bottom: 12px; }
  .pile { height: 210px; }
  .pile .note { width: 120px; height: 100px; font-size: 18px; }
  .pile .n4 { width: 90px; height: 80px; }
  .how { grid-template-columns: minmax(0, 1fr); }
  .notes { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px 12px; }
  .card-note { min-height: 140px; }
  .bigcode b { font-size: 38px; }
  .brand { font-size: 21px; }
  .top-r .btn.ghost { min-height: 38px; padding: 4px 10px; }
  .vbar { grid-template-columns: 90px minmax(0, 1fr) 26px; }
  .seg button { padding: 10px 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
