:root {
  --bg: #0a0a0a;
  --bg-soft: #131313;
  --bg-card: #161616;
  --bg-deep: #0d0d0d;
  --line: #232323;
  --line-strong: #333;
  --ink: #f3f3f3;
  --ink-soft: #b5b5b5;
  --ink-mute: #6a6a6a;
  --accent: #ff7a3d;
  --accent-cool: #6ec6ff;
  --accent-warm: #ffb84d;
  --igneous: #ff7a3d;
  --sedimentary: #d9b066;
  --metamorphic: #8aa9d1;
  --magma: #ff4422;
  --r: 14px;
  --r-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Tajawal', system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

.lab {
  display: grid;
  grid-template-rows: 56px 1fr 64px 90px;
  height: 100vh;
  width: 100vw;
}

/* ---- topbar ---- */
.lab__topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.back {
  width: 36px; height: 36px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  text-decoration: none;
  font-size: 18px;
  background: transparent;
  border: 1px solid var(--line);
  transition: 0.2s;
}
.back:hover { color: var(--ink); border-color: var(--line-strong); }
.title { display: flex; flex-direction: column; line-height: 1.15; }
.title__ar { font-size: 16px; font-weight: 700; }
.title__en {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
}
.topbar-btn {
  margin-inline-start: auto;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 500;
  transition: 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}
.topbar-btn:hover { color: var(--ink); border-color: var(--accent); }
.topbar-btn + .topbar-btn { margin-inline-start: 0; }
.topbar-btn__icon { font-size: 14px; }
#experimentsBtn { color: var(--accent); border-color: var(--accent); }
#experimentsBtn:hover { background: rgba(255, 122, 61, 0.1); }

/* ---- main grid ---- */
.lab__grid {
  display: grid;
  grid-template-columns: 260px 1fr 340px;
  gap: 16px;
  padding: 16px 16px 8px;
  min-height: 0;
}

/* ---- meters (left) ---- */
.meters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  align-self: start;
  overflow-y: auto;
  max-height: 100%;
}
.meter { display: flex; flex-direction: column; gap: 5px; }
.meter__label {
  font-size: 11px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.meter__bar { height: 5px; background: #1d1d1d; border-radius: 3px; overflow: hidden; }
.meter__fill {
  height: 100%; width: 5%;
  background: linear-gradient(90deg, var(--accent-cool), var(--accent));
  border-radius: 3px;
  transition: width 0.6s ease, background 0.6s ease;
}
.meter[data-meter="temperature"] .meter__fill {
  background: linear-gradient(90deg, var(--accent-cool), var(--accent-warm), var(--magma));
}
.meter[data-meter="pressure"] .meter__fill { background: linear-gradient(90deg, #4a5568, #8aa9d1); }
.meter[data-meter="depth"] .meter__fill { background: linear-gradient(90deg, #2c2c2c, #6a6a6a); }
.meter[data-meter="density"] .meter__fill { background: linear-gradient(90deg, #5a4a35, #c5a572); }
.meter[data-meter="hardness"] .meter__fill { background: linear-gradient(90deg, #34d399, #fbbf24, #ef4444); }
.meter__value {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--ink-soft);
  align-self: end;
}

/* ---- composition ---- */
.composition {
  margin-top: 6px;
  display: flex; flex-direction: column; gap: 6px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.composition__label {
  font-size: 11px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.composition__bar {
  height: 12px; display: flex;
  border-radius: 3px; overflow: hidden;
  background: #1d1d1d;
}
.composition__bar-segment { height: 100%; transition: width 0.6s ease; }
.composition__legend { list-style: none; display: flex; flex-direction: column; gap: 3px; }
.composition__legend li {
  font-size: 11px; display: flex; align-items: center; gap: 6px;
  color: var(--ink-soft);
}
.composition__legend .swatch {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
.composition__legend .pct {
  margin-inline-start: auto;
  font-family: 'JetBrains Mono', monospace;
  color: var(--ink-mute);
}

/* ---- stage (center) ---- */
.stage {
  display: flex;
  flex-direction: column;
  background: radial-gradient(ellipse at center, #181818 0%, #0a0a0a 70%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 12px 20px 16px;
  position: relative;
  overflow: hidden;
  min-height: 0;
}

/* view tabs */
.view-tabs {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--bg-deep);
  border-radius: var(--r-sm);
  margin-bottom: 12px;
  align-self: center;
}
.view-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  border-radius: var(--r-sm);
  color: var(--ink-mute);
  font-size: 13px;
  font-weight: 500;
  transition: 0.2s;
}
.view-tab:hover { color: var(--ink-soft); }
.view-tab.is-active {
  background: var(--bg-card);
  color: var(--ink);
  box-shadow: 0 0 0 1px var(--line-strong);
}
.view-tab__icon { font-size: 14px; color: var(--accent); }

.banner {
  position: absolute;
  top: 64px;
  inset-inline: 16px;
  padding: 10px 14px;
  background: rgba(15, 15, 15, 0.96);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  backdrop-filter: blur(8px);
  z-index: 4;
  font-size: 13px;
  color: var(--ink);
  text-align: center;
  animation: bannerIn 0.4s ease;
}
.banner[hidden] { display: none; }
@keyframes bannerIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}
.banner__text b { color: var(--accent); font-weight: 700; }
.banner__text .mono {
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px; color: var(--ink-soft);
  margin-inline-start: 8px;
}

/* view stack */
.view-stack {
  flex: 1;
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: 0;
}
.view {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  min-height: 0;
}
.view[hidden] { display: none; }

/* sample view */
.sample {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
}
#sampleCanvas {
  max-width: 100%; max-height: 100%;
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.6));
}
.sample.is-transitioning #sampleCanvas {
  filter: drop-shadow(0 12px 32px rgba(0, 0, 0, 0.6)) blur(2px) brightness(1.4);
  transition: filter 0.4s ease;
}

/* section view */
.section-wrap {
  display: flex;
  width: 100%; height: 100%;
  gap: 12px;
  align-items: stretch;
  padding: 8px;
}
#sectionCanvas {
  flex: 1;
  max-height: 100%;
  border-radius: var(--r-sm);
}
.section-legend {
  width: 160px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--bg-deep);
  border-radius: var(--r-sm);
  font-size: 11px;
  overflow-y: auto;
}
.section-legend__row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 4px;
  border-radius: 4px;
}
.section-legend__row.is-current {
  background: rgba(255, 122, 61, 0.18);
  border: 1px solid var(--accent);
}
.section-legend__swatch {
  width: 10px; height: 10px; border-radius: 2px;
  flex-shrink: 0;
}
.section-legend__name { color: var(--ink-soft); flex: 1; }
.section-legend__depth {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px; color: var(--ink-mute);
}

/* map view */
.map-wrap {
  position: relative;
  width: 100%; height: 100%;
  display: grid;
  place-items: center;
}
#mapSvg {
  max-width: 100%; max-height: 100%;
  width: 100%; height: 100%;
}
.map-site {
  cursor: pointer;
  transition: 0.2s;
}
.map-site:hover .map-site__halo { opacity: 1; }
.map-site__halo {
  opacity: 0.3;
  transition: 0.2s;
}
.map-site.is-current .map-site__halo {
  opacity: 1;
  animation: pulse 2s ease infinite;
}
.map-site.is-current .map-site__dot {
  fill: var(--accent);
  r: 7;
}
@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.4); opacity: 0.3; }
}
.map-site__label {
  fill: var(--ink);
  font-size: 28px;
  font-family: 'Tajawal', sans-serif;
  font-weight: 600;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.85);
  stroke-width: 5px;
  stroke-linejoin: round;
}
.map-site.is-current .map-site__label { fill: #ffd9a0; font-weight: 700; }
.map-site.is-current .map-site__label { fill: var(--ink); font-weight: 700; }
.map-tooltip {
  position: absolute;
  padding: 10px 14px;
  background: rgba(20, 20, 20, 0.97);
  border: 1px solid var(--accent);
  border-radius: var(--r-sm);
  font-size: 12px;
  pointer-events: none;
  max-width: 240px;
  line-height: 1.5;
  z-index: 10;
  backdrop-filter: blur(8px);
}
.map-tooltip[hidden] { display: none; }
.map-tooltip h4 {
  font-size: 13px;
  margin-bottom: 4px;
  color: var(--accent);
}
.map-tooltip .rocks {
  margin-top: 6px;
  font-size: 10px;
  color: var(--ink-mute);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* microscope view */
.micro-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 8px;
}
#microCanvas {
  max-width: 100%;
  max-height: calc(100% - 40px);
  border-radius: 50%;
  background: #000;
  box-shadow: 0 0 0 4px #1a1a1a, 0 0 0 6px var(--line-strong), 0 12px 40px rgba(0,0,0,0.7);
}
.micro-caption {
  font-size: 12px;
  color: var(--ink-mute);
  text-align: center;
  max-width: 480px;
}

