@charset "UTF-8";

:root {
  font-family: Inter,ui-sans-serif,system-ui,-apple-system,BlinkMacSystemFont,"Apple SD Gothic Neo","Malgun Gothic",sans-serif;
  color: #edf7f7;
  background: #112a34;
  font-size: 16px;
  --ink: #173843;
  --mint: #9ae1ce;
  --gold: #ffc674;
  --line: #38515b;
  --muted: #aec5cb;
  --panel: #1c3742;
  --panel2: #23424c;
  --accent: #9ae1ce;
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
a,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: .45;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  border: 0;
}

button:focus-visible,
a:focus-visible {
  outline: 3px solid #ffc674;
  outline-offset: 2px;
  box-shadow: 0 0 0 2px #0b2530;
}

button {
  transition: background .15s,transform .15s,box-shadow .15s;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

a {
  color: inherit;
}

button[hidden],
[hidden] {
  display: none !important;
}

h1,
h2,
p {
  margin: 0;
}

h2 {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -.025em;
}

small {
  font-size: .8rem;
}

.topbar {
  max-width: 1584px;
  margin: auto;
  min-height: 92px;
  padding: 18px 32px;
  display: flex;
  align-items: center;
  gap: 28px;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  text-decoration: none;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -.04em;
  white-space: nowrap;
}

.brand svg {
  width: 43px;
  height: 43px;
}

.brand small {
  display: block;
  font-size: .63rem;
  letter-spacing: .17em;
  font-weight: 600;
  color: var(--muted);
  margin-top: 3px;
}

.hud {
  display: flex;
  align-items: center;
  gap: 26px;
  margin-left: auto;
}

.hud>span {
  white-space: nowrap;
}

.hud small {
  display: block;
  color: var(--muted);
  margin-bottom: 2px;
  font-size: .75rem;
}

.hud b {
  font-size: 1.05rem;
  font-variant-numeric: tabular-nums;
}

.day-pill {
  padding: 7px 12px;
  border: 1px solid #6b8b90;
  border-radius: 30px;
  color: var(--mint);
  font-size: .875rem;
}

/* Shown while this tab holds progress the browser storage does not: text, not colour alone, carries it. */
.save-badge {
  padding: 6px 11px;
  border: 1px dashed #f2c46d;
  border-radius: 30px;
  color: #ffe2a6;
  font-size: .8125rem;
  font-weight: 700;
  white-space: nowrap;
}
.save-badge::before {
  content: "! ";
}

nav {
  display: flex;
  gap: 12px;
  align-items: center;
}

.icon-button {
  padding: 8px 10px;
  color: #d5e7e9;
  background: transparent;
  border: 1px solid #47616b;
  border-radius: 7px;
  white-space: nowrap;
  font-size: .875rem;
}

.icon-button:hover {
  background: #304e59;
}

.quiet-link {
  color: var(--muted);
  text-underline-offset: 4px;
  font-size: .875rem;
}

.icon-button.light {
  color: #25434e;
  border-color: #788e8e;
  background: #ffffffa8;
}

.icon-button.light:hover {
  background: white;
}

main {
  max-width: 1584px;
  padding: 24px 32px 14px;
  margin: auto;
}

.mission {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 21px;
  gap: 20px;
}

.eyebrow {
  font-weight: 700;
  letter-spacing: .05em;
  color: var(--mint);
  margin-bottom: 6px;
  font-size: .75rem;
}

.mission h1 {
  font-size: clamp(1.35rem,2.1vw,1.9rem);
  letter-spacing: -.045em;
  line-height: 1.3;
}

.mission p:not(.eyebrow) {
  font-size: .9rem;
  color: var(--muted);
  margin-top: 8px;
  line-height: 1.5;
}

.mission-note {
  text-align: right;
  line-height: 1.7;
  font-size: .85rem;
  color: var(--muted);
}

.mission-note strong {
  color: #dcecee;
  font-weight: 500;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0,1fr) 282px;
  gap: 22px;
}

.workbench {
  min-width: 0;
}

.scene-shell {
  position: relative;
  border-radius: 18px;
  overflow: hidden;
  background: #bde2df;
  border: 1px solid #536d71;
  isolation: isolate;
}

.scene-toolbar {
  position: absolute;
  top: 15px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  z-index: 2;
  gap: 12px;
}

.scene-state {
  color: #25434e;
  background: #ffffffc9;
  border: 1px solid #ffffffa0;
  padding: 6px 10px;
  border-radius: 30px;
  box-shadow: 0 2px 12px #112a3410;
  font-size: .875rem;
}

.room-tabs {
  display: flex;
  gap: 3px;
  background: #173843;
  padding: 3px;
  border-radius: 8px;
}

.room-tabs button {
  color: #fff;
  background: transparent;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: .875rem;
}

.room-tabs button.active {
  background: #fff;
  color: #173843;
  box-shadow: 0 1px 8px #17384316;
}

#world, #labWorld {
  display: block;
  width: 100%;
  height: clamp(300px,31vw,438px);
  cursor: pointer;
  touch-action: pan-y;
}

.scene-caption {
  position: absolute;
  bottom: 13px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #12343d;
  gap: 12px;
  font-size: .8rem;
}

.scene-caption span {
  background: #ffffffd9;
  backdrop-filter: blur(8px);
  padding: 6px 10px;
  border-radius: 7px;
}

.scene-caption span:first-child {
  font-weight: 750;
}

.scene-caption span:last-child {
  max-width: 75%;
  text-align: right;
}

.floating-notice {
  position: absolute;
  top: 67px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  background: #173843e8;
  padding: 9px 16px;
  border-radius: 9px;
  font-size: .85rem;
  color: #f9fcfc;
  max-width: 90%;
  text-align: center;
  opacity: 0;
  transition: opacity .25s,transform .25s;
  pointer-events: none;
}

.floating-notice.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.tool-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 0 10px;
}

.tool-heading span {
  color: var(--muted);
  font-size: .75rem;
}

.tools {
  display: grid;
  grid-template-columns: repeat(6,minmax(0,1fr));
  gap: 8px;
}

.tool {
  padding: 10px 5px;
  position: relative;
  text-align: center;
  background: #213e49;
  border: 1px solid #49626b;
  border-radius: 10px;
  color: #eff7f8;
  min-height: 78px;
}

