:root {
  color-scheme: dark;
  --orange: #ff6a00;
  --ink: #070b0f;
  --panel: #10161c;
  --line: rgba(255,255,255,.12);
  --muted: #96a2ab;
  --white: #f7f9fa;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--white);
  font-family: Arial, Helvetica, sans-serif;
  overflow: hidden;
}
button, input { font: inherit; }
button, .file-button { -webkit-tap-highlight-color: transparent; }

.site-header {
  height: 76px;
  display: grid;
  grid-template-columns: 210px 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: #0b1015;
}
.brand { display: block; width: 178px; }
.brand img { display: block; max-width: 100%; height: auto; }
.header-copy { display: flex; align-items: baseline; gap: 12px; }
.header-copy strong { font-size: 17px; text-transform: uppercase; letter-spacing: .02em; }
.eyebrow { color: var(--orange); font-size: 10px; font-weight: 900; letter-spacing: .16em; text-transform: uppercase; }
.back-link { color: #d7dde1; font-size: 12px; font-weight: 800; text-decoration: none; text-transform: uppercase; }
.back-link:hover { color: var(--orange); }

.viewer-shell {
  height: calc(100vh - 76px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 350px;
}
.viewer { position: relative; min-width: 0; overflow: hidden; background: radial-gradient(circle at 50% 38%, #26313a 0, #111920 43%, #070b0f 100%); }
#model-canvas { display: block; width: 100%; height: 100%; outline: none; touch-action: none; }

.toolbar {
  position: absolute;
  top: 18px;
  left: 18px;
  display: flex;
  gap: 5px;
  padding: 5px;
  border: 1px solid var(--line);
  background: rgba(8,13,18,.82);
  box-shadow: 0 14px 40px rgba(0,0,0,.26);
  backdrop-filter: blur(12px);
}
.toolbar button {
  min-width: 42px;
  height: 38px;
  padding: 0 11px;
  border: 0;
  color: #dce3e7;
  background: transparent;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  cursor: pointer;
}
.toolbar button:hover, .toolbar button.is-active { color: #fff; background: var(--orange); }

.navigation-hint {
  position: absolute;
  left: 18px;
  bottom: 18px;
  display: flex;
  gap: 18px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: rgba(8,13,18,.76);
  color: var(--muted);
  font-size: 10px;
  backdrop-filter: blur(10px);
}
.navigation-hint b { color: #fff; }

.info-panel {
  min-width: 0;
  overflow: auto;
  padding: 30px 26px;
  border-left: 1px solid var(--line);
  background: var(--panel);
}
.panel-head h1 { margin: 8px 0 12px; font-size: 29px; line-height: 1; text-transform: uppercase; }
.panel-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.6; }
.model-meta { display: grid; grid-template-columns: repeat(3, 1fr); margin: 25px 0; border: 1px solid var(--line); }
.model-meta div { padding: 12px; border-right: 1px solid var(--line); }
.model-meta div:last-child { border-right: 0; }
.model-meta dt { color: var(--muted); font-size: 9px; font-weight: 800; text-transform: uppercase; }
.model-meta dd { margin: 4px 0 0; font-size: 11px; font-weight: 900; }

.selection { min-height: 205px; padding-top: 20px; border-top: 1px solid var(--line); }
.selection-title { display: flex; justify-content: space-between; align-items: center; color: #fff; font-size: 11px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.selection-title button { border: 0; background: none; color: var(--orange); font-size: 9px; font-weight: 900; cursor: pointer; text-transform: uppercase; }
.selection-empty { display: grid; place-items: center; gap: 8px; padding: 34px 10px; text-align: center; color: var(--muted); }
.selection-empty p { margin: 0; font-size: 12px; }
.selection-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid rgba(255,106,0,.45); border-radius: 50%; color: var(--orange); font-size: 20px; }
.properties { margin: 14px 0 0; }
.properties div { display: grid; grid-template-columns: 95px 1fr; gap: 10px; padding: 9px 0; border-bottom: 1px solid rgba(255,255,255,.07); }
.properties dt { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.properties dd { margin: 0; overflow-wrap: anywhere; font-size: 11px; font-weight: 700; }

.file-button { display: block; margin-top: 22px; padding: 14px 16px; border: 1px solid rgba(255,106,0,.5); cursor: pointer; text-align: center; transition: background .2s; }
.file-button:hover { background: rgba(255,106,0,.1); }
.file-button input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.file-button span, .file-button small { display: block; }
.file-button span { font-size: 11px; font-weight: 900; text-transform: uppercase; }
.file-button small { margin-top: 4px; color: var(--muted); font-size: 9px; }

.loading, .viewer-error {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(330px, calc(100% - 40px));
  transform: translate(-50%, -50%);
  text-align: center;
  z-index: 4;
}
.loading { display: grid; justify-items: center; gap: 10px; }
.loading-ring { width: 42px; height: 42px; border: 2px solid rgba(255,255,255,.16); border-top-color: var(--orange); border-radius: 50%; animation: spin .8s linear infinite; }
.loading strong { font-size: 13px; text-transform: uppercase; }
.loading span { color: var(--muted); font-size: 11px; }
.progress { width: 220px; height: 3px; margin-top: 6px; overflow: hidden; background: rgba(255,255,255,.14); }
.progress i { display: block; width: 5%; height: 100%; background: var(--orange); transition: width .2s; }
.loading.is-hidden { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.viewer-error { padding: 24px; border: 1px solid rgba(255,106,0,.45); background: rgba(11,16,21,.94); }
.viewer-error strong { text-transform: uppercase; }
.viewer-error p { color: var(--muted); font-size: 12px; }
.viewer-error button { padding: 10px 16px; border: 0; background: var(--orange); color: #fff; font-size: 10px; font-weight: 900; cursor: pointer; text-transform: uppercase; }

@media (max-width: 900px) {
  body { overflow: auto; }
  .site-header { height: 66px; grid-template-columns: 145px 1fr auto; padding: 0 16px; gap: 12px; }
  .brand { width: 140px; }
  .header-copy { display: none; }
  .back-link { font-size: 10px; }
  .viewer-shell { height: auto; min-height: calc(100vh - 66px); grid-template-columns: 1fr; grid-template-rows: min(70vh, 620px) auto; }
  .info-panel { border-top: 1px solid var(--line); border-left: 0; }
}
@media (max-width: 560px) {
  .site-header { grid-template-columns: 1fr auto; }
  .viewer-shell { grid-template-rows: 64vh auto; }
  .toolbar { top: 10px; left: 10px; right: 10px; justify-content: center; }
  .toolbar button { min-width: 38px; padding: 0 8px; }
  .navigation-hint { display: none; }
  .info-panel { padding: 25px 20px; }
}
