/* ==========================================================================
   DOODLINGS — a very cute drawing & guessing party
   Sticker-book UI: soft cream paper, chunky pressable buttons, wobbling faces.
   ========================================================================== */

@font-face {
  font-family: 'Fredoka';
  /* Relative on purpose: served from /v/<stamp>/style.css the font inherits the
     same stamped prefix, so it is cacheable forever without ever going stale. */
  src: url('assets/fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --cream: #fff4ec;
  --cream-deep: #ffe9dc;
  --paper: #ffffff;
  --ink: #4b3a54;
  --ink-soft: #8d7c98;
  --ink-faint: #b9acc2;

  --pink: #ff8fbb;
  --pink-deep: #ff6ba6;
  --mint: #7fe0c4;
  --mint-deep: #45c9a6;
  --sky: #8fcaff;
  --sky-deep: #58aef7;
  --butter: #ffd977;
  --butter-deep: #ffc23c;
  --lilac: #bfa8ff;
  --coral: #ff9b7a;

  --edge: rgba(75, 58, 84, 0.13);
  --edge-strong: rgba(75, 58, 84, 0.24);
  --shadow-soft: 0 18px 38px -20px rgba(75, 58, 84, 0.55);

  --radius: 26px;
  --radius-sm: 16px;

  --font: 'Fredoka', 'Baloo 2', 'Quicksand', 'Segoe UI Rounded', 'Apple SD Gothic Neo',
    'Noto Sans KR', 'Malgun Gothic', system-ui, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: var(--font);
  font-weight: 500;
  color: var(--ink);
  background:
    radial-gradient(circle at 12% 8%, #ffe6f1 0%, transparent 42%),
    radial-gradient(circle at 88% 4%, #e4f4ff 0%, transparent 40%),
    radial-gradient(circle at 78% 92%, #e6fff4 0%, transparent 44%),
    var(--cream);
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
}

/* Faint dotted paper grain over everything */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image: radial-gradient(rgba(75, 58, 84, 0.09) 1.2px, transparent 1.2px);
  background-size: 22px 22px;
}

button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--pink-deep); }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(75, 58, 84, 0.18); border-radius: 99px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- sky ---- */

.sky { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }

.sky__blob {
  position: absolute;
  border-radius: 46% 54% 60% 40% / 55% 45% 55% 45%;
  filter: blur(6px);
  opacity: 0.5;
  animation: drift 26s ease-in-out infinite;
}
.sky__blob--1 { width: 340px; height: 300px; left: -90px; top: 8%; background: #ffd7e8; }
.sky__blob--2 { width: 300px; height: 280px; right: -80px; top: 44%; background: #d9f0ff; animation-delay: -8s; }
.sky__blob--3 { width: 260px; height: 240px; left: 28%; bottom: -110px; background: #dcfff0; animation-delay: -16s; }

.sky__doodle {
  position: absolute;
  left: var(--x);
  top: var(--y);
  font-size: 26px;
  color: rgba(75, 58, 84, 0.16);
  animation: bobble 7s ease-in-out infinite;
  animation-delay: var(--d);
}

@keyframes drift {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(0deg); }
  50% { transform: translate3d(24px, -28px, 0) rotate(12deg); }
}
@keyframes bobble {
  0%, 100% { transform: translateY(0) rotate(-6deg); }
  50% { transform: translateY(-14px) rotate(8deg); }
}

/* ------------------------------------------------------------ screens ---- */

.screen {
  position: relative;
  z-index: 1;
  display: none;
  height: 100%;
}
.screen.is-active { display: flex; }

.screen--home {
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: clamp(16px, 3vh, 36px) 18px 18px;
  overflow-y: auto;
}

.screen--room { flex-direction: column; padding: 10px 12px 12px; gap: 10px; }

/* -------------------------------------------------------------- brand ---- */

.brand { text-align: center; flex-shrink: 0; }

.brand__word {
  margin: 0;
  font-size: clamp(38px, 8vw, 76px);
  font-weight: 700;
  letter-spacing: 0.02em;
  display: flex;
  justify-content: center;
  gap: 0.01em;
}

.brand__word span {
  display: inline-block;
  color: var(--paper);
  text-shadow:
    2px 0 0 var(--ink), -2px 0 0 var(--ink), 0 2px 0 var(--ink), 0 -2px 0 var(--ink),
    2px 2px 0 var(--ink), -2px -2px 0 var(--ink), 2px -2px 0 var(--ink), -2px 2px 0 var(--ink),
    0 7px 0 rgba(75, 58, 84, 0.22);
  animation: letter-bob 2.6s ease-in-out infinite;
  animation-delay: calc(var(--n) * 0.09s);
}
.brand__word span:nth-child(3n) { color: #ffe8f2; }
.brand__word span:nth-child(3n + 1) { color: #eaf7ff; }

@keyframes letter-bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-9px) rotate(2deg); }
}

.brand__tag {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: clamp(13px, 1.6vw, 16px);
  font-weight: 500;
}

/* --------------------------------------------------------------- card ---- */

.card {
  background: var(--paper);
  border-radius: var(--radius);
  padding: 20px;
  border: 2px solid var(--edge);
  box-shadow: 0 8px 0 -2px rgba(255, 143, 187, 0.16), var(--shadow-soft);
}

.card__title {
  margin: 0 0 14px;
  font-size: 19px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
}

.home-grid {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 18px;
  flex-shrink: 0;
}

/* ------------------------------------------------------------ buttons ---- */

.btn {
  --btn-bg: var(--pink);
  --btn-shade: var(--pink-deep);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 22px;
  border-radius: 999px;
  background: var(--btn-bg);
  color: #fff;
  font-weight: 600;
  font-size: 16px;
  box-shadow: 0 5px 0 var(--btn-shade), 0 12px 20px -12px rgba(75, 58, 84, 0.7);
  transition: transform 0.09s ease, box-shadow 0.09s ease, filter 0.15s ease;
  text-shadow: 0 1px 0 rgba(75, 58, 84, 0.18);
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--btn-shade); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: 0 5px 0 var(--btn-shade); }
.btn:focus-visible { outline: 3px solid var(--sky-deep); outline-offset: 3px; }

.btn--pink { --btn-bg: var(--pink); --btn-shade: var(--pink-deep); }
.btn--mint { --btn-bg: var(--mint); --btn-shade: var(--mint-deep); }
.btn--sky { --btn-bg: var(--sky); --btn-shade: var(--sky-deep); }
.btn--butter { --btn-bg: var(--butter); --btn-shade: var(--butter-deep); color: #6a4a12; text-shadow: none; }
.btn--ghost {
  --btn-bg: #fff; --btn-shade: rgba(75, 58, 84, 0.22);
  color: var(--ink); text-shadow: none; border: 2px solid var(--edge);
}

.btn--jumbo {
  width: 100%;
  justify-content: flex-start;
  padding: 14px 20px;
  border-radius: 22px;
  margin-bottom: 12px;
  font-size: 17px;
}
.btn__emoji { font-size: 26px; filter: drop-shadow(0 2px 0 rgba(75, 58, 84, 0.18)); }
.btn__stack { display: flex; flex-direction: column; align-items: flex-start; line-height: 1.15; }
.btn__stack small { font-size: 12px; font-weight: 500; opacity: 0.85; }

.btn--send {
  --btn-bg: var(--mint); --btn-shade: var(--mint-deep);
  width: 44px; height: 44px; padding: 0; border-radius: 50%; flex-shrink: 0; font-size: 15px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  border: 2px solid var(--edge);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-soft);
  transition: transform 0.1s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { color: var(--ink); border-color: var(--pink); transform: translateY(-1px); }
.chip--code { color: var(--ink); letter-spacing: 0.14em; font-size: 15px; }
.chip--ghost { background: transparent; }

/* -------------------------------------------------------------- input ---- */

.field { display: flex; flex-direction: column; gap: 5px; flex: 1; min-width: 0; }
.field__label { font-size: 12px; font-weight: 600; color: var(--ink-soft); padding-left: 12px; }

.input {
  width: 100%;
  padding: 12px 16px;
  border-radius: 999px;
  border: 2px solid var(--edge);
  background: #fdf9fb;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.input::placeholder { color: var(--ink-faint); }
.input:focus { border-color: var(--pink); background: #fff; box-shadow: 0 0 0 4px rgba(255, 143, 187, 0.18); }

.input--code {
  text-transform: uppercase;
  letter-spacing: 0.34em;
  text-align: center;
  font-weight: 600;
  font-size: 19px;
  padding-left: 22px;
}

.join { display: flex; align-items: flex-end; gap: 10px; margin: 4px 0 16px; }
.join .btn { flex-shrink: 0; }

/* ------------------------------------------------------------- avatar ---- */

.avatar {
  --size: 40px;
  --tint: var(--pink);
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--size);
  height: var(--size);
  flex-shrink: 0;
  border-radius: 50% 50% 48% 52% / 52% 48% 50% 50%;
  background: var(--tint);
  box-shadow: inset 0 -4px 0 rgba(75, 58, 84, 0.12), 0 3px 0 rgba(75, 58, 84, 0.15);
  font-size: calc(var(--size) * 0.55);
  line-height: 1;
}
.avatar--xl { --size: 96px; animation: wiggle 3.4s ease-in-out infinite; }
.avatar__face { transform: translateY(1px); }

@keyframes wiggle {
  0%, 100% { transform: rotate(-4deg) translateY(0); }
  50% { transform: rotate(4deg) translateY(-6px); }
}

.me { display: flex; align-items: center; gap: 18px; margin-bottom: 16px; }
.me__preview { position: relative; }
.me__sparkle {
  position: absolute; top: -4px; right: -6px; font-size: 20px;
  animation: twinkle 1.8s ease-in-out infinite;
}
@keyframes twinkle {
  0%, 100% { transform: scale(1) rotate(0deg); opacity: 0.85; }
  50% { transform: scale(1.25) rotate(18deg); opacity: 1; }
}

.picker__label { margin: 0 0 8px; padding-left: 4px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.picker { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }

.picker--avatars button {
  width: 42px; height: 42px; border-radius: 14px; font-size: 22px;
  background: #fdf7fa; border: 2px solid transparent;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.picker--avatars button:hover { transform: translateY(-3px) rotate(-5deg); background: #fff0f6; }
.picker--avatars button[aria-checked='true'] { border-color: var(--pink); background: #fff; transform: translateY(-3px); }

.picker--colors button {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid transparent;
  box-shadow: inset 0 -3px 0 rgba(75, 58, 84, 0.14);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.picker--colors button:hover { transform: scale(1.12); }
.picker--colors button[aria-checked='true'] { border-color: var(--ink); transform: scale(1.16); }

/* -------------------------------------------------------------- rooms ---- */

.rooms { border-top: 2px dashed var(--edge); padding-top: 12px; }
.rooms__head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 12px; font-weight: 600; color: var(--ink-soft); margin-bottom: 8px; padding-left: 4px;
}
.rooms__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; max-height: 168px; overflow-y: auto; }
.rooms__empty { color: var(--ink-faint); font-size: 13px; padding: 10px 4px; text-align: center; }

.room-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 16px; background: #fdf7fa;
  border: 2px solid transparent; width: 100%; text-align: left;
  transition: transform 0.12s ease, border-color 0.12s ease, background 0.12s ease;
}
.room-row:hover { border-color: var(--mint); background: #fff; transform: translateX(3px); }
.room-row__faces { font-size: 15px; letter-spacing: -3px; }
.room-row__code { font-weight: 600; letter-spacing: 0.1em; }
.room-row__meta { margin-left: auto; font-size: 12px; color: var(--ink-soft); font-weight: 600; }

.home-foot {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: center;
  font-size: 12px; color: var(--ink-soft); padding-bottom: 8px;
}

.pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 13px; border-radius: 999px; font-size: 12px; font-weight: 600;
  background: rgba(255, 255, 255, 0.85); border: 2px solid var(--edge);
}
.pill__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--butter-deep); animation: pulse 1.4s ease-in-out infinite; }
.pill--ok .pill__dot { background: var(--mint-deep); animation: none; }
.pill--bad .pill__dot { background: #ff7a7a; }
@keyframes pulse { 0%, 100% { opacity: 0.35; } 50% { opacity: 1; } }

/* ------------------------------------------------------------- topbar ---- */

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid var(--edge);
  box-shadow: 0 6px 0 -2px rgba(255, 143, 187, 0.14), var(--shadow-soft);
  backdrop-filter: blur(6px);
}

.topbar__label { display: block; font-size: 10px; font-weight: 600; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.08em; }
.topbar__round strong { font-size: 16px; font-weight: 600; }
.topbar__round, .topbar__code { flex-shrink: 0; }

.wordbar { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 3px; }
.wordbar__tiles { display: flex; flex-wrap: wrap; justify-content: center; gap: 4px; min-height: 30px; }
.wordbar__hint { font-size: 11px; color: var(--ink-soft); font-weight: 500; }

.tile {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 30px; padding: 0 4px;
  border-radius: 8px; background: #fdf3f8;
  border-bottom: 3px solid var(--pink);
  font-weight: 600; font-size: 17px; color: var(--ink);
  animation: tile-pop 0.32s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.tile--blank { color: var(--ink-faint); background: #f8f4fa; border-bottom-color: var(--edge-strong); }
.tile--space { min-width: 12px; background: none; border: none; }
.tile--reveal { background: #fff6dc; border-bottom-color: var(--butter-deep); }
@keyframes tile-pop { from { transform: translateY(-8px) scale(0.7); opacity: 0; } to { transform: none; opacity: 1; } }

/* -------------------------------------------------------------- timer ---- */

.timer {
  position: relative; flex-shrink: 0;
  display: flex; align-items: center; gap: 7px;
  padding: 6px 14px 9px; border-radius: 18px;
  background: #fff; border: 2px solid var(--edge); min-width: 96px;
}
.timer__face { font-size: 20px; }
.timer__count { font-size: 20px; font-weight: 600; min-width: 34px; text-align: center; font-variant-numeric: tabular-nums; }
.timer__track { position: absolute; left: 10px; right: 10px; bottom: 4px; height: 5px; border-radius: 99px; background: var(--edge); overflow: hidden; }
.timer__fill { display: block; height: 100%; width: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--mint), var(--sky)); transition: width 0.25s linear, background 0.4s ease; }
.timer.is-urgent { animation: shake 0.5s ease-in-out infinite; border-color: var(--pink); }
.timer.is-urgent .timer__fill { background: linear-gradient(90deg, var(--coral), var(--pink-deep)); }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-2px) rotate(-1deg); }
  75% { transform: translateX(2px) rotate(1deg); }
}

