:root {
  color-scheme: light dark;
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --fg: #1b1f24;
  --muted: #5d6673;
  --line: #d9dde3;
  --outline: #9aa3ae;
  --outline-faint: #c5cbd3;
  --accent: #2a78d6;
  --accent-fg: #ffffff;
  --set: #1f9d63;
  --bad: #d64545;
  --bad-bg: #fdeeee;
  --shadow: 0 10px 30px rgba(20, 30, 45, .14), 0 2px 6px rgba(20, 30, 45, .08);
  --radius: 14px;
  /* Hover on anything clickable: a blue border over a soft blue fill. */
  --hover-bg: color-mix(in srgb, var(--accent) 7%, var(--surface));
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", "Hiragino Sans", "Noto Sans JP", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111418; --surface: #1b2027; --surface-2: #232a33; --fg: #e8ebef; --muted: #9aa4b1;
    --line: #313a45; --outline: #6f7b89; --outline-faint: #3c4652; --accent: #4b93ea;
    --set: #34b97a; --bad: #ef6b6b; --bad-bg: #3a2124;
    --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .4);
  }
}
:root[data-theme="dark"] {
  --bg: #111418; --surface: #1b2027; --surface-2: #232a33; --fg: #e8ebef; --muted: #9aa4b1;
  --line: #313a45; --outline: #6f7b89; --outline-faint: #3c4652; --accent: #4b93ea;
  --set: #34b97a; --bad: #ef6b6b; --bad-bg: #3a2124;
  --shadow: 0 10px 30px rgba(0, 0, 0, .5), 0 2px 6px rgba(0, 0, 0, .4);
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--fg);
  display: grid; grid-template-rows: auto 1fr auto; min-height: 100dvh;
}
button, input, select { font: inherit; color: inherit; }

/* ---------- header ---------- */
.top {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  padding: max(16px, env(safe-area-inset-top)) 20px 0;
}
.brand h1 { margin: 0; font-size: 22px; letter-spacing: -.01em; }
.brand p { margin: 4px 0 0; color: var(--muted); font-size: 13.5px; }
/* The app icon; rounding hides the light rim at its corners. */
.logo { width: 40px; height: 40px; border-radius: 22%; display: block; }
/* The wide logo: dark lettering on a transparent ground in the light theme, the white-
   lettered badge in the dark theme. */
.wordmark { display: block; line-height: 0; }
.wordmark img { height: 52px; width: auto; }
.wm-dark { display: none; border-radius: 10px; }
:root[data-theme="dark"] .wm-light { display: none; }
:root[data-theme="dark"] .wm-dark { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .wm-light { display: none; }
  :root:not([data-theme="light"]) .wm-dark { display: block; }
}
.actions { display: flex; gap: 8px; flex-shrink: 0; align-items: center; }
.btn.icon { width: 40px; padding: 0; }
.btn.lang { width: auto; padding: 0 10px; }
.flag { display: inline-flex; width: 24px; height: 16px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); flex-shrink: 0; }
.flag svg { width: 100%; height: 100%; display: block; }
.menu button { display: flex; align-items: center; gap: 10px; }
.menu [aria-checked="true"] { font-weight: 700; }
.menu [aria-checked="true"]::after { content: "✓"; margin-left: auto; color: var(--accent); }
.btn.help { color: var(--accent); border: 1.5px solid var(--accent); }
.btn.help:hover { background: var(--hover-bg); }
.help-ico {
  display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  border: 1.8px solid currentColor; font-size: 12.5px; font-weight: 800;
}
.theme-ico::before { content: "◐"; font-size: 17px; }
#theme[data-mode="light"] .theme-ico::before { content: "☀︎"; }
#theme[data-mode="dark"] .theme-ico::before { content: "☾"; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 200px; padding: 6px;
  display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line);
  border-radius: 12px; box-shadow: var(--shadow);
}
.menu[hidden] { display: none; }
.menu button { text-align: left; padding: 9px 12px; border: 0; border-radius: 8px; background: transparent; cursor: pointer; font-size: 14px; }
.menu button:hover, .menu button:focus-visible { background: var(--hover-bg); color: var(--accent); outline: none; }
.menu .danger { color: var(--bad); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 40px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--surface); cursor: pointer; font-weight: 600; text-decoration: none;
  transition: background .15s, border-color .15s, transform .1s;
}
.btn:hover { border-color: var(--accent); background: var(--hover-bg); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible, .dot:focus-visible, .choice:focus-visible, .mark:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { filter: brightness(1.08); background: var(--accent); }
.btn.ghost { background: transparent; }
.btn.small { height: 32px; padding: 0 12px; font-size: 13.5px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent-fg);
  color: var(--accent); font-size: 12px; line-height: 20px; text-align: center;
}

