:root {
  color-scheme: light;
  --ink: #162025;
  --muted: #62727d;
  --line: #d8e0e4;
  --paper: #f7f8f5;
  --panel: #ffffff;
  --teal: #146c68;
  --coral: #c9553f;
  --gold: #c8922c;
  --blue: #356db4;
  --green: #4c8b43;
  --shadow: 0 18px 42px rgba(26, 37, 42, 0.12);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body.dark-mode {
  --ink: #e8f0ed;
  --muted: #a9b7b2;
  --line: #394a4d;
  --paper: #101719;
  --panel: #182225;
  --shadow: 0 18px 42px rgba(0, 0, 0, 0.28);
}

button, input, textarea, select { font: inherit; }

button {
  border: 0;
  border-radius: 7px;
  background: var(--teal);
  color: #fff;
  min-height: 36px;
  padding: 0 14px;
  cursor: pointer;
  transition: transform .12s ease, background .12s ease;
}

button:hover { transform: translateY(-1px); }
button:disabled {
  cursor: not-allowed;
  opacity: .45;
  transform: none;
}
button.secondary { background: #40505a; }
button.danger { background: var(--coral); }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  min-height: 36px;
  padding: 8px 10px;
}

textarea {
  min-height: 190px;
  resize: vertical;
  line-height: 1.45;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
}

label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  min-width: 88px;
}

.app-shell {
  display: grid;
  grid-template-columns: 250px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #182126;
  color: #fff;
  padding: 20px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  background: var(--gold);
  color: #172024;
  font-weight: 800;
}

.brand h1, .brand p, .topbar h2, .topbar p, .panel h3, .panel h4 { margin: 0; }
.brand h1 { font-size: 17px; letter-spacing: 0; }
.brand p { color: #aebbc1; font-size: 13px; }

.tool-nav {
  display: grid;
  gap: 7px;
}

.tool-nav button {
  width: 100%;
  text-align: left;
  background: transparent;
  color: #dfe7ea;
  border: 1px solid transparent;
}

.tool-nav button.active {
  background: #243137;
  border-color: #3e5059;
  color: #fff;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--coral);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 12px;
}

.topbar h2 {
  font-size: clamp(24px, 3vw, 38px);
  letter-spacing: 0;
}

.top-actions, .control-row {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 10px;
}

.top-actions button { white-space: nowrap; }
.tool { display: none; }
.tool.active { display: block; }

.panel-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(300px, .65fr);
  gap: 18px;
}

.editor-grid { grid-template-columns: minmax(0, 1fr) 360px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
  min-width: 0;
}

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

.panel h3 { font-size: 18px; }
.panel h4 { font-size: 13px; color: var(--muted); margin-bottom: 8px; }

.output-panel {
  display: grid;
  align-content: start;
  gap: 12px;
}

.palette {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.tile-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 36px;
  background: #f8faf9;
  color: var(--ink);
  border: 1px solid var(--line);
  white-space: nowrap;
}

.tile-chip.active {
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.swatch {
  width: 34px;
  height: 34px;
  border-radius: 7px;
  border: 2px solid transparent;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.16);
}

.swatch.active { border-color: var(--ink); }

.tile-chip .swatch {
  width: 20px;
  height: 20px;
}

.tile-type-tools {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.tile-type-tools input[type="color"] {
  width: 54px;
  min-width: 54px;
  padding: 4px;
}

.tile-type-list {
  display: grid;
  gap: 8px;
  max-height: 180px;
  overflow: auto;
}

.tile-type-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 54px 36px;
  gap: 8px;
  align-items: center;
}

.property-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  margin: 10px 0 14px;
}

.property-grid label {
  min-width: 0;
}

.tile-viewport {
  overflow: auto;
  max-height: 78vh;
  max-width: 100%;
  border: 1px solid var(--line);
  background: #dce4e7;
}

.tile-canvas-wrap {
  position: relative;
  display: inline-block;
  transform-origin: 0 0;
}

.tile-canvas {
  width: max-content;
  border: 0;
  background: transparent;
  padding: 8px;
}

.marker-overlay, .selection-overlay {
  position: absolute;
  top: 8px;
  left: 8px;
  pointer-events: none;
}

.marker-pin {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35);
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  cursor: pointer;
}

.marker-pin .marker-label {
  position: absolute;
  top: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(22, 32, 37, 0.85);
  color: #fff;
  font-size: 10px;
  padding: 2px 5px;
  border-radius: 4px;
  white-space: nowrap;
}

