/* TCG-Tracker v2 (2026-11-22, after Neon's handover). Plain CSS, no build step.
   60-30-10: 60 % warm charcoal, 30 % cards a step lighter, 10 % red, and the red only for the one main action of a
   screen (and the tab pill). The greys lean towards the red's hue so they belong to it.
   Golden ratio: spacing 3·5·8·13·21·34·55 px, type 13·16·20·26 px. New sizes come from these steps. */
:root {
  --bg: #1a1615; --bg-deep: #120f0e; --side: #161211; --insp: #171312;
  --card: #25201f; --card2: #312b2a; --card3: #3e3736; --card-hover: #2b2524;
  --line: rgba(255, 238, 234, .09); --line-strong: rgba(255, 238, 234, .16);
  --text: #f1eded; --muted: #b2a8a6; --muted-2: #8a7f7d;
  --accent: #d32f2f; /* white on it 5:1 */ --accent-hover: #e23b3b; --accent-tx: #ff8a80;
  --accent-soft: rgba(211, 47, 47, .15); --accent-border: rgba(211, 47, 47, .42);
  --pill-grad: linear-gradient(135deg, #d32f2f 0%, #ad1457 100%);
  /* state badges in OKLCH with equal lightness, so none shouts louder */
  --ok: #43a047; --ok-bg: oklch(.34 .08 145 / .48); --ok-tx: oklch(.84 .12 145);
  --warn: #f9a825; --warn-bg: oklch(.37 .08 82 / .45); --warn-tx: oklch(.88 .12 85);
  --bad: #e53935; --bad-bg: oklch(.34 .09 25 / .48); --bad-tx: oklch(.83 .12 25);
  /* prices in warm gold: they stand out at once without taking the red of the main action */
  --price: oklch(.87 .15 86); --price-bg: oklch(.34 .07 86 / .55);
  --s1: 3px; --s2: 5px; --s3: 8px; --s4: 13px; --s5: 21px; --s6: 34px; --s7: 55px;
  /* type follows the iPhone's text size (Dynamic Type): app.js sets --ts from 1 to 2; the tab bar stays as it is, like on iOS */
  --ts: 1; --t-sm: calc(13px * var(--ts)); --t-md: calc(16px * var(--ts)); --t-lg: calc(20px * var(--ts)); --t-xl: calc(26px * var(--ts));
  --r-card: 21px; --r-row: 16px; --r-btn: 10px; --r-thumb: 10px; --r-pill: 999px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --spring: cubic-bezier(.22, 1.18, .36, 1); --ease: cubic-bezier(.22, 1, .36, 1);
  --hdr: 64px; /* height of the screen header on wide screens (sticky inspector sits below it) */
  --bar-h: 64px; /* height of the tab bar row (compact on an iPhone held sideways) */
  --sar: 0px; /* the iPhone Duo's strip on the right edge, when the tab bar stands in it (html.rail) */
  color-scheme: dark;
}
*, *::before, *::after { box-sizing: border-box; }
/* iOS home-screen apps (status bar black-translucent) shrink the page by the status bar while the content is short */
html { min-height: calc(100% + env(safe-area-inset-top)); }
/* no rubber band on the whole page (iOS honours it only on <html>): it would drag the fixed tab bar along */
html, body { overscroll-behavior-y: none; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: var(--t-md)/1.42 var(--font); -webkit-text-size-adjust: 100%; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration-color: rgba(255, 238, 234, .4); text-underline-offset: 2px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { opacity: .5; cursor: default; }
code { background: var(--card2); padding: 1px 5px; border-radius: 5px; font-size: var(--t-sm); word-break: break-all; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent-tx); outline-offset: 2px; }
h1, h2, h3, .empty-box strong { text-wrap: balance; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; display: inline-block; }
.ico-sm { width: 15px; height: 15px; stroke-width: 2; }
.num, .badge, .chip-count, .kpi-val, .price-now, .price-old, .stV, input[type=number] { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); } .muted-sm { font-size: var(--t-sm); color: var(--muted); } .muted-xs { font-size: calc(12px * var(--ts)); color: var(--muted); }
.mt8 { margin-top: var(--s3); } .mt13 { margin-top: var(--s4); }

/* ---------- buttons, fields, chips, switches ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s3); min-height: 40px; padding: 0 var(--s4); border-radius: var(--r-btn);
  font-size: var(--t-md); font-weight: 600; background: var(--card2); border: 1px solid var(--line); color: var(--text); white-space: nowrap; text-decoration: none;
  transition: background .14s var(--ease), border-color .14s var(--ease), scale .12s ease; }
.btn:hover { background: var(--card3); border-color: var(--line-strong); }
.btn:not(:disabled):active, .chip:not(:disabled):active, .icon-btn:not(:disabled):active, .action-item:active { scale: .97; }
/* THE one red main action of a screen */
.btn-primary { background: var(--accent); border-color: transparent; color: #fff; box-shadow: 0 6px 18px rgba(211, 47, 47, .28); }
.btn-primary:hover { background: var(--accent-hover); border-color: transparent; }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: var(--t-sm); border-radius: 8px; }
.btn-xs { min-height: 28px; padding: 0 9px; font-size: calc(12px * var(--ts)); border-radius: 8px; gap: var(--s2); }
.btn-full { width: 100%; min-height: 46px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--card2); color: var(--text); }
.btn-danger { color: var(--accent-tx); border-color: var(--accent-border); background: var(--bad-bg); }
.btn-danger:hover { background: var(--accent); color: #fff; }
.btn .ico { width: 18px; height: 18px; }
.btn-sm .ico, .btn-xs .ico { width: 15px; height: 15px; }
.icon-btn { position: relative; width: 34px; height: 34px; border-radius: var(--r-btn); display: inline-flex; align-items: center; justify-content: center; color: var(--muted); flex: none; transition: background .14s var(--ease), color .14s var(--ease); }
.icon-btn:hover { background: var(--card2); color: var(--text); }
.icon-btn-card { background: var(--card2); border: 1px solid var(--line); }
.icon-btn::after, .btn-xs::after, .chip::after { content: ""; position: absolute; inset: -5px -3px; } /* bigger touch area, same look */
.btn-xs, .chip { position: relative; }
.link-btn { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; font-size: inherit; padding: 0 2px; }
.link-btn:hover { color: var(--text); }
#toast .link-btn { color: var(--text); font-weight: 600; }

.input { width: 100%; min-height: 44px; padding: 0 var(--s4); border-radius: var(--r-btn); background: var(--card2); border: 1px solid var(--line); color: var(--text); font-size: var(--t-md); min-width: 0; }
.input::placeholder { color: var(--muted-2); }
.input:focus { border-color: var(--accent-tx); background: #352e2d; outline: none; }
.field { display: grid; gap: var(--s2); min-width: 0; }
.field-label { font-size: var(--t-sm); color: var(--muted); font-weight: 500; }

.chip-row { display: flex; gap: var(--s3); overflow-x: auto; min-width: 0; max-width: 100%; padding: 2px 0; scrollbar-width: none; }
.chip-row::-webkit-scrollbar { display: none; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: var(--s3); min-width: 0; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 var(--s4); border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--line);
  color: var(--muted); font-size: var(--t-sm); font-weight: 500; white-space: nowrap; flex: none; transition: background .15s var(--ease), color .15s var(--ease), border-color .15s var(--ease); }
.chip:hover { background: var(--card2); color: var(--text); }
.chip.on { background: var(--card3); border-color: var(--line-strong); color: var(--text); font-weight: 600; }
.chip-count { font-size: calc(11px * var(--ts)); color: var(--muted); }
.chip.on .chip-count { color: var(--text); }
/* the tick comes out of a blur instead of popping in */
.chip .chk { width: 0; height: 14px; margin-right: -6px; opacity: 0; filter: blur(4px); scale: .5; stroke-width: 2.4;
  transition: width .2s ease, margin .2s ease, opacity .2s ease, filter .2s ease, scale .25s cubic-bezier(.3, 1.45, .45, 1); }
.chip.on .chk { width: 14px; margin-right: 0; opacity: 1; filter: none; scale: 1; }

.segmented { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 3px; padding: 3px; border-radius: var(--s4); background: var(--card); border: 1px solid var(--line); min-width: 0; }
.seg-btn { min-height: 34px; padding: 0 6px; border-radius: var(--r-btn); font-size: var(--t-sm); font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; transition: background .16s var(--ease), color .16s var(--ease); }
.seg-btn:hover { color: var(--text); }
.seg-btn.on { background: var(--card3); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .28); }

