/* ============================================================
   The Minister's Cat — cozy storybook parlour styles
   ============================================================ */

:root {
  --plum: #241b25;
  --plum-2: #2f2330;
  --plum-3: #3b2c3b;
  --paper: #f5e9d2;
  --paper-2: #ead9bb;
  --paper-3: #dfc9a5;
  --ink: #3a2b2c;
  --muted: #7d6960;
  --gold: #e8c07d;
  --gold-deep: #bb8e4e;
  --rust: #ad5247;
  --rust-dark: #8b3c37;
  --sage: #81906c;
  --shadow: 0 18px 40px rgba(10, 6, 12, .38);
  --display: "Fraunces", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --body: "Lora", Georgia, serif;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { min-height: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--body);
  color: var(--paper);
  background:
    radial-gradient(900px 620px at 78% -8%, rgba(232, 192, 125, .16), transparent 60%),
    radial-gradient(700px 500px at 6% 30%, rgba(173, 82, 71, .18), transparent 65%),
    radial-gradient(800px 700px at 50% 120%, rgba(129, 144, 108, .14), transparent 60%),
    linear-gradient(155deg, #2b202c 0%, var(--plum) 45%, #1e1720 100%);
  background-attachment: fixed;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: .14;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}

.ambient { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.ambient span {
  position: absolute;
  border: 1px solid rgba(232, 192, 125, .07);
  border-radius: 50%;
}
.ambient span:nth-child(1) { width: 520px; height: 520px; top: -190px; right: -120px; }
.ambient span:nth-child(2) { width: 380px; height: 380px; bottom: -150px; left: -110px; }
.ambient span:nth-child(3) { width: 760px; height: 760px; top: 32%; left: 36%; opacity: .5; }

main, .site-header { position: relative; z-index: 1; }

/* ---------- header ---------- */
.site-header {
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px 32px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 13px; color: var(--gold); }
.brand-crest { width: 46px; height: 46px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text strong { font-family: var(--display); font-size: 20px; letter-spacing: .015em; }
.brand-text small { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: rgba(245, 233, 210, .55); margin-top: 5px; }

.header-actions { display: flex; gap: 8px; }
.icon-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: rgba(245, 233, 210, .06);
  border: 1px solid rgba(232, 192, 125, .25);
  color: var(--paper);
  border-radius: 999px;
  padding: 9px 14px;
  font: 500 13px var(--body);
  cursor: pointer;
  transition: background .2s, border-color .2s, transform .2s;
}
.icon-btn:hover { background: rgba(232, 192, 125, .14); border-color: var(--gold); transform: translateY(-1px); }
.icon-btn span:first-child { color: var(--gold); font-size: 16px; }
.icon-btn[aria-pressed="false"] { opacity: .55; }

/* ---------- screens ---------- */
.screen { display: none; max-width: 1240px; margin: 0 auto; padding: 26px 32px 80px; }
.screen.is-active { display: block; animation: screen-in .35s ease both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: .22em; text-transform: uppercase;
  color: var(--gold); margin: 0 0 16px;
}
h1, h2 { font-family: var(--display); font-weight: 600; margin: 0; }
h1 { font-size: clamp(36px, 5vw, 62px); line-height: 1.06; letter-spacing: -.02em; }
h1 em { color: var(--gold); font-weight: 500; }
h2 { font-size: 24px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }
.fineprint { color: var(--muted); font-size: 12px; line-height: 1.6; margin: 10px 0 0; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- home ---------- */
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 26px;
  align-items: center;
  padding: 22px 0 34px;
}
.lede { font-size: 17px; line-height: 1.75; color: rgba(245, 233, 210, .82); max-width: 620px; margin: 22px 0 0; }
.lede strong { color: var(--gold); font-weight: 600; }
.hero-chips { display: flex; flex-wrap: wrap; gap: 10px 20px; margin-top: 26px; font-size: 12px; letter-spacing: .06em; color: rgba(232, 192, 125, .85); }
.entitlement-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 22px;
  padding: 14px 16px; border: 1px solid rgba(232, 192, 125, .22); border-radius: 12px;
  background: rgba(245, 233, 210, .045);
}
.entitlement-note { margin: 0; font-size: 13px; color: rgba(245, 233, 210, .7); flex: 1; min-width: 200px; }
.hero-art { display: flex; justify-content: center; }
.hero-cat { width: 100%; max-width: 410px; filter: drop-shadow(0 18px 28px rgba(0,0,0,.3)); }

.mode-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.mode-card {
  background: linear-gradient(160deg, var(--paper) 0%, var(--paper-2) 100%);
  color: var(--ink);
  border-radius: 20px;
  padding: 28px;
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.65);
  border: 1px solid rgba(255, 246, 224, .5);
  position: relative;
  overflow: hidden;
}
.mode-card::after {
  content: "";
  position: absolute; inset: 6px; border: 1px solid rgba(122, 91, 66, .16);
  border-radius: 15px; pointer-events: none;
}
.card-top { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-icon {
  width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%;
  background: var(--plum); color: var(--gold); font-size: 17px;
}
.card-kicker { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--rust-dark); font-weight: 600; }
.mode-card h2 { font-size: 29px; margin-bottom: 8px; }
.mode-card p { color: var(--muted); font-size: 14px; line-height: 1.6; margin: 0 0 18px; }