.marker-pin.spawn { background: #356db4; }
.marker-pin.objective { background: #c8922c; }
.marker-pin.resource { background: #4c8b43; }

.selection-rect {
  position: absolute;
  border: 2px dashed var(--ink);
  background: rgba(53, 109, 180, .15);
}

.paste-rect {
  position: absolute;
  border: 2px solid var(--gold);
  background: rgba(200, 146, 44, .18);
  pointer-events: none;
}

.path-cell {
  position: absolute;
  width: 8px;
  height: 8px;
  background: var(--coral);
  border-radius: 50%;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, .8);
  pointer-events: none;
}
.path-cell.unreachable { background: #888; }

.los-cell {
  position: absolute;
  background: rgba(76, 139, 67, .25);
  border: 1px solid rgba(76, 139, 67, .55);
  pointer-events: none;
}

.elevation-tag {
  position: absolute;
  font-size: 9px;
  color: rgba(0, 0, 0, .6);
  font-weight: 700;
  pointer-events: none;
  transform: translate(-50%, -50%);
  text-shadow: 0 0 3px rgba(255, 255, 255, .8);
}

details.map-meta,
details.marker-tools,
details.tile-groups-tools,
details.stamps-tools {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--panel);
}

details > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--muted);
  padding: 4px 0;
  user-select: none;
}

details[open] > summary { margin-bottom: 8px; }

.marker-list, .stamp-list, .tile-group-editor {
  display: grid;
  gap: 6px;
  max-height: 180px;
  overflow: auto;
  margin-top: 8px;
}

.marker-row, .stamp-row, .group-weight-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.marker-row .marker-swatch {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid rgba(0,0,0,.2);
}

.tile-group-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.tile-group-row header {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: space-between;
}

.group-weight-row {
  grid-template-columns: 1fr 80px auto;
}

.tile {
  border: 1px solid rgba(0,0,0,.12);
  min-width: 12px;
  min-height: 12px;
  padding: 0;
  position: relative;
}

.elev-label {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  color: rgba(0, 0, 0, .65);
  text-shadow: 0 0 3px rgba(255, 255, 255, .8);
  pointer-events: none;
}

.square-map {
  display: grid;
  gap: 0;
}

.square-tile {
  width: var(--tile-size);
  height: var(--tile-size);
}

.hex-map {
  display: block;
  position: relative;
}

.hex-tile {
  position: absolute;
  width: calc(var(--tile-size) * .866 + 1px);
  height: calc(var(--tile-size) + 1px);
  border: 0;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.14);
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

.node-list {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
}

.node-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 9px;
}

.node-card header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 7px;
}

.choice-row {
  display: grid;
  grid-template-columns: 1fr 100px 36px;
  gap: 8px;
}

.stack-form {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.split-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

ul { margin: 0; padding: 0; list-style: none; }

li {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  padding: 8px 0;
}

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}

th, td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 8px;
  font-size: 13px;
}

th { color: var(--muted); font-weight: 700; }
td input, td select { min-height: 32px; }

.result-strip, .name-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #f3f7f7;
  font-size: 13px;
}

.name-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
}

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  aspect-ratio: 82 / 52;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef2f0;
  cursor: crosshair;
}

.timeline {
  display: grid;
  gap: 10px;
  overflow-x: auto;
}

.track {
  display: grid;
  grid-template-columns: 140px 1fr 36px;
  align-items: center;
  gap: 10px;
}

.frames {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 22px;
  gap: 3px;
}

.frame {
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f9faf8;
}

.frame.key {
  background: var(--blue);
  border-color: #234b7e;
}

.frame.playing {
  outline: 3px solid var(--gold);
  outline-offset: 1px;
}

.summary-list {
  display: grid;
  gap: 8px;
}

.summary-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcfb;
}

.large-editor { min-height: 520px; }

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .42);
  display: grid;
  place-items: center;
  z-index: 100;
}
.modal[hidden] { display: none; }
.modal-card {
  background: var(--panel);
  color: var(--ink);
  border-radius: 12px;
  padding: 20px;
  width: min(640px, 92vw);
  max-height: 80vh;
  overflow: auto;
  box-shadow: var(--shadow);
  display: grid;
  gap: 12px;
}
.modal-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}
.modal-close {
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  width: 32px;
  height: 32px;
  min-height: 32px;
  padding: 0;
}
kbd {
  background: var(--line);
  border-radius: 4px;
  padding: 2px 6px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}
.shortcut-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.shortcut-list li { display: flex; gap: 10px; align-items: center; padding: 4px 0; border: 0; }

