:root {
  color-scheme: light;
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-2: #eef4f0;
  --ink: #1f2926;
  --muted: #62716b;
  --line: #d7e0dc;
  --accent: #178273;
  --accent-2: #315f9f;
  --warn: #b87522;
  --bad: #b84a56;
  --shadow: 0 18px 46px rgba(28, 43, 38, 0.11);
}

* { box-sizing: border-box; }

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

button,
input,
select { font: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 420px) minmax(0, 1fr);
  align-items: start;
}

.sidebar {
  min-width: 0;
  height: 100vh;
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto auto auto minmax(190px, 1fr);
  overflow-x: hidden;
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fbfcfb;
}

.brand {
  padding: 10px 12px 8px;
  border-bottom: 1px solid var(--line);
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 { font-size: 18px; }

h2 {
  font-size: 12px;
  color: var(--muted);
}

.status-line {
  min-height: 18px;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.control-panel {
  display: grid;
  gap: 9px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.field {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 11px;
}

select,
input[type="number"],
input[type="text"] {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 9px;
  outline: none;
}

select:focus,
input[type="number"]:focus,
input[type="text"]:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 130, 115, 0.14);
}

.split-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
}

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

.region-fields {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

#regionField {
  grid-template-columns: auto auto;
}

.inline-field {
  min-width: 0;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
  color: var(--muted);
  padding: 4px 5px;
  font-size: 11px;
  font-weight: 800;
}

.inline-field.is-active {
  border-color: var(--accent);
  background: #e7f4ef;
  color: var(--accent);
}

.inline-field input[type="radio"] {
  margin: 0;
  accent-color: var(--accent);
}

.inline-field input[type="number"] {
  padding: 4px 5px;
  border-radius: 5px;
  font-size: 12px;
}

.order-fields {
  gap: 8px;
}

.strategy-field small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-transform: none;
}

.learning-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  border: 1px solid #b9c8e5;
  border-radius: 7px;
  background: #f2f6fb;
  padding: 7px 8px;
  color: var(--ink);
  cursor: pointer;
}

.learning-toggle input { margin-top: 2px; accent-color: var(--accent); }
.learning-toggle span { display: grid; gap: 2px; font-size: 12px; }
.learning-toggle small { color: var(--muted); line-height: 1.25; }

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.segmented label {
  min-width: 0;
  cursor: pointer;
}

.segmented input { display: none; }

.segmented span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--muted);
  padding: 7px 8px;
  text-align: center;
  font-size: 12px;
  text-transform: none;
}

.segmented input:checked + span {
  border-color: var(--accent);
  background: #e7f4ef;
  color: var(--accent);
  font-weight: 700;
}

.selected-tile-panel {
  display: grid;
  gap: 7px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.selected-tile-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.selected-tiles {
  display: grid;
  gap: 5px;
  min-height: 30px;
}

.selected-tile-row {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr) minmax(72px, 96px) auto 22px;
  gap: 7px;
  align-items: center;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 3px 5px 3px 3px;
}

.selected-tile-row.is-root {
  border-color: #b9c8e5;
  background: #f2f6fb;
}

.selected-tile-thumb {
  width: 30px;
  height: 24px;
  object-fit: contain;
  border: 1px solid rgba(31, 41, 55, 0.08);
  border-radius: 4px;
  background: #edf1ef;
}