/* iOS switch: a real button with role="switch", green when on */
.sw { position: relative; flex: none; width: 51px; height: 31px; padding: 0; border-radius: var(--r-pill); background: var(--card3); transition: background .2s ease; }
.sw::before { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0, 0, 0, .3); transition: translate .25s cubic-bezier(.3, 1.3, .5, 1); }
.sw.on { background: var(--ok); }
.sw.on::before { translate: 20px 0; }
.sw::after { content: ""; position: absolute; inset: -7px -4px; }

.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 7px; border-radius: 6px; font-size: calc(11px * var(--ts)); font-weight: 600; letter-spacing: .01em; white-space: nowrap; line-height: 1.35; background: var(--card2); color: var(--muted); }
.b-ok { background: var(--ok-bg); color: var(--ok-tx); } .b-warn { background: var(--warn-bg); color: var(--warn-tx); } .b-bad { background: var(--bad-bg); color: var(--bad-tx); }
.b-accent { background: var(--accent-soft); color: var(--accent-tx); }
.b-gold { background: var(--price-bg); color: var(--price); }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; background: var(--muted-2); }
.dot-ok { background: var(--ok); box-shadow: 0 0 0 3px rgba(67, 160, 71, .22); }
.dot-warn { background: var(--warn); box-shadow: 0 0 0 3px rgba(249, 168, 37, .22); }
.dot-bad { background: var(--bad); box-shadow: 0 0 0 3px rgba(229, 57, 53, .22); }
.dot-pulse { animation: pulseDot 1.8s ease-in-out infinite; }
@keyframes pulseDot { 50% { opacity: .45; transform: scale(.84); } }

/* ---------- sign-in ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; justify-content: center; align-items: center;
  padding: calc(env(safe-area-inset-top) + var(--s6)) max(var(--s4), env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + var(--s6)) max(var(--s4), env(safe-area-inset-left));
  background: radial-gradient(360px 260px at 50% 0%, rgba(211, 47, 47, .14), transparent 72%), var(--bg); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; align-items: stretch; gap: var(--s4); }
.auth-hero { text-align: center; display: grid; justify-items: center; gap: var(--s3); }
.auth-hero img { border-radius: 18px; }
.auth-hero h1 { margin: 0; font-size: var(--t-xl); letter-spacing: -.025em; }
.auth-tagline { margin: 0; font-size: var(--t-sm); color: var(--muted); max-width: 34ch; text-wrap: pretty; }
.auth-proof { list-style: none; margin: 0; padding: var(--s3) var(--s4); border-radius: 14px; background: var(--card); border: 1px solid var(--line); display: grid; gap: var(--s2); font-size: var(--t-sm); }
.auth-proof li { display: flex; align-items: center; gap: var(--s3); color: var(--muted); }
.auth-proof li b { color: var(--text); font-weight: 600; }
.auth-form { display: grid; gap: var(--s3); }
.auth-divider { display: flex; align-items: center; gap: var(--s3); color: var(--muted-2); font-size: calc(12px * var(--ts)); margin: 0; }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.auth-links { text-align: center; display: grid; justify-items: center; gap: var(--s3); font-size: var(--t-sm); color: var(--muted); }
.auth .link-btn { justify-self: start; font-size: var(--t-sm); }
.err { color: var(--accent-tx); min-height: 1.2em; margin: 0; font-size: var(--t-sm); }
.credit { color: var(--muted); font-size: var(--t-sm); text-align: center; margin: var(--s5) 0 var(--s3); line-height: 1.6; display: grid; gap: var(--s2); }
.credit a { color: inherit; }

/* ---------- app shell ---------- */
.screen-header { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between; gap: var(--s3);
  padding: calc(env(safe-area-inset-top) + var(--s4)) max(var(--s4), env(safe-area-inset-right)) var(--s3) max(var(--s4), env(safe-area-inset-left));
  background: var(--bg); border-bottom: 1px solid var(--line); }
