:root {
  color-scheme: light;
  --ink: #1f2626;
  --muted: #65706b;
  --paper: #f8f4eb;
  --panel: #fffdf7;
  --line: #ded4c2;
  --red: #d7263d;
  --green: #0ead69;
  --blue: #118ab2;
  --amber: #f7b801;
  --shadow: 0 18px 45px rgba(31, 38, 38, 0.14);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  min-height: 42px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: #fffdf7;
  cursor: pointer;
  font-weight: 760;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  width: min(1480px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 18px;
}

.stage {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 14px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  min-height: 96px;
  border-bottom: 1px solid var(--line);
}

.brand-block {
  min-width: 0;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 0.94;
}

.creator-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.creator-links a,
.creator-panel a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--ink);
  border-radius: 6px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 830;
  text-decoration: none;
}

.creator-links a {
  padding: 0 12px;
  background: #fffdf7;
}

.creator-links a:last-child,
.creator-panel a:last-child {
  border-color: var(--amber);
  background: var(--amber);
}

h2 {
  font-size: 1rem;
  line-height: 1.1;
}

.round-meter {
  display: grid;
  grid-template-columns: auto auto;
  align-items: center;
  gap: 10px;
  min-width: 164px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  background: #fffaf0;
}

.round-meter span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
  text-transform: uppercase;
}

.round-meter strong {
  min-width: 46px;
  font-size: 1.45rem;
  text-align: right;
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  flex: 1;
  width: 100%;
  min-width: 0;
  min-height: 420px;
  border: 1px solid var(--ink);
  background: #111;
  box-shadow: var(--shadow);
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-height: calc(100vh - 126px);
  object-fit: contain;
  background: var(--paper);
}

.join-panel {
  position: absolute;
  inset: auto 18px 18px 18px;
  display: grid;
  grid-template-columns: minmax(180px, 0.85fr) minmax(240px, 1.15fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 14px;
  border: 1px solid rgba(31, 38, 38, 0.36);
  background: rgba(255, 253, 247, 0.94);
  backdrop-filter: blur(8px);
}

.join-panel > * {
  min-width: 0;
}

.join-panel.is-hidden {
  display: none;
}

.join-copy h2 {
  max-width: 22ch;
  font-size: 1.2rem;
}

.consent-line {
  display: grid;
  grid-template-columns: 18px 1fr;
  align-items: start;
  gap: 9px;
  color: #2c3331;
  font-size: 0.9rem;
  line-height: 1.25;
}

.consent-line input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--green);
}

.consent-line span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.turnstile-mount {
  min-height: 0;
}

.turnstile-mount:empty {
  display: none;
}

.side {
  display: flex;
  min-width: 0;
  flex-direction: column;
  gap: 12px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  padding: 14px;
}

.identity-panel,
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.identity-panel strong {
  font-size: 1.05rem;
}

.dot {
  width: 13px;
  height: 13px;
  border: 1px solid var(--ink);
  border-radius: 50%;
  background: var(--red);
}

.dot.is-live {
  background: var(--green);
}

.creator-panel {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.creator-panel .eyebrow {
  margin-bottom: 0;
}

.creator-panel a {
  width: 100%;
  background: #fffaf0;
}

.panel-head {
  margin-bottom: 12px;
}

.panel-head span {
  min-width: 32px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.panel-head button {
  min-height: 32px;
  padding: 0 10px;
  border-color: var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 0.82rem;
}

.scoreboard {
  display: grid;
  gap: 7px;
  min-height: 120px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.scoreboard li {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 8px;
  padding: 8px 9px;
  border: 1px solid #eadfca;
  background: #fffaf0;
  font-size: 0.92rem;
}

.scoreboard small {
  color: var(--muted);
}

.facts {
  display: grid;
  gap: 8px;
  margin: 0;
}

.facts div {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
}

.facts dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.facts dd {
  margin: 0;
  font-weight: 760;
}

.atlas {
  display: grid;
  gap: 8px;
  max-height: 304px;
  overflow: auto;
}

.atlas-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 9px;
  border: 1px solid #eadfca;
  background: #fffaf0;
}

.atlas-row strong {
  display: block;
  font-size: 0.86rem;
}

.atlas-row span {
  color: var(--muted);
  font-size: 0.78rem;
}

.miss-rate {
  min-width: 54px;
  color: var(--red);
  font-weight: 850;
  text-align: right;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
    padding: 12px;
  }

  .side {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .atlas-panel {
    grid-column: 1 / -1;
  }

  canvas {
    min-height: 58vh;
  }
}

@media (max-width: 760px) {
  .shell {
    width: 100vw;
    max-width: 100vw;
    overflow-x: hidden;
  }

  .stage,
  .side,
  .topbar,
  .canvas-wrap {
    width: 100%;
    max-width: calc(100vw - 24px);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    padding-bottom: 12px;
  }

  .creator-links {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .round-meter {
    width: 100%;
  }

  .join-panel {
    inset: auto 12px 12px 12px;
    width: calc(100vw - 48px);
    max-width: calc(100vw - 48px);
    grid-template-columns: 1fr;
  }

  .join-copy h2 {
    font-size: 1.05rem;
  }

  .consent-line {
    font-size: 0.86rem;
  }

  .side {
    grid-template-columns: 1fr;
  }
}
