/* ═══════════════════════════════════════════════════════════
   Category lab: the shared frame of the four hardware pages.

     .lab     hero with the 3D stage; stage shape follows the part
              (a long card is wide, a CPU is square, a case is tall)
     .rig     sticky filter bar; lens controls stay visible, the rest
              folds into a panel (bottom sheet on phones)
     .tray    compare tray, .cmp compare dialog, .ping stock alert

   The listings themselves live in catalog.css, one layout per category.
   ═══════════════════════════════════════════════════════════ */

/* ─── Lab hero ───────────────────────────────────────────── */
.lab {
  position: relative;
  padding-block: clamp(22px, 3.5vw, 44px) clamp(26px, 4vw, 52px);
  border-bottom: 1px solid var(--line);
  overflow: hidden;
  isolation: isolate;
}

/* Circuit traces: an orthogonal routing pattern, faded out toward the copy. */
.lab__trace {
  position: absolute;
  inset: 0;
  z-index: -1;
  background: var(--trace);
  -webkit-mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' fill='none' stroke='%23000' stroke-width='1.2'%3E%3Cpath d='M0 36h52l18 18h40l14-14h56M0 118h26l22-22h60l30 30h42M90 0v24l14 14M144 180v-30l-18-18M36 180v-40l20-20h34'/%3E%3Ccircle cx='70' cy='54' r='2.6'/%3E%3Ccircle cx='108' cy='96' r='2.6'/%3E%3Ccircle cx='126' cy='132' r='2.6'/%3E%3Ccircle cx='104' cy='38' r='2.6'/%3E%3C/svg%3E") 0 0 / 180px 180px,
    radial-gradient(70% 90% at 22% 40%, #000 0%, transparent 72%);
  -webkit-mask-composite: source-in;
  mask:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180' fill='none' stroke='%23000' stroke-width='1.2'%3E%3Cpath d='M0 36h52l18 18h40l14-14h56M0 118h26l22-22h60l30 30h42M90 0v24l14 14M144 180v-30l-18-18M36 180v-40l20-20h34'/%3E%3Ccircle cx='70' cy='54' r='2.6'/%3E%3Ccircle cx='108' cy='96' r='2.6'/%3E%3Ccircle cx='126' cy='132' r='2.6'/%3E%3Ccircle cx='104' cy='38' r='2.6'/%3E%3C/svg%3E") 0 0 / 180px 180px,
    radial-gradient(70% 90% at 22% 40%, #000 0%, transparent 72%);
  mask-composite: intersect;
}

.lab__inner {
  display: grid;
  grid-template-columns: minmax(0, .82fr) minmax(0, 1.18fr);
  gap: clamp(22px, 4vw, 56px);
  align-items: center;
}
.lab--case .lab__inner { grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr); }

.lab__copy { display: grid; gap: 14px; align-content: center; }
.lab__title {
  font-size: clamp(2rem, 4.4vw, 3.2rem);
  font-weight: 800;
  letter-spacing: -.035em;
  line-height: 1.2;
}
.lab__lede { color: var(--text-mid); max-width: 46ch; }

/* Readout: key ranges for the whole category, datasheet style. */
.readout {
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-top: 1px solid var(--line);
}
.readout > div {
  padding: 12px 0 10px;
  border-bottom: 1px solid var(--line);
}
.readout > div:nth-child(odd) { padding-inline-end: 16px; }
.readout > div:nth-child(even) { padding-inline-start: 16px; border-inline-start: 1px solid var(--line); }
.readout dt { font-size: .74rem; color: var(--text-mute); margin-bottom: 2px; }
.readout dd { margin: 0; font-size: 1.02rem; font-weight: 700; }
.readout dd.mono { direction: ltr; text-align: end; unicode-bidi: plaintext; }
[dir="rtl"] .readout dd.mono { text-align: right; }
.readout dd small { font-size: .72rem; color: var(--text-mute); font-weight: 500; }

/* ─── Stage: the 3D viewport ─────────────────────────────── */
.stage { margin: 0; display: grid; gap: 12px; min-width: 0; }

.stage__viewport {
  position: relative;
  aspect-ratio: 16 / 10;
  border-radius: var(--r);
  border: 1px solid var(--line);
  overflow: hidden;
  background:
    radial-gradient(60% 46% at 50% 78%, var(--green-soft), transparent 70%),
    linear-gradient(to top, var(--surface-2), var(--surface) 62%);
  touch-action: pan-y;
}
.stage--cpu .stage__viewport { aspect-ratio: 5 / 4; }
.stage--ram .stage__viewport { aspect-ratio: 16 / 9; }
.stage--case .stage__viewport { aspect-ratio: 4 / 4.3; }

/* Engineering floor grid, drawn behind the transparent canvas. */
.stage__viewport::before {
  content: "";
  position: absolute;
  inset: 50% -20% -10%;
  background:
    repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 38px),
    repeating-linear-gradient(0deg, var(--line) 0 1px, transparent 1px 38px);
  transform: perspective(420px) rotateX(62deg);
  transform-origin: 50% 0;
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 30%, transparent 92%);
  mask-image: linear-gradient(to bottom, transparent, #000 30%, transparent 92%);
  pointer-events: none;
}

