/* ═══════════════════════════════════════════
   OpenMRT Web — Design System
═══════════════════════════════════════════ */
:root {
  --bg:        #0a0c10;
  --surface:   #0f1218;
  --surface-2: #161b24;
  --surface-3: #1d2430;
  --border:    rgba(255,255,255,.07);
  --border-hi: rgba(255,255,255,.13);
  --amber:     #f59e0b;
  --amber-dim: rgba(245,158,11,.14);
  --cyan:      #22d3ee;
  --purple:    #a78bfa;
  --red:       #f87171;
  --green:     #34d399;
  --text:      #e2e8f0;
  --text-2:    #afbdd1;
  --text-3:    #8c95a2;
  --font-ui:   'Space Grotesk', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --r-sm: 4px; --r-md: 8px; --r-lg: 14px; --r-xl: 20px;
  --trans: .18s cubic-bezier(.4,0,.2,1);
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { background: var(--bg); color: var(--text); font-family: var(--font-ui); min-height: 100vh; overflow-x: hidden; }
a { color: var(--cyan); }
button { cursor: pointer; border: none; background: none; font: inherit; color: inherit; }

/* ── Pages ── */
.page { display: none; min-height: 100vh; }
.page.active { display: block; }
#page-visionmrt.active { display: flex; height: 100vh; overflow: hidden; }



/* ══════════════════════════════════════════
   LANDING
══════════════════════════════════════════ */
#page-landing {
  flex-direction: column;
  align-items: center;
  padding: 0 24px 60px;
  background: radial-gradient(ellipse 80% 50% at 50% -10%, rgba(245,158,11,.07) 0%, transparent 70%), var(--bg);
}