.tool:hover {
  background: #2e4b56;
}

.tool.selected {
  border-color: var(--tool-color);
  box-shadow: inset 0 0 0 1px var(--tool-color);
  background: #2b4c54;
}

.tool svg {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto 5px;
  color: var(--tool-color);
}

.tool strong {
  font-size: .875rem;
}

.tool small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  white-space: nowrap;
  font-size: .75rem;
}

.tool-key {
  position: absolute;
  top: 5px;
  left: 7px;
  color: #b4cbd2;
  font-size: .75rem;
}

.schedule-section {
  margin-top: 18px;
}

.schedule-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.text-button {
  color: var(--muted);
  background: none;
  padding: 5px 9px;
  border-radius: 5px;
  font-size: .875rem;
}

.text-button:hover {
  background: #2a4652;
  color: white;
}

.schedule-scroll {
  overflow: auto;
  padding: 3px 1px;
  scrollbar-width: thin;
  scrollbar-color: #7a9aa3 #0b222b;
  /* Edge shadows appear only on the side that still has more to scroll to. */
  background:
    linear-gradient(to right, #112a34 30%, #112a3400) left center / 28px 100% no-repeat local,
    linear-gradient(to left, #112a34 30%, #112a3400) right center / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, #9ae1ce66, #9ae1ce00) left center / 14px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, #9ae1ce66, #9ae1ce00) right center / 14px 100% no-repeat scroll;
}

.schedule {
  display: grid;
  grid-template-columns: 76px repeat(6,minmax(74px,1fr));
  gap: 6px;
  min-width: 580px;
  align-items: stretch;
}

.schedule .phase-head {
  padding: 7px 4px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 7px;
  color: #c4d9de;
  text-align: center;
  font-size: .875rem;
}

.phase-head span {
  display: block;
  color: #8daab4;
  margin-top: 2px;
  font-size: .75rem;
}

.phase-head.active {
  background: #35515b;
  border-color: #7798a0;
  color: white;
}

.phase-head.active span {
  color: #c1d6dc;
}

.row-label {
  display: flex;
  align-items: center;
  color: var(--muted);
  line-height: 1.3;
  font-size: .875rem;
}

.schedule-cell {
  min-height: 48px;
  background: #1c3843;
  border: 1px solid #6d8c95;
  border-left: 3px solid var(--cell-color);
  border-radius: 7px;
  padding: 7px 2px;
  color: #e3edef;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  position: relative;
  font-size: .875rem;
}

.schedule-cell svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--cell-color);
}

.schedule-cell.selected {
  box-shadow: inset 0 0 0 1px #e4f4ee;
  border-top-color: #a9cfc7;
  border-right-color: #a9cfc7;
  border-bottom-color: #a9cfc7;
}

.schedule-cell:hover {
  background: #34535e;
}

.schedule-cell.running {
  background: #46655f;
  box-shadow: 0 0 0 1px var(--mint);
}

.wall-button {
  padding: 7px 3px;
  border: 1px dashed #567681;
  border-radius: 6px;
  color: #a7c1c8;
  background: transparent;
  min-height: 35px;
  font-size: .875rem;
}

.wall-button.open {
  border-style: solid;
  border-color: #8dcbbc;
  background: #2b514f;
  color: #c8f7e8;
}

.wall-button:hover {
  background: #385462;
}

.schedule-hint {
  color: #91b1bc;
  line-height: 1.6;
  margin: 10px 0 0;
  font-size: .75rem;
  overflow-wrap: anywhere;
  word-break: keep-all;
}

.edit-status {
  margin: 0 0 10px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px dashed #ffc674;
  background: #ffc67418;
  color: #ffe2b0;
  font-size: .8rem;
  line-height: 1.55;
}

.edit-status::before {
  content: "잠김 · ";
  font-weight: 700;
}

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

.runbar {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 17px;
  padding-top: 15px;
  border-top: 1px solid var(--line);
}

.speed-buttons {
  display: flex;
  gap: 2px;
  background: #09222b;
  padding: 3px;
  border-radius: 7px;
}

.speed-buttons button {
  color: #aac5ce;
  background: transparent;
  border-radius: 5px;
  padding: 7px 9px;
  font-size: .875rem;
}

.speed-buttons button.active {
  background: #3a5b65;
  color: white;
}

.runbar>span {
  color: var(--muted);
  flex: 1;
  font-size: .75rem;
}

.primary {
  background: var(--mint);
  color: #113c37;
  font-weight: 800;
  border: 1px solid #bff3e5;
  border-radius: 10px;
  padding: 13px 22px;
  box-shadow: 0 4px 0 #639c8b;
  font-size: .95rem;
  white-space: nowrap;
}

.primary:hover {
  background: #b4f1df;
  box-shadow: 0 4px 0 #639c8b,0 0 0 3px #9ae1ce20;
}

.primary:focus-visible {
  box-shadow: 0 4px 0 #639c8b,0 0 0 2px #0b2530;
}

.primary:active {
  box-shadow: 0 2px 0 #639c8b;
}

.run-button span {
  color: #2b574a;
  font-weight: 600;
  margin-left: 14px;
  font-size: .75rem;
}

.inspector {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.inspector section {
  background: var(--panel);
  border: 1px solid #37535e;
  padding: 16px;
  border-radius: 13px;
}

.request-panel h2 {
  font-size: 1.1rem;
  margin-bottom: 13px;
}

.demand-row {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 8px 0;
  font-size: .875rem;
}

.demand-row svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.demand-row strong {
  margin-left: auto;
  font-variant-numeric: tabular-nums;
  font-size: .875rem;
}

.demand-row small {
  color: var(--muted);
  font-size: .75rem;
}

.small-copy {
  color: var(--muted);
  margin-top: 13px;
  padding-top: 12px;
  border-top: 1px solid #3d5762;
  font-size: .75rem;
  line-height: 1.7;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 7px;
  margin-bottom: 12px;
}

.panel-heading>span {
  color: var(--muted);
  text-align: right;
  font-size: .75rem;
}

.room-meters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.meter-label {
  display: flex;
  justify-content: space-between;
  margin-bottom: 6px;
  color: #ccdee2;
  font-size: .875rem;
}

.meter-track {
  height: 5px;
  background: #102a35;
  border-radius: 5px;
  overflow: hidden;
}

.meter-track>i {
  display: block;
  height: 100%;
  background: var(--bar);
  border-radius: 5px;
  transition: width .4s;
}

.cause-list {
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
  color: #bfd5db;
  font-size: .875rem;
  line-height: 1.7;
}

.cause-list li {
  margin: 8px 0;
  padding-left: 10px;
  border-left: 2px solid #5c8c91;
}

.forecast-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 8px 0;
  color: #bdd1d8;
  font-size: .875rem;
}

