/* ═══════════════════════════════════════════════════════════
   识件台 · PARTSCOPE
   A field desk for identifying electronic components.
   ═══════════════════════════════════════════════════════════ */

:root {
  --paper: #f2f0e6;
  --paper-deep: #e9e6d9;
  --surface: #fbf9f1;
  --ink: #14231d;
  --ink-2: #3d4b44;
  --muted: #727d76;
  --line: #d2cdbd;
  --line-strong: #a7a294;
  --green: #0f3a2d;
  --green-deep: #09291f;
  --green-light: #1b4a3a;
  --blue: #1656d2;
  --blue-dark: #0e3f9e;
  --blue-tint: #e3eafa;
  --amber: #f0b83f;
  --amber-deep: #d79d22;
  --amber-soft: #f7e9c1;
  --red: #b64132;
  --red-soft: #f4e0db;
  --white: #fffdf6;
  --shadow-ink: rgba(14, 42, 34, 0.09);
  --sans: "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", "Microsoft YaHei UI", "Microsoft YaHei", sans-serif;
  --mono: "Cascadia Mono", "Cascadia Code", "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --page-max: 1420px;
  --ease: cubic-bezier(.2, .75, .25, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-width: 320px;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(rgba(20, 35, 29, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 35, 29, 0.035) 1px, transparent 1px);
  background-size: 32px 32px;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button,
a,
input,
select,
summary {
  -webkit-tap-highlight-color: transparent;
}

svg {
  display: block;
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3,
h4 {
  font-family: var(--display);
  line-height: 1.18;
}

::selection {
  color: var(--ink);
  background: var(--amber);
}

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* ── Masthead ───────────────────────────────────────────── */

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  background: rgba(242, 240, 230, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
}

.topbar-inner {
  width: 100%;
  max-width: var(--page-max);
  min-height: 70px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: center;
  gap: 30px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  flex: 0 0 auto;
}

.brand-mark {
  display: block;
  line-height: 0;
  filter: drop-shadow(2px 2px 0 rgba(14, 42, 34, 0.12));
}

.brand-type {
  display: flex;
  flex-direction: column;
  line-height: 1;
}

.brand-type strong {
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.brand-type small {
  margin-top: 5px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.2em;
}

.main-nav {
  display: flex;
  align-items: stretch;
  align-self: stretch;
  gap: 25px;
}

.nav-link {
  position: relative;
  padding: 3px 0 0;
  color: var(--muted);
  background: none;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.nav-link::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 20px;
  left: 0;
  height: 2px;
  background: var(--blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform 180ms var(--ease);
}

.nav-link:hover {
  color: var(--ink);
}

.nav-link.is-active {
  color: var(--ink);
}

.nav-link.is-active::after {
  transform: scaleX(1);
}

.offline-state {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding: 6px 10px;
  color: var(--ink-2);
  background: rgba(251, 249, 241, 0.7);
  border: 1px solid var(--line);
  font-size: 11.5px;
  white-space: nowrap;
}

.offline-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2f7a57;
  box-shadow: 0 0 0 3px rgba(47, 122, 87, 0.12);
}

.offline-state b {
  margin-left: 2px;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
}

/* ── Shared shell ───────────────────────────────────────── */

.app-shell {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 26px 28px 58px;
}

.view:not([hidden]) {
  animation: view-in 260ms var(--ease);
}

@keyframes view-in {
  from { opacity: 0; transform: translateY(7px); }
  to   { opacity: 1; transform: translateY(0); }
}

.page-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.page-kicker::before {
  content: "";
  width: 18px;
  height: 2px;
  background: var(--blue);
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 34px;
  padding: 10px 0 26px;
  border-bottom: 1px solid var(--line-strong);
}

/* 三个视图的标题视觉一致；语义上只有首屏那个是 h1，其余用 h2（避免一页三个 h1） */
.page-head :is(h1, h2) {
  margin-bottom: 8px;
  font-size: clamp(32px, 4vw, 48px);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.page-head p:not(.page-kicker) {
  max-width: 62ch;
  margin-bottom: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.page-search {
  position: relative;
  flex: 0 1 360px;
  min-width: 240px;
  padding-bottom: 5px;
}

.page-search svg {
  position: absolute;
  top: 14px;
  left: 14px;
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.8;
  stroke-linecap: round;
  pointer-events: none;
}

.page-search input {
  width: 100%;
  height: 46px;
  padding: 0 88px 0 42px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 2px;
  outline: none;
}

.page-search input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 86, 210, 0.12);
}

.page-search input::-webkit-search-cancel-button {
  display: none;
}

.result-count {
  position: absolute;
  top: 17px;
  right: 12px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  pointer-events: none;
}

.head-note {
  flex: 0 0 auto;
  padding: 12px 16px;
  color: var(--ink-2);
  background: var(--surface);
  border-left: 2px solid var(--amber);
  font-family: var(--mono);
  font-size: 11.5px;
  line-height: 1.8;
}

.head-note b {
  color: var(--ink);
}

/* ── Identification workbench ───────────────────────────── */

.workbench {
  display: grid;
  grid-template-columns: minmax(358px, 0.82fr) minmax(0, 1.45fr);
  min-height: calc(100vh - 124px);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  box-shadow: 13px 13px 0 var(--shadow-ink);
}

.console {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 33px 30px 22px;
  color: var(--paper);
  background:
    radial-gradient(circle at 20% 0%, rgba(240, 184, 63, 0.1), transparent 30%),
    linear-gradient(155deg, var(--green) 0%, var(--green-deep) 82%);
  isolation: isolate;
}

.console::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 0;
  background-image:
    linear-gradient(rgba(243, 241, 232, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243, 241, 232, 0.045) 1px, transparent 1px);
  background-size: 24px 24px;
  mask-image: linear-gradient(to bottom, black, transparent 84%);
}

.console-top {
  max-width: 440px;
}

.console-kicker {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: #c7d2ca;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.09em;
}

.console-kicker span {
  width: 7px;
  height: 7px;
  border-radius: 1px;
  background: var(--amber);
  box-shadow: 0 0 0 3px rgba(240, 184, 63, 0.14);
}

.console h1 {
  margin-bottom: 15px;
  color: var(--white);
  font-size: clamp(36px, 3.5vw, 49px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.04em;
}

.console-lede {
  max-width: 38ch;
  margin-bottom: 0;
  color: #c3cec6;
  font-size: 13.5px;
  line-height: 1.75;
}

.mode-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  margin: 25px 0 22px;
  padding: 4px;
  background: rgba(255, 255, 255, 0.065);
  border: 1px solid rgba(243, 241, 232, 0.17);
}

.mode-button {
  min-height: 41px;
  padding: 7px 8px;
  color: #c8d3cb;
  background: transparent;
  border: 0;
  border-radius: 1px;
  font-size: 12.5px;
  font-weight: 600;
  transition: color 150ms ease, background-color 150ms ease;
}

.mode-button:hover {
  color: var(--white);
  background: rgba(255, 255, 255, 0.06);
}

.mode-button.is-active {
  color: var(--ink);
  background: var(--paper);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.18);
}

.console-panel {
  animation: panel-in 180ms ease;
}

@keyframes panel-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.search-form > label,
.tool-label {
  display: block;
  margin-bottom: 8px;
  color: #c9d4cc;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.search-box {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  min-height: 54px;
  padding: 6px 6px 6px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 2px;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

.search-box:focus-within {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(240, 184, 63, 0.22);
}

.search-icon {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: var(--ink-2);
  stroke-width: 1.8;
  stroke-linecap: round;
}

.search-box input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0;
  color: var(--ink);
  background: transparent;
  border: 0;
  outline: none;
  font-family: var(--mono);
  font-size: 14px;
  letter-spacing: 0.01em;
}

.search-box input::placeholder {
  color: #8b958e;
  font-family: var(--sans);
  font-size: 12.5px;
  letter-spacing: 0;
}

.search-box input::-webkit-search-cancel-button {
  display: none;
}

.search-submit {
  min-width: 66px;
  min-height: 42px;
  padding: 0 16px;
  color: var(--ink);
  background: var(--amber);
  border: 1px solid var(--amber-deep);
  border-radius: 1px;
  font-size: 13px;
  font-weight: 700;
  transition: background-color 150ms ease, transform 150ms ease;
}

.search-submit:hover {
  background: #f6c75c;
}

.search-submit:active {
  transform: translateY(1px);
}

.field-hint {
  margin: 8px 0 0;
  color: #98aba0;
  font-size: 11px;
}

.field-hint kbd {
  display: inline-block;
  min-width: 17px;
  margin: 0 2px;
  padding: 0 4px;
  color: #dce4de;
  background: rgba(255, 255, 255, 0.09);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  font-family: var(--mono);
  font-size: 10px;
  text-align: center;
}

.example-block,
.recent-block {
  margin-top: 24px;
}

.panel-label {
  margin: 0;
  color: #9fb1a6;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.example-chip {
  padding: 6px 10px;
  color: #e5ece7;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(243, 241, 232, 0.22);
  border-radius: 1px;
  font-family: var(--mono);
  font-size: 11.5px;
  transition: border-color 150ms ease, color 150ms ease, background-color 150ms ease;
}

.example-chip:hover {
  color: var(--amber);
  background: rgba(240, 184, 63, 0.08);
  border-color: rgba(240, 184, 63, 0.55);
}

.recent-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.text-button {
  padding: 0;
  color: #9fb1a6;
  background: none;
  border: 0;
  font-size: 10.5px;
  text-decoration: underline;
  text-underline-offset: 3px;
}

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

.recent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 9px;
}

.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 3px 0;
  color: #c8d3cb;
  background: none;
  border: 0;
  font-family: var(--mono);
  font-size: 11.5px;
}