#page-landing.active {
  display: flex;
}
.site-header { width: 100%; max-width: 1100px; display: flex; align-items: center; justify-content: space-between; padding: 28px 0 0; }
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.2rem; font-weight: 600; }
.logo-mark { color: var(--amber); font-size: 1.4rem; }
.logo-mark.small { font-size: 1rem; }
.logo em { color: var(--amber); font-style: normal; }
.header-pill {
  font-size: .68rem;
  text-decoration: none;
  font-family: var(--font-mono);
  color: var(--text-3);
  border: 1px solid var(--border-hi);
  border-radius: 20px;
  padding: 4px 12px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.header-pill,
.header-pill:visited,
.header-pill:hover,
.header-pill:focus,
.header-pill:active {
  text-decoration: none;
  color: var(--text-3);
}
.site-header a.header-pill {
  font-size: .68rem;
  font-family: var(--font-mono);
  color: var(--text-3);
  border: 1px solid var(--border-hi);
  border-radius: 20px;
  padding: 4px 12px;
  letter-spacing: .06em;
  text-transform: uppercase;

  text-decoration: none;
  text-decoration-line: none;
  border-bottom: none;
  box-shadow: none;
}

.site-header a.header-pill:visited,
.site-header a.header-pill:hover,
.site-header a.header-pill:focus,
.site-header a.header-pill:active {
  color: var(--text-3);
  text-decoration: none;
  text-decoration-line: none;
}

.site-header a.header-pill:hover {
  color: orange;
  border-color: orange;
  text-decoration: none;
}


.hero { text-align: center; max-width: 760px; padding: 80px 0 60px; }
.hero-eyebrow { font-size: .68rem; font-family: var(--font-mono); color: var(--amber); letter-spacing: .12em; text-transform: uppercase; margin-bottom: 24px; }
.hero-title { font-size: clamp(2rem, 5vw, 3.4rem); font-weight: 700; letter-spacing: -.03em; line-height: 1.1; margin-bottom: 24px; }
.hero-title .grad { background: linear-gradient(135deg, var(--amber) 0%, var(--red) 50%, var(--purple) 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text; }
.hero-sub { font-size: .95rem; color: var(--text-2); line-height: 1.7; }
.models { width: 100%; max-width: 1000px; margin-bottom: 40px; }
.models-label { font-size: .65rem; font-family: var(--font-mono); color: var(--text-3); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 16px; text-align: center; }
.model-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.model-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 20px 18px 18px; text-align: left; transition: var(--trans); }
.model-card:not(.disabled-model):hover { border-color: var(--border-hi); background: var(--surface-2); transform: translateY(-2px); box-shadow: 0 8px 32px rgba(0,0,0,.4); }
.active-model { border-color: var(--amber) !important; background: var(--surface-2) !important; box-shadow: 0 0 0 1px var(--amber), 0 8px 40px var(--amber-dim) !important; }
.disabled-model { opacity: .4; cursor: not-allowed; }
.model-badge { position: absolute; top: 12px; right: 12px; font-size: .6rem; font-family: var(--font-mono); letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 20px; background: rgba(52,211,153,.14); color: var(--green); border: 1px solid rgba(52,211,153,.28); }
.model-badge.coming { background: rgba(148,163,184,.08); color: var(--text-3); border-color: var(--border); }
.model-icon { width: 36px; height: 36px; color: var(--amber); margin-bottom: 14px; }
.model-name { font-size: 1rem; font-weight: 600; margin-bottom: 7px; }
.model-desc { font-size: .76rem; color: var(--text-2); line-height: 1.5; margin-bottom: 12px; }
.model-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.model-tags span { font-size: .6rem; font-family: var(--font-mono); color: var(--text-3); border: 1px solid var(--border); border-radius: 20px; padding: 2px 7px; }
.active-model .model-tags span { color: var(--amber); border-color: var(--amber-dim); }
.launch-btn { display: flex; align-items: center; gap: 10px; background: var(--amber); color: #0a0c10; font-size: .92rem; font-weight: 700; padding: 13px 30px; border-radius: var(--r-xl); transition: var(--trans); }
.launch-btn:hover { background: #fbbf24; transform: translateY(-1px); box-shadow: 0 6px 24px rgba(245,158,11,.3); }
.site-footer { margin-top: 60px; display: flex; gap: 12px; align-items: center; font-size: .7rem; font-family: var(--font-mono); color: var(--text-3); }

/* ══════════════════════════════════════════
   WORKSPACE LAYOUT  (sidebar | viewer | results)
══════════════════════════════════════════ */
#page-visionmrt {
  display: none;
  height: 100vh;
  overflow: hidden;
}

#page-visionmrt.active {
  display: flex;
}

/* ── Left sidebar ── */
.sidebar {
  width: 252px; min-width: 252px;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  padding-bottom: 20px;
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 2px; }
.sidebar-header { padding: 16px 16px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; position: sticky; top: 0; background: var(--surface); z-index: 10; }
.back-btn { display: flex; align-items: center; gap: 5px; font-size: .72rem; color: var(--text-3); padding: 3px 7px; border: 1px solid var(--border); border-radius: var(--r-sm); transition: var(--trans); }
.back-btn:hover { border-color: var(--border-hi); color: var(--text-2); }
.sidebar-title { font-size: .88rem; font-weight: 600; color: var(--amber); display: flex; align-items: center; gap: 6px; }


.sample-data-row {
  margin-bottom: 2px;
  padding: 12px 12px;
}

.sample-select {
  width: 100%;
  padding: 9px 34px 9px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);

  /* Custom amber chevron replacing the native arrow */
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23f59e0b' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;

  /* Lets Firefox tint native scrollbars/highlights amber to match */
  accent-color: var(--amber);
}

.sample-select:hover {
  border-color: var(--amber);
  background-color: var(--surface-3);
  box-shadow: 0 0 0 1px rgba(245,158,11,.18);
}

.sample-select:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

.sample-select:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Option-level styling — honored by Firefox, and by some Chromium builds for
   selection/hover highlight color. Not universally supported (native popup
   chrome is OS-controlled), but this covers browsers that do respect it. */
.sample-select option {
  background: var(--surface);
  color: var(--text);
  padding: 8px 10px;
}

.sample-select option:hover,
.sample-select option:focus,
.sample-select option:checked {
  background: var(--amber) !important;
  color: #0a0c10 !important;
}

body.light-mode .sample-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6' fill='none'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23b45309' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}


.custom-select {
  position: relative;
  width: 100%;
}

.custom-select-trigger {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  font-family: var(--font-ui);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--trans), box-shadow var(--trans), background var(--trans);
}

.custom-select-trigger:hover {
  border-color: var(--amber);
  background: var(--surface-3);
  box-shadow: 0 0 0 1px rgba(245,158,11,.18);
}

.custom-select.open .custom-select-trigger {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px var(--amber-dim);
}

.custom-select-chevron {
  color: var(--amber);
  flex-shrink: 0;
  margin-left: 8px;
  transition: transform var(--trans);
}

.custom-select.open .custom-select-chevron {
  transform: rotate(180deg);
}

.custom-select-list {
  list-style: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 220px;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-md);
  box-shadow: 0 12px 32px rgba(0,0,0,.45);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity .16s ease, transform .16s ease;
}