/* actions */
.actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 640px;
  margin: 12px auto 0;
}
.action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 12px 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  transition: 0.2s;
}
.action:hover:not(:disabled) {
  border-color: var(--accent);
  background: #1d1614;
  transform: translateY(-1px);
}
.action:disabled { opacity: 0.35; cursor: not-allowed; }
.action__icon { font-size: 22px; color: var(--accent); line-height: 1; }
.action[data-action="pressure"] .action__icon { color: var(--metamorphic); }
.action[data-action="erosion"] .action__icon { color: var(--sedimentary); }
.action[data-action="cool"] .action__icon { color: var(--accent-cool); }
.action__label { font-size: 14px; font-weight: 700; }
.action__hint { font-size: 11px; color: var(--ink-mute); }

/* action modal */
.action-modal {
  position: absolute;
  inset: auto 24px 90px 24px;
  padding: 14px;
  background: rgba(15, 15, 15, 0.97);
  border: 1px solid var(--line-strong);
  border-radius: var(--r);
  backdrop-filter: blur(10px);
  z-index: 5;
  animation: modalIn 0.25s ease;
}
.action-modal[hidden] { display: none; }
@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
.action-modal__head, .experiment-overlay__head, .experiment-menu__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.action-modal__title { font-size: 13px; color: var(--ink-soft); font-weight: 500; }
.action-modal__close, .experiment-overlay__close, .experiment-menu__close {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  border-radius: 50%;
  background: #1d1d1d;
  color: var(--ink-mute);
  font-size: 16px;
  line-height: 1;
}
.action-modal__close:hover, .experiment-overlay__close:hover, .experiment-menu__close:hover { color: var(--ink); }
.action-modal__options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.action-opt {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding: 10px 12px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  text-align: start;
  transition: 0.2s;
}
.action-opt:hover {
  border-color: var(--opt-color, var(--accent));
  background: #1d1d1d;
}
.action-opt__title { font-size: 13px; font-weight: 700; color: var(--ink); }
.action-opt__hint { font-size: 11px; color: var(--ink-mute); }
.action-opt__numeric {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--opt-color, var(--accent));
  margin-top: 2px;
}