.stage__poster {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  transition: opacity .6s var(--ease), transform .8s var(--ease);
}
.stage__poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: .9;
}
.stage.is-live .stage__poster { opacity: 0; transform: scale(1.04); pointer-events: none; }

.stage__gl { position: absolute; inset: 0; }
.stage__gl canvas { display: block; width: 100% !important; height: 100% !important; outline: none; cursor: grab; }
.stage__gl canvas:active { cursor: grabbing; }
.stage__gl canvas:focus-visible { box-shadow: inset 0 0 0 2px var(--green); }

/* Loader: the counter climbs in the unit this part is judged by. */
.stage__load {
  position: absolute;
  inset-inline-start: 16px;
  inset-block-end: 16px;
  display: grid;
  gap: 6px;
  min-width: 170px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--ink) 78%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: opacity .4s, transform .4s var(--ease);
}
.stage.is-live .stage__load { opacity: 0; transform: translateY(8px); pointer-events: none; }
.stage__read { display: flex; align-items: baseline; gap: 8px; direction: ltr; justify-content: flex-end; }
.stage__count { font-size: 1.5rem; font-weight: 700; color: var(--text); letter-spacing: -.02em; }
.stage__unit { font-size: .74rem; color: var(--green); }
.stage__bar { height: 2px; background: var(--line-2); overflow: hidden; border-radius: 2px; }
.stage__bar i { display: block; height: 100%; background: var(--green); transform-origin: 100% 50%; transform: scaleX(var(--p, 0)); }
[dir="ltr"] .stage__bar i { transform-origin: 0 50%; }
.stage__msg { font-size: .74rem; color: var(--text-mute); }

.stage__start {
  position: absolute;
  inset-inline-start: 16px;
  inset-block-end: 16px;
}

/* Dimension line, positioned by the viewer from projected 3D points. */
.stage__dim {
  position: absolute;
  top: 0; left: 0;
  height: 0;
  border-top: 1px solid var(--green-line);
  transform-origin: 0 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity .4s;
}
.stage.is-live .stage__dim.is-on { opacity: 1; }
.stage__dim::before, .stage__dim::after {
  content: "";
  position: absolute;
  top: -5px;
  width: 1px; height: 9px;
  background: var(--green);
}
.stage__dim::before { left: 0; }
.stage__dim::after { right: 0; }
.stage__dim span {
  position: absolute;
  left: 50%;
  top: 6px;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: .72rem;
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--green);
  white-space: nowrap;
  padding: 1px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--ink) 70%, transparent);
}

.stage__cap {
  display: flex;
  align-items: baseline;
  gap: 10px 14px;
  flex-wrap: wrap;
  font-size: .9rem;
}
.stage__cap b { font-weight: 700; }
.stage__cap .mono { font-size: .8rem; color: var(--text-mute); direction: ltr; }
.stage__label { font-size: .74rem; color: var(--green); font-weight: 600; }

.stage__tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}
.stage__spots, .stage__acts { display: flex; gap: 6px; flex-wrap: wrap; }