.header-left { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.screen-header h1 { margin: 0; font-size: var(--t-xl); font-weight: 700; letter-spacing: -.025em; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.shop-pill { display: inline-flex; align-items: center; gap: 7px; min-height: 32px; padding: 0 11px; border-radius: var(--r-pill); background: var(--card); border: 1px solid var(--line);
  font-size: var(--t-sm); font-weight: 500; white-space: nowrap; flex: none; transition: background .15s var(--ease), border-color .15s var(--ease); }
.shop-pill:hover { background: var(--card2); border-color: var(--line-strong); }
.shop-pill.warn { border-color: rgba(249, 168, 37, .45); }
.offline-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: var(--r-pill); background: var(--bad-bg); color: var(--bad-tx); font-size: calc(12px * var(--ts)); font-weight: 600; white-space: nowrap; }
#view { padding: var(--s4) max(var(--s4), env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + var(--bar-h) + 25px) max(var(--s4), env(safe-area-inset-left)); max-width: 760px; margin: 0 auto; min-width: 0; }
.sidebar, .inspector { display: none; }
/* switching tabs: the page glides in from the side of the tab that was tapped */
#view.enter { animation: viewIn .28s var(--ease); }
@keyframes viewIn { from { opacity: 0; transform: translateX(calc(var(--dir, 0) * 24px)); } }

/* ---------- glass tab bar with a sliding lens ("Sliding Pill"), docked to the bottom edge ---------- */
.tabbar {
  --pad: 4px; --tab-ink: #ede6e5; --tab-on: #ff8a80; --tspring: cubic-bezier(.3, 1.45, .45, 1);
  --pill-a: #d32f2f; --pill-b: #ad1457;
  position: fixed; z-index: 6; left: 0; right: 0; bottom: 0;
  height: calc(var(--bar-h) + env(safe-area-inset-bottom));
  padding: var(--pad) max(var(--pad), env(safe-area-inset-right), calc((100vw - 480px) / 2)) calc(var(--pad) + env(safe-area-inset-bottom)) max(var(--pad), env(safe-area-inset-left), calc((100vw - 480px) / 2));
  display: grid; grid-auto-flow: column; grid-auto-columns: 1fr;
  border-radius: var(--r-card) var(--r-card) 0 0; border: 1px solid rgba(255, 255, 255, .14); border-bottom: 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
  touch-action: none; user-select: none; -webkit-user-select: none;
}
/* The glass sits on a layer inside the bar, not on the bar itself (2026-11-27, scrolling stuttered on the iPhone):
   Safari 26 samples background and blur of fixed elements at the screen edge to tint its own toolbar.
   The bar itself stays clear, so Safari has nothing to sample there; it looks the same. */
.tabbar::before { content: ""; position: absolute; z-index: 0; inset: -1px -1px 0; border-radius: inherit; pointer-events: none;
  background: rgb(49 43 42 / .5); -webkit-backdrop-filter: blur(22px) saturate(190%); backdrop-filter: blur(22px) saturate(190%); }
.tabbar .tab { position: relative; z-index: 2; min-width: 0; padding: 0; border: 0; border-radius: var(--r-pill); background: none;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  font-size: 10px; font-weight: 600; letter-spacing: -.01em; line-height: 1.1; color: var(--tab-ink); transition: color .2s ease, transform .35s var(--tspring); }
.tabbar .tab svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: fill .2s ease; }
.tabbar .tab-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tabbar .tab.on, .tabbar .tab.hot { color: var(--tab-on); }
.tabbar .tab.on svg, .tabbar .tab.hot svg { fill: rgba(255, 138, 128, .3); }
.tabbar:not(.lensing) .tab.on { color: #fff; transition: color .2s ease .1s, transform .35s var(--tspring); }
.tabbar:not(.lensing) .tab.on svg { fill: rgba(255, 255, 255, .25); }
.tabbar.lensing .tab.on:not(.hot) { color: var(--tab-ink); }
.tabbar.lensing .tab.on:not(.hot) svg { fill: none; }
.tabbar.lensing .tab.hot { transform: scale(1.1); }
.tabbar .tab:focus-visible { outline: 2px solid var(--tab-on); outline-offset: -3px; }
.tab-dot { position: absolute; top: 5px; left: calc(50% + 5px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pill); background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; border: 1.5px solid #2a2423; font-variant-numeric: tabular-nums; }
.tabbar:not(.lensing) .tab.on .tab-dot { background: #fff; color: #ad1457; border-color: transparent; }
.lens { position: absolute; z-index: 1; left: 0; top: var(--pad); height: calc(var(--bar-h) - 2 * var(--pad)); width: var(--w, 25%);
  border-radius: var(--r-pill); pointer-events: none; translate: var(--x, 0px) 0; scale: 1;
  background: linear-gradient(90deg, var(--pill-a), var(--pill-b)); background: linear-gradient(90deg in oklch, var(--pill-a), var(--pill-b)); box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  transition: translate .5s var(--tspring), scale .35s var(--tspring), background .25s ease, box-shadow .25s ease; }
.lens::before { content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; opacity: 0;
  background: conic-gradient(from 200deg, #ff6b6b, #ffd36b, #8bff9a, #6bd5ff, #b48bff, #ff6bd0, #ff6b6b);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0); transition: opacity .25s ease; }
.lens::after { content: ""; position: absolute; inset: 0; border-radius: inherit; opacity: 0; background: radial-gradient(120% 70% at 50% 0%, rgba(255, 255, 255, .45), transparent 60%); transition: opacity .25s ease; }
.lens.live { scale: 1.16 1.32; background: rgba(255, 255, 255, .06);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .35), inset 0 -6px 14px rgba(255, 255, 255, .08), 0 8px 24px rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: brightness(1.12) saturate(1.5); backdrop-filter: brightness(1.12) saturate(1.5); }
.lens.live::before { opacity: .75; } .lens.live::after { opacity: .5; }
.lens.drag { transition: translate 0s, scale .35s var(--tspring), background .25s ease, box-shadow .25s ease; }
/* Reel "Tab Bar Part 18" (2026-11-24): the tapped tab sinks in while the finger rests (.press), on release a fine ring
   in the pill colour runs out from the target and fades (.tapring, tabbar in app.js) */
.tabbar .tab.press:not(.on) { background: rgba(0, 0, 0, .2); box-shadow: inset 0 2px 5px rgba(0, 0, 0, .45), inset 0 -1px 1px rgba(255, 255, 255, .1); }
.tabbar.lensing .tab.press { background: none; box-shadow: none; }
.tapring { position: absolute; z-index: 1; font-style: normal; border-radius: 50%; border: 1.5px solid color-mix(in srgb, var(--pill-a) 85%, transparent); pointer-events: none; opacity: 0; animation: tapring .46s cubic-bezier(.2, .7, .3, 1); }
@keyframes tapring { from { opacity: .9; scale: .8; } to { opacity: 0; scale: 1.65; } }
@media (prefers-reduced-motion: reduce) { .tapring { display: none; } }
/* Apple curve on the resting pill: a plain capsule has a kink where the straight edge meets the half circle
   (curvature jumps from 0 to 1/r). Here the bend starts earlier and eases in, as in iOS or Figma "corner smoothing"
   60 %. The gradient moves to ::after and is cut with clip-path: shape() (Safari 18.4+, Chrome 135+); the shadow
   stays on the pill. --r = half the pill height. Older browsers and "Increase Contrast" keep the plain capsule. */
@supports (clip-path: shape(from 0 0, line to 0 0)) {
  @media not (prefers-contrast: more) {
    .lens { --r: calc(var(--bar-h) / 2 - var(--pad)); }
    .lens:not(.live) { background: none; }
    .lens:not(.live)::after { opacity: 1; background: linear-gradient(90deg, var(--pill-a), var(--pill-b)); background: linear-gradient(90deg in oklch, var(--pill-a), var(--pill-b));
      clip-path: shape(from calc(min(var(--r)*1.6,50%)) 0,hline to calc(100% - min(var(--r)*1.6,50%)),curve to calc(100% - var(--r)*0.546) calc(var(--r)*0.109) with calc(100% - min(var(--r)*1.6,50%)*0.4686 - var(--r)*0.2901) 0 / calc(100% - min(var(--r)*1.6,50%)*0.203 - var(--r)*0.4352) 0,arc to 100% 50% of var(--r) cw,arc to calc(100% - var(--r)*0.546) calc(100% - var(--r)*0.109) of var(--r) cw,curve to calc(100% - min(var(--r)*1.6,50%)) 100% with calc(100% - min(var(--r)*1.6,50%)*0.203 - var(--r)*0.4352) 100% / calc(100% - min(var(--r)*1.6,50%)*0.4686 - var(--r)*0.2901) 100%,hline to calc(min(var(--r)*1.6,50%)),curve to calc(var(--r)*0.546) calc(100% - var(--r)*0.109) with calc(min(var(--r)*1.6,50%)*0.4686 + var(--r)*0.2901) 100% / calc(min(var(--r)*1.6,50%)*0.203 + var(--r)*0.4352) 100%,arc to 0 50% of var(--r) cw,arc to calc(var(--r)*0.546) calc(var(--r)*0.109) of var(--r) cw,curve to calc(min(var(--r)*1.6,50%)) 0 with calc(min(var(--r)*1.6,50%)*0.203 + var(--r)*0.4352) 0 / calc(min(var(--r)*1.6,50%)*0.4686 + var(--r)*0.2901) 0,close); }
  }
}

/* ---------- desktop command center (from 960 px): sidebar, list, inspector ---------- */
.brand { display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s2); }
.brand img { border-radius: 11px; }
.brand-title { font-weight: 700; letter-spacing: -.02em; line-height: 1.15; }
.brand-role { font-size: 12px; color: var(--muted); }
.side-nav { display: flex; flex-direction: column; gap: var(--s2); }
.side-btn { position: relative; display: flex; align-items: center; gap: var(--s4); padding: 11px var(--s4); border-radius: var(--s4); font-size: 15px; font-weight: 500; color: var(--muted); text-align: left; transition: background .16s var(--ease), color .16s var(--ease); }
.side-btn:hover { background: var(--card); color: var(--text); }
.side-btn.on { background: var(--pill-grad); color: #fff; font-weight: 600; box-shadow: 0 6px 20px rgba(211, 47, 47, .25); }
.side-badge, .side-kbd { margin-left: auto; font-size: 11px; font-variant-numeric: tabular-nums; }
.side-badge { min-width: 22px; height: 20px; padding: 0 6px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .14); color: var(--text); font-weight: 600; display: inline-flex; align-items: center; justify-content: center; }
.side-btn.on .side-badge { background: rgba(0, 0, 0, .25); color: #fff; }
.side-kbd { color: var(--muted-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.side-btn.on .side-kbd { display: none; }
.side-health { margin-top: auto; padding: var(--s4); border-radius: var(--r-row); background: var(--card); border: 1px solid var(--line); text-align: left; display: grid; gap: var(--s2); transition: border-color .15s var(--ease), background .15s var(--ease); }
.side-health:hover { background: var(--card2); border-color: var(--line-strong); }
.side-health-top { display: flex; align-items: center; gap: var(--s3); font-size: var(--t-sm); font-weight: 600; }
.side-health-sub { font-size: 12px; color: var(--muted); }
.side-foot { font-size: 12px; color: var(--muted-2); padding: 0 var(--s2); display: grid; gap: var(--s2); }
.side-foot a { color: var(--muted); }

@media (min-width: 960px) {
  .shell { display: grid; grid-template-columns: 244px minmax(0, 1fr); min-height: 100vh; }
  .sidebar { display: flex; flex-direction: column; gap: var(--s5); position: sticky; top: 0; height: 100vh; overflow-y: auto; padding: var(--s5) var(--s4); background: var(--side); border-right: 1px solid var(--line); }
  .tabbar { display: none; }
  .screen-header { height: var(--hdr); padding: 0 var(--s5); }
  #view { padding: var(--s5) var(--s5) var(--s6); max-width: 820px; }
  .split { display: grid; grid-template-columns: minmax(0, 1fr); }
  body.insp .split { grid-template-columns: minmax(0, 1fr) 390px; }
  body.insp #view { max-width: none; margin: 0; width: 100%; }
  body.insp .inspector { display: block; position: sticky; top: var(--hdr); height: calc(100vh - var(--hdr)); overflow-y: auto; padding: var(--s5); background: var(--insp); border-left: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: var(--card3) transparent; }
  .toast { left: auto; right: var(--s5); bottom: var(--s5); margin: 0; width: 380px; }
}

/* ---------- cards & lists ---------- */
.card-box { padding: var(--s4); border-radius: var(--r-card); background: var(--card); border: 1px solid var(--line); display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); min-width: 0; }
.card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s3); }
.card-title { margin: 0; font-size: calc(17px * var(--ts)); font-weight: 700; }
.card-desc { margin: 0; font-size: var(--t-sm); color: var(--muted); line-height: 1.45; text-wrap: pretty; }
.stack-sm { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s3); min-width: 0; }
.stack-md { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s4); min-width: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); min-width: 0; }
.row-gap { display: flex; align-items: center; gap: var(--s3); min-width: 0; flex-wrap: wrap; }
.section-label { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin: var(--s5) 0 var(--s3); font-size: calc(12px * var(--ts)); font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.section-label:first-child { margin-top: var(--s2); }
.list { display: flex; flex-direction: column; gap: var(--s3); }
.empty-box { text-align: center; padding: var(--s6) var(--s4); border-radius: var(--r-card); background: var(--card); border: 1px dashed var(--line-strong); display: grid; justify-items: center; gap: var(--s3); color: var(--muted); }
.empty-box strong { color: var(--text); }
.empty-box .ico { width: 26px; height: 26px; }
.end { color: var(--muted); text-align: center; font-size: var(--t-sm); margin: var(--s4) 0 var(--s2); }
.list-more { width: 100%; margin: var(--s4) 0; }

/* ---------- banner strip (push setup, paused) aligned with the list ---------- */
.banner-strip { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s3) var(--s3) var(--s3) var(--s4); margin-bottom: var(--s4); border-radius: var(--r-row); background: var(--card); border: 1px solid var(--line-strong); }
.banner-strip.paused { border-color: rgba(249, 168, 37, .4); background: linear-gradient(90deg, rgba(249, 168, 37, .08), var(--card)); }
.banner-info { display: flex; align-items: center; gap: var(--s3); min-width: 0; }
.banner-ico { width: 34px; height: 34px; border-radius: var(--r-btn); background: var(--accent-soft); color: var(--accent-tx); display: grid; place-items: center; flex: none; }
.banner-strip.paused .banner-ico { background: var(--warn-bg); color: var(--warn-tx); }
.banner-copy { min-width: 0; }
.banner-title { font-size: var(--t-sm); font-weight: 600; line-height: 1.25; }
.banner-sub { font-size: calc(12px * var(--ts)); color: var(--muted); display: flex; align-items: center; gap: 6px; margin-top: 2px; }
.step-dots { display: inline-flex; gap: 3px; flex: none; }
.step-dots span { width: 14px; height: 4px; border-radius: 99px; background: var(--card3); }
.step-dots span.done { background: var(--ok); } .step-dots span.now { background: var(--accent-tx); }
.banner-strip .btn { flex: none; }