/* ---------- stage ---------- */
.stage-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 10px 16px; min-height: 0; }
.views { display: inline-flex; padding: 3px; gap: 2px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line); }
.view-tab {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 0; border-radius: 8px;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 13.5px; cursor: pointer;
}
.view-tab:hover { color: var(--fg); }
.view-tab[aria-selected="true"] { background: var(--surface); color: var(--fg); box-shadow: 0 1px 3px rgba(0, 0, 0, .12); }
.view-tab:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 1px; }
.view-tab .ico-lock, .view-tab.locked .ico-open { display: none; }
.view-tab.locked .ico-lock { display: block; }
.view-tab.locked { opacity: .6; cursor: not-allowed; }
.stage {
  position: relative; aspect-ratio: 400 / 480;
  height: min(calc(100dvh - 200px), 700px); max-width: 100%;
}
.stage[data-view="desk"] { aspect-ratio: 720 / 440; height: auto; width: min(100%, 980px, calc((100dvh - 200px) * 720 / 440)); }
.stage[data-view="software"] { aspect-ratio: auto; height: auto; width: min(100%, 760px); }
.stage .outline { display: none; }
.stage[data-view="desk"] .view-desk, .stage[data-view="inside"] .view-inside, .stage[data-view="software"] .view-software { display: block; }
.stage .sw-list { display: none; }
.stage[data-view="software"] .sw-list { display: grid; gap: 10px; animation: open-out .22s ease-out; }
.sw-cat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.sw-cat.bad { border-color: var(--bad); }
.sw-cat.locked { background: var(--surface-2); }
.sw-head { display: flex; align-items: center; gap: 8px; }
.sw-head h3 { margin: 0; font-size: 13px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.sw-ico { font-size: 16px; }
.sw-item { display: flex; align-items: center; gap: 12px; padding: 10px 0 2px; }
.sw-item + .sw-item { border-top: 1px solid var(--line); margin-top: 8px; }
.sw-main { flex: 1; min-width: 0; }
.sw-name { font-weight: 650; }
.sw-spec { color: var(--muted); font-size: 13px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.sw-bad { color: var(--bad); font-size: 13px; margin-top: 2px; }
.sw-actions, .sw-add { display: flex; gap: 6px; flex-wrap: wrap; }
.sw-add { margin-top: 10px; }
.sw-empty { color: var(--muted); padding: 6px 0 0; }
.sw-lock { font-size: 18px; }
.stage[data-view="inside"] .view-inside { animation: open-in .28s ease-out; }
.stage[data-view="desk"] .view-desk { animation: open-out .22s ease-out; }
@keyframes open-in { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }
@keyframes open-out { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .stage .outline { animation: none !important; } }
.outline { width: 100%; height: 100%; display: block; overflow: visible; }
.open-pc {
  position: absolute; transform: translate(-50%, -50%); height: 30px; padding: 0 12px; border-radius: 15px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 12.5px; font-weight: 650;
  cursor: pointer; white-space: nowrap; box-shadow: 0 2px 6px rgba(0, 0, 0, .12);
}
.open-pc .short { display: none; }
.open-pc:hover { border-color: var(--accent); color: var(--accent); }
.open-pc.locked { color: var(--muted); cursor: not-allowed; }
.open-pc.locked::before { content: "🔒 "; }
.open-pc.locked:hover { border-color: var(--line); color: var(--muted); }
.outline .shell { fill: var(--surface); stroke: var(--outline); stroke-width: 2.5; }
.outline .window { fill: var(--surface-2); stroke: var(--outline-faint); stroke-width: 1.5; }
.outline .part { fill: none; stroke: var(--outline); stroke-width: 1.6; }
.outline .faint { fill: none; stroke: var(--outline-faint); stroke-width: 1.4; }
.outline .dashed { stroke-dasharray: 4 4; }
.outline .foot { fill: var(--outline-faint); }
.outline .ram.filled, .outline .drive.filled { fill: color-mix(in srgb, var(--set) 28%, transparent); stroke: var(--set); }
.outline .ram.absent { display: none; }
.dot-n {
  position: absolute; right: -9px; top: -9px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px;
  background: var(--fg); color: var(--bg); font-size: 11px; font-weight: 700; line-height: 17px; pointer-events: none;
}

.dot {
  position: absolute; width: 26px; height: 26px; margin: -13px 0 0 -13px; padding: 0;
  border-radius: 50%; border: 3px solid var(--surface); cursor: pointer;
  background: var(--accent); box-shadow: 0 2px 8px rgba(0, 0, 0, .25);
  transition: transform .15s, background .2s;
}
.dot::after {
  content: ""; position: absolute; inset: -9px; border-radius: 50%;
  border: 2px solid var(--accent); opacity: 0; animation: pulse 2.4s ease-out infinite;
}
.dot.set { background: var(--set); }
.dot.set::after, .dot.bad::after { animation: none; }
.dot.bad { background: var(--bad); }
.dot.incl { background: var(--surface); border-color: var(--set); }
.dot.incl::after { animation: none; }
.dot:hover, .dot.open { transform: scale(1.18); }
.dot.open { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 30%, transparent), 0 2px 8px rgba(0, 0, 0, .25); }
@keyframes pulse { 0% { transform: scale(.6); opacity: .7; } 70%, 100% { transform: scale(1.25); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dot::after { animation: none; } }
.dot-label {
  position: absolute; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  white-space: nowrap; padding: 3px 8px; border-radius: 6px; background: var(--fg); color: var(--bg);
  font-size: 12px; font-weight: 600; pointer-events: none; opacity: 0; transition: opacity .12s;
}
.dot:hover .dot-label, .dot:focus-visible .dot-label { opacity: 1; }
.dot.open .dot-label { opacity: 0; }

/* ---------- balloon ---------- */
.balloon {
  position: absolute; z-index: 5; width: 300px; padding: 14px 16px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  box-shadow: var(--shadow); animation: pop .16s ease-out;
}
.balloon::before {
  content: ""; position: absolute; width: 14px; height: 14px; background: var(--surface);
  border: 1px solid var(--line); transform: rotate(45deg);
}
.balloon[data-side="right"]::before { left: -8px; top: calc(var(--arrow-y) - 7px); border-top: 0; border-right: 0; }
.balloon[data-side="left"]::before { right: -8px; top: calc(var(--arrow-y) - 7px); border-bottom: 0; border-left: 0; }
.balloon[data-side="below"]::before { top: -8px; left: calc(var(--arrow-x) - 7px); border-bottom: 0; border-right: 0; }
.balloon[data-side="above"]::before { bottom: -8px; left: calc(var(--arrow-x) - 7px); border-top: 0; border-left: 0; }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
.b-cat { font-size: 11.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.b-name { font-weight: 650; margin-top: 3px; }
.b-spec { color: var(--muted); font-size: 13px; margin-top: 2px; }
.b-price { font-weight: 700; margin-top: 6px; }
.b-empty { color: var(--muted); margin-top: 4px; }
.b-warn { margin: 10px 0 0; padding: 8px 10px 8px 26px; border-radius: 10px; background: var(--bad-bg); color: var(--bad); font-size: 13px; }
.b-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.b-lock { margin: 10px 0 0; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--muted); font-size: 13px; }
.b-lock::before { content: "🔒 "; }
.b-part { display: flex; gap: 10px; align-items: flex-start; margin-top: 6px; }
.b-link { font-size: 12.5px; font-weight: 500; color: var(--accent); margin-left: 6px; }
/* Amazon-style buttons for links to Amazon. */
.btn.amz { background: #ffd814; border-color: #fcd200; color: #0f1111; border-radius: 999px; font-weight: 600; }
.btn.amz:hover { background: #f7ca00; border-color: #f2c200; }
.btn.amz.small { height: 30px; font-size: 13px; padding: 0 14px; margin-top: 6px; width: fit-content; }
.btn.amz.tiny { height: 24px; font-size: 12px; padding: 0 10px; margin-left: 6px; vertical-align: middle; }
.b-items { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; }
.b-items li + li { border-top: 1px solid var(--line); margin-top: 10px; padding-top: 4px; }
.b-items .b-actions { margin-top: 6px; }
.b-room { margin: 10px 0 0; color: var(--muted); font-size: 12.5px; }
.thumb {
  width: 44px; height: 44px; flex-shrink: 0; border-radius: 8px; background: #fff; border: 1px solid var(--line);
  display: grid; place-items: center; overflow: hidden;
}
.thumb.big { width: 56px; height: 56px; }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.thumb-ico { font-size: 22px; filter: grayscale(.2); }
.thumb:has(.thumb-ico) { background: var(--surface-2); }

/* ---------- footer ---------- */
.foot-links {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px;
  padding: 10px 16px max(12px, env(safe-area-inset-bottom)); font-size: 13px; color: var(--muted);
}
.foot-right { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; text-align: right; }
.btn.howto { color: var(--muted); flex-shrink: 0; }
.btn.howto:hover { color: var(--accent); }
.btn.howto .help-ico { width: 18px; height: 18px; font-size: 11px; font-style: italic; font-family: Georgia, serif; }
.howto-body { padding: 4px 20px 22px; overflow-y: auto; }
.how-intro { color: var(--muted); margin: 0 0 12px; }
.how-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.how-steps li { display: flex; gap: 14px; padding: 10px 12px; border-radius: 12px; border: 1px solid transparent; }
.how-steps li:hover { border-color: var(--accent); background: var(--hover-bg); }
.how-steps p { margin: 2px 0 0; color: var(--muted); font-size: 14px; }
.how-ico { font-size: 20px; width: 28px; text-align: center; flex-shrink: 0; }
.foot-links a { color: inherit; }
.foot-links a:hover { color: var(--fg); }
.foot-links nav { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px 18px; }
.disclosure { font-size: 12px; opacity: .8; }

/* ---------- modals ---------- */
.modal {
  width: min(640px, calc(100vw - 32px)); max-height: min(780px, calc(100dvh - 48px));
  padding: 0; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--surface); color: var(--fg); box-shadow: var(--shadow);
}
.modal[open] { display: flex; flex-direction: column; animation: pop .16s ease-out; }
.modal::backdrop { background: rgba(10, 15, 25, .42); backdrop-filter: blur(2px); }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px 6px; margin: 0; }
.modal-head h2 { margin: 0; font-size: 18px; }
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent;
  font-size: 24px; line-height: 1; cursor: pointer; color: var(--muted);
}
.icon-btn:hover { background: var(--surface-2); color: var(--fg); }

.filters { padding: 6px 18px 12px; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.search, .filter-row select {
  height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
}
.search { width: 100%; }
.search:focus, .filter-row select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: transparent; }
.filter-row { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px 12px; font-size: 13px; color: var(--muted); }
.sorts { display: inline-flex; gap: 6px; }
.price-range { display: grid; gap: 4px; flex: 1 1 260px; max-width: 380px; }
.pr-label b { color: var(--fg); font-weight: 650; margin-left: 4px; }
/* Two range inputs on one track: only their thumbs take the pointer. */
.dual { position: relative; height: 26px; --lo: 0%; --hi: 100%; }
.dual::before, .dual::after { content: ""; position: absolute; top: 11px; height: 4px; border-radius: 2px; }
.dual::before { left: 0; right: 0; background: var(--line); }
.dual::after { left: var(--lo); right: calc(100% - var(--hi)); background: var(--accent); }
.dual input { position: absolute; inset: 0; width: 100%; margin: 0; background: none; pointer-events: none; -webkit-appearance: none; appearance: none; z-index: 1; }
.dual input::-webkit-slider-runnable-track { height: 26px; background: none; }
.dual input::-moz-range-track { background: none; }
.dual input::-webkit-slider-thumb {
  -webkit-appearance: none; pointer-events: auto; width: 20px; height: 20px; margin-top: 3px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: grab;
}
.dual input::-moz-range-thumb {
  pointer-events: auto; width: 16px; height: 16px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); cursor: grab;
}
.dual input:hover::-webkit-slider-thumb { background: var(--hover-bg); transform: scale(1.1); }
.dual input:focus-visible::-webkit-slider-thumb { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); }
.dual input:disabled::-webkit-slider-thumb { display: none; }
.sort, .chip {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 17px;
  border: 1px solid var(--line); background: var(--surface); color: var(--fg); font-size: 13px; font-weight: 600; cursor: pointer;
}
.sort:hover, .chip:hover { border-color: var(--accent); background: var(--hover-bg); }
.sort.on, .chip[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.sort .arrow::after { content: "↕"; opacity: .45; }
.sort[data-dir="asc"] .arrow::after { content: "↑"; opacity: 1; }
.sort[data-dir="desc"] .arrow::after { content: "↓"; opacity: 1; }
.sort:focus-visible, .chip:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.brands summary { cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--muted); width: fit-content; }
.brands summary small { font-weight: 500; color: var(--accent); }
.brand-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; max-height: 150px; overflow-y: auto; }
.brand-chip { padding: 0 10px 0 4px; height: 32px; }
.brand-chip small { color: var(--muted); font-weight: 500; }
.mono {
  display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: hsl(var(--h) 55% 45%); color: #fff; font-size: 10.5px; font-weight: 800; letter-spacing: -.02em;
}
.chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 4px 18px 8px; }
.chips[hidden] { display: none; }
.filter-row label { display: flex; align-items: center; gap: 6px; }
.filter-row select { height: 34px; color: var(--fg); }