.recent-chip::before {
  content: "";
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--amber);
  opacity: 0.75;
}

.recent-chip:hover {
  color: var(--white);
}

.console-note {
  display: flex;
  gap: 9px;
  margin-top: 26px;
  padding-top: 17px;
  color: #a5b5ab;
  border-top: 1px solid rgba(243, 241, 232, 0.14);
  font-size: 11.5px;
  line-height: 1.7;
}

.console-note p {
  margin: 0;
}

.console-note b {
  color: var(--white);
  font-family: var(--mono);
  font-weight: 500;
}

.note-mark {
  flex: 0 0 auto;
  color: var(--amber);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.4;
}

.console-foot {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: auto;
  padding-top: 28px;
  color: #83968b;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.03em;
}

.console-foot span:not(:last-child)::after {
  content: "/";
  margin-left: 12px;
  color: rgba(243, 241, 232, 0.25);
}

/* Appearance form */

.appearance-step {
  padding: 17px 0 2px;
  border-top: 1px solid rgba(243, 241, 232, 0.14);
}

.appearance-step:first-child {
  padding-top: 2px;
  border-top: 0;
}

.step-head {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}

.step-number {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
  color: var(--ink);
  background: var(--amber);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
}

.step-copy {
  margin: 3px 0 0;
  color: #96a99e;
  font-size: 10.5px;
  line-height: 1.4;
}

