/* Tangem Portfolio Viewer — self-contained theme. Dark by default, follows the
   OS in `auto`, with explicit light/dark overrides via .theme-* on <html>.
   Accent is Tangem's brand blue (#006fd6, verified from tangem.com 2026-06). */
:root {
  --bg: #0b0e14;
  --bg-elev: #131825;
  --card: #161c2b;
  --card-hover: #1b2235;
  --line: #232c40;
  --text: #e8edf6;
  --text-dim: #9aa6bd;
  --muted: #6b768d;
  --accent: #006fd6;          /* Tangem brand blue */
  --accent-strong: #0a86e8;
  --accent-2: #5aa9ff;
  --gold: #ffd23f;            /* kept as a subtle warm secondary */
  --good: #2ecc71;
  --warn: #ffb020;
  --pill: #1f2738;
  --radius: 14px;
  --radius-sm: 10px;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 45%, transparent);
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .25);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, .28);
  color-scheme: dark;
}
.theme-light {
  --bg: #f5f7fb; --bg-elev: #ffffff; --card: #ffffff; --card-hover: #f2f5fb;
  --line: #e4e9f2; --text: #14181f; --text-dim: #5a667c; --muted: #8893a6;
  --pill: #eef2f9;
  --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent);
  --shadow-sm: 0 1px 2px rgba(20, 30, 60, .08);
  --shadow-md: 0 4px 14px rgba(20, 30, 60, .10);
  color-scheme: light;
}
.theme-light .brand img { filter: none; }
@media (prefers-color-scheme: light) {
  :root:not(.theme-dark) {
    --bg: #f5f7fb; --bg-elev: #ffffff; --card: #ffffff; --card-hover: #f2f5fb;
    --line: #e4e9f2; --text: #14181f; --text-dim: #5a667c; --muted: #8893a6;
    --pill: #eef2f9;
    --focus: 0 0 0 3px color-mix(in srgb, var(--accent) 38%, transparent);
    --shadow-sm: 0 1px 2px rgba(20, 30, 60, .08);
    --shadow-md: 0 4px 14px rgba(20, 30, 60, .10);
    color-scheme: light;
  }
  :root:not(.theme-dark) .brand img { filter: none; }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  width: 380px;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}
body.full { width: auto; }

.app { display: flex; flex-direction: column; min-height: 480px; }
.app.wide { max-width: 760px; margin: 0 auto; padding: 8px 0 24px; min-height: 100vh; }

/* ---------- topbar ---------- */
.topbar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-elev), var(--bg));
  position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand img {
  width: 30px; height: 30px; border-radius: 8px; flex: none; display: block;
  filter: invert(1);
  transition: filter .2s;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text .name { font-weight: 700; font-size: 14px; letter-spacing: -.01em; }
.brand-text .sub { font-size: 11px; color: var(--text-dim); }
.spacer { flex: 1; }
.readonly-pill {
  font-size: 10.5px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  padding: 3px 8px; border-radius: 999px;
}
.icon-btn {
  width: 32px; height: 32px; display: grid; place-items: center;
  background: var(--pill); border: 1px solid var(--line); border-radius: 9px;
  color: var(--text-dim); cursor: pointer; padding: 0;
  transition: color .15s, background .15s, border-color .15s;
}
.icon-btn:hover { color: var(--text); background: var(--card-hover); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.icon-btn:active { transform: translateY(1px); }
.icon-btn svg { width: 17px; height: 17px; }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- search ---------- */
.search-wrap { padding: 12px 14px 6px; }
.search {
  display: flex; align-items: center; gap: 8px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 7px 8px 7px 11px;
  transition: border-color .15s, box-shadow .15s;
  box-shadow: var(--shadow-sm);
}
.search:focus-within {
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: var(--focus);
}
.search.invalid { border-color: var(--warn); }
.search.invalid:focus-within { box-shadow: 0 0 0 3px color-mix(in srgb, var(--warn) 40%, transparent); }
.search .lead { display: grid; place-items: center; color: var(--muted); }
.search .lead svg { width: 17px; height: 17px; }
.search input {
  flex: 1; min-width: 0; background: none; border: none; outline: none;
  color: var(--text); font-size: 13.5px; font-family: inherit;
}
.search input::placeholder { color: var(--muted); }
.search .clear {
  width: 24px; height: 24px; display: none; place-items: center;
  background: none; border: none; color: var(--muted); cursor: pointer; padding: 0;
  border-radius: 6px;
}
.search .clear:hover { color: var(--text); background: var(--card-hover); }
.search .clear svg { width: 15px; height: 15px; }
.search:focus-within .clear { display: grid; }
.search .go {
  background: var(--accent); color: #fff; font-weight: 700; font-size: 13px;
  border: none; border-radius: 9px; padding: 7px 14px; cursor: pointer;
  transition: filter .15s, transform .05s;
}
.search .go:hover { filter: brightness(1.08); }
.search .go:active { transform: translateY(1px); }
.search .go:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- recents ---------- */
.recents { display: flex; flex-wrap: wrap; gap: 6px; padding: 2px 14px; }
.recents:empty { display: none; }
.recent {
  font-size: 11.5px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text-dim); background: var(--pill); border: 1px solid var(--line);
  border-radius: 999px; padding: 3px 9px; cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.recent:hover { color: var(--text); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--pill)); }
