/* Summary — design tokens. Mirrors ios/Summary/DesignSystem.swift. */
:root {
  --bg: #f6f3ee;
  --surface: #fffdf9;
  --surface-2: #efebe4;
  --ink: #1b1a18;
  --ink-2: #57534d;
  --ink-3: #8a857c;
  --line: #e3ddd3;
  --accent: #d8432f;        /* Summary red: the "play" you no longer press */
  --accent-ink: #ffffff;
  --accent-soft: #fbe5e0;
  --watch: #1f6f4a;  --watch-soft: #dcefe4;
  --enough: #2a59c9; --enough-soft: #e1e9fb;
  --skip: #8a857c;   --skip-soft: #ebe7e0;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(27, 26, 24, .06), 0 8px 24px rgba(27, 26, 24, .06);
  --serif: "Newsreader", "New York", Georgia, serif;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", system-ui, sans-serif;
  --ease: cubic-bezier(.2, .8, .2, 1);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110; --surface: #1b1a18; --surface-2: #24221f; --ink: #f3efe8; --ink-2: #b9b2a7; --ink-3: #847d72;
    --line: #2e2b27; --accent: #ff5a43; --accent-soft: #3a1d17; --watch: #5fd39a; --watch-soft: #15301f;
    --enough: #7fa2ff; --enough-soft: #18223d; --skip: #9b9488; --skip-soft: #2a2824;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121110; --surface: #1b1a18; --surface-2: #24221f; --ink: #f3efe8; --ink-2: #b9b2a7; --ink-3: #847d72;
  --line: #2e2b27; --accent: #ff5a43; --accent-soft: #3a1d17; --watch: #5fd39a; --watch-soft: #15301f;
  --enough: #7fa2ff; --enough-soft: #18223d; --skip: #9b9488; --skip-soft: #2a2824;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 16px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px calc(48px + env(safe-area-inset-bottom)); }
.narrow { max-width: 720px; }

/* Top bar */
.top { position: sticky; top: 0; z-index: 5; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid transparent; }
.top.scrolled { border-bottom-color: var(--line); }
.top-in { max-width: 1080px; margin: 0 auto; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; display: flex; align-items: center; gap: 12px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font: 600 22px/1 var(--serif); letter-spacing: -.01em; }
.brand-mark { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); display: grid; place-items: center; }
.brand-mark svg { width: 14px; height: 14px; }
.spacer { flex: 1; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); display: grid; place-items: center; transition: transform .15s var(--ease), background .2s; }
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn.spin svg { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Hero counter */
.hero { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; margin: 18px 0 8px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow); }
.stat.main { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.stat-label { font-size: 13px; color: var(--ink-3); font-weight: 500; letter-spacing: .01em; }
.stat.main .stat-label { color: color-mix(in srgb, var(--bg) 70%, transparent); }
.stat-value { font: 600 44px/1.05 var(--serif); letter-spacing: -.02em; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat-value small { font: 500 17px var(--sans); letter-spacing: 0; margin-left: 4px; opacity: .75; }
.stat-sub { font-size: 13px; margin-top: 8px; color: var(--ink-2); }
.stat.main .stat-sub { color: color-mix(in srgb, var(--bg) 78%, transparent); }
.stats-mini { display: grid; grid-template-rows: 1fr 1fr; gap: 12px; }
.stats-mini .stat { padding: 14px 18px; }
.stats-mini .stat-value { font-size: 28px; margin-top: 2px; }
.meter { height: 6px; border-radius: 99px; background: color-mix(in srgb, var(--bg) 20%, transparent); margin-top: 14px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; width: 0; transition: width .9s var(--ease); }

/* Add URL */
.add { display: flex; gap: 8px; margin: 14px 0 6px; }
.add input { flex: 1; min-width: 0; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); padding: 0 14px; }
.add input::placeholder { color: var(--ink-3); }
.btn { height: 46px; padding: 0 18px; border-radius: 12px; border: 0; background: var(--accent); color: var(--accent-ink); font-weight: 600; transition: transform .15s var(--ease), opacity .2s; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn.ghost { background: var(--surface); color: var(--ink); border: 1px solid var(--line); }
.btn:disabled { opacity: .5; }
.note { font-size: 13px; color: var(--ink-3); min-height: 20px; }
.note.err { color: var(--accent); }

/* Tabs */
.tabs { display: flex; gap: 6px; margin: 18px 0 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { height: 36px; padding: 0 14px; border-radius: 99px; border: 1px solid var(--line); background: transparent; color: var(--ink-2); font-weight: 500; font-size: 14px; white-space: nowrap; }
.tab[aria-selected="true"] { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tab .n { opacity: .6; margin-left: 4px; font-variant-numeric: tabular-nums; }

/* Feed */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; box-shadow: var(--shadow); transition: transform .25s var(--ease), box-shadow .25s; animation: rise .45s var(--ease) both; }
.card:hover { transform: translateY(-2px); }
.card:active { transform: scale(.985); }
.card.read { opacity: .72; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } }
.thumb { position: relative; aspect-ratio: 16 / 9; background: var(--surface-2); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge { position: absolute; bottom: 8px; right: 8px; background: rgba(0, 0, 0, .78); color: #fff; font-size: 12px; font-weight: 600; padding: 2px 7px; border-radius: 6px; font-variant-numeric: tabular-nums; }
.origin { position: absolute; top: 8px; left: 8px; background: rgba(255, 255, 255, .92); color: #1b1a18; font-size: 11px; font-weight: 600; padding: 3px 8px; border-radius: 99px; letter-spacing: .02em; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.channel { font-size: 13px; color: var(--ink-3); font-weight: 500; display: flex; gap: 6px; align-items: center; }
.title { font: 600 19px/1.25 var(--serif); letter-spacing: -.005em; margin: 0; }
.tldr { font-size: 14.5px; color: var(--ink-2); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.meta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-top: auto; padding-top: 6px; font-size: 13px; color: var(--ink-3); }
.chip { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; }
.chip.watch { background: var(--watch-soft); color: var(--watch); }
.chip.summary_enough { background: var(--enough-soft); color: var(--enough); }
.chip.skip { background: var(--skip-soft); color: var(--skip); }
.chip.saved { background: var(--accent-soft); color: var(--accent); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.empty { text-align: center; padding: 60px 20px; color: var(--ink-3); }
.empty h3 { font: 600 22px var(--serif); color: var(--ink); margin: 0 0 6px; }
.skeleton { background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: var(--radius); height: 330px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* Detail */
.back { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; color: var(--ink-2); font-weight: 500; font-size: 14px; margin: 16px 0 10px; }
.detail { animation: rise .4s var(--ease) both; }
.player { position: relative; border-radius: var(--radius); overflow: hidden; aspect-ratio: 16 / 9; background: #000; display: block; }
.player img { width: 100%; height: 100%; object-fit: cover; opacity: .9; }
.play { position: absolute; inset: 0; display: grid; place-items: center; }
.play span { width: 64px; height: 64px; border-radius: 50%; background: var(--accent); display: grid; place-items: center; box-shadow: 0 8px 30px rgba(0, 0, 0, .35); transition: transform .2s var(--ease); }
.player:hover .play span { transform: scale(1.06); }
.d-title { font: 600 30px/1.18 var(--serif); letter-spacing: -.015em; margin: 18px 0 8px; }
.d-meta { display: flex; flex-wrap: wrap; gap: 6px 14px; color: var(--ink-3); font-size: 14px; }
.d-meta a { color: var(--ink-2); font-weight: 500; text-decoration: none; }
.verdict { margin: 20px 0; border-radius: var(--radius); padding: 16px 18px; display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; align-items: center; }
.verdict.watch { background: var(--watch-soft); color: var(--watch); }
.verdict.summary_enough { background: var(--enough-soft); color: var(--enough); }
.verdict.skip { background: var(--skip-soft); color: var(--skip); }
.verdict b { font-size: 16px; }
.verdict p { margin: 0; grid-column: 2; color: var(--ink-2); font-size: 14.5px; }
.verdict .v-ico { grid-row: span 2; width: 40px; height: 40px; border-radius: 12px; background: currentColor; display: grid; place-items: center; }
.verdict .v-ico svg { width: 20px; height: 20px; color: var(--surface); }
.saved-line { font-size: 13px; color: var(--ink-3); margin: -8px 0 18px; }
h2.sec { font: 600 13px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--ink-3); margin: 30px 0 12px; }
.lead { font: 500 21px/1.45 var(--serif); margin: 0; }
.ideas { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.idea { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px 16px; display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; }
.ts { grid-row: span 2; align-self: start; font: 600 12.5px var(--sans); font-variant-numeric: tabular-nums; color: var(--accent); background: var(--accent-soft); text-decoration: none; padding: 4px 8px; border-radius: 8px; display: inline-flex; gap: 4px; align-items: center; }
.ts svg { width: 10px; height: 10px; }
.idea b { font-weight: 600; }
.idea p { margin: 0; color: var(--ink-2); font-size: 15px; }
.prose { font-size: 17px; line-height: 1.7; }
.prose h2, .prose h3 { font: 600 21px/1.3 var(--serif); margin: 26px 0 8px; letter-spacing: -.005em; }
.prose p { margin: 0 0 14px; }
.prose ul, .prose ol { padding-left: 22px; margin: 0 0 14px; }
.prose li { margin: 4px 0; }
.takeaways { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.takeaways li { display: grid; grid-template-columns: 22px 1fr; gap: 10px; align-items: start; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 15.5px; }
.check { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line); display: grid; place-items: center; cursor: pointer; transition: background .2s, border-color .2s; }
.check.on { background: var(--accent); border-color: var(--accent); }
.check svg { width: 12px; height: 12px; color: #fff; opacity: 0; transition: opacity .15s; }
.check.on svg { opacity: 1; }
.takeaways li.done span { color: var(--ink-3); text-decoration: line-through; }
blockquote { margin: 0 0 10px; padding: 12px 16px; border-left: 3px solid var(--accent); background: var(--surface); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font: 500 18px/1.45 var(--serif); }
blockquote a { display: block; margin-top: 6px; font: 600 12px var(--sans); color: var(--accent); text-decoration: none; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.topics span { font-size: 12.5px; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); }
.actions { position: sticky; bottom: 0; margin-top: 28px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to top, var(--bg) 70%, transparent); display: flex; gap: 8px; }
.actions .btn { flex: 1; }

/* Sources / settings */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin: 14px 0; box-shadow: var(--shadow); }
.panel h3 { font: 600 20px var(--serif); margin: 0 0 6px; }
.panel p { margin: 0 0 10px; color: var(--ink-2); font-size: 15px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.status { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 14px; }
.status.ok { color: var(--watch); }
.status.off { color: var(--accent); }
label.f { display: grid; gap: 6px; font-size: 14px; font-weight: 500; margin: 10px 0; }
label.f input, label.f textarea { border-radius: 10px; border: 1px solid var(--line); background: var(--bg); padding: 10px 12px; }
textarea { min-height: 90px; resize: vertical; }
.runs { font: 12.5px/1.5 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; background: var(--surface-2); border-radius: 10px; padding: 12px; max-height: 320px; overflow: auto; color: var(--ink-2); }
.run-row { display: flex; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.run-row:last-child { border-bottom: 0; }
ol.steps { margin: 6px 0 10px; padding-left: 20px; color: var(--ink-2); font-size: 15px; }

/* Login */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-card .brand { justify-content: center; font-size: 34px; margin-bottom: 8px; }
.login-card .brand-mark { width: 44px; height: 44px; border-radius: 13px; }
.login-card .brand-mark svg { width: 20px; height: 20px; }
.login-card p { color: var(--ink-2); margin: 0 0 24px; }
.login-card input { width: 100%; height: 52px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); padding: 0 16px; text-align: center; font-size: 17px; letter-spacing: .04em; margin-bottom: 10px; }
.login-card .btn { width: 100%; height: 52px; }
.shake { animation: shake .4s var(--ease); }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-size: 14px; font-weight: 500; opacity: 0; transition: opacity .25s, transform .35s var(--ease); pointer-events: none; z-index: 20; max-width: calc(100% - 32px); }
.toast.on { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 640px) {
  .hero { grid-template-columns: 1fr; }
  .stats-mini { grid-template-columns: 1fr 1fr; grid-template-rows: none; }
  .stat-value { font-size: 38px; }
  .d-title { font-size: 25px; }
  .grid { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
