/* shared/sheet.css — the ONE bottom-sheet primitive (mobile redesign 2026).
   Every phone-width popover/menu/dropdown routes through shared/sheet.js and
   wears these `.tcg-sheet*` classes: grabber, 44px option rows, one scroll
   context, never stacked. Absorbs the look of the older section-scoped
   `.dk-sheet` / `.cl-sheet` / `.tcg-arrange-pop` patterns into one neutral
   vocabulary (the "one sheet rule"). Anatomy values are lifted verbatim from
   the mobile-redesign handoff (README §Bottom sheets + reference.html 1b frame).

   Phone-only surface. It renders at any width the JS opens it at, but the app
   only opens sheets on phone (data-platform="mobile" / < --bp-lg); desktop keeps
   its anchored popovers. --z-bottom-sheet (90) sits above the dock + tabbar and
   below the drawer/palette rungs. */

.tcg-sheet-scrim {
  position: fixed;
  inset: 0;
  z-index: var(--z-bottom-sheet, 90);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  background: oklch(0 0 0 / 0.55);
  opacity: 0;
  transition: opacity var(--transition-fast);
}
.tcg-sheet-scrim.open { opacity: 1; }

.tcg-sheet {
  width: 100%;
  max-height: calc(70dvh / var(--ui-scale, 1)); /* /scale: zoom scales dvh too */
  display: flex;
  flex-direction: column;
  background: var(--bg-elev-1);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 16px 16px 0 0;
  padding: 8px 16px calc(18px + env(safe-area-inset-bottom));
  box-shadow: 0 -12px 40px oklch(0 0 0 / 0.5);
  transform: translateY(100%);
  transition: transform var(--transition-slide);
  will-change: transform;
}
.tcg-sheet-scrim.open .tcg-sheet { transform: translateY(0); }
/* Drag-follow: JS sets --drag-y and toggles .dragging to suppress the spring so
   the sheet tracks the finger 1:1, then removes it to animate the settle. */
.tcg-sheet.dragging { transition: none; transform: translateY(var(--drag-y, 0)); }

/* Reduced motion: no slide, no fade timing — appear/disappear instantly. */
@media (prefers-reduced-motion: reduce) {
  .tcg-sheet-scrim, .tcg-sheet { transition: none; }
}

.tcg-sheet-grab {
  flex-shrink: 0;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--border-strong);
  margin: 2px auto 12px;
}

.tcg-sheet-title {
  flex-shrink: 0;
  font-family: var(--font-display);
  font-style: italic;
  font-size: 18px;
  color: var(--text);
  margin: 0 0 8px;
}

/* One scroll context: the body scrolls, the grabber + title stay put. */
.tcg-sheet-body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}

/* ── option list (view rows: All decks / Proxy / … with a leading ✓ + count) ── */
.tcg-sheet-sec { margin-bottom: 14px; }
.tcg-sheet-sec:last-child { margin-bottom: 0; }
.tcg-sheet-head {
  font-family: var(--font-mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 8px;
}
.tcg-sheet-opts { display: flex; flex-direction: column; gap: 2px; }
.tcg-sheet-opt {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.tcg-sheet-opt:hover { background: var(--bg-hover); color: var(--text); }
.tcg-sheet-opt.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}
.tcg-sheet-opt-check {
  flex-shrink: 0;
  width: 13px;
  color: var(--accent);
  font-size: 12px;
  text-align: left;
}
.tcg-sheet-opt-label { flex: 1; min-width: 0; }
.tcg-sheet-opt-count {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}
.tcg-sheet-opt-count.warn { color: var(--warning); }

/* ── chip groups (sort · group · density): pills, selected = accent treatment ── */
.tcg-sheet-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.tcg-sheet-chip {
  font: inherit;
  font-size: 11.5px;
  padding: 8px 12px;
  border-radius: 999px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border-soft);
  color: var(--text-2);
  white-space: nowrap;
  cursor: pointer;
}
.tcg-sheet-chip:hover { color: var(--text); }
.tcg-sheet-chip.on {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: var(--text);
}

/* ── plain action rows (overflow / credential / more sheets) ── */
.tcg-sheet-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 0 4px;
  border: 0;
  border-top: 1px solid var(--border-soft);
  background: transparent;
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}
.tcg-sheet-rows > .tcg-sheet-row:first-child { border-top: 0; }
.tcg-sheet-row:hover { color: var(--text); }
.tcg-sheet-row[disabled] { color: var(--text-4); cursor: default; }
.tcg-sheet-row.danger { color: var(--danger); }
.tcg-sheet-row-icon {
  flex-shrink: 0;
  width: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-3);
}
.tcg-sheet-row-label { flex: 1; min-width: 0; }
.tcg-sheet-row-meta {
  flex-shrink: 0;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text-3);
}
.tcg-sheet-row-chev { flex-shrink: 0; color: var(--text-3); }