.forecast-row b {
  font-variant-numeric: tabular-nums;
  font-weight: 750;
  color: white;
}

.forecast-row .good {
  color: var(--mint);
}

.forecast-row .low {
  color: #ffc674;
}

#forecastHint,
#labForecastHint {
  color: #a7c2cb;
  border-top: 1px solid #3c5964;
  padding-top: 10px;
  margin-top: 11px;
  font-size: .75rem;
  line-height: 1.7;
}

.upgrade {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 10px 0;
  border-top: 1px solid #35515c;
}

.upgrade:first-child {
  padding-top: 0;
  border-top: 0;
}

.upgrade:last-child {
  padding-bottom: 0;
}

.upgrade strong {
  display: block;
  margin-bottom: 3px;
  font-size: .875rem;
}

.upgrade p {
  color: var(--muted);
  font-size: .75rem;
  line-height: 1.7;
}

.upgrade button {
  border: 1px solid #70978f;
  background: #2c504c;
  color: #c4f1df;
  border-radius: 7px;
  padding: 7px 9px;
  min-width: 52px;
  white-space: nowrap;
  font-size: .875rem;
}

.upgrade .owned {
  color: var(--mint);
  white-space: nowrap;
  font-size: .75rem;
}

footer {
  display: flex;
  justify-content: space-between;
  color: #829eaa;
  padding: 22px 0 4px;
  gap: 12px;
  font-size: .75rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: #081c27c9;
  backdrop-filter: blur(8px);
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.modal-card {
  width: min(650px,100%);
  background: #f3f8f4;
  color: #193b42;
  padding: 30px;
  border-radius: 20px;
  box-shadow: 0 25px 100px #0006;
  max-height: calc(100dvh - 48px);
  overflow: auto;
  position: relative;
}

.modal-card .eyebrow {
  color: #386660;
}

.modal-card h2 {
  font-size: clamp(1.5rem,2.7vw,2.1rem);
  letter-spacing: -.055em;
  line-height: 1.35;
  margin: 7px 0 13px;
}

.modal-card>p {
  font-size: .94rem;
  line-height: 1.85;
  color: #49616a;
}

.modal-card .intro-visual {
  height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin: 12px 0 20px;
}

.fold-icon {
  width: 64px;
  height: 64px;
  background: #d4e9df;
  display: grid;
  place-items: center;
  border-radius: 12px;
  border: 2px solid #71a99d;
  transform: rotate(-5deg);
}

.fold-icon:nth-child(2) {
  background: #f5dfb7;
  border-color: #d9ac64;
  transform: rotate(6deg);
}

.fold-icon:nth-child(3) {
  background: #ded6ef;
  border-color: #9c89bf;
  transform: rotate(-3deg);
}

.fold-icon svg {
  width: 36px;
  height: 36px;
}

.intro-rules {
  display: grid;
  gap: 14px;
  margin: 22px 0;
}

.intro-rule {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: .85rem;
  line-height: 1.65;
  color: #4b636a;
}

.intro-rule strong {
  color: #24474b;
}

.intro-rule>span:first-child {
  background: #d8eae1;
  border-radius: 6px;
  min-width: 29px;
  min-height: 29px;
  display: grid;
  place-items: center;
  font-weight: 800;
  color: #2f6a5c;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 25px;
}

.secondary {
  color: #315a5e;
  background: #e0ebe5;
  border: 1px solid #c2d6cc;
  border-radius: 9px;
  padding: 12px 17px;
  font-size: .85rem;
}

.modal-card .primary {
  font-size: .9rem;
}

.close-modal {
  position: absolute;
  right: 17px;
  top: 15px;
  width: 30px;
  height: 30px;
  background: #e0ebe5;
  color: #527070;
  border-radius: 50%;
  font-size: 1.2rem;
}

.result-grid {
  display: grid;
  grid-template-columns: repeat(3,1fr);
  gap: 10px;
  margin: 24px 0 18px;
}

.result-stat {
  padding: 14px;
  background: #e3eee7;
  border: 1px solid #ceded4;
  border-radius: 12px;
  text-align: center;
}

.result-stat small {
  display: block;
  color: #44606a;
  font-size: .71rem;
  margin-bottom: 7px;
}

.result-stat b {
  font-size: 1.5rem;
  color: #245650;
}

.result-stat.good {
  background: #d4eddf;
  border-color: #a3cbb8;
}

.result-stat.low {
  background: #f7e9d4;
  border-color: #dbc398;
}

.result-stat span {
  display: block;
  font-size: .65rem;
  color: #4d5f57;
  margin-top: 5px;
}

.lesson-list {
  padding-left: 20px;
  color: #49646a;
  line-height: 1.75;
  font-size: .86rem;
}

.lesson-list li {
  margin: 7px 0;
}

.modal-small {
  font-size: .74rem !important;
  color: #4a6469 !important;
  margin-top: 14px !important;
}

.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .82rem;
  margin-top: 18px;
}

.history-table td,
.history-table th {
  padding: 10px 5px;
  border-bottom: 1px solid #ccddd4;
  text-align: left;
}

.history-table th {
  color: #4a615c;
  font-weight: 600;
}

.history-table td:last-child {
  text-align: right;
}

.toast {
  position: fixed;
  bottom: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(15px);
  background: #eff8f1;
  color: #193b42;
  box-shadow: 0 8px 30px #0004;
  border: 1px solid #a9cabc;
  padding: 12px 20px;
  border-radius: 10px;
  z-index: 30;
  font-size: .85rem;
  pointer-events: none;
  opacity: 0;
  transition: .2s;
  text-align: center;
  max-width: 90vw;
}

