:root {
  color-scheme: dark;
  --bg: #0f172a;
  --panel: #111827;
  --panel-alt: #172033;
  --line: #273449;
  --text: #e5edf7;
  --muted: #9fb2c8;
  --accent: #38bdf8;
  --accent-soft: rgba(56, 189, 248, 0.15);
  --base-accent: #f59e0b;
  --base-soft: rgba(245, 158, 11, 0.14);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  overflow: hidden;
}

button,
select,
input {
  font: inherit;
}

button,
select {
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--text);
  border-radius: 10px;
}

button {
  padding: 0.55rem 0.8rem;
  cursor: pointer;
}

button:hover {
  border-color: #3f5a7a;
  background: #1b2940;
}

button.active {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.18);
  color: #d9f6ff;
}

select {
  min-height: 2.3rem;
  padding: 0.5rem 0.65rem;
  width: 100%;
}

a {
  color: #93c5fd;
}

.diff-app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.diff-toolbar {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(10, 16, 28, 0.95);
}

.toolbar-group {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.toolbar-grow {
  flex: 1 1 auto;
}

.field,
.inline-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.inline-field {
  flex: 1 1 auto;
}

.field span,
.helper-text,
.empty-state {
  color: var(--muted);
  font-size: 0.9rem;
}

.diff-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 340px;
  gap: 1rem;
  padding: 1rem;
}

.pane-column,
.sidebar {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.pane-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}

.pane-header h2,
.section-header h2,
.pane-card h3 {
  margin: 0;
}

.viewer-pane,
.pane-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--panel);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.25);
}

.viewer-pane {
  position: relative;
  min-height: 420px;
  overflow: hidden;
  background: radial-gradient(circle at top, #142033 0%, #0b1120 65%);
}

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

.viewer-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 1rem;
  font-weight: 600;
  background: rgba(8, 12, 20, 0.72);
  z-index: 3;
}

.hidden {
  display: none !important;
}

.pane-card {
  padding: 1rem;
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.7rem;
  padding: 0.18rem 0.55rem;
  border-radius: 999px;
  font-size: 0.82rem;
}

.badge.muted {
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(71, 85, 105, 0.18);
  color: #d4dde8;
}

.badge.accent {
  border: 1px solid rgba(56, 189, 248, 0.35);
  background: rgba(56, 189, 248, 0.14);
  color: #d9f6ff;
}

.summary-card {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.summary-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.4rem 0.75rem;
}

.summary-grid dt {
  color: var(--muted);
}

.summary-grid dd {
  margin: 0;
}

.chip-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.chip {
  padding: 0.34rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 0.82rem;
}

.chip.base {
  border-color: rgba(245, 158, 11, 0.35);
  background: var(--base-soft);
  color: #fde7bf;
}

.chip.head {
  border-color: rgba(56, 189, 248, 0.35);
  background: var(--accent-soft);
  color: #d9f6ff;
}

.gallery {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.gallery-card {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  color: inherit;
  text-decoration: none;
}

.gallery-card img {
  width: 100%;
  height: 150px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: white;
}

.gallery-card span {
  font-size: 0.84rem;
  color: var(--muted);
}

.inspector-header {
  align-items: center;
}

.part-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 420px;
  overflow: auto;
  margin-top: 0.75rem;
}

.part-list-item {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  text-align: left;
  padding: 0.55rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-alt);
  color: var(--text);
}

.part-color-swatch {
  width: 0.75rem;
  height: 0.75rem;
  flex: 0 0 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.26);
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.75);
}

.part-list-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.part-list-item.active {
  border-color: rgba(56, 189, 248, 0.55);
  background: rgba(56, 189, 248, 0.12);
}

body.head-only-mode .diff-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
}

body.head-only-mode .pane-column:first-child {
  display: none;
}

@media (max-width: 1400px) {
  .diff-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .sidebar {
    grid-column: 1 / -1;
  }

  body.head-only-mode .diff-layout {
    grid-template-columns: 1fr;
  }

  body.head-only-mode .sidebar {
    grid-column: auto;
  }
}

@media (max-width: 960px) {
  body {
    overflow: auto;
  }

  .diff-layout {
    grid-template-columns: 1fr;
  }

  .diff-toolbar {
    flex-wrap: wrap;
  }

  .viewer-pane {
    min-height: 340px;
  }
}
