/* Logicnaut Block Lab. Brand kit: Launch Purple, Deep Space, Circuit Teal, Rocket Orange, Idea Yellow, Cloud White.
   Scratch category colours stay on the blocks themselves. Base type stays at 18px for a young learner. */

/* Light theme: hot rod red and gold armour on warm white. Dark theme below: a Stark style HUD. */
:root {
  color-scheme: light;
  --ink: #1c1420;
  --ink-soft: #3a2a33;
  --muted: #6b5a63;
  --line: #e6d9d6;
  --page: #f7f3f1;
  --surface: #ffffff;
  --white: #ffffff;
  --ws-bg: #efe9e8;
  --accent: #d3261f;
  --accent-dark: #8f1410;
  --accent-soft: #f04a3f;
  --gold: #f2c14e;
  --gold-dark: #b8860b;
  --green: #17b3d6;
  --green-dark: #0f7f9a;
  --red: #b3261e;
  --orange: #e8a23b;
  --orange-dark: #b07414;
  --glow: rgba(64, 214, 255, 0.55);
  --tint-note: #fff3d6;
  --tint-win: #e3f6fb;
  --tint-try: #fde8e6;
  --tint-info: #fbeeda;
  --display: Orbitron, "Exo 2", "Avenir Next Condensed", "Trebuchet MS", sans-serif;
  --body: "Exo 2", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Share Tech Mono", ui-monospace, Menlo, Consolas, monospace;
  --shadow: 0 10px 28px rgba(60, 20, 20, 0.14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --hero: #120a12;
  --hero-text: #ffffff;
}

/* Dark HUD tokens are defined once and applied for the system setting or an explicit choice. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --ink: #f4eef0;
    --ink-soft: #d8ccd0;
    --muted: #a493a0;
    --line: #3a2a35;
    --page: #0c0a12;
    --surface: #17121f;
    --ws-bg: #1f1826;
    --accent: #e63b31;
    --accent-dark: #8f1410;
    --gold: #f2c14e;
    --gold-dark: #f2c14e;
    --green: #35d0ee;
    --green-dark: #1b8fa8;
    --tint-note: #2a2210;
    --tint-win: #0f2a33;
    --tint-try: #33110f;
    --tint-info: #2a1d10;
    --shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(242, 193, 78, 0.08);
    --hero: #08060c;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #f4eef0;
  --ink-soft: #d8ccd0;
  --muted: #a493a0;
  --line: #3a2a35;
  --page: #0c0a12;
  --surface: #17121f;
  --ws-bg: #1f1826;
  --accent: #e63b31;
  --accent-dark: #8f1410;
  --gold: #f2c14e;
  --gold-dark: #f2c14e;
  --green: #35d0ee;
  --green-dark: #1b8fa8;
  --tint-note: #2a2210;
  --tint-win: #0f2a33;
  --tint-try: #33110f;
  --tint-info: #2a1d10;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(242, 193, 78, 0.08);
  --hero: #08060c;
}

* { box-sizing: border-box; }

/* Layout rules below set display, so hidden needs to win over them. */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--body);
  font-size: 18px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--page);
  overflow-x: hidden;
}
/* HUD grid: a faint reactor blue lattice behind the page in dark mode, gold hairlines in light mode. */
body {
  background-image:
    linear-gradient(rgba(242, 193, 78, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(242, 193, 78, 0.06) 1px, transparent 1px);
  background-size: 48px 48px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) body {
    background-image:
      linear-gradient(rgba(53, 208, 238, 0.07) 1px, transparent 1px),
      linear-gradient(90deg, rgba(53, 208, 238, 0.07) 1px, transparent 1px);
  }
}
:root[data-theme="dark"] body {
  background-image:
    linear-gradient(rgba(53, 208, 238, 0.07) 1px, transparent 1px),
    linear-gradient(90deg, rgba(53, 208, 238, 0.07) 1px, transparent 1px);
}

body.is-dragging { cursor: grabbing; user-select: none; -webkit-user-select: none; }

.wrap {
  width: 100%;
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  background: var(--ink);
  color: var(--white);
  padding: 10px 14px;
  border-radius: 10px;
  z-index: 50;
}
.skip-link:focus { top: 12px; }

a { color: var(--accent); }

button {
  font: inherit;
  color: inherit;
  cursor: pointer;
}

