/* Drawdi — design system + all game styles */

:root {
  --cream: #FFF8EE;  --ink: #3B2A4A;  --ink-soft: #7A6A8A;  --paper: #FFFFFF;
  --peach: #FFD3BA;  --pink: #FFC2DA;  --lavender: #DCCBFF;  --sky: #BEE3FF;
  --mint: #BFF0D8;   --butter: #FFEFA8; --coral: #FF9E8A;    --teal: #86DCCB;
  --radius: 24px;    --shadow: 0 8px 0 rgba(59,42,74,.12);
  --head: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --body: 'Nunito', system-ui, sans-serif;
  --press: rgba(59,42,74,.22);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { overscroll-behavior: none; }
html:has(body.host) { font-size: clamp(11px, min(1.04vw, 1.85vh), 26px); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--body);
  background-color: var(--cream);
  background-image: radial-gradient(rgba(59,42,74,.07) 1.5px, transparent 1.7px);
  background-size: 28px 28px;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3 { font-family: var(--head); margin: 0; line-height: 1.1; }
p { margin: 0; }
button { font-family: var(--head); color: var(--ink); }
.muted { color: var(--ink-soft); font-weight: 700; }

/* ---------- Background blobs ---------- */

.blobs { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blobs i {
  position: absolute; width: 42vmax; aspect-ratio: 1; opacity: .6;
  border-radius: 42% 58% 63% 37% / 45% 38% 62% 55%;
  animation: float 24s ease-in-out infinite alternate;
}
.blobs i:nth-child(1) { background: var(--pink);     top: -16vmax; left: -12vmax; }
.blobs i:nth-child(2) { background: var(--lavender); top: -14vmax; right: -16vmax; animation-delay: -6s; }
.blobs i:nth-child(3) { background: var(--mint);     bottom: -22vmax; left: 18%; animation-delay: -12s; }
.blobs i:nth-child(4) { background: var(--sky);      bottom: -14vmax; right: -12vmax; animation-delay: -3s; }
.blobs i:nth-child(5) { background: var(--butter);   top: 38%; left: -8vmax; width: 20vmax; animation-delay: -9s; }

/* ---------- Building blocks ---------- */

.card {
  background: var(--paper);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
}

.btn {
  font: 700 1.15rem/1 var(--head);
  color: var(--ink);
  background: var(--butter);
  border: 0;
  border-radius: 999px;
  padding: .8em 1.5em;
  min-height: 48px;
  box-shadow: 0 .3em 0 var(--press);
  cursor: pointer;
  transition: transform .1s, box-shadow .1s, background .2s;
  touch-action: manipulation;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 calc(.3em + 2px) 0 var(--press); }
.btn:active:not(:disabled) { transform: translateY(.22em); box-shadow: 0 .08em 0 var(--press); }
.btn.primary { background: var(--coral); }
.btn.big { font-size: 1.55rem; padding: .7em 1.8em; }
.btn:disabled { background: #EEE7F2; color: var(--ink-soft); box-shadow: none; cursor: not-allowed; }
.btn:focus-visible, .seg button:focus-visible, .tool:focus-visible, .choice:focus-visible { outline: 4px solid var(--sky); outline-offset: 3px; }
.why { color: var(--ink-soft); font-weight: 700; min-height: 1.4em; margin-top: .6rem; }

.chip, .pill {
  display: inline-flex; align-items: center; gap: .4em;
  font: 700 1.1rem/1 var(--head);
  background: var(--paper); border-radius: 999px;
  padding: .5em 1em; box-shadow: 0 .2em 0 rgba(59,42,74,.1);
}
.host .chip { font-size: 1.4rem; }
.pill { background: var(--lavender); font-size: .8em; padding: .3em .8em; vertical-align: middle; }

.input {
  width: 100%;
  font: 700 1.2rem var(--body);
  color: var(--ink);
  background: var(--paper);
  border: 3px solid var(--lavender);
  border-radius: 16px;
  padding: .7rem 1rem;
  min-height: 52px;
  outline: none;
  transition: border-color .2s;
}
.input:focus { border-color: var(--teal); }
.input::placeholder { color: #B8ADC4; }

/* Logo: sticker letters */
.logo { font-size: 4.6rem; font-weight: 800; letter-spacing: .01em; white-space: nowrap; }
.logo span {
  display: inline-block;
  -webkit-text-stroke: .07em var(--ink);
  paint-order: stroke fill;
  text-shadow: 0 .07em 0 var(--ink);
  animation: wobble 3.2s ease-in-out infinite;
}
.logo span:nth-child(6n+1) { color: var(--coral); }
.logo span:nth-child(6n+2) { color: var(--butter); animation-delay: -.4s; }
.logo span:nth-child(6n+3) { color: var(--teal); animation-delay: -.8s; }
.logo span:nth-child(6n+4) { color: var(--pink); animation-delay: -1.2s; }
.logo span:nth-child(6n+5) { color: var(--sky); animation-delay: -1.6s; }
.logo span:nth-child(6n)   { color: var(--lavender); animation-delay: -2s; }
.logo.small { font-size: 2.9rem; }

/* Avatars */
.avatar {
  --s: 3.2rem;
  position: relative; flex: none;
  width: var(--s); height: var(--s);
  display: inline-grid; place-items: center;
  border-radius: 50%;
  background: var(--c, var(--peach));
  border: calc(var(--s) * .06) solid var(--paper);
  box-shadow: 0 calc(var(--s) * .07) 0 rgba(59,42,74,.14);
  font-size: calc(var(--s) * .55); line-height: 1;
  font-family: system-ui, 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', sans-serif;
}
.avatar.vip::after {
  content: '👑'; position: absolute; top: -.62em; left: 50%;
  font-size: .6em; transform: translateX(-50%) rotate(-14deg);
}
.avatar.offline { filter: grayscale(.9); opacity: .45; }
.avatar.tiny  { --s: 1.7rem; }
.avatar.small { --s: 2.4rem; }
.avatar.big   { --s: 5.2rem; }
.avatar.huge  { --s: 8rem; }

/* Letter tiles */
.hint { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem 1.4rem; }
.word { display: inline-flex; flex-wrap: wrap; justify-content: center; gap: .35rem; }
.tile {
  --t: 3.4rem;
  width: calc(var(--t) * .82); height: var(--t);
  display: grid; place-items: center;
  border-radius: calc(var(--t) * .2);
  background: var(--paper);
  box-shadow: 0 calc(var(--t) * .07) 0 rgba(59,42,74,.15);
  font: 800 calc(var(--t) * .6)/1 var(--head);
  text-transform: uppercase;
}
.tile.blank::after {
  content: ''; align-self: end; margin-bottom: 22%;
  width: 55%; height: calc(var(--t) * .08); border-radius: 99px; background: var(--lavender);
}
.hint.revealed .tile { background: var(--mint); animation: pop .45s cubic-bezier(.3,1.6,.5,1) both; }
.hint.small { gap: .3rem .8rem; }
.hint.small .tile { --t: 1.9rem; }
.stars { color: #F5B82E; font-size: 1.6rem; letter-spacing: .1em; text-shadow: 0 2px 0 rgba(59,42,74,.12); }

/* Drawing paper */
.stage {
  position: relative;
  container-type: size;
  min-height: 0;
  display: grid; place-items: center;
}
.paper {
  display: block;
  width: min(100cqw, 133.333cqh);
  aspect-ratio: 4 / 3;
  background: #fff;
  border-radius: 20px;
  box-shadow: 0 0 0 6px var(--paper), var(--shadow);
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.countdown {
  width: 9rem; height: 9rem; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--butter); box-shadow: var(--shadow);
  font: 800 4.6rem/1 var(--head);
}
.countdown.small { width: 5rem; height: 5rem; font-size: 2.4rem; }

.team-0 { --team: var(--coral); }
.team-1 { --team: var(--teal); }
.team-tag { background: var(--team); border-radius: 999px; padding: .4em 1.2em; font: 700 1.4rem var(--head); }

.ranking { list-style: none; margin: 0; padding: 1rem; display: grid; gap: .5rem; }
.rank-row {
  display: grid; grid-template-columns: 2.6em auto 1fr auto; align-items: center; gap: .7em;
  padding: .45em .9em; border-radius: 999px; background: var(--cream); font-weight: 800;
}
.rank-row:first-child { background: var(--butter); }
.rank-row.me { box-shadow: inset 0 0 0 3px var(--teal); }
.rank-place { font-family: var(--head); color: var(--ink-soft); }
.rank-name { text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-score { font-family: var(--head); font-size: 1.2em; }

.reveal-word { font-size: 4.4rem; font-weight: 800; overflow-wrap: anywhere; }

/* Overlays */
.banner {
  position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--butter); border-radius: 999px; padding: .5em 1.2em;
  font: 700 1rem var(--head); box-shadow: var(--shadow);
  animation: pulse 1.2s ease-in-out infinite;
}
.host .banner { font-size: 1.6rem; } /* readable from the sofa */
.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 50;
  background: var(--peach); border-radius: 999px; padding: .7em 1.4em; max-width: calc(100% - 32px);
  font-weight: 800; box-shadow: var(--shadow); animation: pop .35s cubic-bezier(.3,1.6,.5,1);
}
.sound-pill {
  position: fixed; right: 1.5rem; bottom: 1.5rem; z-index: 30;
  border: 0; border-radius: 999px; padding: .7em 1.3em; cursor: pointer;
  background: var(--lavender); font: 700 1.1rem var(--head); box-shadow: var(--shadow);
  animation: bob 2.4s ease-in-out infinite;
}
body:not([data-phase=lobby]) .sound-pill { display: none; } /* don't cover the score strip mid-game */
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 40; }

/* ---------- Host ---------- */

.host .screen { min-height: 100vh; padding: 2rem 2.5rem; }
.host .center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.6rem; text-align: center; }

/* Lobby */
.lobby-head { display: flex; align-items: baseline; gap: 2rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.tagline { font: 700 1.6rem var(--head); color: var(--ink-soft); }
.lobby-grid { display: grid; grid-template-columns: minmax(22rem, 30rem) 1fr; gap: 2rem; align-items: start; }
.join-card { display: flex; flex-direction: column; align-items: center; gap: .6rem; text-align: center; padding: 2rem; }
.qr {
  width: 17rem; aspect-ratio: 1; padding: .8rem;
  background: #fff; border-radius: 1.4rem; border: .35rem dashed var(--lavender);
  margin-bottom: .6rem;
}
.join-card .muted { font-size: 1.2rem; }
.join-url { font: 800 1.9rem var(--head); overflow-wrap: anywhere; }
.code { display: flex; gap: .6rem; margin-top: .3rem; }
.code span {
  width: 5.4rem; height: 6.6rem; display: grid; place-items: center;
  border-radius: 1.2rem; font: 800 4.6rem/1 var(--head);
  box-shadow: 0 .35rem 0 rgba(59,42,74,.15);
}
.code span:nth-child(1) { background: var(--peach); transform: rotate(-4deg); }
.code span:nth-child(2) { background: var(--mint);  transform: rotate(3deg); }
.code span:nth-child(3) { background: var(--sky);   transform: rotate(-2deg); }
.code span:nth-child(4) { background: var(--pink);  transform: rotate(4deg); }

.lobby-side { display: grid; grid-template-columns: 1fr auto; gap: 1.4rem; min-width: 0; }
.players-card { grid-column: 1 / -1; }
.players-card h2 { font-size: 2rem; margin-bottom: 1rem; }
.bubbles { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.5rem, 1fr)); gap: 1rem; min-height: 9rem; }
.bubbles.teams { grid-template-columns: 1fr 1fr; }
.team-col {
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: .8rem; padding: 1rem;
  border-radius: 1.2rem; background: color-mix(in srgb, var(--team) 30%, white);
}
.team-col h3 { width: 100%; font-size: 1.6rem; }
.team-col .bubble { width: 7rem; }
.team-col .bubble .avatar { --s: 3.8rem; }
.team-col .bubble-name { font-size: 1.1rem; }
.bubble { display: flex; flex-direction: column; align-items: center; gap: .4rem; text-align: center; }
.bubble .avatar { --s: 4.6rem; }
.bubble-name { font-weight: 800; font-size: 1.25rem; line-height: 1.15; max-width: 100%; overflow-wrap: anywhere; }
.pop-in { animation: pop-in .6s cubic-bezier(.3,1.7,.5,1) both; }
.empty { grid-column: 1 / -1; color: var(--ink-soft); font-weight: 700; font-size: 1.3rem; align-self: center; text-align: center; }

.setup { display: grid; gap: .9rem; }
.setup-row { display: flex; align-items: center; gap: 1rem; }
.setup-label { flex: none; width: 5rem; font: 700 1.3rem var(--head); }
.seg { display: flex; flex-wrap: wrap; gap: .3rem; background: var(--cream); padding: .3rem; border-radius: 999px; }
.seg button {
  font: 700 1.25rem/1 var(--head); color: var(--ink-soft);
  border: 0; background: transparent; padding: .5em .8em; border-radius: 999px; cursor: pointer;
  transition: background .2s, color .2s;
}
.seg button:hover { color: var(--ink); }
.seg button.on { background: var(--lavender); color: var(--ink); box-shadow: 0 .18em 0 rgba(59,42,74,.15); }
.start-row { width: 17rem; display: flex; flex-direction: column; justify-content: center; align-items: center; text-align: center; }
.start-row .btn { white-space: nowrap; }

/* Choosing */
.choose-title { font-size: 3.4rem; max-width: 80vw; }
.choose-title span { overflow-wrap: anywhere; }

/* Drawing */
.host .draw { height: 100vh; display: grid; grid-template-rows: auto 1fr auto; gap: 1.2rem; padding: 1.4rem 2rem; }
.draw-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 1.5rem; }
.draw-top-left { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; white-space: nowrap; } /* long hints wrap, not the drawer line */
.drawer-line { display: inline-flex; align-items: center; gap: .6rem; font: 700 1.4rem var(--head); }
.hint-wrap { display: flex; flex-direction: column; align-items: center; gap: .3rem; }
.ring { justify-self: end; position: relative; width: 6.8rem; height: 6.8rem; display: grid; place-items: center; }
.ring svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.ring-bg { fill: var(--paper); stroke: var(--lavender); stroke-width: 9; }
.ring-fg { fill: none; stroke: var(--teal); stroke-width: 9; stroke-linecap: round; transition: stroke-dashoffset .25s linear, stroke .3s; }
.ring span { position: relative; font: 800 2.5rem/1 var(--head); }
.ring.hurry { animation: wiggle .5s ease-in-out infinite; }
.ring.hurry .ring-fg { stroke: var(--coral); }

