:root {
  color-scheme: light;
  --ink: #202a26;
  --ink-soft: #52615a;
  --paper: #f4f2eb;
  --paper-deep: #e9e6dc;
  --line: #d9d8cc;
  --forest: #285c4c;
  --forest-dark: #18362f;
  --moss: #aebd8f;
  --clay: #d5764e;
  --clay-pale: #f1d7c8;
  --viewer: #17211e;
  --viewer-edge: #26332e;
  --white: #fffefa;
  --font-ui: "Aptos", "Trebuchet MS", sans-serif;
  --font-display: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  --font-mono: "Cascadia Code", Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 14px;
  letter-spacing: 0;
}

button,
input {
  color: inherit;
  font: inherit;
  letter-spacing: 0;
}

button {
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 2px solid var(--clay);
  outline-offset: 3px;
}

.app-shell {
  display: grid;
  grid-template-rows: 70px minmax(0, 1fr);
  width: 100%;
  height: 100%;
  min-height: 0;
}

.topbar {
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.mode-switch {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: var(--paper);
}

.mode-button {
  min-width: 76px;
  height: 29px;
  padding: 0 10px;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
  transition: background-color 120ms ease, color 120ms ease;
}

.mode-button[aria-selected="true"] {
  background: var(--forest);
  color: var(--white);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border-radius: 2px;
  background: var(--forest);
  color: var(--white);
  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1;
}

.brand-copy {
  display: grid;
  gap: 2px;
}

.brand-copy strong {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 600;
  line-height: 1;
}

.brand-copy span,
.eyebrow,
.coverage-status,
.list-heading,
.sidebar-foot,
.footer-label,
.viewer-credit,
.stage-caption {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0;
}

.brand-copy span {
  color: var(--ink-soft);
  font-size: 9px;
}

.coverage-status {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 10px;
  color: var(--ink-soft);
  white-space: nowrap;
}

.status-light,
.placement-dot {
  width: 7px;
  height: 7px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: var(--clay);
}

.status-divider {
  width: 1px;
  height: 14px;
  background: var(--line);
}

.workspace {
  display: grid;
  grid-template-columns: 304px minmax(0, 1fr);
  min-height: 0;
}

.scene-sidebar {
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 26px 18px 14px;
  border-right: 1px solid var(--line);
  background: var(--paper);
}

.sidebar-heading {
  padding: 0 10px 23px;
}

.eyebrow {
  color: var(--forest);
  font-size: 9px;
}

.sidebar-heading h2 {
  margin: 7px 0 0;
  font-family: var(--font-display);
  font-size: 27px;
  font-weight: 500;
  line-height: 1.05;
}

.sidebar-heading p {
  margin: 6px 0 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.search-label {
  margin: 0 10px 7px;
  color: var(--ink-soft);
  font-size: 11px;
  font-weight: 600;
}

.chapter-filter {
  width: calc(100% - 4px);
  height: 38px;
  margin: 0 2px 15px;
  padding: 0 10px;
  border: 1px solid #cecec2;
  border-radius: 3px;
  background: var(--white);
  color: var(--ink);
  font-size: 12px;
}

.chapter-filter:focus-visible {
  border-color: var(--forest);
}

.search-box {
  display: flex;
  height: 40px;
  align-items: center;
  gap: 9px;
  margin: 0 2px 23px;
  padding: 0 10px;
  border: 1px solid #cecec2;
  border-radius: 3px;
  background: var(--white);
}

.search-box:focus-within {
  border-color: var(--forest);
  box-shadow: 0 0 0 1px var(--forest);
}

.search-mark {
  color: var(--forest);
  font-family: var(--font-display);
  font-size: 23px;
  line-height: 1;
  transform: rotate(-20deg);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 12px;
}

.search-box input::placeholder {
  color: #8c948d;
}

.search-box kbd {
  display: grid;
  width: 20px;
  height: 21px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
}

.list-heading {
  display: flex;
  justify-content: space-between;
  padding: 0 10px 9px;
  color: var(--ink-soft);
}

.scene-list {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 3px;
  overflow: auto;
  padding: 0 2px 10px;
  scrollbar-color: #b7bbae transparent;
  scrollbar-width: thin;
}

.scene-item {
  display: grid;
  min-height: 56px;
  grid-template-columns: 28px minmax(0, 1fr) 16px;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  text-align: left;
  transition: background-color 140ms ease, border-color 140ms ease;
}

.scene-item:hover {
  border-color: var(--line);
  background: #eeece3;
}

.scene-item[aria-current="true"] {
  border-color: #bdd0c3;
  background: #e5ece5;
}

.scene-index {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid #d4d5c9;
  border-radius: 50%;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
}

.scene-item[aria-current="true"] .scene-index {
  border-color: var(--forest);
  background: var(--forest);
  color: var(--white);
}

.scene-item-copy {
  display: grid;
  min-width: 0;
  gap: 4px;
}

.scene-item-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-item-area {
  color: #737e75;
  font-family: var(--font-mono);
  font-size: 9px;
}

.scene-item-arrow {
  color: #9ba49b;
  font-size: 16px;
  opacity: 0;
  transform: translateX(-3px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.scene-item:hover .scene-item-arrow,
.scene-item[aria-current="true"] .scene-item-arrow {
  opacity: 1;
  transform: translateX(0);
}

.empty-results {
  padding: 20px 10px;
  color: var(--ink-soft);
  font-size: 12px;
}

.connections-panel {
  flex: 0 0 auto;
  max-height: 190px;
  margin: 5px 2px 8px;
  overflow: hidden;
  border-top: 1px solid var(--line);
}

.connections-panel[hidden] {
  display: none;
}

.connections-summary {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  color: var(--ink-soft);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  list-style: none;
}

.connections-summary::-webkit-details-marker {
  display: none;
}

.connections-summary::after {
  color: var(--forest);
  content: "+";
  font-family: var(--font-ui);
  font-size: 15px;
}

.connections-panel[open] .connections-summary::after {
  content: "-";
}

.transition-list {
  display: grid;
  max-height: 148px;
  gap: 3px;
  overflow: auto;
  padding: 0 2px 5px;
  scrollbar-color: #b7bbae transparent;
  scrollbar-width: thin;
}

.transition-row {
  display: grid;
  min-height: 37px;
  grid-template-columns: minmax(0, 1fr) 28px;
  align-items: center;
  gap: 6px;
  padding: 3px 5px 3px 8px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: rgba(255, 254, 250, 0.72);
}

.transition-link {
  width: 100%;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.transition-link:hover {
  border-color: #9caf9e;
  background: #e8eee7;
}

.transition-copy {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.transition-route {
  overflow: hidden;
  color: var(--ink);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.transition-kind {
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 8px;
}

.delete-transition {
  display: grid;
  width: 27px;
  height: 27px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 3px;
  background: transparent;
  color: #9a513e;
  font-size: 17px;
  line-height: 1;
}

.delete-transition:hover {
  border-color: #ddb6a8;
  background: #f3e2da;
  color: #713b2c;
}

.no-transitions {
  padding: 7px 6px 9px;
  color: var(--ink-soft);
  font-size: 10px;
}

.sidebar-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: auto;
  padding: 12px 9px 0;
  color: #78837a;
  font-size: 8px;
  white-space: nowrap;
}

.foot-rule {
  width: 16px;
  height: 2px;
  background: var(--clay);
}

.sidebar-foot span:last-child {
  margin-left: auto;
}

.viewer-panel {
  display: grid;
  min-width: 0;
  min-height: 0;
  grid-template-rows: 92px minmax(0, 1fr) 46px;
  padding: 0 24px 12px;
  background: var(--paper);
}

.scene-header {
  display: flex;
  min-width: 0;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.scene-heading {
  min-width: 0;
}

.scene-heading h1 {
  overflow: hidden;
  margin: 4px 0 0;
  font-family: var(--font-display);
  font-size: 25px;
  font-weight: 500;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.scene-subtitle {
  margin: 5px 0 0;
  color: var(--ink-soft);
  font-size: 11px;
}

.scene-actions {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 15px;
}

.world-tools {
  display: flex;
  align-items: center;
  gap: 6px;
}

.world-tools[hidden] {
  display: none;
}

.tool-button {
  display: inline-flex;
  height: 33px;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  color: var(--forest-dark);
  font-size: 10px;
  font-weight: 600;
  white-space: nowrap;
}

.tool-button:hover,
.tool-button[aria-pressed="true"] {
  border-color: var(--forest);
  background: #e5ece5;
}

.tool-button span:first-child {
  color: var(--clay);
  font-size: 15px;
}

.transition-type {
  width: 105px;
  height: 33px;
  padding: 0 6px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  font-size: 10px;
}

.one-way-option {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  color: var(--ink-soft);
  font-size: 9px;
  white-space: nowrap;
}

.one-way-option input {
  accent-color: var(--forest);
}

.draft-status {
  color: #77837a;
  font-family: var(--font-mono);
  font-size: 8px;
  white-space: nowrap;
}

.transition-tools[hidden] {
  display: none;
}

.placement-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
}

.placement-dot {
  width: 6px;
  height: 6px;
  background: var(--clay);
}

.copy-link {
  display: inline-flex;
  height: 34px;
  align-items: center;
  gap: 7px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 3px;
  background: var(--white);
  color: var(--forest-dark);
  font-size: 11px;
  font-weight: 600;
  transition: border-color 140ms ease, background-color 140ms ease;
}

.copy-link[hidden] {
  display: none;
}

.copy-link:hover {
  border-color: var(--forest);
  background: #edf2ec;
}

.copy-link span:first-child {
  color: var(--clay);
  font-size: 15px;
}

.viewer-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--viewer-edge);
  border-radius: 3px;
  background-color: var(--viewer);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
}

.osd-viewer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  outline: 0;
}

.transition-layer {
  position: absolute;
  z-index: 1;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

.transition-line {
  fill: none;
  stroke: #f2a17a;
  stroke-width: 2;
  stroke-dasharray: 6 5;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.8));
}

.transition-endpoint {
  fill: var(--clay);
  stroke: var(--white);
  stroke-width: 2;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.75));
}

.transition-endpoint.is-pending {
  fill: var(--moss);
}

.world-scene-label {
  max-width: 190px;
  overflow: hidden;
  padding: 4px 7px;
  border: 1px solid rgba(239, 239, 223, 0.55);
  border-radius: 2px;
  background: rgba(24, 38, 32, 0.92);
  color: #f4f2eb;
  font-family: var(--font-mono);
  font-size: 9px;
  line-height: 1.3;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.world-scene-label.is-selected {
  border-color: #ef9a72;
  box-shadow: 0 0 0 1px #ef9a72;
}

.world-count {
  color: var(--moss);
}

.viewer-message {
  position: absolute;
  z-index: 3;
  top: 50%;
  left: 50%;
  display: flex;
  max-width: calc(100% - 32px);
  align-items: center;
  gap: 11px;
  padding: 12px 15px;
  border: 1px solid rgba(196, 208, 193, 0.25);
  border-radius: 3px;
  background: rgba(23, 33, 30, 0.92);
  color: #e6e9dc;
  font-size: 12px;
  pointer-events: none;
  transform: translate(-50%, -50%);
}

.viewer-message[hidden] {
  display: none;
}

.loading-mark {
  width: 14px;
  height: 14px;
  flex: 0 0 auto;
  border: 2px solid rgba(230, 233, 220, 0.28);
  border-top-color: var(--moss);
  border-radius: 50%;
  animation: turn 800ms linear infinite;
}

.viewer-message.is-error .loading-mark {
  border: 0;
  border-radius: 0;
  background: var(--clay);
  animation: none;
  clip-path: polygon(50% 0, 100% 100%, 0 100%);
}

.navigator-frame {
  position: absolute;
  z-index: 2;
  top: 15px;
  right: 15px;
  width: 162px;
  height: 104px;
  overflow: hidden;
  border: 1px solid rgba(239, 239, 223, 0.36);
  border-radius: 2px;
  background: rgba(23, 33, 30, 0.75);
  opacity: 0.88;
}

.navigator {
  width: 100%;
  height: 100%;
}

.navigator .openseadragon-container {
  background: transparent !important;
}

.viewer-controls {
  position: absolute;
  z-index: 3;
  right: 15px;
  bottom: 15px;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 4px;
  border: 1px solid rgba(228, 235, 218, 0.22);
  border-radius: 3px;
  background: rgba(23, 33, 30, 0.94);
}

.viewer-control {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 0;
  border-radius: 2px;
  background: transparent;
  color: #edf1e5;
  font-family: var(--font-ui);
  font-size: 22px;
  line-height: 1;
  transition: background-color 120ms ease, color 120ms ease;
}

.viewer-control:hover {
  background: var(--forest);
  color: var(--white);
}

.fit-control {
  font-family: var(--font-display);
  font-size: 21px;
}

.control-divider {
  width: 1px;
  height: 21px;
  margin: 0 2px;
  background: rgba(228, 235, 218, 0.24);
}

.stage-caption {
  position: absolute;
  z-index: 2;
  bottom: 18px;
  left: 17px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(238, 240, 226, 0.68);
  font-size: 8px;
}

.caption-mark {
  width: 6px;
  height: 6px;
  border: 1px solid var(--moss);
  transform: rotate(45deg);
}

.scene-footer {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 28px;
  color: var(--ink-soft);
}

.image-dimensions,
.connection-summary {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.footer-label {
  color: #818a80;
  font-size: 8px;
}

#scene-dimensions,
#transition-count {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 10px;
}

.viewer-credit {
  margin-left: auto;
  color: #818a80;
  font-size: 8px;
}

.layer-controls {
  position: absolute;
  z-index: 5;
  top: 14px;
  left: 14px;
  width: min(260px, calc(100% - 28px));
  max-height: calc(100% - 28px);
  color: #f4f2eb;
  font-size: 11px;
}

.layer-controls summary {
  display: flex;
  min-height: 34px;
  align-items: center;
  justify-content: space-between;
  padding: 0 11px;
  border: 1px solid rgba(239, 239, 223, 0.28);
  border-radius: 3px;
  background: rgba(23, 33, 30, 0.94);
  cursor: pointer;
  font-family: var(--font-mono);
  font-size: 9px;
  list-style: none;
}

.layer-controls summary::-webkit-details-marker { display: none; }
.layer-controls summary::after { color: var(--moss); content: "+"; font-size: 16px; }
.layer-controls[open] summary::after { content: "-"; }

.layer-menu {
  max-height: min(430px, calc(100% - 40px));
  margin-top: 3px;
  overflow: auto;
  padding: 12px;
  border: 1px solid rgba(239, 239, 223, 0.24);
  border-radius: 3px;
  background: rgba(23, 33, 30, 0.96);
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.24);
}

.layer-heading {
  margin-bottom: 8px;
  color: #b7c3a8;
  font-family: var(--font-mono);
  font-size: 8px;
}

.layer-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 7px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(239, 239, 223, 0.18);
}