.toast.visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

@media (min-width:1650px) {
  .game-layout {
    grid-template-columns: minmax(0,1fr) 310px;
  }
}

@media (max-width:1100px) {
  .topbar {
    gap: 16px;
    padding: 16px 22px;
  }

  .hud {
    gap: 16px;
  }

  main {
    padding: 22px;
  }

  .game-layout {
    grid-template-columns: minmax(0,1fr) 250px;
    gap: 16px;
  }

  .mission-note {
    display: none;
  }

  .scene-toolbar {
    left: 12px;
    right: 12px;
  }

  .room-tabs button {
    padding: 6px;
  }

  .inspector section {
    padding: 13px;
  }

  .runbar>span {
    display: none;
  }

  .run-button {
    margin-left: auto;
  }

  .schedule {
    grid-template-columns: 65px repeat(6,minmax(68px,1fr));
    min-width: 545px;
  }

  .tools {
    gap: 5px;
  }

  .scene-caption {
    left: 12px;
    right: 12px;
  }
}

/* Desktop density: applies on top of the 1100px adjustments above. */

@media (min-width:851px) {
  .topbar {
    min-height: 72px;
    padding-top: 12px;
    padding-bottom: 12px;
  }

  main {
    padding-top: 16px;
  }

  .mission {
    margin-bottom: 16px;
  }

  .mission p:not(.eyebrow) {
    margin-top: 5px;
  }

  #world, #labWorld {
    height: clamp(300px,25vw,350px);
  }

  .tool-heading {
    margin-top: 14px;
  }

  .tool {
    padding-top: 8px;
    padding-bottom: 8px;
  }

  .schedule-section {
    margin-top: 14px;
  }
}

@media (max-width:850px) {
  .topbar {
    flex-wrap: wrap;
    gap: 13px;
  }

  .hud {
    margin-left: auto;
  }

  .topbar nav {
    width: 100%;
    justify-content: flex-end;
    gap: 10px;
    padding-top: 4px;
    border-top: 1px solid #304c56;
  }

  .topbar nav .icon-button {
    padding: 5px 9px;
  }

  .game-layout {
    grid-template-columns: 1fr;
  }

  .inspector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }

  .inspector .request-panel {
    grid-row: span 1;
  }

  .tools {
    gap: 8px;
  }

  #world, #labWorld {
    height: 380px;
  }

  .runbar>span {
    display: block;
  }

  .mission h1 {
    font-size: 1.6rem;
  }

  .mission {
    margin-bottom: 17px;
  }
}

@media (max-width:540px) {
  .topbar {
    padding: 13px 16px;
  }

  .brand {
    font-size: 1.05rem;
    gap: 7px;
  }

  .brand svg {
    width: 35px;
    height: 35px;
  }

  .brand small {
    font-size: .56rem;
  }

  .hud {
    gap: 12px;
  }

  .hud b {
    font-size: .9rem;
  }

  .day-pill {
    padding: 5px 8px;
  }

  main {
    padding: 18px 13px 12px;
  }

  .mission h1 {
    font-size: 1.4rem;
  }

  .mission p:not(.eyebrow) {
    font-size: .8rem;
  }

  .scene-shell {
    border-radius: 12px;
  }

  #world, #labWorld {
    height: 300px;
  }

  .scene-toolbar {
    top: 10px;
    left: 10px;
    right: 10px;
    gap: 4px;
  }

  .scene-state {
    padding: 5px 7px;
    font-size: .75rem;
    max-width: 90px;
  }

  .room-tabs button {
    font-size: .75rem;
    padding: 5px;
  }

  .scene-toolbar .light {
    padding: 6px;
    font-size: .75rem;
  }

  .scene-caption {
    gap: 5px;
    left: 8px;
    right: 8px;
    font-size: .75rem;
  }

  .scene-caption span {
    padding: 5px 7px;
  }

  .scene-caption span:last-child {
    max-width: 62%;
  }

  .tools {
    grid-template-columns: repeat(3,minmax(0,1fr));
    gap: 7px;
  }

  .tool {
    display: grid;
    align-items: center;
    text-align: left;
    min-height: 62px;
    padding: 10px 8px;
    grid-template-columns: 27px 1fr;
  }

  .tool svg {
    margin: 0;
    width: 22px;
    height: 22px;
    grid-row: span 2;
  }

  .tool small {
    margin: 1px 0 0;
    font-size: .75rem;
  }

  .tool strong {
    font-size: .875rem;
  }

  .tool-key {
    display: none;
  }

  .tool-heading {
    align-items: flex-start;
  }

  .tool-heading span {
    max-width: 53%;
    text-align: right;
    line-height: 1.5;
  }

  .schedule {
    min-width: 570px;
  }

  .schedule-scroll {
    padding-bottom: 9px;
  }

  .runbar {
    flex-wrap: wrap;
  }

  .runbar>span {
    display: none;
  }

  .run-button {
    padding: 12px 16px;
  }

  .run-button span {
    display: none;
  }

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

  .inspector h2 {
    font-size: 1rem;
  }

  .request-panel h2 {
    font-size: 1rem;
  }

  .inspector section {
    padding: 16px;
  }

  .demand-row {
    gap: 6px;
    font-size: .875rem;
  }

  .demand-row svg {
    width: 17px;
  }

  .demand-row strong {
    font-size: 1rem;
  }

  .forecast-row {
    font-size: .875rem;
  }

  .panel-heading {
    align-items: flex-start;
    gap: 4px;
  }

  .panel-heading span {
    font-size: .59rem;
  }

  .room-meters {
    gap: 7px;
  }

  .cause-list {
    font-size: .875rem;
  }

  .upgrade {
    gap: 5px;
    align-items: flex-start;
  }

  .upgrade strong {
    font-size: .875rem;
  }

  .upgrade p {
    font-size: .875rem;
  }

  .upgrade button {
    padding: 6px;
    min-width: 40px;
    font-size: .875rem;
  }

  .small-copy {
    font-size: .875rem;
  }

  .modal-backdrop {
    padding: 14px;
  }

  .modal-card {
    padding: 25px 21px;
    border-radius: 17px;
    max-height: calc(100dvh - 28px);
  }

  .modal-card h2 {
    font-size: 1.65rem;
  }

  .modal-card>p {
    font-size: .85rem;
  }

  .result-grid {
    gap: 6px;
  }

  .result-stat {
    padding: 12px 6px;
  }

  .result-stat b {
    font-size: 1.25rem;
  }

  .modal-actions {
    gap: 9px;
  }

  .modal-actions button {
    padding: 11px 13px;
    font-size: .78rem;
  }

  .intro-rule {
    font-size: .8rem;
  }

  footer {
    line-height: 1.5;
    font-size: .75rem;
  }

  footer span:last-child {
    text-align: right;
  }

  .room-tabs {
    gap: 0;
  }

  .schedule-cell {
    font-size: .875rem;
  }

  .wall-button {
    font-size: .875rem;
  }

  .row-label {
    font-size: .875rem;
  }

  .panel-heading>span {
    font-size: .875rem;
  }

  #forecastHint,
  #labForecastHint {
    font-size: .875rem;
  }

  .modal-small {
    font-size: .8rem !important;
  }
}

