@font-face {
  font-family: Nunito;
  src: url('/assets/nunito.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}
:root {
  color-scheme: light;
  --background: #faf9f4;
  --paper: #fffef9;
  --ink: #26342a;
  --muted: #5e685b;
  --line: #e2e4d8;
  --olive: #344b3a;
  --lime: #e3eeaf;
  --orange: #a9422d;
  --confetti-0: #dba346;
  --confetti-1: #a9c67a;
  --confetti-2: #bd7258;
  --confetti-3: #97acc2;
  font: 16px/1.45 Nunito, ui-rounded, system-ui, sans-serif;
  color: var(--ink);
  background: var(--background);
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
button, input { font: inherit; color: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .57; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { line-height: 1.12; font-weight: 800; }
:focus-visible { outline: 3px solid #bd7327; outline-offset: 3px; }
img { display: block; max-width: 100%; }
.shell { width: min(1140px, calc(100% - 72px)); margin-inline: auto; }
.masthead { border-bottom: 1px solid var(--line); background: var(--paper); }
.masthead-inner { min-height: 54px; display: flex; align-items: center; gap: 10px; padding-block: 5px; }
#header-actions { flex: 0 0 auto; margin-inline-start: auto; }
.button {
  min-height: 44px; display: inline-flex; align-items: center; justify-content: center;
  gap: 8px; padding: 8px 14px; border: 1px solid #daddd0; border-radius: 11px;
  background: var(--paper); font-size: 15px; font-weight: 800; text-align: center;
  transition: background 150ms, border-color 150ms, transform 150ms;
}
.button:not(:disabled):hover { background: #edf0e6; border-color: #c9d0c1; }
.button:not(:disabled):active { transform: translateY(1px); }
.button svg { flex-shrink: 0; }
.button.primary, .button.signed-in { background: var(--olive); border-color: var(--olive); color: #fff; }
.button.primary:not(:disabled):hover, .button.signed-in:hover { background: #273c2d; border-color: #273c2d; }
.header-button { min-height: 39px; padding: 6px 12px; }
.stage, .participant { padding-bottom: 42px; }
.room-tabs { display: flex; flex: 0 1 auto; min-width: 0; gap: 3px; overflow-x: auto; padding: 3px; border: 1px solid var(--line); border-radius: 11px; background: #f0f1e9; scrollbar-width: thin; }
.room-tabs a { padding: 6px 11px; border: 1px solid transparent; border-radius: 8px; flex: none; font-size: 14px; font-weight: 800; color: var(--muted); max-width: 18rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.room-tabs a:hover { background: #e8ecdf; color: var(--ink); }
.room-tabs a[aria-current] { background: var(--paper); border-color: #e1e5da; color: var(--olive); box-shadow: 0 1px 2px #26342a0e; }
.stage-heading, .participant-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin-bottom: 18px; }
.stage-heading h1, .participant-heading h1 { font-size: clamp(36px, 5.6vw, 62px); line-height: 1; letter-spacing: -.066em; overflow-wrap: anywhere; }
.stage-heading { justify-content: flex-start; align-items: center; gap: 7px; margin-block: 13px 14px; }
.participant-title { display: flex; align-items: center; gap: 7px; }
.icon-button.stage-reset { flex: 0 0 44px; width: 44px; height: 44px; border-color: transparent; background: transparent; color: var(--muted); }
.icon-button.stage-reset:hover, .icon-button.stage-reset.reset-ready { border-color: #daddd0; background: #edf0e6; color: var(--ink); }
.control-actions, .dialog-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.stage-layout { display: grid; grid-template-columns: minmax(0, 1fr) 244px; gap: 13px; }
.spotlight {
  min-height: 254px; position: relative; isolation: isolate; display: flex; align-items: center;
  border-radius: 20px; overflow: hidden; padding: 26px 31px;
  background: radial-gradient(ellipse at 90% 2%, #55704d 0%, transparent 62%), #314738;
  color: #fdfdf3;
}
.spotlight-content { z-index: 1; position: relative; width: 63%; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; border-radius: 999px; padding: 5px 10px; background: #ffffff18; color: #f2f5dd; font-size: 14px; font-weight: 800; }
.status-pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); }
.spotlight h2 { margin: 8px 0; font-size: clamp(31px, 4.4vw, 57px); letter-spacing: -.06em; overflow-wrap: anywhere; }
.spotlight p { color: #ebefdd; }
.button.spotlight-button { background: var(--lime); color: #263c2e; border-color: var(--lime); margin-top: 18px; }
.button.spotlight-button:not(:disabled):hover { background: #f1f8cb; border-color: #f1f8cb; }
.picker-actions { display: flex; align-items: center; gap: 8px; margin-top: 18px; }
.picker-actions .spotlight-button { margin-top: 0; }
.button.undo-pick { width: 44px; flex: 0 0 44px; padding: 0; }
.spotlight .undo-pick { background: transparent; color: inherit; border-color: #ffffff65; }
.spotlight .undo-pick:not(:disabled):hover { background: #ffffff1f; border-color: #fff; }
.stage-decoration { position: absolute; inset: 0 1.3% 0 auto; width: 44%; overflow: hidden; pointer-events: none; }
.stage-disc { position: absolute; top: 0%; right: 10%; width: 79%; aspect-ratio: 1; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 12px, #a4b79a66 13px 14px); border: 1px solid #b1c4a56b; }
.stage-keys {
  position: absolute;
  top: 50%;
  right: 15%;
  width: 68%;
  aspect-ratio: 2;
  overflow: hidden;
  transform: translateY(-50%) rotate(-12deg);
  border: clamp(2px, .35vw, 4px) solid #283e2f;
  border-radius: 11px;
  box-shadow: 0 12px 25px #182a2060;
  background:
    repeating-linear-gradient(90deg, transparent 0 calc(12.5% - 1px), #8b9987 calc(12.5% - 1px) 12.5%),
    linear-gradient(#fffef0 0%, #eef1d8 92%, #d3dcc2 92%);
}
.stage-keys i {
  position: absolute;
  top: 0;
  left: calc(var(--after-key) * 12.5%);
  width: 7.5%;
  height: 62%;
  transform: translateX(-50%);
  border-radius: 0 0 4px 4px;
  background: linear-gradient(90deg, #223529, #354d3c 78%, #25392b);
  box-shadow: 1px 2px 2px #182a2050;
}
.stage-spark { position: absolute; right: 4%; top: 12%; color: #e8edab; font-size: 35px; }
.small-spark { top: auto; right: 72%; bottom: 11%; font-size: 32px; }
.spotlight-art { position: absolute; width: 34%; right: 4%; top: 50%; transform: translateY(-50%) rotate(-3deg); border: 5px solid #fffef5; border-radius: 15px; overflow: hidden; box-shadow: 0 10px 27px #1b2c2466; }
.spotlight-art .art { aspect-ratio: 5 / 4; }
.spotlight-art:has(.art-sticker) { width: min(29%, 188px); }
.spotlight-art .art-sticker { aspect-ratio: 1; }
.join-card { display: grid; grid-template-columns: minmax(0, 1fr); gap: 9px; place-items: center; align-content: center; border-radius: 20px; border: 1px solid var(--line); background: var(--paper); padding: 13px; color: var(--olive); font-size: 23px; font-weight: 800; line-height: 1.15; }
.join-card img { width: min(100%, 184px); height: auto; border: 1px solid var(--line); border-radius: 11px; background: #fff; }
.join-card:hover { border-color: #a4ae99; background: #f4f6ed; }
.results + .join-card { align-self: start; }
.control-bar { min-height: 64px; display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.round-status { color: var(--muted); font-size: 15px; font-weight: 750; }
.dot-divider { margin-inline: 8px; }
.button.reveal-button { background: #f9e9de; border-color: #eacabb; color: #873826; }
.button.reveal-button:not(:disabled):hover { background: #f6ded0; border-color: #e3b7a5; }
.lineup { margin-top: 20px; }
.section-heading { display: flex; gap: 9px; justify-content: space-between; align-items: baseline; margin-bottom: 10px; }
.section-heading h2 { font-size: 24px; letter-spacing: -.035em; }
.section-heading > span { color: var(--muted); font-size: 14px; font-weight: 750; }
.lineup-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 146px), 1fr)); gap: 10px; }
.project { min-width: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--paper); }
.project-current { border-color: #758961; box-shadow: 0 0 0 1px #758961; }
.project-picture { position: relative; }
.project-picture .art { width: 100%; aspect-ratio: 1; }
.project-label { padding: 10px 11px 11px; }
.project-label h3 { font-size: 16px; overflow-wrap: anywhere; }
.project-label p { font-size: 14px; color: var(--muted); margin-top: 4px; overflow-wrap: anywhere; }
.project-tag { position: absolute; left: 6px; top: 6px; display: inline-flex; align-items: center; gap: 3px; background: var(--paper); border-radius: 999px; padding: 3px 7px; font-size: 12px; font-weight: 800; }
.project-tag svg { width: 13px; height: 13px; }
.current-tag { color: #fff; background: var(--olive); }
.art { position: relative; overflow: hidden; isolation: isolate; background: var(--art-bg); min-height: 1px; }
.art img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.art.art-sticker img { object-fit: contain; padding: 5px; }
.theme-0 { --art-bg: #dce4ed; --art-dark: #57708f; --art-light: #eff4f9; --art-accent: #e1ab6a; }
.theme-1 { --art-bg: #e5dcf0; --art-dark: #755b86; --art-light: #f4eafb; --art-accent: #f4bd8f; }
.theme-2 { --art-bg: #e1e9d5; --art-dark: #54735d; --art-light: #eef4df; --art-accent: #a9bb79; }
.theme-3 { --art-bg: #e9d9d3; --art-dark: #985c53; --art-light: #f8eae2; --art-accent: #e8b486; }
.theme-4 { --art-bg: #eee4c5; --art-dark: #ad7f40; --art-light: #fff4d6; --art-accent: #dfac6d; }
.theme-5 { --art-bg: #d8e7e2; --art-dark: #4c7573; --art-light: #eaf5ef; --art-accent: #a6bfa3; }
.art-orbit { position: absolute; inset: -24% -12% auto auto; width: 67%; aspect-ratio: 1; border-radius: 50%; background: repeating-radial-gradient(circle at center, transparent 0 7px, color-mix(in srgb, var(--art-dark) 29%, transparent) 8px 9px); }
.art-shape { position: absolute; width: 42%; height: 72%; left: 22%; bottom: -13%; border-radius: 50% 50% 0 0; background: var(--art-dark); transform: rotate(-28deg); }
.art-shape::after { content: ''; position: absolute; inset: 11%; border-radius: inherit; background: repeating-linear-gradient(90deg, var(--art-light) 0 17%, var(--art-dark) 18% 21%); }
.art-flare { position: absolute; top: 17%; left: 12%; width: 18%; aspect-ratio: 1; background: var(--art-accent); clip-path: polygon(50% 0, 61% 38%, 100% 50%, 61% 61%, 50% 100%, 38% 61%, 0 50%, 38% 38%); }
.theme-1 .art-shape, .theme-4 .art-shape { transform: rotate(25deg); left: 43%; }
.theme-2 .art-shape { transform: rotate(-39deg); bottom: -3%; }
.theme-3 .art-orbit, .theme-5 .art-orbit { right: auto; left: -14%; }
.theme-3 .art-shape, .theme-5 .art-shape { left: 36%; transform: rotate(56deg); }
.theme-3 .art-flare, .theme-5 .art-flare { left: auto; right: 12%; }
.participant { max-width: 860px; }
.participant-heading { padding-top: 22px; }
.participant-heading h1 { font-size: clamp(33px, 4.9vw, 49px); }
.app-dialog { max-height: min(90dvh, 850px); width: min(94%, 430px); border: 1px solid var(--line); border-radius: 21px; color: var(--ink); background: var(--paper); padding: 26px; box-shadow: 0 22px 80px #172c255c; }
.app-dialog::backdrop { background: #182b23a3; backdrop-filter: blur(4px); }
.app-dialog h2 { font-size: 31px; letter-spacing: -.05em; padding-right: 24px; }
.app-dialog p { margin: 8px 0 18px; color: var(--muted); }
.icon-button { display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 9px; background: var(--paper); width: 36px; height: 36px; }
.icon-button:hover { background: #edf0e6; }
.modal-close { position: absolute; top: 13px; right: 13px; }
.dialog-actions { justify-content: end; }
.app-dialog label { display: block; margin-bottom: 4px; font-weight: 750; }
.app-dialog input { width: 100%; border: 1px solid var(--line); border-radius: 9px; background: #fff; padding: 10px; }
#teacher-form, #teacher-form > .button { margin-top: 12px; }
.app-dialog > h2 + .dialog-actions { margin-top: 12px; }
.app-dialog .form-error { color: var(--orange); margin: 6px 0; }
.wide { width: 100%; margin-top: 12px; }
.qr-dialog, .draw-dialog { width: min(94%, 480px); text-align: center; }
.qr-dialog h2, .draw-dialog h2 { padding: 0; }
.qr-dialog .dialog-actions { justify-content: center; margin-top: 10px; }
.large-qr { width: min(100%, 340px); height: auto; margin: 12px auto 0; border: 1px solid var(--line); border-radius: 12px; }
.draw-dialog { width: min(calc(100% - 28px), 282px, max(190px, calc(100dvh - 108px))); padding: 15px; }
.draw-scene { position: relative; display: grid; gap: 9px; }
.draw-scene:focus, .draw-name h2:focus { outline: 0; }
.draw-picture { aspect-ratio: 1; overflow: hidden; border-radius: 12px; }
.draw-picture > .art { width: 100%; height: 100%; }
.draw-name { display: grid; align-items: center; }
.draw-name > * { grid-area: 1 / 1; font-size: 26px; font-weight: 800; line-height: 1.12; letter-spacing: -.05em; overflow-wrap: anywhere; }
.draw-name span { visibility: hidden; }
.results { position: relative; isolation: isolate; overflow: hidden; padding: 22px; border: 1px solid #e4e6d6; border-radius: 19px; background: #f0f3e6; }
.results-title { text-align: center; margin-bottom: 14px; }
.results-pill { background: #e3ebd3; color: #364f39; }
.results h2 { margin-top: 6px; font-size: clamp(27px, 4.6vw, 48px); letter-spacing: -.06em; }
.winner-row, .runner-up-row { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; }
.winner, .runner-up { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.winner { width: min(100%, 330px); text-align: center; border-color: #d7bd74; }
.winner .art { height: clamp(126px, 21vw, 206px); }
.winner .art-sticker { height: auto; aspect-ratio: 1; width: min(100%, 220px); margin-inline: auto; }
.winner > div:last-child { padding: 10px; }
.results h3 { overflow-wrap: anywhere; }
.winner h3 { font-size: 25px; margin: 5px 0 2px; }
.results article p { color: var(--muted); font-size: 14px; }
.medal { display: inline-block; min-width: 53px; padding: 2px 8px; font-size: 13px; font-weight: 800; border-radius: 999px; }
.gold { background: #f9e4a0; color: #684a14; }
.silver { background: #e6eced; color: #3d535a; }
.bronze { background: #f6e4d8; color: #763f2e; }
.runner-up-row { margin-top: 11px; }
.runner-up { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: stretch; width: min(100%, 228px); }
.runner-up > div:last-child { padding: 8px; }
.runner-up h3 { font-size: 16px; margin: 4px 0 1px; }
.reveal-animation .winner { animation: land 520ms cubic-bezier(.18,.68,.28,1.12) both; }
.reveal-animation .runner-up { animation: land 470ms 120ms ease-out both; }
.confetti { position: absolute; inset: 0; z-index: 2; overflow: hidden; pointer-events: none; }
.confetti i { position: absolute; top: -14px; left: var(--x); width: 6px; height: 12px; border-radius: 1px; background: var(--color); animation: fall 1300ms var(--d) ease-out both; }
@keyframes land { from { opacity: 0; transform: translateY(18px) scale(.85); } to { opacity: 1; transform: none; } }
@keyframes fall { 70% { opacity: 1; } to { transform: translate(34px, 580px) rotate(var(--tilt)) rotate(340deg); opacity: 0; } }
.empty-results, .loading { padding: 32px; text-align: center; border: 1px solid var(--line); border-radius: 18px; background: var(--paper); }
.loading { margin-top: 25px; }
.loading p, .empty-results p { margin: 7px 0; }
.toast { position: fixed; z-index: 3; inset: auto 14px max(env(safe-area-inset-bottom), 16px); width: fit-content; max-width: calc(100vw - 28px); margin: auto; padding: 8px 14px; border-radius: 9px; background: #263c2e; color: white; box-shadow: 0 5px 18px #0002; font-weight: 750; }
@media (max-width: 750px) {
  .shell { width: calc(100% - 32px); }
  .stage-layout { grid-template-columns: minmax(0, 1fr) clamp(164px, 27vw, 188px); }
  .spotlight { padding: 19px; }
  .join-card { font-size: 20px; }
}
@media (max-width: 520px) {
  .masthead-inner:has(.room-tabs:not([hidden])) .header-button { width: 44px; padding-inline: 0; }
  .masthead-inner:has(.room-tabs:not([hidden])) .header-button span { display: none; }
  .stage-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .spotlight { min-height: 204px; border-radius: 16px; }
  .spotlight-content { width: 72%; }
  .stage-decoration { right: 0; width: 43%; }
  .spotlight-art { width: 27%; right: 3%; }
  .join-card { grid-template-columns: 90px auto; justify-content: center; gap: 14px; padding: 8px 12px; border-radius: 12px; font-size: 22px; }
  .control-bar { align-items: flex-start; flex-direction: column; }
  .control-actions { width: 100%; }
  .button { min-height: 44px; padding-inline: 10px; }
  .lineup-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .participant-heading { padding-top: 17px; }
  .runner-up { flex: 1 1 130px; grid-template-columns: 45px minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .confetti { display: none; }
}