/* experiment menu */
.experiment-menu {
  position: absolute;
  inset: 60px 24px 90px 24px;
  padding: 18px;
  background: rgba(13, 13, 13, 0.98);
  border: 1px solid var(--accent);
  border-radius: var(--r);
  backdrop-filter: blur(12px);
  z-index: 6;
  display: flex;
  flex-direction: column;
  gap: 12px;
  animation: modalIn 0.25s ease;
}
.experiment-menu[hidden] { display: none; }
.experiment-menu__head {
  font-size: 14px; color: var(--ink);
  margin-bottom: 0;
}
.experiment-menu__head em { color: var(--accent); font-style: normal; font-weight: 700; }
.experiment-menu__list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  overflow-y: auto;
}
.experiment-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  text-align: start;
  transition: 0.2s;
}
.experiment-card:hover {
  border-color: var(--accent);
  background: #1d1614;
}
.experiment-card:disabled { opacity: 0.35; cursor: not-allowed; }
.experiment-card__head { display: flex; align-items: center; gap: 8px; }
.experiment-card__icon { font-size: 22px; }
.experiment-card__title { font-size: 14px; font-weight: 700; color: var(--ink); }
.experiment-card__desc { font-size: 12px; color: var(--ink-soft); line-height: 1.5; }
.experiment-card__avail { font-size: 10px; color: var(--ink-mute); margin-top: auto; font-family: 'JetBrains Mono', monospace; }