.toggle { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14px; width: fit-content; }
.toggle input { position: absolute; opacity: 0; }
.toggle .track { width: 38px; height: 22px; border-radius: 11px; background: var(--line); position: relative; transition: background .15s; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::after { transform: translateX(16px); }
.toggle input:focus-visible + .track { outline: 3px solid color-mix(in srgb, var(--accent) 45%, transparent); outline-offset: 2px; }
.toggle small { color: var(--muted); }
.toggle[hidden], .open-pc[hidden] { display: none; }

.results { list-style: none; margin: 0; padding: 6px 10px 12px; overflow-y: auto; }
.results .empty { padding: 28px 12px; text-align: center; color: var(--muted); }
.row {
  display: grid; grid-template-columns: 22px 44px 1fr auto auto; align-items: center; gap: 12px;
  padding: 10px 8px; border-radius: 10px; border: 1px solid transparent; transition: background .12s, border-color .12s;
}
.row + .row { box-shadow: 0 -1px 0 var(--line); }
.row:hover { background: var(--hover-bg); border-color: var(--accent); box-shadow: none; }
.row:hover + .row { box-shadow: none; }
.row.current { background: color-mix(in srgb, var(--set) 10%, transparent); }
.row.bad .row-main, .row.bad .row-price { opacity: .62; }
.row-name { font-weight: 600; }
.row-spec { color: var(--muted); font-size: 12.5px; }
.sku { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 11.5px; }
.row-price { font-weight: 700; white-space: nowrap; }
.mark {
  position: relative; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
  background: var(--bad); color: #fff; font-weight: 800; font-size: 13px; cursor: help;
}
.mark.ok { background: transparent; cursor: default; }
.why {
  position: absolute; z-index: 3; left: 28px; top: 50%; transform: translateY(-50%);
  display: none; flex-direction: column; gap: 3px; width: max-content; max-width: 300px;
  padding: 8px 10px; border-radius: 8px; background: var(--fg); color: var(--bg);
  font-size: 12.5px; font-weight: 500; line-height: 1.35; box-shadow: var(--shadow); text-align: left;
}
.mark:hover .why, .mark:focus .why, .row.bad:hover .why { display: flex; }

/* ---------- wizard ---------- */
.steps { display: flex; gap: 6px; list-style: none; margin: 4px 18px 0; padding: 0; }
.steps li { flex: 1; padding-top: 8px; border-top: 3px solid var(--line); font-size: 12px; color: var(--muted); }
.steps li.on { border-color: var(--accent); color: var(--fg); font-weight: 600; }
.steps li.done { border-color: var(--set); }
#wizard-body { padding: 8px 18px 4px; overflow-y: auto; }
.q-title { margin: 10px 0 12px; font-size: 20px; }
.choices { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.choice {
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px; text-align: left;
  padding: 14px; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer;
}
.choice { transition: background .12s, border-color .12s, box-shadow .12s; }
.choice:hover { border-color: var(--accent); background: var(--hover-bg); box-shadow: 0 2px 10px color-mix(in srgb, var(--accent) 14%, transparent); }
.choice.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.choice span { color: var(--muted); font-size: 13px; }
.q-note { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.steps[hidden], .wizard-nav[hidden] { display: none; }
.ready { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 8px; padding-bottom: 14px; }
.ready-card { display: grid; grid-template-columns: 56px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; }
.ready-card .card-pic { width: 56px; height: 56px; }
.card-text { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.card-text b { line-height: 1.3; }
.card-text > span:not(.kind) { color: var(--muted); font-size: 12.5px; line-height: 1.35; }
.ready-card .ready-price { align-self: start; margin-top: 16px; font-size: 14px; white-space: nowrap; }
.kind { font-size: 11px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.choice .kind.custom { color: var(--accent); }
.choice .kind.prebuilt { color: var(--set); }
.wizard { width: min(1020px, calc(100vw - 32px)); }
.save-form { display: flex; gap: 8px; padding: 6px 18px 12px; border-bottom: 1px solid var(--line); }
.save-row { grid-template-columns: 1fr auto auto; }
.wizard-nav { display: flex; justify-content: space-between; padding: 14px 18px 18px; }

/* ---------- cart drawer ---------- */
.drawer {
  margin: 0 0 0 auto; height: 100dvh; max-height: 100dvh; width: min(580px, 100vw);
  border-radius: var(--radius) 0 0 var(--radius); border-right: 0;
}
.drawer[open] { animation: slide .2s ease-out; }
@keyframes slide { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
#cart-body { padding: 4px 18px 20px; overflow-y: auto; }
.head-tools { display: flex; align-items: center; gap: 4px; }
.icon-btn.trash { display: grid; place-items: center; }
.icon-btn.trash:hover:not(:disabled) { color: var(--bad); }
.icon-btn:disabled, .head-tools .btn:disabled { opacity: .4; cursor: default; }
#cart-body .empty { color: var(--muted); }
.cart-group { margin: 14px 0 0; font-size: 13px; color: var(--muted); font-weight: 700; }
.cart-list { list-style: none; margin: 0; padding: 0; }
.cart-main { flex: 1; min-width: 0; }
.qty { color: var(--muted); font-weight: 500; }
.cart-list li { display: flex; align-items: flex-start; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.cart-list .thumb { width: 64px; height: 64px; }
.cart-cat { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.tag-bad { color: var(--bad); background: var(--bad-bg); border-radius: 5px; padding: 0 6px; letter-spacing: 0; text-transform: none; font-weight: 600; }
.cart-name { font-weight: 600; }
.cart-link { font-size: 13px; color: var(--accent); }
.cart-price { font-weight: 700; white-space: nowrap; }
.cart-total { display: flex; justify-content: space-between; padding: 14px 0 6px; font-size: 17px; }
.cart-notes { margin: 6px 0 4px; padding-left: 18px; font-size: 13px; color: var(--muted); }
.cart-notes .bad { color: var(--bad); }
.cart-hint { font-size: 12.5px; color: var(--muted); margin: 10px 0 0; }

/* ---------- welcome ---------- */
.welcome { width: min(520px, calc(100vw - 32px)); }
.welcome-body { padding: 0 18px 20px; display: grid; gap: 10px; overflow-y: auto; }
.welcome-note { margin: 0 0 6px; color: var(--muted); }
.welcome-brand { display: flex; align-items: center; gap: 10px; }
.welcome-brand .logo { width: 32px; height: 32px; }
.choice.welcome-opt { flex-direction: row; align-items: center; gap: 14px; }
.welcome-opt b { display: block; color: var(--fg); font-size: 15.5px; }
.welcome-opt small { display: block; margin-top: 2px; font-size: 13px; }
.choice .welcome-ico { font-size: 26px; width: 36px; text-align: center; flex-shrink: 0; color: inherit; }

/* ---------- small-screen menu ---------- */
.btn.burger, .navsheet { display: none; }
#nav[open] { display: flex; }
.modal.navsheet {
  margin: max(8px, env(safe-area-inset-top)) 8px auto auto; width: min(340px, calc(100vw - 16px));
  max-height: calc(100dvh - 16px); border-radius: var(--radius);
}
.nav-body { padding: 0 12px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 12px; text-align: left;
  border: 1px solid transparent; border-radius: 10px; background: transparent; cursor: pointer; font-size: 15.5px;
}
.nav-item:hover, .nav-item:focus-visible { border-color: var(--accent); background: var(--hover-bg); outline: none; }
.nav-item.accent { color: var(--accent); font-weight: 600; }
.nav-item svg, .nav-item .help-ico { flex-shrink: 0; }
.nav-item .how-i { font-style: italic; font-family: Georgia, serif; }
.nav-head { margin: 12px 12px 4px; font-size: 12px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.seg { display: flex; gap: 6px; padding: 0 4px; }
.seg button {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface); cursor: pointer; font-size: 14.5px;
}
.seg button:hover { border-color: var(--accent); background: var(--hover-bg); }
.seg [aria-checked="true"] { border-color: var(--accent); background: var(--hover-bg); color: var(--accent); font-weight: 700; }
.nav-body hr { width: 100%; border: 0; border-top: 1px solid var(--line); margin: 12px 0 6px; }
.nav-links { display: flex; flex-wrap: wrap; gap: 8px 18px; padding: 8px 12px 0; font-size: 14px; }
.nav-links a { color: var(--muted); }
.nav-body .disclosure { margin: 10px 12px 0; color: var(--muted); }

/* ---------- toast ---------- */
.toast {
  position: fixed; left: 50%; bottom: 72px; transform: translateX(-50%); z-index: 50;
  max-width: calc(100vw - 32px); padding: 10px 16px; border-radius: 10px;
  background: var(--fg); color: var(--bg); font-size: 14px; box-shadow: var(--shadow);
  display: flex; align-items: center; gap: 14px;
}
.toast[hidden] { display: none; }
.toast-action { border: 0; background: transparent; color: var(--accent); font-weight: 700; cursor: pointer; padding: 2px 0; filter: brightness(1.35); }

/* ---------- small screens ---------- */
@media (max-width: 640px) {
  .top { padding: max(12px, env(safe-area-inset-top)) 16px 0; }
  .brand h1 { font-size: 18px; }
  .wordmark img { height: 38px; }
  /* The header keeps the menu; the other buttons and the footer live in it, and the cart floats. */
  .actions > :not(#open-nav):not(#open-cart), body:not(.page) .foot-links { display: none; }
  .btn.burger { display: inline-flex; }
  #open-cart {
    position: fixed; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40;
    height: 56px; min-width: 56px; padding: 0 18px; border-radius: 999px; box-shadow: var(--shadow);
  }
  #open-cart > span[data-i18n] { display: none; }
  #open-cart svg { width: 22px; height: 22px; }
  .stage-wrap { padding-bottom: 88px; }
  .toast { bottom: calc(max(16px, env(safe-area-inset-bottom)) + 68px); }
  .head-tools .btn > span { display: none; }
  .btn { padding: 0 11px; }
  .btn.lang { padding: 0 8px; }
  .top { align-items: center; }
  body { overflow-x: hidden; }
  .btn.icon, .btn { min-width: 38px; }
  .stage { height: auto; width: min(100%, calc((100dvh - 210px) * 400 / 480)); }
  .stage[data-view="desk"], .stage[data-view="software"] { width: 100%; }
  .sw-item { flex-wrap: wrap; }
  .sw-actions { width: 100%; justify-content: flex-end; }
  .ready { grid-template-columns: 1fr; }
  .ready-card { grid-template-columns: 48px 1fr auto; }
  .ready-card .card-pic { width: 48px; height: 48px; }
  .foot-links { align-items: flex-start; }
  .price-range { max-width: none; }
  .stage-wrap { justify-content: flex-start; padding-top: 18px; }
  .stage[data-view="desk"] .dot { width: 22px; height: 22px; margin: -11px 0 0 -11px; border-width: 2.5px; }
  .open-pc { height: 26px; padding: 0 9px; font-size: 12px; }
  .open-pc .long { display: none; }
  .open-pc .short { display: inline; }
  .modal { width: 100vw; max-width: 100vw; max-height: 88dvh; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; }
  .drawer { height: 88dvh; margin: auto 0 0; border-radius: var(--radius) var(--radius) 0 0; border-right: 1px solid var(--line); }
  .row { grid-template-columns: 22px 44px 1fr auto; }
  .row .row-price { grid-column: 3; }
  .save-row { grid-template-columns: 1fr auto auto; }
  .balloon { width: min(300px, calc(100vw - 16px)); }
  .row .btn { grid-column: 2 / -1; justify-self: end; }
  .why { left: -4px; top: 26px; transform: none; max-width: 76vw; }
}

/* ---------- static pages ---------- */
body.page { grid-template-rows: 1fr auto; }
.page-body { width: min(720px, 100%); margin: 0 auto; padding: 40px 16px; }
.page-body h1 { margin: 18px 0 12px; font-size: 28px; }
.page-body p { color: var(--fg); max-width: 65ch; }
.page-body ol { max-width: 65ch; padding-left: 22px; }
.page-body li { margin: 0 0 10px; }
.page-body a:not(.back) { color: var(--accent); }
.back { color: var(--accent); text-decoration: none; font-weight: 600; }
.back:hover { text-decoration: underline; }
[data-lang][hidden] { display: none; }
