:root {
  --bg: #f7f7f8;
  --surface: #ffffff;
  --text: #17181c;
  --muted: #6b6f7a;
  --line: #e4e5e9;
  --accent: #2f6df6;
  --accent-text: #ffffff;
  --model: #2f6df6;
  --danger: #c43c3c;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111215;
    --surface: #1a1b20;
    --text: #ececf0;
    --muted: #9a9eaa;
    --line: #2a2c33;
    --accent: #5b8cff;
    --model: #6f9bff;
    --danger: #ff7676;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.3), 0 8px 24px rgb(0 0 0 / 0.35);
  }
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
a { color: inherit; }
.top {
  display: flex; align-items: center;
  height: 56px; padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { font-weight: 650; text-decoration: none; letter-spacing: -0.01em; }
.brand span { color: var(--muted); font-weight: 450; margin-left: 4px; }
.muted { color: var(--muted); }
h1 { font-size: 22px; letter-spacing: -0.02em; margin: 8px 0 4px; }

/* model list */
.wrap { max-width: 960px; margin: 0 auto; padding: 40px 24px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); margin-top: 24px; }
.card {
  display: block; padding: 20px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  transition: transform .15s ease, border-color .15s ease;
}
.card:hover { transform: translateY(-2px); border-color: var(--accent); }
.card h2 { font-size: 17px; margin: 0 0 6px; }
.card p { margin: 0; color: var(--muted); font-size: 14px; }

/* configurator */
.layout { display: grid; grid-template-columns: 380px 1fr; min-height: calc(100vh - 56px); }
.panel {
  padding: 24px; overflow-y: auto; max-height: calc(100vh - 56px);
  background: var(--surface); border-right: 1px solid var(--line);
}
.back { color: var(--muted); text-decoration: none; font-size: 14px; }
.mode {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-top: 16px; padding: 4px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px;
}
.mode button {
  height: 32px; border: 0; border-radius: 7px; background: transparent;
  color: var(--muted); font: inherit; font-size: 14px; font-weight: 600; cursor: pointer;
}
.mode button[aria-selected=true] { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
fieldset { border: 0; padding: 0; margin: 20px 0 0; }
fieldset[hidden], .field[hidden] { display: none; }
legend {
  font-size: 12px; font-weight: 600; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin-bottom: 8px;
}
.field { display: block; margin: 0 0 12px; }
.field .label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.field.check { display: flex; align-items: center; gap: 8px; }
.field.check .label { margin: 0; color: var(--text); }
input[type=number], select {
  width: 100%; height: 36px; padding: 0 10px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; font: inherit;
}
input:focus-visible, select:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px;
}
.range-row { display: grid; grid-template-columns: 1fr 88px; gap: 10px; align-items: center; }
input[type=range] { width: 100%; accent-color: var(--accent); }
.actions { display: flex; gap: 10px; margin-top: 24px; position: sticky; bottom: 0; padding: 12px 0; background: var(--surface); }
.primary, .secondary {
  flex: 1; height: 42px; border-radius: 10px; font: inherit; font-weight: 600;
  display: inline-flex; align-items: center; justify-content: center; text-decoration: none; cursor: pointer;
}
.primary { background: var(--accent); color: var(--accent-text); border: 0; }
.primary:disabled { opacity: .6; cursor: progress; }
.secondary { background: transparent; color: var(--text); border: 1px solid var(--line); }
.secondary[hidden] { display: none; }
.status { min-height: 1.5em; font-size: 13px; color: var(--muted); margin: 4px 0 0; }
.status.error { color: var(--danger); }
.viewer { position: relative; height: calc(100vh - 56px); }
.viewer canvas { display: block; width: 100%; height: 100%; }
.hint { position: absolute; inset: 0; display: grid; place-items: center; margin: 0; color: var(--muted); pointer-events: none; padding: 24px; text-align: center; }
.hint[hidden] { display: none; }

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .panel { max-height: none; border-right: 0; border-bottom: 1px solid var(--line); padding: 16px; }
  .viewer { height: 60vh; order: -1; }
  .top { padding: 0 16px; }
  .wrap { padding: 24px 16px; }
}