.layer-toggles label,
.layer-option {
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 6px;
  color: #e2e6da;
  font-size: 10px;
  cursor: pointer;
}

.layer-toggles input,
.layer-option input {
  width: 13px;
  height: 13px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--moss);
}

.poi-swatch {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border: 1px solid rgba(255, 255, 255, 0.65);
  border-radius: 50%;
  background: var(--poi-color);
}

.layer-option { margin-top: 10px; }

.poi-authoring {
  display: flex;
  gap: 6px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(239, 239, 223, 0.18);
}

.poi-authoring[hidden] { display: none; }

.poi-authoring select {
  min-width: 0;
  height: 33px;
  flex: 1 1 auto;
  padding: 0 6px;
  border: 1px solid rgba(239, 239, 223, 0.28);
  border-radius: 3px;
  background: #25332e;
  color: #f4f2eb;
  font: inherit;
  font-size: 10px;
}

.poi-authoring .tool-button {
  flex: 0 0 auto;
  border-color: rgba(239, 239, 223, 0.28);
  background: #25332e;
  color: #f4f2eb;
}

.poi-authoring .tool-button[aria-pressed="true"] {
  border-color: var(--moss);
  background: #365344;
}

.poi-instructions {
  margin: 9px 0 0;
  color: #c9d4c0;
  font-size: 10px;
  line-height: 1.4;
}

