/* Terrain Lab (terrain.sciencepark.work) — layout on top of ref.css tokens. */
[hidden] { display: none !important; }   /* .btn / .tl-form set display, which would beat the hidden attribute */
main { padding: 18px 24px 40px; max-width: 1680px; margin: 0 auto; }
.tl-view h1 { margin: 6px 0 8px; font-size: 24px; }
.tl-role { margin-left: auto; font-size: 12px; color: var(--muted); }
.tl-role b { color: var(--text-soft); }

.tl-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr) 360px; gap: 14px; align-items: start; }
.tl-grid > * { min-width: 0; }
.tl-left h2, .tl-right h2, .tl-levels h2 { font-size: 13.5px; margin: 14px 0 8px; color: var(--text-soft); }
.tl-left h2:first-child, .tl-right h2:first-child { margin-top: 2px; }
.tl-left select, .tl-right select, .tl-right input[type=text] { width: 100%; }

select, input[type=number], input[type=text] {
  background: var(--panel-2); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: 6px; padding: 5px 7px; font: inherit; font-size: 13px;
}
input[type=number] { width: 84px; font-family: var(--font-mono); }

.tl-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; }
.tl-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--muted); }
.tl-form label input, .tl-form label select { width: 100%; }
.tl-form .tl-wide { grid-column: 1 / -1; }

.tl-kind { border: 1px solid var(--border); border-radius: 8px; padding: 6px 8px; margin-bottom: 6px; background: var(--panel-2); }
.tl-kind.on { border-color: rgba(56, 189, 248, 0.45); }
.tl-kind .tl-khead { display: flex; align-items: center; gap: 8px; }
.tl-kind .tl-khead label { flex: 1; display: flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; }
.tl-kind .tl-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; }
.tl-kind .tl-prop { width: 60px; }
.tl-kind .tl-params { display: none; margin-top: 6px; gap: 4px 8px; grid-template-columns: 1fr auto auto; align-items: center; font-size: 12px; color: var(--muted); }
.tl-kind.on .tl-params { display: grid; }
.tl-kind .tl-params input { width: 72px; }
.tl-kind .tl-params .tl-unit { grid-column: 1; }

.tl-viewer { position: relative; height: min(62vh, 640px); min-height: 360px; }
.tl-badge { position: absolute; top: 10px; left: 12px; z-index: 2; font-size: 12px; line-height: 1.55; background: rgba(15, 26, 42, 0.82);
  padding: 6px 10px; border-radius: 6px; pointer-events: none; max-width: calc(100% - 140px); }
.tl-back { position: absolute; top: 10px; right: 12px; z-index: 3; }

.tl-scroll { overflow-x: auto; max-width: 100%; }
.tl-table { border-collapse: collapse; font-size: 12px; width: 100%; }
.tl-table th, .tl-table td { border: 1px solid var(--border); padding: 4px 6px; text-align: center; white-space: nowrap; }
.tl-table th { color: var(--muted); font-weight: 500; background: var(--panel-2); }
.tl-table td.num { text-align: right; }
.tl-matrix td { padding: 0; }
.tl-matrix input { width: 54px; border: 0; border-radius: 0; background: transparent; text-align: right; padding: 4px 5px; }
.tl-heat td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; cursor: default; }
.tl-heat td.click { cursor: pointer; }
.tl-jobs td { text-align: left; white-space: normal; }
.tl-jobs td .row { gap: 4px; }

.tl-modes { display: flex; flex-direction: column; gap: 4px; margin-bottom: 8px; font-size: 13px; }
.tl-modes label { display: flex; gap: 6px; align-items: center; cursor: pointer; }

.tl-run-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; margin-top: 14px; }
.tl-run-grid > * { min-width: 0; }
.tl-chart svg { width: 100%; height: 240px; display: block; }

@media (max-width: 1280px) {
  .tl-grid { grid-template-columns: 300px minmax(0, 1fr); }
  .tl-right { grid-column: 1 / -1; }
}
@media (max-width: 860px) {
  main { padding: 14px 16px 32px; }
  .tl-grid, .tl-run-grid { grid-template-columns: minmax(0, 1fr); }
  .tl-viewer { height: 52vh; min-height: 300px; }
}
@media (max-width: 560px) {               /* ref.css makes the nav a scroll strip; give it its own line */
  .topnav { flex-wrap: wrap; }
  .topnav nav { order: 3; flex: 1 1 100%; }
  .brand small { display: none; }
}