.custom-select.open .custom-select-list {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.custom-select-option {
  padding: 9px 12px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  transition: background var(--trans), color var(--trans);
}

.custom-select-option:hover,
.custom-select-option:focus {
  background: var(--amber);
  color: #0a0c10;
}

.custom-select-option:not(:last-child) {
  border-bottom: 1px solid var(--border);
}

.custom-select-list::-webkit-scrollbar { width: 6px; }
.custom-select-list::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }

body.light-mode .custom-select-list {
  box-shadow: 0 12px 32px rgba(0,0,0,.14);
}


.upload-zone { margin: 12px; border: 1.5px dashed var(--border-hi); border-radius: var(--r-md); padding: 18px 12px; text-align: center; cursor: pointer; transition: var(--trans); }
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--amber); background: var(--amber-dim); }
.upload-icon { color: var(--text-3); margin-bottom: 7px; }
.upload-text { font-size: .78rem; font-weight: 500; margin-bottom: 3px; }
.upload-hint { font-size: .65rem; color: var(--text-3); font-family: var(--font-mono); }

.param-group { padding: 12px 14px 8px; border-bottom: 1px solid var(--border); }
.param-label { font-size: .62rem; font-family: var(--font-mono); color: var(--text-3); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 9px; }
.param-label-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 9px; }
.param-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.param-row label { font-size: .7rem; color: var(--text-3); width: 34px; flex-shrink: 0; }
.param-input { flex: 1; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); color: var(--text); font-family: var(--font-mono); font-size: .75rem; padding: 4px 8px; outline: none; transition: border-color var(--trans); }
.param-input:focus { border-color: var(--amber); }
.param-row.triple { align-items: flex-start; gap: 8px; }
.param-row.triple > div { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.param-row.triple label { width: auto; }
.hour-display { font-family: var(--font-mono); font-size: 1rem; font-weight: 700; color: var(--amber); }
.hour-slider { width: 100%; -webkit-appearance: none; height: 4px; border-radius: 2px; background: var(--surface-3); outline: none; margin-bottom: 6px; }
.hour-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--amber); cursor: pointer; box-shadow: 0 0 0 3px var(--amber-dim); }
.hour-ticks { display: flex; justify-content: space-between; font-size: .6rem; color: var(--text-3); font-family: var(--font-mono); }
.layer-sliders { display: flex; flex-direction: column; gap: 7px; }
.layer-row { display: flex; align-items: center; gap: 7px; }
.layer-row label { font-size: .7rem; color: var(--text-2); width: 60px; flex-shrink: 0; display: flex; align-items: center; gap: 5px; }
.layer-dot { width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }
.layer-dot.color { background: var(--cyan); }
.layer-dot.seg { background: var(--purple); }
.layer-dot.shadow { background: var(--text-3); }
.layer-dot.thermal { background: var(--amber); }
.layer-slider { flex: 1; -webkit-appearance: none; height: 3px; border-radius: 2px; background: var(--surface-3); outline: none; }
.layer-slider::-webkit-slider-thumb { -webkit-appearance: none; width: 10px; height: 10px; border-radius: 50%; background: var(--amber); cursor: pointer; box-shadow: 0 0 0 3px var(--amber-dim); }
.layer-slider::-moz-range-thumb {
  width: 10px;
  height: 10px;
  border: none;
  border-radius: 50%;
  background: var(--amber);
  cursor: pointer;
  box-shadow: 0 0 0 3px var(--amber-dim);
}
.layer-row .pct { font-size: .62rem; font-family: var(--font-mono); color: var(--text-3); width: 28px; text-align: right; }
.action-group { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.action-btn { display: flex; align-items: center; gap: 7px; width: 100%; padding: 9px 14px; border-radius: var(--r-md); font-size: .78rem; font-weight: 600; transition: var(--trans); justify-content: center; border: 1px solid transparent; }
.action-btn.primary { background: var(--amber); color: #0a0c10; }
.action-btn.primary:hover:not(:disabled) { background: #fbbf24; box-shadow: 0 4px 16px rgba(245,158,11,.28); }
.action-btn.secondary { background: var(--amber-dim); color: var(--amber); border-color: rgba(245,158,11,.30); }
.action-btn.secondary:hover:not(:disabled) { background: rgba(245,158,11,.22); border-color: var(--amber); }
.action-btn:disabled { opacity: .32; cursor: not-allowed; }
.status-panel { padding: 8px 14px; border-top: 1px solid var(--border); }
.status-row { display: flex; align-items: flex-start; gap: 7px; font-size: .7rem; color: var(--text-3); }
.status-dot { width: 6px; height: 6px; border-radius: 50%; margin-top: 4px; flex-shrink: 0; transition: background .3s; }
.status-dot.idle      { background: var(--text-3); }
.status-dot.uploading { background: var(--cyan);   animation: pulse .9s infinite; }
.status-dot.processing{ background: var(--amber);  animation: pulse .9s infinite; }
.status-dot.computing { background: var(--amber);  animation: pulse .6s infinite; }
.status-dot.ready     { background: var(--green); }
.status-dot.done      { background: var(--green); }
.status-dot.error     { background: var(--red); }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:.35} }
.progress-bar-wrap { margin-top: 7px; height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--amber); border-radius: 2px; width: 0%; transition: width .4s ease; }
.metric-card { margin: 7px 14px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 14px; }
.metric-label { font-size: .6rem; font-family: var(--font-mono); color: var(--text-3); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 3px; }
.metric-value { font-family: var(--font-mono); font-size: 1.3rem; font-weight: 700; color: var(--cyan); }