.guide-card {
  width: min(880px, 96vw);
  max-height: 88vh;
}
.modal-actions { display: flex; gap: 8px; align-items: center; }
.guide {
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
}
.guide-meta { color: var(--muted); font-size: 12px; margin: 0 0 14px; }
.guide h2 {
  font-size: 18px;
  margin: 28px 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.guide h3 {
  font-size: 14px;
  margin: 16px 0 4px;
  color: var(--ink);
}
.guide p, .guide ul, .guide ol { margin: 6px 0 10px; }
.guide ul, .guide ol { padding-left: 22px; }
.guide ul li, .guide ol li { padding: 2px 0; border: 0; display: list-item; }
.guide pre {
  background: #f3f6f6;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  overflow: auto;
}
.guide code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f3f6f6;
  padding: 1px 5px;
  border-radius: 4px;
}
.guide-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 6px 0 10px;
}
.guide-table th, .guide-table td {
  border-bottom: 1px solid var(--line);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
}
.guide-table th { color: var(--muted); font-weight: 700; }
.guide-toc {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  background: rgba(53, 109, 180, .04);
  margin-bottom: 18px;
}
.guide-toc strong { display: block; margin-bottom: 6px; color: var(--muted); }
.guide-toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 24px; }
.guide-toc a { color: var(--blue); text-decoration: none; }
.guide-toc a:hover { text-decoration: underline; }