.field-label { display: block; font-size: 12px; font-weight: 600; color: var(--ink); margin-bottom: 8px; letter-spacing: .04em; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 16px 0 20px; }
.text-input, .select-input {
  width: 100%;
  font: 15px var(--body);
  color: var(--ink);
  background: rgba(255, 252, 244, .75);
  border: 1px solid rgba(109, 78, 58, .32);
  border-radius: 10px;
  padding: 11px 13px;
  outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.text-input::placeholder { color: #a18b7c; }
.text-input:focus, .select-input:focus { border-color: var(--rust); box-shadow: 0 0 0 3px rgba(173, 82, 71, .16); }
.select-input { margin-top: 8px; cursor: pointer; font-size: 13px; padding: 9px 10px; }
.code-input { text-transform: uppercase; letter-spacing: .32em; font-family: var(--display); font-weight: 700; text-align: center; }

.btn {
  font: 600 14px var(--body);
  border-radius: 10px;
  border: 1px solid transparent;
  padding: 12px 18px;
  cursor: pointer;
  transition: transform .18s, box-shadow .18s, background .18s, opacity .18s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); }
.btn:active:not(:disabled) { transform: translateY(0); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(160deg, var(--rust), var(--rust-dark)); color: #fff4e4; box-shadow: 0 8px 18px rgba(139, 60, 55, .3); }
.btn-primary:hover:not(:disabled) { box-shadow: 0 12px 24px rgba(139, 60, 55, .42); }
.btn-ghost { background: transparent; border-color: rgba(109, 78, 58, .4); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { background: rgba(109, 78, 58, .08); }
.btn-quiet { background: rgba(245, 233, 210, .08); border-color: rgba(232, 192, 125, .25); color: var(--paper); }
.btn-quiet:hover:not(:disabled) { background: rgba(232, 192, 125, .14); }
.btn-gold { background: linear-gradient(160deg, var(--gold), var(--gold-deep)); color: #3a2b1d; box-shadow: 0 8px 18px rgba(0,0,0,.2); }
.btn-wide { width: 100%; }
.btn-small { padding: 8px 13px; font-size: 12px; }

.divider { display: flex; align-items: center; gap: 12px; margin: 20px 0 14px; color: var(--muted); font-size: 12px; }
.divider::before, .divider::after { content: ""; height: 1px; background: rgba(109, 78, 58, .2); flex: 1; }
.join-row { display: flex; gap: 10px; }
.join-row .text-input { flex: 1; }
.join-hint { font-size: 12px !important; margin-top: 10px !important; }
.join-hint.error { color: var(--rust-dark); font-weight: 600; }
.join-hint.invite { color: var(--rust-dark); font-weight: 600; }
.join-row.is-invite { animation: invitePulse 1.6s ease-out 2; border-radius: 12px; }
@keyframes invitePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(232, 192, 125, 0); }
  50% { box-shadow: 0 0 0 6px rgba(232, 192, 125, .22); }
}
.connection-note {
  margin: 24px 0 0; padding: 13px 16px;
  border: 1px dashed rgba(232, 192, 125, .35); border-radius: 12px;
  color: rgba(245, 233, 210, .66); font-size: 13px; line-height: 1.6;
}
.connection-note code { color: var(--gold); background: rgba(0,0,0,.2); padding: 2px 6px; border-radius: 5px; }
.itch-notice {
  margin: 18px 0 0; padding: 15px 18px;
  border: 1px solid rgba(232, 192, 125, .4); border-radius: 12px;
  background: rgba(232, 192, 125, .07);
  font-size: 13px; line-height: 1.65; color: rgba(245, 233, 210, .82);
}
.itch-notice strong { color: var(--gold); font-family: var(--display); letter-spacing: .04em; }
.itch-notice p { margin: 6px 0 8px !important; }
.itch-notice ul { margin: 0; padding-left: 20px; }
.itch-notice li { margin-bottom: 5px; }
.itch-notice a { color: var(--gold); text-decoration: underline; text-underline-offset: 3px; }
.itch-float {
  position: fixed; right: 16px; bottom: 16px; z-index: 60;
  padding: 9px 14px; border: 1px solid rgba(232, 192, 125, .5); border-radius: 999px;
  background: rgba(38, 26, 22, .92); color: var(--gold);
  font-family: var(--display); font-size: 12px; letter-spacing: .06em;
  text-decoration: none; box-shadow: 0 6px 20px rgba(0,0,0,.35);
}
.itch-float:hover { background: rgba(58, 39, 32, .96); }

/* ---------- panels ---------- */
.panel {
  background: linear-gradient(155deg, var(--paper) 0%, var(--paper-2) 100%);
  color: var(--ink);
  border: 1px solid rgba(255, 246, 224, .5);
  border-radius: 18px;
  padding: 22px;
  box-shadow: var(--shadow), inset 0 1px rgba(255,255,255,.55);
}
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.panel-heading h2 { font-size: 20px; }
.panel-heading.compact { margin-bottom: 12px; }
.panel-label { font-size: 11px; font-weight: 600; letter-spacing: .18em; text-transform: uppercase; color: var(--rust-dark); margin: 0 0 10px; }

/* ---------- lobby ---------- */
.lobby-head, .game-topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 8px 0 26px; }
.lobby-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 22px; align-items: start; }
.lobby-main, .lobby-side { display: flex; flex-direction: column; gap: 20px; }
.share-panel { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.share-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.room-code { font-size: 52px; letter-spacing: .12em; color: var(--rust-dark); line-height: 1.1; }
.player-list, .standings, .podium { list-style: none; margin: 0; padding: 0; }
.player-list li, .standings li {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 4px; border-bottom: 1px dashed rgba(109, 78, 58, .22);
}
.player-list li:last-child, .standings li:last-child { border-bottom: none; }
.avatar {
  width: 38px; height: 38px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--plum); color: var(--gold);
  font-family: var(--display); font-weight: 700; font-size: 16px;
}
.player-name { font-weight: 600; font-size: 15px; }
.player-meta { display: block; color: var(--muted); font-size: 11px; margin-top: 3px; }
.tag {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700;
  padding: 4px 8px; border-radius: 999px; background: rgba(129, 144, 108, .18); color: #556349;
}
.tag.you { background: rgba(173, 82, 71, .14); color: var(--rust-dark); }
.tag.host { background: rgba(232, 192, 125, .35); color: #775422; }
.player-list li .spacer { flex: 1; }
.lobby-bot-row { display: flex; gap: 10px; margin-top: 16px; }
.lobby-side .field-label { margin-bottom: 14px; }
.host-only { text-align: center; }
.host-only .fineprint { margin-top: 10px; }
.waiting-note { text-align: center; font-size: 13px; color: rgba(245, 233, 210, .65); }

/* ---------- game top ---------- */
.room-chip {
  display: inline-flex; align-items: center; gap: 9px;
  background: rgba(245, 233, 210, .07); border: 1px solid rgba(232, 192, 125, .25);
  color: var(--paper); border-radius: 999px; padding: 8px 14px; cursor: pointer; font: 13px var(--body);
}
.room-chip-label { color: rgba(245, 233, 210, .55); font-size: 11px; text-transform: uppercase; letter-spacing: .12em; }
.room-chip strong { font-family: var(--display); letter-spacing: .16em; color: var(--gold); }
.turn-pill { display: flex; align-items: center; gap: 9px; font-size: 13px; color: rgba(245, 233, 210, .8); }
.turn-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--gold); box-shadow: 0 0 0 4px rgba(232,192,125,.12); animation: pulse 2s infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 8px rgba(232,192,125,0); } }
.timer { position: relative; width: 52px; height: 52px; display: grid; place-items: center; }
.timer svg { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.timer circle { fill: none; stroke-width: 3.5; }
.timer-track { stroke: rgba(232, 192, 125, .16); }
.timer-fill { stroke: var(--gold); stroke-linecap: round; stroke-dasharray: 113.1; stroke-dashoffset: 0; transition: stroke-dashoffset .12s linear, stroke .3s; }
.timer.low .timer-fill { stroke: var(--rust); }
.timer.low #timerText { color: #ee9787; }
#timerText { font-family: var(--display); font-weight: 700; font-size: 17px; z-index: 1; }

/* ---------- game layout ---------- */
.game-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .55fr); gap: 22px; align-items: start; }
.stage { min-width: 0; }
.letter-card {
  position: relative; text-align: center;
  background: linear-gradient(155deg, var(--paper) 0%, var(--paper-2) 100%);
  color: var(--ink); border-radius: 20px; padding: 20px 20px 22px;
  box-shadow: var(--shadow); border: 1px solid rgba(255, 246, 224, .55);
  overflow: hidden;
}
.letter-card::before { content: ""; position: absolute; inset: 7px; border: 1px solid rgba(122, 91, 66, .18); border-radius: 14px; pointer-events: none; }
.letter-ornament { position: absolute; top: 12px; left: 20px; color: var(--rust); opacity: .6; font-size: 20px; }
.letter-caption { font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: var(--rust-dark); font-weight: 600; margin: 0; }
.big-letter {
  font-family: var(--display); font-size: clamp(84px, 13vw, 132px); line-height: 1;
  color: var(--plum); margin: 2px 0 4px; font-weight: 600;
  text-shadow: 2px 2px 0 rgba(232, 192, 125, .45);
}

