/* Honda CR-V RE Anatomy — dark workshop studio theme. */

:root {
  --bg: #0a0c0f;
  --panel: rgba(17, 21, 26, 0.92);
  --panel-solid: #11151a;
  --panel-2: rgba(22, 27, 33, 0.94);
  --line: rgba(255, 255, 255, 0.085);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #e8ecf1;
  --muted: #98a3af;
  --muted-2: #6c7783;
  --accent: #5ab0f2;
  --accent-dim: rgba(90, 176, 242, 0.16);
  --accent-line: rgba(90, 176, 242, 0.55);
  --amber: #e0a54b;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  --font: "Inter", "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#app { position: fixed; inset: 0; overflow: hidden; }

#stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  outline: none;
  cursor: grab;
}
#stage.dragging { cursor: grabbing; }
#stage.pointing { cursor: pointer; }

/* ------------------------------- top bar ------------------------------- */
#topbar {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 16px;
  background: linear-gradient(180deg, rgba(8, 10, 13, 0.92), rgba(8, 10, 13, 0));
  pointer-events: none;
  z-index: 20;
}
#topbar > * { pointer-events: auto; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  border-radius: 10px;
  background: linear-gradient(160deg, rgba(90, 176, 242, 0.22), rgba(90, 176, 242, 0.04));
  border: 1px solid var(--line);
  color: #cfe4f5;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 14px; letter-spacing: 0.02em; }
.brand-text em { font-style: normal; font-size: 11px; color: var(--muted-2); letter-spacing: 0.06em; text-transform: uppercase; }

.topbar-centre { display: flex; gap: 8px; }
.model-chip {
  font-size: 11.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  background: rgba(12, 15, 19, 0.7);
  padding: 5px 11px;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.model-chip b { color: var(--text); font-weight: 600; }

.topbar-actions { display: flex; align-items: center; gap: 8px; }

button { font-family: inherit; color: inherit; }

.ghost-btn, .solid-btn, .icon-btn, .cam-btn, .chip-btn {
  border: 1px solid var(--line);
  background: rgba(16, 20, 25, 0.82);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, transform 0.12s ease;
}
.ghost-btn:hover, .icon-btn:hover, .cam-btn:hover, .chip-btn:hover { background: rgba(30, 38, 46, 0.95); border-color: var(--line-strong); }
.solid-btn { background: var(--accent); color: #05121d; border-color: transparent; font-weight: 600; }
.solid-btn:hover { background: #7cc3f8; }
.solid-btn.small, .ghost-btn.small { padding: 6px 10px; font-size: 12px; }
.icon-btn { display: grid; place-items: center; width: 38px; height: 38px; padding: 0; }
.icon-btn.small { width: 28px; height: 28px; border-radius: 8px; }
button:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------ side panels ----------------------------- */
#catalogue, #inspector {
  position: absolute;
  top: 66px;
  bottom: 112px;
  width: 314px;
  display: flex;
  flex-direction: column;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  z-index: 15;
  overflow: hidden;
}
#catalogue { left: 14px; }
#inspector { right: 14px; width: 336px; }

.panel-head { padding: 14px 15px 8px; }
.panel-head h2 { margin: 0; font-size: 13px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted-2); }
.panel-head .muted { margin: 4px 0 0; font-size: 12px; }

.search-row { display: flex; align-items: center; gap: 6px; padding: 6px 12px 10px; }
#part-search {
  flex: 1;
  min-width: 0;
  background: rgba(8, 10, 13, 0.75);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  padding: 9px 11px;
  font-size: 13px;
}
#part-search::placeholder { color: var(--muted-2); }
#search-clear { display: none; }
.search-row.has-value #search-clear { display: grid; }

.group-list { flex: 1; overflow-y: auto; padding: 2px 10px 14px; scrollbar-width: thin; }
.group-list::-webkit-scrollbar { width: 9px; }
.group-list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; }

.group { margin-bottom: 6px; }
.group-head {
  width: 100%;
  display: grid;
  grid-template-columns: 18px 1fr auto;
  align-items: center;
  gap: 8px;
  text-align: left;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 9px 10px;
  font-size: 13.5px;
  cursor: pointer;
}
.group-head:hover { background: rgba(255, 255, 255, 0.06); }
.group-head .chev { transition: transform 0.18s ease; color: var(--muted-2); font-size: 11px; }
.group.open .group-head .chev { transform: rotate(90deg); }
.group-head.active { border-color: var(--accent-line); background: var(--accent-dim); }
.group-head .count {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.07);
  border-radius: 999px;
  padding: 1px 7px;
}
.group-body { display: none; padding: 4px 2px 2px 10px; }
.group.open .group-body { display: block; }
.sub-head { font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted-2); margin: 8px 0 3px; }
.part-row {
  display: flex; align-items: center; gap: 8px;
  width: 100%; text-align: left;
  background: none; border: 0; border-radius: 8px;
  padding: 6px 8px; font-size: 13px; color: #cfd7df; cursor: pointer;
}
.part-row:hover { background: rgba(255, 255, 255, 0.055); color: #fff; }
.part-row.active { background: var(--accent-dim); color: #eaf4fe; box-shadow: inset 2px 0 0 var(--accent); }
.part-row .swatch { width: 7px; height: 7px; border-radius: 50%; background: var(--muted-2); flex: none; }
.part-row.active .swatch { background: var(--accent); }
.panel-foot { margin: 0; padding: 10px 15px 13px; font-size: 11px; border-top: 1px solid var(--line); }

/* ------------------------------- inspector ------------------------------ */
.inspector-body { flex: 1; overflow-y: auto; padding: 16px; scrollbar-width: thin; }
.inspector-body::-webkit-scrollbar { width: 9px; }
.inspector-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.12); border-radius: 8px; }