/* ── Center viewer ── */
.viewer {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg);
  border-right: 1px solid var(--border);
}
.viewer-tabs { display: flex; gap: 2px; padding: 10px 14px 0; border-bottom: 1px solid var(--border); background: var(--surface); flex-shrink: 0; }
.vtab { font-size: .75rem; font-weight: 500; color: var(--text-3); padding: 7px 14px; border-radius: var(--r-sm) var(--r-sm) 0 0; transition: var(--trans); border: 1px solid transparent; border-bottom: none; position: relative; bottom: -1px; }
.vtab:hover { color: var(--text-2); background: var(--surface-2); }
.vtab.active { color: var(--amber); background: var(--bg); border-color: var(--border); border-bottom-color: var(--bg); }
.tab-content { display: none; flex: 1; overflow: hidden; position: relative; min-height: 0; }
.tab-content.active { display: flex; flex-direction: column; }

/* CubeMap cross — fixed-size cross layout inside a scrollable wrapper */
.cubemap-wrap { flex: 1; display: flex; align-items: center; justify-content: center; overflow: hidden; padding: 12px; position: relative; }

/* The cross grid uses absolute pixel sizes so faces never overflow */
.cubemap-cross {
  display: grid;
  grid-template-columns: repeat(4, 160px);
  grid-template-rows: repeat(3, 160px);
  gap: 0px;                  /* was 2px */
  justify-content: center;
  align-content: center;
  padding: 0;                /* reduce extra whitespace */
  background: transparent;
}

.pixel-track-card {
  font-size: 0.76rem;
}

.pixel-track-card .section-title {
  font-size: 0.70rem;
  letter-spacing: 0.08em;
}

.pixel-track-meta {
  font-size: 0.82rem;
  line-height: 1.35;
  color: var(--text-2);
  word-break: break-word;
}

#chart-surface-pixel {
  width: 100%;
  max-height: 95px;
}

/* Face positions in the cross */
.face-cell { border-radius: var(--r-sm); overflow: hidden; position: relative; background: var(--surface-2); border: 1px solid var(--border); }
.face-cell {
  border-radius: 0;
  overflow: hidden;
  position: relative;
  background: var(--surface-2);

  border: none;
  border-top: 1px solid #f59e0b;
  border-left: 1px solid #f59e0b;
}
.face-cell[data-face="Up"]    { grid-column: 2; grid-row: 1; }
.face-cell[data-face="West"]  { grid-column: 1; grid-row: 2; }
.face-cell[data-face="North"] { grid-column: 2; grid-row: 2; }
.face-cell[data-face="East"]  { grid-column: 3; grid-row: 2; }
.face-cell[data-face="South"] { grid-column: 4; grid-row: 2; }
.face-cell[data-face="Down"]  { grid-column: 2; grid-row: 3; }
.face-cell canvas { width: 160px; height: 160px; display: block; }
.face-cell canvas {
  width: 160px;
  height: 160px;
  display: block;
  image-rendering: pixelated; /* optional, if you want crisper look */
}
/* Add right border only where there is no neighbor on the right */
.face-cell[data-face="Up"],
.face-cell[data-face="South"],
.face-cell[data-face="Down"] {
  border-right: 1px solid #f59e0b;
}

