:root {
  color-scheme: light;
  --ink: #261a40;
  --muted: #665875;
  --paper: #fff5de;
  --white: #fffdf7;
  --coral: #ff8069;
  --ice: #c5b7fd;
  --sun: #ffdc75;
  --mint: #d0f2ce;
  --line: 2px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  font-family: ui-rounded, "Trebuchet MS", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .55; box-shadow: none; }
:focus-visible { outline: 3px solid #5233a1; outline-offset: 4px; }
[hidden] { display: none !important; }
p { margin: .55rem 0 0; line-height: 1.5; overflow-wrap: anywhere; }
h1, h2 { margin: 0; line-height: 1.04; letter-spacing: -.04em; overflow-wrap: anywhere; }
h1 { font-size: clamp(2.6rem, 7vw, 4.65rem); font-weight: 900; }
h2 { font-size: clamp(1.45rem, 3vw, 1.9rem); font-weight: 850; }
ul { list-style: none; padding: 0; margin: 0; }

.shell { max-width: 1160px; padding: 0 clamp(1rem, 4vw, 3rem) 4rem; margin: auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; gap: .7rem; min-height: 96px; border-bottom: var(--line); }
.wordmark { display: flex; align-items: center; gap: .65rem; font-weight: 900; font-size: clamp(1.02rem, 3vw, 1.38rem); letter-spacing: -.04em; }
.wordmark img { width: 42px; height: 42px; }
.room-status { font-size: .88rem; font-weight: 800; text-align: right; }
main { padding-top: clamp(1.75rem, 5vw, 3.85rem); }

.home-grid, .room-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, .8fr); gap: clamp(1.25rem, 4vw, 3rem); align-items: start; }
.home-grid { align-items: center; }
.hero { min-height: 530px; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; background: var(--sun); border: var(--line); box-shadow: var(--shadow); border-radius: 32px; padding: clamp(1.4rem, 4vw, 3rem); }
.hero h1 { font-size: clamp(3rem, 7.4vw, 5.7rem); line-height: .92; letter-spacing: -.075em; }
.hero h1 span { color: #983527; }
.hero p { max-width: 34ch; font-size: 1.15rem; margin-top: 1rem; }
.hero-art { width: 100%; min-height: 210px; position: relative; margin-bottom: 1rem; user-select: none; }
.art-back, .art-front { position: absolute; width: 124px; height: 156px; border: 3px solid var(--ink); border-radius: 20px; left: calc(50% - 62px); top: 22px; box-shadow: 4px 4px 0 var(--ink); }
.art-back { background: repeating-linear-gradient(45deg, #ff8b76, #ff8b76 9px, #ffa18b 9px, #ffa18b 18px); transform: translateX(-36px) rotate(-19deg); }
.art-front { background: #e5dcff; transform: translateX(23px) rotate(14deg); display: grid; place-items: center; }
.art-front img { width: 82px; }
.spark { position: absolute; color: var(--ink); line-height: 1; }
.spark-one { left: calc(50% - 126px); top: 24px; font-size: 2.1rem; }
.spark-two { right: calc(50% - 125px); top: 18px; font-size: 2rem; }
.spark-three { right: calc(50% - 118px); top: 145px; font-size: 1.45rem; }

.panel { background: var(--white); border: var(--line); border-radius: 24px; padding: clamp(1.15rem, 3vw, 2rem); box-shadow: var(--shadow); }
.entry { padding: clamp(1.15rem, 4vw, 2.45rem); }
.entry h2 { margin: 1.55rem 0 1.3rem; }
.segmented { display: flex; gap: .2rem; border: var(--line); padding: .25rem; border-radius: 14px; background: var(--paper); }
.segmented button { flex: 1; padding: .6rem .4rem; color: var(--ink); font-size: .91rem; font-weight: 800; background: none; border: 0; border-radius: 9px; }
.segmented button[aria-pressed="true"] { color: var(--white); background: var(--ink); }
form { display: grid; gap: 1rem; }
label { display: grid; gap: .4rem; font-size: .91rem; font-weight: 800; }
input:not([type="checkbox"]), select { width: 100%; min-width: 0; min-height: 49px; padding: .7rem .8rem; border: var(--line); border-radius: 11px; color: var(--ink); background: white; font-size: 1rem; }
.code-input { text-transform: uppercase; letter-spacing: .16em; }
.button { min-height: 44px; padding: .58rem .94rem; border: var(--line); border-radius: 11px; color: var(--ink); font-weight: 850; box-shadow: 2px 2px 0 var(--ink); }
.button:not(:disabled):hover { filter: brightness(.95); }
.button:not(:disabled):active { transform: translate(2px, 2px); box-shadow: none; }
.primary { background: var(--coral); }
.secondary { background: var(--white); }
.correct-button { background: var(--mint); }
.entry .primary { min-height: 51px; margin-top: .3rem; }

.screen-title, .table-heading { margin-bottom: 1.55rem; }
.table-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.table-heading .button { flex-shrink: 0; }
.eyebrow { display: block; font-size: .86rem; line-height: 1.35; letter-spacing: .08em; text-transform: uppercase; font-weight: 850; }
.section-title { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.badge { flex-shrink: 0; border: var(--line); background: var(--ice); border-radius: 99px; padding: .2rem .62rem; font-size: .88rem; font-weight: 850; }
.roster { display: grid; gap: .63rem; margin-top: 1.1rem; }
.seat { padding: .7rem .8rem; background: var(--paper); border: 1px solid #e6d8b9; border-radius: 12px; }
.seat.target { background: #eee7ff; border-color: #9e87e4; }
.seat-line { display: flex; align-items: center; gap: .55rem; }
.seat-main { min-width: 0; margin-right: auto; overflow-wrap: anywhere; }
.seat-meta { display: block; font-size: .85rem; color: var(--muted); }
.seat-meta:empty { display: none; }
.remove { width: 36px; height: 36px; flex: 0 0 auto; padding: 0; border: 1px solid transparent; background: transparent; border-radius: 7px; color: var(--ink); font-size: 1.35rem; line-height: 1; }
.remove:hover { background: #ffd9cd; border-color: var(--ink); }
.score { font-size: 1.32rem; white-space: nowrap; }
.score small { font-size: .83rem; }
progress { display: block; width: 100%; height: 8px; margin-top: .65rem; appearance: none; border: 0; border-radius: 12px; accent-color: #6247a3; background: #e1d6c5; overflow: hidden; }
progress::-webkit-progress-bar { border-radius: 12px; background: #e1d6c5; }
progress::-webkit-progress-value { background: #6247a3; }
progress::-moz-progress-bar { background: #6247a3; }

.invite { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; border-top: 1px dashed var(--muted); padding-top: 1rem; margin-top: 1.2rem; }
.invite strong { letter-spacing: .15em; }
.invite .button { margin-left: auto; }
.settings { margin-top: 1.1rem; }
.settings input[type="number"] { max-width: 9rem; }
.settings details { border: 1px solid #aa99bc; border-radius: 11px; padding: .65rem .7rem; }
summary { font-weight: 800; cursor: pointer; }
.category-options { display: grid; gap: .35rem; margin-top: .55rem; max-height: 250px; overflow: auto; }
.check { display: flex; align-items: center; gap: .45rem; min-height: 30px; }
.check input { width: 19px; height: 19px; accent-color: #6247a3; }
.start-game { margin-top: 1.25rem; }
.start-game .button, .settings .button { width: 100%; }
.helper { color: var(--muted); font-size: .92rem; }

.game-grid, .final-grid { grid-template-columns: minmax(0, 1fr) minmax(230px, .55fr); }
.card-back { min-height: 330px; display: grid; align-content: center; text-align: center; justify-items: center; padding: 1.5rem; border: var(--line); box-shadow: var(--shadow); border-radius: 26px; background: repeating-linear-gradient(135deg, #d8cdff, #d8cdff 13px, #e4dbff 13px, #e4dbff 26px); }
.card-back div { font-size: 5rem; line-height: 1; margin-bottom: .85rem; }
.question { background: var(--sun); }
.question h2 { margin-top: 1rem; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.06; }
.point-badge { background: var(--white); }
.choices { display: grid; gap: .55rem; padding-left: 1.65rem; list-style-type: upper-alpha; font-weight: 750; }
.choices li { padding-left: .25rem; }
.private-answer, .reveal { border: var(--line); background: var(--ice); padding: .8rem 1rem; border-radius: 13px; margin-top: 1rem; overflow-wrap: anywhere; }
.private-answer strong { display: block; font-size: 1.3rem; }
.private-answer p { margin-top: .35rem; }
.reveal { background: var(--white); }
.reveal.correct { background: var(--mint); }
.reveal p { font-size: 1.25rem; margin-top: .2rem; }
.mark-actions { display: flex; gap: .65rem; margin-top: .95rem; }
.mark-actions button { flex: 1; }
.turn-hint { margin-top: 1.1rem; color: var(--muted); }
.card-list { display: grid; gap: .65rem; margin-top: 1rem; }
.card-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .8rem; align-items: start; padding: .85rem; background: var(--paper); border: 1px solid #e6d8b9; border-radius: 13px; overflow-wrap: anywhere; }
.card-list strong { display: block; margin-top: .2rem; }
.card-list p { margin: .3rem 0 0; }
.card-list small { color: var(--muted); }
.card-actions { display: grid; gap: .45rem; }
.scoreboard .roster { margin-top: .85rem; }
.victory { background: var(--sun); }
.victory img { display: block; margin-bottom: 1rem; }
.victory .button, .waiting .button { margin-top: 1rem; }
.waiting { max-width: 600px; margin: auto; }
.notice { position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%); max-width: min(94vw, 34rem); width: max-content; padding: .72rem 1rem; border: var(--line); border-radius: 12px; box-shadow: 3px 3px 0 var(--ink); background: var(--white); font-weight: 800; z-index: 1; }

@media (max-width: 760px) {
  .site-header { min-height: 70px; }
  .home-grid, .room-grid { grid-template-columns: 1fr; }
  .hero { min-height: auto; }
  .hero-art { min-height: 170px; }
  .art-front, .art-back { width: 102px; height: 126px; left: calc(50% - 51px); top: 14px; }
  .art-front img { width: 70px; }
  .spark-three { top: 110px; }
  .card-back { min-height: 260px; }
}

@media (max-width: 400px) {
  .hero h1 { font-size: clamp(2.45rem, 13vw, 3.25rem); }
  .table-heading { align-items: flex-start; flex-direction: column; }
  .card-list li { grid-template-columns: 1fr; }
  .card-actions { display: flex; }
  .invite .button { margin-left: 0; }
}
.settings label + label, .settings label + details { margin-top: .8rem; }
.room-footer { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .6rem; margin-top: 1.4rem; }