.empty-state h2 { margin: 4px 0 8px; font-size: 17px; }
.empty-state p { color: var(--muted); font-size: 13.5px; margin: 0 0 14px; }
.empty-tips { list-style: none; padding: 0; margin: 0; display: grid; gap: 7px; }
.empty-tips li { font-size: 12.5px; color: var(--muted-2); border-left: 2px solid var(--line-strong); padding-left: 10px; }
.empty-tips b { color: var(--muted); }

.insp-tagrow { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 9px; }
.tag {
  font-size: 10.5px; letter-spacing: 0.07em; text-transform: uppercase;
  border-radius: 999px; padding: 3px 9px; border: 1px solid var(--line);
  color: var(--muted); background: rgba(255, 255, 255, 0.04);
}
.tag.group { color: #cfe6fa; border-color: var(--accent-line); background: var(--accent-dim); }
.tag.verified { color: #bfe6c8; border-color: rgba(120, 220, 150, 0.35); background: rgba(90, 200, 130, 0.1); }
.tag.representative { color: #f0d6a8; border-color: rgba(224, 165, 75, 0.35); background: rgba(224, 165, 75, 0.1); }
.insp-title { margin: 0 0 6px; font-size: 19px; line-height: 1.25; }
.insp-subtitle { margin: 0 0 14px; color: var(--muted); font-size: 13px; }
.insp-desc { font-size: 14px; color: #d7dee6; margin: 0 0 16px; }

.spec-list { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 14px; }
.spec { background: var(--panel-2); padding: 9px 11px; }
.spec dt { font-size: 10.5px; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted-2); margin-bottom: 3px; }
.spec dd { margin: 0; font-size: 13px; color: #dbe3ea; }

.action-row { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.action-row .solid-btn, .action-row .ghost-btn { flex: 1 1 auto; }

.insp-progress { border-top: 1px solid var(--line); padding-top: 12px; }
.insp-progress .label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--muted-2); margin-bottom: 6px; }
.bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #9ad4ff); transition: width 0.12s linear; }
.insp-progress .value { font-family: var(--mono); font-size: 12px; color: var(--muted); margin-top: 6px; }

.breadcrumb { font-size: 11.5px; color: var(--muted-2); margin-bottom: 10px; }
.breadcrumb button { background: none; border: 0; color: var(--muted); cursor: pointer; padding: 0; font-size: 11.5px; text-decoration: underline; }

/* ------------------------------ stage tools ----------------------------- */
#stage-tools { position: absolute; inset: 0; pointer-events: none; z-index: 14; }
.isolate-banner {
  position: absolute; top: 70px; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 10px;
  background: rgba(12, 16, 21, 0.92);
  border: 1px solid var(--accent-line);
  border-radius: 999px; padding: 7px 8px 7px 14px;
  font-size: 12.5px; box-shadow: var(--shadow); pointer-events: auto;
  max-width: min(92vw, 520px);
}
.isolate-banner .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(90, 176, 242, 0.18); flex: none; }
#isolate-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hover-chip {
  position: absolute; pointer-events: none; transform: translate(-50%, -140%);
  background: rgba(10, 13, 17, 0.92); border: 1px solid var(--line-strong);
  border-radius: 7px; padding: 4px 8px; font-size: 12px; white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
}

/* ------------------------------- bottom bar ----------------------------- */
#bottombar {
  position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%);
  width: min(1080px, calc(100vw - 28px));
  display: flex; align-items: center; gap: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  padding: 12px 16px 10px; z-index: 16;
}
.explode-block { flex: 1 1 auto; min-width: 0; }
.explode-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 7px; }
.explode-head label { font-size: 12px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.readout { font-family: var(--mono); font-size: 12.5px; color: var(--text); }
#explode-slider { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; cursor: pointer; margin: 0; }
#explode-slider::-webkit-slider-runnable-track {
  height: 6px; border-radius: 999px;
  background: linear-gradient(90deg, rgba(90, 176, 242, 0.65) var(--fill, 0%), rgba(255, 255, 255, 0.1) var(--fill, 0%));
}
#explode-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 20px; height: 20px; margin-top: -7px;
  border-radius: 50%; background: #eaf4fe; border: 3px solid var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}
#explode-slider::-moz-range-track { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); }
#explode-slider::-moz-range-progress { height: 6px; border-radius: 999px; background: rgba(90, 176, 242, 0.7); }
#explode-slider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #eaf4fe; border: 3px solid var(--accent); }
.explode-hints { display: flex; justify-content: space-between; font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted-2); margin-top: 2px; }