/* Header and hero. */
.hero-band {
  position: relative;
  background: radial-gradient(circle at 78% 30%, rgba(211, 38, 31, 0.35), transparent 42%), var(--hero);
  color: var(--hero-text);
  padding-bottom: 8px;
  overflow: hidden;
}
.hero-band::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    repeating-linear-gradient(180deg, rgba(53, 208, 238, 0.06) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 82% 50%, rgba(53, 208, 238, 0.18), transparent 28%);
}
.hero-band::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--gold), var(--green), transparent);
  pointer-events: none;
}
.topbar, .intro { position: relative; z-index: 1; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 14px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}
.brand .reactor { width: 48px; height: 48px; filter: drop-shadow(0 0 8px var(--glow)); }
.brand-words { display: flex; flex-direction: column; line-height: 1.05; }
.brand-words strong { font-family: var(--display); font-weight: 900; font-size: 22px; letter-spacing: 0.08em; }
.brand-words small { font-family: var(--display); font-size: 12px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.28em; }

.header-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.ghost, .link-button {
  background: transparent;
  border: 2px solid currentColor;
  border-radius: var(--radius-sm) 2px var(--radius-sm) 2px;
  padding: 8px 16px;
  font-weight: 700;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.hero-band .ghost, .hero-band .link-button { color: var(--hero-text); }
main .ghost, main .link-button { color: var(--ink-soft); }
.ghost.small { padding: 6px 12px; font-size: 15px; }

.primary {
  background: linear-gradient(180deg, var(--accent-soft), var(--accent));
  color: var(--white);
  border: 0;
  border-radius: var(--radius-sm) 2px var(--radius-sm) 2px;
  box-shadow: 0 5px 0 var(--accent-dark);
  font-family: var(--display);
  letter-spacing: 0.04em;
  padding: 12px 22px;
  font-weight: 800;
  font-size: 18px;
  min-height: 48px;
}
.primary.small { padding: 8px 16px; font-size: 16px; min-height: 40px; }
.primary:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-dark); }
.primary:focus-visible, .ghost:focus-visible, .tool:focus-visible, .puzzle-chip:focus-visible { outline: 3px solid var(--green); outline-offset: 3px; box-shadow: 0 0 0 6px var(--glow); }
.primary:disabled { opacity: 0.5; cursor: default; }

.intro {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr);
  gap: 28px;
  align-items: center;
  padding: 28px 0 12px;
}
.eyebrow, .instruction {
  margin: 0 0 6px;
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold-dark);
  font-weight: 400;
}
.intro h1 {
  font-family: var(--display);
  font-weight: 800;
  letter-spacing: -0.02em;
  font-size: clamp(30px, 4vw, 50px);
  line-height: 1.08;
  margin: 0 0 14px;
  text-transform: uppercase;
}
.intro h1 span { color: var(--accent); text-shadow: 0 0 18px rgba(230, 59, 49, 0.35); }
.lede { margin: 0 0 18px; color: var(--ink-soft); }

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.stats div {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
}
.stats strong { font-family: var(--mono); font-weight: 600; font-size: 32px; line-height: 1; color: var(--accent); }
.stats span { font-family: var(--mono); font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.16em; margin-top: 4px; }

.action-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 10px; }

/* Shells. */
.shell, .world, .palette, .workspace-card, .stage-card, .stats div { position: relative; border: 1px solid var(--line); }
.shell::before, .world::before, .stage-card::before, .workspace-card::before, .palette::before {
  content: "";
  position: absolute;
  inset: 8px;
  pointer-events: none;
  border-radius: 6px;
  background:
    linear-gradient(var(--gold-dark), var(--gold-dark)) top left / 22px 2px no-repeat,
    linear-gradient(var(--gold-dark), var(--gold-dark)) top left / 2px 22px no-repeat,
    linear-gradient(var(--gold-dark), var(--gold-dark)) bottom right / 22px 2px no-repeat,
    linear-gradient(var(--gold-dark), var(--gold-dark)) bottom right / 2px 22px no-repeat;
  opacity: 0.7;
}
.shell {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 22px 24px;
  box-shadow: var(--shadow);
  margin: 20px 0;
}
.shell-title { font-family: var(--display); font-weight: 700; letter-spacing: 0.02em; font-size: 22px; margin: 0 0 10px; line-height: 1.2; }
.path-head { margin: 26px 0 6px; }
.path-head .shell-title { margin-bottom: 0; }
.shell-title.small { font-size: 17px; }
.shell-note { color: var(--muted); font-size: 16px; margin: 6px 0; }
.field-label { display: block; font-weight: 700; margin: 12px 0 6px; }