/* Touch targets: at least 40px tall on narrow screens. */
@media (max-width:760px) {
  .icon-button,
  .room-tabs button,
  .text-button,
  .wall-button,
  .speed-buttons button,
  .upgrade button,
  .modal-actions button,
  .secondary {
    min-height: 40px;
  }

  .quiet-link,
  a.secondary {
    display: inline-flex;
    align-items: center;
    min-height: 40px;
  }

  .close-modal {
    width: 40px;
    height: 40px;
    right: 11px;
    top: 10px;
  }
}

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

/* Verdict text beside judged numbers (never color alone), result tables, rewind, practice */
.forecast-value {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.verdict {
  font-style: normal;
  font-size: .75rem;
  font-weight: 700;
}

.forecast-row .verdict.good,
.forecast-row .good {
  color: var(--mint);
}

.forecast-row .verdict.low {
  color: #ffc674;
}

.forecast-row b small,
.upgrade small {
  font-size: .72rem;
  font-weight: 400;
  color: var(--muted);
}

.upgrade-buy,
.upgrade .owned {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 3px;
}

.modal-card .verdict.good {
  color: #1c6a4f;
}

.modal-card .verdict.low {
  color: #8a4b00;
}

.result-stat .verdict {
  display: block;
  margin-top: 6px;
  font-size: .78rem;
}

.shortfall {
  margin: 4px 0 14px;
  font-size: .9rem;
  color: #2f4b52;
}

.shortfall.low strong {
  color: #8a4b00;
}

.rule-tag {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 999px;
  background: #e5dcc4;
  color: #5b4713;
  font-size: .7rem;
  font-weight: 700;
  vertical-align: middle;
}

.legacy-note,
.miss-note,
.rewind-warn {
  font-size: .85rem;
  line-height: 1.7;
  color: #4a6469;
  margin: 10px 0 0;
}

.rewind-warn {
  padding: 10px 12px;
  background: #f7e9d4;
  border-radius: 10px;
  color: #5a3a07;
}

.miss-note {
  color: #6b4208;
  text-align: right;
}

.secondary[aria-disabled="true"] {
  opacity: .5;
  cursor: default;
}

.table-scroll {
  overflow-x: auto;
  margin: 12px 0 10px;
  border-radius: 8px;
}

.table-scroll:focus-visible {
  outline: 3px solid #2f6a5c;
  outline-offset: 2px;
}

.phase-table,
.history-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .78rem;
  font-variant-numeric: tabular-nums;
}

.phase-table th,
.phase-table td,
.history-table th,
.history-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #ccddd4;
  text-align: left;
  vertical-align: top;
  color: #24474b;
}

.phase-table thead th,
.history-table thead th {
  color: #4a615c;
  font-weight: 600;
}

.phase-table td small,
.history-table td small {
  display: block;
  font-size: .72rem;
  color: #4a6469;
}

.phase-table td.cause {
  min-width: 190px;
  line-height: 1.55;
}

.phase-table td.neg {
  color: #8a4b00;
}

.history-table td:last-child {
  text-align: left;
}

.history-table tr.miss {
  background: #f7e9d4;
}

.history-table .rewind {
  display: block;
  margin-top: 6px;
  padding: 7px 10px;
  font-size: .78rem;
}

.practice-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin: 0 0 14px;
  padding: 10px 14px;
  border: 1px solid #ffc674;
  border-radius: 10px;
  background: #3a3322;
  color: #ffe2b0;
  font-size: .85rem;
}

.practice-bar[hidden] {
  display: none;
}

@media (max-width:540px) {
  .phase-table,
  .phase-table tbody,
  .phase-table tr,
  .phase-table th,
  .phase-table td,
  .history-table,
  .history-table tbody,
  .history-table tr,
  .history-table th,
  .history-table td {
    display: block;
  }

  .phase-table thead,
  .history-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
  }

  .phase-table tr,
  .history-table tr {
    padding: 8px 4px;
    border-bottom: 1px solid #ccddd4;
  }

  .phase-table th,
  .phase-table td,
  .history-table th,
  .history-table td {
    border: 0;
    padding: 2px 0;
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: .85rem;
  }

  .phase-table td::before,
  .history-table td::before {
    content: attr(data-label);
    color: #4a615c;
    flex: none;
  }

  .phase-table td.cause {
    display: block;
    min-width: 0;
  }

  .phase-table td.cause::before {
    display: block;
  }

  .phase-table th,
  .history-table th {
    font-weight: 700;
    font-size: .9rem;
  }

  .phase-table td small,
  .history-table td small {
    text-align: right;
  }

  .miss-note {
    text-align: left;
  }
}

@media (min-width:541px) {
  .phase-table th,
  .phase-table td:not(.cause) {
    white-space: nowrap;
  }

  .phase-table td small {
    white-space: normal;
  }

  .history-table th {
    min-width: 8.5em;
  }
}

/* Cell flow: start state -> capacity -> use -> end state, for the selected room and phase */
.flow {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 8px;
}

.flow-step {
  display: grid;
  grid-template-columns: 3.1rem minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  color: #d5e5e9;
  font-size: .875rem;
  line-height: 1.5;
}