.spot {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  min-height: 40px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-mid);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: color .2s, border-color .2s, background-color .2s, transform .18s var(--ease);
}
.spot::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--line-2);
  transition: background-color .2s, box-shadow .2s;
}
.spot:hover { color: var(--text); border-color: var(--line-2); }
.spot:active { transform: scale(.96); }
.spot[aria-pressed="true"] { color: var(--green); border-color: var(--green-line); background: var(--green-soft); }
.spot[aria-pressed="true"]::before { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.stage__acts .iconbtn[aria-pressed="true"] { color: var(--green); border-color: var(--green-line); background: var(--green-soft); }
.stage:not(.is-live) .stage__tools button { opacity: .5; pointer-events: none; }

.stage__hint { font-size: .76rem; color: var(--text-mute); }
.stage__note {
  font-size: .76rem;
  color: var(--text-mid);
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px dashed var(--line-2);
}

/* ─── Rig: sticky filter bar ─────────────────────────────── */
.rig {
  position: sticky;
  top: 72px;
  z-index: 30;
  background: color-mix(in srgb, var(--ink) 90%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
@media (prefers-reduced-transparency: reduce) {
  .rig { background: var(--ink); backdrop-filter: none; -webkit-backdrop-filter: none; }
}
.rig__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  padding-block: 12px;
  flex-wrap: wrap;
}
.rig__lens, .rig__end { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rig__count { font-size: .84rem; color: var(--text-mute); white-space: nowrap; }
.rig__count b { color: var(--text); font-weight: 700; }
.rig__more { position: relative; }
.rig__n {
  display: inline-grid;
  place-items: center;
  min-width: 20px; height: 20px;
  padding-inline: 5px;
  border-radius: var(--r-pill);
  background: var(--green);
  color: var(--on-green);
  font-size: .7rem;
  font-weight: 700;
}
.rig__note {
  font-size: .74rem;
  color: var(--text-mute);
  padding-block: 0 10px;
}
.rig__note i { color: var(--green); vertical-align: -2px; }

/* Segmented control on real radios; the glider is added by JS. */
.seg {
  position: relative;
  display: inline-flex;
  margin: 0;
  padding: 3px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-pill);
  background: var(--surface);
  isolation: isolate;
}
.seg legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.seg label { position: relative; cursor: pointer; }
.seg input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.seg span {
  display: block;
  padding: 7px 15px;
  min-height: 34px;
  border-radius: var(--r-pill);
  font-size: .84rem;
  font-weight: 600;
  color: var(--text-mid);
  white-space: nowrap;
  transition: color .25s;
}
.seg input:checked + span { color: var(--on-green); background: var(--green); }
.seg input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.seg label:hover span { color: var(--text); }
.seg input:checked + span, .seg label:hover input:checked + span { color: var(--on-green); }
.seg.has-glider input:checked + span { background: transparent; }
.seg__glider {
  position: absolute;
  z-index: -1;
  top: 3px; bottom: 3px; left: 0;
  border-radius: var(--r-pill);
  background: var(--green);
  pointer-events: none;
}
.seg--sm span { padding: 6px 12px; font-size: .8rem; font-family: var(--mono); }
.seg.is-off { opacity: .4; pointer-events: none; }

.sort select {
  appearance: none;
  -webkit-appearance: none;
  padding: 9px 36px 9px 16px;
  padding-inline: 16px 36px;
  min-height: 40px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background:
    linear-gradient(45deg, transparent 50%, var(--text-mute) 50%) calc(100% - 20px) 55% / 5px 5px no-repeat,
    linear-gradient(-45deg, transparent 50%, var(--text-mute) 50%) calc(100% - 15px) 55% / 5px 5px no-repeat,
    var(--surface);
  font-size: .84rem;
  font-weight: 600;
  cursor: pointer;
}
[dir="rtl"] .sort select {
  background-position: 15px 55%, 20px 55%, 0 0;
}
.sort select:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Active filters as removable chips. */
.rig__active { display: flex; flex-wrap: wrap; gap: 6px; padding-block: 0 12px; }
.rig__active:empty { display: none; }
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px 5px 12px;
  padding-inline: 12px 8px;
  border-radius: var(--r-pill);
  border: 1px solid var(--green-line);
  background: var(--green-soft);
  color: var(--text);
  font-size: .78rem;
  font-weight: 600;
  cursor: pointer;
}
.pill i { color: var(--green); font-size: .9rem; }
.pill:hover { border-color: var(--green); }
.pill--clear { background: transparent; border-color: var(--line-2); color: var(--text-mute); }

/* ─── Filter panel ───────────────────────────────────────── */
.sheet {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows .5s var(--ease);
}
.sheet.is-open { grid-template-rows: 1fr; }
.sheet__scrim { display: none; }
.sheet__panel { min-height: 0; overflow: hidden; }
.sheet__head { display: none; }
.sheet__grid {
  display: grid;
  grid-template-columns: 1.4fr repeat(3, minmax(0, 1fr));
  gap: 22px 32px;
  padding-block: 8px 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
.sheet__foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-block: 0 16px;
}
.sheet__done { display: none; }

.facet { display: grid; gap: 10px; align-content: start; min-width: 0; }
.facet h3 { font-size: .8rem; font-weight: 700; color: var(--text-mid); }
.facet__hint { font-size: .74rem; color: var(--text-mute); line-height: 1.6; }
.facet select, .facet input[type="number"] {
  width: 100%;
  padding: 10px 14px;
  min-height: 42px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line-2);
  background: var(--surface);
  font-size: .86rem;
}
.facet input[type="number"] { font-family: var(--mono); direction: ltr; text-align: center; }
.facet select:focus-visible, .facet input:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* Price histogram above a dual range. */
.hist {
  display: flex;
  align-items: flex-end;
  gap: 3px;
  height: 44px;
  direction: ltr;
}
.hist i {
  flex: 1;
  min-height: 3px;
  border-radius: 2px 2px 0 0;
  background: var(--line-2);
  transition: background-color .25s;
}
.hist i.is-in { background: var(--green-line); }
.hist i.is-in.is-hit { background: var(--green); }

