/* SHOT CLOCK projector: a dark soundstage. Header bar, one stage, control strip.
   Everything sizes off the viewport so it fills any projector. */
body.host {
  display: grid; grid-template-rows: auto 1fr auto; height: 100%; overflow: hidden;
  background: radial-gradient(80% 60% at 50% -10%, #2a2214 0%, transparent 60%), radial-gradient(60% 50% at 50% 110%, #1c160c 0%, transparent 70%), var(--ink);
}
.bar {
  position: relative; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  padding-block: calc(12px + env(safe-area-inset-top, 0px)) 12px;
  border-bottom: 1px solid var(--line);
}
.bar-left, .bar-right { display: flex; align-items: center; gap: 12px; min-width: 0; }
.bar-title { font: 600 18px/1 var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.join-pill { display: flex; align-items: center; gap: 12px; padding: 8px 8px 8px 16px; border: 1px solid var(--line); border-radius: 999px; background: #000; }
.join-addr { font: 700 20px/1 var(--display); letter-spacing: .04em; }
.join-addr b { color: var(--gold); letter-spacing: .14em; }
.join-pill .count { font: 600 15px/1 var(--display); color: var(--muted); background: var(--panel-2); padding: 6px 10px; border-radius: 999px; }
#soundBtn.off, #fxBtn.off, #musicBtn.off { opacity: .4; text-decoration: line-through; }
#fxBtn { font: 700 14px/1 var(--display); letter-spacing: .1em; }
.badge { background: var(--rec); color: #fff; border-radius: 999px; min-width: 22px; height: 22px; display: inline-grid; place-items: center; font-size: 13px; padding: 0 6px; letter-spacing: 0; }
.credit { font-size: 12px; color: var(--muted); opacity: .7; }

#stage { position: relative; overflow: auto; min-height: 0; }
.screen { position: relative; z-index: 1; min-height: 100%; padding-block: clamp(16px, 3vh, 40px); padding-inline: clamp(0px, 2.5vw, 48px); }
.screen.enter { animation: screenIn .5s ease both; }
@keyframes screenIn { from { opacity: 0; transform: scale(1.015); filter: blur(4px); } }
.beams { display: none; }
body[data-screen=lobby] .beams, body[data-screen=results] .beams, body[data-screen=setup] .beams { display: block; }
body.fx-off .beams { display: none; }

.controls {
  position: relative; z-index: 30;
  display: flex; justify-content: center; align-items: center; gap: 12px; flex-wrap: wrap;
  padding-block: 14px calc(14px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line); background: color-mix(in srgb, var(--ink) 80%, black);
}
body.cinema .controls, body.revealing .controls { visibility: hidden; }

.prompt-big { font-size: clamp(44px, 7.2vw, 128px); line-height: .9; text-transform: uppercase; letter-spacing: .005em; }
.prompt-mid { font-size: clamp(34px, 5vw, 84px); line-height: .92; text-transform: uppercase; }
.task { font-size: clamp(18px, 1.9vw, 30px); color: var(--text); margin: .4em 0 0; max-width: 40ch; }
.headline { font-size: clamp(90px, 16vw, 260px); line-height: .85; text-transform: uppercase; }
.empty { color: var(--muted); font-style: italic; }
.small { font-size: 14px; }

/* setup */
.setup { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: clamp(24px, 4vw, 64px); align-items: start; max-width: 1280px; margin: 0 auto; }
.setup-intro { display: grid; gap: 16px; align-content: start; padding-top: 12px; }
.setup-intro h1 { font-size: clamp(44px, 5.4vw, 88px); line-height: .92; text-transform: uppercase; }
.setup-intro h1::first-line { color: var(--gold); }
.setup-intro p { max-width: 52ch; margin: 0; }
.resume { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border: 1px dashed var(--line); border-radius: var(--radius); width: fit-content; }
.setup-card { display: grid; gap: 20px; background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line); border-radius: 14px; padding: clamp(18px, 2.4vw, 32px); }
.deck-grid { display: grid; gap: 20px; }
.field { display: grid; gap: 8px; min-width: 0; }
.field-label, .field > label > .field-label { font: 600 13px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.field-foot { display: flex; justify-content: space-between; gap: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* die slots */
.die-slot { position: relative; min-width: 0; }
.die-slot canvas, .die-slot .die-fallback { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.die-slot .die-fallback { display: grid; place-items: center; }
.die-slot canvas { -webkit-mask: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%); mask: radial-gradient(ellipse 50% 50% at 50% 50%, #000 62%, transparent 100%); }
.die-slot.small { width: clamp(150px, 16vw, 240px); aspect-ratio: 1; }
.die-slot.big { min-height: 0; height: 100%; }

/* lobby */
.lobby { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(24px, 4vw, 72px); align-items: stretch; }
.lobby-join { display: grid; align-content: center; justify-items: start; gap: clamp(18px, 3vh, 34px); }
.join-card { background: #000; border-radius: 18px; padding: clamp(18px, 3vh, 32px) clamp(22px, 3vw, 44px); display: grid; gap: 6px; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.join-domain { margin: 0; font: 700 clamp(26px, 3vw, 52px)/1 var(--display); letter-spacing: .04em; color: var(--text); }
.code-big { font: 800 clamp(90px, 11vw, 200px)/.9 var(--display); letter-spacing: .1em; color: var(--gold); text-shadow: 0 0 .05em #fff3c4, 0 0 .2em color-mix(in srgb, var(--gold) 70%, transparent); }
.join-row { display: flex; align-items: center; gap: 20px; }
.join-hint { margin: 0; max-width: 18ch; font: 600 clamp(18px, 1.6vw, 26px)/1.15 var(--display); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.qr { background: #fff; padding: 10px; border-radius: 12px; line-height: 0; }
.qr svg { width: clamp(130px, 17vh, 220px); height: auto; }
.qr.small svg { width: 160px; }
.lobby-room { display: grid; grid-template-rows: auto 1fr auto; gap: 16px; min-height: 0; }
.names { display: flex; flex-wrap: wrap; gap: 10px; align-content: flex-start; overflow: auto; }
.name { font: 700 clamp(18px, 1.7vw, 28px)/1 var(--display); letter-spacing: .04em; text-transform: uppercase; padding: 10px 16px; border-radius: 8px; background: color-mix(in srgb, var(--panel-2) 90%, transparent); border: 1px solid var(--line); }
.names.small .name { font-size: clamp(15px, 1.2vw, 20px); padding: 8px 12px; }
.name.pop { animation: pop .6s cubic-bezier(.2,1.6,.4,1) both; border-color: var(--gold); box-shadow: 0 0 24px color-mix(in srgb, var(--gold) 35%, transparent); }
@keyframes pop { from { transform: scale(.3) rotate(-8deg); opacity: 0; } }
.lobby-foot { display: flex; align-items: center; gap: 24px; padding-top: 12px; border-top: 1px solid var(--line); }
.lobby-meta { display: grid; gap: 8px; justify-items: start; }
.lobby-meta p { margin: 0; }

/* roll: die on the left, board or prompt card on the right */
.roll { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: clamp(16px, 3vw, 56px); align-items: stretch; height: 100%; }
.roll-side { display: grid; align-content: center; min-width: 0; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: clamp(6px, .8vw, 12px); }
.slot {
  position: relative; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 10px;
  min-height: clamp(48px, 7.4vh, 84px); padding: 6px 12px; border-radius: 8px; background: #000; border: 1px solid #2e281e;
  transition: background .12s, border-color .12s, opacity .4s, transform .4s;
}
.slot-num { font: 700 clamp(16px, 1.5vw, 26px)/1 var(--led); color: color-mix(in srgb, var(--gold) 55%, #000); min-width: 1.6em; text-align: right; }
.slot-text { font: 700 clamp(13px, 1.15vw, 20px)/1.05 var(--display); text-transform: uppercase; letter-spacing: .02em; color: #9c917e; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.slot.lit { background: color-mix(in srgb, var(--gold) 30%, #000); border-color: var(--gold); }
.slot.lit .slot-num { color: #fff3c4; text-shadow: 0 0 10px var(--gold); }
.slot.dim { opacity: .25; transform: scale(.97); }
.slot.hit { background: var(--gold); border-color: #fff1c1; transform: scale(1.06); z-index: 2; box-shadow: 0 0 0 4px #000, 0 0 50px color-mix(in srgb, var(--gold) 70%, transparent); animation: hit .5s steps(2) 3; }
.slot.hit .slot-num, .slot.hit .slot-text { color: var(--gold-ink); text-shadow: none; }
@keyframes hit { 50% { background: #fff1c1; } }
.prompt-card { background: #000; border-radius: 22px; padding: clamp(22px, 3.5vh, 44px) clamp(24px, 3vw, 48px); display: grid; gap: 14px; margin: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.7); }
.prompt-card p, .prompt-card h2 { margin: 0; }
.prompt-card .prompt-big { animation: landed .7s cubic-bezier(.2,1.3,.4,1) both; }
@keyframes landed { from { opacity: 0; transform: scale(.85); } }
.num-badge { position: absolute; top: -18px; right: 28px; font: 700 clamp(28px, 2.6vw, 44px)/1 var(--led); color: var(--gold-ink); background: var(--gold); padding: 10px 14px 8px; border-radius: 10px; box-shadow: 0 0 0 4px #000, 0 0 30px color-mix(in srgb, var(--gold) 60%, transparent); }
.roll-meta { font: 600 clamp(16px, 1.4vw, 22px)/1.2 var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

/* active: the shot clock */
.active { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .36fr); grid-template-rows: auto 1fr; gap: clamp(12px, 2vw, 32px); }
.active-top { grid-column: 1 / -1; }
.active-top .eyebrow span:first-child { margin-right: 14px; }
.active-top h2, .active-top p { margin: 0; }
.active-top .eyebrow { margin-bottom: 10px; }
.clock-wrap { display: grid; align-content: center; justify-items: center; gap: 22px; background: #000; border-radius: 22px; padding: clamp(18px, 3vh, 40px); border: 2px solid #2a2418; box-shadow: inset 0 0 80px rgba(0,0,0,.9), 0 30px 80px rgba(0,0,0,.6); }
.clock-wrap .led { font-size: clamp(110px, 22vh, 280px); }
.clock-wrap.hurry { animation: hurry 1s ease-in-out infinite; border-color: #5a1a1a; }
@keyframes hurry { 50% { box-shadow: inset 0 0 80px rgba(0,0,0,.9), 0 0 80px rgba(255,40,40,.35); } }
.clock-bar { width: 100%; height: 10px; background: #1a1712; border-radius: 999px; overflow: hidden; }
.clock-bar div { height: 100%; background: var(--gold); transform-origin: left; box-shadow: 0 0 20px var(--gold); }
.clock-wrap.hurry .clock-bar div { background: var(--rec); box-shadow: 0 0 20px var(--rec); }
.in-wrap { display: grid; grid-template-rows: auto 1fr; gap: 12px; min-height: 0; }

/* review */
.review { display: grid; align-content: center; justify-items: start; gap: 18px; max-width: 1200px; margin: 0 auto; }
.review h2, .review p { margin: 0; }
.review .headline { color: var(--rec); text-shadow: 0 0 60px rgba(255,60,60,.35); }
.stats { display: flex; gap: clamp(24px, 5vw, 80px); flex-wrap: wrap; }
.stats > div, .vote-meter { display: grid; gap: 4px; }
.stat { font: 700 clamp(56px, 8vw, 120px)/.9 var(--led); color: var(--gold); text-shadow: 0 0 .2em color-mix(in srgb, var(--gold) 50%, transparent); }
.stat-label { font: 600 16px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); }

/* gallery */
.gallery { display: grid; grid-template-rows: auto 1fr auto; gap: 14px; height: 100%; }
.gallery-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.gallery-head .eyebrow { flex: 1; }
.gallery-count { font: 700 26px/1 var(--led); color: var(--gold); }
.gallery-media { min-height: 0; position: relative; background: #000; border-radius: 12px; overflow: hidden; box-shadow: 0 0 0 1px #2a2418, 0 40px 100px rgba(0,0,0,.7); }
.gallery-media.pop { animation: galleryIn .5s cubic-bezier(.2,1,.3,1); }
@keyframes galleryIn { from { transform: scale(.94); opacity: .2; filter: brightness(2.2); } }
.gallery-media > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.gallery-media img, .gallery-media video { object-fit: contain; }
.gallery-media iframe { border: 0; }
.gallery-media > .empty, .gallery-media > .link-card { display: grid; place-content: center; }
.gallery-caption { margin: 0; font-size: clamp(18px, 1.8vw, 28px); text-align: center; min-height: 1.4em; }
.link-card { display: grid; justify-items: center; gap: 14px; padding: 24px; text-align: center; }
.link-host { font: 700 clamp(24px, 3vw, 44px)/1.1 var(--display); }

/* voting */
.voting { display: grid; grid-template-rows: auto 1fr; gap: 18px; height: 100%; }
.voting-head { display: flex; justify-content: space-between; align-items: end; gap: 24px; flex-wrap: wrap; }
.voting-head h2 { margin: 8px 0 0; }
.voting-head h2 span { color: var(--gold); }
.vote-meter { text-align: right; }
.vote-grid { --cols: 4; display: grid; grid-template-columns: repeat(var(--cols), minmax(0, 1fr)); gap: 12px; align-content: start; overflow: auto; }
.vote-tile { margin: 0; position: relative; background: #000; border-radius: 10px; overflow: hidden; max-width: 100%; }
.vote-tile::before { content: ''; display: block; padding-top: 66.6667%; }
.vote-tile > img, .vote-tile > video, .vote-tile > .link-card { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.vote-tile .link-host { font-size: 18px; }
.vote-tile figcaption { position: absolute; left: 8px; top: 8px; min-width: 44px; height: 40px; display: grid; place-items: center; padding: 0 8px; background: #000; color: var(--gold); border: 2px solid var(--gold); border-radius: 8px; font: 700 20px/1 var(--led); }

/* results */
.results { display: grid; grid-template-columns: minmax(0, 1fr) minmax(220px, .32fr); gap: clamp(20px, 3vw, 48px); height: 100%; }
.results-main { display: grid; grid-template-rows: auto 1fr; gap: 18px; min-height: 0; }
.podium { display: grid; grid-template-columns: 1fr 1.3fr 1fr; gap: 16px; align-items: end; align-self: center; min-height: 0; }
.place { margin: 0; display: grid; min-width: 0; transition: transform .7s cubic-bezier(.2,1.4,.3,1), opacity .4s, filter .6s; }
.place.waiting { opacity: 0; transform: translateY(40px) scale(.85); filter: blur(10px); }
.p1 { order: 2; } .p2 { order: 1; } .p3 { order: 3; }
.place-media { position: relative; background: #000; border-radius: 10px 10px 0 0; overflow: hidden; max-width: 100%; }
.place-media::before { content: ''; display: block; padding-top: 75%; }
.p1 .place-media::before { padding-top: 88%; }
.place-media > img, .place-media > video, .place-media > .link-card { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.p1 .place-media { box-shadow: 0 0 0 3px var(--gold), 0 0 90px color-mix(in srgb, var(--gold) 45%, transparent); }
.lower-third { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 12px; background: var(--gold); color: var(--gold-ink); padding: 10px 14px; border-radius: 0 0 10px 10px; font-family: var(--display); text-transform: uppercase; }
.p2 .lower-third, .p3 .lower-third { background: var(--panel-2); color: var(--text); border: 1px solid var(--line); border-top: 0; }
.place-rank { font: 800 clamp(20px, 2vw, 34px)/1 var(--display); }
.place-name { font: 700 clamp(18px, 1.8vw, 32px)/1 var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .03em; }
.place-votes { font: 600 16px/1 var(--display); letter-spacing: .08em; }
.leaderboard { border-left: 1px solid var(--line); padding-left: clamp(16px, 2vw, 32px); }
body.revealing .leaderboard { opacity: 0; }
.leaderboard { transition: opacity .6s; }
.leaderboard ol { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 4px; counter-reset: r; }
.leaderboard li { counter-increment: r; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); font: 600 clamp(18px, 1.5vw, 24px)/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.leaderboard li::before { content: counter(r); color: var(--gold); font-weight: 800; }
.leaderboard li span:last-child { color: var(--gold); font-family: var(--led); }

/* ended */
.ended { display: grid; align-content: center; justify-items: start; gap: 18px; max-width: 1200px; margin: 0 auto; }
.ended h2 { margin: 0; }

/* teacher drawer */
.drawer { z-index: 60;
  position: fixed; z-index: 50; top: 0; right: 0; bottom: 0; width: min(560px, 100vw);
  background: var(--panel); border-left: 1px solid var(--line); box-shadow: -20px 0 60px rgba(0,0,0,.6);
  display: grid; grid-template-rows: auto 1fr; overflow: hidden;
  padding: calc(16px + env(safe-area-inset-top, 0px)) calc(18px + env(safe-area-inset-right, 0px)) env(safe-area-inset-bottom, 0px) 18px;
}
.drawer-head { display: flex; justify-content: space-between; gap: 12px; padding-bottom: 12px; }
.drawer-head p { margin: 0 0 6px; }
#panelMount { display: grid; grid-template-rows: auto 1fr; min-height: 0; }

/* panel (shared with remote) */
.panel-tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.panel-tab { white-space: nowrap; background: none; border: 0; padding: 12px 12px; cursor: pointer; color: var(--muted); font: 600 15px/1 var(--display); letter-spacing: .12em; text-transform: uppercase; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.panel-tab[aria-selected=true] { color: var(--gold); border-bottom-color: var(--gold); }
.panel-body { overflow: auto; padding-block: 16px 24px; min-height: 0; }
.entries-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.entries { display: grid; gap: 10px; }
.entry { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel-2); }
.entry.rejected { opacity: .55; }
.entry-meta { display: grid; gap: 6px; align-content: start; justify-items: start; min-width: 0; }
.entry-name { font: 700 19px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.entry-caption { margin: 0; font-size: 14px; color: var(--muted); }
.entry-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.entry-actions .btn { min-height: 38px; padding: 0 12px; font-size: 14px; }
.thumb { position: relative; aspect-ratio: 4 / 3; background: #000; border-radius: 8px; overflow: hidden; max-width: 100%; align-self: start; }
.thumb > img, .thumb > video, .thumb > .thumb-link { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb > .thumb-link { display: grid; }
.thumb.veiled img, .thumb.veiled video { filter: blur(18px) brightness(.6); transform: scale(1.1); }
.thumb .peek { position: absolute; inset: 0; margin: auto; width: fit-content; height: fit-content; padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: rgba(0,0,0,.6); cursor: pointer; font: 600 13px/1 var(--display); letter-spacing: .14em; text-transform: uppercase; }
.thumb-link { display: grid; place-content: center; gap: 4px; height: 100%; text-align: center; padding: 6px; text-decoration: none; font-size: 13px; color: var(--text); }
.thumb-link strong { font-family: var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--gold); }
.thumb.veiled .thumb-link { filter: none; }
.players-list { display: grid; gap: 8px; }
.players-list p { margin: 0 0 6px; }
.player-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); font: 600 18px/1 var(--display); letter-spacing: .04em; text-transform: uppercase; }
.player-row .btn { min-height: 36px; font-size: 13px; padding: 0 12px; }
.deck-form { display: grid; gap: 16px; }
.deck-form p { margin: 0; }

/* narrow screens (teacher previewing on a laptop window or tablet) */
@media (max-width: 900px) {
  body.host { overflow: auto; height: auto; min-height: 100%; }
  .setup, .lobby, .roll, .results, .active { grid-template-columns: minmax(0, 1fr); }
  .die-slot.big { height: 46vh; }
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .leaderboard { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 16px; }
  .podium { grid-template-columns: minmax(0, 1fr); }
  .p1, .p2, .p3 { order: 0; }
  .join-pill { order: 3; width: 100%; justify-content: center; }
  .vote-grid { --cols: 2 !important; }
  .gallery-media { min-height: 50vh; }
  .code-big { font-size: 64px; }
}
@media (max-width: 480px) {
  .entry { grid-template-columns: 96px minmax(0, 1fr); }
  .bar-title, .logo-word { display: none; }
}