.flow-tag {
  padding: 1px 0;
  border-radius: 6px;
  background: #14394a;
  color: #a9d3cc;
  font-size: .75rem;
  font-weight: 700;
  text-align: center;
}

.flow-step b {
  color: white;
  font-variant-numeric: tabular-nums;
}

.flow-step small {
  display: block;
  color: #aac4cb;
  font-size: .8125rem;
}

.flow-step small.inline {
  display: inline;
}

.flow-step .room-meters {
  margin: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  list-style: none;
  margin: 5px 0 2px;
  padding: 0;
}

.chips li {
  padding: 1px 8px;
  border: 1px solid #5c8c91;
  border-radius: 999px;
  color: #e6f1f2;
  font-size: .8125rem;
}

.why {
  margin-top: 4px;
}

.why summary {
  cursor: pointer;
  color: #a9d3cc;
  font-size: .8125rem;
}

.why summary:focus-visible {
  outline: 2px solid #ffc674;
  outline-offset: 2px;
}

.why ul {
  margin: 4px 0 0;
  padding-left: 1.1rem;
  font-size: .8125rem;
}

/* Debt (T18b): always spelled out in words; color only backs the text up. */
.hud .debt-tag {
  display: block;
  margin-top: 1px;
  color: #ffc674;
  font-size: .72rem;
  font-weight: 600;
  line-height: 1.3;
}

.upgrade .upgrade-reason {
  margin-top: 5px;
  color: #ffc674;
  font-size: .75rem;
  line-height: 1.6;
}

.upgrade button[aria-disabled="true"] {
  opacity: .55;
  cursor: not-allowed;
}

.cash-flow,
.debt-note {
  margin: 0 0 12px;
  font-size: .9rem;
  line-height: 1.7;
  color: #2f4b52;
}

.cash-flow b {
  font-variant-numeric: tabular-nums;
}

.cash-flow small {
  display: block;
  margin-top: 2px;
  color: #4a6469;
  font-size: .78rem;
}

.cash-flow .debt-word {
  color: #8a4b00;
  font-weight: 700;
}

.debt-note {
  padding: 10px 12px;
  background: #f7e9d4;
  border-radius: 10px;
  color: #5a3a07;
  font-size: .85rem;
}

.final-balance {
  margin: 14px 0 0;
}

