:root {
  color-scheme: light;
  --paper: #f7f5ef;
  --panel: #fffef9;
  --ink: #202018;
  --muted: #626056;
  --line: #dedbd1;
  --violet: #542be5;
  --violet-dark: #4220bb;
  --lime: #e4f580;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  font: 16px/1.45 Inter, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--violet); outline-offset: 4px; }
h1, h2, p { margin: 0; }
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
.top { border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top, 0); }
.top-inner { display: flex; justify-content: space-between; align-items: center; min-height: 72px; gap: 12px; }
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 900; letter-spacing: -.05em; font-size: 1.2rem; text-decoration: none; }
.mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--violet); color: white; font-size: 1.35rem; }
.top-status { color: var(--muted); font: 600 .78rem var(--mono); text-transform: uppercase; }
#game { padding-block: 42px max(52px, env(safe-area-inset-bottom, 0px)); }
.hero { display: grid; grid-template-columns: 1.04fr 1fr; gap: 42px; align-items: center; min-height: 490px; }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--muted); font: 600 .73rem var(--mono); letter-spacing: .055em; }
.eyebrow > span { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); }
.hero h1 { font-size: clamp(4.1rem, 9.7vw, 8rem); line-height: .9; letter-spacing: -.06em; font-weight: 900; margin: .22em 0 .25em; }
.hero h1 em { color: var(--violet); font-style: normal; }
.hero h1 em span { color: var(--ink); }
.lead { font-size: clamp(1rem, 2vw, 1.2rem); color: var(--muted); max-width: 34ch; }
.create-form { margin-top: 26px; max-width: 320px; }
.field { display: grid; gap: 7px; font-weight: 700; font-size: .86rem; }
.field input, .field select, .invite input { min-width: 0; width: 100%; min-height: 48px; padding: 10px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 10px; background: var(--panel); }
.field input::placeholder { color: #777469; font-weight: 400; }
.primary, .secondary { display: inline-flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 46px; border-radius: 10px; padding: 9px 15px; font-weight: 800; text-decoration: none; }
.primary { color: #fff; background: var(--violet); border: 1px solid var(--violet); }
.primary:not(:disabled):hover { background: var(--violet-dark); border-color: var(--violet-dark); }
.primary:disabled { opacity: .58; }
.primary span { font-size: 1.28em; }
.secondary { color: var(--ink); background: var(--panel); border: 1px solid var(--line); }
.secondary:hover { border-color: var(--ink); }
.create-form .primary { margin-top: 10px; width: 100%; min-height: 50px; }
.block { margin-top: 18px; width: 100%; }
.art { position: relative; isolation: isolate; width: 100%; aspect-ratio: 1.14; border-radius: 28px; overflow: hidden; background-color: var(--lime); background-image: radial-gradient(#66732840 1px, transparent 1px); background-size: 17px 17px; }
.art-card { position: absolute; width: 42%; aspect-ratio: .85; padding: 3%; border: 1.5px solid var(--ink); border-radius: clamp(9px, 2vw, 17px); box-shadow: 5px 7px 0 #22231a; background: var(--panel); }
.art-back { top: 15%; left: 47%; transform: rotate(15deg); }
.art-photo { top: 15%; left: 16%; transform: rotate(-14deg); }
.art-card .tile { width: 100%; aspect-ratio: 1; border-radius: 9px; }
.art-caption { display: flex; flex-direction: column; justify-content: center; width: 39%; aspect-ratio: 1.35; left: 39%; top: 50%; transform: rotate(-8deg); background: #e8dcff; color: var(--ink); font-size: clamp(.83rem, 2.1vw, 1.5rem); font-weight: 900; line-height: 1.14; letter-spacing: -.04em; }
.art-caption span { font-size: 2.2em; line-height: .6; color: var(--violet); }
.art-spark { position: absolute; color: var(--violet); right: 7%; bottom: 11%; font-size: clamp(2rem, 6vw, 4.5rem); line-height: 1; }
.art-spark.small { top: 7%; left: 10%; bottom: auto; right: auto; font-size: clamp(1.3rem, 3.8vw, 2.7rem); }
.how { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; border-top: 1px solid var(--line); margin-top: 28px; padding-top: 24px; }
.how > div { display: flex; gap: 12px; align-items: flex-start; }
.how p { color: var(--muted); margin-top: 2px; font-size: .85rem; }
.how-icon { flex: 0 0 39px; height: 39px; display: grid; place-items: center; border-radius: 10px; font-weight: 800; }
.purple { background: #e8dcff; color: #4725bc; }
.lime { background: var(--lime); }
.peach { background: #ffdec9; }
.page-heading { margin: 6px 0 28px; }
.page-heading h1 { font-size: clamp(2.1rem, 6vw, 4.9rem); letter-spacing: -.055em; font-weight: 900; line-height: 1; margin-block: 12px; }
.page-heading h1 > span { color: var(--violet); }
.page-heading .lead { max-width: 54ch; }
.page-heading .primary { margin-top: 12px; }
.lobby-grid { display: grid; grid-template-columns: 1.1fr 1fr; gap: 18px; align-items: start; }
.panel { padding: clamp(16px, 3vw, 28px); background: var(--panel); border: 1px solid var(--line); border-radius: 17px; min-width: 0; }
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.panel h2 { font-size: 1.25rem; letter-spacing: -.045em; }
.panel h2 + form { margin-top: 16px; }
.count { color: var(--violet); background: #eee7ff; border-radius: 7px; padding: 4px 9px; font: 600 .82rem var(--mono); white-space: nowrap; }
.players { list-style: none; margin: 13px 0 0; padding: 0; }
.players li { display: flex; align-items: center; gap: 9px; min-height: 46px; padding: 5px 0; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; font-size: .92rem; }
.players small, .muted { color: var(--muted); }
.muted { margin-top: 10px; font-size: .92rem; }
.board-panel > .muted:first-child { margin-top: 0; }
.avatar { flex: 0 0 30px; height: 30px; display: grid; place-items: center; background: var(--lime); border-radius: 9px; font-weight: 800; }
.role { margin-left: auto; color: var(--muted); font: 500 .72rem var(--mono); }
.bot-controls { margin-top: 15px; }
.bot-controls .muted { margin-top: 8px; }
.invite { display: flex; gap: 7px; margin-top: 15px; }
.invite input { flex: 1; font: 500 .75rem var(--mono); }
.invite .secondary { font-size: .83rem; padding-inline: 10px; }
.settings { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.board { display: grid; align-items: start; gap: 18px; }
.board.with-setup { grid-template-columns: minmax(160px, 250px) 1fr; }
.setup-preview { background: #efeadf; padding: 14px; border-radius: 14px; min-width: 0; }
.setup-preview .eyebrow, .board-panel > .eyebrow { margin-bottom: 9px; }
.setup-preview .card { min-height: 110px; }
.setup-preview .card.image { padding: 0; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 140px), 1fr)); gap: 10px; }
.card { display: block; position: relative; width: 100%; min-width: 0; max-width: 270px; min-height: 130px; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; text-align: left; background: #f4efff; color: var(--ink); padding: 0; }
button.card:not(:disabled):hover { border-color: var(--violet); }
.card.selected { border-color: var(--violet); box-shadow: 0 0 0 2px var(--violet); }
.card.image { background: #dfdfd5; }
.tile { aspect-ratio: 1; height: auto; background-color: #dfdfd5; background-image: url('/cards.webp'); background-repeat: no-repeat; background-size: 400% 400%; background-position: calc(var(--x) * 100% / 3) calc(var(--y) * 100% / 3); }
.card-text { display: block; padding: 15px; font-weight: 800; letter-spacing: -.035em; line-height: 1.22; font-size: clamp(.98rem, 2vw, 1.2rem); overflow-wrap: anywhere; }
.quote { display: block; font: 800 2.6rem/.7 Inter, sans-serif; color: var(--violet); padding-top: 8px; }
.picked { position: absolute; top: 8px; right: 8px; display: none; place-items: center; color: #fff; background: var(--violet); width: 24px; height: 24px; border-radius: 50%; }
.card.selected .picked { display: grid; }
.confirm, .winner-card + .secondary, .progress + .secondary { margin-top: 15px; }
.progress { font-weight: 800; }
.winner-card { border: 2px solid var(--violet); }
.notice { display: none; position: fixed; z-index: 2; inset: auto 16px max(16px, env(safe-area-inset-bottom, 0px)); margin-inline: auto; width: fit-content; max-width: calc(100% - 32px); border-radius: 9px; padding: 10px 14px; color: white; background: var(--ink); font-size: .88rem; }
.notice.visible { display: block; }
.loading { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 730px) {
  .wrap { width: calc(100% - 36px); }
  .top-inner { min-height: 58px; }
  #game { padding-top: 26px; }
  .hero { grid-template-columns: 1fr; gap: 21px; min-height: 0; }
  .hero h1 { font-size: clamp(3.7rem, 14vw, 6rem); }
  .art { max-width: 470px; aspect-ratio: 1.48; }
  .art-card { width: 35%; }
  .art-photo { left: 20%; }
  .art-caption { width: 34%; aspect-ratio: 1.55; top: 53%; }
  .how { grid-template-columns: 1fr; gap: 12px; margin-top: 22px; padding-top: 16px; }
  .lobby-grid, .board.with-setup { grid-template-columns: 1fr; }
  .setup-preview .card { max-width: 235px; min-height: 0; }
  .setup-preview .image { max-width: 136px; }
}

@media (max-width: 390px) {
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-text { padding: 11px; }
  .settings { grid-template-columns: 1fr; }
}