/* --------------------------------------------------------------- play ---- */

.play {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 232px minmax(0, 1fr) 292px;
  gap: 10px;
}

.panel {
  background: rgba(255, 255, 255, 0.92);
  border-radius: 22px;
  border: 2px solid var(--edge);
  box-shadow: 0 6px 0 -2px rgba(143, 202, 255, 0.14), var(--shadow-soft);
  padding: 12px;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.panel--stage { position: relative; padding: 10px; background: rgba(255, 255, 255, 0.72); }

.panel__title {
  margin: 0 0 10px; font-size: 14px; font-weight: 600; color: var(--ink-soft);
  display: flex; align-items: center; gap: 7px; padding-left: 4px; flex-shrink: 0;
}

/* ------------------------------------------------------------ players ---- */

.players { list-style: none; margin: 0; padding: 0 2px; display: flex; flex-direction: column; gap: 7px; overflow-y: auto; min-height: 0; }

.player {
  position: relative;
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: 16px;
  background: #fdf7fa; border: 2px solid transparent;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.player.is-you { background: #fff; border-color: var(--edge); }
.player.is-drawer { border-color: var(--butter-deep); background: #fffaea; }
.player.is-guessed { border-color: var(--mint-deep); background: #eefdf7; }
.player.is-away { opacity: 0.45; }
.player.just-scored { animation: score-pop 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
@keyframes score-pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.06) rotate(-1.5deg); background: #dcfcef; }
  100% { transform: scale(1); }
}

.player__rank { font-size: 12px; font-weight: 600; color: var(--ink-faint); width: 16px; flex-shrink: 0; text-align: center; }
.player__body { min-width: 0; flex: 1; }
.player__name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player__score { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.player__badge { position: absolute; top: -6px; left: 26px; font-size: 14px; filter: drop-shadow(0 1px 1px rgba(75, 58, 84, 0.3)); }
.player__delta {
  font-size: 12px; font-weight: 600; color: var(--mint-deep);
  animation: float-up 1.4s ease-out forwards;
}
@keyframes float-up {
  0% { transform: translateY(6px); opacity: 0; }
  25% { transform: translateY(0); opacity: 1; }
  100% { transform: translateY(-10px); opacity: 0; }
}
.player__kick {
  opacity: 0; font-size: 12px; padding: 2px 6px; border-radius: 8px; color: var(--ink-faint);
  transition: opacity 0.15s ease;
}
.player:hover .player__kick { opacity: 1; }
.player__kick:hover { color: #ff6b6b; background: #fff0f0; }

/* -------------------------------------------------------------- stage ---- */

.stage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; align-items: center; justify-content: center; }

.stage__frame {
  position: relative;
  width: 100%;
  max-width: min(100%, calc((100vh - 250px) * 4 / 3));
  aspect-ratio: 4 / 3;
  border-radius: 20px;
  overflow: hidden;
  background: #fff;
  border: 3px solid rgba(75, 58, 84, 0.16);
  box-shadow: 0 10px 0 -3px rgba(255, 217, 119, 0.35), 0 22px 42px -22px rgba(75, 58, 84, 0.6);
}

#board { display: block; width: 100%; height: 100%; touch-action: none; }
.stage__frame.can-draw #board { cursor: none; }

.cursor-dot {
  position: absolute; top: 0; left: 0; pointer-events: none; opacity: 0;
  border-radius: 50%; border: 2px solid rgba(75, 58, 84, 0.55);
  transform: translate(-50%, -50%); transition: opacity 0.15s ease;
}
.stage__frame.can-draw .cursor-dot.is-on { opacity: 1; }

/* Above the overlay: the podium deserves confetti raining over its own card. */
.confetti { position: absolute; inset: 0; z-index: 6; width: 100%; height: 100%; pointer-events: none; }
.floaters { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }

.floater {
  position: absolute; bottom: 8%; font-size: 30px;
  animation: floaty 2.6s ease-out forwards;
}
@keyframes floaty {
  0% { transform: translateY(0) scale(0.4) rotate(0deg); opacity: 0; }
  15% { transform: translateY(-16px) scale(1.1) rotate(-8deg); opacity: 1; }
  100% { transform: translateY(-260px) scale(0.9) rotate(14deg); opacity: 0; }
}

/* ------------------------------------------------------------ overlay ---- */

.overlay {
  position: absolute; inset: 0; z-index: 5;
  border-radius: 22px;
  /* flex-start + margin:auto on the card centres it when it fits and lets it
     scroll from the top when it does not — plain `center` clips the top edge. */
  display: flex; align-items: flex-start; justify-content: center; padding: 16px;
  background: rgba(255, 244, 236, 0.9);
  backdrop-filter: blur(7px);
  animation: fade-in 0.24s ease both;
  overflow-y: auto;
}
.overlay[hidden] { display: none; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.overlay__card {
  margin: auto;
  width: min(680px, 100%);
  background: var(--paper);
  border-radius: var(--radius);
  border: 2px solid var(--edge);
  box-shadow: 0 10px 0 -3px rgba(255, 143, 187, 0.2), var(--shadow-soft);
  padding: 22px;
  text-align: center;
  animation: card-in 0.34s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
@keyframes card-in { from { transform: translateY(18px) scale(0.94); opacity: 0; } to { transform: none; opacity: 1; } }

.overlay__eyebrow { font-size: 12px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.1em; }
.overlay__title { margin: 6px 0 4px; font-size: clamp(22px, 3.4vw, 30px); font-weight: 700; }
.overlay__sub { margin: 0 0 16px; color: var(--ink-soft); font-size: 14px; }
.overlay__word { display: inline-block; padding: 6px 18px; border-radius: 16px; background: #fff6dc; border-bottom: 4px solid var(--butter-deep); font-size: 26px; font-weight: 700; margin: 4px 0 14px; }

.word-choices { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; }
.word-choice {
  flex: 1 1 150px;
  padding: 18px 14px;
  border-radius: 20px;
  background: linear-gradient(160deg, #fff, #fdf3f8);
  border: 2px solid var(--edge);
  box-shadow: 0 5px 0 rgba(75, 58, 84, 0.14);
  font-size: 18px; font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.12s ease, border-color 0.12s ease;
}
.word-choice:hover { transform: translateY(-4px) rotate(-1.4deg); border-color: var(--pink); box-shadow: 0 9px 0 rgba(255, 143, 187, 0.35); }
.word-choice:active { transform: translateY(2px); box-shadow: 0 2px 0 rgba(75, 58, 84, 0.16); }
.word-choice small { display: block; font-size: 11px; font-weight: 500; color: var(--ink-faint); margin-top: 4px; }

.summary { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.summary li {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 12px; border-radius: 14px; background: #fdf7fa; font-size: 14px;
  animation: row-in 0.3s ease both;
}
.summary li.is-zero { opacity: 0.55; }
.summary__name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.summary__delta { font-weight: 700; color: var(--mint-deep); }
.summary__delta.is-zero { color: var(--ink-faint); }
@keyframes row-in { from { transform: translateX(-10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* podium */
.podium { display: flex; align-items: flex-end; justify-content: center; gap: 10px; margin: 14px 0 6px; }
.podium__step { display: flex; flex-direction: column; align-items: center; gap: 6px; flex: 1; max-width: 130px; }
.podium__block {
  width: 100%; border-radius: 16px 16px 6px 6px; background: linear-gradient(180deg, #fff, #fdeef6);
  border: 2px solid var(--edge); border-bottom-width: 4px;
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 700;
  animation: rise 0.5s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.podium__step--1 .podium__block { height: 108px; background: linear-gradient(180deg, #fff8e2, #ffeeb8); }
.podium__step--2 .podium__block { height: 82px; }
.podium__step--3 .podium__block { height: 64px; }
.podium__name { font-size: 13px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.podium__score { font-size: 12px; color: var(--ink-soft); font-weight: 600; }
@keyframes rise { from { transform: scaleY(0.2); transform-origin: bottom; opacity: 0; } to { transform: none; opacity: 1; } }

/* lobby overlay bits */
.lobby-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(126px, 1fr)); gap: 9px; text-align: left; margin: 6px 0 14px; }
.setting { background: #fdf7fa; border-radius: 16px; padding: 9px 11px; }
.setting__label { font-size: 11px; font-weight: 600; color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.07em; margin-bottom: 6px; }
.setting__options { display: flex; flex-wrap: wrap; gap: 5px; }
.opt {
  padding: 5px 11px; border-radius: 999px; background: #fff; border: 2px solid var(--edge);
  font-size: 13px; font-weight: 600; color: var(--ink-soft);
  transition: transform 0.1s ease, border-color 0.12s ease, color 0.12s ease, background 0.12s ease;
}
.opt:hover { transform: translateY(-2px); color: var(--ink); }
.opt[aria-pressed='true'] { background: var(--pink); border-color: var(--pink-deep); color: #fff; }
.opt:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.opt--pack[aria-pressed='true'] { background: var(--mint); border-color: var(--mint-deep); color: #16584a; }

.lobby-faces { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 6px 0 14px; }
.lobby-face { display: flex; flex-direction: column; align-items: center; gap: 3px; width: 62px; }
.lobby-face__name { font-size: 11px; font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.invite {
  display: flex; align-items: center; gap: 8px; justify-content: center;
  background: #fff8e6; border: 2px dashed var(--butter-deep); border-radius: 16px;
  padding: 10px 14px; margin-bottom: 14px; font-size: 14px; font-weight: 600;
}
.invite code { font-size: 20px; letter-spacing: 0.2em; font-weight: 700; }

.custom-words { width: 100%; margin-top: 4px; }
.custom-words textarea {
  width: 100%; min-height: 56px; resize: vertical; border-radius: 14px;
  border: 2px solid var(--edge); background: #fff; padding: 9px 12px; font-size: 13px; outline: none;
}
.custom-words textarea:focus { border-color: var(--pink); }

/* -------------------------------------------------------------- tools ---- */

.tools {
  flex-shrink: 0; width: 100%; max-width: min(100%, calc((100vh - 250px) * 4 / 3));
  display: flex; flex-direction: column; gap: 7px;
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid var(--edge); border-radius: 20px; padding: 8px 10px;
  box-shadow: 0 5px 0 -2px rgba(191, 168, 255, 0.22);
}
.tools[hidden] { display: none; }
.tools__row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tools__row--controls { justify-content: space-between; }
.tools__group { display: flex; gap: 5px; }

.swatches { display: flex; flex-wrap: wrap; gap: 4px; }
.swatch {
  width: 22px; height: 22px; border-radius: 7px; border: 2px solid rgba(75, 58, 84, 0.12);
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.swatch:hover { transform: translateY(-3px) scale(1.1); }
.swatch[aria-checked='true'] { transform: translateY(-3px) scale(1.16); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }

.sizes { display: flex; align-items: center; gap: 5px; }
.size {
  display: flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 50%; background: #fdf7fa; border: 2px solid transparent;
  transition: transform 0.1s ease, border-color 0.12s ease;
}
.size:hover { transform: translateY(-2px); }
.size[aria-checked='true'] { border-color: var(--pink); background: #fff; }
.size__dot { display: block; border-radius: 50%; background: var(--ink); }

.tool {
  width: 34px; height: 34px; border-radius: 12px; background: #fdf7fa;
  border: 2px solid transparent; font-size: 16px;
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.1s ease, border-color 0.12s ease, background 0.12s ease;
}
.tool:hover { transform: translateY(-2px); background: #fff; }
.tool[aria-pressed='true'] { border-color: var(--pink); background: #fff; }
.tool--action { background: #f6f2fa; }
.tool--skip { width: auto; padding: 0 12px; font-size: 12px; font-weight: 600; color: var(--ink-soft); }

/* ---------------------------------------------------------- reactions ---- */

.reactions { display: flex; gap: 5px; flex-shrink: 0; }
.reaction {
  width: 32px; height: 32px; border-radius: 50%; font-size: 16px;
  background: rgba(255, 255, 255, 0.9); border: 2px solid var(--edge);
  display: inline-flex; align-items: center; justify-content: center;
  transition: transform 0.12s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.reaction:hover { transform: translateY(-4px) scale(1.16); }
.reaction:active { transform: scale(0.9); }

/* --------------------------------------------------------------- chat ---- */

.chat {
  list-style: none; margin: 0 0 10px; padding: 2px 4px;
  flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 6px;
}

.msg { display: flex; gap: 7px; align-items: flex-start; animation: msg-in 0.24s ease both; font-size: 13px; }
@keyframes msg-in { from { transform: translateY(6px); opacity: 0; } to { transform: none; opacity: 1; } }

.msg__bubble {
  position: relative;
  background: #fdf7fa; border-radius: 14px 14px 14px 5px;
  padding: 6px 11px; min-width: 0; max-width: 100%;
  overflow-wrap: anywhere;
}
.msg__who { display: block; font-size: 10px; font-weight: 600; color: var(--ink-soft); }

.msg--system { justify-content: center; }
.msg--system .msg__bubble {
  background: transparent; color: var(--ink-soft); font-size: 12px;
  text-align: center; border-radius: 10px; font-weight: 500; padding: 3px 8px;
}
.msg--correct .msg__bubble {
  background: linear-gradient(140deg, #d9fbee, #c3f7e2); color: #14705a; font-weight: 600;
  border-radius: 14px; animation: correct-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.msg--correct { justify-content: center; }
@keyframes correct-pop { 0% { transform: scale(0.8); } 60% { transform: scale(1.05); } 100% { transform: scale(1); } }
.msg--team .msg__bubble { background: #eefdf7; border: 1px dashed var(--mint-deep); }
.msg--close .msg__bubble { background: #fff5dc; color: #8a6116; font-weight: 600; }
.msg--me .msg__bubble { background: #fdeef6; }

.chat-form { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.input--chat { padding: 11px 15px; }
.chat-form.is-locked .input--chat { background: #f4f0f6; color: var(--ink-faint); }

/* ------------------------------------------------------------- toasts ---- */

.toasts {
  position: fixed; z-index: 40; left: 50%; bottom: 22px; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none;
}
.toast {
  padding: 10px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--paper); border: 2px solid var(--edge);
  box-shadow: 0 5px 0 rgba(75, 58, 84, 0.14), var(--shadow-soft);
  animation: toast-in 0.3s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}
.toast--warn { background: #fff3d8; border-color: var(--butter-deep); }
.toast--close { background: #fff0f6; border-color: var(--pink); }
.toast--bad { background: #ffeaea; border-color: #ffadad; }
.toast.is-out { animation: toast-out 0.28s ease forwards; }
@keyframes toast-in { from { transform: translateY(18px) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toast-out { to { transform: translateY(-8px) scale(0.94); opacity: 0; } }

/* --------------------------------------------------------- responsive ---- */

@media (max-width: 1080px) {
  .play { grid-template-columns: 190px minmax(0, 1fr) 250px; }
}

@media (max-width: 900px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  body { overflow: auto; }
  .screen--room { height: auto; min-height: 100%; }

  .topbar { flex-wrap: wrap; justify-content: center; row-gap: 8px; }
  .wordbar { order: -1; width: 100%; }

  .play {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: 'stage' 'players' 'chat';
  }
  .panel--stage { grid-area: stage; }
  .panel--players { grid-area: players; }
  .panel--chat { grid-area: chat; min-height: 300px; }

  .stage__frame { max-width: 100%; }
  .tools { max-width: 100%; }
  .players { flex-direction: row; overflow-x: auto; overflow-y: hidden; padding-bottom: 4px; }
  .player { flex-shrink: 0; min-width: 148px; }
}

@media (max-width: 520px) {
  .me { flex-direction: column; text-align: center; gap: 12px; }
  .card { padding: 16px; }
  .timer { min-width: 80px; }
  .tools__row--controls { justify-content: center; }
}

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

/* Miniature mascot portraits and a softly lit winners' stage. */
.avatar {
  background: radial-gradient(ellipse at 28% 18%, #ffffffc9, transparent 60%), var(--tint);
  border: 1px solid #ffffffc0;
  box-shadow: inset 0 -3px 5px #694b6424, inset 0 2px 2px #ffffffd9, 0 3px 0 #694b641c;
}
.avatar__face { display: block; width: 112%; height: 112%; flex-shrink: 0; }
.mascot-art { display: block; width: 100%; height: 100%; overflow: visible; }
.picker--avatars .mascot-art { width: 39px; height: 39px; }
.mascot-eye { transform-box: fill-box; transform-origin: center; }
.avatar--xl .mascot-eye { animation: mascot-blink 5.8s ease-in-out infinite; }
.picker--avatars button:hover .mascot-body { transform: translateY(-2px) rotate(-3deg); transform-origin: 50% 75%; }
.podium__step { animation: podium-arrive .7s cubic-bezier(.18,.8,.28,1.15) both; }
.podium__step--2 { animation-delay: .1s; }
.podium__step--3 { animation-delay: .22s; }
.podium__block { border: 1px solid #fff8; box-shadow: inset 0 3px 0 #fff9, inset -7px -3px 0 #ae91af18, 0 8px 14px #745b7412; }
.podium__step--1 .avatar { --size: 58px !important; }
@keyframes mascot-blink { 0%, 92%, 96%, 100% { transform: scaleY(1); } 94% { transform: scaleY(.08); } }
@keyframes podium-arrive { from { opacity: 0; transform: translateY(20px) scale(.9); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .avatar--xl .mascot-eye, .podium__step { animation: none; }
}