.how-steps { margin: 0; padding-left: 22px; display: grid; gap: 8px; }

/* Worlds. */
.world-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 18px;
  margin: 10px 0 40px;
}
.world {
  background: var(--surface);
  border-radius: var(--radius-md);
  border-top: 10px solid var(--world);
  padding: 18px 20px 20px;
  box-shadow: var(--shadow);
}
.world-locked { opacity: 0.72; }
.world-number { font-family: var(--mono); font-size: 13px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--world-dark); }
.world-head h3 { font-family: var(--display); font-weight: 700; font-size: 19px; margin: 2px 0 4px; letter-spacing: 0.03em; }
.world-tagline { margin: 0 0 6px; color: var(--ink-soft); }
.world-progress { margin: 0 0 10px; font-size: 15px; color: var(--muted); font-weight: 600; }

.puzzle-list { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 8px; }
.puzzle-chip {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--line);
  background: var(--page);
  text-align: left;
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
}
.puzzle-chip.is-solved { border-color: var(--world); background: var(--surface); }
.puzzle-chip.is-solved .chip-meta { color: var(--gold-dark); }
.puzzle-chip.is-locked { color: var(--muted); cursor: default; }
.chip-meta { font-size: 15px; color: var(--gold-dark); letter-spacing: 0.08em; white-space: nowrap; }
.puzzle-chip.is-locked .chip-meta, .puzzle-chip:not(.is-solved) .chip-meta { color: var(--muted); }

/* Play screen. */
.play-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 22px 0 8px;
  flex-wrap: wrap;
}
.play-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.goal { margin: 4px 0 6px; font-size: 20px; max-width: 70ch; }
.ask-note { margin: 0 0 6px; color: var(--ink-soft); font-size: 16px; background: var(--tint-info); border-radius: var(--radius-sm); padding: 8px 12px; max-width: 70ch; }
.par-line { margin: 0; color: var(--muted); font-size: 15px; font-weight: 600; }

.lab {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 400px;
  gap: 16px;
  align-items: start;
}

.palette {
  min-width: 0;
  max-width: 100%;
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 10px;
  max-height: 680px;
  display: flex;
  flex-direction: column;
}
.palette-tabs { display: flex; flex-wrap: wrap; gap: 6px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.palette-tab {
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.cat-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.palette-body { overflow-y: auto; flex: 1 1 auto; min-width: 0; max-width: 100%; padding-top: 6px; overscroll-behavior: contain; }
.palette-heading { font-size: 15px; margin: 12px 0 4px; display: flex; align-items: center; gap: 8px; color: var(--ink-soft); }
.palette-item { margin: 8px 0; width: max-content; max-width: 100%; }
.make-variable {
  border: 0;
  background: #ff8c1a;
  color: var(--white);
  border-radius: 999px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 15px;
  margin: 4px 0 8px;
}

.workspace-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 10px;
  min-width: 0;
}
.workspace-toolbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; padding: 0 2px 8px; }
.block-count { font-size: 15px; color: var(--muted); font-weight: 600; }
.toolbar-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.tool {
  border: 1px solid var(--line);
  background: var(--page);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  font-size: 15px;
  font-weight: 600;
}
.tool:disabled { opacity: 0.45; cursor: default; }

.workspace {
  position: relative;
  height: 600px;
  overflow: auto;
  background: var(--ws-bg);
  border-radius: 12px;
  border: 1px solid var(--line);
  touch-action: pan-x pan-y;
}
.workspace:focus-visible { outline: 3px solid var(--gold); }
.ws-canvas { position: relative; width: 1600px; height: 1400px; min-width: 100%; }
.ws-canvas.is-empty::before {
  content: "Drag a block here, or tap one in the palette.";
  position: absolute;
  left: 24px;
  top: 24px;
  color: var(--muted);
  font-weight: 600;
}
.workspace-help { margin: 8px 2px 0; font-size: 15px; color: var(--muted); }

.script { position: absolute; display: flex; flex-direction: column; align-items: flex-start; }
.static-script { display: flex; flex-direction: column; align-items: flex-start; margin: 6px 0; }