/* Add bottom border only where there is no neighbor below */
.face-cell[data-face="West"],
.face-cell[data-face="East"],
.face-cell[data-face="South"],
.face-cell[data-face="Down"] {
  border-bottom: 1px solid #f59e0b;
}
.face-cell .face-label { position: absolute; bottom: 4px; left: 6px; font-size: .58rem; font-family: var(--font-mono); color: rgba(255,255,255,.45); text-transform: uppercase; letter-spacing: .05em; text-shadow: 0 1px 3px rgba(0,0,0,.8); pointer-events: none; }
.face-cell.loading { display: flex; align-items: center; justify-content: center; }
.face-cell.loading::after { content:''; width:18px; height:18px; border: 2px solid var(--surface-3); border-top-color: var(--amber); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform:rotate(360deg); } }

:root {
  --cubemap-face-size: 210px;
}

.cubemap-cross {
  display: grid;
  grid-template-columns: repeat(4, var(--cubemap-face-size));
  grid-template-rows: repeat(3, var(--cubemap-face-size));
  gap: 0;
  justify-content: center;
  align-content: center;
}

.face-cell canvas {
  width: var(--cubemap-face-size);
  height: var(--cubemap-face-size);
  display: block;
}

.face-placeholder-msg { grid-column: 1 / -1; grid-row: 1 / -1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--text-3); font-size: .82rem; text-align: center; }

.colorbar-overlay { position: absolute; right: 20px; bottom: 20px; display: flex; align-items: stretch; gap: 5px; pointer-events: none; }
.colorbar-overlay img { width: 16px; height: 140px; border-radius: 3px; object-fit: fill; border: 1px solid var(--border-hi); }
#colorbar-labels { display: flex; flex-direction: column; justify-content: space-between; font-family: var(--font-mono); font-size: .6rem; color: var(--text-2); }

/* Panorama */
.pano-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
  background: var(--bg);
}
#panorama-canvas { cursor: grab; display: block; }
#panorama-canvas:active { cursor: grabbing; }
.pano-placeholder { position: absolute; color: var(--text-3); font-size: .82rem; text-align: center; }
.pano-hint { position: absolute; bottom: 12px; left: 50%; transform: translateX(-50%); font-size: .62rem; font-family: var(--font-mono); color: var(--text-3); background: rgba(10,12,16,.7); padding: 3px 10px; border-radius: 20px; pointer-events: none; }

/* Hemisphere */
#tab-hemisphere { background: var(--bg); align-items: center; justify-content: center; }
.hemisphere-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
}
#hemisphere-canvas { border-radius: 50%; display: block; }
.hemi-overlay { position: absolute; bottom: 14px; left: 50%; transform: translateX(-50%); background: rgba(10,12,16,.75); border: 1px solid var(--border-hi); border-radius: 20px; padding: 4px 12px; font-family: var(--font-mono); font-size: .75rem; color: var(--cyan); }
.hemi-placeholder { position: absolute; color: var(--text-3); font-size: .82rem; text-align: center; max-width: 240px; }


/* 3D */
#tab-three { background: var(--bg); }
.three-wrap {
  position: relative;
  width: 100%;
  height: 100%;
  flex: 1;
  overflow: hidden;
  background: linear-gradient(180deg, #87c2eb 0%, var(--bg) 100%);
}
#three-canvas {
  width: 100%;
  height: 100%;
  display: block;
  cursor: crosshair;
}
#three-canvas:active { cursor: crosshair; }
.three-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
  font-size: .82rem;
  text-align: center;
  pointer-events: none;
  padding: 20px;
  z-index: 5;
}
.three-hint {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  font-size: .62rem;
  font-family: var(--font-mono);
  color: var(--text-3);
  background: rgba(10,12,16,.7);
  padding: 3px 10px;
  border-radius: 20px;
  pointer-events: none;
}

.three-loading-box {
  text-align: center;
  pointer-events: none;
  transform: translateY(-45px);
}

.three-loading-title {
  color: #dafbf6;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  margin-bottom: 8px;
}

.three-loading-sub {
  color: var(--text-3);
  font-size: 0.72rem;
  font-family: var(--font-mono);
}

.loading-pulse {
  animation: loadingPulse 2.4s ease-in-out infinite;
}

@keyframes loadingPulse {
  0%, 100% {
    opacity: 0.35;
    transform: scale(0.985);
    text-shadow: 0 0 0 rgba(245, 158, 11, 0);
  }

  50% {
    opacity: 1;
    transform: scale(1.015);
    text-shadow: 0 0 14px rgba(245, 158, 11, 0.75);
  }
}

