:root {
  color-scheme: dark;
  --bg: #141518;
  --surface: #1e2024;
  --panel: #25272c;
  --line: #44474e;
  --edge: #72757c;
  --text: #f6f3ed;
  --muted: #b9bbc2;
  --orange: #ff7836;
  --ink: #171513;
  --ok: #a3e6ba;
  --error: #ff9e9e;
  font: 16px/1.5 Arial, Helvetica, sans-serif;
  background: var(--bg);
  color: var(--text);
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100dvh; }
h1, h2, h3, p, ul, ol { margin: 0; }
h1, h2, h3 { line-height: 1.14; letter-spacing: -.035em; overflow-wrap: anywhere; }
h1 { font-size: clamp(2rem, 5vw, 3.75rem); }
h2 { font-size: clamp(1.45rem, 3vw, 2rem); }
h3 { font-size: 1.125rem; }
a { color: inherit; }
button, input { font: inherit; }
button { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--orange); outline-offset: 3px; }
.skip { position: absolute; z-index: 1; background: var(--bg); padding: .5rem; transform: translateY(-150%); }
.skip:focus { transform: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.topbar {
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .75rem clamp(.75rem, 4vw, 3rem); border-bottom: 1px solid var(--line); background: #101113;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; font-size: .85rem; font-weight: 900; line-height: .92; text-decoration: none; letter-spacing: -.04em; flex: none; }
#account { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: .5rem .85rem; font-size: .875rem; }
.account-name { color: var(--muted); overflow-wrap: anywhere; }
.signout { background: transparent; color: var(--muted); border: 0; padding: .15rem; text-decoration: underline; cursor: pointer; min-height: 32px; }
.loading { padding: 2rem; color: var(--muted); text-align: center; }
.shell { width: min(100% - 1.5rem, 740px); margin: clamp(.9rem, 4vw, 3rem) auto; }
.shell.wide { width: min(100% - 2rem, 1480px); }
.stack { display: grid; align-content: start; gap: .85rem; }
.room { display: grid; gap: 1rem; }
.card { min-width: 0; padding: clamp(.85rem, 2.5vw, 1.45rem); background: var(--surface); border: 1px solid var(--line); }
.card.signal { border-left: 4px solid var(--orange); }
.card-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: .65rem; }
.eyebrow { font-size: .875rem; font-weight: 700; text-transform: uppercase; letter-spacing: .095em; color: var(--muted); }
.orange { color: var(--orange); }
.muted { color: var(--muted); }
.badge { display: inline-flex; align-items: center; gap: .3rem; padding: .18rem .45rem; color: var(--muted); border: 1px solid var(--edge); font-size: .875rem; line-height: 1.25; }
.badge.hot { color: var(--orange); border-color: var(--orange); }
.badge.good { color: var(--ok); border-color: var(--ok); }
.badge.bad { color: var(--error); border-color: var(--error); }
.notice { padding: .55rem .75rem; border-left: 3px solid var(--edge); background: var(--panel); color: var(--muted); overflow-wrap: anywhere; }
.notice.error { border-color: var(--error); color: var(--error); }
.primary, .button {
  background: var(--panel); color: var(--text); border: 1px solid var(--edge);
  min-height: 44px; padding: .6rem .9rem; font-weight: 700; display: inline-flex;
  align-items: center; justify-content: center; text-align: center; text-decoration: none; cursor: pointer;
}
.button.primary { background: var(--orange); color: var(--ink); border-color: var(--orange); }
.button:hover:not(:disabled) { filter: brightness(1.15); }
button:disabled, input:disabled { opacity: .63; cursor: default; }
.button.small { min-height: 36px; font-size: .875rem; padding: .35rem .65rem; }
.actions { display: flex; gap: .55rem; align-items: stretch; flex-wrap: wrap; }
.actions > .button { flex: 1 1 auto; }
form.stack { gap: .65rem; }
label { font-weight: 700; }
input {
  width: 100%; min-width: 0; min-height: 46px; border: 1px solid var(--edge);
  border-radius: 0; padding: .55rem .75rem; color: var(--text); background: var(--bg);
}
input.code, input.answer { font-variant-numeric: tabular-nums; font-size: 1.5rem; letter-spacing: .25em; }
.login {
  min-height: calc(100dvh - 60px); display: grid; align-content: center;
  background: radial-gradient(75% 65% at 92% 10%, #3b251a 0%, transparent 85%);
}
.login h1 { font-size: clamp(3rem, 9.5vw, 6.35rem); line-height: .9; letter-spacing: -.078em; max-width: 9ch; }
.login .intro { margin: 0 0 .4rem; }
.login .panel { width: min(100%, 48rem); margin: 0 auto; padding: 2.2rem 1rem; gap: 1.25rem; }
.timer { font-size: clamp(3.35rem, 9vw, 5.85rem); font-variant-numeric: tabular-nums; font-weight: 800; line-height: 1; letter-spacing: -.055em; }
.timer.small-time { font-size: clamp(1.7rem, 5vw, 2.65rem); }
.clock-pair { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr); gap: .8rem; align-items: end; }
.clock-pair > :nth-child(2) { border-left: 1px solid var(--line); padding-left: .85rem; }
.clock-label { display: block; margin-bottom: .28rem; }
.rule-list { padding-left: 1.35rem; display: grid; gap: .45rem; }
.rule-label { font-weight: 700; }
.sequence { padding: .9rem; border: 1px solid var(--orange); color: var(--orange); text-align: center; font-size: clamp(1.5rem, 7vw, 3.25rem); font-weight: 800; font-variant-numeric: tabular-nums; letter-spacing: .1em; }
.round-index { color: var(--orange); font-weight: 900; font-size: 1.45rem; margin-right: .4rem; }
.hostgrid { display: grid; gap: .85rem; align-items: start; grid-template-columns: minmax(145px, .7fr) minmax(290px, 1.85fr) minmax(280px, 1.25fr); }
.phase-list, .roster, .event-list { list-style: none; padding: 0; }
.phase-list { display: grid; gap: .28rem; align-self: start; }
.phase-list li { padding: .38rem .55rem; color: var(--muted); border-left: 2px solid var(--line); font-size: .875rem; }
.phase-list li[aria-current] { border-color: var(--orange); color: var(--orange); background: var(--panel); }
.roster > li, .event-list > li { border-top: 1px solid var(--line); padding: .55rem 0; overflow-wrap: anywhere; }
.roster-item { display: grid; gap: .45rem; }
.slot-id { font-variant-numeric: tabular-nums; color: var(--orange); margin-right: .4rem; }
.room-code { display: block; color: var(--orange); font-size: clamp(2rem, 5vw, 3.6rem); font-variant-numeric: tabular-nums; font-weight: 800; letter-spacing: .13em; }
.event-list { max-height: 15rem; overflow: auto; }
.event-list time { display: inline-block; margin-right: .35rem; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums; }
.event-list li { font-size: .875rem; }
dialog { width: min(31rem, 100% - 1.5rem); max-height: 90dvh; padding: 1.2rem; border: 1px solid var(--edge); background: var(--surface); color: var(--text); }
dialog::backdrop { background: rgb(0 0 0 / 72%); }
dialog form, .dialog-body { display: grid; gap: .8rem; }
@media (max-width: 950px) {
  .hostgrid { grid-template-columns: minmax(265px, 1.15fr) minmax(255px, .85fr); }
  .hostgrid > :first-child { grid-column: 1 / -1; }
  .phase-list { display: flex; flex-wrap: wrap; }
}
@media (max-width: 620px) {
  .shell.wide { width: min(100% - 1.5rem, 740px); }
  .hostgrid { grid-template-columns: 1fr; }
  .record { order: 1; }
}
@media (max-width: 390px) {
  .topbar { gap: .35rem; }
  #account { gap: .35rem; }
  .account-name { font-size: .8rem; }
  .clock-pair { gap: .45rem; }
  .clock-pair > :nth-child(2) { padding-left: .55rem; }
}

.entry-actions { max-width: 29rem; }
.entry-actions > .button { justify-self: start; min-width: 10rem; }
.login .panel h2 { font-size: clamp(1.7rem, 4vw, 2.7rem); }
.entry-actions .actions { justify-content: flex-start; }
.entry-actions .actions > .button { flex: 0 1 auto; }
.host-title { align-items: flex-end; }
.host-title .actions { flex: 0 1 auto; }
.room-invite { display: grid; align-items: center; gap: .75rem; }
.bank-amount, .ring-value strong { color: var(--orange); font-variant-numeric: tabular-nums; font-size: 1.4rem; font-weight: 800; }
.player-bank { align-items: end; gap: 1.25rem 1rem; }
.player-bank .timer { font-size: clamp(2.6rem, 7vw, 4.65rem); }
.player-bank .timer.small-time { font-size: clamp(1.35rem, 4vw, 2.4rem); }
.task-details p { white-space: pre-line; overflow-wrap: anywhere; }
details .task-details { margin-top: .5rem; }
.attempt-ring { position: relative; width: min(13.5rem, 66vw); aspect-ratio: 1; margin: .25rem auto; }
.attempt-ring svg { width: 100%; height: 100%; fill: none; stroke-width: 4; transform: rotate(-90deg); }
.ring-track { stroke: var(--line); }
.ring-progress { stroke: var(--orange); stroke-linecap: round; }
.ring-value { position: absolute; inset: 18%; display: grid; align-content: center; justify-items: center; gap: .2rem; }
.ring-value strong { font-size: clamp(1.15rem, 6vw, 1.7rem); }
select, textarea {
  width: 100%; min-height: 46px; padding: .5rem .65rem; border: 1px solid var(--edge);
  border-radius: 0; background: var(--bg); color: var(--text); font: inherit;
}
textarea { min-height: 4.1rem; resize: vertical; }
dialog .dialog-body { gap: .45rem; }
dialog .dialog-body label { margin-top: .2rem; }

.obs-page, .obs-page .stage { min-height: 100vh; }
.stage {
  display: grid; grid-template-rows: auto auto minmax(0, 1fr); gap: 3vh;
  padding: 5vh 5vw; background: radial-gradient(65% 64% at 92% 10%, #482b1b 0%, var(--bg) 88%);
}
.stage-header, .stage-player-data { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.stage-brand { display: flex; align-items: center; gap: .8vw; white-space: nowrap; }
.stage-header .badge, .stage-brand { font-size: clamp(.85rem, 1.3vw, 1.6rem); }
.stage-task { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 1.3vw; }
.stage-title, .stage-common, .stage-player-data { padding: clamp(.7rem, 1.6vw, 2.1rem); background: var(--surface); border: 1px solid var(--line); }
.stage-title { border-left: .4vw solid var(--orange); }
.stage-title h1 { font-size: clamp(1.55rem, 4vw, 5rem); }
.stage-common { text-align: right; }
.stage .eyebrow { font-size: clamp(.75rem, 1vw, 1.2rem); }
.stage .timer { font-size: clamp(1.7rem, 5.2vw, 7rem); }
.stage-roster { display: grid; gap: 1vw; grid-template-columns: repeat(4, minmax(0, 1fr)); align-content: stretch; }
.stage-roster[data-count="1"] { grid-template-columns: minmax(0, 1fr); }
.stage-roster[data-count="2"] { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.stage-roster[data-count="3"] { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stage-player { display: grid; grid-template-rows: minmax(0, 1fr) auto; border: 1px solid var(--edge); min-width: 0; }
.camera-space { min-height: clamp(3rem, 12vh, 12rem); background: linear-gradient(145deg, #303138, #25272c); }
.stage-player-data { flex-wrap: wrap; border-width: 1px 0 0; font-size: clamp(.95rem, 1.5vw, 2rem); overflow-wrap: anywhere; }
.stage-bank { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--orange); }
.stage-break { grid-column: 1 / -1; grid-row: 1 / -1; min-height: 90vh; display: grid; place-content: center; gap: 2vh; justify-items: center; text-align: center; background: var(--bg); }
.obs-transparent, .obs-transparent .stage, .obs-transparent .camera-space { background: transparent; }
.discord-layout { grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); grid-template-rows: auto auto minmax(0, 1fr); }
.discord-layout .stage-header { grid-column: 1 / -1; }
.discord-layout .stage-task { grid-column: 1; grid-template-columns: 1fr; }
.discord-layout .stage-common { text-align: left; }
.discord-layout .discord-camera { grid-column: 2; grid-row: 2 / span 2; background: transparent; border: 1px solid var(--edge); }
.discord-layout .stage-roster { grid-column: 1; grid-template-columns: repeat(2, minmax(0, 1fr)); align-content: start; }
.discord-layout .stage-player { grid-template-rows: auto; }
.discord-layout .stage-player-data { border-width: 0; padding: .6rem; }
.discord-layout .stage-player .camera-space { display: none; }
@media (max-width: 620px) {
  .host-title .actions { flex: 1 1 100%; }
  .stage-header { gap: .4rem; }
  .stage-brand strong { display: none; }
  .stage-roster { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