.recent:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- tabs ---------- */
.tabs {
  display: flex; gap: 4px; padding: 8px 12px 2px; overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  font-size: 12.5px; font-weight: 600; color: var(--text-dim);
  background: transparent; border: 1px solid transparent; border-radius: 999px;
  padding: 5px 11px; cursor: pointer;
  transition: color .15s, background .15s, border-color .15s;
}
.tab:hover { color: var(--text); background: var(--pill); }
.tab.active { color: var(--text); background: var(--card); border-color: var(--line); box-shadow: var(--shadow-sm); }
.tab .dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.tab .tt { font-size: 11px; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.tab.active .tt { color: var(--text-dim); }
.tab:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- content ---------- */
.content { flex: 1; padding: 8px 14px 14px; }

.summary {
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 14%, var(--card)), var(--card));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 12px;
  box-shadow: var(--shadow-md);
}
.sum-label { font-size: 11.5px; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; }
.sum-total { font-size: 28px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 8px; font-variant-numeric: tabular-nums; }
.sum-total.dim { opacity: .65; }
.addr {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; color: var(--text-dim); background: var(--pill);
  border: 1px solid var(--line); border-radius: 999px; padding: 4px 10px; cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: color .15s, border-color .15s;
}
.addr:hover { color: var(--text); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.addr .ens { color: var(--accent-2); font-weight: 600; font-family: 'Inter', sans-serif; }
.addr svg { width: 13px; height: 13px; opacity: .7; }
.addr.copied { color: var(--good); border-color: var(--good); }
.addr:focus-visible { outline: none; box-shadow: var(--focus); }

/* ---------- chain section ---------- */
.chain { margin-bottom: 14px; }
.ch-head {
  display: flex; align-items: center; gap: 8px;
  font-size: 12.5px; font-weight: 700; color: var(--text-dim);
  margin: 0 2px 7px; text-transform: uppercase; letter-spacing: .03em;
}
.ch-head .dot { width: 9px; height: 9px; border-radius: 50%; }
.ch-head .ch-total { margin-left: auto; color: var(--text); font-size: 13px; font-variant-numeric: tabular-nums; }
.skeleton-dash { color: var(--muted); }

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.row {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 13px; border-bottom: 1px solid var(--line);
  transition: background .12s;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--card-hover); }