/* push guide (3 steps on the iPhone) */
.guide { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--s3); counter-reset: st; }
.guide li { counter-increment: st; display: flex; gap: var(--s4); align-items: flex-start; padding: var(--s4); border-radius: var(--r-row); background: var(--card2); border: 1px solid var(--line); color: var(--muted); }
.guide li::before { content: counter(st); flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; font-size: var(--t-sm); font-weight: 700; border: 1px solid var(--line-strong); }
.guide li b { display: block; color: var(--text); margin-bottom: 2px; }
.guide li.done::before { content: "✓"; background: var(--ok-bg); color: var(--ok-tx); border-color: transparent; }
.guide li.now { border-color: var(--line-strong); color: var(--text); }
.guide li.now::before { background: var(--text); color: var(--bg); border-color: var(--text); }
.guide .ico { width: 16px; height: 16px; vertical-align: -3px; }

/* ---------- feed ---------- */
.feed-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); min-width: 0; }
.feed-toolbar .chip-row { flex: 1 1 auto; min-width: 0; padding-right: var(--s3);
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent 100%); mask-image: linear-gradient(to right, #000 calc(100% - 16px), transparent 100%); }
.feed-toolbar #markRead { flex: none; }

/* thumbnails: shop photo on a calm white tile, or a drawn sealed box when there is none */
.thumb { position: relative; width: 55px; height: 55px; border-radius: var(--r-thumb); flex: none; overflow: hidden; background: #fff; padding: 3px; isolation: isolate; }
.thumb img { display: block; width: 100%; height: 100%; object-fit: contain; }
.thumb img:not(.in) { opacity: 0; } .thumb img.in { animation: imgIn .35s ease; }
.thumb.art, .thumb:has(img.broken) { background: linear-gradient(145deg, #512536, #26161d); border: 1px solid rgba(255, 255, 255, .14); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22); padding: 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.thumb:has(img.broken) img { display: none; }
.thumb.op { background: linear-gradient(145deg, #6e241d, #2a1312); } .thumb.etb { background: linear-gradient(145deg, #2d345c, #181a2c); } .thumb.jp { background: linear-gradient(145deg, #5e3824, #281915); }
.thumb .art-box { width: 30px; height: 24px; border-radius: 4px; border: 1.5px solid rgba(255, 255, 255, .55); background: rgba(255, 255, 255, .12); position: relative; }
.thumb .art-box::after { content: ""; position: absolute; top: 4px; left: 3px; right: 3px; height: 2px; background: rgba(255, 255, 255, .45); border-radius: 2px; }
.thumb .art-tag { margin-top: 4px; font-size: 8.5px; font-weight: 800; letter-spacing: .04em; color: #fff; text-transform: uppercase; white-space: nowrap; opacity: .94; }
.thumb:not(.art):not(:has(img.broken)) .art-box, .thumb:not(.art):not(:has(img.broken)) .art-tag { display: none; }
.thumb-lg { width: 78px; height: 78px; border-radius: 14px; }
@keyframes imgIn { from { opacity: 0; } }

.swipe { position: relative; border-radius: var(--r-row); overflow: hidden; touch-action: pan-y; transition: height .25s ease, opacity .25s ease, margin .25s ease; }
.swipe-bg { position: absolute; inset: 0; display: none; align-items: center; gap: var(--s2); padding: 0 var(--s5); font-size: var(--t-sm); font-weight: 700; color: #fff; border-radius: var(--r-row); }
.swipe-bg .ico { width: 16px; height: 16px; }
.swipe-bg.pin { background: #4a4240; justify-content: flex-start; } /* neutral: only throwing away is red */
.swipe-bg.hide { background: #6b1d1d; justify-content: flex-end; }
.swipe.right .swipe-bg.pin, .swipe.left .swipe-bg.hide { display: flex; }
.swipe.armed .swipe-bg.pin { background: #5e5553; } .swipe.armed .swipe-bg.hide { background: var(--accent); }
.swipe.gone { height: 0 !important; opacity: 0; margin-top: calc(-1 * var(--s3)); }
.swipe > .alert-card { transition: transform .25s ease, background .14s var(--ease), border-color .14s var(--ease); }
.swipe.moving > .alert-card { transition: none; }

.alert-card { position: relative; z-index: 1; display: flex; align-items: center; gap: var(--s4); padding: 11px var(--s4); border-radius: var(--r-row); background: var(--card); border: 1px solid var(--line); cursor: pointer; }
.alert-card:hover { background: var(--card-hover); border-color: var(--line-strong); }
.alert-card.sel { background: #2e2726; border-color: var(--accent-tx); }
.alert-card.unread::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.alert-card.flash { animation: flash 1.6s; }
@keyframes flash { from { background: var(--card3); } }
.alert-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.alert-meta { display: flex; align-items: center; gap: 6px; font-size: calc(12px * var(--ts)); color: var(--muted); min-width: 0; }
.alert-meta .ico { width: 13px; height: 13px; }
.alert-meta-tag { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.alert-time { margin-left: auto; white-space: nowrap; color: var(--muted-2); padding-left: var(--s2); }
.alert-title { font-size: calc(14.5px * var(--ts)); font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.alert-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); margin-top: 2px; min-width: 0; }
.price-cluster { display: flex; align-items: center; gap: 6px; min-width: 0; flex-wrap: nowrap; overflow: hidden; }
.price-now { font-size: calc(15px * var(--ts)); font-weight: 700; color: var(--price); white-space: nowrap; }
.price-old { font-size: calc(12px * var(--ts)); color: var(--muted-2); text-decoration: line-through; white-space: nowrap; }
.shop-inline { font-size: calc(12px * var(--ts)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.alert-actions { display: flex; align-items: center; gap: 2px; flex: none; }
.hover-ops { display: none; align-items: center; gap: 2px; }
@media (hover: hover) and (pointer: fine) {
  .alert-card:hover .hover-ops, .alert-card:focus-within .hover-ops { display: inline-flex; }
}
.note-body { font-size: var(--t-sm); color: var(--muted); white-space: pre-wrap; overflow-wrap: anywhere; text-wrap: pretty; }
.note-body b { color: var(--text); }
/* the bot's prices inside a message: the price to pay in gold, an old price before → struck */
.price { color: var(--price); background: var(--price-bg); font-weight: 700; padding: 0 var(--s2); border-radius: var(--s2); white-space: nowrap; font-variant-numeric: tabular-nums; }
s.price-was { color: var(--muted); white-space: nowrap; }

/* auto-buy mission card: the one thing to act on */
.ab-card { position: relative; display: flex; flex-direction: column; gap: var(--s3); padding: var(--s4); border-radius: 18px; cursor: pointer;
  background: radial-gradient(280px 120px at 0% 0%, rgba(211, 47, 47, .16), transparent 70%), var(--card); border: 1px solid var(--accent-border); box-shadow: 0 10px 28px rgba(0, 0, 0, .34); }
.ab-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); }
.ab-status { display: inline-flex; align-items: center; gap: 6px; font-size: calc(11px * var(--ts)); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent-tx); }
.ab-main { display: flex; align-items: center; gap: var(--s4); min-width: 0; }
.ab-foot { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; }
.ab-foot .btn-primary, .ab-foot .btn-main { flex: 1 1 140px; }
details.more > summary { cursor: pointer; font-size: calc(12px * var(--ts)); color: var(--muted); list-style: none; display: inline-flex; align-items: center; gap: 4px; min-height: 28px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::before { content: "▸"; transition: transform .2s ease; }
details.more[open] > summary::before { transform: rotate(90deg); }

/* ---------- products ---------- */
.search-bar { display: flex; align-items: center; gap: var(--s3); margin-bottom: var(--s3); min-width: 0; }
.search-field { position: relative; flex: 1 1 auto; min-width: 0; }
.search-field > .ico { position: absolute; left: 13px; top: 50%; translate: 0 -50%; color: var(--muted-2); pointer-events: none; width: 16px; height: 16px; }
.search-input { padding-left: 38px; padding-right: 38px; }
.search-input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; right: 5px; top: 50%; translate: 0 -50%; }
.filter-btn.on { border-color: var(--line-strong); background: var(--card3); }
.recent { margin-bottom: var(--s3); }
.recent .chip { color: var(--muted); }
.count { margin: var(--s3) 0; font-size: var(--t-sm); color: var(--muted); }
.count.wait { opacity: .5; transition: opacity .2s ease .15s; }
.product-list { display: flex; flex-direction: column; gap: var(--s3); }
@media (min-width: 1280px) { body.insp .product-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); } }
.prod-card { display: flex; gap: var(--s4); padding: var(--s4); border-radius: 18px; background: var(--card); border: 1px solid var(--line); cursor: pointer; text-align: left; min-width: 0; transition: background .14s var(--ease), border-color .14s var(--ease); }
.prod-card:hover { background: var(--card-hover); border-color: var(--line-strong); }
.prod-card.sel { border-color: var(--accent-tx); background: #2e2726; }
.prod-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 5px; }
.prod-title { font-size: calc(14.5px * var(--ts)); font-weight: 600; line-height: 1.25; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.prod-price-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; }
.prod-price-row > * { flex: none; }
.uvp-meta { font-size: calc(12px * var(--ts)); color: var(--muted); white-space: nowrap; }
.prod-meta-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); font-size: calc(12px * var(--ts)); color: var(--muted); min-width: 0; }
.prod-meta-row > span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* ---------- inspector (desktop pane, detail sheet on phones) ---------- */
.insp-head { display: flex; gap: var(--s4); align-items: flex-start; }
.insp-title { margin: var(--s2) 0 0; font-size: calc(17px * var(--ts)); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.kpi-grid { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: var(--s2); min-width: 0; }
.kpi-box { padding: 9px; border-radius: var(--s4); background: var(--card); border: 1px solid var(--line); display: grid; gap: 2px; min-width: 0; }
.sheet .kpi-box { background: var(--card2); }
.kpi-lbl { font-size: calc(11px * var(--ts)); color: var(--muted); }
.kpi-val { font-size: calc(15px * var(--ts)); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-val.gold { color: var(--price); }
.kpi-sub { font-size: calc(11px * var(--ts)); color: var(--muted); }
.insp-actions { display: grid; gap: var(--s3); }
.insp-actions .row-gap > .btn { flex: 1 1 0; }
.insp-empty { color: var(--muted); text-align: center; padding: var(--s7) var(--s4); display: grid; gap: var(--s3); justify-items: center; font-size: var(--t-sm); }
.insp-empty .ico { width: 28px; height: 28px; }
.insp-wrap { display: grid; gap: var(--s4); }

/* ---------- auto-buy cockpit ---------- */
.progress { height: 6px; border-radius: var(--r-pill); background: var(--card2); overflow: hidden; display: block; width: 100%; border: 0; appearance: none; -webkit-appearance: none; }
.progress::-webkit-progress-bar { background: var(--card2); border-radius: 99px; }
.progress::-webkit-progress-value { background: var(--ok); border-radius: 99px; }
.progress::-moz-progress-bar { background: #43a047; border-radius: 99px; }
.url-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.url-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 4px 10px; border-radius: var(--r-pill); background: var(--card2); border: 1px solid var(--line); font-size: calc(12px * var(--ts)); text-decoration: none; }
.url-pill span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.add-url { display: flex; gap: var(--s3); min-width: 0; }
.add-url .input { flex: 1; min-height: 38px; font-size: var(--t-sm); }
.add-url .btn { flex: none; min-height: 38px; }
.offer-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px var(--s4); border-radius: var(--s4); background: var(--card); border: 1px solid var(--line); font-size: var(--t-sm); min-width: 0; }
.offer-row > div { min-width: 0; }
.offer-row strong { overflow-wrap: anywhere; }
.sticky-top { position: sticky; top: var(--hdr-now, calc(env(safe-area-inset-top) + 66px)); z-index: 2; }
@media (min-width: 960px) { .sticky-top { top: calc(var(--hdr) + var(--s3)); } }
@media (max-height: 700px) { .sticky-top { position: static; } }

/* ---------- shop monitor ---------- */
.shop-row { display: flex; align-items: center; gap: var(--s3); padding: 11px var(--s4); border-radius: 15px; background: var(--card2); border: 1px solid var(--line); min-width: 0; }
.shop-row.error { border-color: rgba(249, 168, 37, .45); }
.shop-row.blocked { border-color: rgba(229, 57, 53, .45); }
.shop-row-main { flex: 1; min-width: 0; display: grid; gap: 2px; }
.shop-row-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: calc(15px * var(--ts)); font-weight: 600; }
.shop-row-meta { font-size: calc(12px * var(--ts)); color: var(--muted); }
.shop-row-err { font-size: calc(12px * var(--ts)); color: var(--warn-tx); }
.shop-row.blocked .shop-row-err { color: var(--bad-tx); }

/* ---------- settings in iOS style: a short list, every topic opens as a page of its own ---------- */
.st { display: grid; gap: var(--s5); }
@media (min-width: 760px) { .st { max-width: 610px; margin: 0 auto; } }
.stGroup { display: grid; gap: var(--s3); }
.stGroup > h2 { margin: 0 var(--s4); font-size: var(--t-sm); font-weight: 600; color: var(--muted); }
.stNote { margin: 0 var(--s4); color: var(--muted); font-size: var(--t-sm); text-wrap: pretty; }
.stList { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.stHead, .stRow { display: flex; align-items: center; gap: var(--s4); width: 100%; text-align: left; color: var(--text); font: inherit; background: none; border: 0; border-radius: 0; text-decoration: none; }
.stRow { position: relative; min-height: 55px; padding: var(--s3) var(--s4); cursor: pointer; }
div.stRow { cursor: default; }
.stRow + .stRow::before { content: ""; position: absolute; top: 0; left: 60px; right: 0; border-top: 1px solid var(--line); }
button.stRow:hover, a.stRow:hover { background: rgba(255, 255, 255, .03); }
button.stRow:active, a.stRow:active, .stHead:active { background: var(--card2); }
.stHead { padding: var(--s4); background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); cursor: pointer; }
.stIc { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; flex: none; background: var(--card2); color: var(--text); }
.stT { flex: 1; min-width: 0; display: grid; gap: 1px; }
.stT b { font-weight: 600; line-height: 1.3; }
.stT small { color: var(--muted); font-size: var(--t-sm); line-height: 1.35; overflow-wrap: anywhere; }
.stV { color: var(--muted); white-space: nowrap; }
.stCh { display: grid; color: var(--muted); } .stCh .ico { width: 16px; height: 16px; }
.stRow.danger, .stRow.danger .stIc { color: var(--accent-tx); }
.avatar { width: 55px; height: 55px; border-radius: 50%; display: grid; place-items: center; flex: none; background: var(--card3); border: 1px solid var(--line-strong); font-size: var(--t-xl); font-weight: 600; }
.stHead .stT b { font-size: var(--t-lg); }
.who { display: flex; gap: var(--s4); align-items: center; }
.who .avatar { width: 42px; height: 42px; font-size: var(--t-lg); }
.stBack { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: calc(-1 * var(--s3)) 0 var(--s3) calc(-1 * var(--s3)); padding: 0 var(--s3); border-radius: 9px; color: var(--text); font-weight: 600; }
.stBack:hover { background: var(--card2); }
.stBack .ico { width: 22px; height: 22px; }
#view.stSub { touch-action: pan-y; min-height: calc(100dvh - var(--hdr)); }
.urow { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s4); align-items: center; padding: var(--s3) 0; border-top: 1px solid var(--line); }
.urow:first-child { border-top: 0; }
.urow .grow { flex: 1; min-width: 0; }
.urow .meta, .meta { color: var(--muted); font-size: var(--t-sm); }
.btns { display: flex; flex-wrap: wrap; gap: var(--s3); }
.form { display: flex; flex-wrap: wrap; gap: var(--s3); align-items: center; }
.form.stack > * { flex: 1 1 100%; }
.check { display: flex; gap: var(--s3); align-items: flex-start; font-size: var(--t-sm); color: var(--muted); text-align: left; }
.check input { width: 22px; height: 22px; margin: 0; flex: none; accent-color: var(--accent); }
.okmsg { color: var(--ok-tx); font-size: var(--t-sm); margin: var(--s3) 0 0; }
.news { display: grid; gap: var(--s3); }
.news section { padding: var(--s4); border-radius: var(--r-row); background: var(--card); border: 1px solid var(--line); }
.sheet .news section { background: var(--card2); }
.news h3 { margin: 0 0 var(--s2); font-size: var(--t-md); }
.news ul { margin: 0; padding-left: var(--s5); display: grid; gap: var(--s3); }
.news li { text-wrap: pretty; }
.invite-box { padding: var(--s4); border-radius: var(--r-row); background: var(--card2); border: 1px dashed var(--accent-border); display: grid; gap: var(--s3); }
.invite-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: var(--t-lg); font-weight: 700; letter-spacing: .08em; overflow-wrap: anywhere; }
.pw-box code { font-size: var(--t-md); }

/* ---------- sheet: a window from below (centred dialog on wide screens) ---------- */
.sheet-host { position: fixed; inset: 0; z-index: 20; display: flex; justify-content: center; align-items: flex-end; background: rgba(10, 8, 8, .62); }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 86%; min-height: 0; display: flex; flex-direction: column; overflow: hidden;
  background: #231e1d; border: 1px solid var(--line-strong); border-bottom: 0; border-radius: var(--t-xl) var(--t-xl) 0 0; box-shadow: 0 -16px 60px rgba(0, 0, 0, .65); touch-action: pan-y; }
.sheet-grab { flex: none; padding: 10px 0 4px; display: flex; justify-content: center; cursor: grab; touch-action: none; }
.sheet-grab span { width: 38px; height: 4px; border-radius: 99px; background: rgba(255, 238, 234, .25); }
.sheet-head { flex: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: var(--s2) var(--s4) var(--s3) var(--s5); border-bottom: 1px solid var(--line); touch-action: none; }
.sheet-title { margin: 0; font-size: var(--t-lg); font-weight: 700; letter-spacing: -.015em; min-width: 0; overflow-wrap: anywhere; }
.sheet-body { flex: 1 1 auto; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; padding: var(--s4) var(--s4) var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.sheet-body > * { flex: none; }
.sheet-foot { flex: none; display: flex; gap: var(--s3); padding: var(--s3) var(--s4) calc(env(safe-area-inset-bottom) + var(--s4)); border-top: 1px solid var(--line); }
.sheet-foot .btn { flex: 1; }
.sheet:not(:has(.sheet-foot)) .sheet-body { padding-bottom: calc(env(safe-area-inset-bottom) + var(--s5)); }
.sheet.moving { transition: none; }
.sheet-host.in { animation: fadeIn .18s ease; } .sheet-host.in .sheet { animation: sheetUp .3s var(--ease); }
@keyframes fadeIn { from { background: rgba(10, 8, 8, 0); } }
@keyframes sheetUp { from { transform: translateY(100%); } }
/* origin (app.js): a sheet that grows out of the tapped card does not slide up as well; while the copy of a closing
   sheet shrinks back into its card, .sheet-dim fades the backdrop out */
.sheet-host.grow.in .sheet { animation: none; }
.sheet-dim { position: fixed; inset: 0; z-index: 20; background: rgba(10, 8, 8, .62); pointer-events: none; }
@media (min-width: 960px) {
  .sheet-host { align-items: center; padding: var(--s5); }
  .sheet { border-radius: 24px; border-bottom: 1px solid var(--line-strong); max-height: 84vh; box-shadow: 0 28px 80px rgba(0, 0, 0, .72); }
  .sheet-host.in .sheet { animation: modalIn .22s var(--spring); }
  .sheet-grab { display: none; }
  .sheet-head { padding-top: var(--s4); }
}
@keyframes modalIn { from { opacity: 0; transform: scale(.96) translateY(10px); } }
.action-list { display: grid; gap: 6px; }
.action-item { width: 100%; display: flex; align-items: center; gap: var(--s4); padding: var(--s4); border-radius: var(--s4); background: var(--card2); font-size: calc(15px * var(--ts)); font-weight: 500; text-align: left; text-decoration: none; color: var(--text); transition: background .14s; }
.action-item:hover { background: var(--card3); }
.action-item.danger { color: var(--accent-tx); }

/* ---------- toast: closes by itself, with its X, or with a swipe ---------- */
.toast { position: fixed; left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); bottom: calc(env(safe-area-inset-bottom) + var(--bar-h) + 13px); z-index: 30;
  display: flex; align-items: center; gap: var(--s3); max-width: 480px; margin: 0 auto; padding: 11px 6px 11px 15px; border-radius: 14px; background: #332c2b; border: 1px solid var(--line-strong);
  box-shadow: 0 12px 34px rgba(0, 0, 0, .55); font-size: var(--t-sm); touch-action: none; transition: transform .25s cubic-bezier(.2, .8, .2, 1), opacity .25s ease; }
.toast.in { animation: toastIn .3s var(--spring); }
.toast.moving { transition: none; }
@keyframes toastIn { from { transform: translateY(14px) scale(.96); opacity: 0; } }
.toast-body { flex: 1; min-width: 0; }
.toast-x { flex: none; }

/* ---------- skeleton while the first answer is on its way ---------- */
.sk { background: linear-gradient(90deg, var(--card2) 30%, var(--card3) 50%, var(--card2) 70%) 0 0 / 300% 100%; border-radius: 6px; animation: shimmer 1.4s linear infinite; }
.sk-card { display: flex; gap: var(--s4); padding: 11px var(--s4); border-radius: var(--r-row); background: var(--card); margin-bottom: var(--s3); }
.sk-thumb { width: 55px; height: 55px; border-radius: var(--r-thumb); flex: none; }
.sk-lines { flex: 1; }
.sk-line { height: 11px; margin: 5px 0 9px; }
.w40 { width: 40%; } .w45 { width: 45%; } .w50 { width: 50%; } .w60 { width: 60%; } .w70 { width: 70%; } .w75 { width: 75%; } .w90 { width: 90%; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* continuous ("squircle") corners where the browser can draw them */
@supports (corner-shape: squircle) {
  .card-box, .alert-card, .swipe, .swipe-bg, .ab-card, .prod-card, .stList, .stHead, .sheet, .toast, .banner-strip { corner-shape: squircle; }
}

/* ---------- accessibility: the system decides ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .lens.live { scale: 1; }
}
/* "Reduce Transparency": solid bar, no frosted glass (there is no switch in the app) */
@media (prefers-reduced-transparency: reduce) {
  .tabbar::before { background: #25201f; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .lens.live { background: rgba(255, 255, 255, .14); -webkit-backdrop-filter: none; backdrop-filter: none; }
}
@media (prefers-contrast: more) {
  :root { --line: rgba(255, 238, 234, .28); --line-strong: rgba(255, 238, 234, .4); --muted: #d6cecc; }
  .tabbar { border-color: rgba(255, 255, 255, .45); }
  .tabbar::before { background: rgb(49 43 42 / .94); }
  .lens, .lens.live { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .6); }
  .lens.live::before { opacity: 0; }
}

/* ---------- Rechtliches (/rechtliches): one page, anchors #impressum, #datenschutz, #nutzung ---------- */
body.legal { overflow-wrap: anywhere; }
.legal main { margin: 0 auto; padding: calc(env(safe-area-inset-top) + var(--s4)) max(var(--s4), env(safe-area-inset-right)) calc(env(safe-area-inset-bottom) + var(--s6)) max(var(--s4), env(safe-area-inset-left)); max-width: 720px; }
.legal .back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; font-weight: 600; text-decoration: none; }
.legal .back .ico { width: 22px; height: 22px; }
.legal h1 { font-size: calc(33px * var(--ts)); line-height: 1.15; letter-spacing: -.02em; margin: var(--s3) 0; }
.legal h2 { font-size: var(--t-xl); line-height: 1.2; margin: 0 0 var(--s4); }
.legal h3 { font-size: var(--t-md); margin: var(--s5) 0 var(--s2); }
.legal p, .legal ul { margin: 0 0 var(--s4); }
.legal .lead, .legal .stand { color: var(--muted); }
.legal .stand { font-size: var(--t-sm); }
.legal nav ul { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: var(--s3); }
.legal nav a { display: inline-flex; align-items: center; min-height: 44px; padding: 0 var(--s5); border-radius: 22px; background: var(--card); border: 1px solid var(--line); text-decoration: none; }
.legal section { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card); padding: var(--s5); margin-top: var(--s5); scroll-margin-top: var(--s4); }
.legal address { font-style: normal; }
.legal table { border-collapse: collapse; width: 100%; font-size: var(--t-sm); margin-bottom: var(--s4); }
.legal th, .legal td { text-align: left; vertical-align: top; padding: var(--s3) var(--s3) var(--s3) 0; border-top: 1px solid var(--line); }
.legal th { font-weight: 600; width: 61.8%; }
.legal .credit { display: block; }

/* ---------- iPhone Duo and the iPhone in every pose (Apple HIG "Designing for iPhone Duo", "Designing for iOS") ----------
   No layout per pose: the compact layout (outer display, iPhone) and the regular one (inner display, iPad) grow from the same parts.
   - html.rail (app.js): the system keeps a strip free on the right edge only (iPhone Duo closed, and open in landscape).
     As in Apple's apps the tab bar stands in that strip as an upright capsule at thumb height, Back on top of it.
     Content stays left of the strip, backgrounds run underneath. ?duo simulates the strip.
   - Big display from 760 × 500 without the sidebar (iPhone Duo opened up sideways, iPad): one level more on screen. List
     and details side by side, settings as list and page (38.2 : 61.8), the auto-buy switch beside its goals. Opened up
     upright (669 px) the phone layout stays, as two columns of cards would get too narrow. From 960 px: the computer.
   - Half folded (viewport segments): every column in one half, nothing lies on the fold; sheets and notes move into one half.
   - iPhone held sideways: compact tab bar (icon beside the label), so the cards keep their height. */
:root { --below: calc(var(--bar-h) + env(safe-area-inset-bottom, 0px)); } /* what the tab bar covers at the bottom */
html.rail { --sar: env(safe-area-inset-right, 0px); --rail-w: min(76px, calc(var(--sar) - 8px)); --railtop: calc(env(safe-area-inset-top, 0px) + 112px); --below: 0px; }
html.rail.duotest { --sar: 84px; }
html.rail .screen-header { padding-right: calc(var(--sar) + var(--s4)); }
html.rail .split { padding-right: var(--sar); }
html.rail #view { padding-right: var(--s4); padding-bottom: calc(env(safe-area-inset-bottom, 0px) + var(--s6)); }
html.rail .toast { right: calc(var(--sar) + 16px); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--s4)); }
html.rail .sheet-host { padding-right: var(--sar); }
/* the bar: a glass capsule standing in the strip; the open tab's pill slides up and down */
html.rail .tabbar {
  left: auto; top: auto; right: calc((var(--sar) - var(--rail-w)) / 2); bottom: calc(env(safe-area-inset-bottom, 0px) + var(--s4));
  width: var(--rail-w); height: auto; max-height: calc(100dvh - var(--railtop) - 56px - env(safe-area-inset-bottom, 0px) - var(--s4));
  padding: var(--pad); display: flex; flex-direction: column;
  border-radius: calc(var(--rail-w) / 2); border-bottom: 1px solid rgba(255, 255, 255, .14);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35), inset 0 1px 0 rgba(255, 255, 255, .08);
}
html.rail .tabbar .tab { flex: 1 1 60px; min-height: 44px; max-height: 60px; letter-spacing: -.03em; }
html.rail .lens { top: 0; left: var(--pad); right: var(--pad); width: auto; height: var(--w, 56px); translate: 0 var(--x, 0px);
  background: linear-gradient(180deg, var(--pill-a), var(--pill-b)); background: linear-gradient(180deg in oklch, var(--pill-a), var(--pill-b)); }
html.rail .lens.live { scale: 1.12 1.1; }
/* Back on top of the strip, where Apple puts it (the page's own button would sit far left, away from the thumb) */
.railBack { display: none; }
html.rail .railBack:not([hidden]) {
  display: grid; place-items: center; position: fixed; z-index: 7; top: var(--railtop); right: calc((var(--sar) - 52px) / 2);
  width: 52px; height: 52px; padding: 0; border-radius: 50%; color: var(--text);
  background: rgb(49 43 42 / .6); border: 1px solid rgba(255, 255, 255, .14); box-shadow: 0 4px 14px rgba(0, 0, 0, .3);
  -webkit-backdrop-filter: blur(22px) saturate(190%); backdrop-filter: blur(22px) saturate(190%);
}
html.rail .railBack .ico { width: 24px; height: 24px; }
html.rail .railBack::after { content: ""; position: absolute; inset: -6px; }
html.rail #view .stBack { display: none; }
@media (prefers-reduced-transparency: reduce) { html.rail .railBack:not([hidden]) { background: var(--card2); -webkit-backdrop-filter: none; backdrop-filter: none; } }

/* the page title inside a settings page, only when list and page stand side by side */
.stPageT { display: none; margin: 0 0 var(--s4); font-size: var(--t-lg); line-height: 1.25; letter-spacing: -.015em; }
.stPageT:focus { outline: none; }

/* iPhone held sideways: little height, so the bar gets compact like iOS's (icon beside the label) */
@media (orientation: landscape) and (max-height: 500px) {
  :root { --bar-h: 44px; }
  html:not(.rail) .tabbar .tab { flex-direction: row; gap: var(--s2); font-size: 12px; }
  html:not(.rail) .tabbar .tab svg { width: 20px; height: 20px; }
  html:not(.rail) .tab-dot { position: static; margin-left: 2px; }
}

/* big display without the sidebar: one level more, never one long stretched column */
@media (min-width: 760px) and (min-height: 500px) and (max-width: 959.98px) {
  body.insp #view { max-width: none; margin: 0; width: 100%; }
  body.insp .split { display: grid; grid-template-columns: minmax(0, 1fr) clamp(300px, 42%, 390px); }
  body.insp .inspector { display: block; position: sticky; top: var(--hdr-now, 66px); height: calc(100dvh - var(--hdr-now, 66px) - var(--below));
    overflow-y: auto; overscroll-behavior: contain; padding: var(--s4); background: var(--insp); border-left: 1px solid var(--line); scrollbar-width: thin; scrollbar-color: var(--card3) transparent; }
  body:not(.insp) #view { max-width: 1100px; }
  /* auto-buy: the switch with its price limit left, goals, history and blocked right */
  .abGrid.two { grid-template-columns: minmax(0, 38.2fr) minmax(0, 61.8fr); column-gap: var(--s5); align-items: start; }
  .abGrid.two .chip-row { flex-wrap: wrap; overflow: visible; }
  /* settings: list left, the open page right; the page stays in sight while the list scrolls */
  .stSplit { display: grid; grid-template-columns: minmax(260px, 38.2fr) minmax(0, 61.8fr); gap: var(--s5); align-items: start; }
  .stSplit .st { max-width: none; margin: 0; }
  .stDetail { position: sticky; top: calc(var(--hdr-now, 66px) + var(--s4)); max-height: calc(100dvh - var(--hdr-now, 66px) - 2 * var(--s4) - var(--below));
    overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--card3) transparent; }
  .stDetail .stBack { display: none; }
  .stPageT { display: block; }
  .stSplit :is(.stRow, .stHead)[aria-current="page"] { background: var(--card2); }
  .stSplit .stHead[aria-current="page"] { border-color: var(--line-strong); }
  .stDetail.enter { animation: viewIn .28s var(--ease); }
}

/* half folded like a book: each column in its own half, the fold stays empty */
@media (horizontal-viewport-segments: 2) {
  body.insp .split { grid-template-columns: env(viewport-segment-width 0 0) minmax(0, 1fr); column-gap: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0)); }
  body.insp .inspector { border-left: 0; }
  body:not(.insp) #view { max-width: none; margin: 0; }
  .stSplit, .abGrid.two { grid-template-columns: calc(env(viewport-segment-width 0 0) - 2 * var(--s4)) minmax(0, 1fr);
    column-gap: calc(env(viewport-segment-left 1 0) - env(viewport-segment-right 0 0) + 2 * var(--s4)); }
  /* sheets and notes open in the right half (Apple: sheets and alerts move off the fold) */
  .sheet-host { padding-left: env(viewport-segment-left 1 0); }
  .toast { left: calc(env(viewport-segment-left 1 0) + var(--s4)); }
}
/* half folded like a laptop: sheets stay in the lower half, where the hands are */
@media (vertical-viewport-segments: 2) {
  .sheet { max-height: calc(env(viewport-segment-height 0 1) - var(--s4)); }
}

