/* Robot site shared stylesheet (/, /r/{id}, /r/{id}/{stage}): MDIS Robotics Obsidian Studio theme. */
:root {
  --bg: #090b0f;
  --panel: #11151c;
  --panel-2: #0d1016;
  --panel-hover: #181e27;
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #f4f5f7;
  --text-soft: #cbd5e1;
  --muted: #94a3b8;
  --cyan: #38bdf8;
  --cyan-hover: #7dd3fc;
  --green: #34d399;
  --amber: #f59e0b;
  --red: #fb7185;
  --radius: 10px;
  --font-display: "Plus Jakarta Sans", "IBM Plex Sans KR", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-sans: "IBM Plex Sans KR", "Plus Jakarta Sans", "Noto Sans KR", -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  word-break: keep-all;
  overflow-wrap: break-word;
}
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, .brand { font-family: var(--font-display); }
a { color: var(--cyan); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 2px solid var(--cyan);
  outline-offset: 2px;
}
code, .mono, .kpi .v, td.num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}
code, .mono { font-size: 12.5px; }

/* nav */
.topnav {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 56px;
  padding: 8px 24px;
  background: rgba(9, 11, 15, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
  flex-wrap: wrap;
}
.brand {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.015em;
  color: #fff;
}
.brand small { color: var(--muted); font-weight: 500; margin-left: 8px; font-size: 12.5px; }
.topnav nav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.topnav nav a {
  color: var(--muted);
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 11px;
  border-radius: 6px;
  transition: color 0.15s ease, background-color 0.15s ease;
}
.topnav nav a:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.topnav nav a.active { color: var(--bg); background: var(--cyan); font-weight: 600; }
.topnav nav a.legacy { border: 1px dashed var(--border-strong); }

main { max-width: 1360px; margin: 0 auto; padding: 24px 24px 64px; }
h1 { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 6px; color: #fff; }
h2 { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; margin: 0 0 12px; color: #fff; }
.lead { color: var(--muted); margin: 0 0 18px; max-width: 72ch; line-height: 1.6; }
section { margin-top: 28px; }
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}
.note { color: var(--muted); font-size: 12.5px; }

/* hero */
.hero { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.viewer {
  position: relative;
  min-height: 420px;
  background: radial-gradient(ellipse at 50% 35%, #121a28 0%, var(--bg) 72%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.viewer canvas { display: block; width: 100%; height: 100%; }
.viewer .hint { position: absolute; left: 12px; bottom: 10px; color: var(--muted); font-size: 12px; pointer-events: none; }
.kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.kpi {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.kpi .v { font-size: 19px; font-weight: 600; color: #fff; }
.kpi .k { color: var(--muted); font-size: 11.5px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--border-strong);
  color: var(--text-soft);
  background: var(--panel-2);
}
.chip.ok { color: var(--green); border-color: rgba(52, 211, 153, 0.42); background: rgba(52, 211, 153, 0.08); }
.chip.warn { color: var(--amber); border-color: rgba(245, 158, 11, 0.42); background: rgba(245, 158, 11, 0.08); }
.chip.bad { color: var(--red); border-color: rgba(251, 113, 133, 0.42); background: rgba(251, 113, 133, 0.08); }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}
th { color: var(--muted); font-weight: 500; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.bar { position: relative; width: 120px; height: 8px; background: var(--panel-2); border-radius: 4px; overflow: hidden; display: inline-block; vertical-align: middle; }
.bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); border-radius: 4px; }
.bar i.warn { background: var(--amber); }
.bar i.bad { background: var(--red); }

/* parts selection */
.slots { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.slot h3 { font-size: 14px; margin: 0 0 2px; }
.slot .range { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.opt { display: grid; grid-template-columns: 18px 1fr auto; gap: 8px; align-items: start; padding: 8px; border: 1px solid var(--border);
  border-radius: 6px; margin-bottom: 6px; cursor: pointer; }
.opt:hover { border-color: var(--border-strong); }
.opt.selected { border-color: var(--cyan); background: rgba(56, 189, 248, 0.06); }
.opt input { margin-top: 3px; }
.opt .name { font-size: 13px; }
.opt .meta { color: var(--muted); font-size: 12px; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 4px; white-space: nowrap; }
.badge.ok { color: var(--green); background: rgba(52, 211, 153, 0.1); }
.badge.bad { color: var(--red); background: rgba(251, 113, 133, 0.1); }
.summary { margin-top: 14px; display: flex; flex-wrap: wrap; gap: 18px; align-items: center; }
.summary .v { font-weight: 700; font-size: 16px; }

/* mass stack */
.stack { display: flex; height: 22px; border-radius: 5px; overflow: hidden; border: 1px solid var(--border); }
.stack span { display: block; height: 100%; }
.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; font-size: 12px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 5px; vertical-align: -1px; }

.two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 13px;
  border-radius: 7px;
  border: 1px solid var(--border-strong);
  background: var(--panel-hover);
  color: var(--text);
  text-decoration: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:hover { border-color: rgba(56, 189, 248, 0.5); background: #222a36; color: #fff; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--cyan); color: var(--bg); border-color: var(--cyan); font-weight: 600; }
.btn.primary:hover { background: var(--cyan-hover); border-color: var(--cyan-hover); color: var(--bg); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 5px 14px; margin: 0; font-size: 13px; }
dl.facts dt { color: var(--muted); }
dl.facts dd { margin: 0; font-variant-numeric: tabular-nums; }

/* /sim layout */
.sim-grid { display: grid; grid-template-columns: 240px minmax(0, 1fr) 330px; gap: 14px; align-items: start;
  grid-template-areas: "left view res" "omni view res"; grid-template-rows: auto 1fr; }
.sim-left { grid-area: left; display: flex; flex-direction: column; gap: 14px; }
.sim-view { grid-area: view; }
.sim-omni { grid-area: omni; }
.sim-res { grid-area: res; }
.action-card { display: flex; flex-direction: column; gap: 6px; }
.action-card h2 { margin: 0; }
.action-card .note { margin: 0 0 2px; }
.clips-box { padding: 0; }
.clips-box > summary { cursor: pointer; padding: 10px 12px; font-size: 13px; color: var(--muted); }
.clips-box[open] > summary { border-bottom: 1px solid var(--border); }
.runs-more > summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin-top: 8px; }
/* 11-14 page review step 4: the result's first lines stay, the rest and the baseline fold */
.facts-more > summary, .fold > summary { cursor: pointer; font-size: 12.5px; color: var(--muted); margin: 8px 0 4px; }
.facts-more > dl.facts { margin-top: 4px; }
.fold { margin-top: 14px; }
.fold > summary h2 { display: inline; font-size: 15px; margin: 0; color: var(--text); }
.sim-grid > *, .hero > *, .two > *, .slots > * { min-width: 0; }  /* tables scroll inside, not widen the page */

/* /train layout */
.train-grid { display: grid; grid-template-columns: 290px minmax(0, 1fr) 340px; gap: 14px; align-items: start; }
.train-grid > * { min-width: 0; }
.train-clip { padding: 8px 10px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; margin-bottom: 5px; transition: all 0.12s ease; }
.train-clip:hover { background: var(--panel-2); border-color: var(--border); }
.train-clip.active { border-color: var(--cyan); background: rgba(56, 189, 248, 0.08); }
.train-clip .run-top { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; margin-bottom: 2px; }
.train-clip .run-name { font-weight: 700; font-size: 13px; color: #fff; font-family: var(--font-mono); }
.train-clip .run-tagline { color: var(--muted); font-size: 11.5px; line-height: 1.35; margin-top: 3px; word-break: keep-all; }
.train-clip.active .run-tagline { color: #cde4f7; }

/* Step & Status Badges */
.step-badge { font-size: 10px; font-weight: 700; padding: 1px 5px; border-radius: 3px; background: var(--panel-2); border: 1px solid var(--border); color: #94a3b8; display: inline-block; letter-spacing: 0.02em; }
.run-badge { font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 4px; display: inline-block; letter-spacing: 0.01em; }
.run-badge.serving { background: rgba(56, 189, 248, 0.15); color: var(--cyan); border: 1px solid rgba(56, 189, 248, 0.45); }
.run-badge.accepted { background: rgba(52, 211, 153, 0.15); color: var(--green); border: 1px solid rgba(52, 211, 153, 0.4); }
.run-badge.exp { background: rgba(148, 163, 184, 0.12); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.25); }
.run-badge.demo { background: rgba(96, 165, 250, 0.15); color: #60a5fa; border: 1px solid rgba(96, 165, 250, 0.35); }
.run-badge.research { background: rgba(245, 158, 11, 0.15); color: var(--amber); border: 1px solid rgba(245, 158, 11, 0.35); }

/* Run Details Card in Right Panel */
.meta-box { background: var(--panel-2); border: 1px solid var(--border); border-radius: 8px; padding: 12px; margin-bottom: 14px; }
.meta-box .meta-header { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding-bottom: 8px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.meta-box .meta-title { font-size: 13px; font-weight: 700; color: #fff; }
.meta-box .meta-section { margin-top: 8px; }
.meta-box .meta-label { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 2px; }
.meta-box .meta-desc { font-size: 12.5px; line-height: 1.45; color: #e2e8f0; word-break: keep-all; }

.clips { max-height: 640px; overflow-y: auto; padding: 8px; }
.clip { padding: 7px 9px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.clip:hover { background: var(--panel-2); }
.clip.active { border-color: var(--cyan); background: rgba(56, 189, 248, 0.08); }
.clip .cat { color: var(--muted); font-size: 11.5px; }
.clip-group { color: var(--muted); font-size: 11.5px; margin: 10px 4px 4px; text-transform: none; }
.sim-viewer { min-height: 0; height: clamp(460px, 62vh, 680px); }   /* 11-14 page review step 3: the view follows the screen */
.controls { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: 10px; }
.controls input[type=range] { flex: 1; min-width: 140px; }
.readout { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.status-line { margin-top: 8px; font-size: 13px; color: var(--muted); min-height: 20px; }
/* 11-14 main-screen review: the 240 px left column — pad above, each slider under its label */
@media (min-width: 1081px) {
  .sim-omni .omni-panel { padding: 12px !important; }
  .sim-omni .omni-layout { flex-direction: column; align-items: stretch !important; gap: 12px !important; }
  .sim-omni .omni-pad { align-self: center; }
  .sim-omni .omni-sliders { min-width: 0 !important; }
  .sim-omni .omni-sliders .row { flex-wrap: wrap; gap: 2px; }
  .sim-omni .omni-sliders input[type=range] { width: 100% !important; }
  .sim-omni .omni-head .note { font-size: 11px !important; }
}

@media (max-width: 1080px) {
  .sim-grid, .train-grid { grid-template-columns: 1fr; }
  .sim-grid { grid-template-areas: "view" "left" "omni" "res"; grid-template-rows: none; }
  .sim-viewer { height: clamp(340px, 56vh, 560px); }
  .clips { max-height: 220px; }
}
@media (max-width: 900px) {
  .hero, .two { grid-template-columns: 1fr; }
  .slots { grid-template-columns: 1fr; }
  .viewer { min-height: 340px; }
}
@media (max-width: 560px) {
  main { padding: 16px 16px 48px; }
  .topnav { padding: 8px 16px; gap: 8px; }
  /* 11-14 page review step 3: one row — the brand, then the page tabs scrolling sideways (two wrapped rows took 150 px) */
  .topnav { flex-wrap: nowrap; }
  .topnav .brand { flex: none; }
  .topnav nav { flex: 1; min-width: 0; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .topnav nav::-webkit-scrollbar { display: none; }
  .topnav nav a { white-space: nowrap; flex: none; }
  /* the viewer's buttons: no group labels or keyboard keys on a phone, one line each — they covered the top half of the
     view and broke words letter by letter */
  .sim-hud { gap: 4px; flex-wrap: wrap; }
  .controls input[type=range] { min-width: 80px; }   /* play · bar · time · speed on one line */
  .hud-group { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; padding: 3px 4px; }
  .hud-btn { white-space: nowrap; padding: 3px 6px; font-size: 11px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  h1 { font-size: 20px; }
}

/* robot menu (/) and robot pages (/r/{id}) — 2026-10-24 */
a.brand { color: #fff; text-decoration: none; }
.robot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-top: 18px; }
.robot-card { display: flex; flex-direction: column; gap: 14px; padding: 0; overflow: hidden; }
.robot-card .card-viewer { display: block; min-height: 340px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; }
.robot-card-body { padding: 0 18px 18px; }
.robot-card-body h2 { margin-bottom: 2px; }
.robot-card-body .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.crumbs { color: var(--muted); font-size: 13px; margin-bottom: 10px; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: #fff; }
.stage-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.files { margin: 0; padding-left: 18px; }
.files li { margin: 3px 0; }
@media (max-width: 900px) {
  .robot-grid, .stage-cards { grid-template-columns: 1fr; }
  .robot-card .card-viewer { min-height: 280px; }
}

/* retarget page (/r/{id}/retarget) — 2026-10-24 P2 */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 4px 0 6px; }
.tab { background: var(--panel); border: 1px solid var(--border); color: var(--muted); padding: 7px 12px; border-radius: 6px;
  cursor: pointer; font: inherit; font-size: 13px; }
.tab.active { color: var(--text); border-color: var(--cyan); background: rgba(56, 189, 248, 0.08); }
.cats { padding: 4px 2px 8px; gap: 4px; }
.cats .chip, .viewer-toggles .chip { cursor: pointer; background: var(--panel-2); font: inherit; font-size: 12px; }
.cats .chip.on, .viewer-toggles .chip.on { color: var(--cyan); border-color: rgba(56, 189, 248, 0.5); }
.viewer-toggles { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 4px; z-index: 2; }
.clip .badges { display: flex; gap: 4px; margin-top: 3px; }
.gates dd { text-align: right; font-variant-numeric: tabular-nums; }
.gates .ok { color: var(--green); }
.gates .bad { color: var(--red); }
.gates .na { color: var(--muted); }
.torque-row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; padding: 3px 0; border-bottom: 1px solid var(--border); }
.torque-row span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.controls input[type=range] { accent-color: var(--cyan); }
.chip:disabled { opacity: 0.4; cursor: not-allowed; }

/* Omni-directional Pad & Controls — 2026-10-27 */
.omni-pad { display: grid; grid-template-columns: repeat(3, 44px); grid-template-rows: repeat(3, 44px); gap: 4px; }
.omni-btn { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid var(--border-strong); border-radius: 6px; background: var(--panel-2); color: var(--text);
  font-size: 15px; cursor: pointer; transition: all 0.12s ease; padding: 0; user-select: none; }
.omni-btn:hover { border-color: var(--cyan); background: rgba(56, 189, 248, 0.12); }
.omni-btn.active { border-color: var(--cyan); background: var(--cyan); color: var(--bg); font-weight: 700; box-shadow: 0 0 10px rgba(56, 189, 248, 0.3); }
.omni-btn .kbd { position: absolute; top: 2px; left: 4px; font-size: 9px; opacity: 0.6; font-family: var(--font-mono); }
.omni-btn.active .kbd { opacity: 0.9; }

/* Sim 3D Viewport HUD Overlay — 2026-11-10 */
.sim-hud {
  position: absolute;
  top: 10px;
  left: 10px;
  right: 10px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  pointer-events: none;
  z-index: 5;
  flex-wrap: wrap;
}
.hud-label, .hud-key { display: none; }
.hud-group {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(17, 21, 28, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px;
  padding: 4px 6px;
  backdrop-filter: blur(8px);
  pointer-events: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
}
.hud-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 4px;
}
.hud-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 5px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}
.hud-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.hud-btn.active {
  background: rgba(56, 189, 248, 0.16);
  border-color: var(--cyan);
  color: #fff;
}
.hud-key {
  font-family: var(--font-mono);
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 4px;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  color: #cbd5e1;
}
.hud-btn.active .hud-key {
  border-color: var(--cyan);
  color: var(--cyan);
}