.range { position: relative; height: 24px; direction: ltr; }
.range::before {
  content: "";
  position: absolute;
  left: 0; right: 0; top: 11px;
  height: 2px;
  background: var(--line-2);
  border-radius: 2px;
}
.range__fill {
  position: absolute;
  top: 11px;
  height: 2px;
  background: var(--green);
  left: var(--a, 0%);
  right: calc(100% - var(--b, 100%));
}
.range input {
  position: absolute;
  inset: 0;
  width: 100%;
  margin: 0;
  background: none;
  pointer-events: none;
  -webkit-appearance: none;
  appearance: none;
}
.range input::-webkit-slider-thumb {
  -webkit-appearance: none;
  pointer-events: auto;
  width: 22px; height: 22px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--green);
  cursor: grab;
}
.range input::-moz-range-thumb {
  pointer-events: auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--green);
  cursor: grab;
}
.range input:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--green-soft); }
.range input::-webkit-slider-runnable-track { background: none; }
.range__out { font-size: .8rem; color: var(--text-mid); }
.range__out b { color: var(--text); }

.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.check { position: relative; cursor: pointer; }
.check input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; }
.check > span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 13px;
  min-height: 36px;
  border-radius: var(--r-pill);
  border: 1px solid var(--line);
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-mid);
  transition: color .2s, border-color .2s, background-color .2s;
}
.check small { font-size: .7rem; color: var(--text-mute); font-weight: 500; }
.check input:checked + span { color: var(--green); border-color: var(--green-line); background: var(--green-soft); }
.check input:checked + span small { color: var(--green); }
.check input:focus-visible + span { outline: 2px solid var(--green); outline-offset: 2px; }
.check input:disabled + span { opacity: .4; cursor: not-allowed; }

.toggle { display: flex; align-items: center; gap: 10px; font-size: .82rem; color: var(--text-mid); cursor: pointer; }
.toggle input {
  appearance: none;
  -webkit-appearance: none;
  position: relative;
  flex-shrink: 0;
  width: 38px; height: 22px;
  margin: 0;
  border-radius: var(--r-pill);
  background: var(--line-2);
  cursor: pointer;
  transition: background-color .2s;
}
.toggle input::after {
  content: "";
  position: absolute;
  top: 3px;
  inset-inline-start: 3px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--text);
  transition: inset-inline-start .25s var(--ease);
}
.toggle input:checked { background: var(--green); }
.toggle input:checked::after { inset-inline-start: 19px; background: var(--on-green); }
.toggle input:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ─── Compare tray ───────────────────────────────────────── */
.tray {
  position: fixed;
  inset-inline: 12px;
  inset-block-end: calc(12px + env(safe-area-inset-bottom));
  z-index: var(--z-tray);
  display: flex;
  justify-content: center;
  pointer-events: none;
}
.tray__inner {
  pointer-events: auto;
  width: min(820px, 100%);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--shadow);
}
.tray__slots {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  min-width: 0;
}
.tray__slot {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 52px;
  padding: 6px;
  padding-inline-end: 4px;
  border-radius: 10px;
  border: 1px dashed var(--line-2);
  min-width: 0;
}
.tray__slot.is-full { border-style: solid; border-color: var(--line); background: var(--surface-2); }
.tray__slot img { width: 50px; height: 38px; object-fit: cover; border-radius: 6px; flex-shrink: 0; }
.tray__slot b { font-size: .76rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; min-width: 0; }
.tray__empty { font-size: .74rem; color: var(--text-mute); padding-inline: 8px; }
.tray__rm {
  flex-shrink: 0;
  width: 30px; height: 30px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text-mute);
  cursor: pointer;
}
.tray__rm:hover { color: var(--text); background: var(--line); }
.tray__acts { display: flex; gap: 6px; flex-shrink: 0; }

