:root {
  color-scheme: dark;
  --bg-black: #000;
  --bg-dark: #0c0c0c;
  --bg-card: #111;
  --bg-elevated: #1a1a1a;
  --border: #222;
  --border-light: #333;
  --text-white: #fff;
  --text-gray: #999;
  --text-muted: #666;
  --text-dim: #444;
  --accent-teal: #0ea5e9;
  --accent-amber: #b7791f;
  --danger: #ef4444;
  --font-heading: "Space Grotesk", Inter, system-ui, sans-serif;
  --font-body: Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg-black);
  color: var(--text-white);
  font-family: var(--font-body);
}

body {
  overflow-x: hidden;
}

button {
  color: inherit;
  font: inherit;
}

button,
canvas {
  -webkit-tap-highlight-color: transparent;
}

.app-shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 20px 40px 40px;
}

.system-strip {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 28px;
  border-bottom: 1px solid var(--border);
  background: #050505;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
}

.brand-lockup,
.header-actions,
.intro-actions,
.viewer-toolbar,
.swatches,
.output-actions button {
  display: flex;
  align-items: center;
}

.brand-lockup {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--border-light);
  background: var(--bg-card);
}

.brand-mark svg,
button svg {
  width: 16px;
  height: 16px;
  stroke-width: 1.75;
}

.brand-mark svg {
  color: var(--accent-teal);
}

.brand-name {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 1.8px;
}

.brand-subtitle,
.eyebrow,
.panel-caption,
.loading-meta {
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.header-actions {
  gap: 10px;
}

.ghost-button,
.solid-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 0;
  padding: 0 16px;
  cursor: pointer;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}

.ghost-button {
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-gray);
}

.ghost-button:hover {
  border-color: var(--border-light);
  color: var(--text-white);
}

.solid-button {
  background: var(--text-white);
  color: var(--bg-black);
  font-weight: 700;
}

.large {
  padding: 0 18px;
}

.intro {
  width: min(760px, 100%);
  margin-bottom: 28px;
}

.intro h1 {
  margin: 10px 0 8px;
  max-width: 820px;
  font-family: var(--font-heading);
  font-size: 46px;
  line-height: 1.05;
  letter-spacing: 0;
}

.intro-copy {
  margin: 0;
  color: var(--text-gray);
  font-size: 16px;
  line-height: 1.55;
}

.intro-actions {
  gap: 12px;
  margin-top: 20px;
}

.showcase-console {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr) 300px;
  gap: 20px;
  min-height: 700px;
  border: 1px solid var(--border);
  background: #050505;
  padding: 24px;
  box-shadow: 0 16px 30px #0009;
}

.control-rail,
.config-panel,
.viewer-wrap {
  border: 1px solid var(--border);
  background: var(--bg-card);
}

.control-rail,
.config-panel {
  padding: 18px;
}

.control-rail,
.config-panel,
.panel-block,
.preset-list,
.output-actions {
  display: flex;
  flex-direction: column;
}

.control-rail {
  gap: 18px;
}

.config-panel {
  gap: 16px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  width: max-content;
  border: 1px solid #0ea5e925;
  background: #0ea5e908;
  padding: 8px 10px;
  color: var(--accent-teal);
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.4px;
}

.status-dot {
  width: 8px;
  height: 8px;
  background: var(--accent-teal);
}

.panel-block {
  gap: 10px;
}

.panel-block h2,
.config-panel h2,
.panel-block h3 {
  margin: 0;
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0;
}

.panel-block h2,
.config-panel h2 {
  font-size: 15px;
}

.panel-block h3 {
  font-size: 14px;
}

.mode-list,
.preset-list,
.output-actions {
  display: grid;
  gap: 8px;
}

.mode-button,
.preset-button,
.hotspot-list button,
.output-actions button,
.tool-button {
  min-height: 36px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-gray);
  cursor: pointer;
  font-size: 12px;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, color 160ms ease;
}

.mode-button,
.preset-button {
  padding: 0 10px;
}

.mode-button:hover,
.preset-button:hover,
.hotspot-list button:hover,
.output-actions button:hover,
.tool-button:hover {
  border-color: var(--border-light);
  color: var(--text-white);
}

.mode-button.is-active,
.preset-button.is-active,
.tool-button.is-active {
  border-color: var(--text-white);
  background: var(--text-white);
  color: var(--bg-black);
  font-weight: 700;
}

.hotspot-list {
  display: grid;
  gap: 2px;
}

.hotspot-list button {
  min-height: 26px;
  border: 0;
  padding: 0;
  background: transparent;
}