.shape-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.shape-button {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-height: 69px;
  padding: 9px 9px 8px;
  color: #d4ded7;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(243, 241, 232, 0.18);
  border-radius: 2px;
  text-align: left;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.shape-button:hover {
  border-color: rgba(240, 184, 63, 0.6);
  background: rgba(255, 255, 255, 0.075);
}

.shape-button.is-selected {
  color: var(--ink);
  background: var(--amber);
  border-color: var(--amber);
}

.shape-icon {
  width: 30px;
  height: 22px;
  color: inherit;
}

.shape-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.35;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shape-label {
  font-size: 10.5px;
  font-weight: 600;
  line-height: 1.25;
}

.pin-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 5px;
}

.pin-button {
  min-height: 34px;
  padding: 4px;
  color: #d4ded7;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(243, 241, 232, 0.18);
  border-radius: 1px;
  font-family: var(--mono);
  font-size: 11px;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.pin-button:hover {
  border-color: rgba(240, 184, 63, 0.6);
}

.pin-button.is-selected {
  color: var(--ink);
  background: var(--amber);
  border-color: var(--amber);
  font-weight: 600;
}

.clue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.clue-button {
  min-height: 31px;
  padding: 5px 9px;
  color: #d4ded7;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid rgba(243, 241, 232, 0.18);
  border-radius: 1px;
  font-size: 10.5px;
  transition: border-color 150ms ease, background-color 150ms ease, color 150ms ease;
}

.clue-button:hover {
  border-color: rgba(240, 184, 63, 0.6);
}

.clue-button.is-selected {
  color: var(--ink);
  background: var(--amber);
  border-color: var(--amber);
  font-weight: 600;
}

.appearance-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(243, 241, 232, 0.14);
}

.ghost-button {
  min-height: 34px;
  padding: 5px 11px;
  color: #cbd5ce;
  background: transparent;
  border: 1px solid rgba(243, 241, 232, 0.23);
  border-radius: 1px;
  font-size: 10.5px;
}

.ghost-button:hover {
  color: var(--white);
  border-color: rgba(243, 241, 232, 0.5);
}

.switch-link {
  padding: 0;
  color: var(--amber);
  background: none;
  border: 0;
  font-size: 10.5px;
  text-align: right;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.switch-link:hover {
  color: #f7cf74;
}

/* ── Reading panel ──────────────────────────────────────── */

.reading {
  min-width: 0;
  padding: 34px 38px 38px;
  background: var(--surface);
}

/* Idle state */

.idle {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: idle-in 420ms var(--ease);
}

@keyframes idle-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.idle-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.78fr);
  align-items: center;
  gap: 36px;
}

.micro-label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-bottom: 16px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.micro-label::before {
  content: "";
  width: 22px;
  height: 1px;
  background: var(--line-strong);
}

.idle-copy h2 {
  margin-bottom: 15px;
  font-size: clamp(34px, 4vw, 48px);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.04em;
}

.idle-lede {
  max-width: 36ch;
  margin-bottom: 0;
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.8;
}

.specimen-panel {
  position: relative;
  overflow: hidden;
  min-height: 282px;
  background:
    linear-gradient(rgba(243, 241, 232, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243, 241, 232, 0.05) 1px, transparent 1px),
    linear-gradient(155deg, #124333, var(--green-deep));
  background-size: 20px 20px, 20px 20px, 100% 100%;
  border: 1px solid var(--green-deep);
  box-shadow: 7px 7px 0 var(--paper-deep);
}

.specimen-panel::after {
  content: "SPECIMEN / 01";
  position: absolute;
  right: 12px;
  bottom: 9px;
  color: rgba(243, 241, 232, 0.42);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.12em;
}

.specimen-svg {
  width: 100%;
  height: 100%;
  min-height: 282px;
}

.idle-steps {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 39px;
  padding-top: 0;
}

.idle-step {
  padding-top: 13px;
  border-top: 1px solid var(--line-strong);
}

.idle-step .step-index {
  display: block;
  margin-bottom: 7px;
  color: var(--blue);
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 600;
}

.idle-step h3 {
  margin-bottom: 5px;
  font-size: 14px;
  font-weight: 700;
}

.idle-step p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.idle-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 31px;
  padding-top: 15px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
}

.idle-foot b {
  color: var(--ink-2);
}

.idle-foot .dot {
  width: 5px;
  height: 5px;
  background: var(--amber);
  border-radius: 50%;
}

.idle-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 15px;
  border-radius: 1px;
  font-size: 12px;
  font-weight: 650;
  text-decoration: none;
  transition: background-color 150ms ease, border-color 150ms ease, color 150ms ease;
}

.primary-button {
  color: var(--paper);
  background: var(--green);
  border: 1px solid var(--green);
}

.primary-button:hover {
  background: var(--green-light);
  border-color: var(--green-light);
}

.secondary-button {
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line-strong);
}

.secondary-button:hover {
  border-color: var(--ink);
}

/* Results */

.result-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 13px;
  margin-bottom: 18px;
  border-bottom: 2px solid var(--ink);
}

.result-head .result-head-label {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.result-head h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.result-query {
  display: inline-flex;
  align-items: baseline;
  gap: 7px;
  max-width: 45%;
  color: var(--muted);
  font-size: 10.5px;
  white-space: nowrap;
}

.result-query b {
  overflow: hidden;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  text-overflow: ellipsis;
}

.candidate-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: -2px 0 21px;
  padding-bottom: 3px;
  scrollbar-width: thin;
}

