@font-face {
  font-family: Inter;
  src: url("./fonts/Inter-Variable-Cyrillic.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: Inter;
  src: url("./fonts/Inter-Variable-Latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

:root {
  font-family: Inter, Arial, sans-serif;
  color: #1E1B24;
  background: #FFFFFF;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #1E1B24;
  --secondary: #4B4453;
  --muted: #7A7286;
  --accent: #8075FF;
  --accent-hover: #6B60E8;
  --teal: #005B63;
  --surface: #F4F4F6;
  --border: #E0DDE6;
  --warning-bg: #FEF3C7;
  --warning-ink: #92400E;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: #FFFFFF; }
button, input, select { font: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, canvas:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

.topbar {
  height: 62px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 clamp(18px, 4vw, 60px);
  color: #F8FFF8;
  background: #4B4453;
  border-bottom: 2px solid #8075FF;
}
.brand-mark {
  width: 31px; height: 31px; border: 1px solid #AEB8FE; border-radius: 9px;
  display: grid; place-items: center; font-size: 10px; font-weight: 750; color: #F8FFF8;
}
.brand-copy { display: flex; flex-direction: column; gap: 1px; line-height: 1.15; }
.brand-copy strong { font-size: 12px; letter-spacing: .01em; }
.brand-copy span { color: #AEB8FE; font-size: 10px; }
.topbar-caption { margin-left: auto; color: #F8FFF8; font-size: 12px; }

.workspace { width: min(1500px, 100%); margin: 0 auto; padding: 34px clamp(18px, 4vw, 60px) 40px; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.eyebrow, .scene-kicker { margin: 0 0 8px; color: var(--teal); font-size: 10px; line-height: 1.3; font-weight: 700; letter-spacing: .12em; }
h1 { margin: 0; color: var(--ink); font-size: clamp(24px, 3vw, 32px); line-height: 1.15; font-weight: 720; letter-spacing: -.035em; }
.intro { margin: 10px 0 0; max-width: 700px; color: var(--secondary); font-size: 13px; line-height: 1.55; }
.status-badge { flex: 0 0 auto; padding: 8px 11px; border: 1px solid #F2D38D; border-radius: 999px; color: var(--warning-ink); background: var(--warning-bg); font-size: 11px; font-weight: 650; }
.status-badge.is-ok { border-color: #B7E4C7; color: #166534; background: #DCFCE7; }
.status-badge.is-warning { border-color: #F2D38D; color: #92400E; background: #FEF3C7; }

.viewer-layout { display: grid; grid-template-columns: minmax(248px, 292px) minmax(0, 1fr); gap: 18px; align-items: stretch; }
.control-panel { display: flex; flex-direction: column; gap: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: #FFFFFF; box-shadow: 0 8px 26px rgb(19 17 26 / 4%); }
.control-section { padding: 18px 18px 17px; border-bottom: 1px solid var(--border); }
.control-section h2 { margin: 0; color: var(--ink); font-size: 13px; font-weight: 660; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.section-count, .helper { color: var(--muted); font-size: 11px; }
.helper { margin: 7px 0 0; line-height: 1.5; }
.loading-copy { margin: 12px 0 0; color: var(--muted); font-size: 12px; }
.layer-list { display: grid; gap: 6px; margin-top: 11px; }
.layer-option { display: flex; align-items: center; gap: 9px; min-height: 38px; padding: 7px 8px; border: 1px solid transparent; border-radius: 8px; cursor: pointer; color: var(--secondary); font-size: 12px; }
.layer-option:hover { background: var(--surface); }
.layer-option:has(input:checked) { border-color: #D9D5FF; background: #F6F5FF; color: var(--ink); }
.layer-option input { width: 15px; height: 15px; accent-color: var(--accent); }
.fill-option { display: flex; align-items: center; gap: 9px; min-height: 44px; margin-top: 8px; color: var(--secondary); font-size: 13px; cursor: pointer; }
.fill-option input { width: 18px; height: 18px; accent-color: var(--accent); flex: 0 0 auto; }
.fill-status { margin: 0; color: var(--secondary); font-size: 12px; font-weight: 600; }
.layer-color { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.layer-count-badge { margin-left: auto; color: var(--muted); font-size: 10px; }
.field-label { display: block; margin: 13px 0 6px; color: var(--secondary); font-size: 11px; font-weight: 600; }
.control-input { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 8px; color: var(--ink); background: var(--surface); font-size: 12px; }
.segmented { display: flex; gap: 4px; margin-top: 12px; padding: 4px; border-radius: 9px; background: var(--surface); }
.segmented button { flex: 1; min-height: 32px; padding: 0 6px; border: 0; border-radius: 6px; color: var(--secondary); background: transparent; font-size: 10px; cursor: pointer; }
.segmented button[aria-pressed="true"] { color: #1E1B24; background: var(--accent); font-weight: 650; }
.range-input { width: 100%; margin: 10px 0 0; accent-color: var(--accent); }
.range-captions { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; }
.experimental-tag { padding: 4px 7px; border-radius: 999px; color: #3730A3; background: #EEF2FF; font-size: 9px; font-weight: 650; }
.switch-row { display: flex; align-items: center; gap: 9px; margin-top: 13px; color: var(--secondary); font-size: 11px; cursor: pointer; }
.switch-row input { position: absolute; opacity: 0; pointer-events: none; }
.switch { position: relative; width: 32px; height: 18px; margin-left: auto; border-radius: 12px; background: #C8C4CF; transition: background .15s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: white; transition: transform .15s; }
.switch-row input:checked + .switch { background: var(--accent); }
.switch-row input:checked + .switch::after { transform: translateX(14px); }
.switch-row input:focus-visible + .switch { outline: 3px solid var(--accent); outline-offset: 3px; }
.switch-row input:disabled + .switch { opacity: .55; cursor: not-allowed; }
.panel-footnote { display: flex; gap: 9px; align-items: flex-start; margin-top: auto; padding: 15px 18px; background: #FAFAFB; }
.panel-footnote p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.footnote-dot { flex: 0 0 auto; width: 7px; height: 7px; margin-top: 4px; border-radius: 50%; background: #D97706; }

.scene-column { min-width: 0; overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: #FFFFFF; box-shadow: 0 8px 26px rgb(19 17 26 / 4%); }
.scene-toolbar { min-height: 66px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border); }
.scene-kicker { display: block; margin-bottom: 4px; font-size: 9px; }
.scene-title strong { font-size: 13px; font-weight: 650; }
.scene-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.icon-button { min-height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 7px; color: var(--secondary); background: #FFFFFF; font-size: 10px; cursor: pointer; }
.icon-button:hover { border-color: var(--accent); color: var(--accent-hover); }
.canvas-wrap { position: relative; height: clamp(410px, 56vw, 690px); overflow: hidden; background: #FBFBFC; overscroll-behavior: contain; }
#point-canvas { display: block; width: 100%; height: 100%; touch-action: none; }
#tile-captions { position: absolute; inset: 0; pointer-events: none; }
.tile-caption { position: absolute; padding: 5px 7px; border: 1px solid var(--border); border-radius: 6px; color: var(--secondary); background: rgb(255 255 255 / 92%); font-size: 10px; font-weight: 650; }
.render-status { position: absolute; top: 14px; left: 14px; padding: 6px 9px; border-radius: 6px; background: #FFFFFF; color: var(--teal); font-size: 11px; pointer-events: none; }
.render-status[hidden] { display: none; }
.scene-overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--secondary); background: rgb(251 251 252 / 90%); font-size: 12px; text-align: center; pointer-events: none; }
.scene-overlay[hidden] { display: none; }
.loader { width: 24px; height: 24px; border: 2px solid #D9D5FF; border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
#load-progress { width: min(280px, 70%); height: 8px; border: 0; border-radius: 6px; accent-color: var(--accent); overflow: hidden; }
#load-progress::-webkit-progress-bar { background: var(--border); border-radius: 6px; }
#load-progress::-webkit-progress-value { background: var(--accent); border-radius: 6px; transition: width .2s; }
#load-progress::-moz-progress-bar { background: var(--accent); border-radius: 6px; }
#load-detail { color: var(--secondary); font-size: 12px; }
.scene-overlay.is-error .loader { animation: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.axis-labels { position: absolute; top: 16px; right: 16px; display: flex; gap: 5px; pointer-events: none; }
.axis-labels span { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; color: var(--teal); background: #E7F4F4; font-size: 9px; font-weight: 700; }
.scene-hint { position: absolute; left: 14px; bottom: 12px; color: #4B4453; font-size: 10px; pointer-events: none; }
.scene-metrics { display: grid; grid-template-columns: repeat(3, 1fr); padding: 13px 18px; border-top: 1px solid var(--border); }
.scene-metrics div { display: flex; flex-direction: column; gap: 4px; padding: 0 12px; border-left: 1px solid var(--border); }
.scene-metrics div:first-child { padding-left: 0; border-left: 0; }
.scene-metrics span { color: var(--muted); font-size: 10px; }
.scene-metrics strong { color: var(--ink); font-size: 12px; font-weight: 650; }
.scene-note { margin: 0; padding: 0 18px 15px; color: var(--secondary); font-size: 12px; line-height: 1.5; }
.page-footer { display: flex; justify-content: space-between; gap: 16px; padding: 17px clamp(18px, 4vw, 60px); border-top: 1px solid var(--border); color: var(--muted); background: #FFFFFF; font-size: 10px; }

@media (max-width: 840px) {
  .viewer-layout { grid-template-columns: 1fr; }
  .control-panel { order: 2; }
  .scene-column { order: 1; }
  .canvas-wrap { height: min(65vh, 600px); min-height: 360px; }
}
@media (max-width: 520px) {
  .topbar { height: 56px; }
  .topbar-caption { font-size: 10px; }
  .workspace { padding-top: 25px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 13px; }
  .scene-toolbar { align-items: flex-start; flex-direction: column; }
  .scene-actions { width: 100%; }
  .icon-button { flex: 1; }
  .scene-metrics { padding: 12px 9px; }
  .scene-metrics div { padding: 0 8px; }
  .page-footer { flex-direction: column; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

.brand-logo { width: 128px; height: 49px; object-fit: contain; flex: 0 0 auto; }

/* The page stays light; the cloud has a quiet, high contrast viewing surface. */
.canvas-wrap { background: #13111A; }
.scene-hint { color: #F8FFF8; max-width: calc(100% - 28px); line-height: 1.5; }
.scene-note { padding-top: 12px; }
.slice-section { background: #F6F5FF; border-left: 4px solid #8075FF; }
.slice-section h2 { font-size: 15px; }
#slice-value { font-size: 11px; color: #005B63; font-weight: 600; }
.range-input { min-height: 44px; cursor: pointer; }
.control-input, .icon-button, .segmented button, .layer-option { min-height: 44px; }
.scene-actions .icon-button { flex: 1; }
.canvas-wrap:fullscreen, .canvas-wrap.is-expanded { width: 100vw; height: 100dvh; min-height: 0; }
.canvas-wrap.is-expanded { position: fixed; inset: 0; z-index: 100; }
.close-expanded { position: absolute; right: 12px; top: 12px; z-index: 2; }
[hidden] { display: none !important; }
@media (max-width: 840px) {
  .workspace { padding: 20px 12px; }
  .page-heading { margin-bottom: 16px; }
  .canvas-wrap { height: 56dvh; min-height: 300px; }
  .control-panel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .slice-section { grid-column: 1 / -1; grid-row: 1; }
  .panel-footnote { grid-column: 1 / -1; }
}
@media (max-width: 520px) {
  .control-panel { display: flex; }
  .slice-section { order: -1; }
  .scene-hint { font-size: 11px; }
  .control-section { padding: 16px; }
  .topbar-caption { display: none; }
  .layer-option { font-size: 13px; }
  .segmented button { font-size: 12px; }
}

/* An unobstructed scene; gesture instructions belong to the controls. */
.control-panel .scene-hint { position: static; color: var(--muted); font-size: 11px; max-width: none; }
.scene-column { display: flex; flex-direction: column; align-self: start; position: sticky; top: 16px; }
.canvas-wrap { flex: none; height: clamp(480px, calc(100dvh - 240px), 820px); min-height: 480px; }
@media (max-width: 840px) { .scene-column { position: static; } .canvas-wrap { height: 56dvh; min-height: 300px; } }

.variant-picker { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.variant-picker button { min-height: 44px; min-width: 0; padding: 6px 4px; font-size: 13px; white-space: normal; }
#edl-value { color: var(--secondary); font-size: 12px; }