.poi-instructions[hidden] { display: none; }

.world-scene-label[hidden] { display: none; }

.poi-marker {
  position: relative;
  z-index: 4;
  display: grid;
  width: 25px;
  height: 25px;
  place-items: center;
  border: 2px solid rgba(255, 254, 250, 0.94);
  border-radius: 50%;
  background: var(--poi-color);
  box-shadow: 0 1px 8px rgba(0, 0, 0, 0.55);
  color: #17211e;
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

button.poi-marker { padding: 0; cursor: pointer; }
button.poi-marker:hover { z-index: 1; transform: scale(1.17); }
.poi-chest { --poi-color: #edbd61; }
.poi-monster { --poi-color: #ed7165; }
.poi-boss { --poi-color: #f19152; }
.poi-shop { --poi-color: #6dceaa; }
.poi-interactible { --poi-color: #83bce1; }
.poi-corrupted-spot { --poi-color: #d49ce4; }
.poi-npc { --poi-color: #d9dfc8; }

.public-atlas {
  display: grid;
  grid-template-rows: 64px minmax(0, 1fr);
}

.public-header {
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--white);
}

.public-status {
  display: flex;
  align-items: center;
  gap: 9px;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 9px;
  white-space: nowrap;
}

.public-status .status-light { background: var(--forest); }

.public-stage {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border-top: 1px solid var(--viewer-edge);
  background-color: var(--viewer);
  background-image: linear-gradient(135deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%),
    linear-gradient(315deg, rgba(255, 255, 255, 0.018) 25%, transparent 25%);
  background-position: 0 0, 12px 12px;
  background-size: 24px 24px;
}

.public-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  outline: 0;
}

.public-map .openseadragon-container { background: transparent !important; }

#public-transition-layer[hidden] { display: none; }

.public-caption {
  position: absolute;
  z-index: 2;
  bottom: 18px;
  left: 17px;
  display: flex;
  align-items: center;
  gap: 7px;
  color: rgba(238, 240, 226, 0.68);
  font-family: var(--font-mono);
  font-size: 8px;
}

@media (max-width: 760px) {
  .public-atlas { grid-template-rows: 58px minmax(0, 1fr); }
  .public-header { padding: 0 14px; }
  .public-header .brand { gap: 9px; }
  .public-header .brand-mark { width: 32px; height: 32px; font-size: 20px; }
  .public-header .brand-copy strong { font-size: 18px; }
  .public-header .brand-copy span { font-size: 8px; }
  .public-status { gap: 6px; font-size: 8px; }
  .public-stage .layer-controls { top: 9px; left: 9px; width: min(250px, calc(100% - 18px)); }
  .public-stage .navigator-frame { top: 9px; right: 9px; width: 112px; height: 75px; }
  .public-stage .viewer-controls { right: 9px; bottom: 9px; }
  .public-stage .viewer-control { width: 31px; height: 31px; }
  .public-caption { bottom: 17px; left: 10px; font-size: 7px; }
}

@media (max-width: 420px) {
  .public-status { max-width: 125px; overflow: hidden; text-overflow: ellipsis; }
}

.transition-marker {
  position: relative;
  z-index: 4;
  display: grid;
  width: 29px;
  height: 29px;
  place-items: center;
  border: 2px solid var(--white);
  border-radius: 50%;
  background: var(--clay);
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.38);
  color: var(--white);
  font-size: 15px;
  font-weight: 700;
  line-height: 1;
  transition: transform 140ms ease, background-color 140ms ease;
}

.transition-marker:hover {
  background: var(--forest);
  transform: scale(1.12);
}

@keyframes turn {
  to { transform: rotate(360deg); }
}

@media (max-width: 760px) {
  .app-shell {
    grid-template-rows: 60px minmax(0, 1fr);
  }

  .topbar {
    padding: 0 15px;
  }

  .mode-button {
    min-width: 61px;
    height: 27px;
    padding: 0 8px;
    font-size: 10px;
  }

  .coverage-status {
    gap: 7px;
    font-size: 8px;
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: minmax(190px, 34svh) minmax(0, 1fr);
  }

  .scene-sidebar {
    padding: 13px 14px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-heading {
    display: flex;
    align-items: baseline;
    gap: 10px;
    padding: 0 2px 10px;
  }

  .sidebar-heading h2 {
    margin: 0;
    font-size: 22px;
  }

  .sidebar-heading p {
    margin: 0;
    font-size: 11px;
  }

  .sidebar-heading .eyebrow {
    font-size: 8px;
  }

  .search-label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .search-box {
    height: 35px;
    margin: 0 0 9px;
  }

  .chapter-filter {
    height: 32px;
    margin: 0 0 8px;
  }

  .list-heading {
    padding: 0 2px 6px;
  }

  .scene-list {
    grid-template-columns: repeat(auto-fill, minmax(185px, 1fr));
    gap: 2px 5px;
    overflow: auto;
    padding: 0 0 5px;
  }

  .connections-panel {
    max-height: 112px;
    margin: 3px 0 5px;
  }

  .connections-summary {
    min-height: 27px;
  }

  .transition-list {
    max-height: 80px;
  }

  .scene-item {
    min-height: 43px;
    grid-template-columns: 24px minmax(0, 1fr) 12px;
    gap: 7px;
    padding: 4px 5px;
  }

  .scene-index {
    width: 23px;
    height: 23px;
    font-size: 8px;
  }

  .scene-item-copy {
    gap: 2px;
  }

  .scene-item-name {
    font-size: 11px;
  }

  .scene-item-area {
    font-size: 8px;
  }

  .sidebar-foot {
    display: none;
  }

  .viewer-panel {
    grid-template-rows: 68px minmax(0, 1fr) 37px;
    padding: 0 12px 8px;
  }

  .viewer-panel.is-world {
    grid-template-rows: 92px minmax(0, 1fr) 37px;
  }

  .viewer-panel.is-world .scene-header {
    flex-wrap: wrap;
    align-content: center;
    justify-content: flex-start;
    gap: 5px;
  }

  .viewer-panel.is-world .scene-heading {
    flex: 1 1 100%;
  }

  .viewer-panel.is-world .scene-heading h1 {
    font-size: 20px;
  }

  .viewer-panel.is-world .scene-actions {
    width: 100%;
    justify-content: space-between;
    gap: 7px;
  }

  .scene-heading h1 {
    font-size: 21px;
  }

  .scene-heading .eyebrow {
    font-size: 8px;
  }

  .scene-subtitle {
    display: none;
  }

  .scene-actions {
    gap: 9px;
  }

  .world-tools {
    gap: 4px;
  }

  .world-tools .tool-button {
    width: 31px;
    padding: 0;
  }

  .world-tools .tool-button span:last-child,
  .one-way-option span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .world-tools .draft-status {
    display: none;
  }

  .transition-type {
    width: 88px;
  }

  .placement-status {
    font-size: 8px;
  }

  .copy-link {
    width: 34px;
    justify-content: center;
    padding: 0;
  }

  .copy-link span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
  }

  .navigator-frame {
    top: 9px;
    right: 9px;
    width: 112px;
    height: 75px;
  }

  .viewer-controls {
    right: 9px;
    bottom: 9px;
  }

  .viewer-control {
    width: 31px;
    height: 31px;
  }

  .stage-caption {
    bottom: 17px;
    left: 10px;
    font-size: 7px;
  }

  .scene-footer {
    gap: 14px;
  }

  .viewer-credit {
    display: none;
  }
}

@media (max-width: 420px) {
  .coverage-status {
    display: none;
  }

  .topbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .brand-copy strong {
    font-size: 18px;
  }

  .scene-header {
    gap: 6px;
  }

  .placement-status {
    gap: 5px;
    max-width: 106px;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .scene-list {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  }

  .scene-item-area {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}