.candidate-tab {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
  min-height: 36px;
  padding: 6px 11px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 1px;
  font-size: 11.5px;
  white-space: nowrap;
  transition: color 150ms ease, border-color 150ms ease, background-color 150ms ease;
}

.candidate-tab:hover {
  border-color: var(--ink-2);
}

.candidate-tab.is-active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.candidate-tab .candidate-score {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
}

.candidate-tab.is-active .candidate-score {
  color: #b7c3bb;
}

.ambiguity {
  display: flex;
  gap: 10px;
  margin-bottom: 22px;
  padding: 12px 15px;
  background: var(--amber-soft);
  border-left: 3px solid var(--amber-deep);
  font-size: 12px;
  line-height: 1.7;
}

.ambiguity-mark {
  flex: 0 0 auto;
  color: #7c5710;
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 700;
}

.ambiguity p {
  margin: 0;
  color: #5c471c;
}

.ambiguity b {
  color: #3f3215;
}

.result-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 0.62fr);
  align-items: start;
  gap: 28px;
}

.result-title-block {
  min-width: 0;
}

.result-meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  min-height: 26px;
}

.cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  padding: 4px 8px;
  color: var(--cat-color, var(--ink-2));
  background: var(--cat-bg, var(--paper-deep));
  border-radius: 1px;
  font-size: 10.5px;
  font-weight: 600;
}

.cat-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  background: currentColor;
  border-radius: 50%;
}

.match-type {
  color: var(--muted);
  font-size: 10.5px;
}

.result-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-top: 15px;
}

.result-title {
  overflow-wrap: anywhere;
  margin: 0 0 5px;
  font-size: clamp(34px, 4.5vw, 59px);
  font-weight: 800;
  line-height: 1.06;
  letter-spacing: -0.055em;
}

.result-name {
  margin: 0;
  color: var(--ink-2);
  font-size: 14.5px;
  font-weight: 500;
  line-height: 1.5;
}

.confidence-stamp {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 78px;
  height: 78px;
  margin-top: 1px;
  color: var(--blue);
  border: 2px solid currentColor;
  border-radius: 50%;
  outline: 1px solid currentColor;
  outline-offset: 3px;
  transform: rotate(-6deg);
  text-align: center;
}

.confidence-stamp.is-mid {
  color: #9a6516;
}

.confidence-stamp.is-low {
  color: var(--red);
}

.stamp-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
}