.row .ic {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  background: var(--pill); object-fit: cover;
}
.row .meta { min-width: 0; flex: 1; }
.row .sym { font-weight: 700; font-size: 13.5px; display: flex; align-items: center; gap: 6px; min-width: 0; }
.row .sym .sym-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sym .badge {
  font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 5px; padding: 1px 5px;
}
.row .name {
  font-size: 11.5px; color: var(--text-dim); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 200px;
}
.row .vals { text-align: right; flex: none; }
.row .amt { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.row .usd { font-size: 11.5px; color: var(--text-dim); font-variant-numeric: tabular-nums; }

.unpriced { font-size: 11px; padding: 7px 4px 0; }
.unpriced > summary {
  list-style: none; cursor: pointer; color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px;
  border-radius: 999px; padding: 3px 9px;
  transition: color .15s, background .15s;
}
.unpriced > summary::-webkit-details-marker { display: none; }
.unpriced > summary::before {
  content: '+'; font-weight: 700; color: var(--accent-2); font-size: 12px;
}
.unpriced[open] > summary::before { content: '−'; }
.unpriced > summary:hover { color: var(--text-dim); background: var(--pill); }
.unpriced > .card { margin-top: 7px; }
.muted { color: var(--muted); }

/* ---------- banners / empty ---------- */
.banner {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; padding: 9px 12px; border-radius: var(--radius-sm); margin-bottom: 12px;
}
.banner svg { width: 16px; height: 16px; flex: none; }
.banner.warn { color: var(--warn); background: color-mix(in srgb, var(--warn) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--warn) 30%, transparent); }

.empty { text-align: center; padding: 38px 22px; }
.empty.small { padding: 28px 22px; }
.empty-ic {
  width: 52px; height: 52px; margin: 0 auto 14px; display: grid; place-items: center;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 16px;
}
.empty-ic svg { width: 26px; height: 26px; }
.empty h2 { font-size: 16px; margin: 0 0 8px; }
.empty p { font-size: 12.5px; color: var(--text-dim); margin: 4px 0; line-height: 1.5; }
.empty code { font-family: ui-monospace, monospace; color: var(--text); }

/* ---------- skeleton ---------- */
.skel { pointer-events: none; }
.sk-ic { width: 34px; height: 34px; border-radius: 50%; background: var(--pill); }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.sk, .sk-val { background: var(--pill); border-radius: 6px; height: 11px; animation: pulse 1.3s ease-in-out infinite; }
.sk.a { width: 40%; } .sk.b { width: 65%; height: 9px; } .sk-val { width: 60px; height: 13px; }
@keyframes pulse { 0%,100% { opacity: .55; } 50% { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .sk, .sk-val { animation: none; opacity: .7; }
  .icon-btn, .tab, .recent, .row, .search, .go, .unpriced > summary { transition: none; }
}
.unpriced > summary:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 999px; }

/* ---------- footer ---------- */
.footer {
  font-size: 10.5px; color: var(--muted); text-align: center;
  padding: 11px 14px; border-top: 1px solid var(--line);
}
.footer-link {
  display: inline; font: inherit; color: inherit;
  background: none; border: none; padding: 0; cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
  transition: color .15s;
}
.footer-link:hover,
.footer-link:focus-visible { color: var(--text-dim); outline: none; }

/* ---------- invalid search ---------- */
.search.invalid { border-color: color-mix(in srgb, #ff5c5c 70%, var(--line)); }

/* ---------- modal / onboarding ---------- */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 50;
  background: color-mix(in srgb, #000 55%, transparent);
  backdrop-filter: blur(2px);
  display: flex; align-items: flex-start; justify-content: center;
  overflow-y: auto; padding: 16px;
  opacity: 0; transition: opacity .18s ease;
}
.modal-backdrop[hidden] { display: none; }
.modal-backdrop.open { opacity: 1; }
.modal {
  position: relative; width: 100%; max-width: 420px; margin: auto;
  background: var(--bg-elev); border: 1px solid var(--line);
  border-radius: 18px; padding: 18px 18px 16px;
  box-shadow: 0 24px 60px rgba(0,0,0,.45);
  transform: translateY(8px) scale(.99); transition: transform .18s ease;
}
.modal-backdrop.open .modal { transform: none; }
.modal-close {
  position: absolute; top: 12px; right: 12px; width: 30px; height: 30px;
  display: grid; place-items: center; background: var(--pill);
  border: 1px solid var(--line); border-radius: 9px; color: var(--text-dim);
  cursor: pointer; padding: 0;
}
.modal-close:hover { color: var(--text); }
.modal-close svg { width: 16px; height: 16px; }

.ob-hero { text-align: center; padding: 4px 6px 12px; }
.ob-hero-ic {
  width: 48px; height: 48px; margin: 0 auto 10px; display: grid; place-items: center;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-radius: 14px;
}
.ob-hero-ic svg { width: 26px; height: 26px; }
.ob-hero h2 { font-size: 17px; margin: 0 0 6px; }
.ob-hero p { font-size: 12.5px; color: var(--text-dim); margin: 0; line-height: 1.5; }

.ob-sec-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); margin: 16px 2px 8px; display: flex; align-items: center; gap: 8px;
}
.ob-hint {
  font-size: 9.5px; font-weight: 600; letter-spacing: .02em; text-transform: none;
  color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent);
  border-radius: 999px; padding: 2px 8px;
}