/* Blocks. */
.block {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  width: max-content;
  max-width: 100%;
  color: var(--white);
  background: var(--block);
  border: 1px solid var(--block-dark);
  border-radius: 6px;
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}
.block-row { display: flex; align-items: center; gap: 6px; padding: 6px 12px; min-height: 42px; }
.label { white-space: nowrap; }

/* Bottom tab that hooks into the block below. */
.shape-stack::after, .shape-c::after, .shape-e::after, .shape-hat::after {
  content: "";
  position: absolute;
  left: 14px;
  bottom: -7px;
  width: 26px;
  height: 8px;
  background: var(--block);
  border: 1px solid var(--block-dark);
  border-top: 0;
  border-radius: 0 0 5px 5px;
  z-index: 1;
}
.script > .block + .block, .mouth-stack > .block + .block, .static-script > .block + .block { margin-top: 0; }
.script > .block, .mouth-stack > .block, .static-script > .block { margin-bottom: 1px; }

.shape-hat { border-radius: 26px 26px 6px 6px; }
.shape-hat .block-row { padding-top: 12px; }
.shape-cap { border-radius: 6px 6px 12px 12px; }

.mouth {
  align-self: stretch;
  margin-left: 16px;
  min-height: 34px;
  background: var(--ws-bg);
  border-radius: 6px 0 0 6px;
  padding: 4px 0 6px 0;
}
.in-palette .mouth, .drag-layer .mouth, .peek-blocks .mouth { background: var(--ws-bg); }
.mouth-stack { display: flex; flex-direction: column; align-items: flex-start; min-width: 90px; }
.block-foot { height: 22px; align-self: stretch; }
.block-row-else { min-height: 36px; }

.shape-reporter { border-radius: 999px; }
.shape-reporter .block-row { min-height: 32px; padding: 2px 10px; }
.shape-boolean {
  border-radius: 0;
  border: 0;
  clip-path: polygon(14px 0, calc(100% - 14px) 0, 100% 50%, calc(100% - 14px) 100%, 14px 100%, 0 50%);
}
.shape-boolean .block-row { min-height: 32px; padding: 2px 18px; }

