:root {
  --ink: #1d1b2f;
  --paper: #ffffff;
  --bg: #ffd23f;
  --bg-dot: #f5c21b;
  --pink: #ff4d6d;
  --orange: #ff9f1c;
  --yellow: #ffe45e;
  --teal: #2ec4b6;
  --blue: #3a86ff;
  --purple: #8338ec;
  --muted: #5d5a73;
  --line: 3px solid var(--ink);
  --shadow: 5px 5px 0 var(--ink);
  --shadow-sm: 3px 3px 0 var(--ink);
  --radius: 18px;
  --head: 'Lilita One', 'Arial Rounded MT Bold', system-ui, sans-serif;
  --body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  font-family: var(--body);
  font-weight: 700;
  color: var(--ink);
  background-color: var(--bg);
  background-image: radial-gradient(var(--bg-dot) 2px, transparent 2.5px);
  background-size: 26px 26px;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--head); font-weight: 400; letter-spacing: 0.01em; margin: 0; line-height: 1.1; }
p { margin: 0; }

#app { max-width: 1100px; margin: 0 auto; padding: max(14px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom)); }
.screen { display: flex; flex-direction: column; gap: 16px; animation: screen-in 0.35s ease-out; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.center { align-items: center; justify-content: center; text-align: center; min-height: 70dvh; }
.center-text { text-align: center; }

.label { font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 900; color: var(--muted); }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.big-emoji { font-size: 3.4rem; line-height: 1; }

/* ── cards & buttons ── */
.card { background: var(--paper); border: var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.card-title { font-size: 1.4rem; margin-bottom: 12px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-head .card-title { margin-bottom: 12px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
  background: var(--paper); padding: 12px 20px; font-weight: 900; font-size: 1.05rem;
  text-decoration: none; transition: transform 0.08s, box-shadow 0.08s, filter 0.15s; min-height: 48px;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
}
.btn:hover:not(:disabled) { filter: brightness(1.05); transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active:not(:disabled) { transform: translate(3px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn:focus-visible, .chip:focus-visible, .swatch:focus-visible, .size:focus-visible, .tool:focus-visible, .art-card:focus-visible, .toggle:focus-visible, .rule-chip:focus-visible {
  outline: 3px solid var(--blue); outline-offset: 3px;
}
.btn-xl { font-family: var(--head); font-weight: 400; font-size: 1.5rem; padding: 14px 28px; min-height: 60px; border-radius: 18px; box-shadow: var(--shadow); letter-spacing: 0.02em; }
.btn-small { padding: 8px 14px; font-size: 0.95rem; min-height: 40px; }
.btn-pink { background: var(--pink); color: #fff; }
.btn-blue { background: var(--blue); color: #fff; }
.btn-teal { background: var(--teal); }
.btn-yellow { background: var(--yellow); }
.btn-ghost { background: rgba(255, 255, 255, 0.7); }
.btn-icon { width: 44px; height: 44px; min-height: 44px; padding: 0; font-size: 1.5rem; border-radius: 12px; }

.input {
  width: 100%; border: var(--line); border-radius: 14px; padding: 12px 14px; font-size: 1.15rem; font-weight: 800;
  background: #fffdf3; outline: none; min-height: 52px;
}
.input:focus { box-shadow: 0 0 0 4px rgba(58, 134, 255, 0.35); }
.label[for] { display: block; margin-bottom: 8px; }

.tag { font-size: 0.72rem; font-weight: 900; text-transform: uppercase; letter-spacing: 0.06em; padding: 2px 8px; border-radius: 99px; border: 2px solid var(--ink); background: var(--yellow); }
.tag-host { background: var(--orange); }
.tag-off { background: #ddd; }

/* ── home ── */
.home { max-width: 520px; margin: 0 auto; gap: 18px; }
.hero { text-align: center; padding: 18px 0 4px; }
.logo { display: flex; flex-direction: column; align-items: center; font-family: var(--head); line-height: 0.9; }
.logo-line { display: flex; font-size: clamp(3rem, 15vw, 5.2rem); color: var(--pink); -webkit-text-stroke: 3px var(--ink); paint-order: stroke fill; text-shadow: 5px 5px 0 var(--ink); }
.logo-2 { color: var(--blue); font-size: clamp(3.4rem, 18vw, 6.2rem); }
.logo-line span { display: inline-block; animation: letter-in 0.6s cubic-bezier(.2, 1.6, .5, 1) both; }
.logo-line span:nth-child(odd) { transform: rotate(-4deg); }
.logo-line span:nth-child(even) { transform: rotate(3deg) translateY(4px); }
@keyframes letter-in { from { opacity: 0; transform: translateY(-40px) rotate(-20deg) scale(0.5); } }
.tagline { margin-top: 14px; font-size: 1.08rem; font-weight: 800; }
.create-wrap { display: flex; flex-direction: column; align-items: stretch; gap: 8px; text-align: center; }
.join-row { display: flex; gap: 10px; }
.code-input { text-transform: uppercase; letter-spacing: 0.3em; font-family: var(--head); font-size: 1.5rem; text-align: center; }
.join-card.invited { border-color: var(--pink); box-shadow: 5px 5px 0 var(--pink); }
.invite-note { margin-bottom: 10px; font-size: 1.05rem; }
.form-error { color: #c1121f; font-weight: 900; text-align: center; min-height: 1.3em; }
.how { text-align: center; }
.how h2 { font-size: 1.3rem; margin-bottom: 10px; }
.steps { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.steps li { display: flex; align-items: center; gap: 12px; background: rgba(255, 255, 255, 0.65); border: 2px solid var(--ink); border-radius: 14px; padding: 10px 14px; text-align: left; }
.step-emoji { font-size: 1.6rem; }

/* ── lobby ── */
.lobby { max-width: 760px; margin: 0 auto; }
.code-card { text-align: center; background: var(--paper); }
.room-code { display: flex; justify-content: center; gap: 10px; margin: 8px 0 14px; }
.room-code span {
  font-family: var(--head); font-size: clamp(2.6rem, 14vw, 4.4rem); width: 1.35em; height: 1.45em; display: grid; place-items: center;
  background: var(--yellow); border: var(--line); border-radius: 14px; box-shadow: var(--shadow-sm);
}
.room-code span:nth-child(2n) { background: #c7f0ec; transform: rotate(2deg); }
.room-code span:nth-child(3n) { background: #ffd6de; transform: rotate(-3deg); }
.code-actions { display: flex; justify-content: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.count-pill { font-family: var(--head); font-size: 1.1rem; background: var(--teal); border: 2px solid var(--ink); border-radius: 99px; padding: 2px 12px; margin-bottom: 12px; }
.player-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.player { display: flex; align-items: center; gap: 10px; border: 2px solid var(--ink); border-radius: 14px; padding: 8px 10px; background: #fffdf3; animation: pop 0.35s cubic-bezier(.2, 1.6, .5, 1); min-width: 0; }
.player.is-you { background: #e8f1ff; }
.player.offline { opacity: 0.55; }
.player.empty { border-style: dashed; background: transparent; color: var(--muted); animation: none; }
.player-name { font-weight: 900; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { width: 38px; height: 38px; flex: none; display: grid; place-items: center; font-size: 1.4rem; border-radius: 50%; background: var(--yellow); border: 2px solid var(--ink); }
.kick { border: 2px solid var(--ink); background: #fff; border-radius: 50%; width: 30px; height: 30px; font-size: 0.8rem; flex: none; }
.kick:hover { background: var(--pink); color: #fff; }
.settings { display: grid; gap: 14px; }
.setting { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.setting-label { font-weight: 900; font-size: 1.05rem; }
.setting-val { font-family: var(--head); font-size: 1.3rem; }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper-val { font-family: var(--head); font-size: 1.6rem; min-width: 1.6em; text-align: center; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 2px solid var(--ink); border-radius: 99px; padding: 6px 12px; background: #fff; font-weight: 900; min-height: 38px; }
.chip.on { background: var(--blue); color: #fff; box-shadow: 2px 2px 0 var(--ink); }
.toggle { width: 64px; height: 36px; border-radius: 99px; border: var(--line); background: #ddd; position: relative; padding: 0; transition: background 0.2s; }
.toggle span { position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid var(--ink); transition: transform 0.2s; }
.toggle.on { background: var(--teal); }
.toggle.on span { transform: translateX(28px); }
.lobby-footer, .results-footer { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 4px 0 10px; text-align: center; }
.btn-start { width: min(100%, 420px); }
.waiting { font-size: 1.15rem; font-weight: 900; display: flex; align-items: center; gap: 10px; background: rgba(255, 255, 255, 0.75); border: 2px solid var(--ink); border-radius: 14px; padding: 12px 18px; }
.dots { width: 34px; height: 10px; background: radial-gradient(circle, var(--ink) 4px, transparent 5px) 0 0 / 12px 10px repeat-x; animation: dots 1s steps(3) infinite; }
@keyframes dots { from { width: 10px; } to { width: 40px; } }

/* ── intro ── */
.intro { align-items: center; text-align: center; min-height: 80dvh; justify-content: center; gap: 18px; }
.round-label { font-family: var(--head); font-size: 1.5rem; background: var(--ink); color: #fff; padding: 6px 18px; border-radius: 99px; }
.theme-card { background: var(--paper); border: var(--line); border-radius: 22px; box-shadow: 7px 7px 0 var(--ink); padding: 22px 26px; max-width: 640px; transform: rotate(-1.5deg); }
.theme-text { font-size: clamp(2rem, 8vw, 3.4rem); margin-top: 6px; color: var(--purple); }
.with { font-family: var(--head); font-size: 1.4rem; }
.rule-card { display: flex; align-items: center; gap: 14px; text-align: left; background: var(--pink); color: #fff; border: var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 16px 20px; max-width: 560px; transform: rotate(1.5deg); }
.rule-card .rule-emoji { font-size: 3rem; line-height: 1; filter: drop-shadow(2px 2px 0 var(--ink)); }
.rule-card .rule-text { display: flex; flex-direction: column; gap: 4px; }
.rule-card strong { font-family: var(--head); font-weight: 400; font-size: 1.8rem; }
.rule-card span span { font-size: 1.05rem; }
.reveal-1 { animation: slam 0.6s cubic-bezier(.2, 1.5, .5, 1) 0.2s both; }
.reveal-2 { animation: fade 0.4s ease 1.3s both; }
.reveal-3 { animation: slam 0.6s cubic-bezier(.2, 1.5, .5, 1) 1.6s both; }
@keyframes slam { from { opacity: 0; transform: scale(2.2) rotate(8deg); } }
@keyframes fade { from { opacity: 0; } }
.countdown { font-family: var(--head); font-size: clamp(4rem, 22vw, 8rem); color: var(--paper); -webkit-text-stroke: 4px var(--ink); paint-order: stroke fill; text-shadow: 6px 6px 0 var(--ink); min-height: 1.1em; }
.bump { animation: bump 0.9s ease-out; }
@keyframes bump { from { transform: scale(2); opacity: 0; } 30% { transform: scale(1); opacity: 1; } }
.pop { animation: pop 0.5s cubic-bezier(.2, 1.6, .5, 1) both; }
@keyframes pop { from { transform: scale(0.6); opacity: 0; } }

/* ── rule chip & timer ── */
.rule-chip { display: inline-flex; align-items: center; gap: 6px; border: 2px solid var(--ink); border-radius: 99px; background: var(--pink); color: #fff; padding: 5px 12px 5px 8px; font-weight: 900; box-shadow: 2px 2px 0 var(--ink); white-space: nowrap; min-height: 38px; }
.rule-chip .rule-emoji { font-size: 1.2rem; }
.timer { display: inline-flex; align-items: center; gap: 6px; font-family: var(--head); font-size: 1.6rem; background: var(--paper); border: var(--line); border-radius: 14px; padding: 4px 14px; box-shadow: var(--shadow-sm); min-width: 88px; justify-content: center; font-variant-numeric: tabular-nums; }
.timer-icon { font-size: 1.1rem; }
.timer.urgent { background: var(--pink); color: #fff; }
.timer.pulse { animation: pulse 0.5s ease-out; }
@keyframes pulse { 40% { transform: scale(1.18); } }

/* ── drawing ── */
#app:has(.draw) { max-width: none; padding-top: max(8px, env(safe-area-inset-top)); padding-bottom: max(8px, env(safe-area-inset-bottom)); }
.draw { height: calc(100dvh - max(16px, env(safe-area-inset-top) + env(safe-area-inset-bottom))); gap: 8px; max-width: 900px; margin: 0 auto; animation: none; }
.draw-head { display: flex; align-items: center; gap: 10px; background: var(--paper); border: var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 8px 10px; }
.draw-theme { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.draw-theme strong { font-family: var(--head); font-weight: 400; font-size: clamp(1.05rem, 3.6vw, 1.5rem); line-height: 1.1; color: var(--purple); }
.draw-head .label { font-size: 0.68rem; }
.stage { flex: 1; min-height: 0; position: relative; container-type: size; display: grid; place-items: center; }
.pad-frame { width: min(100cqw, 100cqh); height: min(100cqw, 100cqh); border: var(--line); border-radius: 12px; box-shadow: var(--shadow); background: #fff; overflow: hidden; }
.pad { position: relative; width: 100%; height: 100%; transition: transform 0.6s cubic-bezier(.3, 1.4, .5, 1); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.pad canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.pad-overlay { cursor: crosshair; }
.draw.chaos .pad-frame { animation: shake 0.4s ease-in-out 2; }
@keyframes shake { 25% { transform: rotate(-2deg); } 75% { transform: rotate(2deg); } }
.chaos-banner { position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 3; background: var(--purple); color: #fff; border: var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 8px 14px; display: flex; flex-direction: column; align-items: center; text-align: center; pointer-events: none; animation: slam 0.5s cubic-bezier(.2, 1.5, .5, 1); max-width: 90%; }
.chaos-banner strong { font-family: var(--head); font-weight: 400; font-size: 1.3rem; }
.chaos-banner span { font-size: 0.9rem; }
.lock-overlay { position: absolute; inset: 0; z-index: 4; display: grid; place-items: center; background: rgba(29, 27, 47, 0.35); border-radius: 12px; animation: fade 0.3s; }
.lock-card { background: var(--paper); border: var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 20px 24px; text-align: center; max-width: 88%; display: flex; flex-direction: column; gap: 6px; animation: pop 0.4s cubic-bezier(.2, 1.6, .5, 1); }
.lock-card h2 { font-size: 2rem; }

.toolbar { background: var(--paper); border: var(--line); border-radius: 16px; box-shadow: var(--shadow-sm); padding: 8px; display: flex; flex-direction: column; gap: 8px; }
.palette { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.swatch { width: 36px; height: 36px; border-radius: 50%; border: 3px solid var(--ink); background: var(--c); padding: 0; transition: transform 0.1s; flex: none; }
.swatch.eraser { background: #fff; background-image: linear-gradient(45deg, transparent 45%, var(--pink) 45%, var(--pink) 55%, transparent 55%); }
.swatch.on { transform: scale(1.18); box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
.tool-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: center; }
.sizes { display: flex; gap: 4px; }
.size { width: 42px; height: 42px; border: 2px solid var(--ink); border-radius: 12px; background: #fff; display: grid; place-items: center; padding: 0; }
.size i { display: block; border-radius: 50%; background: var(--ink); }
.size.on { background: var(--yellow); box-shadow: 2px 2px 0 var(--ink); }
.tool { border: 2px solid var(--ink); border-radius: 12px; background: #fff; padding: 0 12px; height: 42px; font-weight: 900; white-space: nowrap; }
.tool:disabled { opacity: 0.4; cursor: not-allowed; }
.giant-note, .line-note { font-weight: 900; padding: 0 6px; }
.ink-meter { display: flex; align-items: center; gap: 8px; min-width: 150px; flex: 1; max-width: 260px; }
.ink-bar { flex: 1; height: 18px; border: 2px solid var(--ink); border-radius: 99px; overflow: hidden; background: #eee; }
.ink-bar i { display: block; height: 100%; background: var(--blue); transition: width 0.15s linear; }
.ink-meter.low .ink-bar i { background: var(--pink); animation: blink 0.6s infinite alternate; }
@keyframes blink { to { opacity: 0.5; } }
.btn-done { min-height: 42px; padding: 6px 14px; margin-left: auto; }

@media (max-width: 560px) {
  .draw-head { flex-wrap: wrap; }
  .draw-theme { flex-basis: calc(100% - 110px); }
  .draw-head .rule-chip { order: 3; }
  .swatch { width: 32px; height: 32px; }
  .size { width: 38px; height: 38px; }
  .tool { height: 38px; padding: 0 9px; }
  .btn-done { margin-left: 0; }
}
@media (min-width: 900px) and (min-aspect-ratio: 4/3) {
  .draw { display: grid; grid-template-columns: 1fr 200px; grid-template-rows: auto 1fr; max-width: 1200px; }
  .draw-head { grid-column: 1 / -1; }
  .toolbar { align-self: center; }
  .palette { display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center; }
  .tool-row { flex-direction: column; align-items: stretch; }
  .sizes { justify-content: center; }
  .tool-row .tool, .btn-done { width: 100%; margin: 0; }
  .ink-meter { max-width: none; }
}

/* ── galleries ── */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-title { font-size: clamp(1.6rem, 6vw, 2.5rem); color: var(--ink); }
.head-right { display: flex; gap: 10px; align-items: center; }
.vote-status { background: rgba(255, 255, 255, 0.8); border: 2px solid var(--ink); border-radius: 14px; padding: 10px 14px; font-size: 1.05rem; }
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(46%, 240px), 1fr)); gap: 14px; }
.art-card { position: relative; display: block; width: 100%; padding: 0; border: var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); overflow: hidden; transition: transform 0.12s; animation: pop 0.4s cubic-bezier(.2, 1.6, .5, 1) both; text-align: left; }
.gallery .art-card:nth-child(2) { animation-delay: 0.05s; }
.gallery .art-card:nth-child(3) { animation-delay: 0.1s; }
.gallery .art-card:nth-child(4) { animation-delay: 0.15s; }
.gallery .art-card:nth-child(5) { animation-delay: 0.2s; }
.gallery .art-card:nth-child(n+6) { animation-delay: 0.25s; }
.art-card:hover { transform: rotate(-1deg) scale(1.02); }
.drawing-img { display: block; width: 100%; aspect-ratio: 1; object-fit: contain; background: #fff; }
.drawing-img.broken { background: repeating-linear-gradient(45deg, #eee 0 10px, #fff 10px 20px); }
.art-num { position: absolute; top: 8px; left: 8px; font-family: var(--head); font-size: 1.2rem; background: var(--yellow); border: 2px solid var(--ink); border-radius: 10px; padding: 0 8px; }
.art-tag { position: absolute; top: 8px; right: 8px; font-weight: 900; font-size: 0.8rem; border: 2px solid var(--ink); border-radius: 99px; padding: 2px 10px; background: var(--teal); }
.art-tag.voted { display: none; background: var(--pink); color: #fff; }
.art-card.is-voted { outline: 5px solid var(--pink); outline-offset: -2px; }
.art-card.is-voted .art-tag.voted { display: block; }
.art-card.is-voted .art-tag.mine { display: none; }
.has-voted .art-card:not(.is-voted) { opacity: 0.75; }
.art-blank { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-6deg); font-family: var(--head); color: var(--muted); font-size: 1.1rem; white-space: nowrap; }
.voter-strip { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.voter { display: inline-flex; align-items: center; gap: 6px; background: rgba(255, 255, 255, 0.7); border: 2px solid var(--ink); border-radius: 99px; padding: 3px 10px 3px 3px; font-size: 0.9rem; }
.voter .avatar { width: 28px; height: 28px; font-size: 1rem; }
.voter.done { background: #c7f0ec; }
.voter.offline { opacity: 0.5; }
.voter b { color: #0a7d71; }

.headline { font-family: var(--head); font-size: clamp(1.4rem, 5vw, 2.2rem); text-align: center; background: var(--paper); border: var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 14px 18px; }
.art-card.result { display: flex; flex-direction: column; }
.art-card.winner { border-color: var(--orange); box-shadow: 0 0 0 4px var(--orange), var(--shadow); transform: rotate(-1deg); }
.art-card.is-mine .art-artist::after { content: ' (you)'; color: var(--muted); }
.crown { position: absolute; top: 6px; right: 8px; font-size: 2.2rem; filter: drop-shadow(2px 2px 0 var(--ink)); animation: pop 0.6s cubic-bezier(.2, 1.6, .5, 1) 0.4s both; }
.art-caption { display: flex; flex-direction: column; gap: 2px; border-top: var(--line); padding: 8px 10px; }
.art-artist { font-weight: 900; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-votes { color: #c07600; font-weight: 900; }
.results-gallery .art-card.winner { grid-row: span 1; }

.score-card { max-width: 560px; width: 100%; margin: 0 auto; }
.scoreboard { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.scoreboard li { display: flex; align-items: center; gap: 10px; border: 2px solid var(--ink); border-radius: 14px; padding: 6px 12px 6px 6px; background: #fffdf3; }
.scoreboard li:first-child { background: #fff1c2; }
.scoreboard li.is-you { outline: 3px solid var(--blue); }
.rank { font-family: var(--head); width: 28px; text-align: center; font-size: 1.2rem; }
.sb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 900; }
.sb-score { font-family: var(--head); font-size: 1.4rem; }
.delta { font-weight: 900; color: #0a7d71; background: #c7f0ec; border-radius: 99px; padding: 0 8px; animation: pop 0.5s cubic-bezier(.2, 1.6, .5, 1) 0.6s both; }

.final { gap: 18px; }
.champion { text-align: center; font-size: clamp(2rem, 8vw, 3.4rem); color: var(--pink); -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill; text-shadow: 4px 4px 0 var(--ink); }
.trophy { text-align: center; font-size: 5rem; animation: bob 2s ease-in-out infinite; }
@keyframes bob { 50% { transform: translateY(-10px) rotate(4deg); } }
.section-title { font-size: 1.8rem; text-align: center; margin-top: 8px; }
.round-block { background: rgba(255, 255, 255, 0.55); border: 2px solid var(--ink); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.round-block-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.round-block-head h3 { font-size: 1.3rem; }
.small-gallery { grid-template-columns: repeat(auto-fill, minmax(min(45%, 170px), 1fr)); }
.final-art { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.final-art figcaption { font-weight: 900; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.final-art figcaption small { color: var(--muted); }
.final-art .crown { font-size: 1.6rem; }

/* ── modal, toasts, banner ── */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; background: rgba(29, 27, 47, 0.6); display: grid; place-items: center; padding: 16px; animation: fade 0.2s; }
.modal-card { position: relative; background: var(--paper); border: var(--line); border-radius: 22px; box-shadow: 7px 7px 0 var(--ink); padding: 16px; width: min(100%, 640px); max-height: calc(100dvh - 32px); overflow: auto; animation: pop 0.3s cubic-bezier(.2, 1.5, .5, 1); }
.modal-x { position: absolute; top: 10px; right: 10px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: var(--line); background: var(--yellow); font-weight: 900; }
.zoom { display: flex; flex-direction: column; align-items: center; gap: 12px; text-align: center; }
.zoom .drawing-img { width: min(100%, calc(100dvh - 210px)); border: var(--line); border-radius: 14px; }
.zoom-caption { font-family: var(--head); font-size: 1.3rem; }
.self-note, .voted-note { font-weight: 900; font-size: 1.15rem; padding: 10px 16px; border-radius: 14px; border: 2px solid var(--ink); background: var(--yellow); }
.voted-note { background: #c7f0ec; }

.toasts { position: fixed; left: 50%; bottom: max(16px, env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { background: var(--paper); border: var(--line); border-radius: 14px; box-shadow: var(--shadow-sm); padding: 10px 16px; font-weight: 900; text-align: center; animation: toast-in 0.35s cubic-bezier(.2, 1.6, .5, 1); transition: opacity 0.35s, transform 0.35s; }
.toast-good { background: #c7f0ec; }
.toast-warn { background: #ffe8c2; }
.toast-error { background: var(--pink); color: #fff; }
.toast.out { opacity: 0; transform: translateY(10px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(20px) scale(0.9); } }
.conn-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 70; background: var(--ink); color: #fff; text-align: center; padding: max(8px, env(safe-area-inset-top)) 12px 8px; font-weight: 900; display: flex; align-items: center; justify-content: center; gap: 10px; }

.spinner, .spinner-sm { border-radius: 50%; border: 5px solid rgba(29, 27, 47, 0.2); border-top-color: var(--pink); animation: spin 0.8s linear infinite; }
.spinner { width: 54px; height: 54px; }
.spinner-sm { width: 18px; height: 18px; border-width: 3px; border-color: rgba(255, 255, 255, 0.3); border-top-color: #fff; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-help { display: flex; flex-direction: column; gap: 10px; align-items: center; }

.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 10px; height: 16px; border: 1.5px solid var(--ink); border-radius: 2px; animation-name: fall; animation-timing-function: cubic-bezier(.3, .6, .6, 1); animation-fill-mode: forwards; }
@keyframes fall { to { top: 110vh; transform: rotate(720deg) translateX(60px); } }
.noscript { text-align: center; padding: 40px; font-size: 1.2rem; }

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

.player-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.player-info .player-name { flex: none; }
.player-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.player-tags:empty { display: none; }
.player.empty .avatar { font-family: var(--head); color: var(--muted); background: transparent; border-style: dashed; }
.has-voted .art-card:not(.is-voted) { opacity: 1; }
.has-voted .art-card:not(.is-voted) .drawing-img { opacity: 0.55; filter: grayscale(0.4); }
.practice-btn { margin-top: 12px; }
.rule-picker { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 6px; scrollbar-width: thin; }
.rule-picker .chip { white-space: nowrap; flex: none; }
.practice .draw-theme .small { font-weight: 700; color: var(--muted); }
@media (min-width: 900px) and (min-aspect-ratio: 4/3) {
  .practice { grid-template-rows: auto auto 1fr; }
  .practice .rule-picker { grid-column: 1 / -1; flex-wrap: wrap; }
}
@media (max-width: 560px) {
  .palette { gap: 5px; flex-wrap: nowrap; }
  .swatch { width: 31px; height: 31px; border-width: 2.5px; }
  .swatch.on { transform: scale(1.12); box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--ink); }
}
.seo-fallback { max-width: 560px; margin: 12vh auto 0; text-align: center; display: grid; gap: 12px; }
.seo-fallback h1 { font-size: 3rem; color: var(--pink); }
.setting-label { display: flex; flex-direction: column; }
.setting-hint { font-size: 0.8rem; color: var(--muted); font-weight: 700; }
.toggle.on.spicy { background: var(--pink); }
