:root {
  color-scheme: light;
  --ink: #302044;
  --muted: #615371;
  --paper: #fffaf3;
  --white: #fffefd;
  --line: #ded3e8;
  --purple: #6037a6;
  --lilac: #eadaff;
  --mint: #dff3e5;
  --peach: #ffe5d9;
  --yellow: #ffe092;
  font: 500 1rem/1.5 system-ui, sans-serif;
  color: var(--ink);
  background: #f0eaf7;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; }
.app {
  width: min(100%, 34rem);
  min-height: 100vh;
  margin: auto;
  background: var(--paper);
  border-inline: 1px solid var(--line);
}
.brand {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 4.5rem;
  padding: .8rem clamp(1rem, 5vw, 2rem);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 1.22rem;
  font-weight: 850;
  letter-spacing: -.035em;
}
.brand-mark {
  display: block;
  flex: 0 0 auto;
}
main { padding: 1.6rem clamp(1rem, 5vw, 2rem) 2rem; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(2rem, 7vw, 3rem); line-height: 1.05; letter-spacing: -.055em; font-weight: 850; }
h2 { font-size: 1.1rem; line-height: 1.3; letter-spacing: -.02em; }
p { color: var(--muted); }
h1 + p { margin-top: .6rem; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
:focus-visible { outline: 3px solid #8056c8; outline-offset: 3px; }
.primary, .secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 3rem;
  padding: .6rem 1rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--white);
  color: var(--ink);
  font-weight: 750;
}
.primary { border-color: var(--purple); background: var(--purple); color: white; }
.back {
  min-height: 2.75rem;
  padding: .25rem 0;
  border: 0;
  color: var(--purple);
  background: transparent;
  font-weight: 740;
}
.back + h1 { margin-top: .45rem; }
.stack { display: grid; gap: 1rem; margin-top: 1.5rem; }
.home-actions { gap: .65rem; margin-top: 1.65rem; }
.field { display: grid; gap: .35rem; font-weight: 720; }
input, select {
  width: 100%;
  min-width: 0;
  min-height: 3rem;
  padding: .55rem .8rem;
  border: 1px solid #baacca;
  border-radius: .72rem;
  background: var(--white);
  color: var(--ink);
}
#join-code { text-transform: uppercase; letter-spacing: .08em; }
#join-code::placeholder { text-transform: none; letter-spacing: normal; }
fieldset { padding: 0; margin: 0; min-width: 0; border: 0; }
legend { margin-bottom: .45rem; padding: 0; font-weight: 750; }
.mode-list { display: grid; gap: .45rem; }
.mode {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-width: 0;
  padding: .6rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--white);
}
label.mode { cursor: pointer; }
label.mode:has(input:checked) { border-color: var(--purple); background: #f6efff; }
.mode input { width: 1.1rem; min-height: auto; margin: 0 0 0 auto; flex-shrink: 0; accent-color: var(--purple); }
.mode-symbol, .avatar {
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  flex: 0 0 2.15rem;
  border-radius: .55rem;
  font-weight: 800;
}
.symbol-peach { background: var(--peach); }
.symbol-mint { background: var(--mint); }
.symbol-lilac { background: var(--lilac); }
.symbol-yellow { background: var(--yellow); }
.mode-name { display: block; font-size: .95rem; line-height: 1.25; }
.mode-description { display: block; color: var(--muted); font-size: .81rem; line-height: 1.3; margin-top: .12rem; }
.ticket {
  margin-top: 1rem;
  padding: .8rem 1rem 1rem;
  border: 1px solid #aa83e6;
  border-radius: 1rem;
  background: var(--lilac);
  text-align: center;
}
.eyebrow { color: #50317f; font-size: .7rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
#room-code { display: block; margin: .1rem 0 .45rem; font-size: clamp(2.15rem, 12vw, 3rem); line-height: 1; font-weight: 900; letter-spacing: .11em; }
#invite-url { min-height: 2.5rem; padding: .35rem; background: transparent; border-color: transparent; text-align: center; }
.share-buttons { display: flex; flex-wrap: wrap; justify-content: center; gap: .45rem; }
.share-buttons button { min-height: 2.75rem; padding-inline: .65rem; font-size: .875rem; }
.notice, .error { margin-top: .4rem; font-size: .85rem; overflow-wrap: anywhere; }
.error { color: #962e32; }
.lobby-group { margin-top: 1rem; }
.lobby-group h2 { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; margin-bottom: .45rem; }
.count, .player-tag { color: var(--muted); font-size: .8rem; font-weight: 680; }
.players { display: grid; gap: .35rem; padding: 0; margin: 0; list-style: none; }
.players li { display: flex; align-items: center; gap: .55rem; padding: .32rem .55rem; border: 1px solid var(--line); border-radius: .65rem; background: var(--white); }
.avatar { width: 1.8rem; height: 1.8rem; flex-basis: 1.8rem; font-size: .8rem; }
.player-name { font-weight: 730; overflow-wrap: anywhere; }
.player-tag { margin-left: auto; white-space: nowrap; }
summary { display: list-item; cursor: pointer; padding-block: .65rem; color: var(--purple); font-weight: 750; }
.lobby-footer { margin-top: 1rem; padding-top: .6rem; border-top: 1px solid var(--line); }
.lobby-footer p { font-size: .83rem; }
dialog { width: min(calc(100% - 2rem), 26rem); padding: 1.2rem; border: 1px solid var(--line); border-radius: 1rem; color: var(--ink); background: var(--paper); }
dialog::backdrop { background: #30204485; }
dialog p { margin-top: .55rem; }
.dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; margin-top: 1.1rem; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.wide { width: 100%; }
.lobby-footer .wide { margin-top: .55rem; }
.round-panel { display: grid; gap: .8rem; }
.round-prompt, .round-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .65rem;
}
.round-prompt {
  padding: .8rem 1rem;
  background: var(--lilac);
  border-radius: 1rem;
}
.round-prompt h1, .round-heading h1 { font-size: clamp(1.65rem, 7vw, 2.75rem); overflow-wrap: anywhere; }
.timer {
  flex: 0 0 auto;
  min-width: 3.5rem;
  padding: .42rem .55rem;
  border-radius: .7rem;
  background: var(--white);
  color: var(--purple);
  text-align: center;
  font-variant-numeric: tabular-nums;
}
.round-heading .timer { background: var(--lilac); }
.drawing-paper {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: .9rem;
  background: radial-gradient(#e2d8ee 1px, transparent 1px) 0 0 / 15px 15px, var(--white);
}
.drawing-paper canvas {
  position: relative;
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1;
  touch-action: none;
  cursor: crosshair;
}
.drawing-paper .starter-layer { position: absolute; inset: 0; pointer-events: none; }
.plot-base { position: absolute; inset: 0; display: block; width: 100%; height: auto; pointer-events: none; }
.plot-brush-tools, .plot-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .45rem; }
.plot-choices button { min-height: 3rem; padding: .45rem; font-size: .9rem; }
.plot-reveal, #plot-reveal-content { display: grid; gap: .65rem; }
.plot-reveal-nav { display: flex; justify-content: space-between; align-items: center; gap: .45rem; }
.plot-drawing .round-prompt h1 { font-size: clamp(1.38rem, 5vw, 2rem); line-height: 1.12; }
#lobby-plot-setting { margin-top: .55rem; }
@media (orientation: landscape) and (min-width: 620px) {
  .app:has(.plot-drawing:not([hidden])) { width: min(100%, 61rem); }
  .plot-drawing { grid-template-columns: minmax(0, 1fr) minmax(15rem, .65fr); align-items: start; }
  .plot-drawing .drawing-paper { grid-column: 1; grid-row: 1 / span 6; width: min(100%, 72vh); justify-self: center; }
  .plot-drawing > :not(.drawing-paper) { grid-column: 2; }
}
.guess-paper canvas { cursor: default; touch-action: auto; }
.guess-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: .5rem; }
.guess-controls { display: grid; gap: .55rem; }
.guess-countdown {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 2.65rem;
  gap: .55rem;
  align-items: center;
  color: var(--purple);
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.guess-countdown progress {
  width: 100%;
  height: .65rem;
  appearance: none;
  border: 0;
  border-radius: 1rem;
  overflow: hidden;
  background: var(--lilac);
}
.guess-countdown progress::-webkit-progress-bar { background: var(--lilac); border-radius: 1rem; }
.guess-countdown progress::-webkit-progress-value { background: var(--purple); border-radius: 1rem; }
.guess-countdown progress::-moz-progress-bar { background: var(--purple); border-radius: 1rem; }
.scoreboard-note { margin-top: .4rem; }
.luck-playing .brand { display: none; }
.luck-playing main { padding: .45rem .65rem; }
.luck-playing main > .notice { margin-bottom: .2rem; }
.luck-draw { display: grid; gap: .25rem; }
.luck-heading, .luck-board-label { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.luck-heading h1 { font-size: clamp(1.35rem, 5vw, 2.15rem); }
.luck-stage { padding: .3rem .6rem; border-radius: .6rem; background: var(--yellow); color: var(--ink); text-align: center; white-space: nowrap; }
.luck-draw.is-drawing .luck-stage { background: var(--mint); }
.luck-play-boards {
  --luck-size: min(100%, max(90px, calc((100vh - 162px) / 2)));
  --luck-size: min(100%, max(90px, calc((100svh - 162px) / 2)));
  display: grid;
  justify-items: center;
  gap: .2rem;
}
.luck-board { width: var(--luck-size); }
.luck-board-label { font-size: .8rem; font-weight: 750; padding: .15rem .1rem; line-height: 1.25; }
.luck-clock { min-width: 2.2rem; text-align: right; color: var(--purple); font-variant-numeric: tabular-nums; }
.luck-sheet { display: block; width: 100%; height: auto; aspect-ratio: 1; background: white; border: 1px solid var(--line); border-radius: .6rem; }
#luck-canvas { touch-action: none; cursor: crosshair; }
.luck-draw-tools, .luck-categories { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
.luck-draw-tools button { min-height: 44px; padding: .35rem; font-size: .85rem; }
.luck-vote-layout, .luck-vote-side, .luck-awards { display: grid; gap: .6rem; }
.luck-original-panel { display: grid; gap: .4rem; justify-items: start; }
.luck-original-panel .luck-sheet { width: min(100%, 14rem); }
.luck-sketches, .luck-award-winners { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .5rem; }
.luck-sketches button { display: grid; gap: .3rem; min-width: 0; padding: .25rem; }
.luck-sketches button[aria-pressed="true"], .luck-categories button[aria-pressed="true"] { background: var(--lilac); outline: 2px solid var(--purple); outline-offset: -2px; }
.luck-sketches button:disabled { cursor: default; }
.luck-award { min-width: 0; border-radius: .75rem; padding: .65rem; background: var(--lilac); overflow-wrap: anywhere; }
.luck-award:nth-child(2) { background: var(--peach); }
.luck-award-names { display: grid; gap: .5rem; margin-top: .5rem; }
.luck-award figure { margin: 0; }
.luck-award figcaption { font-size: .83rem; font-weight: 700; padding-block: .2rem; }
#lobby-plot-setting { margin-top: .55rem; }
.party-switch {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .75rem;
  min-height: 3rem;
  padding: .6rem .75rem;
  border: 1px solid var(--line);
  border-radius: .75rem;
  background: var(--white);
  font-weight: 750;
  cursor: pointer;
}
.party-switch small { display: block; color: var(--muted); font-weight: 500; }
.party-switch input { position: absolute; width: 1px; height: 1px; min-height: 0; opacity: 0; }
.party-track {
  display: inline-flex;
  align-items: center;
  width: 2.75rem;
  height: 1.55rem;
  padding: .2rem;
  flex-shrink: 0;
  border-radius: 1rem;
  background: #756984;
}
.party-track::before { content: ''; width: 1.12rem; height: 1.12rem; border-radius: 50%; background: white; }
.party-switch input:checked + .party-track { justify-content: flex-end; background: var(--purple); }
.party-switch input:focus-visible + .party-track { outline: 3px solid var(--purple); outline-offset: 3px; }
.party-switch input:disabled + .party-track { opacity: .6; }
#lobby-party-setting { margin: .5rem 0; }
@media (orientation: landscape) and (max-height: 580px) and (min-width: 520px) {
  .luck-playing .app { width: min(100%, 62rem); }
  .luck-play-boards {
    --luck-size: min(100%, calc(100vh - 145px));
    --luck-size: min(100%, calc(100svh - 145px));
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .5rem;
  }
}
@media (min-width: 760px) {
  .luck-showcase .app { width: min(100%, 72rem); }
  .luck-vote-layout { grid-template-columns: minmax(11rem, 1fr) 3fr; align-items: start; }
  .luck-original-panel { position: sticky; top: .6rem; }
  .luck-original-panel .luck-sheet { width: 100%; }
  .luck-sketches { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .luck-award-names { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.answer-reveal { padding: .75rem 1rem; border-radius: .85rem; background: var(--mint); }
.answer-reveal strong { display: block; font-size: 1.4rem; }
.drawing-tools { display: flex; gap: .35rem; }
.drawing-tools button { flex: 1; padding-inline: .3rem; }
.drawing-tools button[aria-pressed="true"] { background: var(--lilac); border-color: #aa83e6; }
.round-note { font-size: .85rem; text-align: center; }
.gallery { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
.sketch-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: .3rem;
  align-items: center;
  min-width: 0;
  padding: .4rem;
  border: 1px solid var(--line);
  border-radius: .8rem;
  background: var(--white);
  color: var(--ink);
  font-size: .82rem;
  font-weight: 720;
  cursor: pointer;
}
.sketch-card canvas { grid-column: 1 / -1; width: 100%; height: auto; aspect-ratio: 1; }
.sketch-card input { width: 1rem; min-height: auto; padding: 0; margin: .2rem; accent-color: var(--purple); }
.sketch-card:has(input:checked) { background: var(--mint); border-color: #397449; }
.sketch-card:has(input:disabled) { cursor: default; }
.winner { padding: .9rem 1rem; background: var(--yellow); border-radius: 1rem; }
.winner strong { display: block; margin: .2rem 0; font-size: clamp(1.45rem, 6vw, 2.2rem); line-height: 1.07; overflow-wrap: anywhere; }
.notice { margin-bottom: .55rem; }

.luck-sketches figure { margin: 0; min-width: 0; }
.luck-sketches figcaption { font-size: .82rem; padding: .25rem 0; overflow-wrap: anywhere; }
@media (max-width: 759px) {
  #luck-vote .luck-original-panel {
    grid-template-columns: auto 1fr;
    align-items: start;
  }
  #luck-vote .luck-original-panel .luck-sheet { width: min(31vw, 9rem); }
  #luck-vote .luck-sketches { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  #luck-vote .luck-sketches button { font-size: .76rem; }
  #luck-vote .luck-categories {
    position: sticky;
    top: 0;
    z-index: 1;
    padding-block: .25rem;
    background: var(--paper);
  }
}

/* Homepage illustration and game guide */
.hero-art {
  position: relative;
  isolation: isolate;
  display: grid;
  justify-items: center;
  gap: .55rem;
  overflow: hidden;
  margin: 0 0 1.45rem;
  padding: .65rem .5rem 1.05rem;
  border-radius: 1.15rem;
  background: radial-gradient(ellipse at 48% 42%, #f4eaff 10%, var(--lilac) 70%);
}
.hero-art::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  opacity: .35;
  background: radial-gradient(circle, #a987d1 1px, transparent 1.5px) 0 0 / 16px 16px;
  mask-image: linear-gradient(to right, #000, transparent 27%, transparent 73%, #000);
}
.hero-prompt {
  font-size: clamp(.9rem, 3vw, 1.02rem);
  line-height: 1.25;
  font-weight: 820;
  padding: .2rem .65rem .25rem;
  border: 1px solid #d7b36c;
  border-radius: 100px;
  background: var(--yellow);
}
.hero-sketches {
  display: flex;
  justify-content: center;
  align-items: center;
  width: min(100%, 26rem);
  gap: .2rem;
  padding-inline: .55rem;
}
.hero-sketch {
  display: grid;
  place-items: center;
  width: min(30%, 8.3rem);
  aspect-ratio: 1;
  padding: .4rem;
  border: 1px solid #8f76ac;
  border-radius: .65rem;
  background: #fffdfa;
  box-shadow: 2px 3px 0 #bba3d5;
  transform: translateY(.18rem) rotate(-9deg);
}
.hero-sketch:nth-child(2) { z-index: 1; transform: rotate(4deg); border-color: #be7895; }
.hero-sketch:nth-child(3) { transform: translateY(.22rem) rotate(10deg); }
.hero-sketch svg { display: block; width: 100%; height: auto; }
.explore-link {
  justify-self: center;
  min-height: 2.75rem;
  padding: .5rem .6rem;
  color: var(--purple);
  font-weight: 750;
  text-underline-offset: .18em;
}
.explore-link span { display: inline-block; margin-left: .2rem; }

.games-app { width: min(100%, 59rem); }
.games-app .brand a { display: inline-flex; align-items: center; gap: inherit; color: inherit; text-decoration: none; }
.guide-back { display: inline-block; margin-bottom: .85rem; color: var(--purple); font-size: .9rem; font-weight: 700; }
.game-guide-grid { display: grid; gap: .9rem; margin-top: 1.2rem; }
.game-guide-card { --guide-bg: var(--lilac); min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: .95rem; background: var(--white); }
.guide-mint { --guide-bg: var(--mint); }
.guide-peach { --guide-bg: var(--peach); }
.guide-yellow { --guide-bg: #fff0c1; }
.guide-art {
  display: flex;
  justify-content: center;
  align-items: start;
  gap: clamp(.55rem, 4vw, 1.3rem);
  padding: .8rem .35rem .65rem;
  background: var(--guide-bg);
}
.guide-example { display: grid; justify-items: center; gap: .3rem; width: min(43%, 8rem); }
.guide-example > span { text-align: center; font-size: .76rem; font-weight: 750; line-height: 1.22; }
.guide-paper {
  display: grid;
  place-items: center;
  width: min(100%, 5.95rem);
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: .52rem;
  background: var(--white);
}
.guide-paper svg, .guide-paper img { display: block; width: 100%; height: auto; }
.guide-scene { position: relative; width: 100%; }
.guide-scene svg { position: absolute; inset: 0; }
.guide-guess { padding: .02rem .3rem; border: 1px solid var(--line); border-radius: .22rem; font-size: .75rem; font-weight: 750; }
.game-guide-copy { padding: .7rem .85rem .9rem; }
.game-guide-copy h2 { font-size: 1.23rem; }
.game-guide-copy p { margin-top: .2rem; font-size: .9rem; line-height: 1.43; }
.guide-mix { margin: 1.2rem 0 .8rem; }
.guide-host { text-decoration: none; }
@media (min-width: 630px) { .game-guide-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 890px) { .game-guide-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

