:root {
  font-family:
    Inter,
    ui-sans-serif,
    system-ui,
    -apple-system,
    sans-serif;
  color: #e7ece5;
  background: #111b21;
  line-height: 1.5;
  --ink: #111b21;
  --line: #314149;
  --muted: #a9b8b9;
  --accent: #cce3aa;
  --panel: #19272e;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
a {
  color: #cce3aa;
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}
button,
select,
input {
  font: inherit;
}
button,
.button {
  border: 1px solid #4c6064;
  border-radius: 5px;
  color: #e7ece5;
  background: #263940;
  padding: 8px 11px;
  font-size: 12px;
  cursor: pointer;
  display: inline-block;
}
button:hover,
.button:hover {
  background: #365057;
  border-color: #a8c5a8;
}
button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
canvas:focus-visible,
summary:focus-visible {
  outline: 2px solid #d5eab6;
  outline-offset: 4px;
}
label {
  font-size: 12px;
  color: var(--muted);
}
input[type='checkbox'] {
  accent-color: var(--accent);
}
input[type='range'] {
  accent-color: var(--accent);
  width: 100px;
  vertical-align: middle;
}
.masthead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding: 21px 4vw;
  gap: 20px;
}
.wordmark {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #e7ece5;
  display: flex;
  align-items: center;
  gap: 12px;
}
.brand-icon {
  font-size: 27px;
  color: #cce3aa;
}
.edition {
  font-family: monospace;
  font-size: 10px;
  letter-spacing: 1px;
  color: #9cacae;
  font-weight: 400;
  border-left: 1px solid var(--line);
  padding-left: 18px;
  margin-left: 6px;
}
.masthead nav {
  display: flex;
  gap: 23px;
  font-size: 12px;
}
main {
  max-width: 1530px;
  margin: auto;
  padding: 0 4vw;
}
.scenario-panel {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
  gap: 28px;
  background: #1d2d33;
  border: 1px solid var(--line);
  border-bottom: 0;
  padding: 20px 24px;
  font-size: 12px;
}
.scenario-launch {
  display: flex;
  gap: 8px;
  margin-top: 7px;
}
.scenario-launch select {
  min-width: 0;
  flex: 1;
  padding: 7px;
  background: #25373e;
  color: var(--accent);
  border: 1px solid #4c6064;
  border-radius: 5px;
}
.scenario-launch button {
  flex-shrink: 0;
}
.scenario-choice p,
.scenario-run p {
  margin: 9px 0 0;
}
.scenario-goal {
  color: #d8e5c8;
}
.scenario-run details {
  margin-top: 10px;
  color: var(--muted);
}
.scenario-run summary {
  cursor: pointer;
}
.scenario-run details p {
  margin-bottom: 8px;
}
#history-canvas {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
  border-radius: 5px;
}
#history-position {
  width: min(100%, 280px);
}
#history-diff {
  max-height: 280px;
  overflow: auto;
}
.sound-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}
.sound-tools button {
  padding: 4px 7px;
  font-size: 11px;
}
.sound-tools input[type='range'] {
  width: 60px;
}
.sound-status {
  width: 100%;
  font-size: 10px;
  color: var(--muted);
}
#scene-explorer label {
  display: block;
  margin: 8px 0;
}
#scene-filter,
#scene-objects {
  width: 100%;
  min-width: 0;
  background: #25373e;
  color: var(--accent);
  border: 1px solid #4c6064;
  border-radius: 4px;
  padding: 6px;
}
.coordinate-controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 10px;
}
.coordinate-controls input {
  width: 70px;
  background: #25373e;
  color: var(--accent);
  border: 1px solid #4c6064;
  padding: 5px;
  border-radius: 4px;
}
.scenario-authoring {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}
.scenario-authoring label {
  display: grid;
  gap: 4px;
}
.scenario-authoring input,
.scenario-authoring textarea {
  width: 100%;
  min-width: 0;
  resize: vertical;
  background: #25373e;
  color: #e7ece5;
  border: 1px solid #4c6064;
  border-radius: 4px;
  padding: 6px;
  font: inherit;
}
@media (max-width: 700px) {
  .scenario-panel {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 16px;
  }
  .scenario-launch {
    flex-wrap: wrap;
  }
}
.intro {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 24px;
  margin: 37px 0 25px;
}
.eyebrow {
  font-family: monospace;
  letter-spacing: 1.5px;
  font-size: 10px;
  color: #b3c5b9;
  margin: 0 0 9px;
}
h1 {
  font-size: clamp(28px, 3vw, 42px);
  line-height: 1.1;
  letter-spacing: -1.5px;
  font-weight: 550;
  margin: 0;
}
h2 {
  font-size: 24px;
  line-height: 1.2;
  font-weight: 550;
  letter-spacing: -0.6px;
  margin: 0;
}
h3 {
  font-size: 15px;
  font-weight: 550;
  margin: 0 0 12px;
}
.intro > p {
  max-width: 380px;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.world-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 7px 7px 0 0;
  overflow: hidden;
}
.world-tab {
  background: #17242b;
  border: none;
  border-radius: 0;
  text-align: left;
  padding: 17px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.world-tab span:first-child {
  font: 11px monospace;
  opacity: 0.6;
}
.world-tab strong {
  display: block;
  font-weight: 550;
  font-size: 14px;
}
.world-tab small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin-top: 2px;
}
.world-tab[aria-current='true'] {
  background: #2e4140;
  box-shadow: inset 0 -3px var(--accent);
}
.workspace {
  display: grid;
  grid-template-columns: 290px minmax(0, 1fr);
  border: 1px solid var(--line);
  border-top: 0;
  background: var(--panel);
  min-height: 590px;
}
.mission {
  padding: 25px 22px;
  border-right: 1px solid var(--line);
}
.mission h2 {
  font-size: 25px;
}
.description {
  font-size: 12px;
  color: var(--muted);
  margin: 12px 0 18px;
}
.objective {
  background: #23353a;
  border-left: 2px solid #bcd39e;
  padding: 13px 12px;
  font-size: 12px;
}
.objective p {
  margin: 6px 0 0;
}
.objective .eyebrow {
  font-size: 9px;
}
.status-pill {
  display: inline-block;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: #d5eab6;
  border: 1px solid #576b56;
  padding: 4px 8px;
  border-radius: 3px;
  margin: 16px 0 9px;
}
.stats {
  display: grid;
  grid-template-columns: 1fr auto;
  font-size: 11px;
  margin: 0;
}
.stats dt {
  color: var(--muted);
  padding: 4px 0;
  border-bottom: 1px solid #31414980;
}
.stats dd {
  margin: 0;
  text-align: right;
  padding: 4px 0;
  border-bottom: 1px solid #31414980;
  font-variant-numeric: tabular-nums;
}
.selection {
  font-size: 12px;
  color: #c8d7d1;
}
.controls {
  display: grid;
  gap: 7px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.controls button {
  text-align: left;
  font-size: 11px;
  line-height: 1.35;
  min-height: 40px;
}
.controls button:first-child {
  background: #c5dbab;
  color: #182629;
  border-color: #c5dbab;
  font-weight: 600;
}
.feedback {
  font-size: 11px;
  color: #d6d5b4;
  min-height: 32px;
}
.scene-panel {
  min-width: 0;
  display: flex;
  flex-direction: column;
  position: relative;
  background: #182a32;
}
.scene-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid #ffffff0d;
  padding: 11px 17px;
  min-height: 51px;
  font: 10px monospace;
  color: #bdcac7;
}
.scene-toolbar > div {
  display: flex;
  align-items: center;
  gap: 8px;
}
.scene-toolbar button {
  padding: 4px 8px;
  font-size: 10px;
  background: transparent;
}
.scene-toolbar label {
  font-size: 10px;
}
.live-dot {
  display: inline-block;
  width: 5px;
  height: 5px;
  background: #cce3aa;
  border-radius: 50%;
  margin-right: 5px;
}
#scene {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1000/620;
  touch-action: none;
  flex: none;
  object-fit: contain;
  max-height: 750px;
}
.scene-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  padding: 12px 17px;
  font-size: 10px;
  color: #9eb4b5;
  min-height: 45px;
}
.scene-footer label {
  white-space: nowrap;
}
.session-bar {
  border: 1px solid var(--line);
  border-top: 0;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 25px;
  background: #17242a;
  border-radius: 0 0 7px 7px;
}
.session-bar > div:first-child {
  display: flex;
  gap: 15px;
  align-items: center;
  font-size: 12px;
}
.session-bar strong {
  font-weight: 550;
}
#journal-count {
  font: 10px monospace;
  color: var(--muted);
}
.button-row {
  display: flex;
  gap: 7px;
  align-items: center;
  flex-wrap: wrap;
}
.button-row a {
  font-size: 11px;
  margin-left: 7px;
}
.subtle {
  background: transparent;
}
.session-bar p {
  font-size: 10px;
  margin: 0;
  color: var(--muted);
  flex-basis: 100%;
}
.diagnostics {
  margin-top: 37px;
}
.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}
.section-heading h2 {
  font-size: 22px;
}
.diagnostic-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
.inspect-panel {
  background: #17242a;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 20px;
  min-width: 0;
}
.badge {
  display: inline-block;
  margin-left: 7px;
  font: 9px monospace;
  color: #cce3aa;
  padding: 3px 6px;
  border-radius: 3px;
  border: 1px solid #4b6354;
}
.badge.bad {
  color: #ffadc0;
  border-color: #985165;
}
.muted {
  color: var(--muted);
  font-size: 11px;
}
.art-selects {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 9px;
  margin: 17px 0;
}
.art-selects label {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 10px;
}
select {
  background: #223239;
  color: #dce6df;
  border: 1px solid #45565d;
  border-radius: 4px;
  padding: 7px;
  font-size: 11px;
  min-width: 0;
  width: 100%;
}
.art-preview {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 15px 0;
}
.art-preview canvas {
  width: 144px;
  height: 144px;
  border: 1px solid #45565d;
  border-radius: 4px;
  background: repeating-conic-gradient(#25363e 0% 25%, #30414a 0% 50%) 50%/24px 24px;
}
.art-preview > div {
  min-width: 0;
  font-size: 11px;
}
.animation-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 8px;
}
.animation-tools label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 65px;
  font-size: 10px;
}
.animation-tools button {
  min-height: 32px;
}
.animation-help {
  font-size: 11px;
  line-height: 1.6;
}
.mono,
pre {
  font-family: ui-monospace, SFMono-Regular, monospace;
  font-size: 10px;
  overflow-wrap: anywhere;
}
.mono {
  color: #d5eab6;
}
details {
  border-top: 1px solid var(--line);
  margin-top: 15px;
  padding-top: 12px;
}
summary {
  font-size: 11px;
  color: #b6c7c5;
  cursor: pointer;
}
pre {
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 250px;
  overflow: auto;
  background: #101d24;
  padding: 12px;
  border-radius: 4px;
  color: #b3c6ca;
  line-height: 1.7;
}
.diagnostic-results {
  padding-left: 17px;
  font-size: 11px;
  color: #c7d4c6;
  line-height: 1.8;
  min-height: 76px;
}
.diagnostic-results .bad {
  color: #ffadc0;
}
.error {
  position: absolute;
  inset: 70px 20px auto;
  background: #632e42;
  color: #ffe1e9;
  border: 1px solid #b06583;
  padding: 20px;
  font-size: 13px;
}
footer {
  display: flex;
  align-items: center;
  gap: 22px;
  flex-wrap: wrap;
  margin: 30px 0;
  font-size: 10px;
  color: #8ea5aa;
}
footer span {
  margin-right: auto;
}
@media (min-width: 1400px) {
  .workspace {
    grid-template-columns: 320px minmax(0, 1fr);
  }
  .mission {
    padding: 28px;
  }
}
@media (max-width: 1000px) {
  main {
    padding: 0 20px;
  }
  .edition {
    display: none;
  }
  .workspace {
    grid-template-columns: 245px minmax(0, 1fr);
  }
  .mission {
    padding: 18px 15px;
  }
  .scene-toolbar > div {
    flex-wrap: wrap;
  }
  .intro > p {
    max-width: 300px;
  }
  .scene-footer {
    flex-wrap: wrap;
  }
  .world-tab {
    padding: 15px 12px;
  }
  .world-tab strong {
    font-size: 12px;
  }
  .world-tab small {
    font-size: 9px;
  }
}
@media (max-width: 720px) {
  .masthead {
    padding: 15px 20px;
  }
  .masthead nav {
    gap: 13px;
    font-size: 10px;
  }
  .masthead nav a:last-child {
    display: none;
  }
  .intro {
    display: block;
    margin: 27px 0 20px;
  }
  .intro > p {
    max-width: 100%;
    margin-top: 14px;
  }
  .world-tabs {
    grid-template-columns: repeat(2, 1fr);
  }
  .workspace {
    display: flex;
    flex-direction: column;
  }
  .mission {
    order: 2;
    border-right: 0;
    border-top: 1px solid var(--line);
    padding: 20px;
  }
  .mission h2 {
    font-size: 23px;
  }
  .description {
    margin: 8px 0 13px;
  }
  .scene-panel {
    order: 1;
  }
  .controls {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .scene-toolbar {
    padding: 10px;
  }
  .scene-footer {
    padding: 10px;
    font-size: 9px;
  }
  .scene-footer label {
    font-size: 10px;
  }
  .scene-footer input {
    width: 70px;
  }
  .stats {
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 0 9px;
  }
  .diagnostic-grid {
    grid-template-columns: 1fr;
  }
  .section-heading {
    align-items: start;
  }
  .section-heading h2 {
    font-size: 19px;
  }
  .section-heading label {
    max-width: 120px;
    font-size: 10px;
  }
  .session-bar {
    padding: 15px;
  }
  .button-row {
    gap: 6px;
  }
  button,
  .button {
    padding: 8px;
    font-size: 11px;
  }
  .art-preview canvas {
    width: 120px;
    height: 120px;
  }
  .scene-toolbar label {
    font-size: 9px;
  }
  .scene-toolbar > div {
    gap: 5px;
  }
  .art-selects {
    grid-template-columns: 1.6fr 1fr 1fr;
  }
  main {
    padding: 0 12px;
  }
  .art-preview {
    gap: 12px;
  }
}

/* Derived game advice stays near the board and separate from developer diagnostics. */
.notebook {
  margin-top: 30px;
}
.notebook-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.notebook-card {
  background: #1b2b32;
  border: 1px solid var(--line);
  border-top: 2px solid #688b84;
  border-radius: 5px;
  padding: 17px;
  min-width: 0;
}
.notebook-card.success {
  border-top-color: #b4d998;
}
.notebook-card.warning {
  border-top-color: #d8b17c;
}
.notebook-card h3 {
  font-size: 13px;
  margin-bottom: 9px;
}
.notebook-card p {
  font-size: 11px;
  color: #b7c8c8;
  margin: 0;
}
.notebook-card dl {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  font-size: 10px;
  line-height: 1.5;
  gap: 6px 9px;
  margin: 12px 0 0;
}
.notebook-card dt {
  color: #b1c4c5;
}
.notebook-card dd {
  margin: 0;
  text-align: right;
  color: #e0e8d5;
  overflow-wrap: anywhere;
}
.board-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 13px 0;
}
.board-tools label {
  display: flex;
  align-items: center;
  gap: 6px;
}
.board-tools select {
  width: 75px;
}
.board-scroll {
  max-width: 100%;
  max-height: 490px;
  overflow: auto;
  border: 1px solid var(--line);
}
.board-scroll canvas {
  display: block;
  max-width: none;
}
.controls button[title] {
  text-decoration-thickness: 1px;
}
@media (max-width: 1050px) {
  .notebook-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 550px) {
  .notebook-grid {
    grid-template-columns: 1fr;
  }
  .notebook .section-heading {
    display: block;
  }
  .notebook .section-heading > p {
    margin-bottom: 0;
  }
  .notebook-card dl {
    grid-template-columns: 1fr 1fr;
  }
}

/* A reversible view choice; simulation and save controls stay in the same DOM. */
.play-view-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; font-size: 12px; }
.play-view-tools button[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); }
.motion-control { display: block; margin: 0 18px 12px; font-size: 12px; color: var(--muted); }
body.play-focused .diagnostics, body.play-focused .authoring-tools { display: none; }

.story-beat { margin: 18px 0; padding: 14px; border-left: 3px solid var(--accent); background: #22343a; }
.story-beat h3 { margin: 0 0 8px; font-size: 14px; color: var(--accent); }
.story-beat p { margin: 0; font-size: 13px; line-height: 1.65; color: #d3dfdc; }

[hidden] { display: none !important; }

#scene-actions:not(:empty) { padding: 12px 16px; border-top: 1px solid var(--line); background: var(--panel); }
#scene-actions .controls { margin: 0; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }

.scene-status { margin: 0; padding: 10px 16px; font-size: 13px; line-height: 1.6; color: #e9efd8; background: #22343a; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }

.story-beat button { margin-top: 12px; font-size: 11px; }