.cmpbtn[aria-pressed="true"] { color: var(--green); border-color: var(--green-line); background: var(--green-soft); }

/* ─── Compare dialog ─────────────────────────────────────── */
.cmp__panel {
  position: absolute;
  inset: 4dvh 50% auto auto;
  inset-inline: max(16px, calc(50% - 560px));
  top: 4dvh;
  bottom: 4dvh;
  display: grid;
  grid-template-rows: auto 1fr;
  border-radius: var(--r);
  border: 1px solid var(--line-2);
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.cmp__head {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}
.cmp__head h2 { font-size: 1.1rem; margin-inline-end: auto; }
.cmp__body { overflow: auto; overscroll-behavior: contain; }

.cmp__table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}
.cmp__table th, .cmp__table td {
  padding: 12px 16px;
  text-align: start;
  vertical-align: top;
  border-bottom: 1px solid var(--line);
  font-size: .86rem;
}
.cmp__table col.cmp__labels { width: 190px; }
.cmp__table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--surface);
  border-bottom-color: var(--line-2);
}
.cmp__prod { display: grid; gap: 8px; }
.cmp__prod img { width: 100%; max-width: 180px; aspect-ratio: 4 / 3; object-fit: cover; border-radius: 10px; border: 1px solid var(--line); }
.cmp__prod b { font-size: .9rem; line-height: 1.5; }
.cmp__prod .price { font-size: .92rem; }
.cmp__sec th {
  padding-top: 22px;
  font-size: .74rem;
  font-weight: 700;
  color: var(--green);
  border-bottom-color: var(--line-2);
}
.cmp__table tbody th[scope="row"] { color: var(--text-mute); font-weight: 600; font-size: .8rem; }
.cmp__v { display: grid; gap: 6px; }
.cmp__v .mono { direction: ltr; justify-self: start; font-size: .92rem; color: var(--text); }
[dir="rtl"] .cmp__v .mono { justify-self: end; }
.cmp__v.is-best .mono { font-weight: 700; }
.cmp__best {
  justify-self: start;
  font-size: .68rem;
  font-weight: 700;
  color: var(--green);
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.cmp__bar { height: 4px; border-radius: 3px; background: var(--line); overflow: hidden; }
.cmp__bar i { display: block; height: 100%; background: var(--text-mute); transform-origin: 100% 50%; transform: scaleX(var(--v, 0)); }
[dir="ltr"] .cmp__bar i { transform-origin: 0 50%; }
.cmp__v.is-best .cmp__bar i { background: var(--green); }
.cmp__table tr.is-same { display: none; }
.cmp.show-all .cmp__table tr.is-same { display: table-row; }
.cmp__est { font-size: .72rem; color: var(--text-mute); padding: 12px 20px 18px; }

/* ─── Stock alert (ناموجود) ──────────────────────────────── */
dialog.ping {
  width: min(420px, calc(100vw - 32px));
  padding: 0;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}
dialog.ping::backdrop { background: var(--scrim); backdrop-filter: blur(3px); }
.ping__in { display: grid; gap: 14px; padding: 22px; }
.ping__head { display: flex; align-items: flex-start; gap: 12px; }
.ping__head h2 { font-size: 1.05rem; margin-inline-end: auto; }
.ping__sig {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: .78rem;
  color: var(--text-mute);
}
.ping__sig .mono { direction: ltr; color: var(--text-mid); }
.ping__dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--text-mute);
  box-shadow: 0 0 0 0 var(--green-line);
  animation: pingDot 1.8s ease-out infinite;
}
@keyframes pingDot { 0% { box-shadow: 0 0 0 0 var(--line-2); } 100% { box-shadow: 0 0 0 10px transparent; } }
.ping p { font-size: .88rem; color: var(--text-mid); }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 1100px) {
  .sheet__grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 900px) {
  .lab__inner, .lab--case .lab__inner { grid-template-columns: 1fr; }
  .lab__copy { order: 0; }
  .stage { order: 1; }
  .stage--gpu .stage__viewport { aspect-ratio: 4 / 3; }
  .stage--case .stage__viewport { aspect-ratio: 1 / 1; }
  .readout { grid-template-columns: repeat(2, minmax(0, 1fr)); }

  /* backdrop-filter makes an element the containing block of its fixed
     descendants, so the "fixed" bottom sheet below was pinned to this bar:
     measured at -343..371 px on an 812 px phone (371 - 88dvh = -343).
     A solid bar keeps the sheet on the viewport. */
  .rig {
    top: 72px;
    background: var(--ink);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }
  .rig__bar { padding-block: 10px; }
  .rig__lens { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; max-width: 100%; }
  .rig__lens::-webkit-scrollbar { display: none; }

  /* The panel becomes a bottom sheet. */
  .sheet {
    position: fixed;
    inset: 0;
    z-index: var(--z-dialog);
    display: none;
    transition: none;
  }
  .sheet.is-open { display: block; }
  .sheet__scrim { display: block; position: absolute; inset: 0; background: var(--scrim); }
  .sheet__panel {
    position: absolute;
    inset-inline: 0;
    bottom: 0;
    max-height: 88dvh;
    display: grid;
    grid-template-rows: auto 1fr auto;
    border-radius: var(--r) var(--r) 0 0;
    border-top: 1px solid var(--line-2);
    background: var(--surface);
  }
  .sheet__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px var(--pad) 10px;
    border-bottom: 1px solid var(--line);
  }
  .sheet__head h2 { font-size: 1rem; }
  .sheet__head::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 40px; height: 4px;
    margin-left: -20px;
    border-radius: 4px;
    background: var(--line-2);
  }
  .sheet__grid {
    grid-template-columns: 1fr;
    overflow-y: auto;
    overscroll-behavior: contain;
    border-top: 0;
    padding-block: 16px;
  }
  .sheet__foot {
    justify-content: space-between;
    padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
    border-top: 1px solid var(--line);
  }
  .sheet__done { display: inline-flex; }

  .cmp__panel { inset: 0; border-radius: 0; border: 0; }
  .cmp__table, .cmp__table thead, .cmp__table tbody, .cmp__table tr { display: block; }
  .cmp__table colgroup { display: none; }
  .cmp__table tr { display: grid; grid-template-columns: repeat(var(--n, 2), minmax(0, 1fr)); }
  .cmp__table th, .cmp__table td { border-bottom: 0; padding: 8px 12px; }
  .cmp__table tr { border-bottom: 1px solid var(--line); }
  .cmp__table thead tr > :first-child,
  .cmp__table tbody th[scope="row"] { grid-column: 1 / -1; padding-bottom: 0; }
  .cmp__table thead tr > :first-child { display: none; }
  .cmp__sec th { grid-column: 1 / -1; }
  .cmp.show-all .cmp__table tr.is-same { display: grid; }
}

@media (max-width: 640px) {
  .tray__inner { flex-direction: column; align-items: stretch; }
  .tray__slot { height: 46px; }
  .tray__slot img { width: 40px; height: 30px; }
  .tray__slot b { display: none; }
  .tray__acts { justify-content: space-between; }
  .stage__tools { flex-direction: column; align-items: stretch; }
  .stage__spots { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: none; }
  .stage__acts { justify-content: flex-end; }
  .rig__end { width: 100%; justify-content: space-between; }
}

@media (hover: none) {
  .spot, .seg span, .check > span { min-height: 44px; }
  .seg span { display: grid; place-items: center; }
}

@media (prefers-reduced-motion: reduce) {
  .ping__dot { animation: none; }
  .sheet { transition: none; }
}