.draw-main { display: grid; grid-template-columns: 1fr 22rem; gap: 1.5rem; min-height: 0; }
.feed-card { display: flex; flex-direction: column; gap: .8rem; overflow: hidden; }
.feed-card h3 { font-size: 1.5rem; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: .5rem; }
.feed-item { display: flex; flex-wrap: wrap; align-items: center; gap: .3rem .5rem; padding: .5rem .8rem; border-radius: 1rem; background: var(--mint); font-size: 1.15rem; transition: opacity .4s; }
.feed-name { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.feed-text { overflow-wrap: anywhere; min-width: 0; }
.feed-item.slide-in { animation: pop .5s cubic-bezier(.3,1.7,.5,1); }

.strip { display: flex; flex-wrap: wrap; justify-content: center; gap: .8rem; }
.pchip {
  display: flex; align-items: center; gap: .55rem; padding: .35rem 1rem .35rem .35rem;
  background: var(--paper); border-radius: 999px; box-shadow: 0 .25rem 0 rgba(59,42,74,.1);
  font-weight: 800; font-size: 1.2rem; transition: background .3s;
}
.pchip.guessed { background: var(--mint); animation: pop .45s cubic-bezier(.3,1.7,.5,1); }
.pchip.drawing { background: var(--butter); }
.pchip.offline { opacity: .55; }
.pchip-name { max-width: 9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pchip-score { font-family: var(--head); background: var(--cream); border-radius: 999px; padding: .1em .6em; }
.tick { font-size: 1.1rem; }

.team-card {
  flex: 1; max-width: 40rem; display: flex; flex-direction: column; gap: .6rem;
  padding: .9rem 1.2rem; border-radius: var(--radius);
  background: color-mix(in srgb, var(--team) 30%, white);
  border: .3rem solid transparent; transition: transform .3s, border-color .3s;
}
.team-card.active { border-color: var(--team); transform: translateY(-.3rem); box-shadow: var(--shadow); }
.team-head { display: flex; justify-content: space-between; align-items: center; font: 800 1.6rem var(--head); }
.team-score { background: var(--paper); border-radius: 999px; padding: 0 .7em; }
.team-members { display: flex; flex-wrap: wrap; gap: .5rem; }
.team-card .pchip { font-size: 1.05rem; }

.reveal {
  position: absolute; inset: 0; display: grid; place-items: center;
  background: rgba(255,248,238,.5); backdrop-filter: blur(3px); border-radius: 20px;
}
.reveal-card { text-align: center; padding: 2rem 3.5rem; max-width: 90%; max-height: 100%; animation: pop .55s cubic-bezier(.3,1.6,.5,1); display: flex; flex-direction: column; align-items: center; gap: .5rem; }
.reveal-card .muted { font-size: 1.4rem; }
.reveal-team { font: 800 2rem var(--head); background: var(--team); border-radius: 999px; padding: .2em 1em; margin-top: .4rem; }
.gains { list-style: none; margin: .6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; }
.gain { display: flex; align-items: center; gap: .5rem; background: var(--cream); border-radius: 999px; padding: .3rem 1rem .3rem .3rem; font-weight: 800; font-size: 1.25rem; }
.gain-pts { font-family: var(--head); color: #2E8F6E; }
.gains .muted { font-size: 1.3rem; }
/* Wrong guesses on the reveal: shrinks first when space runs out, so the word and gains stay visible */
.wrongs { min-height: 0; max-height: 13rem; max-width: 52rem; overflow: hidden; display: flex; flex-direction: column; gap: .4rem; margin-top: .6rem; }
.wrongs[hidden] { display: none; }
.wrongs .muted { font-size: 1.2rem; flex: none; }
.wrong-list { list-style: none; margin: 0; padding: 0; min-height: 0; overflow: hidden; display: flex; flex-wrap: wrap; justify-content: center; align-content: flex-start; gap: .45rem; }
.wrong { display: flex; flex-wrap: wrap; align-items: center; gap: .2rem .45rem; max-width: 100%; background: var(--lavender); border-radius: 1.2rem; padding: .25rem .9rem .25rem .25rem; font-size: 1.15rem; }
.wrong-name { font-weight: 800; white-space: nowrap; }
.wrong-text { overflow-wrap: anywhere; min-width: 0; text-align: left; }

/* Game end */
.host .end { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1.3rem; }
.end-title { font-size: 3.8rem; text-align: center; animation: pop .6s cubic-bezier(.3,1.6,.5,1); }
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 1.5rem; }
.step { display: flex; flex-direction: column; align-items: center; gap: .4rem; width: 13rem; text-align: center; }
.step-name { font: 800 1.6rem var(--head); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-score { font-weight: 800; color: var(--ink-soft); font-size: 1.2rem; }
.step-block {
  width: 100%; display: grid; place-items: center; font: 800 3.6rem var(--head);
  border-radius: 1.4rem 1.4rem .6rem .6rem; box-shadow: var(--shadow);
  animation: rise .8s cubic-bezier(.3,1.3,.5,1) both; transform-origin: bottom;
}
.place-1 .step-block { height: 10rem; background: var(--butter); animation-delay: .5s; }
.place-2 .step-block { height: 7rem; background: var(--lavender); animation-delay: .25s; }
.place-3 .step-block { height: 5rem; background: var(--peach); }
.place-1 .avatar { --s: 6.4rem; animation: bob 2s ease-in-out infinite; }
.team-final { width: 24rem; display: flex; flex-direction: column; align-items: center; gap: .6rem; background: color-mix(in srgb, var(--team) 35%, white); }
.team-final h2 { font-size: 2.4rem; }
.team-final-score { font: 800 4.4rem/1 var(--head); }
.team-final.winner { border: .35rem solid var(--team); animation: pop .6s cubic-bezier(.3,1.6,.5,1); }
.team-final .team-members { justify-content: center; }
.end .ranking { width: min(56rem, 100%); grid-template-columns: 1fr 1fr; font-size: 1.2rem; }

/* ---------- Phone ---------- */

.phone { overflow: hidden; }
#app {
  position: fixed; left: 0; top: 0; width: 100%;
  height: var(--vh, 100dvh);
  transform: translateY(var(--vt, 0));
  overflow-y: auto;
  overscroll-behavior: contain;
}
.phone .screen {
  min-height: 100%;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}
.phone .center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1rem; text-align: center; }
.phone .title { font-size: 2.2rem; max-width: 100%; overflow-wrap: anywhere; }
.phone .btn.big { font-size: 1.4rem; width: min(100%, 20rem); }

.join-form { width: min(100%, 22rem); display: grid; gap: 1rem; text-align: left; }
.join-form label { display: grid; gap: .4rem; font: 700 1.1rem var(--head); }
.code-input { font: 800 2rem var(--head); text-align: center; letter-spacing: .4em; text-indent: .4em; text-transform: uppercase; }
.join-form .btn { width: 100%; }
.err { color: #C0392B; font-weight: 800; min-height: 1.3em; text-align: center; }

.bounce { animation: bounce-in .8s cubic-bezier(.3,1.7,.5,1) both; }
.big-name { font: 800 1.6rem var(--head); }
.team-box { display: flex; flex-direction: column; align-items: center; gap: .7rem; width: min(100%, 22rem); background: color-mix(in srgb, var(--team) 40%, white); font-size: 1.2rem; }
.mini-avatars { display: flex; flex-wrap: wrap; justify-content: center; gap: .5rem; max-width: 22rem; padding-top: .5rem; }
.vip-box { width: 100%; display: flex; flex-direction: column; align-items: center; }
.waiting { color: var(--ink-soft); font-weight: 700; }

.choose-mine { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 1rem; }
.choices { width: min(100%, 24rem); display: grid; gap: .9rem; }
.choice {
  display: grid; grid-template-columns: 1fr auto; grid-template-areas: "stars mult" "word word";
  gap: .2rem .6rem; align-items: center; text-align: left;
  min-height: 88px; padding: .9rem 1.2rem; border: 0; border-radius: var(--radius);
  box-shadow: 0 6px 0 var(--press); cursor: pointer; touch-action: manipulation;
  transition: transform .1s, box-shadow .1s;
  animation: pop-in .5s cubic-bezier(.3,1.6,.5,1) both;
}
.choice:active { transform: translateY(4px); box-shadow: 0 2px 0 var(--press); }
.choice:nth-child(2) { animation-delay: .08s; }
.choice:nth-child(3) { animation-delay: .16s; }
.choice.diff-1 { background: var(--mint); }
.choice.diff-2 { background: var(--sky); }
.choice.diff-3 { background: var(--pink); }
.choice .stars { grid-area: stars; font-size: 1.2rem; }
.choice-word { grid-area: word; font: 800 1.7rem/1.15 var(--head); overflow-wrap: anywhere; }
.mult { grid-area: mult; background: var(--paper); border-radius: 999px; padding: .2em .7em; font: 800 1.1rem var(--head); }

.pdraw { position: relative; height: 100%; display: flex; flex-direction: column; gap: .6rem; }
.phone .pdraw { min-height: 0; padding-bottom: max(.6rem, env(safe-area-inset-bottom)); }
.p-top { display: flex; flex-direction: column; align-items: center; gap: .4rem; }
.p-word { font: 700 1.2rem var(--head); text-align: center; overflow-wrap: anywhere; }
.p-word b { font-size: 1.5rem; }
.p-word .stars { font-size: 1rem; }
.p-timer { width: 100%; display: flex; align-items: center; gap: .6rem; }
.bar { flex: 1; height: .75rem; border-radius: 99px; background: var(--paper); box-shadow: inset 0 0 0 2px var(--lavender); overflow: hidden; }
.bar i { display: block; height: 100%; width: 100%; border-radius: 99px; background: var(--teal); transition: width .25s linear; }
#p-secs { font: 800 1.5rem/1 var(--head); min-width: 2ch; text-align: right; }
.p-timer.hurry .bar i { background: var(--coral); }
.p-timer.hurry #p-secs { animation: wiggle .5s ease-in-out infinite; color: #D9534F; }
.pdraw .stage { flex: 1 1 auto; place-items: start center; }
.is-drawer .pdraw .stage { place-items: end center; }
.phone .paper { border-radius: 14px; box-shadow: 0 0 0 4px var(--paper), 0 6px 0 rgba(59,42,74,.12); }

.tools { display: grid; grid-template-columns: repeat(5, 1fr); gap: .45rem; }
.tool {
  min-height: 48px; border: 0; border-radius: 14px; cursor: pointer;
  background: var(--paper); box-shadow: 0 4px 0 rgba(59,42,74,.14);
  display: grid; place-items: center; font: 700 1.1rem var(--head);
  touch-action: manipulation; transition: transform .1s;
}
.tool:active { transform: translateY(3px); box-shadow: 0 1px 0 rgba(59,42,74,.14); }
.swatch { background: var(--c); }
.swatch.eraser { background: var(--paper); box-shadow: inset 0 0 0 2px var(--lavender), 0 4px 0 rgba(59,42,74,.14); font-size: 1.4rem; }
.tool.on { outline: 3px solid var(--ink); outline-offset: 2px; transform: scale(1.04); }
.size i { display: block; border-radius: 50%; background: var(--ink); }
.tool.action { font-size: 1.5rem; background: var(--butter); }
.tool.clear { grid-column: span 2; font-size: 1.1rem; background: var(--peach); }
.tool.clear.armed { background: var(--coral); animation: wiggle .4s ease-in-out 2; }

.guess-bar { display: flex; gap: .5rem; }
.guess-bar .input { flex: 1; min-width: 0; }
.guess-bar .btn { padding: .6em 1.2em; }
.shake { animation: shake .45s; }
.guess-wait { background: var(--mint); border-radius: var(--radius); padding: 1rem; text-align: center; font-weight: 800; font-size: 1.1rem; box-shadow: var(--shadow); }
.guess-wait[class*=team-] { background: color-mix(in srgb, var(--team) 45%, white); }
.fx {
  position: absolute; left: 50%; bottom: 5.5rem; z-index: 5; pointer-events: none;
  transform: translate(-50%, -50%);
  font: 800 2.4rem/1 var(--head); padding: .5em 1em; border-radius: 999px; white-space: nowrap;
  box-shadow: var(--shadow);
}
.fx.good { background: var(--mint); }
.fx.nope { background: var(--pink); font-size: 1.8rem; }
.fx.play { animation: fx-pop .9s cubic-bezier(.3,1.6,.5,1) both; }

.phone .reveal-word { font-size: 2.8rem; }
.gain-badge { background: var(--mint); border-radius: 999px; padding: .4em 1.2em; font: 800 1.8rem var(--head); box-shadow: var(--shadow); animation: pop .55s .2s cubic-bezier(.3,1.7,.5,1) both; }
.gain-badge.zero { background: var(--lavender); font-size: 1.3rem; }
.stats { display: flex; width: min(100%, 22rem); justify-content: space-around; gap: 1rem; padding: 1rem; }
.stats div { display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.stats b { font: 800 1.8rem var(--head); }
.medal { font-size: 5rem; line-height: 1; animation: bounce-in .9s cubic-bezier(.3,1.7,.5,1) both; }
.phone .ranking { width: min(100%, 22rem); }

/* ---------- Motion ---------- */

@keyframes float  { to { transform: translate(4vmax, 3vmax) rotate(30deg) scale(1.1); border-radius: 58% 42% 37% 63% / 55% 62% 38% 45%; } }
@keyframes wobble { 0%, 100% { transform: rotate(-3deg) translateY(0); } 50% { transform: rotate(3deg) translateY(-.05em); } }
@keyframes pop-in { 0% { transform: scale(.2); opacity: 0; } 60% { transform: scale(1.12); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bounce-in { 0% { transform: translateY(-40px) scale(.4); opacity: 0; } 55% { transform: translateY(6px) scale(1.1); opacity: 1; } 75% { transform: translateY(-4px) scale(.97); } 100% { transform: none; } }
@keyframes pop    { 0% { transform: scale(.6); opacity: 0; } 60% { transform: scale(1.08); opacity: 1; } 100% { transform: scale(1); } }
@keyframes bob    { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes wiggle { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(-7deg) scale(1.05); } 75% { transform: rotate(7deg) scale(1.05); } }
@keyframes shake  { 0%, 100% { transform: none; } 20% { transform: translateX(-10px); } 40% { transform: translateX(9px); } 60% { transform: translateX(-6px); } 80% { transform: translateX(4px); } }
@keyframes rise   { from { transform: scaleY(0); } to { transform: scaleY(1); } }
@keyframes pulse  { 50% { opacity: .65; } }
@keyframes fx-pop { 0% { transform: translate(-50%, -50%) scale(.4); opacity: 0; } 40% { transform: translate(-50%, -50%) scale(1.1); opacity: 1; } 100% { transform: translate(-50%, -60%) scale(1); opacity: 1; } }
.bob { animation: bob 2.2s ease-in-out infinite; }

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

/* Laptop-ish hosts: stack the lobby when it gets narrow */
@media (max-width: 900px) {
  .host .lobby-grid { grid-template-columns: 1fr; }
  .host .draw-main { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .host .feed-card { max-height: 10rem; }
}