.camera-cluster { display: grid; grid-template-columns: repeat(4, auto); gap: 6px; flex: none; }
.cam-btn {
  display: flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 44px; height: 40px; padding: 0 8px; font-size: 15px; border-radius: 10px;
}
.cam-btn kbd {
  font-family: var(--mono); font-size: 10px; color: var(--muted-2);
  border: 1px solid var(--line); border-radius: 4px; padding: 0 3px; background: rgba(0, 0, 0, 0.3);
}
.cam-btn.wide { grid-column: span 2; height: 34px; font-size: 13px; }
.cam-btn.reset { font-size: 12.5px; }

/* -------------------------------- loader -------------------------------- */
.loader {
  position: absolute; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: radial-gradient(120% 90% at 50% 20%, #141a20 0%, #0a0c0f 55%, #06070a 100%);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.loader.done { opacity: 0; visibility: hidden; }
.loader-inner { text-align: center; max-width: 380px; padding: 20px; }
.loader-mark { color: #cfe4f5; margin-bottom: 14px; opacity: 0.9; }
.loader-inner h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: 0.01em; }
.loader-sub { color: var(--muted-2); font-size: 12.5px; margin: 0 0 20px; letter-spacing: 0.04em; }
.loader-bar { height: 3px; background: rgba(255, 255, 255, 0.1); border-radius: 999px; overflow: hidden; }
.loader-bar i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), #b7e0ff); transition: width 0.2s ease; }
.loader-status { margin: 12px 0 0; font-size: 12px; color: var(--muted-2); font-family: var(--mono); }

/* ------------------------------ help dialog ----------------------------- */
.help-dialog {
  border: 1px solid var(--line-strong); border-radius: var(--radius);
  background: var(--panel-solid); color: var(--text); padding: 22px 24px;
  width: min(620px, 92vw); box-shadow: var(--shadow);
}
.help-dialog::backdrop { background: rgba(4, 6, 9, 0.68); backdrop-filter: blur(3px); }
.help-dialog h2 { margin: 0 0 14px; font-size: 17px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.help-dialog h3 { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-2); margin: 0 0 8px; }
.help-dialog ul { margin: 0; padding-left: 16px; }
.help-dialog li { font-size: 13px; color: var(--muted); margin-bottom: 5px; }
.help-dialog li b { color: var(--text); }
.help-note { font-size: 11.5px; color: var(--muted-2); border-top: 1px solid var(--line); padding-top: 12px; margin: 18px 0 14px; }
.help-dialog form { text-align: right; }

/* --------------------------------- toast -------------------------------- */
.toast {
  position: absolute; bottom: 130px; left: 50%; transform: translateX(-50%);
  background: rgba(10, 13, 17, 0.95); border: 1px solid var(--line-strong);
  border-radius: 10px; padding: 9px 14px; font-size: 13px; z-index: 40;
  box-shadow: var(--shadow); max-width: 90vw;
}

/* ------------------------------ responsive ------------------------------ */
.backdrop {
  position: absolute; inset: 0; background: rgba(4, 6, 9, 0.55);
  z-index: 24; opacity: 0; pointer-events: none; transition: opacity 0.22s ease;
}
.backdrop.show { opacity: 1; pointer-events: auto; }

@media (max-width: 1180px) {
  .group-head { min-height: 46px; }
  .part-row { min-height: 44px; }
  .icon-btn { width: 44px; height: 44px; }
  #catalogue, #inspector {
    top: 0; bottom: 0; width: min(330px, 88vw);
    border-radius: 0; padding-top: 58px;
    transition: transform 0.24s ease;
    z-index: 30;
  }
  #catalogue { left: 0; transform: translateX(-102%); }
  #inspector { right: 0; transform: translateX(102%); }
  #catalogue.open, #inspector.open { transform: translateX(0); }
  .topbar-actions .icon-btn { display: grid; }
  #topbar { padding-right: 10px; }
}

@media (min-width: 1181px) {
  #btn-drawer-left, #btn-drawer-right { display: none; }
  .brand { margin-left: 0; }
}

@media (max-width: 900px) {
  .topbar-centre { display: none; }
  #bottombar { flex-direction: column; gap: 10px; padding: 12px; bottom: 10px; }
  .camera-cluster { width: 100%; grid-template-columns: repeat(6, 1fr); }
  .cam-btn.wide { grid-column: span 3; height: 44px; }
  #explode-slider { height: 40px; }
  .camera-cluster .cam-btn.reset { grid-column: span 6; }
  .cam-btn { min-width: 0; height: 44px; }
  #catalogue, #inspector { bottom: 0; }
  .help-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  body { font-size: 14px; }
  .brand-text em { display: none; }
  #bottombar { width: calc(100vw - 16px); left: 8px; transform: none; }
  .cam-btn kbd { display: none; }
  #inspector { width: 100vw; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Evidence mode: hide every interface panel so the model can be captured alone. */
.bare #topbar, .bare #catalogue, .bare #inspector, .bare #bottombar,
.bare #stage-tools, .bare .backdrop { display: none !important; }
.bare #stage { cursor: default; }