.stamp-inner strong {
  font-family: var(--mono);
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.stamp-inner small {
  margin-top: 5px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.result-summary {
  max-width: 58ch;
  margin: 18px 0 0;
  color: var(--ink-2);
  font-size: 13.5px;
  line-height: 1.82;
}

.result-art-board {
  position: relative;
  min-height: 210px;
  overflow: hidden;
  background:
    linear-gradient(rgba(243, 241, 232, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(243, 241, 232, 0.045) 1px, transparent 1px),
    linear-gradient(150deg, #124434, var(--green-deep));
  background-size: 18px 18px, 18px 18px, 100% 100%;
  border: 1px solid var(--green-deep);
}

.result-art-board::before {
  content: "PART / " attr(data-art-index);
  position: absolute;
  top: 10px;
  left: 11px;
  z-index: 1;
  color: rgba(243, 241, 232, 0.46);
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.result-art-board svg {
  width: 100%;
  height: auto;
  min-height: 210px;
}

.evidence {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 18px;
}

.evidence-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 7px;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px solid var(--line);
  font-size: 10.5px;
  line-height: 1.3;
}

.evidence-tag::before {
  content: "";
  width: 4px;
  height: 4px;
  background: #39765a;
  border-radius: 50%;
}

.result-divider {
  margin: 27px 0 0;
  border: 0;
  border-top: 1px solid var(--line-strong);
}

.result-details {
  display: grid;
  grid-template-columns: minmax(0, 0.88fr) minmax(0, 1.12fr);
  gap: 31px;
  padding-top: 22px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 11px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.section-title::before {
  content: "";
  width: 13px;
  height: 2px;
  background: var(--blue);
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  column-gap: 18px;
}

.fact {
  min-width: 0;
  padding: 9px 0 10px;
  border-top: 1px solid var(--line);
}

.fact-label {
  display: block;
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 500;
}

.fact-value {
  display: block;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.clean-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.clean-list li {
  position: relative;
  padding: 0 0 8px 14px;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.7;
}

.clean-list li::before {
  content: "";
  position: absolute;
  top: 0.68em;
  left: 0;
  width: 4px;
  height: 4px;
  background: var(--amber-deep);
}

.confusion {
  display: flex;
  gap: 12px;
  margin-top: 22px;
  padding: 13px 15px;
  background: var(--amber-soft);
  border-left: 3px solid var(--amber-deep);
}

.confusion-label {
  flex: 0 0 auto;
  color: #765313;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.8;
}

.confusion p {
  margin: 0;
  color: #57451f;
  font-size: 11.5px;
  line-height: 1.75;
}

.pin-details {
  margin-top: 21px;
  border-top: 1px solid var(--line-strong);
}

.pin-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  color: var(--ink);
  font-size: 11.5px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
}

.pin-details summary::-webkit-details-marker {
  display: none;
}

.pin-details summary::after {
  content: "+";
  color: var(--blue);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 400;
}

.pin-details[open] summary::after {
  content: "−";
}

.pin-table-wrap {
  max-height: 248px;
  overflow: auto;
  border: 1px solid var(--line);
}

.pin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11px;
}

.pin-table th,
.pin-table td {
  padding: 6px 11px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.pin-table th {
  position: sticky;
  top: 0;
  color: var(--muted);
  background: var(--paper);
  font-size: 9px;
  font-weight: 600;
}

.pin-table td:first-child {
  width: 90px;
  color: var(--blue);
  font-family: var(--mono);
}

.pin-table tr:last-child td {
  border-bottom: 0;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}

.models-block {
  margin-top: 25px;
  padding-top: 20px;
  border-top: 1px solid var(--line-strong);
}

.models-block h3 {
  margin: 0 0 4px;
  font-size: 12px;
  font-weight: 700;
}

.models-copy {
  margin: 0 0 11px;
  color: var(--muted);
  font-size: 11px;
}

.model-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 10.5px;
  transition: border-color 150ms ease, background-color 150ms ease;
}

.model-chip::before {
  content: "";
  width: 5px;
  height: 5px;
  background: var(--cat-color, var(--muted));
  border-radius: 50%;
}

.model-chip:hover {
  background: var(--paper);
  border-color: var(--ink-2);
}

.assumption-note {
  display: flex;
  gap: 9px;
  margin: 16px 0 21px;
  padding-top: 13px;
  color: var(--muted);
  border-top: 1px dashed var(--line-strong);
  font-size: 11px;
  line-height: 1.65;
}

.assumption-note::before {
  content: "i";
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 15px;
  height: 15px;
  margin-top: 1px;
  color: var(--paper);
  background: var(--ink-2);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 9px;
  font-style: italic;
}

/* Empty / no match */

.no-match {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: 12px 0;
  animation: idle-in 300ms var(--ease);
}

.no-match-mark {
  display: grid;
  place-items: center;
  width: 62px;
  height: 62px;
  margin-bottom: 22px;
  color: var(--ink);
  background: var(--amber-soft);
  border: 1px solid var(--amber-deep);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 600;
  transform: rotate(-5deg);
}

.no-match h2 {
  max-width: 18ch;
  margin-bottom: 9px;
  font-size: clamp(29px, 3.8vw, 41px);
  font-weight: 800;
  letter-spacing: -0.035em;
}

.no-match > p {
  max-width: 46ch;
  margin-bottom: 20px;
  color: var(--ink-2);
  font-size: 13px;
}

.no-match-queries {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-bottom: 23px;
}

.query-suggestion {
  padding: 6px 10px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 11px;
}

.query-suggestion:hover {
  color: var(--ink);
  border-color: var(--ink-2);
}

.no-match-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.appearance-empty {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
}

.appearance-empty h2 {
  max-width: 16ch;
  margin: 15px 0 10px;
  font-size: clamp(30px, 3.8vw, 42px);
  font-weight: 800;
  letter-spacing: -0.04em;
}

.appearance-empty p {
  max-width: 48ch;
  color: var(--ink-2);
  font-size: 13px;
}

.appearance-empty .empty-prompt {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-top: 23px;
  padding-top: 16px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11.5px;
}

.empty-prompt .prompt-arrow {
  color: var(--blue);
  font-family: var(--mono);
  font-size: 14px;
}

/* ── Library ────────────────────────────────────────────── */

.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 17px 0 0;
}

.filter-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 31px;
  padding: 5px 9px;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 1px;
  font-size: 11px;
  line-height: 1.2;
}

.filter-button span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
}

.filter-button:hover {
  border-color: var(--line);
}

.filter-button.is-active {
  color: var(--paper);
  background: var(--ink);
  border-color: var(--ink);
}

.filter-button.is-active span {
  color: #b6c1ba;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(244px, 1fr));
  gap: 13px;
  margin-top: 21px;
}

.part-card {
  --cat-color: var(--ink-2);
  --cat-bg: var(--paper-deep);
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 198px;
  padding: 16px 17px 15px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--cat-color);
  border-radius: 1px;
  text-align: left;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease;
}

.part-card:hover {
  border-color: var(--line-strong);
  box-shadow: 5px 5px 0 var(--shadow-ink);
  transform: translateY(-2px);
}

.part-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.part-card-cat {
  color: var(--cat-color);
  font-size: 10px;
  font-weight: 650;
}

.part-card-glyph {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  color: var(--cat-color);
  background: var(--cat-bg);
  font-family: var(--mono);
  font-size: 7px;
  font-weight: 600;
  letter-spacing: 0.03em;
}

.part-model {
  margin: 15px 0 2px;
  font-family: var(--mono);
  font-size: 17px;
  font-weight: 650;
  line-height: 1.25;
  letter-spacing: -0.03em;
  overflow-wrap: anywhere;
}

.part-name {
  margin: 0;
  color: var(--ink-2);
  font-size: 11.5px;
  line-height: 1.5;
}

.part-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: auto;
  padding-top: 14px;
}

.meta-tag {
  padding: 2px 5px;
  color: var(--muted);
  background: var(--paper);
  border: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 8.5px;
  line-height: 1.5;
}

.library-empty {
  padding: 76px 20px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  text-align: center;
}

.library-empty p {
  margin-bottom: 16px;
  font-size: 13px;
}

/* ── Code tools ─────────────────────────────────────────── */

.tool-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 24px;
}

.tool-card {
  padding: 25px 26px 24px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--blue);
}

.tool-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 23px;
}

.tool-heading .page-kicker {
  margin-bottom: 7px;
  font-size: 10px;
}