/* ── Right results sidebar ── */
.results-sidebar {
  width: 260px; min-width: 260px;
  background: var(--surface);
  display: flex; flex-direction: column;
  overflow-y: auto; overflow-x: hidden;
  padding-bottom: 20px;
}
.results-sidebar::-webkit-scrollbar { width: 3px; }
.results-sidebar::-webkit-scrollbar-thumb { background: var(--surface-3); }
.results-header { padding: 16px 16px 14px; border-bottom: 1px solid var(--border); font-size: .7rem; font-family: var(--font-mono); color: var(--text-3); letter-spacing: .1em; text-transform: uppercase; position: sticky; top: 0; background: var(--surface); z-index: 10; }
.results-placeholder { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 40px 20px; color: var(--text-3); font-size: .78rem; text-align: center; flex: 1; }
.results-placeholder strong { color: var(--text-2); }
.results-data { padding: 12px 12px 0; display: flex; flex-direction: column; gap: 10px; }
.wx-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.wx-cell { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 6px; text-align: center; }
.wx-icon { font-size: 1.1rem; margin-bottom: 3px; }
.wx-val { font-family: var(--font-mono); font-size: 1.1rem; font-weight: 700; margin-bottom: 2px; }
.wx-unit { font-size: .58rem; color: var(--text-3); font-family: var(--font-mono); }
.index-cards { display: flex; flex-direction: column; gap: 6px; }
.index-card { border-radius: var(--r-md); padding: 10px 14px; border: 1px solid; display: flex; align-items: center; justify-content: space-between; }
.index-card.mrt  { background: rgba(245,158,11,.07);  border-color: rgba(245,158,11,.22); }
.index-card.utci { background: rgba(52,211,153,.07);  border-color: rgba(52,211,153,.22); }
.index-card.pet  { background: rgba(248,113,113,.07); border-color: rgba(248,113,113,.22); }
.index-label { font-size: .62rem; font-family: var(--font-mono); letter-spacing: .1em; text-transform: uppercase; }
.index-card.mrt  .index-label { color: var(--amber); }
.index-card.utci .index-label { color: var(--green); }
.index-card.pet  .index-label { color: var(--red); }
.index-val { font-family: var(--font-mono); font-size: 1.5rem; font-weight: 700; }
.index-card.mrt  .index-val { color: var(--amber); }
.index-card.utci .index-val { color: var(--green); }
.index-card.pet  .index-val { color: var(--red); }
.index-unit { font-size: .7rem; color: var(--text-3); font-family: var(--font-mono); }
.cat-row { font-size: .68rem; color: var(--text-3); font-family: var(--font-mono); padding: 7px 10px; background: var(--surface-2); border-radius: var(--r-sm); border: 1px solid var(--border); }
.chart-block { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 10px 12px; }
.chart-label { font-size: .6rem; font-family: var(--font-mono); color: var(--text-3); letter-spacing: .08em; text-transform: uppercase; margin-bottom: 8px; }


/* Light mode variable override */
body.light-mode {
  --bg:        #f8fafc;
  --surface:   #ffffff;
  --surface-2: #f1f5f9;
  --surface-3: #e2e8f0;
  --border:    rgba(15,23,42,.12);
  --border-hi: rgba(15,23,42,.20);
  --amber-dim: rgba(245,158,11,.16);
  --text:      #0f172a;
  --text-2:    #475569;
  --text-3:    #64748b;
}

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.sample-data-link.small {
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: var(--accent);
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.85;
}

.sample-data-link.small:hover {
  opacity: 1;
  text-decoration: underline;
}

/* Keep the toggle on the far right of the tab bar */
.viewer-tabs {
  align-items: flex-end;
}

.theme-toggle {
  margin-left: auto;
  margin-bottom: 5px;
  width: 54px;
  height: 26px;
  border-radius: 999px;
  position: relative;
  background: var(--surface-2);
  border: 1px solid var(--border-hi);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.04);
  transition: background .25s ease, border-color .25s ease, box-shadow .25s ease;
}

.theme-toggle:hover {
  border-color: var(--amber);
  box-shadow: 0 0 14px rgba(245,158,11,.22);
}

.theme-toggle-knob {
  position: absolute;
  top: 3px;
  left: 4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 2px 8px rgba(0,0,0,.28);
  transition: transform .25s ease;
}

.theme-toggle-icon {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-52%);
  font-size: .72rem;
  line-height: 1;
  color: var(--text-2);
  transition: left .25s ease, right .25s ease, color .25s ease;
  pointer-events: none;
}

.theme-toggle.light .theme-toggle-knob {
  transform: translateX(27px);
}

