:root {
  --bg: #0d0f17; --panel: #171a26; --panel-2: #222637; --text: #eceef6; --muted: #959bb3;
  --line: #2b3044; --accent: #8b5cf6; --accent-2: #3b82f6; --radius: 14px; --gutter: clamp(16px, 2.5vw, 48px);
  --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
}
:root[data-theme="light"] {
  --bg: #f4f5fa; --panel: #fff; --panel-2: #eaecf5; --text: #191c2a; --muted: #5d637c; --line: #dcdfec;
  --ok: #15803d; --warn: #b45309; --bad: #dc2626;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 system-ui, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Only the page header: 3D faces also use the class "top". */
header.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px var(--gutter); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.top-actions { display: flex; align-items: center; gap: 10px; }
.brand span { line-height: 1.1; }
.brand small { display: block; color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 800; font-size: 20px; letter-spacing: .3px; }
.icon-btn { min-width: 40px; height: 40px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
#prefs-btn { font-size: 19px; }
#prefs { position: absolute; top: calc(100% + 8px); right: var(--gutter); width: min(260px, calc(100vw - 32px)); max-height: calc(100vh - 90px); overflow: auto; padding: 14px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); box-shadow: 0 14px 40px #0007; }
#prefs h3 { margin: 0 0 10px; font-size: 16px; }
#prefs fieldset { border: 0; margin: 0; padding: 0; }
#prefs fieldset + fieldset { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
#prefs legend { padding: 0; margin-bottom: 6px; color: var(--muted); font-size: 13px; }
#prefs label { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 9px; cursor: pointer; }
#prefs label:hover, #prefs label:has(:checked) { background: var(--panel-2); }
#prefs input { accent-color: var(--accent); margin: 0; }

main { flex: 1; width: 100%; padding: 14px var(--gutter) 50px; }
h2 { margin: 0 0 6px; font-size: 16px; }
.muted { display: block; color: var(--muted); font-size: 13px; }
.small { font-size: 12px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); font-weight: 600; transition: border-color .15s, transform .15s; }
.btn:hover { border-color: var(--accent); transform: translateY(-1px); }
.btn.download { width: 100%; margin-bottom: 14px; padding: 12px 16px; }
.btn.download svg { width: 20px; height: 20px; stroke-width: 2; stroke-linejoin: round; }
.btn.primary { border-color: transparent; color: #fff; background: linear-gradient(120deg, var(--accent), var(--accent-2)); box-shadow: 0 6px 18px #7c3aed40; }
.btn.on { border-color: var(--accent); color: var(--accent); }
.btn svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.chip { padding: 6px 15px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); font-size: 13px; }
.chip:hover { border-color: var(--accent); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }

/* ---------- Sample builds and actions in the header ---------- */
.nav-tools { display: flex; flex: 1; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 18px; min-width: 0; }
.presets, .presets div { display: flex; align-items: center; gap: 4px; }
.presets > span { margin-right: 6px; color: var(--muted); font-size: 12px; white-space: nowrap; }
.presets div { padding: 3px; border-radius: 99px; border: 1px solid var(--line); background: var(--panel); }
.presets .chip { padding: 4px 12px; border-color: transparent; background: none; white-space: nowrap; }
.presets .chip:hover { background: var(--panel-2); border-color: var(--accent); }
.actions { display: flex; align-items: center; gap: 6px; }
.actions .btn { padding: 6px 11px; font-size: 13px; white-space: nowrap; }
.actions .btn.primary { box-shadow: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Layout: the 3D system unit and the results ---------- */
.layout { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 25vw, 420px); gap: 18px; align-items: start; }
.col-view { position: sticky; top: calc(var(--header, 61px) + 14px); min-width: 0; }
.col-side { min-width: 0; }
.count { padding: 2px 10px; border-radius: 99px; background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 700; }
.count.full { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }

#saved h2 { margin: 22px 0 10px; }
.saved-row { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; padding: 8px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.saved-row b { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.saved-row .btn { padding: 5px 10px; font-size: 12px; }

/* The chosen part, shown at the top of its picker */
.current { flex: none; padding: 10px 14px; border-radius: 10px; border: 1px solid var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--panel)); }
.current-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.current-head > div { min-width: 0; }
.price-form { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 8px; margin-top: 9px; padding-top: 9px; border-top: 1px dashed var(--line); }
.field { display: block; min-width: 0; }
.field > span { display: block; margin-bottom: 2px; color: var(--muted); font-size: 11px; font-weight: 600; }
.field input { width: 100%; padding: 6px 9px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 13px; }
.field.link, .price-form .why, .open-source { grid-column: 1 / -1; }
.price-form .why { margin: 0; }
.price-form .why:empty, .open-source:empty { display: none; }
.source { color: var(--accent-2); font-size: 12px; overflow-wrap: anywhere; }
.source:hover { text-decoration: underline; }
.cost-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.cost select { padding: 4px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font: inherit; font-size: 13px; }
.cost ul { list-style: none; margin: 8px 0 0; padding: 0; }
.cost li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.cost-name { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cost li button { padding: 0; border: 0; background: none; text-align: right; font-size: 13px; }
.cost-value { font-weight: 700; }
.add-price { color: var(--accent); font-weight: 600; }
.cost li .source { grid-column: 1 / -1; font-size: 11px; }
.cost-total { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 4px 12px; margin-top: 10px; }
.cost-total b { font-size: 19px; color: var(--ok); }
.current b { display: block; }
.current-title { display: block; color: var(--accent); font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.btn.danger { flex: none; padding: 6px 12px; font-size: 13px; color: var(--bad); }
.btn.danger:hover { border-color: var(--bad); }

.card { margin-bottom: 14px; padding: 18px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--line); }
.card p { margin: 8px 0; }
.status { border-top: 4px solid var(--accent-2); }
.status h2 { display: flex; align-items: center; gap: 9px; }
.dot { width: 11px; height: 11px; flex: none; border-radius: 50%; background: var(--accent-2); box-shadow: 0 0 10px currentColor; }
.status.ok .dot { background: var(--ok); }
.status.warnings .dot { background: var(--warn); }
.status.errors .dot { background: var(--bad); }
.status.ok { border-top-color: var(--ok); }
.status.warnings { border-top-color: var(--warn); }
.status.errors { border-top-color: var(--bad); }
.issues { list-style: none; margin: 10px 0 0; padding: 0; }
.issues li { margin-bottom: 7px; padding: 9px 12px; border-radius: 9px; background: var(--panel-2); border-left: 3px solid var(--accent-2); font-size: 14px; }
.issues li.error { border-left-color: var(--bad); }
.issues li.error strong { color: var(--bad); }
.issues li.warn { border-left-color: var(--warn); }
.issues li.warn strong { color: var(--warn); }
.meter { height: 9px; margin: 10px 0 4px; border-radius: 99px; background: var(--panel-2); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--ok); }
.meter.warn i { background: var(--warn); }
.meter.error i { background: var(--bad); }
.tier { padding: 12px 15px; border-radius: 11px; color: #fff; font-size: 19px; font-weight: 800; text-align: center; background: #475569; }
.tier.low { background: #0f766e; }
.tier.mid { background: #1d4ed8; }
.tier.high { background: #6d28d9; }
.tier.extreme { background: linear-gradient(110deg, #7c3aed, #be185d); }
.tabs { display: flex; gap: 7px; margin: 12px 0 4px; }
.game { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line); }
.game > div:first-child { min-width: 0; }
.score { text-align: right; flex: none; }
.score b { display: block; }
.verdict { font-size: 12px; font-weight: 700; }
.verdict.excellent, .verdict.smooth { color: var(--ok); }
.verdict.playable, .verdict.low { color: var(--warn); }
.verdict.no, .blocked { color: var(--bad); }

dialog { width: min(760px, calc(100vw - 24px)); height: min(720px, calc(100dvh - 24px)); padding: 18px; border-radius: var(--radius); border: 1px solid var(--line); background: var(--bg); color: var(--text); }
dialog[open] { display: flex; flex-direction: column; gap: 10px; }
dialog::backdrop { background: #000a; }
.picker-head { display: flex; justify-content: space-between; align-items: center; }
.picker-head h2 { margin: 0; font-size: 19px; }
dialog input[type="search"] { width: 100%; padding: 10px 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
.brands { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
dialog textarea { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); color: var(--text); font: 12px/1.5 Consolas, monospace; resize: vertical; }
dialog pre { max-height: 180px; overflow: auto; padding: 10px; border-radius: 10px; background: var(--panel-2); font-size: 11px; white-space: pre-wrap; overflow-wrap: anywhere; }
dialog li { margin-bottom: 8px; }
dialog summary { cursor: pointer; margin-bottom: 8px; }
.options > .btn { margin-top: 4px; }
.check { display: flex; gap: 9px; align-items: center; font-size: 14px; }
.check input { accent-color: var(--accent); }
.options { flex: 1; overflow: auto; overscroll-behavior: contain; padding: 2px; }
.option { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; padding: 11px 14px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.option b { display: block; }
.option.bad { border-style: dashed; }
.why { display: block; color: var(--bad); font-size: 13px; }

.foot { width: 100%; padding: 30px var(--gutter) max(18px, env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
.foot-main { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 20px; }
.foot-brand { display: inline-flex; align-items: center; gap: 11px; font-weight: 800; font-size: 22px; }
.foot p { margin: 8px 0 0; color: var(--muted); }
.foot nav { display: flex; flex-wrap: wrap; gap: 24px; }
.foot nav a, .foot nav button { padding: 4px 0; border: 0; background: none; font-weight: 600; }
.foot nav a:hover, .foot nav button:hover { color: var(--accent); }
.foot-legal { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }

#toast { position: fixed; z-index: 20; left: 50%; bottom: 30px; transform: translateX(-50%); max-width: calc(100vw - 24px); padding: 9px 18px; border-radius: 99px; background: #000d; color: #fff; font-size: 14px; text-align: center; pointer-events: none; }

/* Narrow screens: results go under the 3D view. */
@media (max-width: 960px) {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .col-view { position: static; }
}
/* Below this width the sample builds and actions get their own scrollable row. */
@media (max-width: 1280px) {
  .presets > span { display: none; }
}
@media (max-width: 1080px) {
  header.top { flex-wrap: wrap; row-gap: 8px; }
  .nav-tools { order: 3; flex: 1 0 100%; flex-wrap: nowrap; justify-content: safe center; gap: 10px; overflow-x: auto; padding: 2px 0; scrollbar-width: none; }
  .nav-tools > * { flex: none; }
}
@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); grid-template-areas: "view" "parts" "summary"; }
}
@media (max-width: 520px) {
  #detect-btn { padding: 9px 11px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* ---------- 3D system unit ---------- */
.view-card { padding: 14px; border-radius: 18px; background: var(--panel); border: 1px solid var(--line); }
.view-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 12px; }
.view-head h2 { margin: 0; }
.view-tools { display: flex; flex-wrap: wrap; gap: 7px; margin-left: auto; }
.view-tools .chip { white-space: nowrap; }
@media (max-width: 520px) { .view-tools { margin-left: 0; gap: 6px; } .view-tools .chip { padding: 5px 10px; font-size: 12px; } }
.pill { padding: 3px 11px; border-radius: 99px; font-size: 12px; font-weight: 700; background: color-mix(in srgb, var(--accent-2) 18%, transparent); }
.pill.ok { color: var(--ok); background: color-mix(in srgb, var(--ok) 16%, transparent); }
.pill.warnings { color: var(--warn); background: color-mix(in srgb, var(--warn) 16%, transparent); }
.pill.errors { color: var(--bad); background: color-mix(in srgb, var(--bad) 16%, transparent); }
.view-hint { margin: 10px 0 0; color: var(--muted); font-size: 12px; text-align: center; }

/* The stage stays dark in both themes so the lighting reads well. */
.viewport { position: relative; height: clamp(430px, calc(100vh - 190px), 860px); overflow: hidden; border-radius: 14px; perspective: 1500px; touch-action: pan-y; cursor: grab; user-select: none;
  background: radial-gradient(70% 55% at 50% 45%, #29325a, transparent 75%), linear-gradient(#0b0e1a, #141a30 70%, #0a0c16); }
.viewport:active { cursor: grabbing; }
.viewport::before { content: ""; position: absolute; inset: 0; background-image: linear-gradient(#8ea2ff12 1px, transparent 1px), linear-gradient(90deg, #8ea2ff12 1px, transparent 1px); background-size: 34px 34px; mask-image: radial-gradient(closest-side, #000, transparent); }
.scene { position: absolute; left: 50%; top: 50%; width: 0; height: 0; transform-style: preserve-3d; }
.obj, .inner, .shell, .block { position: absolute; transform-style: preserve-3d; }
.obj, .shell { cursor: pointer; }
.face, .anchor { position: absolute; }
.anchor { width: 0; height: 0; }
.gliding .scene, .gliding .obj { transition: transform .7s cubic-bezier(.25, .8, .25, 1); }
.drop { animation: drop .65s cubic-bezier(.2, .8, .3, 1.15); }
@keyframes drop { from { transform: translate3d(0, -46px, 190px); } to { transform: none; } }
.zoom { position: absolute; z-index: 2; bottom: 10px; left: 50%; display: flex; gap: 6px; transform: translateX(-50%); }
.zoom button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid #ffffff22; background: #12172dd9; color: #e6e9ff; font-size: 18px; line-height: 1; }
.zoom button:hover { border-color: #a78bfa; }
.viewport.dragging { cursor: grabbing; }
/* Nothing inside the model should start a text selection or a native image drag. */
.scene svg { display: block; overflow: visible; }
.scene svg.circuit { overflow: hidden; }

/* ---------- Case ---------- */
.shell .shadow { background: radial-gradient(closest-side, #000c, #0007 45%, transparent); pointer-events: none; }
.shell .tray { background: radial-gradient(120% 90% at 20% 0%, #2b3352, transparent 60%), linear-gradient(150deg, #1b2034, #0c0f1c); border-radius: 4px; }
.grommet { position: absolute; width: 5%; border-radius: 8px; background: #05060c; border: 2px solid #39415f; }
.shell .ambient { pointer-events: none; opacity: 0; background: radial-gradient(55% 45% at 30% 28%, #22d3ee38, transparent 70%), radial-gradient(60% 40% at 75% 80%, #a855f738, transparent 70%); }
.powered .shell .ambient { opacity: 1; }
.shell .floor { background: repeating-linear-gradient(90deg, #ffffff07 0 2px, transparent 2px 9px), linear-gradient(#0f1322, #262d49); }
.shell .roof { background: radial-gradient(circle, #05070f 38%, transparent 42%) 0 0 / 9px 9px, #232a4552; pointer-events: none; }
.shell .wall-front { background: radial-gradient(circle, #04050a 36%, transparent 40%) 0 0 / 7px 7px, linear-gradient(90deg, #151a2d, #262e4b); }
.shell .wall-rear { background: linear-gradient(#8ea2ff0d, #8ea2ff05); pointer-events: none; }
.shell.case-budget .wall-front, .shell.case-itx .wall-front { background: linear-gradient(90deg, #121627, #232a44 55%, #151a2d); }
.shell.empty .face { background: none; border: 2px dashed #5b679c99; }
.shell.empty .shadow, .shell.empty .ambient { display: none; }
.shell .mount { pointer-events: none; }
.shell .slot-cover { background: linear-gradient(#8b94b6, #3a415d); border-radius: 2px; pointer-events: none; }
.edge { pointer-events: none; }
.edge .face { background: linear-gradient(135deg, #4c577f, #20263c); }
.edge .top { background: linear-gradient(90deg, #5a659a, #333c63); }
.edge .left, .foot .left { background: #1a1f33; }
.foot .face { background: #12162a; border-radius: 3px; }
.power-button .face { background: #2c3352; border-radius: 4px; }
.power-button .top { border-radius: 50%; border: 2px solid #8b94b6; }
.powered .power-button .top { border-color: #22d3ee; box-shadow: 0 0 12px #22d3ee; }
.side-glass { pointer-events: none; }
.side-glass .glass, .shell .glass { pointer-events: none; border-radius: 6px; border: 1px solid #a9b6ee55; background: linear-gradient(115deg, #ffffff17, transparent 22%, transparent 55%, #ffffff0d 56%, #ffffff05 68%, transparent 69%); }
.thumb-screw { border-radius: 50%; background: radial-gradient(circle, #1b2036 28%, #b9c2e2 32%, #596389 70%); }
.exploded .side-glass .face { border-style: dashed; }
.shell.hot .tray, .shell.hot .edge .face { box-shadow: inset 0 0 0 2px #a78bfa; }
.shell.error .edge .face { background: #b83a55; }
.shell.error .tray { box-shadow: inset 0 0 40px #ef444499; }

/* ---------- Fans ---------- */
.fan-frame { fill: #11152a; stroke: #414a72; stroke-width: 2; }
.fan .screw { fill: #6c77a6; }
.fan-well { fill: #05070f; }
.blade { fill: #39426a; stroke: #6b76a8; stroke-width: .8; fill-opacity: .92; }
.fan-ring { fill: none; stroke: #4b557f; stroke-width: 3.5; }
.hub { fill: #1a2038; stroke: #7f8bbd; stroke-width: 1.5; }
.hub-mark { fill: none; stroke: #aab4dd; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.powered .rotor { animation: spin .9s linear infinite; }
.powered .blade { fill: #4c4f9c; stroke: #a5b4fc; }
.powered .fan-ring { stroke: #22d3ee; filter: drop-shadow(0 0 4px #22d3ee); }
.powered .hub { stroke: #c084fc; }
@keyframes spin { to { transform: rotate(1turn); } }

/* ---------- Shared part looks ---------- */
/* :where() keeps these defaults weak, so any part style below or above wins. */
:where(.obj .face) { background: #232941; }
:where(.obj .top) { background: #3a426a; }
:where(.obj .left) { background: #1b2035; }
:where(.obj .right, .obj .bottom) { background: #111526; }
.accent-line { position: absolute; left: 12%; right: 12%; top: 14%; height: 2px; border-radius: 2px; background: #6b76a8; }
.powered .accent-line { background: linear-gradient(90deg, #22d3ee, #a855f7); box-shadow: 0 0 7px #a855f7; }

/* ---------- Motherboard ---------- */
.board .pcb .face { background: #0c3b37; }
.board .pcb .front { background: radial-gradient(90% 70% at 25% 10%, #1d776a, transparent 70%), linear-gradient(150deg, #125248, #082a2c); box-shadow: inset 0 0 0 1px #2e9c86; }
.circuit .trace { fill: none; stroke: #5eead433; stroke-width: 1; }
.circuit .via { fill: #c9a94e; }
.circuit .hole { fill: #c9a94e; }
.circuit .screw { fill: #1c2236; }
.board .shroud .face { background: linear-gradient(160deg, #39415f, #181d31); }
.board .shroud .top { background: #59638c; }
.shroud-name { position: absolute; left: 50%; top: 58%; transform: translate(-50%, -50%) rotate(-90deg); color: #c7cff5; font-size: 9px; font-weight: 800; letter-spacing: .3em; white-space: nowrap; }
.board .sink .face, .board .chipset .face { background: repeating-linear-gradient(90deg, #aab4d4 0 2px, #4a5375 2px 5px); }
.board .chipset .front { background: linear-gradient(135deg, #454e72, #1d2338); border-radius: 4px; }
.chipset-name { position: absolute; inset: 40% 0 0; color: #e5eaff; font: 800 11px/1.4 Consolas, monospace; text-align: center; }
.capacitor .face { background: linear-gradient(90deg, #3f4663, #b7c0dc, #3f4663); }
.board .capacitor .front { background: radial-gradient(circle, #e5e9f7 20%, #7f89ad 55%, #1b2035 72%); border-radius: 50%; }
.board .choke .face { background: #2a2f44; }
.board .choke .front { background: #444b66; box-shadow: inset 0 0 0 1px #6d769c; }
.board .socket { background: radial-gradient(circle, #0d2a2c 55%, #123c3d); border: 3px solid #c3cbe0; border-radius: 4px; box-shadow: 0 0 0 3px #0a1c20; }
.board .dimm .face { background: #0a0d17; }
.board .dimm .front { background: linear-gradient(#cfd6ee 0 4px, #151a2c 4px calc(100% - 4px), #cfd6ee 0); }
.board .connector .face, .board .sata .face { background: #0b0e19; }
.board .connector .front { background: radial-gradient(circle, #c9a94e 24%, transparent 30%) 0 0 / 6px 6px, #11152a; }
.board .sata .front { background: linear-gradient(#2c3352 40%, #05070f 40% 62%, #2c3352 62%); }
.board .pcie .face { background: #0a0d17; }
.board .pcie .front { background: linear-gradient(#aab4d4 0 1px, #05070f 1px 5px, #aab4d4 5px); }
.m2-slot { border: 1px dashed #7fe3cf66; border-radius: 3px; }
.battery { border-radius: 50%; background: radial-gradient(circle at 35% 30%, #fff, #aab2c8 45%, #555e7c); }

/* ---------- Processor ---------- */
.cpu .substrate .face { background: #1c5c45; }
.cpu .substrate .front { background: radial-gradient(circle, #c9a94e 18%, transparent 24%) 1px 1px / 5px 5px, #1c5c45; }
.cpu .ihs .face { background: #8089a3; }
.cpu .ihs .front { display: flex; flex-direction: column; align-items: center; justify-content: center; background: linear-gradient(135deg, #fdfdff, #aab1c6 42%, #e4e8f4 60%, #868ea8); border-radius: 5px; }
.chip-brand { color: #3a415a; font-size: 7px; font-weight: 700; line-height: 1.2; }
.chip-name { color: #151a2e; font-size: 10px; font-weight: 800; letter-spacing: .05em; line-height: 1.2; }
.pin-one { background: linear-gradient(45deg, #e9c46a 50%, transparent 50%); }
.cpu.amd .ihs .front { box-shadow: 0 0 10px #f9731699; }
.cpu.intel .ihs .front { box-shadow: 0 0 10px #38bdf899; }

/* ---------- Coolers ---------- */
.fin { border-radius: 3px; background: linear-gradient(160deg, #dbe1f2b3, #68729699 45%, #c4cce4a6); border: 1px solid #eef1ff80; }
.obj .fin { background: linear-gradient(160deg, #dbe1f2c0, #68729699 45%, #c4cce4b0); }
.obj .fin.round { border-radius: 50%; }
.obj .fin-cap .face { background: linear-gradient(135deg, #3d4566, #171c2f); }
.obj .fin-cap .front { background: linear-gradient(150deg, #424b6f, #151a2c 70%); border-radius: 5px; box-shadow: inset 0 0 0 1px #8d98c4; }
.pipe-tip { position: absolute; width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 35% 30%, #ffe3c2, #d9894a 45%, #6e3a17); }
.pipe-tip.t0 { left: 12%; top: 26%; } .pipe-tip.t1 { left: 44%; top: 30%; } .pipe-tip.t2 { right: 12%; top: 26%; }
.pipe-tip.t3 { left: 12%; bottom: 12%; } .pipe-tip.t4 { left: 44%; bottom: 8%; } .pipe-tip.t5 { right: 12%; bottom: 12%; }
.cooler-name { position: absolute; inset: 46% 0 auto; color: #e5eaff; font-size: 9px; font-weight: 800; letter-spacing: .24em; text-align: center; }
.obj .heatpipe .face, .obj .cold-plate .face { background: linear-gradient(#ffd2a6, #c9763a 50%, #7a3f18); }
.obj .fan-body .face { background: #161b30; box-shadow: inset 0 0 0 1px #414a72; }
.powered .fan-body .face { box-shadow: inset 0 0 0 1px #22d3ee99; }
.obj .core .face { background: repeating-linear-gradient(90deg, #8d97ba 0 1.5px, #1d2237 1.5px 4px); }
.obj .core .top { background: linear-gradient(135deg, #3a4263, #171c2f); }
.obj .tank .face { background: linear-gradient(135deg, #3d4566, #14182a); }
.obj .pump-base .face { background: #171c2f; }
.obj .puck { border-radius: 50%; background: #1b2138; box-shadow: inset 0 0 0 1px #4a547c; }
.obj .pump-cap { display: grid; place-items: center; border-radius: 50%; background: radial-gradient(circle at 35% 28%, #3c4569, #0a0d18 70%); box-shadow: inset 0 0 0 2px #8d98c4; }
.pump-ring { position: absolute; inset: 8px; border-radius: 50%; border: 3px solid #4b557f; }
.pump-logo { color: #e5eaff; font-size: 17px; font-weight: 900; }
.powered .pump-ring { border-color: #22d3ee #a855f7 #22d3ee #a855f7; box-shadow: 0 0 12px #22d3ee, inset 0 0 10px #8b5cf6; animation: spin 5s linear infinite; }
.obj .cable.hose { background: linear-gradient(#0b0d16, #6b769c 36%, #1a1f33 62%, #05060b); border-radius: 5px; }
.hoses { pointer-events: none; }

/* ---------- Memory ---------- */
.obj .ram-board .face { background: #0f4a3c; }
.obj .spreader .face { background: linear-gradient(#59638c, #1a1f35 30%, #232a45 70%, #4a547c); }
.obj .spreader .left { background: linear-gradient(135deg, #1a1f35 0 28%, #6c77a6 28% 31%, #2a3150 31% 66%, #6c77a6 66% 69%, #151a2d 69%); }
.obj .spreader .front { background: linear-gradient(90deg, #6c77a6, #2a3150 50%, #6c77a6); }
.obj .lightbar .face { background: #8f99bf; border-radius: 2px; }
.powered .lightbar .face { background: linear-gradient(#a855f7, #22d3ee, #a855f7, #22d3ee) 0 0 / 100% 200%; box-shadow: 0 0 10px #a855f7; animation: flow 3s linear infinite; }
@keyframes flow { to { background-position: 0 200%; } }

/* ---------- Graphics card ---------- */
.obj .gpu-board .face { background: #0f3b36; }
.obj .backplate .face { background: linear-gradient(90deg, #4a5378, #232943); }
.obj .backplate .top { background: linear-gradient(115deg, #49527a, #1a1f35 40%, #2e3656 75%, #161a2d); box-shadow: inset 0 0 0 1px #8d98c4; }
.backplate-name { position: absolute; right: 9%; bottom: 16%; color: #eef1ff; font-size: 14px; font-weight: 900; letter-spacing: .1em; white-space: nowrap; }
.gpu .backplate .accent-line { left: 8%; right: 55%; top: auto; bottom: 22%; height: 3px; }
.gpu-fins { background: repeating-linear-gradient(90deg, #b5bdd9aa 0 1px, #10142499 1px 5px); }
.obj .shroud .face { background: linear-gradient(135deg, #353d5e, #131728); }
.obj.gpu .shroud .front { background: linear-gradient(160deg, #353d5f, #10131f 55%, #262d49); border-radius: 9px 16px 9px 16px; box-shadow: inset 0 0 0 1px #7480b0; }
.cut { position: absolute; width: 26%; height: 5px; background: #6b76a8; transform: skewX(-38deg); }
.cut-a { left: 4%; top: 3px; }
.cut-b { right: 4%; bottom: 3px; }
.gpu.nvidia .cut { background: #76b900; }
.gpu.amd .cut { background: #ef4444; }
.gpu.intel .cut { background: #38bdf8; }
.gpu-fans { position: absolute; inset: 1px 4px 11px; display: flex; align-items: center; justify-content: space-evenly; }
.gpu-name { position: absolute; inset: auto 0 0; overflow: hidden; color: #fff; font-size: 10px; font-weight: 800; letter-spacing: .1em; text-align: center; white-space: nowrap; }
.light-strip { position: absolute; left: 14%; right: 14%; bottom: 3px; height: 4px; border-radius: 3px; background: #59638c; }
.powered .light-strip { background: linear-gradient(90deg, #22d3ee, #a855f7, #22d3ee); box-shadow: 0 0 10px #a855f7; }
.obj .bracket .face { background: linear-gradient(#e0e5f3, #8d96b4 50%, #c5ccdf); }
.obj .bracket .left { display: flex; flex-direction: column; align-items: center; justify-content: space-evenly; }
.port { width: 38%; height: 8px; border-radius: 2px; background: #0a0d17; box-shadow: 0 0 0 1px #4a547c; }
.obj .gold .face { background: repeating-linear-gradient(90deg, #f2d479 0 3px, #8a6d1f 3px 5px); }
.obj .power-plug .face { background: #0b0e19; }
.obj .power-plug .top { background: radial-gradient(circle, #4a547c 30%, transparent 36%) 0 0 / 8px 8px, #0b0e19; }

/* ---------- Drives ---------- */
.obj .m2-board .face { background: #111827; }
.obj .m2-board .front { background: linear-gradient(90deg, #e9c46a 0 5px, #14532d 5px); }
.obj .memory-chip .face { background: #0b0e19; }
.obj .memory-chip .front { background: linear-gradient(135deg, #2c3352, #0d101d); box-shadow: inset 0 0 0 1px #5a6596; }
.obj .controller .front { background: linear-gradient(135deg, #cbd3ea, #6b759c); }
.obj .enclosure .face { background: linear-gradient(135deg, #3f4767, #181d30); }
.obj.drive .enclosure .front { display: grid; place-items: center; border-radius: 3px; box-shadow: inset 0 0 0 1px #8d98c4; }
.obj.hdd .enclosure .top { background: radial-gradient(circle at 36% 50%, #c9d0e6 0 7%, #8992b2 8% 24%, #b4bcd6 25% 26%, transparent 27%), linear-gradient(135deg, #99a2c0, #4b5475); }
.drive-name { color: #e2e8f0; font-size: 11px; font-weight: 800; letter-spacing: .14em; }
.drive-sticker { position: absolute; right: 8px; bottom: 8px; padding: 2px 6px; border-radius: 3px; background: #e5e9f7; color: #1b2036; font-size: 7px; font-weight: 800; }

/* ---------- Power supply and cables ---------- */
.obj .housing .face { background: linear-gradient(135deg, #353d5e, #12162a); }
.obj.psu .housing .front { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; box-shadow: inset 0 0 0 1px #6b76a8; background: linear-gradient(115deg, #2d3452 0 62%, #6d28d9 62% 66%, #2563eb 66% 70%, #1a1f35 70%); }
.obj .housing .top { background: #171c2f; display: grid; place-items: center; }
.grill { position: relative; display: grid; place-items: center; }
.grill-wires { position: absolute; inset: -4px; border-radius: 50%; background: repeating-radial-gradient(circle, transparent 0 7px, #aab4d4cc 7px 8.5px), linear-gradient(transparent 49%, #aab4d4cc 49% 51%, transparent 51%); }
.obj .housing .left { display: flex; align-items: center; justify-content: space-evenly; }
.socket-ac { width: 24%; height: 34%; border-radius: 4px 4px 9px 9px; background: #05070f; box-shadow: 0 0 0 2px #7480b0; }
.switch { width: 11%; height: 24%; border-radius: 3px; background: linear-gradient(#f87171 50%, #3a1520 50%); box-shadow: 0 0 0 2px #7480b0; }
.psu-watts { color: #fff; font-size: 19px; font-weight: 900; line-height: 1.1; }
.psu-badge { padding: 1px 8px; border-radius: 99px; background: #4a547c; color: #fff; font-size: 8.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.psu-badge.bronze { background: #a1622f; }
.psu-badge.gold { background: #b8860b; }
.psu-badge.platinum, .psu-badge.titanium { background: #7d8aa5; }
.cables { pointer-events: none; }
.obj.cables .cable { background: linear-gradient(#0a0c14, #3a415c 45%, #0a0c14); border-radius: 3px; }
/* Sleeved power cables, red SATA data and black-and-yellow SATA power. */
.obj.cables .cable.main { background: repeating-linear-gradient(#171a2a 0 1.5px, #6d28d9 1.5px 3px); }
.obj.cables .cable.pcie { background: linear-gradient(#3b0f6b, #a855f7 45%, #3b0f6b); }
.obj.cables .cable.sata-data { background: linear-gradient(#7f1d1d, #f87171 45%, #7f1d1d); }
.obj.cables .cable.sata-power { background: linear-gradient(#05060b, #3a415c 30%, #eab308 45% 58%, #1a1f33 72%, #05060b); }
.exploded .obj.cables, .exploded .obj.hoses { display: none; }

/* ---------- Part states: chosen, highlighted, warning, problem, empty ---------- */
.obj.hot .block .front, .obj.hot .fin, .obj.hot .puck { box-shadow: 0 0 12px #a78bfa, inset 0 0 0 2px #ddd6fe; }
.obj.warn .block .front { box-shadow: 0 0 10px #f59e0b, inset 0 0 0 2px #fbbf24; }
.obj.error .block .face { box-shadow: inset 0 0 0 1px #fb7185, inset 0 0 18px #ef4444cc; }
.obj.error .fin { border-color: #fb7185; }
.obj.ghost .face { background: #8b5cf612; border: 1.5px dashed #a78bfacc; box-shadow: none; }
.obj.ghost .front { display: grid; place-items: center; }
.obj.ghost.hot .face { background: #8b5cf640; }
.plus { color: #c4b5fd; font-size: 22px; font-weight: 300; }

/* Leader lines and labels */
.leaders { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.leader { --tone: #67e8f9; }
.leader.ok { --tone: #5eead4; }
.leader.warn { --tone: #fbbf24; }
.leader.error { --tone: #fb7185; }
.leader.empty { --tone: #8b93c4; }
.leader path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.leader .shadow { stroke: #05070f; stroke-width: 4; opacity: .55; }
.leader .line { stroke: var(--tone); stroke-width: 1.25; opacity: .8; }
.leader .start { fill: var(--tone); }
.leader .ring { fill: var(--tone); fill-opacity: .16; stroke: var(--tone); stroke-opacity: .55; stroke-width: 1; }
.leader .dot { fill: #fff; }
.leader.empty .line { stroke-dasharray: 3 4; opacity: .55; }
.leader.hot .line { stroke: #fff; stroke-width: 2; opacity: 1; stroke-dasharray: none; }
.leader.hot .ring { fill-opacity: .4; stroke: #fff; }
.overlay { position: absolute; inset: 0; pointer-events: none; }
.tag, .pin { position: absolute; pointer-events: auto; color: #eef0fb; }
.tag { --tone: #67e8f9; display: flex; align-items: center; gap: 9px; padding: 8px 10px; border: 1px solid #ffffff1c; border-radius: 12px; background: linear-gradient(135deg, #1b2140e6, #0f1328e6); box-shadow: 0 8px 22px #0006; text-align: left; line-height: 1.28; backdrop-filter: blur(8px); transition: top .18s ease-out, border-color .15s, box-shadow .15s, transform .15s; }
.tag.ok { --tone: #5eead4; }
.tag.warn { --tone: #fbbf24; }
.tag.error { --tone: #fb7185; background: linear-gradient(135deg, #3a1a2ceb, #1b0f1ceb); }
.tag.empty { --tone: #8b93c4; border-style: dashed; background: #12162ab3; box-shadow: none; }
/* The coloured edge faces the part the card points to. */
.tag::after { content: ""; position: absolute; top: 9px; bottom: 9px; width: 3px; border-radius: 3px; background: var(--tone); box-shadow: 0 0 8px var(--tone); }
.tag.left { left: 10px; }
.tag.left::after { right: -2px; }
.tag.right { right: 10px; flex-direction: row-reverse; text-align: right; }
.tag.right::after { left: -2px; }
.tag.empty::after { box-shadow: none; opacity: .5; }
.tag:hover, .tag.hot { z-index: 1; border-color: var(--tone); box-shadow: 0 0 0 1px var(--tone), 0 10px 26px #0008; }
.tag.left:hover, .tag.left.hot { transform: translateX(3px); }
.tag.right:hover, .tag.right.hot { transform: translateX(-3px); }
.tag-icon { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 9px; color: var(--tone); background: color-mix(in srgb, var(--tone) 15%, transparent); }
.tag-icon svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.tight .tag-icon { display: none; }
.tag-words { flex: 1; min-width: 0; }
.tag-title { color: var(--tone, #9aa4d0); font-size: 9.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; }
.tag-text { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 2; font-size: 12.5px; font-weight: 700; overflow-wrap: anywhere; }
.tag-detail { overflow: hidden; color: #9ba3c9; font-size: 10.5px; white-space: nowrap; text-overflow: ellipsis; }
.tag.empty .tag-text { color: #c4b5fd; font-weight: 600; }
.no-labels .tag, .no-labels .pin, .no-labels .leaders { display: none; }
.pin, .legend { display: none; }
.compact .tag, .compact .leaders { display: none; }
.compact .pin { display: grid; place-items: center; width: 22px; height: 22px; padding: 0; transform: translate(-50%, -50%); border-radius: 50%; border: 2px solid #a5b4fc; background: #121628; font-size: 11px; font-weight: 800; }
.compact .pin.ok { border-color: #34d399; }
.compact .pin.warn { border-color: #fbbf24; }
.compact .pin.error { border-color: #f87171; }
.compact.no-labels .pin { display: none; }
.compact .viewport { height: clamp(340px, 62vh, 500px); }
.compact .legend { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; margin-top: 10px; }
.compact.no-labels .legend { display: none; }
.legend-row { display: flex; align-items: center; gap: 8px; padding: 7px 9px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel-2); text-align: left; line-height: 1.3; }
.legend-row.warn { border-color: var(--warn); }
.legend-row.error { border-color: var(--bad); }
.legend-row .tag-title { color: var(--muted); }
.legend-number { display: grid; place-items: center; width: 22px; height: 22px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11px; font-weight: 800; }
.legend-row > div:last-child { min-width: 0; }
@media (prefers-reduced-motion: reduce) { .drop, .powered .rotor, .powered .pump-ring, .powered .lightbar .face { animation: none !important; } }

/* ---------- A part taken out of the PC ---------- */
.veil { position: absolute; inset: 0; opacity: 0; pointer-events: none; transition: opacity .45s; background: radial-gradient(70% 60% at 50% 45%, #141a33cc, #05070fee); }
.focusing .veil { opacity: 1; }
.scene.showcase { display: none; pointer-events: none; }
.scene.showcase.on { display: block; }
.showcase.moving { transition: left .7s cubic-bezier(.22, .8, .24, 1), top .7s cubic-bezier(.22, .8, .24, 1), transform .7s cubic-bezier(.22, .8, .24, 1); }
.pivot { position: absolute; transform-style: preserve-3d; }
.showcase .obj, .showcase .shell { pointer-events: none; }
.showcase .cables { display: none; }
/* The part is missing from the PC while it is out. */
.scene .obj.taken, .scene.taken { visibility: hidden; }
.obj .rear { background: #161b30; box-shadow: inset 0 0 0 1px #414a72; }
.showcase-name { position: absolute; z-index: 1; transform: translateX(-50%); width: max-content; padding: 8px 18px; border-radius: 12px; border: 1px solid #ffffff22; background: #11162bd9; color: #eef0fb; text-align: center; pointer-events: none; opacity: 0; transition: opacity .35s .3s; }
.showcase-name .tag-title { color: #67e8f9; }
.showcase-name .tag-text { font-size: 15px; }
.focusing .showcase-name { opacity: 1; }
.focusing .leaders, .focusing .overlay, .focusing ~ .view-hint { display: none; }
.focusing .legend { visibility: hidden; }

/* ---------- The choosing panel on the right ---------- */
#picker { position: fixed; z-index: 6; top: var(--header, 61px); right: 0; bottom: 0; left: auto; width: clamp(340px, 31vw, 500px); height: auto; max-width: 100vw; max-height: none; margin: 0; padding: 16px; border: 0; border-left: 1px solid var(--line); border-radius: 0; box-shadow: -18px 0 44px #0007; animation: slide-in .4s cubic-bezier(.22, .8, .24, 1); }
#picker[open] { gap: 9px; }
@keyframes slide-in { from { transform: translateX(104%); } to { transform: none; } }
.part-tabs { display: grid; grid-template-columns: repeat(8, 1fr); gap: 5px; flex: none; }
.part-tabs button { display: grid; place-items: center; height: 38px; padding: 0; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); color: var(--muted); }
.part-tabs button:hover { border-color: var(--accent); color: var(--text); }
.part-tabs button.on { border-color: transparent; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.part-tabs svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.current-list { display: flex; flex-direction: column; gap: 6px; flex: none; max-height: 44vh; overflow: auto; }
.current-list:empty { display: none; }
#picker .options { min-height: 120px; }
.option.chosen { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
#picker .done { flex: none; width: 100%; }
body.picking #toast { left: 34%; }
/* Narrow screens: the panel rises from the bottom, below the part. */
@media (max-width: 960px) {
  #picker { top: auto; left: 0; width: 100%; height: 52vh; height: 52dvh; padding: 10px 12px; border-left: 0; border-top: 1px solid var(--line); border-radius: 16px 16px 0 0; box-shadow: 0 -14px 40px #0008; animation-name: slide-up; }
  .current-list { max-height: none; overflow: visible; }
  .price-form { margin-top: 5px; padding-top: 5px; }
  .current { padding: 6px 10px; }
  .current .muted, .current-title, .showcase-name { display: none; }
  #picker[open] { gap: 7px; }
  #picker .picker-head h2 { font-size: 16px; }
  #picker .picker-head .icon-btn { height: 32px; min-width: 32px; }
  #picker input[type="search"] { padding: 7px 13px; }
  #picker .chip { padding: 3px 11px; }
  .part-tabs button { height: 34px; }
  #picker .brands { flex-wrap: nowrap; flex: none; overflow-x: auto; scrollbar-width: none; }
  #picker .brands > * { flex: none; }
  #picker .done { display: none; }
  /* Room to scroll the 3D view above the panel. */
  body.picking { padding-bottom: 54vh; }
  body.picking #toast { left: 50%; }
}
@keyframes slide-up { from { transform: translateY(104%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { #picker { animation: none; } .showcase.moving { transition: none; } }

#picker { overflow-y: auto; }
#picker .options { flex: 1 0 220px; }
@media (max-width: 960px) { #picker .options { flex-basis: 160px; } }