.tool-heading h2 {
  margin: 0;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.tool-symbol {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--blue);
  background: var(--blue-tint);
  border-radius: 50%;
  font-family: var(--mono);
  font-size: 19px;
}

.tool-label {
  color: var(--ink-2);
  font-size: 10.5px;
}

.tool-input {
  width: 100%;
  height: 55px;
  padding: 0 15px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  border-radius: 1px;
  outline: none;
  font-family: var(--mono);
  font-size: 22px;
  letter-spacing: 0.08em;
}

.tool-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(22, 86, 210, 0.1);
}

.tool-hint {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 10.5px;
}

.tool-result {
  min-height: 132px;
  margin-top: 18px;
  padding: 18px 18px 17px;
  color: var(--paper);
  background: var(--green);
}

.tool-result-label {
  margin: 0 0 4px;
  color: #a9bab0;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
}

.tool-result-value {
  margin: 0;
  color: var(--white);
  font-family: var(--mono);
  font-size: clamp(28px, 3.6vw, 41px);
  font-weight: 600;
  letter-spacing: -0.05em;
  line-height: 1.2;
}

.tool-result-explain {
  margin: 8px 0 0;
  color: #bfcec4;
  font-size: 11px;
  line-height: 1.75;
}

.tool-result-error {
  color: #ffd0c8;
}

.code-chipline {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 3px;
}

.code-chipline .unit {
  color: #bcd0c4;
  font-family: var(--sans);
  font-size: 12px;
}

/* Color-band tool */

.color-tool {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(280px, 0.92fr);
  gap: 44px;
  margin-top: 18px;
  padding: 28px 30px 30px;
  background: var(--surface);
  border: 1px solid var(--line);
}

.color-tool-copy h2 {
  margin-bottom: 10px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.04em;
}

.color-tool-copy > p:not(.page-kicker) {
  max-width: 51ch;
  margin-bottom: 17px;
  color: var(--ink-2);
  font-size: 12px;
  line-height: 1.75;
}

.band-mode {
  display: inline-flex;
  gap: 3px;
  margin-bottom: 18px;
  padding: 3px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.band-mode-button {
  min-height: 30px;
  padding: 4px 12px;
  color: var(--muted);
  background: transparent;
  border: 0;
  font-size: 11px;
}

.band-mode-button.is-active {
  color: var(--paper);
  background: var(--ink);
}

.band-selects {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 13px;
}

.band-select-wrap {
  min-width: 0;
}

.band-select-wrap label {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9.5px;
}

.band-select {
  width: 100%;
  height: 37px;
  padding: 0 8px;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 1px;
  font-size: 11.5px;
}

.band-result {
  margin-top: 18px;
  padding-top: 15px;
  border-top: 1px solid var(--line-strong);
}

.band-result-value {
  color: var(--ink);
  font-family: var(--mono);
  font-size: clamp(29px, 4vw, 42px);
  font-weight: 650;
  letter-spacing: -0.06em;
  line-height: 1.15;
}

.band-result-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
}

.color-tool-visual {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 22px 20px;
  background:
    linear-gradient(rgba(20, 35, 29, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(20, 35, 29, 0.04) 1px, transparent 1px),
    var(--paper);
  background-size: 18px 18px, 18px 18px, 100% 100%;
  border: 1px solid var(--line);
}

.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  justify-content: center;
  margin-bottom: 28px;
}

.color-dot {
  width: 17px;
  height: 17px;
  border: 1px solid rgba(20, 35, 29, 0.24);
}

.resistor-drawing {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 86px;
}

.resistor-lead {
  flex: 1 1 34px;
  min-width: 20px;
  height: 2px;
  background: #8f958d;
}

.resistor-body {
  position: relative;
  display: flex;
  align-items: stretch;
  justify-content: space-evenly;
  flex: 0 1 250px;
  height: 66px;
  padding: 0 20px;
  overflow: hidden;
  background: #d6bd91;
  border: 1px solid #9f8255;
  border-radius: 34px / 22px;
  box-shadow: inset 0 7px 10px rgba(255, 255, 255, 0.24), inset 0 -7px 12px rgba(92, 66, 28, 0.17);
}

.band-slot {
  display: block;
  width: 13px;
  min-width: 9px;
  height: 100%;
  border-right: 1px solid rgba(20, 35, 29, 0.25);
  border-left: 1px solid rgba(20, 35, 29, 0.18);
}

.visual-caption {
  margin: 18px 0 0;
  color: var(--muted);
  font-size: 9.5px;
  text-align: center;
}

/* Code notes */

.code-examples {
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line-strong);
}

.code-example-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 13px;
}

.code-example-head h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.code-example-head p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
}

.code-example-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.code-line {
  display: grid;
  grid-template-columns: 74px 1fr 1fr;
  align-items: stretch;
  background: var(--surface);
  border: 1px solid var(--line);
}

.code-line > code {
  display: flex;
  align-items: center;
  padding: 12px 13px;
  color: var(--ink);
  background: var(--paper);
  border-right: 1px solid var(--line);
  font-family: var(--mono);
  font-size: 15px;
  font-weight: 600;
}

.code-line > div {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-width: 0;
  padding: 8px 11px;
}

.code-line > div + div {
  border-left: 1px solid var(--line);
}

.code-line b {
  color: var(--ink-2);
  font-size: 9.5px;
  font-weight: 600;
}

.code-line span {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: var(--mono);
  font-size: 10px;
}

/* ── Detail drawer ──────────────────────────────────────── */