/* experiment overlay (running) */
.experiment-overlay {
  position: absolute;
  inset: 60px 24px 24px 24px;
  padding: 16px;
  background: rgba(8, 8, 8, 0.98);
  border: 1px solid var(--accent);
  border-radius: var(--r);
  backdrop-filter: blur(14px);
  z-index: 7;
  display: flex;
  flex-direction: column;
  animation: modalIn 0.3s ease;
}
.experiment-overlay[hidden] { display: none; }
.experiment-overlay__title { font-size: 15px; font-weight: 700; color: var(--accent); }
.experiment-overlay__stage {
  flex: 1;
  display: grid;
  place-items: center;
  min-height: 0;
}
#experimentCanvas {
  max-width: 100%;
  max-height: 100%;
}
.experiment-overlay__caption {
  font-size: 13px;
  color: var(--ink-soft);
  text-align: center;
  padding: 12px 0 0;
  line-height: 1.6;
  min-height: 50px;
  border-top: 1px solid var(--line);
  margin-top: 10px;
}

/* ---- info panel (right) ---- */
.info {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow-y: auto;
}
.card__head { display: flex; align-items: center; justify-content: space-between; }
.card__label {
  font-family: 'JetBrains Mono', monospace;
  font-size: 10px;
  color: var(--ink-mute);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.card__name { font-size: 24px; font-weight: 900; letter-spacing: -0.01em; }
.card__family {
  display: inline-block;
  width: max-content;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 3px;
  background: #1d1d1d;
  color: var(--ink-soft);
  font-weight: 500;
}
.card__family[data-family="igneous"] { background: rgba(255, 122, 61, 0.15); color: var(--igneous); }
.card__family[data-family="sedimentary"] { background: rgba(217, 176, 102, 0.15); color: var(--sedimentary); }
.card__family[data-family="metamorphic"] { background: rgba(138, 169, 209, 0.15); color: var(--metamorphic); }
.card__family[data-family="magma"] { background: rgba(255, 68, 34, 0.18); color: var(--magma); }
.card__origin { font-size: 13px; color: var(--ink-soft); line-height: 1.6; }
.card__signs {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12px;
  color: var(--ink-soft);
}
.card__signs li {
  padding-inline-start: 14px;
  position: relative;
}
.card__signs li::before {
  content: "·";
  position: absolute;
  inset-inline-start: 4px;
  color: var(--accent);
  font-weight: 700;
}
.card__when {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 4px;
  padding: 10px;
  background: var(--bg-deep);
  border-radius: var(--r-sm);
  border-inline-start: 2px solid var(--accent-warm);
}
.card__when-row {
  display: flex; justify-content: space-between; gap: 12px;
  font-size: 11px; align-items: baseline;
}
.card__when-label { color: var(--ink-mute); white-space: nowrap; flex-shrink: 0; }
.card__when-val { color: var(--ink); text-align: end; font-size: 12px; }
.card__where { font-size: 12px; color: var(--ink-mute); margin-top: 2px; }
.card__where em { font-style: normal; color: var(--ink-soft); }
.card__fact {
  font-size: 12px; color: var(--ink-soft); font-style: italic;
  border-inline-start: 2px solid var(--accent);
  padding-inline-start: 10px;
  margin-top: 4px;
}

.history {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 100px;
  flex-shrink: 0;
  max-height: 28vh;
  overflow: hidden;
}
.history__head {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--ink-mute);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.history__count { font-family: 'JetBrains Mono', monospace; }
.history__list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
  overflow-y: auto;
  padding-inline-end: 4px;
}
.history__list li {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px;
  padding: 5px 9px;
  background: #1a1a1a;
  border-radius: var(--r-sm);
  border-inline-start: 3px solid var(--line);
}
.history__list li.is-current {
  border-inline-start-color: var(--accent);
  background: #1f1816;
}
.history__list .h-action {
  font-size: 10px; color: var(--ink-mute);
  font-family: 'JetBrains Mono', monospace;
}
.history__list .h-rock { font-weight: 700; }