/* Four color rules (reel 2026-11-24): 60 background, 30 one step lighter (the cards), 10 red only for what you should tap.
   Squint test: blurred, nothing may be louder than the one red main action.
   - Only the first auto-buy (the one with the red button) keeps the red frame. Further auto-buys are quiet cards,
     otherwise three red frames stack up and none of them leads any more.
   - The "Auto-Buy · …" line in text color; the pulsing dot stays red and shows the urgency small.
   - Unread: a light bar instead of a red one, otherwise a list full of alerts becomes a red fence. */
.ab-card:not(.ab-lead) { background: var(--card); border-color: var(--line-strong); box-shadow: none; }
.ab-status { color: var(--text); }
.alert-card.unread::before { background: var(--muted); }
/* ---------- 20 Design-Tipps (Reel 2026-11-24, nach Dan Liu und Emil Kowalski) ----------
   Schon erfüllt: lange Texte links (1), Grautöne zum Rot getönt (4), Löschen als eigenes Symbol rechts (5), Text auf Farbe in
   derselben Farbe (9, Badges in OKLCH), eine Farbe je Zustand (12), Dunkel-Farben gedämpft (16), leere Ansichten mit Knopf (19). */
/* 6: Überschriften enger als Fließtext (1,42) */
h1, h2, h3, .sheet-title { line-height: 1.2; }
/* 8: Satzschreibung statt GROSSBUCHSTABEN in Abschnitts- und Auto-Buy-Zeilen */
.section-label { text-transform: none; letter-spacing: 0; font-size: var(--t-sm); font-weight: 600; }
.ab-status { text-transform: none; letter-spacing: 0; font-size: var(--t-sm); font-weight: 600; }
/* 7: mehrere kleine Schatten statt eines großen: Kontaktschatten + Hof */
.sheet { box-shadow: 0 -1px 2px rgba(0, 0, 0, .3), 0 -5px 13px rgba(0, 0, 0, .3), 0 -21px 55px rgba(0, 0, 0, .45); }
@media (min-width: 960px) { .sheet { box-shadow: 0 2px 5px rgba(0, 0, 0, .35), 0 8px 21px rgba(0, 0, 0, .35), 0 28px 70px rgba(0, 0, 0, .5); } }
.toast { box-shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 5px 13px rgba(0, 0, 0, .3), 0 13px 34px rgba(0, 0, 0, .35); }
/* 13: Toast seitlich mehr Polster */
.toast { padding-left: var(--s5); }