.detail-dialog {
  width: min(590px, 100%);
  max-width: 100%;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0 0 0 auto;
  padding: 0;
  color: var(--ink);
  background: var(--surface);
  border: 0;
  box-shadow: -14px 0 42px rgba(6, 25, 18, 0.24);
}

.detail-dialog[open] {
  animation: drawer-in 280ms var(--ease);
}

@keyframes drawer-in {
  from { transform: translateX(40px); opacity: 0.5; }
  to   { transform: translateX(0); opacity: 1; }
}

.detail-dialog::backdrop {
  background: rgba(7, 24, 18, 0.55);
  backdrop-filter: blur(3px);
}

.dialog-top {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  height: 60px;
  padding: 0 26px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.dialog-top p {
  margin: 0;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  color: var(--ink);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 50%;
}

.icon-button:hover {
  background: var(--paper);
  border-color: var(--line);
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
}

.dialog-content {
  height: calc(100dvh - 60px);
  overflow-y: auto;
  padding: 27px 31px 66px;
}

.drawer-head {
  padding-bottom: 19px;
  border-bottom: 2px solid var(--ink);
}

.drawer-title {
  margin: 13px 0 3px;
  font-size: clamp(32px, 5vw, 46px);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.05em;
  overflow-wrap: anywhere;
}

.drawer-name {
  margin: 0;
  color: var(--ink-2);
  font-size: 14px;
}

.drawer-summary {
  margin: 17px 0 0;
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.8;
}

.drawer-section {
  padding-top: 20px;
}

.drawer-section h3 {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
}

.drawer-section h3::before {
  content: "";
  width: 12px;
  height: 2px;
  background: var(--blue);
}

.drawer-specs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 18px;
}

.drawer-note {
  margin-top: 20px;
  padding: 12px 14px;
  color: #57451f;
  background: var(--amber-soft);
  border-left: 3px solid var(--amber-deep);
  font-size: 11.5px;
  line-height: 1.75;
}

.drawer-caution {
  margin-top: 20px;
  padding-top: 14px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.75;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 25px;
}

/* ── Footer / toast ─────────────────────────────────────── */

.site-foot {
  width: 100%;
  max-width: var(--page-max);
  margin: 0 auto;
  padding: 0 28px 38px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 10px;
}

.site-foot p {
  margin: 0;
}

.toast {
  position: fixed;
  z-index: 70;
  bottom: 25px;
  left: 50%;
  max-width: calc(100vw - 32px);
  padding: 10px 15px;
  color: var(--paper);
  background: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 9px 28px rgba(7, 24, 18, 0.22);
  font-size: 12px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

/* ── SVG artwork ────────────────────────────────────────── */

.art-line {
  fill: none;
  stroke: #f2f0e6;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.art-line-thin {
  fill: none;
  stroke: rgba(242, 240, 230, 0.45);
  stroke-width: 1;
  stroke-linecap: round;
}

.art-amber {
  fill: var(--amber);
}

.art-ink {
  fill: #132d23;
}

.art-paper {
  fill: #f2f0e6;
}

.art-blue {
  fill: #7ea7ff;
}

.art-red {
  fill: #e87961;
}

.art-muted {
  fill: rgba(242, 240, 230, 0.55);
}

.art-text {
  fill: #f2f0e6;
  font-family: var(--mono);
  font-size: 8px;
  letter-spacing: 0.06em;
}

.art-text-small {
  fill: rgba(242, 240, 230, 0.5);
  font-family: var(--mono);
  font-size: 6.5px;
  letter-spacing: 0.06em;
}

.art-label {
  fill: rgba(242, 240, 230, 0.65);
  font-family: var(--sans);
  font-size: 8px;
}

/* ── Responsive ─────────────────────────────────────────── */

@media (max-width: 1180px) {
  .workbench {
    grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.2fr);
  }

  .reading {
    padding: 30px 30px 34px;
  }

  .result-hero {
    grid-template-columns: minmax(0, 1fr) minmax(190px, 0.55fr);
    gap: 22px;
  }

  .result-title {
    font-size: clamp(31px, 4.2vw, 48px);
  }

  .idle-top {
    grid-template-columns: minmax(0, 1fr) minmax(220px, 0.7fr);
    gap: 24px;
  }
}

@media (max-width: 980px) {
  .workbench {
    grid-template-columns: 1fr;
  }

  .console {
    padding: 29px 28px 23px;
  }

  .console h1 {
    font-size: 43px;
  }

  .console-lede {
    max-width: 58ch;
  }

  .console-note {
    max-width: 60ch;
  }

  .console-foot {
    padding-top: 22px;
  }

  .reading {
    min-height: 570px;
    border-top: 1px solid var(--line-strong);
  }

  .idle {
    min-height: 570px;
  }

  .appearance-step {
    max-width: 650px;
  }

  .tool-grid {
    grid-template-columns: 1fr;
  }

  .color-tool {
    grid-template-columns: 1fr;
    gap: 27px;
  }

  .color-tool-visual {
    min-height: 190px;
  }

  .page-search {
    flex-basis: 300px;
  }
}