.slot { display: inline-flex; align-items: center; min-height: 30px; }
.slot-filled { padding: 0; }
.field {
  font: inherit;
  font-weight: 600;
  color: #24292f;
  background: #ffffff;
  border: 0;
  height: 30px;
  padding: 0 10px;
  text-align: center;
  text-shadow: none;
  min-width: 42px;
}
.field-number { border-radius: 999px; }
.field-text { border-radius: 6px; }
.field:focus { outline: 3px solid var(--gold); }
.field-menu {
  appearance: none;
  -webkit-appearance: none;
  background: var(--block-dark) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='white' stroke-width='2'/%3E%3C/svg%3E") no-repeat right 10px center / 10px 7px;
  color: var(--white);
  border-radius: 999px;
  padding: 0 28px 0 12px;
  min-width: 60px;
  text-align: left;
}
.field-menu option { color: var(--ink); background: var(--surface); }
.slot-variable-name .variable-name { padding: 0 6px; font-weight: 600; }
/* Palette fields are read only, so taps pass through to the block and start a drag. */
.in-palette .field { pointer-events: none; }
.slot-boolean.slot-empty {
  width: 46px;
  height: 28px;
  background: var(--block-dark);
  clip-path: polygon(12px 0, calc(100% - 12px) 0, 100% 50%, calc(100% - 12px) 100%, 12px 100%, 0 50%);
}
.slot-hot .field, .slot-hot.slot-empty { outline: 3px solid var(--white); box-shadow: 0 0 0 5px rgba(255, 255, 255, 0.55); }
.slot-hot.slot-empty { background: #ffffff; }

.block.selected { outline: 3px solid var(--gold); outline-offset: 1px; }
.block.running { box-shadow: 0 0 0 3px var(--gold), 0 0 18px rgba(255, 204, 77, 0.7); filter: brightness(1.08); }
.in-palette { cursor: grab; }

.drag-layer {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  filter: drop-shadow(0 10px 18px rgba(27, 31, 59, 0.3));
  will-change: transform;
}
.drag-layer.will-delete { opacity: 0.45; }
.drop-marker {
  position: absolute;
  height: 8px;
  border-radius: 4px;
  background: rgba(27, 31, 59, 0.4);
  pointer-events: none;
  z-index: 5;
}

/* Stage. */
.stage-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 12px;
  min-width: 0;
}
.stage-controls { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 10px; }
.run { background: var(--green); box-shadow: 0 5px 0 var(--green-dark); padding: 10px 18px; }
.run:active { box-shadow: 0 2px 0 var(--green-dark); }
.stop, .check {
  border: 0;
  border-radius: var(--radius-sm) 2px var(--radius-sm) 2px;
  font-family: var(--display);
  letter-spacing: 0.04em;
  padding: 10px 18px;
  font-weight: 800;
  color: var(--white);
  font-size: 17px;
  min-height: 48px;
}
.stop { background: var(--red); box-shadow: 0 5px 0 #b83237; }
.stop:disabled { opacity: 0.45; cursor: default; }
.check { background: var(--orange); box-shadow: 0 5px 0 var(--orange-dark); color: var(--ink); }
.check:active, .stop:active { transform: translateY(3px); box-shadow: 0 2px 0 rgba(0, 0, 0, 0.35); }

.stage-holder {
  aspect-ratio: 4 / 3;
  max-width: 100%;
  background: var(--surface);
  border: 2px solid var(--line);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.stage-svg { display: block; width: 100%; height: 100%; }
.stage-grid line { stroke: var(--line); stroke-width: 0.6; }
.stage-axes line { stroke: var(--gold-dark); stroke-width: 1; opacity: 0.55; }
/* Jarvis glows: a soft reactor blue halo with a warm red edge, stronger while the pen is down. */
.naut-body { filter: drop-shadow(0 0 5px rgba(53, 208, 238, 0.85)) drop-shadow(0 0 14px rgba(230, 59, 49, 0.45)); }
.naut.pen-down .naut-body { filter: drop-shadow(0 0 6px var(--green)) drop-shadow(0 0 18px rgba(53, 208, 238, 0.7)); }
.stage-holder { background: radial-gradient(circle at 50% 50%, rgba(53, 208, 238, 0.06), transparent 70%), var(--surface); }
.star path { fill: var(--gold); stroke: #b8860b; stroke-width: 1.5; }
.star-collected path { fill: var(--green); stroke: var(--green-dark); }
.bubble-box { fill: var(--surface); stroke: var(--gold-dark); stroke-width: 1.5; }
.bubble-text { font: 700 13px var(--body); fill: var(--ink); }
.stage-readout { margin: 8px 2px 0; font-family: var(--mono); font-size: 14px; color: var(--muted); font-weight: 500; white-space: pre; }

.watchers { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.watcher {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--tint-info);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 4px 8px 4px 10px;
  font-size: 15px;
}
.watcher-name { font-weight: 700; color: var(--ink-soft); }
.watcher-value { background: #ff8c1a; color: var(--white); border-radius: 6px; padding: 1px 8px; font-family: var(--mono); font-weight: 600; min-width: 30px; text-align: center; }

.ask-form { margin-top: 10px; background: var(--tint-info); border-radius: 12px; padding: 10px 12px; }
.ask-form label { display: block; font-weight: 700; margin-bottom: 6px; }
.ask-row { display: flex; gap: 8px; }
.ask-row input { flex: 1 1 auto; min-width: 0; font: inherit; padding: 8px 12px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }

.said-log {
  margin: 10px 0 0;
  padding: 8px 12px 8px 32px;
  max-height: 130px;
  overflow-y: auto;
  background: var(--page);
  border-radius: var(--radius-sm);
  font-family: var(--mono);
  font-size: 14px;
  border: 1px solid var(--line);
}
.said-log li { padding: 1px 0; }

.feedback { margin-top: 10px; border-radius: 12px; padding: 12px 14px; font-size: 16px; }
.feedback p { margin: 0 0 6px; }
.feedback-win { background: var(--tint-win); border: 2px solid var(--green); box-shadow: 0 0 24px var(--glow); }
.feedback-try { background: var(--tint-try); border: 2px solid var(--accent); }
.feedback-note { background: var(--tint-note); border: 2px solid var(--gold); }
.feedback-win > p:first-child { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--green-dark); letter-spacing: 0.04em; text-transform: uppercase; }
.problem-list { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.celebrate .star-row { font-size: 34px; color: var(--gold-dark); letter-spacing: 4px; line-height: 1; }
.bolt-line { font-family: var(--mono); font-weight: 600; color: var(--gold-dark); }
.sandbox-note { margin: 10px 0 0; font-size: 15px; color: var(--muted); }

.play-extras { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 40px; }
.play-extras .mentor { order: -1; }

/* The mentor component ships at a 680px scene size; it is shown at just over half scale inside its card. */
.mentor .logic-armor-widget { zoom: 0.62; border-radius: 24px; overflow: hidden; }
.mentor [data-logic-armor] .clean-actor img { filter: drop-shadow(0 0 10px rgba(53, 208, 238, 0.8)) drop-shadow(0 0 28px rgba(230, 59, 49, 0.45)) drop-shadow(0 17px 13px rgba(0, 0, 0, 0.3)); }
.mentor [data-logic-armor] .clean-stage { min-height: 600px; }
.mentor [data-logic-armor] .clean-bubble { font-family: var(--body); font-size: 24px; }
@supports not (zoom: 0.5) {
  .mentor .logic-armor-widget { height: 420px; }
  .mentor [data-logic-armor] .clean-stage { transform: scale(0.62); transform-origin: top left; width: 161%; }
}
.hint-list { margin: 0 0 8px; padding-left: 22px; display: grid; gap: 6px; }
.hint-list li::marker { font-weight: 700; color: var(--accent); }
.peek { margin-top: 10px; }
.peek-blocks { overflow-x: auto; padding: 12px; background: var(--ws-bg); border-radius: 12px; }
.peek-blocks .block { cursor: default; }

/* Dialogs. */
.dialog {
  border: 0;
  border-radius: var(--radius-lg);
  padding: 0;
  max-width: min(720px, calc(100vw - 32px));
  width: 100%;
  box-shadow: var(--shadow);
  color: var(--ink);
}
.dialog::backdrop { background: rgba(27, 31, 59, 0.55); }
.dialog-body { padding: 24px 26px; max-height: 85vh; overflow-y: auto; }
.dialog h2 { font-family: var(--display); font-weight: 700; margin: 0 0 8px; font-size: 24px; }
.dialog h3 { margin: 16px 0 4px; font-size: 20px; }
.dialog input[type="text"] { font: inherit; width: 100%; padding: 10px 14px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); color: var(--ink); }
.card-tagline { font-size: 20px; color: var(--ink-soft); margin: 0 0 10px; }
.card-body p { margin: 0 0 10px; }

/* Footer. */
.site-footer { padding: 20px 20px 40px; color: var(--muted); font-size: 15px; }
.footer-row { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 16px; }
.footer-row p { margin: 0; }

.policy h1 { font-family: var(--display); font-weight: 700; font-size: 26px; margin: 0 0 8px; }
code { font-family: var(--mono); }
.policy h2 { font-size: 22px; margin: 18px 0 4px; }
code { background: var(--paper); padding: 2px 6px; border-radius: 6px; font-size: 0.9em; }

@media (hover: hover) {
  .ghost:hover, .link-button:hover { background: rgba(211, 38, 31, 0.12); }
  .puzzle-chip:not(:disabled):hover { border-color: var(--world); transform: translateY(-1px); }
  .tool:not(:disabled):hover, .palette-tab:hover { background: var(--tint-info); }
  .primary:hover { filter: brightness(1.05); }
}

@media (max-width: 1180px) {
  .play-extras { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .play-extras .mentor { grid-column: 1 / -1; order: 0; }
  .lab { grid-template-columns: minmax(0, 230px) minmax(0, 1fr); }
  .stage-card { grid-column: 1 / -1; }
  .stage-holder { max-width: 560px; }
}

@media (max-width: 820px) {
  .intro { grid-template-columns: 1fr; }
  .lab { grid-template-columns: minmax(0, 1fr); }
  .stage-card { order: -1; }
  .palette { max-height: none; }
  .palette-body { display: flex; gap: 14px; overflow-x: auto; overflow-y: hidden; padding-bottom: 8px; }
  .palette-group { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; }
  .palette-heading { margin: 0; }
  .palette-item { margin: 0; }
  .workspace { height: 420px; }
  .play-extras { grid-template-columns: minmax(0, 1fr); }
  .shell { padding: 18px; }
}

@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .stats strong { font-size: 28px; }
  .header-actions .ghost { padding: 6px 12px; font-size: 15px; }
  .brand .reactor { width: 40px; height: 40px; }
  .goal { font-size: 18px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
}
