:root {
  color-scheme: light;
  --bg: #f4f4f4;
  --panel: rgba(255, 255, 255, 0.94);
  --line: rgba(23, 26, 32, 0.11);
  --cyan: #e82127;
  --green: #168a5b;
  --amber: #c87619;
  --red: #e82127;
  --muted: #6a6d72;
  --text: #171a20;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
body { background: radial-gradient(circle at 75% 8%, rgba(232,33,39,.055), transparent 28rem), linear-gradient(180deg, #ffffff 0, #f3f3f3 58%, #eceeed 100%); }
body::before { content: ""; position: fixed; inset: 0; pointer-events: none; opacity: .46; background-image: linear-gradient(rgba(23,26,32,.025) 1px, transparent 1px), linear-gradient(90deg, rgba(23,26,32,.025) 1px, transparent 1px); background-size: 56px 56px; mask-image: linear-gradient(to bottom, black, transparent 78%); }
a { color: inherit; text-decoration: none; }
button, select { font: inherit; }

.shell { width: min(1500px, 100%); margin: auto; padding: 24px; position: relative; z-index: 1; }
.topbar { display: flex; gap: 18px; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark { width: 38px; aspect-ratio: 1; border: 1px solid rgba(232,33,39,.24); border-radius: 12px; display: grid; place-items: center; color: var(--cyan); background:#fff; box-shadow: 0 8px 28px rgba(23,26,32,.08); }
.eyebrow { color: var(--cyan); font: 700 11px/1.2 ui-monospace, SFMono-Regular, monospace; letter-spacing: .18em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(22px, 3vw, 36px); letter-spacing: -.03em; }
h2 { font-size: 18px; }
.muted { color: var(--muted); }
.status { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; background: rgba(255,255,255,.88); border: 1px solid var(--line); border-radius: 999px; color: var(--muted); font-size: 13px; box-shadow:0 8px 28px rgba(23,26,32,.06); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 12px currentColor; }
.status.online .dot { background: var(--green); }
.status.online { color: var(--green); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 18px 55px rgba(23,26,32,.085), inset 0 1px rgba(255,255,255,.7); backdrop-filter: blur(18px); }
.hero { min-height: 72vh; display: grid; align-items: center; grid-template-columns: 1.1fr .9fr; gap: 34px; padding: clamp(28px, 7vw, 88px); overflow: hidden; position: relative; }
.hero h1 { font-size: clamp(44px, 7.5vw, 98px); line-height: .94; max-width: 9ch; }
.hero p { max-width: 52ch; font-size: clamp(16px, 2vw, 20px); line-height: 1.7; }
.orb { width: min(430px, 70vw); aspect-ratio: 1; justify-self: center; border-radius: 50%; border: 1px solid rgba(111,234,255,.35); display: grid; place-items: center; box-shadow: inset 0 0 80px rgba(111,234,255,.10), 0 0 100px rgba(111,234,255,.08); position: relative; }
.orb::before, .orb::after { content: ""; position: absolute; border-radius: 50%; border: 1px dashed rgba(101,255,196,.28); inset: 11%; animation: spin 22s linear infinite; }
.orb::after { inset: 26%; animation-direction: reverse; animation-duration: 13s; }
.arm-glyph { font-size: 92px; filter: drop-shadow(0 0 24px rgba(111,234,255,.45)); }
@keyframes spin { to { transform: rotate(360deg); } }

.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 18px; }
.card { padding: 24px; min-height: 180px; transition: transform .2s, border-color .2s; }
.card:hover { transform: translateY(-3px); border-color: rgba(111,234,255,.48); }
.card .num { font: 700 12px ui-monospace, monospace; color: var(--cyan); }
.card h2 { margin-top: 42px; margin-bottom: 8px; }

.btn { border: 1px solid var(--cyan); color: #fff; background: var(--cyan); padding: 12px 18px; border-radius: 12px; font-weight: 750; cursor: pointer; box-shadow: 0 8px 28px rgba(232,33,39,.14); }
.btn.secondary { color: var(--text); border-color: rgba(23,26,32,.14); background: #f4f4f4; box-shadow: none; }
.btn.danger { color: white; border-color: rgba(255,102,135,.5); background: rgba(255,102,135,.16); box-shadow: none; }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; }

.workspace { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(300px, .5fr); gap: 18px; }
.video-panel { min-height: 65vh; overflow: hidden; position: relative; background: #020507; }
.video-panel video, .video-panel img { display: block; width: 100%; height: 100%; min-height: 65vh; object-fit: contain; background: #010203; }
.video-overlay { position: absolute; inset: 0; pointer-events: none; border: 1px solid rgba(111,234,255,.16); border-radius: 22px; }
.video-overlay::before, .video-overlay::after { content: ""; position: absolute; width: 55px; height: 55px; border-color: var(--cyan); opacity: .7; }
.video-overlay::before { left: 18px; top: 18px; border-left: 2px solid; border-top: 2px solid; }
.video-overlay::after { right: 18px; bottom: 18px; border-right: 2px solid; border-bottom: 2px solid; }
.side { display: grid; align-content: start; gap: 14px; }
.side .panel { padding: 20px; }
.metric { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(111,234,255,.1); font: 13px ui-monospace, monospace; }
.metric:last-child { border-bottom: 0; }
.metric strong { color: var(--cyan); }
.notice { padding: 14px 16px; border-left: 3px solid var(--amber); background: rgba(200,118,25,.07); color: #724516; border-radius: 8px; font-size: 14px; line-height: 1.55; }
.access-error { display: none; max-width: 680px; margin: 14vh auto; padding: 42px; text-align: center; }
.access-error.show { display: block; }
.hidden { display: none !important; }

.joints { display: grid; gap: 10px; }
.joint-row { display: grid; grid-template-columns: 34px 1fr 64px; align-items: center; gap: 10px; color: var(--muted); font: 12px ui-monospace, monospace; }
.joint-track { height: 6px; background: rgba(255,255,255,.07); border-radius: 999px; overflow: hidden; }
.joint-fill { width: 50%; height: 100%; background: linear-gradient(90deg, var(--cyan), var(--green)); box-shadow: 0 0 12px var(--cyan); transition: width .08s linear; }

.workspace.showcase { grid-template-columns: minmax(0, .88fr) minmax(520px, 1.12fr); }
.twin-panel { overflow: hidden; padding: 0 !important; }
.twin-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 17px 18px 12px; }
.twin-badge { padding: 6px 9px; border: 1px solid rgba(232,33,39,.22); border-radius: 999px; color: var(--cyan); background: rgba(232,33,39,.045); font: 700 10px ui-monospace, monospace; letter-spacing: .1em; }
.twin-stage { height: 520px; position: relative; overflow: hidden; background: radial-gradient(circle at 47% 42%, #ffffff 0, #f4f5f5 48%, #e8ebeb 100%); border-top: 1px solid rgba(23,26,32,.07); border-bottom: 1px solid rgba(23,26,32,.07); }
.twin-stage.compact { height: 285px; }
.twin-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.twin-loading { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; color: var(--cyan); font: 12px ui-monospace, monospace; letter-spacing: .12em; background: rgba(255,255,255,.82); transition: opacity .35s; }
.twin-loading.done { opacity: 0; pointer-events: none; }
.twin-hud { position: absolute; z-index: 2; left: 14px; right: 14px; bottom: 12px; display: flex; justify-content: space-between; align-items: end; pointer-events: none; }
.twin-hud-block { padding: 7px 9px; background: rgba(255,255,255,.82); border: 1px solid rgba(23,26,32,.1); border-radius: 8px; backdrop-filter: blur(10px); box-shadow:0 8px 24px rgba(23,26,32,.08); }
.twin-hud strong { display: block; color: var(--cyan); font: 700 11px ui-monospace, monospace; }
.twin-hud span { color: var(--muted); font: 9px ui-monospace, monospace; }
.twin-controls { padding: 13px 15px 15px; display: flex; gap: 9px; align-items: center; flex-wrap: wrap; }
.twin-controls .btn { padding: 8px 11px; font-size: 12px; }
.twin-controls label { flex: 1; min-width: 125px; color: var(--muted); font: 11px ui-monospace, monospace; }
.twin-controls input[type="range"] { width: 100%; accent-color: var(--cyan); }
.joint-readout { padding: 0 15px 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.joint-chip { padding: 7px; border-radius: 7px; background: rgba(111,234,255,.04); border: 1px solid rgba(111,234,255,.09); font: 10px ui-monospace, monospace; color: var(--muted); }
.joint-chip strong { float: right; color: var(--text); }
.gripper-focus-label { position:absolute; z-index:3; right:16px; top:15px; width:38%; padding:9px 11px 82px; border:1px solid rgba(232,33,39,.2); border-radius:14px; background:rgba(255,255,255,.42); color:var(--cyan); font:750 10px ui-monospace,monospace; letter-spacing:.12em; pointer-events:none; }
.gripper-focus-label span { display:block; margin-top:3px; color:var(--muted); font-size:8px; letter-spacing:.08em; }
.gripper-telemetry { display:grid; grid-template-columns:1.1fr .9fr; gap:10px; padding:14px 15px 0; }
.gripper-state { padding:14px; border-radius:13px; background:#171a20; color:#fff; }
.gripper-state span { display:block; color:#a8a9ad; font:9px ui-monospace,monospace; letter-spacing:.12em; }
.gripper-state strong { display:block; margin:5px 0 11px; font-size:22px; letter-spacing:-.02em; }
.grip-meter { height:5px; background:#45484d; border-radius:99px; overflow:hidden; }
.grip-meter i { display:block; width:50%; height:100%; background:var(--cyan); transition:width .12s linear; }
.pose-summary { padding:13px; border-radius:13px; background:#f2f3f3; border:1px solid rgba(23,26,32,.07); }
.pose-summary span { color:var(--muted); font:9px ui-monospace,monospace; letter-spacing:.1em; }
.pose-summary strong { display:block; margin-top:5px; font-size:15px; }
.tcp-coords { grid-column:1/-1; display:grid; grid-template-columns:repeat(3,1fr); gap:7px; }
.tcp-coords div { padding:8px 10px; border-bottom:2px solid rgba(232,33,39,.18); color:var(--muted); font:10px ui-monospace,monospace; }
.tcp-coords strong { float:right; color:var(--text); }

@media (max-width: 840px) {
  .shell { padding: 14px; }
  .hero { grid-template-columns: 1fr; padding: 32px 24px; }
  .orb { width: min(300px, 75vw); }
  .cards, .workspace, .workspace.showcase { grid-template-columns: 1fr; }
  .video-panel, .video-panel video, .video-panel img { min-height: 48vh; }
  .topbar { align-items: flex-start; }
}

/* Full-screen live views: one viewport, no secondary dashboards. */
.live-page { height: 100dvh; overflow: hidden; }
.live-shell { width: 100%; max-width: none; height: 100dvh; padding: 14px 18px; display: flex; flex-direction: column; }
.live-topbar { min-height: 54px; margin: 0 0 12px; flex: 0 0 auto; }
.live-topbar h1 { margin: 1px 0 0; font-size: clamp(22px, 2.1vw, 31px); }
.live-statuses { display: flex; align-items: center; gap: 9px; }
.system-pill { display: flex; align-items: center; gap: 9px; min-height: 36px; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.88); box-shadow: 0 8px 28px rgba(23,26,32,.06); font-size: 12px; color: var(--muted); }
.system-pill strong { color: var(--red); }
.live-layout { flex: 1 1 auto; min-height: 0; height: auto; gap: 12px; }
.operator-layout { grid-template-columns: minmax(420px, .88fr) minmax(560px, 1.12fr); }
.showcase-layout { grid-template-columns: minmax(420px, .82fr) minmax(620px, 1.18fr); }
.live-page .video-panel { min-height: 0; height: 100%; border-radius: 18px; }
.live-page .video-panel video,
.live-page .video-panel img { width: 100%; height: 100%; min-height: 0; object-fit: contain; }
.panel-caption { position: absolute; z-index: 4; left: 12px; top: 12px; display: flex; align-items: center; gap: 9px; padding: 7px 10px; border-radius: 999px; background: rgba(15,17,20,.74); color: #fff; backdrop-filter: blur(12px); font: 700 10px ui-monospace, monospace; letter-spacing: .06em; }
.panel-caption strong { color: #ff8d90; }
.live-page .twin-panel { height: 100%; min-height: 0; display: flex; flex-direction: column; border-radius: 18px; }
.live-page .twin-head { flex: 0 0 auto; padding: 11px 14px 9px; }
.live-page .twin-head h2 { margin: 3px 0 0; font-size: 17px; }
.live-page .twin-stage { flex: 1 1 auto; height: auto; min-height: 260px; }
.live-page .compact-telemetry { flex: 0 0 auto; grid-template-columns: 1fr 1.25fr; gap: 8px; padding: 9px 11px; }
.live-page .gripper-state,
.live-page .pose-summary { min-height: 64px; padding: 9px 11px; border-radius: 10px; }
.live-page .gripper-state strong { margin: 3px 0 7px; font-size: 18px; }
.live-page .pose-summary strong { margin-top: 4px; font-size: 14px; }
.live-page .twin-controls { flex: 0 0 auto; padding: 0 11px 10px; flex-wrap: nowrap; }
.display-page .twin-controls { display: none; }
.live-page .gripper-focus-label { width: 35%; max-width: 270px; padding: 8px 10px 72px; right: 12px; top: 12px; }
.live-page .twin-hud { left: 10px; right: 10px; bottom: 9px; }

.model-joint-tag { --tag-line: 26px; position: absolute; z-index: 5; display: flex; align-items: baseline; gap: 5px; min-width: 76px; padding: 5px 7px; border: 1px solid rgba(232,33,39,.2); border-radius: 8px; background: rgba(255,255,255,.9); box-shadow: 0 7px 20px rgba(23,26,32,.1); backdrop-filter: blur(8px); pointer-events: none; transition: opacity .12s linear; }
.model-joint-tag::after { content: ""; position: absolute; width: var(--tag-line); height: 1px; right: calc(var(--tag-line) * -1); top: 50%; background: linear-gradient(90deg, rgba(232,33,39,.7), rgba(232,33,39,.12)); transform-origin: left; }
.model-joint-tag:nth-of-type(even)::after { right: auto; left: calc(var(--tag-line) * -1); transform: rotate(180deg); transform-origin: right; }
.model-joint-tag span { color: var(--muted); font: 700 8px ui-monospace, monospace; white-space: nowrap; }
.model-joint-tag strong { color: var(--text); font: 800 11px ui-monospace, monospace; white-space: nowrap; }
.model-joint-tag.is-hidden { opacity: 0; }

@media (max-height: 760px) and (min-width: 981px) {
  .live-shell { padding-top: 9px; padding-bottom: 9px; }
  .live-topbar { min-height: 46px; margin-bottom: 8px; }
  .live-topbar .brand-mark { width: 34px; border-radius: 10px; }
  .live-topbar h1 { font-size: 23px; }
  .live-page .twin-head { padding-top: 8px; padding-bottom: 7px; }
  .live-page .compact-telemetry { padding-top: 7px; padding-bottom: 7px; }
  .live-page .gripper-state,
  .live-page .pose-summary { min-height: 56px; }
  .live-page .twin-controls { padding-bottom: 7px; }
}

@media (max-width: 980px) {
  .live-page { height: auto; min-height: 100%; overflow: auto; }
  .live-shell { height: auto; min-height: 100dvh; }
  .live-layout, .operator-layout, .showcase-layout { grid-template-columns: 1fr; height: auto; }
  .live-page .video-panel { height: 46vh; min-height: 320px; }
  .live-page .twin-panel { height: 72vh; min-height: 560px; }
}