.selected-tile-main {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.selected-tile-name,
.selected-tile-faces {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-tile-name {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.selected-tile-row.is-root .selected-tile-name {
  color: var(--accent-2);
}

.selected-tile-faces {
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
}

.selected-tile-count {
  min-width: 32px;
  justify-self: end;
  color: var(--accent);
  font-size: 13px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.selected-tile-opacity {
  width: 100%;
  min-width: 0;
  accent-color: var(--accent);
}

.selected-tile-remove {
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-weight: 900;
}

.selected-tile-remove:hover {
  background: #edf1ef;
  color: var(--ink);
}

.selected-empty {
  color: var(--muted);
  font-size: 12px;
  align-self: center;
}

.segmented.compact span {
  padding: 5px 7px;
  font-size: 11px;
}

.display-toggles {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 7px 10px;
}

.display-toggles label {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.display-toggles input {
  margin: 0;
  accent-color: var(--accent);
}

.action-row {
  display: grid;
  grid-template-columns: minmax(154px, 178px) minmax(88px, 1fr) auto;
  gap: 8px;
  align-items: end;
}

.frontier-select-field {
  min-width: 0;
  display: grid;
  gap: 5px;
  align-items: stretch;
  color: var(--muted);
  font-size: 11px;
}

.frontier-select-field select {
  width: 100%;
  padding: 8px 9px;
}

.learning-status {
  min-height: 18px;
  margin-top: 7px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

button {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  padding: 8px 10px;
  cursor: pointer;
}

button:hover { border-color: #b9c8c2; }

button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
  font-weight: 800;
}

.primary-button[data-state="pause"] {
  border-color: var(--warn);
  background: var(--warn);
}

.primary-button[data-state="continue"] {
  border-color: var(--accent-2);
  background: var(--accent-2);
}

.is-hidden { display: none !important; }

.choice-field {
  min-width: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.choice-field legend {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.choice-field > small {
  display: block;
  min-height: 28px;
  margin-top: 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
}

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

.radio-cards label {
  position: relative;
  min-width: 0;
  cursor: pointer;
}

.radio-cards input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.radio-cards label > span {
  display: grid;
  min-height: 48px;
  align-content: center;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface);
}

.radio-cards label > span b {
  color: var(--ink);
  font-size: 11px;
}

.radio-cards label > span small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.2;
}

.radio-cards input:checked + span {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, var(--surface));
  box-shadow: inset 0 0 0 1px var(--accent);
}

.radio-cards input:focus-visible + span {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.mode-cards {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.custom-polyhedron-editor {
  display: grid;
  gap: 10px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.custom-polyhedron-editor textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
  resize: vertical;
}

.custom-shape-match.is-error {
  color: #a33b32;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1px;
  border-bottom: 1px solid var(--line);
  background: var(--line);
}

.metrics div {
  min-width: 0;
  padding: 10px 8px;
  background: #fbfcfb;
}

.metrics b {
  display: block;
  font-size: 19px;
}

.metrics span {
  display: block;
  color: var(--muted);
  font-size: 11px;
}

.metrics small {
  display: block;
  margin-top: 2px;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-panel {
  min-height: 190px;
  display: grid;
  grid-template-rows: minmax(140px, 1fr) auto;
  overflow: hidden;
  padding: 10px 12px;
}

.custom-builder-launch,
.opacity-header {
  margin-top: 14px;
}

.catalog-section {
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
}

.catalog-scroll {
  min-height: 0;
  margin-top: 10px;
  overflow: auto;
  padding-right: 4px;
  scrollbar-gutter: stable;
}

.system-tile-list {
  display: grid;
  gap: 14px;
  margin-top: 0;
}

.catalog-group {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.catalog-group-title {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: none;
}

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

.figure-card {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto auto;
  gap: 5px;
  aspect-ratio: 1 / 1;
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  padding: 4px;
  cursor: pointer;
  appearance: none;
  text-align: center;
}

.figure-card:hover {
  border-color: #b9c8c2;
}

.figure-card.is-selected {
  border-color: var(--accent);
  background: #e7f4ef;
}

.figure-card.is-incompatible {
  border-style: dashed;
  cursor: not-allowed;
  opacity: 0.44;
}

.figure-card.is-incompatible:hover {
  border-color: var(--line);
  opacity: 0.44;
}

.figure-card.is-incompatible img {
  filter: grayscale(1);
}

.figure-card img {
  width: 100%;
  height: 100%;
  min-height: 0;
  object-fit: contain;
  border-radius: 4px;
  background: #edf1ef;
}

.figure-card-title {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 9.5px;
  font-weight: 800;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: center;
}

.figure-card.is-root .figure-card-title {
  color: var(--accent-2);
}

.figure-card-angles {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 700;
  line-height: 1.05;
  opacity: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.figure-card:hover .figure-card-angles,
.figure-card:focus-visible .figure-card-angles {
  opacity: 1;
}

.custom-builder-launch button {
  width: 100%;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.custom-builder {
  display: grid;
  gap: 9px;
  padding: 10px;
}

.builder-topline {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
  align-items: center;
}

.builder-topline label {
  display: flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.builder-topline input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
}

.custom-shape-match {
  min-height: 16px;
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 700;
}

.builder-tools {
  display: flex;
  justify-content: flex-end;
}

.polycube-builder {
  width: 100%;
  height: 190px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #edf1ef;
}

.polycube-builder canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.custom-builder-dialog {
  width: min(720px, calc(100vw - 32px));
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 24px 70px rgba(28, 43, 38, 0.24);
}

.custom-builder-dialog::backdrop {
  background: rgba(31, 41, 38, 0.28);
}

.custom-builder-dialog-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  max-height: calc(100vh - 32px);
}

.custom-builder-dialog-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.custom-builder-dialog-header button {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 0;
  font-weight: 900;
}

.custom-builder-dialog-header button:hover {
  background: #edf1ef;
  color: var(--ink);
}

.custom-builder-dialog .custom-builder {
  min-height: 0;
  overflow: auto;
  padding: 14px;
}

.custom-builder-dialog .polycube-builder {
  height: min(48vh, 380px);
  min-height: 260px;
}

.opacity-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.display-toggles {
  grid-template-columns: auto auto;
  justify-content: end;
}

.tile-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.tile-list.is-hidden {
  display: none;
}

.tile-row {
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr);
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px;
  background: var(--surface);
}

.tile-swatch {
  width: 12px;
  height: 12px;
  border-radius: 50%;
}

.tile-meta {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.tile-name {
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tile-angles {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.candidate-research-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 6px 10px;
  margin-top: 8px;
  padding: 9px 10px;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, var(--line));
  border-radius: 7px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
}

.candidate-research-panel > div {
  display: contents;
}

.candidate-research-panel b {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  font-size: 12px;
}
.candidate-research-detail {
  box-sizing: border-box;
  display: block;
  grid-column: 1 / -1;
  grid-row: 2;
  height: 88px;
  overflow: auto;
  padding: 6px 7px;
  border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.35;
  scrollbar-gutter: stable;
  white-space: normal;
}
.candidate-research-detail:focus-visible {
  outline: 2px solid color-mix(in srgb, var(--accent) 70%, white);
  outline-offset: 1px;
}
.candidate-research-panel button {
  grid-column: 2;
  grid-row: 1;
  padding: 6px 8px;
}
.figure-card-angles.is-census-label { opacity: 0.82; }

.tile-meta input {
  width: 100%;
  accent-color: var(--accent);
}

.workspace {
  min-width: 0;
  min-height: 100vh;
  display: grid;
  grid-template-rows: minmax(360px, 1fr);
}

.viewport-panel {
  min-width: 0;
  min-height: 0;
  padding: 14px;
}

.viewport {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 420px;
  contain: layout paint size;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1ef;
  box-shadow: var(--shadow);
}

.viewport canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.growth-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.growth-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 8px 14px 4px;
}

.growth-header > div { min-width: 0; }
.growth-header { flex-wrap: wrap; }
.growth-header > div:first-child { flex: 1 1 360px; }
.growth-header small,
.growth-status {
  color: var(--muted);
  font-size: 11px;
}

.growth-header button { flex: 0 0 auto; padding: 6px 9px; }
.growth-history-controls {
  display: flex;
  flex: 0 1 auto;
  min-width: 0;
  align-items: center;
  gap: 5px;
}
.growth-history-controls button {
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 999px;
  font-size: 16px;
  line-height: 1;
}
.growth-history-controls #growthReplayButton { width: auto; min-width: 62px; padding: 0 10px; font-size: 12px; }
.growth-history-controls button:disabled {
  opacity: .32;
  cursor: default;
}
.growth-view-state {
  flex: 0 1 auto;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 5px 9px;
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  border-radius: 999px;
  background: color-mix(in srgb, var(--accent) 8%, var(--surface));
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.growth-chart-wrap { min-height: 0; padding: 0 8px; }
.growth-chart {
  width: 100%;
  height: 100%;
  min-height: 190px;
  overflow: hidden;
  border-radius: 8px;
}
.growth-chart .plot-container,
.growth-chart .svg-container { width: 100% !important; height: 100% !important; }
.growth-chart .nsewdrag { cursor: default; }
.growth-chart .point { cursor: pointer; }
.growth-empty {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: var(--muted);
  font-size: 12px;
}
.growth-status { min-height: 20px; padding: 2px 14px 7px; }

.tree-panel {
  min-width: 0;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.tree-header {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
}

.tree {
  min-height: 0;
  overflow: auto;
  padding: 9px 14px 18px;
  font: 12px/1.45 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  white-space: nowrap;
}

.tree-node {
  position: relative;
  min-height: 22px;
}

.tree-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 2px 6px;
  background: transparent;
  color: var(--muted);
  cursor: default;
}

.tree-button.has-snapshot { cursor: pointer; }
.tree-button.has-snapshot:hover { border-color: var(--line); background: #f5f8f7; }
.tree-button.is-selected { border-color: var(--ink); }

.tree-toggle {
  width: 14px;
  color: var(--muted);
  text-align: center;
  cursor: pointer;
  user-select: none;
}

.tree-status {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 50%;
  background: #9aa6a1;
}

.tree-button[data-status="working"] .tree-status { background: var(--accent-2); }
.tree-button[data-status="success"] .tree-status { background: var(--accent); }
.tree-button[data-status="fail"] .tree-status { background: var(--bad); }

.tree-label {
  flex: 0 0 auto;
  overflow: visible;
}

.tree-button-summary {
  color: #7b8782;
  font-style: italic;
}

.tree-button-summary .tree-status {
  background: #c3ccc7;
}

.tree-result {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 11px;
}

.tree-frontier {
  flex: 0 0 auto;
  color: var(--accent-2);
  font-size: 11px;
}

@media (min-width: 981px) {
  .app-shell {
    min-height: 100vh;
  }

  .workspace {
    height: 100vh;
    min-height: 0;
  }

  .workspace {
    position: sticky;
    top: 0;
  }
}

@media (max-width: 980px) {
  .app-shell,
  .workspace {
    grid-template-columns: 1fr;
  }

  .app-shell {
    min-height: 100vh;
    overflow: visible;
  }

  .sidebar {
    height: auto;
    min-height: auto;
    display: grid;
    grid-template-rows: auto auto auto auto auto;
    overflow: visible;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .tile-panel {
    grid-template-rows: auto auto auto auto;
    overflow: visible;
  }

  .catalog-scroll {
    max-height: 56vh;
  }

  .workspace {
    min-height: 70vh;
    grid-template-rows: minmax(420px, 70vh);
  }
}

@media (max-width: 560px) {
  .split-fields,
  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .opacity-header {
    grid-template-columns: 1fr;
  }

  .display-toggles {
    justify-content: stretch;
  }

  .viewport-panel { padding: 10px; }
  .growth-header { align-items: flex-start; }
  .growth-history-controls { max-width: 100%; }
}

#viewport[hidden], #markingLearning[hidden] { display: none !important; }
.marking-view-tabs { display: flex; gap: 8px; padding: 8px; }

.marking-library{display:flex;flex-wrap:wrap;gap:8px;align-items:end;padding:12px 16px}.marking-library label{display:flex;flex-direction:column;gap:4px;flex:1;min-width:180px}.marking-library select{max-width:100%}.marking-library button{white-space:nowrap}

.marking-pair-controls:not([hidden]){display:flex;flex-wrap:wrap;align-items:center;gap:8px;margin-bottom:8px}.marking-pair-controls label{display:flex;align-items:center;gap:8px;margin:0}.marking-pair-controls select{width:auto;max-width:100%}.marking-pair-controls .marking-witness{width:auto;margin:0}.marking-pair-detail{font-size:13px;line-height:1.5}