/* ---- cycle (between grid and timeline) ---- */
.cycle {
  background: var(--bg-soft);
  border-top: 1px solid var(--line);
  display: grid;
  place-items: center;
}
.cycle__inner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 20px;
}
.cycle__node {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 6px 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg-card);
  min-width: 100px;
  transition: 0.4s;
}
.cycle__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-mute); transition: 0.4s; }
.cycle__name { font-size: 11px; color: var(--ink-soft); font-weight: 500; }
.cycle__arrow { color: var(--ink-mute); font-size: 14px; }
.cycle__node.is-active {
  border-color: var(--accent); background: #1f1816;
  box-shadow: 0 0 24px rgba(255, 122, 61, 0.25);
}
.cycle__node.is-active .cycle__dot { background: var(--accent); }
.cycle__node.is-active .cycle__name { color: var(--ink); }
.cycle__node[data-node="magma"].is-active { border-color: var(--magma); box-shadow: 0 0 24px rgba(255, 68, 34, 0.3); }
.cycle__node[data-node="magma"].is-active .cycle__dot { background: var(--magma); }
.cycle__node[data-node="sedimentary"].is-active { border-color: var(--sedimentary); box-shadow: 0 0 24px rgba(217, 176, 102, 0.25); }
.cycle__node[data-node="sedimentary"].is-active .cycle__dot { background: var(--sedimentary); }
.cycle__node[data-node="metamorphic"].is-active { border-color: var(--metamorphic); box-shadow: 0 0 24px rgba(138, 169, 209, 0.25); }
.cycle__node[data-node="metamorphic"].is-active .cycle__dot { background: var(--metamorphic); }

/* ---- timeline (bottom) ---- */
.timeline {
  background: var(--bg-deep);
  border-top: 1px solid var(--line);
  padding: 8px 16px 6px;
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
#timelineSvg {
  width: 100%;
  height: 56px;
  display: block;
}
.timeline__hint {
  font-size: 11px;
  color: var(--ink-mute);
  font-family: 'JetBrains Mono', monospace;
  text-align: center;
  letter-spacing: 0.03em;
}
.timeline__hint b { color: var(--accent); }

/* timeline svg pieces */
.tl-eon { transition: opacity 0.3s; }
.tl-eon-label { fill: var(--ink); font-size: 10px; font-family: 'Tajawal', sans-serif; pointer-events: none; }
.tl-event-line { stroke: rgba(255,255,255,0.25); stroke-dasharray: 2 3; }
.tl-event-tick { fill: var(--ink-soft); }
.tl-event-label { fill: var(--ink-mute); font-size: 9px; font-family: 'Tajawal', sans-serif; }
.tl-rock-window {
  fill: rgba(255, 122, 61, 0.2);
  stroke: var(--accent);
  stroke-width: 1.5;
  filter: drop-shadow(0 0 6px rgba(255, 122, 61, 0.5));
}

/* ---- responsive ---- */
@media (max-width: 1200px) {
  .lab__grid { grid-template-columns: 220px 1fr 300px; }
}
@media (max-width: 1000px) {
  .lab { grid-template-rows: 56px 1fr auto auto auto; }
  .lab__grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr auto;
  }
  .meters { flex-direction: row; flex-wrap: wrap; max-height: none; }
  .meter { flex: 1 1 130px; }
  .composition { flex-basis: 100%; border-top: 1px solid var(--line); }
  .info { flex-direction: column; }
  .history { max-height: 22vh; }
  .section-wrap { flex-direction: column; }
  .section-legend { width: 100%; max-height: 100px; }
}
