/* Pack Rangers — ranger field-guide theme, v2 polish */

/* HARD RULE (3rd occurrence of this bug class — cart-count 07-12, cost-modal + binder
   tab 07-16): any display rule silently overrides the [hidden] attribute. This makes
   hidden mean hidden, everywhere, forever. Never remove. The per-id [hidden] rules
   scattered below are now redundant but harmless. */
[hidden] { display: none !important; }

@font-face {
  font-family: 'Fredoka';
  src: url('../fonts/fredoka-latin.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}

:root {
  --paper: #F6F1E3;
  --paper-2: #ECE5D0;
  --card: #FFFDF6;
  --ink: #22301F;
  --ink-soft: #5F6952;
  --pine: #1D4A34;
  --pine-deep: #123526;
  --gold: #E8A83C;
  --gold-hi: #F6C468;
  --gold-deep: #B97E1C;
  --sticker: #FFEFA0;
  --sticker-edge: #E0BF37;
  --line: #DDD3B9;
  --shadow: 0 1px 2px rgba(34,48,31,.08), 0 6px 18px rgba(34,48,31,.07);
  --shadow-lift: 0 2px 4px rgba(34,48,31,.10), 0 12px 28px rgba(34,48,31,.13);
  --radius: 15px;
  --tabbar-h: calc(60px + env(safe-area-inset-bottom));
  --display: 'Fredoka', -apple-system, sans-serif;
  --body: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { height: 100%; }
body {
  font-family: var(--body);
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(29,74,52,.07), transparent 60%),
    radial-gradient(rgba(29,74,52,.05) 1px, transparent 1.4px);
  background-color: var(--paper);
  background-size: auto, 22px 22px;
  color: var(--ink);
  min-height: 100%;
  padding-bottom: var(--tabbar-h);
  overscroll-behavior-y: none;
}
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 6px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
  background: linear-gradient(180deg, #245A40 0%, var(--pine) 55%, #17402D 100%);
  color: #F4EFDF;
  box-shadow: inset 0 -2px 0 rgba(232,168,60,.55), 0 3px 14px rgba(18,53,38,.35);
}
.brand { display: flex; align-items: center; gap: 11px; }
.badge { width: 44px; height: 44px; flex: none; filter: drop-shadow(0 2px 3px rgba(0,0,0,.35)); }
.badge-shield { fill: url(#badgeGold); }
.badge-inner { fill: var(--pine-deep); }
.badge-cards rect { fill: #F4EFDF; stroke: var(--pine-deep); stroke-width: 1.6; }
.badge-cards .badge-card-mid { fill: var(--gold); }
.badge-dot { fill: var(--gold); }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-family: var(--display); font-weight: 650; font-size: 22px; letter-spacing: .02em;
  text-shadow: 0 1px 0 rgba(0,0,0,.25); }
.brand-sub { font-size: 10.5px; letter-spacing: .17em; text-transform: uppercase; color: #D9C98F; }
.top-status { display: flex; align-items: center; gap: 8px; }
.price-date {
  font-size: 11px; font-weight: 700; letter-spacing: .04em;
  background: rgba(0,0,0,.28); border: 1px solid rgba(232,168,60,.45);
  padding: 4px 10px; border-radius: 99px; color: #F2E7C8; white-space: nowrap;
}
.info-btn {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  border: 1.5px solid rgba(232,168,60,.55); background: rgba(0,0,0,.28); color: #F2E7C8;
  font-family: var(--display); font-weight: 650; font-size: 15px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.info-btn:active { transform: scale(.9); }

/* settings & help modal card */
.info-card {
  position: relative; background: var(--card); border-radius: 20px; max-width: 420px; width: 100%;
  padding: 24px 22px 20px; box-shadow: 0 18px 50px rgba(16,32,23,.45);
  max-height: 84vh; overflow-y: auto;
  animation: sheetup .28s cubic-bezier(.18,1.1,.35,1.05);
}
.info-card h3 { font-family: var(--display); font-weight: 650; font-size: 21px; margin-bottom: 8px; padding-right: 36px; }
.info-lead { font-size: 14px; color: var(--ink-soft); margin-bottom: 14px; line-height: 1.5; }
.info-lead b, .info-steps b { color: var(--pine); }
.info-steps { margin: 0 0 14px 20px; display: flex; flex-direction: column; gap: 10px; font-size: 14.5px; line-height: 1.5; }
.info-steps li::marker { font-weight: 800; color: var(--gold-deep); }
.share-glyph { display: inline-flex; vertical-align: -4px; width: 19px; height: 19px; color: #2E7CD6; }
.info-foot { font-size: 12.5px; color: var(--ink-soft); line-height: 1.55; border-top: 1.5px solid var(--line); padding-top: 12px; }
.info-close {
  position: absolute; top: 12px; right: 12px; width: 32px; height: 32px; border-radius: 50%;
  background: var(--paper-2); border: 1.5px solid var(--line); color: var(--ink-soft); font-size: 19px; line-height: 1;
}

/* standalone web-app: keep the notch area filled even during scroll bounce
   (bottom is covered by the fixed tab bar, which already extends into the
   home-indicator inset) */
body::before {
  content: ''; position: fixed; top: 0; left: 0; right: 0; z-index: 45;
  height: env(safe-area-inset-top); background: #245A40; pointer-events: none;
}

/* ---------- layout ---------- */
main { max-width: 720px; margin: 0 auto; padding: 0 14px; }
.view { padding-top: 12px; animation: fadein .2s ease; }
@keyframes fadein { from { opacity: 0; transform: translateY(5px); } to { opacity: 1; transform: none; } }
.view-title { font-family: var(--display); font-weight: 600; font-size: 25px; margin: 8px 2px 2px; }
.view-sub { color: var(--ink-soft); font-size: 14px; margin: 2px 2px 14px; }

/* ---------- search ---------- */
.search-wrap { position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 20; padding: 6px 0 8px;
  background: linear-gradient(var(--paper) 80%, transparent);
  /* the sticky box overhangs the first row by ~23px (transparent gradient tail) — without
     this, that strip silently eats the row's clicks/drags on every platform */
  pointer-events: none; }
.search-wrap > * { pointer-events: auto; }
/* same overhang down the chain: #find-chips and the chip row spill over the first result —
   only the actual controls (chips, buttons, inputs) may catch the pointer */
#find-chips, .search-wrap .chip-row { pointer-events: none; }
.search-wrap .chip-row > * { pointer-events: auto; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 2px solid var(--pine);
  border-radius: 17px; padding: 0 12px;
  box-shadow: 0 2px 0 rgba(29,74,52,.35), var(--shadow);
  transition: box-shadow .15s ease, transform .15s ease;
}
.search-box:focus-within { box-shadow: 0 2px 0 rgba(29,74,52,.35), 0 0 0 4px rgba(232,168,60,.30), var(--shadow-lift); }
.search-box .s-icon { width: 20px; height: 20px; color: var(--pine); flex: none; }
.search-box input {
  flex: 1; border: 0; background: none; font: inherit; font-size: 17px;
  padding: 14px 0; color: var(--ink); min-width: 0;
}
.search-box input:focus { outline: none; }
.search-box input::-webkit-search-cancel-button { display: none; }
.clear-btn {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  background: var(--paper-2); color: var(--ink-soft); font-size: 18px; line-height: 1;
}
.search-hint { font-size: 12.5px; color: var(--ink-soft); padding: 8px 6px 0; }
.search-hint b { color: var(--pine); }
.search-box-sm { margin-bottom: 7px; border-width: 1.5px; border-radius: 13px; }
.search-box-sm input { padding: 10px 0; font-size: 15px; }
#find-chips { padding-top: 8px; display: flex; flex-direction: column; gap: 5px; }
#find-chips .chip-row:empty { display: none; }
#find-chips .chip { font-size: 12.5px; padding: 6.5px 12px; }

/* ---------- card rows ---------- */
.result-count { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-soft); margin: 10px 4px 7px; display: flex; align-items: center; gap: 8px; }
.result-count::after { content: ''; flex: 1; height: 1.5px; background: var(--line); border-radius: 1px; order: 1; }
/* sort control lives inside the count line, not in a band of its own */
.sort-mini {
  order: 2; flex: none; font-size: 11px; font-weight: 750; letter-spacing: .04em;
  color: var(--pine); background: var(--card); border: 1.5px solid var(--line);
  border-radius: 99px; padding: 4px 11px; text-transform: none;
}
.sort-mini:active { transform: scale(.95); }
.card-list { display: flex; flex-direction: column; gap: 9px; padding-bottom: 24px; position: relative; }
/* swipe-left-to-remove: rows slide, the action parks in the vacated strip */
.card-row, .cart-line { touch-action: pan-y; transition: transform .18s ease; }
.swipe-remove { position: absolute; right: 0; width: 86px; border: none; border-radius: 14px;
  background: #B3402A; color: #fff; font-family: var(--display); font-weight: 700; font-size: 14px;
  display: flex; align-items: center; justify-content: center; cursor: pointer; z-index: 1; }
.swipe-remove:active { background: #963521; }
.card-row {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: linear-gradient(180deg, #FFFEFA, var(--card));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 12px 9px 9px; box-shadow: var(--shadow);
  transition: transform .1s ease, box-shadow .1s ease;
  user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.card-row img { -webkit-user-drag: none; }
.card-row:active { transform: scale(.976); box-shadow: 0 1px 2px rgba(34,48,31,.10); }
.thumb {
  width: 48px; height: 67px; flex: none; border-radius: 6px; overflow: hidden; position: relative;
  background: linear-gradient(160deg, var(--paper-2), #DFD5BB);
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--line);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.5), 0 1px 3px rgba(34,48,31,.18);
}
.thumb img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.thumb .ph { font-size: 17px; opacity: .55; }
/* holo shimmer — foil cards get a moving rainbow sheen */
.holo::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 2;
  background: linear-gradient(115deg,
    transparent 32%, rgba(255,120,120,.20) 42%, rgba(255,235,130,.24) 48%,
    rgba(120,255,190,.22) 54%, rgba(120,180,255,.24) 60%, rgba(230,120,255,.20) 66%,
    transparent 76%);
  background-size: 300% 300%;
  mix-blend-mode: screen;
}
/* animate the sheen only on the big detail image (cheap on a 60-row list) */
.detail-img.holo::after { animation: sheen 3.2s ease-in-out infinite alternate; }
@keyframes sheen { from { background-position: 0% 0%; } to { background-position: 100% 100%; } }
.row-main { flex: 1; min-width: 0; }
.row-name { font-weight: 650; font-size: 15.5px; line-height: 1.22; overflow: hidden; text-overflow: ellipsis;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.row-meta { display: flex; align-items: center; gap: 6px; margin-top: 4px; flex-wrap: wrap; }
/* full set name on rows — quiet muted text, not a loud tag (v7: set context at a glance) */
.set-tag {
  font-size: 11.5px; font-weight: 600; color: var(--ink-soft);
  white-space: nowrap; max-width: 170px; min-width: 0;
  overflow: hidden; text-overflow: ellipsis;
}
.num-tag { font-size: 12px; color: var(--ink-soft); font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.rarity-tag { font-size: 11px; color: var(--ink-soft); font-weight: 650; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 3px; }
.rarity-tag .r-sym { font-size: 9px; }
.sealed-tag {
  font-size: 9.5px; font-weight: 800; letter-spacing: .1em; color: var(--pine-deep);
  background: linear-gradient(160deg, var(--gold-hi), var(--gold));
  border: 1px solid var(--gold-deep); border-radius: 5px; padding: 1.5px 6px; white-space: nowrap;
}
.row-price { flex: none; text-align: right; }
.price-big { font-size: 17.5px; font-weight: 800; font-variant-numeric: tabular-nums; color: var(--pine-deep);
  font-family: var(--display); letter-spacing: .01em; }
.price-sub { font-size: 10.5px; color: var(--ink-soft); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.no-price { font-size: 12px; color: var(--ink-soft); opacity: .65; }
.cart-add {
  flex: none; width: 34px; height: 34px; border-radius: 50%; margin-left: 2px;
  background: var(--paper-2); border: 1.5px solid var(--line); color: var(--pine);
  display: flex; align-items: center; justify-content: center;
  transition: transform .15s cubic-bezier(.2,1.4,.4,1);
}
.cart-add svg { width: 16px; height: 16px; }
.cart-add.in { background: linear-gradient(160deg, var(--gold-hi), var(--gold)); border-color: var(--gold-deep); color: var(--pine-deep); }
.cart-add .ca-qty { font-family: var(--display); font-weight: 700; font-size: 14px; }
.cart-add.bump { transform: scale(1.25); }

.more-btn {
  margin: 4px auto 24px; display: block; font-weight: 700; color: var(--pine);
  background: var(--card); border: 2px solid var(--pine); border-radius: 13px; padding: 11px 24px;
  box-shadow: 0 2px 0 rgba(29,74,52,.35);
}
.more-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(29,74,52,.35); }

/* ---------- empty / tips ---------- */
.empty { text-align: center; padding: 30px 20px; color: var(--ink-soft); }
.empty .badge { width: 66px; height: 66px; margin-bottom: 12px; opacity: .95; }
.empty .big { font-family: var(--display); font-weight: 600; font-size: 20px; color: var(--ink); margin-bottom: 6px; }
.empty p { font-size: 14px; line-height: 1.55; max-width: 340px; margin: 0 auto; }
.try-chips { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin-top: 16px; }
.try-chip {
  font-size: 13.5px; font-weight: 700; color: var(--pine);
  background: var(--card); border: 1.5px solid var(--pine); border-radius: 99px; padding: 8px 15px;
  box-shadow: 0 2px 0 rgba(29,74,52,.30);
}
.try-chip:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(29,74,52,.30); }

/* ---------- chips ---------- */
.chip-rows { position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 20;
  background: linear-gradient(var(--paper) 86%, transparent); padding: 6px 0 8px; }
.chip-row { display: flex; gap: 6px; overflow-x: auto; padding: 3px 2px; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip {
  flex: none; font-size: 13px; font-weight: 650; padding: 7.5px 13px;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 99px; color: var(--ink-soft);
  display: flex; align-items: center; gap: 6px;
  box-shadow: 0 1px 2px rgba(34,48,31,.06);
  transition: transform .1s ease;
}
.chip:active { transform: scale(.95); }
.chip.active { background: var(--pine); border-color: var(--pine); color: #F4EFDF;
  box-shadow: 0 2px 6px rgba(18,53,38,.35); }
.type-dot { width: 12px; height: 12px; border-radius: 50%; flex: none; position: relative;
  background: radial-gradient(circle at 35% 30%, rgba(255,255,255,.75), transparent 45%), var(--dot, #999);
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.18), 0 1px 1px rgba(0,0,0,.12); }
/* card-kind chips at the end of the rarity row — gold family, divider before the first */
.chip-kind { border-color: var(--gold); color: var(--gold-deep); font-weight: 750; }
.chip-kind.active { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff;
  box-shadow: 0 2px 6px rgba(185,126,28,.4); }
.chip-kind-first { margin-left: 14px; position: relative; }
.chip-kind-first::before { content: ''; position: absolute; left: -8px; top: 15%; bottom: 15%;
  width: 1.5px; background: var(--line); }

/* ---------- sets ---------- */
.era-head { font-family: var(--display); font-weight: 600; font-size: 15px; color: var(--ink-soft);
  margin: 18px 4px 8px; display: flex; align-items: center; gap: 8px; letter-spacing: .02em; }
.era-head::after { content: ''; flex: 1; height: 1.5px; background: var(--line); border-radius: 1px; }
.set-row {
  display: flex; align-items: center; gap: 11px; width: 100%; text-align: left;
  background: linear-gradient(180deg, #FFFEFA, var(--card));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; box-shadow: var(--shadow); margin-bottom: 8px;
  transition: transform .1s ease;
}
.set-row:active { transform: scale(.98); }
.set-abbr {
  flex: none; min-width: 50px; text-align: center; font-family: var(--display); font-weight: 650; font-size: 13px;
  color: var(--pine);
  background: var(--paper-2);
  border: 1px solid var(--line); border-radius: 9px; padding: 6px 8px;
}
.set-row-main { flex: 1; min-width: 0; }
.set-row-name { display: block; font-weight: 650; font-size: 15px; }
.set-row-meta { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 2px; }
.set-arrow { color: var(--gold-deep); font-size: 19px; font-weight: 700; }

.set-head { display: flex; align-items: center; gap: 10px; padding: 6px 0 2px; }
.back-btn {
  flex: none; width: 40px; height: 40px; border-radius: 13px; font-size: 20px;
  background: var(--card); border: 1.5px solid var(--line); color: var(--pine);
  box-shadow: 0 2px 0 rgba(34,48,31,.10);
}
.back-btn:active { transform: translateY(1px); }
.set-head-text h2 { font-family: var(--display); font-weight: 600; font-size: 20px; line-height: 1.1; }
.set-head-text span { font-size: 12.5px; color: var(--ink-soft); }

/* ---------- detail sheet ---------- */
#sheet-backdrop {
  position: fixed; inset: 0; background: rgba(16,32,23,.5); z-index: 40;
  animation: fadein .16s ease;
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
}
.detail {
  position: fixed; z-index: 50; background: var(--card);
  left: 0; right: 0; bottom: 0; max-height: 88vh; overflow-y: auto;
  border-radius: 24px 24px 0 0; box-shadow: 0 -10px 44px rgba(16,32,23,.4);
  padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
  animation: sheetup .3s cubic-bezier(.18,1.1,.35,1.05);
  overscroll-behavior: contain;  /* a pull past the sheet's top must never become browser pull-to-refresh */
  touch-action: pan-y;
}
/* explicit close — the iPad side panel has no grabber and no backdrop, so it NEEDS one;
   hidden on phones where drag-down + backdrop are the natural closes */
.sheet-close {
  display: none; position: absolute; top: 16px; right: 16px; width: 36px; height: 36px;
  border-radius: 50%; background: var(--paper-2); border: 1.5px solid var(--line);
  color: var(--ink-soft); font-size: 20px; line-height: 1; z-index: 2;
  align-items: center; justify-content: center;
}
@media (min-width: 900px) {
  .sheet-close { display: flex; }
  .detail .pin-btn { right: 62px; }   /* make room: ✕ takes the corner on the wide panel */
}
@keyframes sheetup { from { transform: translateY(60px); opacity: .3; } to { transform: none; opacity: 1; } }
.grabber { width: 44px; height: 5px; border-radius: 3px; background: var(--line); margin: 3px auto 13px; }
.detail-top { display: flex; gap: 16px; }
.detail-img {
  width: 148px; flex: none; aspect-ratio: 5/7; border-radius: 10px; overflow: hidden; position: relative;
  background: linear-gradient(160deg, var(--paper-2), #DFD5BB);
  border: 1px solid var(--line); box-shadow: var(--shadow-lift);
  display: flex; align-items: center; justify-content: center;
}
.detail-img img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.detail-img .ph { font-size: 30px; opacity: .5; }
.zoom-hint { position: absolute; right: 6px; bottom: 6px; z-index: 3; width: 26px; height: 26px; border-radius: 8px;
  background: rgba(18,53,38,.72); color: #F4EFDF; display: flex; align-items: center; justify-content: center;
  font-size: 13px; pointer-events: none; }
.detail-main { flex: 1; min-width: 0; }
.detail-name { font-family: var(--display); font-weight: 650; font-size: 21px; line-height: 1.15; padding-right: 42px;
  text-wrap: balance; }
.detail-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 9px; }
.pin-btn {
  position: absolute; top: 16px; right: 16px; width: 42px; height: 42px; border-radius: 50%;
  background: var(--paper-2); border: 1.5px solid var(--line); font-size: 21px; color: var(--gold-deep);
  display: flex; align-items: center; justify-content: center;
  transition: transform .12s ease;
}
.pin-btn:active { transform: scale(.88); }
.pin-btn.pinned { background: linear-gradient(160deg, var(--gold-hi), var(--gold)); border-color: var(--gold-deep); color: #fff;
  box-shadow: 0 2px 8px rgba(232,168,60,.5); }

/* the price sticker — signature element */
.sticker {
  display: inline-block; margin-top: 13px; transform: rotate(-2.5deg); position: relative;
  background:
    radial-gradient(140% 100% at 20% 0%, rgba(255,255,255,.55), transparent 45%),
    var(--sticker);
  border: 1.6px dashed var(--sticker-edge); border-radius: 11px;
  padding: 8px 18px 9px; box-shadow: 1px 3px 8px rgba(34,48,31,.22);
  animation: stickerpop .35s cubic-bezier(.2,1.4,.4,1);
}
@keyframes stickerpop { from { transform: rotate(-6deg) scale(.7); opacity: 0; } to { transform: rotate(-2.5deg) scale(1); opacity: 1; } }
.sticker::before { /* bit of tape */
  content: ''; position: absolute; top: -8px; left: 50%; width: 40px; height: 13px;
  transform: translateX(-50%) rotate(1.5deg);
  background: rgba(240,230,200,.72); border: 1px solid rgba(190,170,120,.35); border-radius: 2px;
}
.sticker .amt { font-family: var(--display); font-weight: 700; font-size: 29px; color: var(--ink); line-height: 1;
  font-variant-numeric: tabular-nums; }
.sticker .lbl { display: block; font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; color: var(--gold-deep); margin-bottom: 3px; }

.printings { margin-top: 18px; border: 1px solid var(--line); border-radius: 13px; overflow: hidden;
  box-shadow: var(--shadow); }
.printings .p-head, .printings .p-row {
  display: grid; grid-template-columns: 1fr 86px 86px; gap: 8px; padding: 10px 14px; align-items: baseline;
}
.printings .p-head { background: linear-gradient(180deg, var(--paper-2), #E6DEC8); font-size: 11px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--ink-soft); }
.printings .p-row { border-top: 1px solid var(--line); font-size: 14.5px; background: var(--card); }
.printings .p-row b { font-variant-numeric: tabular-nums; font-size: 15.5px; text-align: right; color: var(--pine-deep); }
.printings .p-row span:first-child { font-weight: 650; }
.printings .p-row .lowp { text-align: right; color: var(--ink-soft); font-variant-numeric: tabular-nums; }
.detail-links { display: flex; gap: 10px; margin-top: 16px; flex-wrap: wrap; }
.link-out {
  font-weight: 700; font-size: 14px; color: var(--pine); text-decoration: none;
  border: 1.5px solid var(--pine); border-radius: 11px; padding: 10px 15px; background: var(--card);
  box-shadow: 0 2px 0 rgba(29,74,52,.30);
}
.link-out:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(29,74,52,.30); }
.detail-foot { margin-top: 14px; font-size: 11.5px; color: var(--ink-soft); }

/* ---------- cart ---------- */
.pct-row { justify-content: center; padding: 2px 0 12px; }
.pct-chip { font-variant-numeric: tabular-nums; font-weight: 750; }
.pct-chip.active { background: var(--gold-deep); border-color: var(--gold-deep); color: #fff;
  box-shadow: 0 2px 6px rgba(185,126,28,.4); }
.full-note { display: block; font-size: 11.5px; font-weight: 700; color: var(--gold-deep);
  margin-top: 4px; font-variant-numeric: tabular-nums; }
.cart-total-wrap { text-align: center; margin: 4px 0 16px; }
.cart-sticker { transform: rotate(-1.5deg); padding: 10px 26px 12px; }
.cart-sticker .amt { font-size: 34px; }
.cart-note { font-size: 12px; color: var(--ink-soft); margin-top: 10px; }
.cart-line {
  display: flex; align-items: center; gap: 12px; text-align: left; width: 100%;
  background: linear-gradient(180deg, #FFFEFA, var(--card));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 9px 12px 9px 9px; box-shadow: var(--shadow); cursor: pointer;
}
.line-math { display: block; font-size: 12px; color: var(--ink-soft); margin-top: 4px; font-variant-numeric: tabular-nums; }
.line-right { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 7px; }
.line-total { font-family: var(--display); font-weight: 700; font-size: 17.5px; color: var(--pine-deep); font-variant-numeric: tabular-nums; }
.qty-ctrl { display: flex; align-items: center; gap: 9px; }
.qty-ctrl b { min-width: 14px; text-align: center; font-variant-numeric: tabular-nums; }
.qty-btn {
  width: 28px; height: 28px; border-radius: 50%; font-size: 16px; line-height: 1;
  background: var(--paper-2); border: 1.5px solid var(--line); color: var(--pine);
  display: flex; align-items: center; justify-content: center;
}
.qty-btn:active { transform: scale(.88); }
.cart-foot { display: flex; flex-direction: column; gap: 12px; align-items: center; padding: 18px 0 28px; text-align: center; }

/* cart tab badge */
.cart-icon-wrap { position: relative; display: flex; }
.cart-count {
  position: absolute; top: -6px; right: -10px; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 9px; background: #C0442C; color: #fff; font-size: 10px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.cart-count[hidden] { display: none; }

/* header brand is a button now */
.brand { cursor: pointer; text-align: left; transition: transform .12s ease; }
.brand:active { transform: scale(.96); }

/* ---------- lightbox ---------- */
#lightbox {
  position: fixed; inset: 0; z-index: 60; background: rgba(12,24,17,.88);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: fadein .15s ease;
}
#lightbox img { max-width: min(92vw, 560px); max-height: 88vh; border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6); }

/* ---------- tab bar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 35; height: var(--tabbar-h);
  display: flex; padding-bottom: env(safe-area-inset-bottom);
  background: rgba(255,253,246,.94); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1.5px solid var(--line);
  box-shadow: 0 -4px 16px rgba(34,48,31,.07);
}
.tab {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--ink-soft); font-size: 11px; font-weight: 700; position: relative;
}
.tab svg { width: 23px; height: 23px; transition: transform .15s ease; }
.tab.active { color: var(--pine); }
.tab.active svg { color: var(--gold-deep); transform: translateY(-1px); }
.tab.active::before {
  content: ''; position: absolute; top: 0; width: 36px; height: 3px; border-radius: 0 0 3px 3px;
  background: linear-gradient(90deg, var(--gold), var(--gold-deep));
}
/* keyboard open: slide the bar away so iOS can't strand it mid-screen */
.tabbar { transition: transform .18s ease; }
body.kb-open .tabbar { transform: translateY(110%); }

/* ---------- iPad / wide: two-pane ---------- */
@media (min-width: 900px) {
  main { max-width: 1180px; padding-right: 470px; }
  .detail {
    left: auto; top: calc(64px + env(safe-area-inset-top)); bottom: 0; right: 0; width: 450px; max-height: none;
    border-radius: 0; border-left: 1.5px solid var(--line);
    box-shadow: -12px 0 34px rgba(16,32,23,.12);
    animation: panelin .22s ease;
  }
  @keyframes panelin { from { transform: translateX(26px); opacity: 0; } to { transform: none; opacity: 1; } }
  #sheet-backdrop { display: none; }
  .grabber { display: none; }
  .detail-img { width: 190px; }
  .tabbar { max-width: 400px; left: 50%; transform: translateX(calc(-50% - 235px)); border: 1.5px solid var(--line);
    border-radius: 20px 20px 0 0; }
  body.kb-open .tabbar { transform: translateX(calc(-50% - 235px)) translateY(110%); }
}

/* ---------- adding-to-binder mode ---------- */
#addmode-bar[hidden] { display: none; }
#addmode-bar {
  position: sticky; top: calc(64px + env(safe-area-inset-top)); z-index: 29;
  display: flex; align-items: center; gap: 9px;
  margin: 0; padding: 9px 16px;
  background: linear-gradient(180deg, #FFF6DE, #FBEEC9);
  border-bottom: 1.5px solid var(--gold);
  box-shadow: 0 3px 12px rgba(185,126,28,.18);
  font-size: 13.5px; font-weight: 700; color: var(--gold-deep);
  animation: fadein .18s ease;
}
#addmode-bar svg { width: 17px; height: 17px; flex: none; }
#addmode-bar span { flex: 1; min-width: 0; }
#addmode-done {
  flex: none; font-size: 13px; font-weight: 750; color: #fff;
  background: var(--gold-deep); border-radius: 99px; padding: 6px 16px;
}
/* in adding-mode the quick button wears the binder glyph in binder colors */
.cart-add.badd { color: var(--gold-deep); border-color: var(--gold); }
.cart-add.badd.in { background: linear-gradient(160deg, var(--gold-hi), var(--gold)); border-color: var(--gold-deep); color: var(--pine-deep); }

/* misc calm-pass bits */
.mini-lbl { font-size: 8.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-soft); }
.pct-label { text-align: center; font-size: 10px; font-weight: 800; letter-spacing: .13em;
  text-transform: uppercase; color: var(--ink-soft); padding: 2px 0 4px; }
.danger-link { font-size: 13.5px; font-weight: 700; color: #A93A28; text-decoration: underline; text-underline-offset: 3px; }
.text-link { color: var(--pine); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%;
  font-size: 14px; text-align: left; padding: 10px 12px; margin-bottom: 4px;
  background: var(--paper-2); border: 1.5px solid var(--line); border-radius: 11px;
}
.setting-row b { color: var(--pine); font-weight: 750; }
.setting-row.off b { color: var(--ink-soft); }
.b-stat-slots { border-style: dashed; border-color: var(--gold); }
.b-stat-slots b { color: var(--gold-deep); }
/* "what did you pay?" prompt */
#cost-modal { position: fixed; inset: 0; background: rgba(20,53,38,.45); z-index: 95;
  display: flex; align-items: center; justify-content: center; padding: 24px; }
/* display:flex would override the hidden attribute (same trap as .cart-count, 07-12) */
#cost-modal[hidden] { display: none; }
.cost-card { position: relative; }
.cp-name { margin: 2px 0 6px; font-family: var(--display); font-weight: 700; color: var(--pine-deep); }
.cp-inrow { display: flex; align-items: center; gap: 8px; margin: 10px 0 12px; }
.cp-cur { font-family: var(--display); font-weight: 700; font-size: 20px; color: var(--gold-deep); }
.cp-input { flex: 1; font-size: 18px; }
.cp-alts { display: flex; align-items: center; justify-content: center; gap: 18px; margin-top: 12px; }

.legal-links { display: flex; gap: 16px; justify-content: center; padding-top: 12px; margin-top: 4px; border-top: 1.5px solid var(--line); }
.legal-links .text-link { font-size: 12.5px; }

/* over-cap lock (lapsed trial / free over the cap): saved, visible, not tracked */
.locked-row { opacity: .72; }
.locked-row .line-math i { color: var(--gold-deep); font-style: normal; font-size: 12px; }
.line-lock { font-size: 18px; align-self: center; }
.b-lockcell { grid-column: span 2; text-align: left; }
.b-lockcell b { font-size: 14.5px; }

/* the slot cell as upgrade door (free tier, past the threshold) */
button.b-upgrade { font: inherit; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
button.b-upgrade:active { transform: scale(.97); }
.b-up-link { display: block; margin-top: 3px; font-size: 12.5px; font-weight: 700; color: var(--gold-deep); }
.price-date.off { background: rgba(120,70,0,.45); border-color: var(--gold-hi); color: #FFE9B8; }

/* ---------- multi-select (long-press) ---------- */
body.selecting { padding-bottom: calc(var(--tabbar-h) + 58px); }
body.selecting .cart-add { display: none; }
body.selecting .card-row::after {
  content: ''; flex: none; width: 24px; height: 24px; margin-left: 2px;
  border-radius: 50%; border: 2px solid var(--line); background: var(--card);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; font-weight: 800; color: transparent;
}
body.selecting .card-row.selected {
  border-color: var(--pine);
  background: linear-gradient(180deg, #F5F1E1, #EFE9D4);
  box-shadow: 0 0 0 1.5px rgba(29,74,52,.25), var(--shadow);
}
body.selecting .card-row.selected::after {
  content: '✓'; color: var(--pine-deep);
  background: linear-gradient(160deg, var(--gold-hi), var(--gold));
  border-color: var(--gold-deep);
}
.card-row.sel-pop { transform: scale(.97); }

#select-bar {
  position: fixed; left: 0; right: 0; bottom: var(--tabbar-h); z-index: 36;
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px;
  background: rgba(255,253,246,.96);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1.5px solid var(--line);
  box-shadow: 0 -4px 16px rgba(34,48,31,.08);
  transform: translateY(140%); transition: transform .2s cubic-bezier(.2,1,.35,1), visibility 0s .2s;
  pointer-events: none;   /* while tucked away it must never eat taps meant for the tab bar */
  visibility: hidden;     /* fully out of paint/compositing when parked — its translated position
                             overlaps the tab bar, and a live backdrop-blur there shimmers on iOS */
}
body.selecting #select-bar { transform: none; pointer-events: auto; visibility: visible; transition-delay: 0s; }
.sel-count { font-family: var(--display); font-weight: 650; font-size: 14px; color: var(--pine-deep);
  flex: 1; min-width: 0; white-space: nowrap; }
.selbar-btn {
  flex: none; font-size: 13.5px; font-weight: 700; color: var(--pine);
  background: var(--card); border: 1.5px solid var(--pine); border-radius: 11px; padding: 9px 14px;
  box-shadow: 0 2px 0 rgba(29,74,52,.30); white-space: nowrap;
}
.selbar-btn:active { transform: translateY(1px); box-shadow: 0 1px 0 rgba(29,74,52,.30); }
.sel-cancel {
  flex: none; width: 34px; height: 34px; border-radius: 50%; font-size: 19px; line-height: 1;
  background: var(--paper-2); border: 1.5px solid var(--line); color: var(--ink-soft);
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Binder (app-only) ---------- */
.owned-tag {
  font-size: 9px; font-weight: 800; letter-spacing: .09em; color: var(--ink-soft);
  background: rgba(34,48,31,.07); border: 1px solid rgba(34,48,31,.16);
  border-radius: 5px; padding: 1.5px 5px; white-space: nowrap;
}
.card-row.owned { background: linear-gradient(180deg, #FAF7EC, #F3EEDD); }

.binder-summary {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px; margin: 10px 0 0;
}
@media (min-width: 560px) { .binder-summary { grid-template-columns: repeat(4, 1fr); } }
.b-stat {
  min-width: 0; background: linear-gradient(180deg, #FFFEFA, var(--card));
  border: 1px solid var(--line); border-radius: 13px; padding: 9px 11px 8px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 2px;
}
.b-lbl { font-size: 9.5px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--ink-soft); }
.b-stat b { font-family: var(--display); font-weight: 700; font-size: 18px; color: var(--pine-deep);
  font-variant-numeric: tabular-nums; white-space: nowrap; }
.binder-note { font-size: 12px; color: var(--ink-soft); margin: 8px 2px 0; line-height: 1.45; }
.binder-controls { margin: 12px 0 4px; display: flex; flex-direction: column; gap: 7px; }
.binder-controls .chip-row { align-items: center; flex-wrap: wrap; overflow-x: visible; }
.slot-chip {
  flex: none; margin-left: auto; font-size: 11px; font-weight: 750; color: var(--gold-deep);
  border: 1.5px dashed var(--gold); border-radius: 99px; padding: 5px 11px; white-space: nowrap;
}
.gain-badge {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap;
  border-radius: 7px; padding: 2px 7px;
}
.gain-up { color: #1E6B42; background: rgba(46,125,79,.12); }
.gain-down { color: #A93A28; background: rgba(192,68,44,.11); }
.b-stat .gain-badge { align-self: flex-start; font-size: 13.5px; padding: 3px 8px; }
.qty-tag {
  font-size: 10.5px; font-weight: 800; color: var(--pine-deep);
  background: linear-gradient(160deg, var(--gold-hi), var(--gold));
  border: 1px solid var(--gold-deep); border-radius: 5px; padding: 1px 5px; white-space: nowrap;
}
.binder-row .line-right { gap: 5px; }

/* detail-sheet binder block */
.binder-block {
  margin-top: 16px; border: 1.5px solid var(--line); border-radius: 13px;
  padding: 12px 14px; background: linear-gradient(180deg, #FAF7EC, #F5F0E0);
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  box-shadow: var(--shadow);
}
.binder-block.in-binder { display: block; }
.bb-slots { font-size: 12px; font-weight: 700; color: var(--gold-deep); }
.bb-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.bb-head span { font-size: 11px; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; color: var(--gold-deep); }
.bb-remove { font-size: 12.5px; font-weight: 700; color: #A93A28; text-decoration: underline; text-underline-offset: 2px; }
.bb-row { display: flex; gap: 18px; flex-wrap: wrap; }
.bb-field { display: flex; flex-direction: column; gap: 5px; }
.bb-lbl { font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.cost-wrap { display: flex; align-items: center; gap: 3px; font-weight: 700; color: var(--pine-deep); }
.cost-input {
  width: 84px; font: inherit; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--card); border: 1.5px solid var(--line); border-radius: 9px;
  padding: 6px 9px; color: var(--ink);
}
.cost-input:focus { outline: none; border-color: var(--pine); box-shadow: 0 0 0 3px rgba(232,168,60,.25); }
.bb-math { margin-top: 10px; font-size: 13px; color: var(--ink-soft); font-variant-numeric: tabular-nums; }

/* ---------- paywall ---------- */
#paywall[hidden] { display: none; }
#paywall {
  position: fixed; inset: 0; z-index: 75; background: rgba(16,32,23,.6);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadein .15s ease;
}
.pw-card { max-width: 400px; }
.pw-eyebrow { margin: 0 0 2px; font-size: 11.5px; font-weight: 800; letter-spacing: 2.5px; color: var(--gold-deep); }
.pw-head { text-align: center; padding: 4px 0 4px; }
.pw-head .badge { width: 54px; height: 54px; margin-bottom: 8px; }
.pw-head h3 { font-family: var(--display); font-weight: 650; font-size: 22px; line-height: 1.2;
  text-wrap: balance; padding: 0 !important; }
.pw-benefits { list-style: none; margin: 14px 0 4px; display: flex; flex-direction: column; gap: 9px; }
.pw-benefits li { font-size: 14.5px; font-weight: 650; padding-left: 26px; position: relative; line-height: 1.4; }
.pw-benefits li::before { content: '✓'; position: absolute; left: 2px; color: var(--gold-deep); font-weight: 800; }
.pw-benefits li span { font-weight: 500; color: var(--ink-soft); }
.pw-prices { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 14px 0 12px; }
.pw-price {
  display: flex; flex-direction: column; gap: 3px; align-items: center; text-align: center;
  border: 2px solid var(--line); border-radius: 14px; padding: 12px 8px 10px;
  background: var(--card); transition: border-color .12s ease, box-shadow .12s ease;
}
.pw-price.chosen { border-color: var(--pine); box-shadow: 0 0 0 3px rgba(232,168,60,.28), var(--shadow); }
.pw-plan { font-size: 11px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-soft); }
.pw-amt { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--pine-deep); }
.pw-per { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.pw-note { font-size: 11px; font-weight: 750; color: var(--gold-deep); }
.pw-cta {
  display: block; width: 100%; text-align: center;
  font-family: var(--display); font-weight: 650; font-size: 17px; color: #fff;
  background: linear-gradient(180deg, #266148, var(--pine)); border-radius: 15px; padding: 14px;
  box-shadow: 0 3px 0 var(--pine-deep), var(--shadow-lift);
}
.pw-cta:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--pine-deep); }
.pw-terms { font-size: 12px; color: var(--ink-soft); line-height: 1.5; margin: 12px 2px 10px; text-align: center; }
.pw-links { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; font-size: 12.5px; padding-bottom: 2px; }

/* ---------- account sheet ---------- */
#account-modal[hidden] { display: none; }
#account-modal {
  position: fixed; inset: 0; z-index: 76; background: rgba(16,32,23,.6);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fadein .15s ease;
}
.ac-input {
  display: block; width: 100%; font: inherit; font-size: 17px; margin: 6px 0 12px;
  background: var(--card); border: 2px solid var(--pine); border-radius: 13px; padding: 12px 14px;
  font-variant-numeric: tabular-nums;
}
.ac-input:focus { outline: none; box-shadow: 0 0 0 4px rgba(232,168,60,.3); }
.ac-apple {
  display: flex; align-items: center; justify-content: center; gap: 7px; width: 100%;
  font-weight: 700; font-size: 16px; color: #fff; background: #000; border-radius: 13px; padding: 13px;
}
.ac-or { text-align: center; font-size: 11px; font-weight: 800; letter-spacing: .12em;
  text-transform: uppercase; color: var(--ink-soft); margin: 12px 0 8px; }
.ac-actions { display: flex; gap: 10px; margin: 12px 0; }
.ac-fine { font-size: 12px; color: var(--ink-soft); margin-bottom: 14px; }

/* ---------- onboarding ---------- */
#onboard[hidden] { display: none; }
#onboard {
  position: fixed; inset: 0; z-index: 90;
  background:
    radial-gradient(120% 50% at 50% 0%, rgba(29,74,52,.10), transparent 60%),
    radial-gradient(rgba(29,74,52,.05) 1px, transparent 1.4px), var(--paper);
  background-size: auto, 22px 22px, auto;
  display: flex; flex-direction: column;
  padding: calc(20px + env(safe-area-inset-top)) 28px calc(26px + env(safe-area-inset-bottom));
  animation: fadein .2s ease;
}
.ob-skip {
  position: absolute; top: calc(16px + env(safe-area-inset-top)); right: 16px;
  width: 36px; height: 36px; border-radius: 50%; font-size: 20px;
  background: var(--paper-2); border: 1.5px solid var(--line); color: var(--ink-soft);
}
.ob-body { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 14px; }
.ob-badge { width: 96px; height: 96px; }
.ob-glyph { width: 84px; height: 84px; color: var(--pine); opacity: .9; }
.ob-num {
  font-family: var(--display); font-weight: 700; font-size: 56px; color: var(--pine-deep);
  background: var(--card); border: 2px dashed var(--gold); border-radius: 18px; padding: 10px 26px;
  transform: rotate(-2deg); box-shadow: var(--shadow-lift);
}
.ob-num span { color: var(--gold-deep); }
.ob-body h2 { font-family: var(--display); font-weight: 650; font-size: 28px; line-height: 1.15; text-wrap: balance; }
.ob-body p { font-size: 15.5px; color: var(--ink-soft); line-height: 1.6; max-width: 320px; }
.ob-body p b { color: var(--pine); }
.ob-foot { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.ob-dots { display: flex; gap: 7px; }
.ob-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line); transition: background .15s ease; }
.ob-dots span.on { background: var(--gold-deep); }
.ob-cta {
  width: 100%; max-width: 340px; text-align: center;
  font-family: var(--display); font-weight: 650; font-size: 17px; color: #fff;
  background: linear-gradient(180deg, #266148, var(--pine)); border-radius: 15px; padding: 15px;
  box-shadow: 0 3px 0 var(--pine-deep), var(--shadow-lift);
}
.ob-cta:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--pine-deep); }
.ob-alt { font-size: 14px; font-weight: 650; color: var(--ink-soft); text-decoration: underline; text-underline-offset: 3px; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 16px); z-index: 80;
  transform: translateX(-50%) translateY(12px);
  background: var(--pine-deep); color: #F4EFDF;
  font-weight: 700; font-size: 14px; padding: 10px 20px; border-radius: 99px;
  box-shadow: 0 6px 20px rgba(18,53,38,.4);
  opacity: 0; pointer-events: none; transition: opacity .18s ease, transform .18s ease;
}
#toast.show { opacity: 1; transform: translateX(-50%); }

/* ---------- settings sheet extras ---------- */
#settings-modal[hidden] { display: none; }
#settings-modal {
  position: fixed; inset: 0; z-index: 70; background: rgba(16,32,23,.55);
  -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 22px;
  animation: fadein .15s ease;
}
.settings-h { font-family: var(--display); font-weight: 650; font-size: 15px; color: var(--gold-deep);
  margin: 4px 0 8px; display: flex; align-items: center; gap: 8px; }
.settings-h::after { content: ''; flex: 1; height: 1.5px; background: var(--line); border-radius: 1px; }
.settings-h:not(:first-of-type) { margin-top: 16px; }
.about-rows { display: flex; flex-direction: column; gap: 7px; font-size: 13.5px; }
.about-row { display: flex; justify-content: space-between; gap: 14px; }
.about-row span { color: var(--ink-soft); }
.about-row b { text-align: right; font-weight: 650; }
#settings-btn svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- desktop (mouse + keyboard, ≥1240px) — packrangers.app on a computer ----------
   Gated on hover+fine-pointer so phones and touch iPads (the booth iPad included) can never
   match: their experience stays byte-identical. Chad, 2026-07-17: packrangers.app is the true
   desktop home; the share URL stays the mobile home. */
@media (hover: hover) and (pointer: fine) {
  .card-row, .set-row, .chip, .tab, button { cursor: pointer; }
  input { cursor: text; }
  .card-row:hover { border-color: var(--gold); box-shadow: 0 3px 14px rgba(34,48,31,.14); transform: translateY(-1px); }
  .set-row:hover { border-color: var(--gold); transform: translateY(-1px); }
  .chip:hover:not(.active) { border-color: var(--gold-deep); }
}


/* ---------- DESKTOP v2 "Workbench + Shelf" (packrangers.app only, ≥1240px, mouse) ----------
   Triple gate: html.pr-desktop-host (set pre-paint by index.html — packrangers.app / dev
   override only) + width + hover/pointer:fine. Phones, touch iPads, and the share URL on ANY
   device stay byte-identical. PRD: outputs/2026-07-17_packrangers-desktop_prd-v2.md */
.mode-seg { display: none; }
.quick3 { display: none; }   /* desktop-only three-pack; mobile keeps the single quick button */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

@media (min-width: 1240px) and (hover: hover) and (pointer: fine) {
  :root.pr-desktop-host body {
    display: grid;
    grid-template-columns: minmax(380px, 1fr) auto minmax(340px, 400px);
    grid-template-rows: auto auto minmax(0, 1fr);
    height: 100vh; overflow: hidden;
  }
  :root.pr-desktop-host .topbar { grid-column: 1 / -1; grid-row: 1; position: static; }
  :root.pr-desktop-host #addmode-bar { grid-column: 1 / -1; grid-row: 2; position: static; }
  :root.pr-desktop-host main { grid-column: 1; grid-row: 3; overflow-y: auto; max-width: none; margin: 0; padding: 0 22px 48px; }
  /* the list keeps a readable measure — extra width becomes breathing room, not wider rows
     (a 1100px row is unscannable). Centered in the workbench zone so the whitespace splits
     evenly instead of pooling on one side; when the detail column opens, the zone narrows
     and the content re-centers within it. */
  :root.pr-desktop-host .view { max-width: 780px; margin-inline: auto; }
  :root.pr-desktop-host .tabbar { display: none; }

  /* catalog mode segment in the header */
  :root.pr-desktop-host .mode-seg { display: flex; gap: 2px; margin-left: 26px; padding: 4px; border-radius: 999px;
    background: rgba(10,30,20,.35); border: 1px solid rgba(255,255,255,.16); }
  :root.pr-desktop-host .seg { padding: 7px 18px; border-radius: 999px; font-size: 13px; font-weight: 750; color: #E9E3CD; }
  :root.pr-desktop-host .seg:hover:not(.active) { background: rgba(255,255,255,.10); }
  :root.pr-desktop-host .seg.active { background: linear-gradient(160deg, var(--gold-hi), var(--gold)); color: #3A2A08; }

  /* detail = a workbench column (nonmodal; list stays visible) */
  :root.pr-desktop-host #detail {
    grid-column: 2; grid-row: 3;
    /* relative, not static: the pin ★ / close ✕ are absolute children and must anchor HERE */
    position: relative; width: clamp(400px, 33vw, 560px); max-height: none; overflow-y: auto;
    border: none; border-left: 1.5px solid var(--line); border-radius: 0;
    box-shadow: none; animation: none; padding-bottom: 48px;
  }
  :root.pr-desktop-host #sheet-backdrop { display: none; }
  :root.pr-desktop-host .card-row.open-row { border-color: var(--gold); background: #FFF9E8; }
  :root.pr-desktop-host body.kb-open .tabbar { transform: none; }

  /* ---------- the shelf ---------- */
  :root.pr-desktop-host #shelf {
    display: flex; flex-direction: column; grid-column: 3; grid-row: 3; min-height: 0;
    border-left: 1.5px solid var(--line); background: rgba(255,253,246,.6);
  }
  :root.pr-desktop-host #shelf[hidden] { display: none; }
  .shelf-tabs { display: flex; gap: 2px; padding: 10px 12px 0; border-bottom: 1.5px solid var(--line); }
  .shelf-tab { position: relative; flex: 1; padding: 9px 6px 11px; font-size: 13px; font-weight: 750;
    color: var(--ink-soft); border-radius: 10px 10px 0 0; }
  .shelf-tab:hover:not(.active) { background: var(--paper-2); }
  .shelf-tab.active { color: var(--pine); background: #FFFEFA; border: 1.5px solid var(--line); border-bottom: none; margin-bottom: -1.5px; }
  .shelf-count { display: inline-block; min-width: 18px; margin-left: 6px; padding: 1px 5px; border-radius: 99px;
    background: var(--paper-2); border: 1px solid var(--line); font-size: 10.5px; color: var(--ink-soft); }
  .shelf-tab.active .shelf-count { background: linear-gradient(160deg, var(--gold-hi), var(--gold)); color: #3A2A08; border-color: var(--gold-deep); }
  .shelf-head { padding: 12px 16px; border-bottom: 1.5px solid var(--line); background: #FFFEFA; }
  .shelf-body { flex: 1; min-height: 0; overflow-y: auto; padding: 10px 12px 20px; }

  /* shelf summary header (finance topline: totals always visible) */
  .sh-totals { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
  .sh-big { font-family: var(--display); font-weight: 650; font-size: 22px; color: var(--pine); }
  .sh-sub { font-size: 12px; color: var(--ink-soft); }
  .sh-actions { display: flex; gap: 10px; margin-top: 8px; align-items: center; }
  .sh-export { font-size: 12px; font-weight: 750; color: var(--gold-deep); border: 1.5px solid var(--line);
    border-radius: 99px; padding: 4px 12px; background: var(--paper); }
  .sh-export:hover { border-color: var(--gold-deep); }

  /* shelf rows: dense table feel — borders + hover, no zebra; numerics right, tabular */
  .shelf-row { display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
    padding: 7px 8px; border: 1px solid transparent; border-bottom-color: var(--line); border-radius: 8px; }
  .shelf-row:hover { border-color: var(--gold); background: #FFFEFA; }
  .shelf-row .thumb { width: 34px; height: 47px; border-radius: 5px; flex: none; }
  .sr-main { flex: 1; min-width: 0; }
  .sr-name { display: block; font-size: 13px; font-weight: 700; color: var(--ink);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sr-meta { display: block; font-size: 11px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .sr-nums { text-align: right; flex: none; font-variant-numeric: tabular-nums; }
  .sr-now { display: block; font-size: 13px; font-weight: 800; color: var(--ink); }
  .sr-gain { display: block; font-size: 11px; font-weight: 750; }
  .sr-gain.up { color: #1F7A43; } .sr-gain.down { color: #B3402E; }
  .sr-paid { width: 62px; }
  .sr-paid .cost-input { width: 54px; font-size: 12px; }
  .sr-qty { display: flex; align-items: center; gap: 4px; flex: none; }
  .sr-qty .qty-btn { width: 22px; height: 22px; font-size: 13px; }
  .sr-qty b { min-width: 16px; text-align: center; font-size: 12.5px; }
  .sr-x { flex: none; width: 24px; height: 24px; border-radius: 50%; color: var(--ink-soft); font-size: 15px; }
  .sr-x:hover { background: var(--paper-2); color: #B3402E; }
  .shelf-total-sticker { padding: 12px 16px; border-top: 1.5px solid var(--line); background: #FFFEFA; }

  /* drag & drop */
  body.pr-dragging { user-select: none; -webkit-user-select: none; cursor: grabbing; }
  body.pr-dragging .card-row { cursor: grabbing; }
  .card-row.drag-src { opacity: .4; }
  .drag-ghost { position: fixed; z-index: 80; pointer-events: none; display: flex; align-items: center; gap: 8px;
    max-width: 280px; padding: 7px 12px; border-radius: 10px; background: #FFFEFA;
    border: 1.5px solid var(--gold); box-shadow: 0 10px 28px rgba(34,48,31,.28); font-size: 13px; font-weight: 700; }
  .drag-ghost .g-count { background: var(--gold-deep); color: #fff; border-radius: 99px; padding: 1px 7px; font-size: 11px; }
  body.pr-dragging #shelf { outline: 2.5px dashed var(--gold); outline-offset: -2.5px; }
  #shelf.drop-hot { background: #FFF6DE; outline: 2.5px solid var(--gold); outline-offset: -2.5px; }
  .shelf-tab.drop-hot { background: linear-gradient(160deg, var(--gold-hi), var(--gold)); color: #3A2A08; }

  /* selection (ctrl/cmd-click) reuses the mobile select-bar, anchored bottom-left of workbench */
  :root.pr-desktop-host #select-bar { left: 22px; right: auto; bottom: 18px; max-width: 640px; border-radius: 14px; }

  /* three-pack quick buttons on result rows (pin · binder · cart) — desktop has the room */
  :root.pr-desktop-host .card-row > .cart-add { display: none; }
  :root.pr-desktop-host .quick3 { display: flex; gap: 6px; flex: none; }
  .q3 { width: 34px; height: 34px; border-radius: 50%; flex: none;
    display: flex; align-items: center; justify-content: center;
    background: var(--paper); border: 1.5px solid var(--line); color: var(--ink-soft); font-size: 16px; }
  .q3 svg { width: 17px; height: 17px; }
  .q3:hover { border-color: var(--gold-deep); color: var(--gold-deep); }
  .q3.in { background: linear-gradient(160deg, var(--gold-hi), var(--gold)); border-color: var(--gold-deep); color: #3A2A08; }
  .q3 .ca-qty { font-size: 12px; font-weight: 800; }
}

/* ---------- desktop type scale (Chad 2026-07-17: "bigger minimum fonts by a good bit —
   hard for older users; we have the space"). Desktop-gate only; the mobile scale is tuned
   for arm's-length phones and stays untouched. Floor here: ~12.5px, body text 14-15px+. ---------- */
@media (min-width: 1240px) and (hover: hover) and (pointer: fine) {
  /* results */
  :root.pr-desktop-host .row-name { font-size: 17.5px; }
  :root.pr-desktop-host .set-tag, :root.pr-desktop-host .num-tag { font-size: 13.5px; }
  :root.pr-desktop-host .rarity-tag { font-size: 12.5px; }
  :root.pr-desktop-host .rarity-tag .r-sym { font-size: 10.5px; }
  :root.pr-desktop-host .owned-tag { font-size: 11.5px; }
  :root.pr-desktop-host .price-big { font-size: 19.5px; }
  :root.pr-desktop-host .price-sub, :root.pr-desktop-host .no-price { font-size: 12.5px; }
  :root.pr-desktop-host .result-count { font-size: 13px; }
  :root.pr-desktop-host .more-btn { font-size: 14.5px; }
  /* search + chips */
  :root.pr-desktop-host .search-box input { font-size: 18px; }
  :root.pr-desktop-host .search-hint { font-size: 14px; }
  :root.pr-desktop-host .chip { font-size: 14px; }
  :root.pr-desktop-host #find-chips .chip { font-size: 14px; }
  /* empty states */
  :root.pr-desktop-host .empty .big { font-size: 23px; }
  :root.pr-desktop-host .empty p { font-size: 15.5px; }
  /* detail column */
  :root.pr-desktop-host .detail-name { font-size: 24px; }
  :root.pr-desktop-host .sticker .lbl { font-size: 12.5px; }
  :root.pr-desktop-host .sticker .amt { font-size: 26px; }
  :root.pr-desktop-host .printings .p-head { font-size: 12.5px; }
  :root.pr-desktop-host .printings .p-row { font-size: 15px; }
  :root.pr-desktop-host .detail-foot { font-size: 13.5px; }
  :root.pr-desktop-host .link-out { font-size: 15.5px; }
  :root.pr-desktop-host .binder-block, :root.pr-desktop-host .bb-math { font-size: 14.5px; }
  :root.pr-desktop-host .bb-lbl { font-size: 12.5px; }
  :root.pr-desktop-host .bb-slots { font-size: 13px; }
  :root.pr-desktop-host .text-link { font-size: 14px; }
  /* shelf */
  :root.pr-desktop-host .shelf-tab { font-size: 14.5px; }
  :root.pr-desktop-host .shelf-count { font-size: 12px; }
  :root.pr-desktop-host .sh-big { font-size: 26px; }
  :root.pr-desktop-host .sh-sub { font-size: 13.5px; }
  :root.pr-desktop-host .sh-export { font-size: 13.5px; }
  :root.pr-desktop-host .sr-name { font-size: 15px; }
  :root.pr-desktop-host .sr-meta { font-size: 13px; }
  :root.pr-desktop-host .sr-now { font-size: 15px; }
  :root.pr-desktop-host .sr-gain { font-size: 13px; }
  :root.pr-desktop-host .sr-qty b { font-size: 14px; }
  :root.pr-desktop-host .sr-paid .cost-input { font-size: 13.5px; width: 60px; }
  :root.pr-desktop-host .shelf-row .thumb { width: 38px; height: 53px; }
  /* header + misc */
  :root.pr-desktop-host .seg { font-size: 14.5px; }
  :root.pr-desktop-host .price-date { font-size: 13.5px; }
  :root.pr-desktop-host #toast { font-size: 14.5px; }
  :root.pr-desktop-host .selbar-btn, :root.pr-desktop-host .sel-count { font-size: 14px; }
}

/* ---------- calm-pass fixes (2026-07-17 evening review; doc in outputs/) ---------- */
@media (min-width: 1240px) and (hover: hover) and (pointer: fine) {
  /* RC1: on desktop, #main is the scroll container — the mobile sticky offset (64px, meant
     for a page scrolling under a fixed header) displaced the search stack 64px DOWN over the
     first rows at rest. Anchor sticky to the container's own top. */
  :root.pr-desktop-host .search-wrap, :root.pr-desktop-host .chip-rows { top: 0; }
  /* RC4: chips wrap — horizontal thumb-scroll strips don't exist on a desktop */
  :root.pr-desktop-host .search-wrap .chip-row { flex-wrap: wrap; overflow-x: visible; }
  /* RC3: desktop-appropriate help — keyboard section + desktop tip; phone-install copy hides */
  :root.pr-desktop-host .install-sec { display: none; }
  :root.pr-desktop-host .tip-mobile { display: none; }
  :root.pr-desktop-host .tip-desktop { display: block; }
  :root.pr-desktop-host .kb-h, :root.pr-desktop-host .kb-rows { display: block; }
  .kb-rows { columns: 2; gap: 18px; font-size: 13.5px; color: var(--ink-soft); margin-bottom: 14px; }
  .kb-rows > div { margin-bottom: 8px; break-inside: avoid; }
  .kb-rows kbd { display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 6px; text-align: center;
    background: var(--paper-2); border: 1px solid var(--line); border-bottom-width: 2.5px;
    font: 700 12px/1.5 ui-monospace, monospace; color: var(--ink); }
}
.tip-desktop, .kb-h, .kb-rows { display: none; }