.theme-toggle.light .theme-toggle-icon {
  right: auto;
  left: 8px;
  color: var(--amber);
}

body.light-mode .three-placeholder {
  color: var(--text-2);
}

body.light-mode .three-hint {
  background: rgba(255,255,255,.72);
  color: var(--text-2);
  border: 1px solid var(--border);
}


/* ── Results header actions: instruction + sample data ── */

.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.results-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Circular instruction button */
button#instruction-btn.instruction-btn.icon {
  all: unset !important;

  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;

  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;

  box-sizing: border-box !important;
  border: 1px solid var(--amber) !important;
  border-radius: 50% !important;

  color: var(--amber) !important;
  background: transparent !important;

  font-family: "Times New Roman", "Brush Script MT", cursive !important;
  font-size: 13px !important;
  font-weight: 700 !important;
  font-style: italic !important;
  /* line-height: 1 !important; */

  text-transform: none !important;
  text-decoration: none !important;

  cursor: pointer !important;
  opacity: 0.9 !important;
}

button#instruction-btn.instruction-btn.icon:hover {
  opacity: 1 !important;
  background: rgba(245, 158, 11, 0.12) !important;
}

/* Sample data link */
.sample-data-link.small {
  font-size: 10px;
  font-weight: 600;
  line-height: 1;
  color: var(--amber);
  text-decoration: none;
  white-space: nowrap;
  opacity: 0.85;
}

.sample-data-link.small:hover {
  opacity: 1;
  color: var(--amber);
  text-decoration: underline;
}

/* Instruction dropdown box */
.instruction-box {
  display: grid;
  grid-template-rows: 0fr;
  margin: 0 7px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  line-height: 1.45;
  opacity: 0;
  border-width: 0;
  margin-top: 0;
  margin-bottom: 0;
  transform: translateY(-4px);
  transition:
    grid-template-rows 0.32s cubic-bezier(.4,0,.2,1),
    opacity 0.22s ease,
    transform 0.28s cubic-bezier(.4,0,.2,1),
    border-width 0.28s ease,
    margin 0.28s ease;
}

.instruction-box.active {
  grid-template-rows: 1fr;
  opacity: 1;
  border-width: 1px;
  margin: 8px 7px 12px 7px;
  transform: translateY(0);
}

.instruction-box-inner {
  overflow: hidden;
  min-height: 0;   /* required for grid children to actually shrink/grow correctly */
  padding: 0 12px;
}

.instruction-box.active .instruction-box-inner {
  padding: 10px 12px;
}

.instruction-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 6px;
}

.instruction-box ol {
  margin: 0;
  padding-left: 18px;
}

.instruction-box li {
  margin-bottom: 5px;
}

.instruction-box code {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--amber);
}

.instruction-note {
  margin-top: 8px;
  padding-top: 7px;
  border-top: 1px solid var(--border);
  color: var(--text-3);
  font-size: 10px;
}

body.light-mode .face-cell .face-label {
  color: rgba(15, 23, 42, 0.55) !important;
  text-shadow: 0 1px 2px rgba(255, 255, 255, 0.75) !important;
}


.layer-row.layer-disabled {
  opacity: 0.45;
}

.layer-row.layer-disabled label,
.layer-row.layer-disabled .pct {
  color: var(--text-3) !important;
}

.layer-row.layer-disabled .layer-slider {
  cursor: not-allowed;
}

.layer-row.layer-disabled .layer-slider::-webkit-slider-thumb {
  cursor: not-allowed;
  background: var(--text-3);
}

.model-card.webmrt-model {
  display: block;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}

.model-card.webmrt-model:visited,
.model-card.webmrt-model:hover,
.model-card.webmrt-model:focus,
.model-card.webmrt-model:active {
  color: inherit;
  text-decoration: none;
}

.model-card.webmrt-model:hover {
  border-color: var(--amber);
  background: var(--surface-2);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(0,0,0,.4);
}

/* ── Citation box ── */
.citation-box {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px 12px;
  margin: 0 6px 6px;
}
.citation-text {
  font-size: .68rem;
  line-height: 1.55;
  color: var(--text-2);
  margin-bottom: 9px;
}
.citation-text em {
  color: var(--text);
  font-style: italic;
}
.citation-copy-btn {
  font-size: .62rem;
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--amber);
  background: var(--amber-dim);
  border: 1px solid rgba(245,158,11,.30);
  border-radius: 20px;
  padding: 4px 12px;
  transition: var(--trans);
}
.citation-copy-btn:hover {
  background: rgba(245,158,11,.22);
  border-color: var(--amber);
}
.citation-note {
  margin-top: 7px;
  font-size: .6rem;
  font-family: var(--font-mono);
  color: var(--text-3);
}