.prompt-panel {
  margin-top: 18px; padding: 20px 22px;
  background: rgba(245, 233, 210, .07); border: 1px solid rgba(232, 192, 125, .2);
  border-radius: 18px;
}
.prompt-line { font-family: var(--display); font-size: clamp(18px, 2.4vw, 24px); margin: 0 0 16px; color: var(--paper); text-align: center; }
.prompt-line span { color: var(--gold); }
#answerForm { display: flex; gap: 10px; }
.answer-input {
  flex: 1; min-width: 0;
  font: 16px var(--body); color: var(--ink);
  background: var(--paper); border: 1px solid rgba(232, 192, 125, .4);
  border-radius: 11px; padding: 13px 15px; outline: none;
  transition: box-shadow .2s, border-color .2s;
}
.answer-input::placeholder { color: #a18b7c; }
.answer-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 192, 125, .18); }
.answer-input:disabled { opacity: .6; }
.answer-input.shake { animation: shake .35s; border-color: var(--rust); }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(5px); } 75% { transform: translateX(-3px); } }
.input-help { margin: 10px 0 0; font-size: 12px; color: rgba(245, 233, 210, .55); }

.watch-panel {
  margin-top: 18px; padding: 18px 20px; border-radius: 18px;
  background: rgba(245, 233, 210, .06); border: 1px solid rgba(232, 192, 125, .18);
  display: flex; align-items: center; gap: 16px;
}
.watch-cat { width: 62px; height: 56px; flex: none; color: var(--gold); animation: bob 1.7s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-5px) rotate(-2deg); } }
.watch-title { font-family: var(--display); font-size: 19px; margin: 0 0 4px; }