body.dark-mode .guide pre,
body.dark-mode .guide code { background: #1c2730; border-color: var(--line); }

@media print {
  @page { margin: 18mm 16mm; }
  body.printing { background: white !important; color: #111 !important; }
  body.printing > *:not(#modalGuide) { display: none !important; }
  body.printing #modalGuide { position: static !important; padding: 0 !important; background: white !important; display: block !important; height: auto; }
  body.printing #modalGuide .modal-card {
    box-shadow: none !important;
    width: 100% !important;
    max-width: none !important;
    max-height: none !important;
    overflow: visible !important;
    padding: 0 !important;
    border-radius: 0 !important;
  }
  body.printing #modalGuide header { border-bottom: 2px solid #111; padding-bottom: 6px; margin-bottom: 12px; }
  body.printing .modal-actions, body.printing .modal-close { display: none !important; }
  body.printing .guide { font-size: 11pt; line-height: 1.45; color: #111; }
  body.printing .guide h2 {
    font-size: 16pt;
    border-bottom: 1px solid #111;
    page-break-before: always;
    page-break-after: avoid;
    margin-top: 0;
  }
  body.printing .guide-section:first-of-type h2,
  body.printing .guide-toc + .guide-section h2 { page-break-before: auto; }
  body.printing .guide h3 { page-break-after: avoid; font-size: 12pt; }
  body.printing .guide-section { page-break-inside: auto; break-inside: auto; }
  body.printing .guide-toc { background: white; }
  body.printing .guide-toc ol { columns: 2; }
  body.printing .guide pre, body.printing .guide code {
    background: #f4f4f4 !important; color: #111 !important; border-color: #ccc !important;
  }
  body.printing .guide kbd { background: #eee !important; color: #111 !important; border: 1px solid #aaa; }
  body.printing .guide-table th { color: #444; }
  body.printing .guide a { color: #111; text-decoration: none; }
  body.printing img, body.printing canvas { max-width: 100% !important; }
}

.snapshot-list, .save-snap-list {
  display: grid;
  gap: 6px;
}
.snapshot-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.find-results {
  max-height: 320px;
  overflow: auto;
  display: grid;
  gap: 4px;
}
.find-row {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 12px;
  cursor: pointer;
}
.find-row:hover { background: rgba(53, 109, 180, .08); }

.library-list {
  display: grid;
  gap: 8px;
}
.library-row {
  display: grid;
  grid-template-columns: 32px 1fr 100px 100px auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}
.library-row .icon { font-size: 22px; text-align: center; }
.library-row textarea { min-height: 60px; }

.quest-form {
  display: grid;
  gap: 10px;
}
.quest-form .objective-row,
.quest-form .reward-row,
.quest-form .prereq-row,
.quest-form .outcome-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 8px;
  align-items: center;
}
.quest-dag {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  max-height: 400px;
  overflow: auto;
}
.quest-dag-node {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 6px 10px;
  margin: 4px;
  background: var(--panel);
}

.dialogue-graph {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f4f7f7;
  height: 420px;
  overflow: auto;
}
.dialogue-graph svg { display: block; }

.class-list, .ability-list, .sub-table-list, .bank-list, .map-layer-list {
  display: grid;
  gap: 6px;
}
.class-list .row, .ability-list .row, .sub-table-list .row, .bank-list .row, .map-layer-list .row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  align-items: center;
}

.resistance-editor {
  display: grid;
  gap: 8px;
}

.ttk-grid {
  margin-top: 12px;
  overflow: auto;
}
.ttk-grid table { font-size: 12px; }
.ttk-grid td.heat { text-align: center; }

.loot-chart {
  display: grid;
  grid-auto-flow: column;
  align-items: end;
  gap: 4px;
  height: 80px;
  margin-top: 12px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 4px;
}
.loot-chart .bar {
  background: var(--blue);
  min-width: 18px;
  position: relative;
  transition: height .2s;
}
.loot-chart .bar span {
  position: absolute;
  bottom: -16px;
  left: 0;
  right: 0;
  text-align: center;
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}

.hint { color: var(--muted); font-size: 12px; margin: 0; }

.site-footer {
  margin-top: 24px;
  padding: 14px 0 4px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 12px;
  color: var(--muted);
}

.anim-sheet-preview {
  display: grid;
  grid-auto-flow: column;
  gap: 4px;
  overflow: auto;
  margin-top: 8px;
}
.anim-sheet-preview .cell {
  border: 2px solid transparent;
  display: inline-block;
  background-size: cover;
  cursor: pointer;
}
.anim-sheet-preview .cell.active { border-color: var(--gold); }

.timeline-preview {
  margin-top: 12px;
  display: grid;
  gap: 4px;
  font-size: 12px;
  color: var(--muted);
}

.frame.onion-prev { outline: 1px dashed rgba(53, 109, 180, .5); }

.play-stage {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 14px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  min-height: 180px;
}
.play-portrait {
  width: 120px;
  height: 120px;
  border-radius: 10px;
  background: var(--line) center/cover no-repeat;
  display: grid;
  place-items: center;
  font-size: 36px;
  color: var(--muted);
}
.play-speaker {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}
.play-line {
  font-size: 18px;
  line-height: 1.4;
  margin-bottom: 14px;
  min-height: 32px;
}
.play-choices {
  display: grid;
  gap: 6px;
}
.play-choices button {
  text-align: left;
  background: #243137;
  color: #fff;
}
.play-choices button:disabled { opacity: .35; }

.play-hud {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}
.play-hud > div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel);
  font-size: 13px;
}
.play-hud h4 { font-size: 12px; color: var(--muted); margin-bottom: 6px; }

.play-log {
  max-height: 240px;
  overflow: auto;
  font-size: 12px;
  font-family: ui-monospace, monospace;
}
.play-log .log-line { padding: 2px 0; border-bottom: 1px dashed var(--line); }

.dialogue-graph svg .node-rect {
  cursor: grab;
  fill: var(--panel);
  stroke: var(--ink);
}
.dialogue-graph svg .node-rect.dragging { cursor: grabbing; opacity: .8; }
body.dark-mode .dialogue-graph svg text { fill: var(--ink); }
body.dark-mode .dialogue-graph svg .node-rect { fill: #1c2730; }
body.dark-mode .dialogue-graph { background: #1c2228; }
body.dark-mode .modal-card { background: #182225; }
body.dark-mode .pill { background: #243137; color: #dfe7ea; }
body.dark-mode .summary-item { background: #1c2228; }
body.dark-mode .tile-chip { background: #243137; color: #dfe7ea; }
body.dark-mode kbd { background: #2a3a40; color: #dfe7ea; }
body.dark-mode .play-stage,
body.dark-mode .quest-dag,
body.dark-mode .play-hud > div,
body.dark-mode details.map-meta,
body.dark-mode details.marker-tools,
body.dark-mode details.tile-groups-tools,
body.dark-mode details.stamps-tools { background: #182225; }

.equip-slots {
  display: grid;
  gap: 6px;
}
.equip-slot {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 8px;
  align-items: center;
}

@media (max-width: 980px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
  }
  .tool-nav { grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); }
  .panel-grid, .editor-grid { grid-template-columns: 1fr; }
  .topbar { align-items: stretch; flex-direction: column; }
}

@media (max-width: 560px) {
  .workspace, .sidebar { padding: 14px; }
  .top-actions, .control-row { align-items: stretch; }
  .top-actions > *, .control-row > * { flex: 1 1 140px; }
  .split-list { grid-template-columns: 1fr; }
  .choice-row { grid-template-columns: 1fr; }
}