.stale-toast {
  position: fixed;
  top: 64px;
  left: 278px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 320px;
  background: rgba(15,18,24,.94);
  border: 1px solid var(--amber);
  border-radius: var(--r-lg);
  padding: 10px 12px 10px 14px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45), 0 0 0 1px rgba(245,158,11,.15);
  backdrop-filter: blur(6px);
  font-size: .76rem;
  color: var(--text);
  opacity: 0;
  transform: translateY(-8px) scale(.97);
  pointer-events: none;
  transition: opacity .28s cubic-bezier(.4,0,.2,1), transform .28s cubic-bezier(.4,0,.2,1);
}
.stale-toast.active {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}
.stale-toast-icon {
  font-size: 1rem;
  color: var(--amber);
  flex-shrink: 0;
}
.stale-toast-text {
  line-height: 1.4;
  flex: 1;
}
.stale-toast-close {
  flex-shrink: 0;
  background: transparent;
  border: none;
  color: var(--text-3);
  font-size: .8rem;
  cursor: pointer;
  padding: 2px 4px;
  transition: color var(--trans);
}
.stale-toast-close:hover {
  color: var(--amber);
}
body.light-mode .stale-toast {
  background: rgba(255,255,255,.94);
  border-color: var(--amber);
  color: var(--text);
}

/* ── Floating "running" status toast (top-left) ── */
.running-toast {
  position: fixed;
  top: 64px;
  left: 278px;
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 9px;
  background: rgba(15,18,24,.92);
  border: 1px solid var(--border-hi);
  border-radius: var(--r-lg);
  padding: 10px 16px 10px 12px;
  box-shadow: 0 8px 28px rgba(0,0,0,.45);
  backdrop-filter: blur(6px);
  font-size: .78rem;
  color: var(--text);
  opacity: 0;
  transform: translateY(-8px) scale(.97);
  pointer-events: none;
  transition: opacity .32s cubic-bezier(.4,0,.2,1), transform .32s cubic-bezier(.4,0,.2,1);
}
.running-toast.active {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.running-toast-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--amber);
  flex-shrink: 0;
  animation: pulse .9s infinite;
  margin-top: 2px;
  align-self: flex-start;
}
.running-toast-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 140px;
}
.running-toast-text {
  font-weight: 500;
  white-space: nowrap;
}
.running-toast-progress-wrap {
  height: 3px;
  border-radius: 2px;
  background: rgba(255,255,255,.12);
  overflow: hidden;
}
.running-toast-progress-bar {
  height: 100%;
  width: 0%;
  background: var(--amber);
  border-radius: 2px;
  transition: width .4s ease;
}

body.light-mode .running-toast {
  background: rgba(255,255,255,.92);
  border-color: var(--border);
  color: var(--text);
}


body.light-mode .running-toast-progress-wrap {
  background: rgba(15,23,42,.12);
}


.action-btn.btn-locked {
  opacity: .38;
  cursor: not-allowed;
  filter: grayscale(.5);
  position: relative;
}

.action-btn.btn-locked::after {
  content: '🔒';
  font-size: .7rem;
  margin-left: 6px;
  opacity: .85;
}

.action-btn.btn-locked:hover {
  transform: none !important;
  box-shadow: none !important;
}


/* Kill native number-input spinners cross-browser */
.param-input[type="number"]::-webkit-outer-spin-button,
.param-input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.param-input[type="number"] {
  -moz-appearance: textfield;
  appearance: textfield;
}

/* Wrapper that holds the input + custom stepper buttons */
.number-stepper {
  position: relative;
  display: flex;
  align-items: stretch;
  flex: 1;
}

.number-stepper .param-input {
  flex: 1;
  padding-right: 26px; /* room for the stacked arrows */
}

.stepper-arrows {
  position: absolute;
  right: 3px;
  top: 3px;
  bottom: 3px;
  width: 18px;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
}

.stepper-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--trans);
  line-height: 1;
  padding: 0;
  border: none;
  user-select: none;
}

.stepper-btn:first-child {
  border-bottom: 1px solid var(--border);
}

.stepper-btn:hover {
  color: var(--amber);
  background: var(--amber-dim);
}

.stepper-btn:active {
  background: rgba(245,158,11,.28);
}

.stepper-btn svg {
  width: 8px;
  height: 8px;
  pointer-events: none;
}