/* Apple-Richtlinien (Paket „apple-ios-apps“, 2026-11-25): jede Tippfläche mind. 44 × 44 pt. Kleine Knöpfe behalten
   ihr Aussehen (Abstände 3·5·8·13·21·34·55), nur die unsichtbare Tippfläche wächst. Felder am Touch-Gerät 44 pt.
   Kennzeichen auf Platzhalter-Bildern mind. 11 px (Apples kleinste Schrift). */
.btn-sm, .seg-btn, .shop-pill, .url-pill { position: relative; }
.btn-sm::after, .seg-btn::after, .shop-pill::after, .url-pill::after { content: ""; position: absolute; inset: -5px -3px; }
.url-pill::after { inset: -9px -3px; }
.shop-pill::after { inset: -6px -3px; }
.icon-btn::after { inset: -5px; }
@media (pointer: coarse) { .input, .add-url .input, .add-url .btn { min-height: 44px; } }
.btn-xs::after { inset: -8px -3px; }
.thumb .art-tag { font-size: 11px; letter-spacing: 0; }

/* pull to refresh (app.js pullToRefresh, reel "15 UX-Regeln" 2026-11-27): a round chip slides in under the clock with the
   finger, the arrow turns with it; it spins while loading (Reduce Motion: it only pulses). Neutral, red stays for the main action. */
.ptr { position: fixed; z-index: 90; left: 50%; top: calc(env(safe-area-inset-top) - 40px); width: 40px; height: 40px; margin-left: -20px; border-radius: 50%; display: grid; place-items: center; background: var(--card2); color: var(--muted); box-shadow: 0 1px 2px rgb(0 0 0 / .2), 0 4px 13px rgb(0 0 0 / .3); opacity: 0; translate: 0 var(--d, 0px); pointer-events: none; transition: translate .3s cubic-bezier(.2,.9,.3,1.2), opacity .2s; }
.ptr.on { opacity: var(--p, 0); transition: none; }
.ptr.ready, .ptr.busy { color: var(--text); opacity: 1; }
.ptr.busy { transition: translate .3s; }
.ptr svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; rotate: calc(var(--p, 0) * 300deg); }
.ptr.busy svg { animation: ptr-spin .8s linear infinite; }
@keyframes ptr-spin { from { rotate: 0deg; } to { rotate: 360deg; } }
@keyframes ptr-beat { to { opacity: .35; } }
@media (prefers-reduced-motion: reduce) { .ptr { transition: opacity .2s; } .ptr.busy svg { animation: ptr-beat .7s ease-in-out infinite alternate; } }