.feedback { margin-top: 14px; padding: 12px 16px; border-radius: 11px; font-size: 14px; border: 1px solid; }
.feedback.good { background: rgba(129, 144, 108, .16); border-color: rgba(129, 144, 108, .5); color: #d5e2c2; }
.feedback.bad { background: rgba(173, 82, 71, .16); border-color: rgba(173, 82, 71, .5); color: #f1b6aa; }
.feedback.info { background: rgba(232, 192, 125, .12); border-color: rgba(232, 192, 125, .35); color: var(--gold); }

.alphabet-wrap, .ledger-wrap { margin-top: 20px; }
.alphabet { display: grid; grid-template-columns: repeat(13, minmax(0, 1fr)); gap: 6px; }
.letter-tile {
  aspect-ratio: 1; border-radius: 9px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-family: var(--display); font-weight: 700; font-size: 15px;
  background: rgba(245, 233, 210, .05); border: 1px solid rgba(232, 192, 125, .12);
  color: rgba(245, 233, 210, .32); position: relative; overflow: hidden;
}
.letter-tile small { font-family: var(--body); font-size: 8px; font-weight: 500; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; padding: 0 2px; opacity: .9; }
.letter-tile.done { background: rgba(129, 144, 108, .2); border-color: rgba(129, 144, 108, .45); color: #d7e2c6; }
.letter-tile.current { background: linear-gradient(160deg, var(--gold), var(--gold-deep)); border-color: #f3d79f; color: #3a2b1d; box-shadow: 0 0 0 3px rgba(232,192,125,.16); transform: scale(1.05); z-index: 1; }
.letter-tile.skipped { opacity: .35; }

.ledger { max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; padding-right: 4px; }
.ledger li {
  display: flex; align-items: baseline; gap: 10px; font-size: 13px;
  padding: 8px 12px; background: rgba(245, 233, 210, .05); border-radius: 9px;
  color: rgba(245, 233, 210, .85); animation: ledger-in .3s ease both;
}
@keyframes ledger-in { from { opacity: 0; transform: translateY(-5px); } }
.ledger .ledger-letter { font-family: var(--display); font-weight: 700; color: var(--gold); }
.ledger .ledger-who { color: rgba(245, 233, 210, .5); font-size: 11px; margin-left: auto; white-space: nowrap; }
.ledger-empty { color: rgba(245, 233, 210, .45); font-size: 13px; font-style: italic; padding: 8px 0; }

/* ---------- sidebar ---------- */
.game-sidebar { display: flex; flex-direction: column; gap: 18px; }
.standings li.current-turn { background: rgba(232, 192, 125, .1); border-radius: 9px; padding-left: 8px; padding-right: 8px; }
.standings .score { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--rust-dark); margin-left: auto; }
.standings .streak { color: var(--sage); font-size: 11px; white-space: nowrap; }
.tiny-crown { color: var(--gold-deep); }
.rules-mini p { font-size: 13px; line-height: 1.65; color: var(--muted); margin: 0 0 8px; }
.rules-mini em { color: var(--rust-dark); }

/* ---------- finish ---------- */
.finish-card {
  max-width: 620px; margin: 20px auto; text-align: center;
  background: linear-gradient(155deg, var(--paper) 0%, var(--paper-2) 100%);
  color: var(--ink); border-radius: 24px; padding: 46px 40px 36px;
  box-shadow: var(--shadow); border: 1px solid rgba(255, 246, 224, .55);
  position: relative;
}
.finish-card::before { content: ""; position: absolute; inset: 9px; border: 1px solid rgba(122, 91, 66, .18); border-radius: 17px; pointer-events: none; }
.finish-ribbon { font-size: 42px; color: var(--rust); }
.finish-card .eyebrow { margin-top: 14px; }
.finish-card h1 { font-size: clamp(32px, 4vw, 48px); }
.winner-line { font-family: var(--display); font-size: 22px; color: var(--rust-dark); margin: 18px 0 26px; }
.podium { text-align: left; margin-bottom: 26px; }
.podium li { display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-bottom: 1px dashed rgba(109, 78, 58, .22); }
.podium li:last-child { border-bottom: none; }
.podium .rank { font-family: var(--display); font-size: 20px; color: var(--gold-deep); width: 28px; }
.podium .score { margin-left: auto; font-family: var(--display); font-weight: 700; }
.finish-actions { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; position: relative; }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(16px);
  z-index: 50; max-width: min(460px, calc(100vw - 32px));
  background: var(--plum-3); color: var(--paper); border: 1px solid rgba(232, 192, 125, .4);
  border-radius: 12px; padding: 13px 18px; font-size: 14px; text-align: center;
  box-shadow: 0 16px 38px rgba(0,0,0,.45); animation: toast-in .25s ease forwards;
}
@keyframes toast-in { to { transform: translateX(-50%) translateY(0); } }
.toast.good { border-color: rgba(129, 144, 108, .7); }
.toast.bad { border-color: rgba(173, 82, 71, .8); }

/* ---------- dialog ---------- */
.rules-dialog {
  max-width: 560px; width: calc(100% - 32px);
  background: linear-gradient(155deg, var(--paper), var(--paper-2));
  color: var(--ink); border: 1px solid rgba(255, 246, 224, .6);
  border-radius: 20px; padding: 34px 36px; box-shadow: var(--shadow);
}
.rules-dialog::backdrop { background: rgba(20, 14, 20, .72); backdrop-filter: blur(3px); }
.rules-dialog h2 { font-size: 30px; margin-bottom: 18px; }
.dialog-close { position: absolute; top: 14px; right: 16px; background: none; border: none; font-size: 26px; cursor: pointer; color: var(--muted); }
.rules-list { padding-left: 22px; line-height: 1.75; font-size: 14px; }
.rules-list li { margin-bottom: 10px; }
.unlock-dialog { max-width: 480px; }
.unlock-dialog h2 { font-size: 28px; margin-bottom: 12px; }
.unlock-lede { font-size: 14px; line-height: 1.7; color: var(--muted); margin: 0 0 22px; }
.price-options { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 18px; }
.price-options .btn { flex: 1; min-width: 160px; font-family: var(--display); font-size: 16px; padding: 15px; }

/* ---------- responsive ---------- */
@media (max-width: 940px) {
  .hero { grid-template-columns: 1fr; }
  .hero-art { display: none; }
  .lobby-grid, .game-layout { grid-template-columns: 1fr; }
  .game-sidebar { flex-direction: row; }
  .game-sidebar .panel { flex: 1; }
}
@media (max-width: 700px) {
  .site-header, .screen { padding-left: 18px; padding-right: 18px; }
  .brand-text small { display: none; }
  .icon-btn .label { display: none; }
  .mode-grid { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .game-sidebar { flex-direction: column; }
  .alphabet { grid-template-columns: repeat(9, minmax(0, 1fr)); }
  .lobby-head { align-items: flex-start; }
  .share-panel { flex-direction: column; align-items: flex-start; }
  .room-code { font-size: 42px; }
  #answerForm { flex-wrap: wrap; }
  #answerForm .btn { width: 100%; }
  .finish-card { padding: 36px 22px 28px; }
  .hero { padding-top: 6px; }
}
@media (max-width: 420px) {
  .alphabet { grid-template-columns: repeat(7, minmax(0, 1fr)); }
  .header-actions { gap: 5px; }
  .icon-btn { padding: 8px 11px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