.ob-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ob-step {
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px;
}
.ob-num {
  flex: none; width: 20px; height: 20px; border-radius: 50%; margin-top: 1px;
  display: grid; place-items: center; font-size: 11px; font-weight: 700;
  color: #1a1300; background: var(--accent);
}
.ob-ic { flex: none; color: var(--text-dim); display: grid; place-items: center; margin-top: 1px; }
.ob-ic svg { width: 18px; height: 18px; }
.ob-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.ob-text b { font-size: 13px; }
.ob-text span { font-size: 11.5px; color: var(--text-dim); line-height: 1.45; }
.ob-text code { font-family: ui-monospace, monospace; color: var(--text); font-size: 11px; }

.ob-safe {
  display: flex; align-items: flex-start; gap: 9px; margin-top: 12px;
  font-size: 12px; color: var(--text-dim); line-height: 1.45;
  background: color-mix(in srgb, var(--good) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--good) 28%, transparent);
  border-radius: 12px; padding: 10px 12px;
}
.ob-safe b { color: var(--text); }
.ob-safe svg { width: 17px; height: 17px; flex: none; color: var(--good); margin-top: 1px; }

/* ---------- quiz ---------- */
.quiz { display: flex; flex-direction: column; gap: 12px; }
.quiz-item {
  background: var(--card); border: 1px solid var(--line);
  border-radius: 12px; padding: 11px 12px;
}
.quiz-q { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; line-height: 1.4; }
.quiz-opts { display: flex; flex-direction: column; gap: 6px; }
.quiz-opt {
  display: flex; align-items: center; gap: 9px; text-align: left;
  font-size: 12px; color: var(--text); font-family: inherit;
  background: var(--pill); border: 1px solid var(--line);
  border-radius: 9px; padding: 8px 10px; cursor: pointer; transition: border-color .12s;
}
.quiz-opt:hover:not(:disabled) { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.quiz-opt:disabled { cursor: default; }
.qo-mark {
  flex: none; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--muted); transition: all .12s;
}
.quiz-opt.correct { border-color: var(--good); background: color-mix(in srgb, var(--good) 12%, transparent); }
.quiz-opt.correct .qo-mark { border-color: var(--good); background: var(--good); }
.quiz-opt.wrong { border-color: #ff5c5c; background: color-mix(in srgb, #ff5c5c 12%, transparent); }
.quiz-opt.wrong .qo-mark { border-color: #ff5c5c; background: #ff5c5c; }
.quiz-why {
  display: flex; align-items: flex-start; gap: 8px; margin-top: 9px;
  font-size: 11.5px; color: var(--text-dim); line-height: 1.45;
}
.quiz-why svg { width: 15px; height: 15px; flex: none; color: var(--good); margin-top: 1px; }

.modal-cta {
  width: 100%; margin-top: 16px; padding: 11px;
  background: var(--accent); color: #fff; font-weight: 700; font-size: 14px;
  border: none; border-radius: 11px; cursor: pointer;
  transition: filter .12s, transform .08s;
}
.modal-cta:hover { filter: brightness(1.08); }
.modal-cta:active { transform: scale(.985); }

/* ============================================================
   Splash / loading screen — a branded blue scene shown on open.
   Pure-CSS animation so it paints instantly; app.js fades it out.
   ============================================================ */
.splash {
  position: fixed; inset: 0; z-index: 100;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; color: #fff;
  background:
    radial-gradient(120% 80% at 50% -10%, #0a86e8 0%, #035bb0 34%, #06234a 70%, #050a16 100%);
  opacity: 1; transition: opacity .5s ease, visibility .5s;
}
.splash.splash-out { opacity: 0; visibility: hidden; pointer-events: none; }
.splash[hidden] { display: none; }

/* drifting glows behind everything */
.splash-aura { position: absolute; inset: -25%; pointer-events: none; }
.splash-aura::before, .splash-aura::after {
  content: ""; position: absolute; width: 60%; height: 60%; border-radius: 50%;
  filter: blur(60px); opacity: .55; mix-blend-mode: screen;
  animation: auraDrift 7s ease-in-out infinite alternate;
}
.splash-aura::before { left: 5%; top: 8%; background: #29a3ff; }
.splash-aura::after { right: 4%; bottom: 4%; background: #0050b0; animation-delay: -3.5s; }
@keyframes auraDrift {
  from { transform: translate3d(-6%, -4%, 0) scale(1); }
  to   { transform: translate3d(8%, 6%, 0) scale(1.18); }
}

.splash-inner {
  position: relative; z-index: 1; display: flex; flex-direction: column;
  align-items: center; text-align: center; padding: 0 24px;
}

/* logo */
.splash-logo {
  position: relative; width: 88px; height: 88px; border-radius: 20px;
  overflow: hidden; box-shadow: 0 18px 50px rgba(0, 40, 90, .55), 0 0 0 1px rgba(255,255,255,.06);
  animation: logoIn .7s cubic-bezier(.2,.9,.25,1.1) both, logoFloat 3.4s ease-in-out 0.7s infinite;
}
.splash-logo img { display: block; width: 100%; height: 100%; }
.splash-glow {
  position: absolute; inset: -40%; z-index: -1; border-radius: 50%;
  background: radial-gradient(circle, rgba(90,180,255,.9), rgba(90,180,255,0) 62%);
  filter: blur(14px); animation: glowPulse 2.4s ease-in-out infinite;
}
.splash-sheen {
  position: absolute; top: 0; left: -120%; width: 70%; height: 100%;
  background: linear-gradient(105deg, transparent 0%, rgba(255,255,255,.0) 30%,
    rgba(255,255,255,.65) 50%, rgba(255,255,255,0) 70%, transparent 100%);
  transform: skewX(-18deg); animation: sheen 2.3s ease-in-out .6s infinite;
}
@keyframes logoIn { from { opacity: 0; transform: translateY(10px) scale(.8); } to { opacity: 1; transform: none; } }
@keyframes logoFloat { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
@keyframes glowPulse { 0%,100% { opacity: .45; transform: scale(.92); } 50% { opacity: .9; transform: scale(1.08); } }
@keyframes sheen { 0% { left: -120%; } 55%,100% { left: 130%; } }

.splash-title {
  margin-top: 18px; font-size: 19px; font-weight: 800; letter-spacing: -.01em;
  opacity: 0; animation: fadeUp .5s ease .35s both;
}
.splash-sub {
  margin-top: 4px; font-size: 12px; color: rgba(255,255,255,.7);
  opacity: 0; animation: fadeUp .5s ease .5s both;
}
@keyframes fadeUp { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* progress bar */
.splash-bar {
  position: relative; width: 168px; height: 4px; margin-top: 22px;
  border-radius: 999px; background: rgba(255,255,255,.16); overflow: hidden;
  opacity: 0; animation: fadeUp .4s ease .6s both;
}
.splash-bar i {
  position: absolute; left: 0; top: 0; height: 100%; width: 0;
  border-radius: 999px; background: linear-gradient(90deg, #6fc2ff, #ffffff);
  box-shadow: 0 0 12px rgba(150,210,255,.8);
  animation: barFill 1.9s cubic-bezier(.4,0,.2,1) .55s forwards;
}
@keyframes barFill { 0% { width: 4%; } 65% { width: 78%; } 100% { width: 100%; } }

.splash-loading {
  margin-top: 12px; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase;
  color: rgba(255,255,255,.66); opacity: 0; animation: fadeUp .4s ease .7s both;
}
.splash-dots b { animation: dot 1.4s infinite; opacity: .25; }
.splash-dots b:nth-child(2) { animation-delay: .2s; }
.splash-dots b:nth-child(3) { animation-delay: .4s; }
@keyframes dot { 0%,100% { opacity: .25; } 50% { opacity: 1; } }

/* ---------- micro-polish ---------- */
.go, .icon-btn, .tab, .recent { transition: background .15s, color .15s, border-color .15s, transform .08s, filter .12s; }
.go:active, .icon-btn:active, .recent:active { transform: scale(.95); }
.go:hover { filter: brightness(1.06); }
.copy-btn:active { transform: scale(.96); }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 8px; }

/* staggered row entrance */
.card .row { animation: rowIn .34s ease both; }
.card .row:nth-child(1){animation-delay:.02s}.card .row:nth-child(2){animation-delay:.06s}
.card .row:nth-child(3){animation-delay:.10s}.card .row:nth-child(4){animation-delay:.14s}
.card .row:nth-child(5){animation-delay:.18s}.card .row:nth-child(6){animation-delay:.22s}
.card .row:nth-child(n+7){animation-delay:.26s}
@keyframes rowIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* the summary total gets a soft sweeping highlight */
.summary { position: relative; overflow: hidden; }
.summary::after {
  content: ""; position: absolute; top: 0; left: -60%; width: 40%; height: 100%;
  background: linear-gradient(105deg, transparent, color-mix(in srgb, var(--accent) 14%, transparent), transparent);
  transform: skewX(-18deg); animation: summarySweep 5.5s ease-in-out 1s infinite;
}
@keyframes summarySweep { 0% { left: -60%; } 30%,100% { left: 160%; } }

@media (prefers-reduced-motion: reduce) {
  .splash-aura::before, .splash-aura::after, .splash-glow, .splash-sheen,
  .splash-logo, .summary::after, .splash-dots b { animation: none !important; }
  .splash-bar i { animation: barFill .4s ease forwards; }
  .card .row { animation: none; }
}

/* ---------- settings page ---------- */
.settings-page { background: var(--bg); min-height: 100vh; }
.settings-container { max-width: 560px; margin: 0 auto; padding: 0 0 24px; }
.settings-content { padding: 16px 14px 14px; display: flex; flex-direction: column; gap: 20px; }

.settings-section { animation: rowIn .34s ease both; }
.settings-section:nth-child(1) { animation-delay: .04s; }
.settings-section:nth-child(2) { animation-delay: .08s; }
.settings-section:nth-child(3) { animation-delay: .12s; }
.settings-section:nth-child(4) { animation-delay: .16s; }
.settings-section:nth-child(5) { animation-delay: .20s; }

.section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--text-dim); margin: 0 0 8px 2px;
}

.settings-row {
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-stack {
  flex-direction: column; align-items: stretch; gap: 8px;
}

.settings-label { font-size: 13px; font-weight: 500; color: var(--text); flex-shrink: 0; }
.settings-desc { font-size: 12px; color: var(--text-dim); line-height: 1.45; }
.settings-info { display: flex; flex-direction: column; gap: 4px; }

.settings-note {
  font-size: 11.5px; color: var(--muted); line-height: 1.45;
  padding: 10px 14px 12px; margin: 0;
}

.engage-bullets {
  list-style: none; margin: 0; padding: 0 14px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.engage-bullets li {
  font-size: 11.5px; color: var(--muted); line-height: 1.45;
  padding-left: 14px; position: relative;
}
.engage-bullets li::before {
  content: '○'; position: absolute; left: 0; color: var(--text-dim);
}
.engage-status-row { border-top: 1px solid var(--line); }

/* toggle switch */
.toggle-switch {
  position: relative; flex-shrink: 0;
  width: 44px; height: 26px; padding: 0;
  background: var(--pill); border: 1px solid var(--line);
  border-radius: 999px; cursor: pointer;
  transition: background .15s, border-color .15s;
}
.toggle-switch::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--text-dim);
  transition: transform .15s, background .15s;
}
.toggle-switch.on {
  background: color-mix(in srgb, var(--accent) 25%, var(--pill));
  border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
}
.toggle-switch.on::after {
  transform: translateX(18px);
  background: var(--accent);
}
.toggle-switch:focus-visible { outline: none; box-shadow: var(--focus); }

/* theme segmented control */
.theme-selector {
  display: flex; gap: 3px; background: var(--pill); border-radius: 10px; padding: 3px;
}
.theme-option {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  background: transparent; border: none; border-radius: 7px;
  padding: 6px 14px; cursor: pointer;
  color: var(--text-dim); transition: all .15s ease;
  white-space: nowrap;
}
.theme-option:hover:not(.active) { color: var(--text); background: var(--card); }
.theme-option.active {
  background: var(--accent); color: #fff;
  box-shadow: 0 2px 6px rgba(0, 111, 214, .28);
}
.theme-option:focus-visible { outline: none; box-shadow: var(--focus); }
.theme-icon { font-size: 13px; line-height: 1; }

/* URL input */
.url-input-group { display: flex; gap: 8px; align-items: center; width: 100%; }
.url-input {
  flex: 1; min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px; color: var(--text);
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 11px;
  transition: border-color .15s, box-shadow .15s;
}
.url-input:focus {
  outline: none; border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: var(--focus);
}
.url-input::placeholder { color: var(--muted); }

/* buttons */
.btn {
  font-size: 12.5px; font-weight: 600; font-family: inherit;
  border: none; border-radius: 9px; padding: 8px 16px;
  cursor: pointer; transition: all .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn-secondary { background: var(--pill); color: var(--text); border: 1px solid var(--line); }
.btn-secondary:hover:not(:disabled) { background: var(--card-hover); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }

.btn-danger { background: color-mix(in srgb, var(--warn) 15%, transparent); color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 35%, transparent); }
.btn-danger:hover:not(:disabled) { background: color-mix(in srgb, var(--warn) 22%, transparent); }

.btn-full { width: 100%; }

/* file input */
.btn-file { position: relative; overflow: hidden; }
.file-input {
  position: absolute; inset: 0; opacity: 0; cursor: pointer;
  font-size: 0;
}

/* status indicator */
.status-dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 4px; vertical-align: middle;
}
.status-on { background: var(--good); box-shadow: 0 0 6px color-mix(in srgb, var(--good) 50%, transparent); }
.status-off { background: var(--muted); }

.status-ok { color: var(--good); }
.status-warn { color: var(--text-dim); }
.status-err { color: #ff5c5c; }

/* about card */
.about-card { padding: 18px 16px; }
.about-header { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.about-logo {
  width: 48px; height: 48px; border-radius: 12px; flex: none;
  filter: invert(1);
}
.about-info { display: flex; flex-direction: column; gap: 2px; }
.about-name { font-size: 15px; font-weight: 700; }
.about-version { font-size: 12px; color: var(--text-dim); }
.about-tagline {
  font-size: 12.5px; color: var(--text-dim); margin-bottom: 14px;
  padding: 8px 12px; background: var(--pill); border-radius: 8px;
}
.about-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 600;
  transition: color .15s;
  margin-bottom: 14px;
}
.about-link:hover { color: var(--accent-strong); text-decoration: underline; }
.about-link svg { width: 14px; height: 14px; }
.about-credits { border-top: 1px solid var(--line); padding-top: 12px; }
.about-note { font-size: 11px; color: var(--muted); margin: 4px 0; line-height: 1.45; }

/* privacy policy page */
.privacy-page .icon-btn.back svg { transform: rotate(180deg); }
.privacy-content { gap: 18px; }
.privacy-title {
  font-size: 17px; font-weight: 700; letter-spacing: -.01em;
  margin: 0 2px 4px; line-height: 1.35;
}
.privacy-card { padding: 14px 16px; }
.privacy-card + .privacy-card { margin-top: 10px; }
.privacy-heading {
  font-size: 13px; font-weight: 600; color: var(--text);
  margin: 0 0 10px;
}
.privacy-list {
  list-style: none; margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 6px;
}
.privacy-list li {
  font-size: 12.5px; color: var(--text-dim); line-height: 1.5;
  padding-left: 14px; position: relative;
}
.privacy-list li::before {
  content: '•'; position: absolute; left: 0; color: var(--accent);
}
.privacy-list-neg li::before { content: '×'; color: var(--warn); font-weight: 700; }
.privacy-callout {
  font-size: 12px; font-weight: 600; color: var(--good);
  margin: 12px 0 0; padding: 8px 12px;
  background: color-mix(in srgb, var(--good) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--good) 28%, transparent);
  border-radius: 8px; line-height: 1.45;
}
.privacy-contact {
  font-size: 13px; color: var(--text-dim); margin: 0; line-height: 1.55;
}
.privacy-contact .about-link { margin: 0; display: inline; }
.privacy-policy-link { margin-bottom: 0; }

/* toast */
.toast-container {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; gap: 8px;
  align-items: center; pointer-events: none;
}
.toast {
  background: var(--bg-elev); color: var(--text);
  border: 1px solid var(--line); border-radius: 999px;
  padding: 10px 20px; font-size: 13px; font-weight: 600;
  box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
  opacity: 0; transform: translateY(12px);
  transition: all .25s ease; pointer-events: auto;
}
.toast-show { opacity: 1; transform: translateY(0); }
.toast-success { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); color: var(--accent-2); }
.toast-error { border-color: color-mix(in srgb, #ff5c5c 50%, var(--line)); color: #ff5c5c; }

.toast-error { border-color: color-mix(in srgb, #ff5c5c 50%, var(--line)); color: #ff5c5c; }

/* ---------- pref-sync engagement modal ---------- */
.engage-modal { max-width: 340px; }
.engage-hero { text-align: center; margin-bottom: 16px; }
.engage-hero.compact { margin-bottom: 12px; }
.engage-hero.compact h2 { font-size: 16px; }
.engage-ic {
  width: 44px; height: 44px; margin: 0 auto 10px; border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 18%, var(--pill));
  display: grid; place-items: center; color: var(--accent);
}
.engage-ic svg { width: 22px; height: 22px; }
.engage-hero h2 { font-size: 17px; margin-bottom: 6px; }
.engage-hero p { font-size: 12.5px; color: var(--text-dim); line-height: 1.45; }
.engage-alert {
  margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: 12px;
  background: color-mix(in srgb, var(--warn) 12%, var(--pill));
  color: var(--warn); text-align: left;
}
.engage-actions { display: flex; flex-direction: column; gap: 8px; }
.engage-skip {
  background: none; border: none; color: var(--text-dim); font-size: 12px;
  cursor: pointer; padding: 6px; font-family: inherit;
}
.engage-skip:hover { color: var(--text); }
.engage-hint { font-size: 11px !important; color: var(--muted) !important; }
.engage-quiz { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; max-height: 240px; overflow: auto; }
.engage-q { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--pill); }
.engage-qtext { font-size: 12.5px; font-weight: 600; margin-bottom: 8px; }
.engage-opts { display: flex; flex-direction: column; gap: 6px; }
.engage-opt {
  display: flex; align-items: center; gap: 8px; width: 100%; text-align: left;
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); font-size: 12px; cursor: pointer;
  font-family: inherit; transition: border-color .15s, background .15s;
}
.engage-opt:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.engage-opt.selected { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--card)); }
.engage-mark {
  width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line); flex: none;
}
.engage-opt.selected .engage-mark { border-color: var(--accent); background: var(--accent); }
.engage-submit:disabled { opacity: .45; cursor: not-allowed; }
.engage-empty { font-size: 12px; color: var(--text-dim); text-align: center; padding: 12px; }
.engage-input {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 10px 12px;
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.5;
  transition: border-color .15s, box-shadow .15s;
}
.engage-input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: var(--focus);
}
.engage-input::placeholder {
  color: var(--muted);
}
.engage-counter {
  font-size: 11px;
  color: var(--muted);
  text-align: right;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.engage-counter.met {
  color: var(--good);
}

@media (max-width: 640px) {
  .settings-content { padding: 12px 10px 14px; gap: 14px; }
  .settings-row { flex-direction: column; align-items: stretch; gap: 10px; padding: 12px 12px; }
  .url-input-group { flex-direction: column; }
  .theme-selector { width: 100%; }
  .theme-option { flex: 1; justify-content: center; padding: 8px 8px; }
}
