:root {
  color-scheme: dark;
  --ink: #f3f6ef;
  --muted: #a7b0a8;
  --dim: #69736d;
  --acid: #dfff57;
  --panel: #0d1112;
  --line: rgba(255, 255, 255, 0.12);
  --sidebar: 328px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; margin: 0; background: #07090a; color: var(--ink); }

body { overflow: hidden; }

button, input { font: inherit; }
button { color: inherit; }

.app-shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); height: 100%; }

.sidebar {
  position: relative;
  z-index: 20;
  display: flex;
  min-height: 0;
  flex-direction: column;
  padding: 26px 22px 20px;
  border-right: 1px solid var(--line);
  background:
    radial-gradient(circle at 15% 0%, rgba(223, 255, 87, 0.06), transparent 32%),
    linear-gradient(180deg, #0c1011 0%, #090c0d 100%);
}

.brand { display: flex; align-items: center; justify-content: space-between; }
.brand-mark { display: flex; align-items: center; gap: 11px; color: var(--ink); font-size: 12px; font-weight: 850; line-height: .9; letter-spacing: .11em; text-decoration: none; }
.brand-orbit { width: 30px; height: 30px; border: 1px solid rgba(223, 255, 87, .7); border-radius: 50%; box-shadow: inset 0 0 18px rgba(223, 255, 87, .14); transform: rotate(-26deg); }
.brand-orbit::before, .brand-orbit::after { content: ""; position: absolute; background: var(--acid); border-radius: 50%; }
.brand-orbit::before { width: 5px; height: 5px; margin: 2px 0 0 20px; box-shadow: -15px 17px 0 rgba(223, 255, 87, .5); }
.brand-orbit::after { width: 18px; height: 1px; margin: 14px 0 0 -23px; transform: rotate(26deg); opacity: .55; }

.catalog-heading { margin: 52px 4px 28px; }
.eyebrow { margin: 0 0 10px; color: var(--acid); font-size: 10px; font-weight: 800; letter-spacing: .18em; }
.catalog-heading h1 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(38px, 4.5vw, 50px); font-weight: 500; line-height: .91; letter-spacing: -.05em; }
.catalog-copy { max-width: 245px; margin: 18px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.collection-filter { display: grid; gap: 7px; margin-bottom: 14px; }
.collection-filter > span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.collection-filter select { width: 100%; min-height: 42px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: #111718; font: inherit; font-size: 12px; text-overflow: ellipsis; }
.collection-filter select:focus-visible { outline: 2px solid var(--acid); outline-offset: 2px; }

.search-box { display: flex; align-items: center; gap: 10px; height: 44px; padding: 0 13px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .035); transition: border-color .2s, background .2s; }
.search-box:focus-within { border-color: rgba(223, 255, 87, .55); background: rgba(223, 255, 87, .035); }
.search-box svg { width: 17px; fill: none; stroke: var(--dim); stroke-linecap: round; stroke-width: 1.7; }
.search-box input { width: 100%; border: 0; outline: 0; color: var(--ink); background: transparent; font-size: 13px; }
.search-box input::placeholder { color: #66706a; }

.model-list { display: flex; min-height: 0; flex: 1; flex-direction: column; gap: 8px; margin: 16px -5px 14px; padding: 0 5px; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #343c37 transparent; }
.model-card { position: relative; display: grid; grid-template-columns: 45px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; padding: 11px; border: 1px solid transparent; border-radius: 13px; color: var(--muted); text-align: left; background: transparent; cursor: pointer; transition: .2s ease; }
.model-card:hover { color: var(--ink); background: rgba(255, 255, 255, .04); }
.model-card[aria-current="true"] { border-color: rgba(223, 255, 87, .25); color: var(--ink); background: rgba(223, 255, 87, .07); }
.model-card[aria-current="true"]::before { content: ""; position: absolute; inset: 13px auto 13px -6px; width: 2px; border-radius: 2px; background: var(--acid); box-shadow: 0 0 12px var(--acid); }
.model-thumb { display: grid; place-items: center; width: 45px; aspect-ratio: 1; overflow: hidden; border-radius: 9px; background: linear-gradient(145deg, color-mix(in srgb, var(--card-accent) 26%, #101415), #101415); }
.model-thumb img { width: 100%; height: 100%; object-fit: cover; }
.model-thumb span { font-family: Georgia, serif; font-size: 20px; color: var(--card-accent); }
.model-copy { min-width: 0; }
.model-copy strong, .model-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-copy strong { font-size: 13px; font-weight: 720; }
.model-copy small { margin-top: 4px; color: var(--dim); font-size: 10px; text-transform: uppercase; letter-spacing: .09em; }
.model-format { align-self: start; padding: 4px 6px; border: 1px solid var(--line); border-radius: 5px; color: var(--dim); font-size: 8px; font-weight: 800; letter-spacing: .08em; }
.empty-list { margin: 28px 6px; color: var(--dim); font-size: 13px; line-height: 1.5; }

.sidebar-footer { display: flex; justify-content: space-between; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--dim); font-size: 9px; text-transform: uppercase; letter-spacing: .07em; }
.sidebar-footer a { color: inherit; text-decoration: none; }
.sidebar-footer a:hover { color: var(--ink); }
.footer-links { display: flex; gap: 12px; }
.status-dot { display: inline-block; width: 5px; height: 5px; margin-right: 6px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 8px rgba(223, 255, 87, .7); }

.stage { position: relative; min-width: 0; overflow: hidden; background: #101515; isolation: isolate; }
.viewer-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #0b0e0f; }
.stage::after { content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none; background: linear-gradient(180deg, rgba(0,0,0,.35), transparent 22%, transparent 70%, rgba(0,0,0,.52)); }
.stage-glow { position: absolute; z-index: 1; inset: auto -15% -45% 10%; height: 75%; pointer-events: none; background: radial-gradient(ellipse, rgba(223,255,87,.09), transparent 60%); }

.loading-layer { position: absolute; inset: 0; z-index: 8; display: grid; place-content: center; justify-items: center; gap: 18px; background: #0b0e0f; transition: opacity .5s, visibility .5s; }
.loading-layer.is-hidden { opacity: 0; visibility: hidden; }
.loading-layer p { margin: 0; color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .2em; }
.loader-mark { position: relative; width: 55px; height: 55px; animation: spin 4s linear infinite; }
.loader-mark span { position: absolute; width: 8px; height: 8px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 18px rgba(223,255,87,.75); }
.loader-mark span:nth-child(1) { left: 23px; top: 0; }
.loader-mark span:nth-child(2) { right: 3px; bottom: 8px; opacity: .65; }
.loader-mark span:nth-child(3) { left: 2px; bottom: 8px; opacity: .35; }
@keyframes spin { to { transform: rotate(360deg); } }

.topbar { position: absolute; inset: 24px 26px auto; z-index: 6; display: flex; align-items: center; justify-content: space-between; pointer-events: none; }
.topbar-actions { display: flex; align-items: center; gap: 8px; }
.topbar button, .topbar-actions, .menu-button { pointer-events: auto; }
.pill-button, .icon-button, .format-pill, .xr-button { border: 1px solid rgba(255,255,255,.16); background: rgba(9,12,13,.66); box-shadow: 0 8px 28px rgba(0,0,0,.18); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); }
.pill-button { display: none; align-items: center; gap: 9px; height: 42px; padding: 0 14px; border-radius: 22px; font-size: 12px; font-weight: 700; }
.pill-button svg, .icon-button svg, .xr-button svg { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.pill-button svg { width: 18px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border-radius: 50%; cursor: pointer; transition: .2s; }
.icon-button:hover, .pill-button:hover { border-color: rgba(223,255,87,.55); background: rgba(25,30,27,.8); }
.icon-button svg { width: 17px; }
.format-pill { padding: 8px 10px; border-radius: 7px; color: var(--acid); font-size: 9px; font-weight: 850; letter-spacing: .11em; }
.sidebar-close { display: none; font-size: 24px; }

.scene-card { position: absolute; z-index: 5; left: 30px; bottom: 74px; max-width: min(470px, calc(100% - 60px)); text-shadow: 0 2px 18px rgba(0,0,0,.65); pointer-events: none; }
.scene-card h2 { margin: 0; font-family: Georgia, "Times New Roman", serif; font-size: clamp(34px, 5vw, 58px); font-weight: 500; line-height: .95; letter-spacing: -.055em; }
.scene-card > p:not(.eyebrow) { max-width: 440px; margin: 14px 0 0; color: rgba(241,245,238,.74); font-size: 13px; line-height: 1.55; }
.live-dot { display: inline-block; width: 6px; height: 6px; margin-right: 7px; border-radius: 50%; background: var(--acid); box-shadow: 0 0 10px var(--acid); }
.scene-meta { display: flex; gap: 9px; margin-top: 14px; color: rgba(241,245,238,.56); font-size: 9px; font-weight: 750; text-transform: uppercase; letter-spacing: .12em; }
.meta-separator { color: var(--acid); }

.stage-bottom { position: absolute; z-index: 6; right: 26px; bottom: 26px; display: flex; align-items: center; gap: 18px; }
.create-model-button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 9px 16px; border: 1px solid rgba(223,255,87,.5); border-radius: 22px; background: rgba(9,12,13,.85); color: var(--acid); font-size: 12px; font-weight: 750; text-decoration: none; text-align: center; backdrop-filter: blur(14px); }
.create-model-button:hover { background: #252e17; }
.create-model-button:focus-visible { outline: 2px solid var(--acid); outline-offset: 4px; }
.controls-hint { display: flex; gap: 13px; color: rgba(255,255,255,.52); font-size: 9px; text-transform: uppercase; letter-spacing: .08em; }
.controls-hint span { display: flex; align-items: center; gap: 5px; }
.mouse-icon, .wheel-icon { width: 10px; height: 14px; border: 1px solid currentColor; border-radius: 6px; }
.mouse-icon::before { content: ""; display: block; width: 1px; height: 4px; margin: 2px auto; background: currentColor; }
.wheel-icon::before { content: ""; display: block; width: 1px; height: 6px; margin: 3px auto; background: currentColor; }
.key-icon { display: grid; place-items: center; min-width: 16px; height: 16px; border: 1px solid currentColor; border-radius: 3px; font-size: 8px; font-style: normal; }
.xr-button { display: flex; align-items: center; gap: 9px; height: 42px; padding: 0 15px; border-radius: 22px; color: #11150f; background: var(--acid); border-color: var(--acid); font-size: 11px; font-weight: 850; cursor: pointer; }
.xr-button:hover { background: #ecff91; }
.xr-button svg { width: 19px; }
.xr-button[hidden] { display: none; }

.toast { position: absolute; z-index: 30; left: 50%; bottom: 24px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: rgba(8,11,12,.9); font-size: 12px; transform: translate(-50%, 22px); opacity: 0; visibility: hidden; transition: .25s; }
.toast.is-visible { transform: translate(-50%, 0); opacity: 1; visibility: visible; }
.scrim { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 880px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(340px, 88vw); transform: translateX(-105%); transition: transform .28s ease; box-shadow: 20px 0 60px rgba(0,0,0,.55); }
  body.menu-open .sidebar { transform: translateX(0); }
  .scrim { position: fixed; inset: 0; z-index: 15; display: block; visibility: hidden; background: rgba(0,0,0,.55); opacity: 0; transition: .28s; }
  body.menu-open .scrim { visibility: visible; opacity: 1; }
  .sidebar-close, .pill-button { display: grid; }
  .stage { height: 100%; }
  .topbar {
    inset: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) auto max(16px, env(safe-area-inset-left));
  }
  .pill-button { display: flex; }
  .scene-card { left: 18px; bottom: 88px; max-width: calc(100% - 36px); }
  .scene-card h2 { font-size: clamp(35px, 11vw, 52px); }
  .scene-card > p:not(.eyebrow) { display: none; }
  .stage-bottom { left: 16px; right: 16px; bottom: max(20px, env(safe-area-inset-bottom)); justify-content: space-between; gap: 8px; }
  .create-model-button { max-width: 60%; font-size: 11px; padding-inline: 12px; }
  .controls-hint { display: none; }
}

@media (max-height: 700px) {
  .catalog-heading { margin: 28px 4px 18px; }
  .catalog-heading h1 { font-size: 38px; }
  .catalog-copy { display: none; }
  .scene-card { bottom: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