/* Folding-table experiment (T15c) */
.lab-banner{align-items:flex-start}
.lab-banner-actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.lab-banner-actions .secondary{min-height:44px}
.lab-hud{gap:18px}
.lab-pill{border-color:var(--gold);color:var(--gold)}
.lab-heading{font-size:1.15rem;margin-bottom:8px}
.lab-lead{color:var(--muted);line-height:1.6;margin-bottom:16px;font-size:.9rem}
.lab-cards{display:grid;grid-template-columns:repeat(auto-fit,minmax(260px,1fr));gap:16px}
.lab-card{background:var(--panel);border:1px solid var(--line);border-radius:14px;padding:18px;display:flex;flex-direction:column;gap:10px;line-height:1.55;font-size:.9rem}
.lab-card h3{margin:0;font-size:1.1rem}
.lab-card-sub{color:var(--mint);font-size:.8rem}
.lab-facts{margin:0;padding-left:1.1rem;color:#d5e5e9;font-size:.85rem}
.lab-card-state{color:var(--gold);font-weight:600;font-size:.85rem}
.lab-card .primary{margin-top:auto;min-height:44px}
.lab-grid-section{margin-top:18px}
.lab-now{margin:0 0 10px;font-size:.9rem;color:#dcecee}
.lab-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:6px;max-width:560px}
.lab-cell{min-height:76px;padding:6px 4px;border-radius:8px;background:#1c3843;border:2px solid #6d8c95;color:#e3edef;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px;text-align:center;font-size:.8rem;line-height:1.3;position:relative;word-break:keep-all}
.lab-cell b{font-weight:700}
.lab-cell.kind-storage{border-style:dashed;border-width:3px}
.lab-cell.kind-door{border-style:dotted;border-width:3px;background:#2a3f3f}
.lab-cell.kind-counter{border-top-width:5px}
.lab-cell.kind-tools{border-bottom-width:5px}
.lab-cell.has-table{background:#6a5233;border-color:#ffc674;color:#fff6e0}
.lab-cell.has-table.part-l{border-right-style:dashed}
.lab-cell.has-table.part-r{border-left-style:dashed}
.lab-cell-table{font-weight:700;color:var(--gold)}
.lab-cell.cursor{box-shadow:inset 0 0 0 2px #e4f4ee}
.lab-cell[aria-disabled="true"]{opacity:.7}
.lab-cell.refused{border-color:#ff9c8a;background:#4a2a2a}
.lab-cell-no{font-style:normal;font-weight:700;color:#ffb4a6}
.lab-grid-help{margin:8px 0 0;font-size:.78rem;color:#91b1bc;line-height:1.5}
.lab-grid-status{margin:8px 0 0;padding:8px 12px;border-radius:8px;border:1px solid var(--line);background:#16303a;font-size:.85rem;line-height:1.55;min-height:2.6em}
.lab-grid-status.refused{border-color:#ff9c8a;color:#ffd6cd}
.lab-placements{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:8px;margin-top:12px}
.lab-place{min-height:64px;padding:8px;border-radius:9px;background:#1c3843;border:2px solid #47616b;color:#e3edef;text-align:left;display:flex;flex-direction:column;gap:3px;line-height:1.35}
.lab-place small{color:#aac4cb;font-size:.75rem}
.lab-place.current{border-color:var(--mint);background:#2b514f}
.lab-place[aria-disabled="true"]{opacity:.7}
.lab-here{font-size:.75rem;font-weight:700;color:var(--mint)}
.lab-fixed{margin-top:10px;font-size:.8rem;color:#91b1bc;line-height:1.6}
.lab-schedule{display:grid;grid-template-columns:repeat(6,minmax(0,1fr));gap:5px}
.lab-schedule .phase-head span{font-size:.65rem}
.lab-schedule .schedule-cell{flex-direction:column;gap:2px;min-height:56px;padding:6px 2px;font-size:.8rem}
.lab-cash-note{font-size:.78rem;color:#91b1bc;margin-top:6px;line-height:1.5}
.lab-chain{display:block;line-height:1.6}
.row-pick{background:#1c3843;color:#e3edef;border:1px solid #6d8c95;border-radius:6px;padding:8px 10px;min-height:40px}
.row-pick[aria-pressed="true"]{background:#35515b;border-color:var(--mint)}
.lab-row-detail{margin-top:12px;padding:12px;border:1px solid var(--line);border-radius:10px}
.lab-row-detail h3{margin:0 0 8px;font-size:.95rem}
@media (max-width:540px){
 .lab-banner{flex-direction:column;align-items:stretch}
 .lab-banner-actions{justify-content:flex-start}
 .lab-hud{flex-wrap:wrap;gap:8px}
 .lab-cell{min-height:84px;font-size:.78rem}
 .lab-placements{grid-template-columns:1fr}
 .lab-place{min-height:56px}
 .lab-schedule .phase-head{padding:6px 1px;font-size:.78rem}
 .lab-schedule .phase-head span{display:none}
 #labButton{padding:8px 10px;min-height:40px}
}
@media (max-width:760px){
 .lab-schedule .phase-head,.lab-grid-section .text-button,#labShortcut,#labSound{min-height:40px;min-width:40px}
}
.modal-card .row-pick{background:#e5efec;color:#173843;border:1px solid #8aa7a3;font-weight:700}
.modal-card .row-pick[aria-pressed="true"]{background:#cfe5dc;border-color:#2f7f6f}
.modal-card .lab-row-detail{border-color:#bcd0cb}
.lab-workbench{display:flex;flex-direction:column}
.lab-workbench .scene-shell{order:0}
@media (max-width:850px){
 .lab-workbench .lab-grid-section{order:-1;margin-top:0;margin-bottom:14px}
}

/* Campaign screens (T21): day brief, start, event, summary. Text states carry meaning; color only repeats it. */
.day-brief{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1fr);gap:18px;margin:0 0 20px;padding:16px 18px;background:var(--panel);border:1px solid #37535e;border-radius:13px}
.day-brief:empty{display:none}
.day-brief h2{font-size:1.05rem;margin-bottom:8px}
.day-question{color:#dcecee;line-height:1.6;margin:0 0 10px;font-size:.95rem}
.brief-facts,.diff-facts{margin:0;display:grid;gap:8px}
.brief-facts>div,.diff-facts>div{display:grid;grid-template-columns:7.5em minmax(0,1fr);gap:4px 10px;font-size:.84rem;line-height:1.6}
.brief-facts dt,.diff-facts dt{color:var(--muted);font-weight:600}
.brief-facts dd,.diff-facts dd{margin:0;color:#e6f2f2;overflow-wrap:anywhere}
.brief-facts small,.diff-facts small{display:block;color:var(--muted);font-size:.72rem}
.brief-facts code{background:#142f3a;padding:1px 6px;border-radius:5px;font-size:.78rem}
.brief-facts b.good{color:var(--mint)}
.brief-facts b.low{color:var(--gold)}
.violation{margin:10px 0 0;padding:9px 12px;border-radius:9px;background:#f7e9d4;color:#5a3a07;font-size:.84rem;line-height:1.6}
.table-title{margin:0 0 6px;font-weight:700;font-size:.8rem;color:#dcecee}
.demand-table{width:100%;border-collapse:collapse;font-size:.8rem;font-variant-numeric:tabular-nums}
.demand-table th,.demand-table td{padding:5px 6px;border-bottom:1px solid #3d5762;text-align:right}
.demand-table th:first-child{text-align:left}
.demand-table thead th,.demand-table tfoot th,.demand-table tfoot td{color:var(--muted);font-weight:600}
.demand-table tfoot th,.demand-table tfoot td{border-top:2px solid #3d5762;border-bottom:0}
.demand-table td.req{outline:2px solid var(--gold);outline-offset:-2px;font-weight:700}
.demand-table td.req small{display:block;font-size:.66rem;font-weight:600;color:var(--gold)}
.moves{margin-top:10px;font-size:.82rem}
.moves summary{cursor:pointer;color:var(--mint);padding:4px 0}
.move-list{margin:6px 0 0;padding-left:18px;line-height:1.7;color:#dcecee}
.story-view{max-width:1100px;margin:0 auto;padding-bottom:30px}
.story-head{margin-bottom:18px}
.story-head h1{font-size:clamp(1.4rem,2.4vw,2rem);letter-spacing:-.04em;line-height:1.3;margin:2px 0 8px}
.story-head h1:focus{outline:none}
.story-head h1:focus-visible{outline:3px solid #ffc674;outline-offset:4px}
.story-head p{color:var(--muted);line-height:1.6;font-size:.92rem;margin:6px 0}
.story-head .secondary{margin-top:6px}
.story-section{margin:0 0 18px;padding:16px 18px;background:var(--panel);border:1px solid #37535e;border-radius:13px}
.story-section h2{font-size:1.1rem;margin-bottom:8px}
.story-section .small-copy,.story-view .small-copy{color:var(--muted);font-size:.78rem;line-height:1.7;margin:6px 0;padding:0;border:0}
.story-section p{line-height:1.7;font-size:.9rem}
.card-tag{color:var(--gold);font-size:.82rem;margin:2px 0 10px}
.difficulty-set{display:grid;grid-template-columns:repeat(auto-fit,minmax(min(100%,300px),1fr));gap:12px;margin:12px 0}
.difficulty-card,.choice-card{background:#16303a;border:2px solid #38515b;border-radius:12px;padding:12px 14px;min-width:0}
.difficulty-card.selected,.choice-card.selected{border-color:var(--mint);background:#1a3a44}
.diff-head{display:flex;align-items:flex-start;gap:10px}
.diff-head input{width:22px;height:22px;margin-top:2px;accent-color:#9ae1ce;flex:none}
.diff-head label{display:flex;flex-wrap:wrap;gap:2px 8px;align-items:baseline;cursor:pointer;line-height:1.5;font-size:.92rem}
.diff-head label strong{font-size:1.02rem}
.diff-head label span{color:var(--muted)}
.diff-head label b{color:var(--gold);font-weight:700}
.pick-tag{font-style:normal;font-weight:700;color:var(--mint);font-size:.78rem}
.diff-head input:focus-visible{outline:3px solid #ffc674;outline-offset:2px}
.diff-body{margin-top:10px}
.diff-body .diff-facts>div{grid-template-columns:1fr}
.diff-body p{margin:6px 0}
.preview-day{margin:10px 0;padding:10px 12px;background:#12292f;border-radius:9px}
.preview-day h4{margin:0 0 4px;font-size:.88rem}
.preview-day p{font-size:.82rem;margin:4px 0}
.preview-label{color:var(--muted);font-size:.74rem !important}
.preview-day details{margin-top:6px;font-size:.82rem}
.preview-day summary{cursor:pointer;color:var(--mint);padding:3px 0}
.story-actions{display:flex;gap:12px;flex-wrap:wrap;justify-content:flex-end;margin-top:14px}
.story-view .story-actions .secondary{color:#315a5e}
.campaign-list{list-style:none;margin:10px 0 0;padding:0;display:grid;gap:8px}
.campaign-list li{display:flex;justify-content:space-between;align-items:center;gap:12px;padding:10px 12px;background:#16303a;border:1px solid #38515b;border-radius:10px}
.campaign-list li.current{border-color:var(--mint)}
.campaign-list li div{min-width:0}
.campaign-list strong,.campaign-list span,.campaign-list small{display:block}
.campaign-list span{font-size:.84rem;color:#dcecee}
.campaign-list small{font-size:.74rem;color:var(--muted)}
.story-view .rewind-warn{margin-top:12px}
.story-view .cash-flow{color:#e6f2f2}
.story-view .cash-flow small{color:var(--muted)}
.story-view .cash-flow .debt-word{color:var(--gold)}
.count-line{margin:10px 0 0;color:#e6f2f2}
.rule-tag-line{color:var(--muted)}
.summary-table{margin-top:4px}
.story-view .history-table th,.story-view .history-table td{border-bottom-color:#3d5762;color:#e6f2f2;vertical-align:top}
.story-view .history-table th{color:#dcecee}
.story-view .history-table thead th{color:var(--muted)}
.story-view .history-table td:last-child{text-align:left}
.story-view .history-table td small{display:block;color:var(--muted);font-size:.72rem}
.story-view .history-table tr.miss th:first-child,.story-view .history-table tr.ok th:first-child{border-left:4px solid transparent}
.story-view .history-table tr.ok th:first-child{border-left-color:var(--mint)}
.story-view .history-table tr.miss th:first-child{border-left-color:var(--gold)}
.story-view .history-table .detail-row td{padding-top:0}
.story-view .history-table details summary{cursor:pointer;color:var(--mint);font-size:.78rem;padding:4px 0}
.story-view .secondary,.day-brief .secondary{min-height:40px}
.grade-box{margin:12px 0;padding:12px 14px;background:#e3eee7;border:1px solid #ceded4;border-radius:12px}
.grade-box p{margin:4px 0 !important;font-size:.9rem !important;color:#193b42 !important;line-height:1.6}
.grade-box small{color:#4a6469}
.grade-box .grade-name{font-size:1.1rem;color:#245650}
.grade-box b.good{color:#1c6a4f}
.grade-box b.low{color:#8a4b00}
@media (max-width:900px){
  .day-brief{grid-template-columns:minmax(0,1fr)}
}
@media (max-width:540px){
  .brief-facts>div,.diff-facts>div{grid-template-columns:1fr}
  .campaign-list li{flex-direction:column;align-items:stretch}
  .story-actions{justify-content:stretch}
  .story-actions button{flex:1 1 100%}
  .story-view .history-table td[colspan]{display:block}
  .story-view .history-table td[colspan]::before{content:none}
}
.story-view .history-table tr.miss,.story-view .history-table tr.ok{background:transparent}
.story-actions .primary{white-space:normal;text-align:center;line-height:1.4}

/* M2 (T28): result branch screen, first-chapter route note, chapter rows of the summary */
.route-note{margin:12px 0;padding:10px 12px;border:1px solid rgba(127,150,150,.55);border-radius:10px;font-size:.84rem;line-height:1.65}
.route-note p{margin:4px 0;font-size:.84rem}
.route-note code,.route-case code,.branch-public code,.continue-section code,.story-view code{font-family:inherit;font-weight:700;padding:0 6px;border:1px solid rgba(127,150,150,.55);border-radius:6px;white-space:nowrap}
.route-cases{list-style:none;margin:8px 0 0;padding:0;display:grid;gap:8px}
.route-case{padding:10px 12px;background:#16303a;border:2px solid #38515b;border-radius:10px;min-width:0}
.route-case.is-this{border-color:var(--mint);background:#1a3a44}
.route-case p{margin:4px 0 0;color:#dcecee}
.route-cases.compact{gap:4px}
.route-cases.compact li{padding:4px 8px;border-left:3px solid rgba(127,150,150,.45);line-height:1.6}
.route-cases.compact li.is-this{border-left-color:currentColor;font-weight:600}
.route-cases.compact li span{display:block;font-weight:400;opacity:.85}
.this-tag{display:inline-block;font-style:normal;font-weight:700;font-size:.76rem;padding:0 8px;border:1px solid currentColor;border-radius:999px;color:var(--mint);white-space:normal}
.route-note .this-tag{color:inherit}
.branch-public{color:#e6f2f2 !important}
.branch-table td b{font-weight:700}
.branch-table td[colspan]{text-align:left}
.story-view .history-table tr.chapter-row th{padding:12px 4px 4px;border-bottom:2px solid #3d5762;font-size:.95rem;color:var(--mint);background:transparent;text-align:left}
.chapter-counts{list-style:none;margin:12px 0 0;padding:0;display:grid;gap:4px;font-size:.86rem;line-height:1.6;color:#e6f2f2}
.continue-section{border-color:var(--mint)}
.continue-section .story-actions{justify-content:flex-start}
.story-view code{font-size:.9em}
@media (max-width:540px){
  .story-view .history-table tr.chapter-row th{display:block}
  .branch-table td[colspan]{display:block}
  .branch-table td[colspan]::before{content:none}
}
@media (max-width:540px){
  .story-view .history-table td::before{color:var(--muted)}
}
.route-note .small-copy{color:inherit !important;opacity:.82}
