:root {
  --bg: #0d1117;
  --text: #c9d1d9;
  --blue: #58a6ff;
  --green: #3fb950;
  --orange: #ffa657;
  --red: #f85149;
  --purple: #d2a8ff;
  --link: #79c0ff;
  --glass: rgba(20, 26, 36, 0.42);
  --glass-strong: rgba(20, 26, 36, 0.62);
  --line: rgba(201, 209, 217, 0.14);
  --mono: 'JetBrains Mono', ui-monospace, monospace;
  --sans: 'Inter', system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

#stage { position: fixed; inset: 0; }
#stage canvas { display: block; width: 100%; height: 100%; touch-action: none; opacity: 0; transition: opacity 0.5s ease; }
body.scene-ready #stage canvas { opacity: 1; }

.glass {
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 14px;
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.35);
}

/* Loader (lab/lib/intro.css): no parts assemble after the hand-off, so the label and the bar fade
   where they are instead of sliding down over the Throw button. */
.lab-loader.handoff .lab-loader-status { top: calc(44% + min(200px, 27vw)); }

/* Hero, top-left. */
.hero {
  position: fixed;
  top: 26px;
  left: 28px;
  width: min(360px, calc(100vw - 40px));
  pointer-events: none;
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.6);
}
.hero > * { pointer-events: auto; }
.kicker {
  margin: 0;
  font: 800 21px/1 var(--sans);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: #e6edf3;
}
.hero h1 {
  margin: 2px 0 12px;
  font: 800 44px/1 var(--sans);
  letter-spacing: -0.01em;
  text-transform: uppercase;
  background: linear-gradient(92deg, var(--link) 0%, var(--blue) 45%, var(--purple) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: none;
  filter: drop-shadow(0 2px 16px rgba(88, 166, 255, 0.35));
}
.hook { margin: 0 0 16px; font-size: 14px; line-height: 1.5; color: #dfe6ee; }

.tiles { display: flex; gap: 8px; margin-bottom: 10px; }
.tile {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px 9px;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-shadow: none;
}
.tile-label { font: 500 10px var(--mono); letter-spacing: 0.1em; text-transform: uppercase; color: #8b949e; }
.tile-value { font: 700 17px var(--mono); color: var(--link); white-space: nowrap; font-variant-numeric: tabular-nums; }
.tile-value.hot { color: var(--purple); text-shadow: 0 0 14px rgba(210, 168, 255, 0.7); }

.live {
  margin: 0;
  padding: 11px 13px;
  min-height: 62px;
  font-size: 13.5px;
  line-height: 1.5;
  color: #e6edf3;
  background: var(--glass);
  border: 1px solid var(--line);
  border-radius: 10px;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  text-shadow: none;
}
.live b { color: #fff; font-weight: 700; }
.live .red { color: var(--red); font-weight: 700; }
.live .white { color: #fff; font-weight: 700; text-shadow: 0 0 10px rgba(255, 255, 255, 0.4); }
.live .blue { color: var(--link); font-weight: 600; }
.live .purple { color: var(--purple); font-weight: 700; }
.live .num { font-family: var(--mono); font-weight: 700; color: #fff; }

/* Console, top-right. */
.console {
  position: fixed;
  top: 22px;
  right: 22px;
  width: 330px;
  padding: 13px 14px 14px;
  font-family: var(--sans);
}
.row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 12px 0 0; }
.label { font: 500 10px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: #8b949e; }
.value { font: 400 10px var(--mono); color: #8b949e; }

.segmented { display: flex; gap: 3px; padding: 3px; background: rgba(0, 0, 0, 0.28); border-radius: 10px; }
.segmented button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 6px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: #c9d1d9;
  font: 600 13px var(--sans);
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.segmented button:hover { background: rgba(255, 255, 255, 0.06); }
.segmented button.on { background: #e6edf3; color: #0d1117; box-shadow: 0 0 18px rgba(121, 192, 255, 0.35); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot.calm { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.wild { background: var(--purple); box-shadow: 0 0 8px var(--purple); }

input[type="range"] { width: 100%; margin: 8px 0 0; accent-color: var(--link); cursor: pointer; }

.actions { display: flex; gap: 8px; margin-top: 13px; }
.actions button { border: 0; cursor: pointer; font: 700 14px var(--sans); border-radius: 10px; }
.primary {
  flex: 1;
  padding: 10px 14px;
  color: #0d1117;
  background: linear-gradient(180deg, #a5d6ff, var(--blue));
  box-shadow: 0 0 24px rgba(88, 166, 255, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  transition: transform 0.12s, box-shadow 0.2s;
}
.primary:hover { box-shadow: 0 0 34px rgba(88, 166, 255, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.5); }
.primary:active { transform: scale(0.97); }
.icon {
  width: 40px;
  display: grid;
  place-items: center;
  color: #e6edf3;
  background: rgba(255, 255, 255, 0.08);
}
.icon:hover { background: rgba(255, 255, 255, 0.16); }

/* Essay. */
.essay {
  position: fixed;
  right: 22px;
  top: 250px;
  bottom: 70px;
  width: 330px;
  padding: 18px 20px;
  overflow-y: auto;
  background: var(--glass-strong);
  font-size: 13.5px;
  line-height: 1.6;
}
.essay h2 { margin: 16px 0 6px; font: 500 11px var(--mono); letter-spacing: 0.12em; text-transform: uppercase; color: var(--link); }
.essay h2:first-of-type { margin-top: 0; }
.essay p { margin: 0; color: #d7dde4; }
.close { position: absolute; top: 8px; right: 10px; border: 0; background: none; color: #8b949e; font-size: 20px; cursor: pointer; }

/* Bottom-right corner. */
.corner {
  position: fixed;
  right: 22px;
  bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  font: 500 12px var(--sans);
}
.stats { font: 400 10px var(--mono); color: #6e7681; }

@media (max-width: 760px) {
  .hero { top: calc(14px + env(safe-area-inset-top)); left: 14px; width: calc(100vw - 28px); }
  .kicker { font-size: 15px; }
  .hero h1 { font-size: 30px; margin-bottom: 8px; }
  .hook { display: none; }
  .tiles { gap: 6px; margin-bottom: 6px; }
  .tile { padding: 6px 8px; }
  .tile-value { font-size: 14px; }
  /* Room for three lines, so the framing band below does not move as the sentence changes. */
  .live { font-size: 12.5px; line-height: 1.45; min-height: calc(3 * 1.45em + 16px); padding: 8px 10px; }
  .console {
    top: auto;
    left: 10px;
    right: 10px;
    bottom: calc(46px + env(safe-area-inset-bottom));
    width: auto;
    padding: 10px;
  }
  .console > .row:first-child { display: none; }
  .row.two { margin-top: 8px; gap: 10px; }
  .row.two .row { margin-bottom: 4px; }
  .actions { margin-top: 10px; }
  /* Thumb-sized targets: 44 px or more. */
  .segmented button { min-height: 44px; font-size: 13px; padding: 0 4px; }
  input[type="range"] { height: 44px; margin: 3px 0 0; }
  .actions button { min-height: 48px; }
  .primary { font-size: 16px; }
  .icon { width: 48px; }
  .essay { left: 10px; right: 10px; top: calc(14px + env(safe-area-inset-top)); bottom: calc(var(--sheet-h, 260px) + 8px); width: auto; }
  .close { width: 44px; height: 44px; top: 0; right: 0; }
  .corner { right: 12px; left: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); justify-content: flex-end; }
  .stats { margin-right: auto; }
  .value { display: none; }
}