.viewer-wrap {
  position: relative;
  overflow: hidden;
  min-height: 652px;
  background:
    radial-gradient(circle at 50% 42%, #24272b 0, #101112 50%, #050505 100%);
}

.viewer {
  position: absolute;
  inset: 0;
}

.viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.grid-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.45;
  background-image:
    linear-gradient(#ffffff0d 1px, transparent 1px),
    linear-gradient(90deg, #ffffff0d 1px, transparent 1px);
  background-size: 160px 160px;
  mask-image: radial-gradient(circle at 50% 48%, #000 0 45%, transparent 78%);
}

.viewer-label {
  position: absolute;
  z-index: 3;
  top: 16px;
  left: 16px;
  border: 1px solid var(--border);
  background: #000b;
  padding: 10px 12px;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
}

.loading-panel {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  width: min(360px, calc(100% - 48px));
  transform: translate(-50%, -50%);
  border: 1px solid var(--border);
  background: #050505e6;
  padding: 18px;
}

.loading-panel.is-hidden {
  display: none;
}

.loading-title {
  margin-bottom: 12px;
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
}

.loading-meter {
  height: 4px;
  background: var(--border);
}

.loading-meter span {
  display: block;
  width: 12%;
  height: 100%;
  background: var(--accent-teal);
  transition: width 200ms ease;
}

.loading-meta {
  margin-top: 12px;
}

.viewer-toolbar {
  position: absolute;
  z-index: 4;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  gap: 8px;
  border: 1px solid var(--border);
  background: #000c;
  padding: 8px;
}

.tool-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-width: 92px;
  padding: 0 12px;
}

.tool-button.icon-only {
  min-width: 36px;
  width: 36px;
  padding: 0;
}

.panel-caption {
  margin: -6px 0 0;
}

.swatches {
  gap: 10px;
}

.swatch {
  width: 100%;
  height: 42px;
  border: 1px solid var(--border-light);
  cursor: pointer;
}

.swatch.polymer {
  background: #1b1d1f;
}

.swatch.bronze {
  border-color: var(--accent-amber);
  background: #7a4a14;
}

.swatch.steel {
  border-color: #cbd5e1;
  background: #9ba3ad;
}

.swatch.is-active {
  outline: 1px solid var(--text-white);
  outline-offset: 3px;
}

.output-actions {
  gap: 8px;
}

.output-actions button {
  gap: 8px;
  justify-content: flex-start;
  padding: 0 10px;
}

.output-actions .primary-output {
  border-color: var(--text-white);
  background: var(--text-white);
  color: var(--bg-black);
  font-weight: 700;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(360px, calc(100vw - 40px));
  border: 1px solid var(--border-light);
  background: #050505;
  color: var(--text-white);
  padding: 12px 14px;
  font-size: 13px;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 180ms ease, transform 180ms ease;
  pointer-events: none;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 1100px) {
  .app-shell {
    padding: 16px;
  }

  .showcase-console {
    grid-template-columns: 1fr;
  }

  .control-rail {
    order: 2;
  }

  .config-panel {
    order: 3;
  }

  .viewer-wrap {
    min-height: 560px;
  }

}

@media (max-width: 680px) {
  .app-shell {
    padding: 8px;
  }

  .system-strip {
    display: none;
  }

  .site-header {
    height: 52px;
  }

  .brand-subtitle,
  .header-actions span,
  .intro-copy,
  .intro-actions {
    display: none;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-name {
    font-size: 12px;
  }

  .header-actions {
    gap: 8px;
  }

  .ghost-button,
  .solid-button {
    width: 36px;
    min-height: 36px;
    padding: 0;
  }

  .intro {
    margin: 10px 0 14px;
  }

  .eyebrow {
    display: none;
  }

  .intro h1 {
    margin: 0;
    max-width: 310px;
    font-size: 30px;
    line-height: 1.08;
  }

  .showcase-console {
    gap: 8px;
    min-height: auto;
    border: 0;
    padding: 0;
    background: transparent;
    box-shadow: none;
  }

  .control-rail {
    display: none;
  }

  .viewer-wrap {
    min-height: 354px;
  }

  .viewer-label {
    top: 12px;
    left: 12px;
    border: 0;
    background: transparent;
    padding: 0;
  }

  .viewer-toolbar {
    width: calc(100% - 36px);
    justify-content: space-between;
    bottom: 14px;
  }

  .tool-button {
    min-width: 34px;
    width: 34px;
    padding: 0;
  }

  .tool-button span {
    display: none;
  }

  .config-panel {
    padding: 16px;
  }

  .output-actions {
    grid-template-columns: repeat(3, 1fr);
    display: grid;
  }

  .output-actions button {
    justify-content: center;
  }

  .output-actions span {
    display: none;
  }

}