@media (max-width: 760px) {
  .topbar-inner {
    min-height: 61px;
    padding: 0 16px;
    gap: 18px;
  }

  .brand-mark {
    display: none;
  }

  .brand-type strong {
    font-size: 18px;
  }

  .brand-type small {
    display: none;
  }

  .main-nav {
    gap: 17px;
  }

  .nav-link {
    font-size: 12.5px;
  }

  .nav-link::after {
    bottom: 16px;
  }

  .offline-state {
    display: none;
  }

  .app-shell {
    padding: 12px 12px 42px;
  }

  .workbench {
    min-height: 0;
    box-shadow: 7px 7px 0 var(--shadow-ink);
  }

  .console {
    padding: 24px 19px 19px;
  }

  .console h1 {
    font-size: 37px;
  }

  .console-lede {
    font-size: 12.5px;
  }

  .mode-switch {
    margin-top: 21px;
  }

  .search-box {
    grid-template-columns: 20px minmax(0, 1fr) auto;
  }

  .search-submit {
    min-width: 57px;
    padding: 0 12px;
  }

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

  .shape-button {
    min-height: 65px;
  }

  .reading {
    min-height: 500px;
    padding: 23px 19px 28px;
  }

  .idle {
    min-height: 500px;
  }

  .idle-top {
    grid-template-columns: 1fr;
    gap: 24px;
  }

  .idle-copy h2 {
    font-size: 35px;
  }

  .specimen-panel {
    min-height: 210px;
    order: 2;
  }

  .specimen-svg {
    min-height: 210px;
  }

  .idle-steps {
    grid-template-columns: 1fr;
    gap: 0;
    margin-top: 27px;
  }

  .idle-step {
    display: grid;
    grid-template-columns: 24px 1fr;
    column-gap: 10px;
    padding: 11px 0;
    border-top: 1px solid var(--line);
  }

  .idle-step .step-index {
    grid-row: span 2;
    margin: 2px 0 0;
  }

  .idle-step h3 {
    margin-bottom: 2px;
  }

  .idle-step p {
    grid-column: 2;
  }

  .idle-foot {
    margin-top: 20px;
  }

  .result-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .result-query {
    max-width: 100%;
  }

  .result-hero {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .result-title-row {
    gap: 13px;
  }

  .result-title {
    font-size: clamp(34px, 9vw, 47px);
  }

  .confidence-stamp {
    width: 68px;
    height: 68px;
  }

  .stamp-inner strong {
    font-size: 17px;
  }

  .stamp-inner small {
    font-size: 7px;
  }

  .result-art-board {
    order: -1;
    min-height: 168px;
  }

  .result-art-board svg {
    min-height: 168px;
    max-height: 205px;
  }

  .result-details {
    grid-template-columns: 1fr;
    gap: 23px;
  }

  .drawer-content,
  .dialog-content {
    padding-right: 20px;
    padding-left: 20px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 19px;
    padding-top: 4px;
  }

  .page-head :is(h1, h2) {
    font-size: 36px;
  }

  .page-search {
    flex: 0 0 auto;
    width: 100%;
    min-width: 0;
  }

  .head-note {
    display: none;
  }

  .filter-row {
    padding-top: 13px;
  }

  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(212px, 1fr));
    gap: 9px;
  }

  .part-card {
    min-height: 185px;
    padding: 13px 13px 12px;
  }

  .part-model {
    font-size: 15px;
  }

  .tool-grid {
    gap: 11px;
    margin-top: 18px;
  }

  .tool-card {
    padding: 20px 18px;
  }

  .tool-heading h2,
  .color-tool-copy h2 {
    font-size: 25px;
  }

  .tool-result {
    min-height: 120px;
  }

  .color-tool {
    padding: 21px 18px 22px;
  }

  .color-tool-visual {
    padding: 17px 13px;
  }

  .code-example-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

  .code-example-grid {
    grid-template-columns: 1fr;
  }

  .site-foot {
    flex-direction: column;
    gap: 4px;
    padding: 0 16px 28px;
  }

  .detail-dialog {
    width: 100%;
  }
}

@media (max-width: 430px) {
  .brand-type strong {
    font-size: 17px;
    letter-spacing: 0.03em;
  }

  .main-nav {
    gap: 13px;
    margin-left: auto;
  }

  .nav-link {
    font-size: 11.5px;
  }

  .console h1 {
    font-size: 34px;
  }

  .pin-grid {
    grid-template-columns: repeat(4, 1fr);
  }

  .library-grid {
    grid-template-columns: 1fr;
  }

  .part-card {
    min-height: 164px;
  }

  .band-selects {
    grid-template-columns: 1fr;
  }

  .resistor-body {
    flex-basis: 200px;
    height: 56px;
    padding: 0 12px;
  }

  .band-slot {
    width: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

/* ── 无结果兜底：最接近的几条 ─────────────────────────────
   型号对不上时给近似结果。它们不是“猜中了”，所以文案只用
   「最接近」并且不加百分比 —— 标个 62% 会让人误以为是匹配度。 */

.no-match .closest-block {
  margin-top: 26px;
}

.no-match .closest-block .panel-label {
  margin-bottom: 10px;
}

.no-match .closest-block .field-hint {
  margin-top: 10px;
  max-width: 40ch;
}

/* ── 站内回程（由博客仓库 scripts/sync-parts.mjs 追加，别在原项目里改）──
   识件台可以独立访问 —— 别人直接把 /parts/ 的链接发过来时，页面上得有一条
   回工具箱的路，否则读者只能按浏览器后退。文字色沿用页脚继承的 muted，
   只用透明度做层次，不引入新颜色，跟这套米色 + 墨绿的气质不冲突。 */

.site-foot {
  flex-wrap: wrap;
}

.foot-back {
  flex-basis: 100%;
}

.foot-back a {
  color: inherit;
  text-decoration: none;
  border-bottom: 1px solid currentColor;
  opacity: 0.75;
  transition: opacity 160ms ease;
}

.foot-back a:hover,
.foot-back a:focus-visible {
  opacity: 1;
}
