:root {
  --bg: #0B0D11; --surface: #161A21; --raised: #1E232C; --text: #F5F7FA; --muted: #9AA3B2; --subtle: #6B7280;
  --line: rgba(255,255,255,0.10); --fill: rgba(255,255,255,0.08); --red: #E5484D; --match: #FFC965;
  --serif: ui-serif, "New York", "Iowan Old Style", Charter, Georgia, serif;
  --sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Helvetica Neue", Arial, sans-serif;
  --page: #EDEBE6; --ink: #16171A; --ink-2: #4B4E55;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --page: #08090B; --ink: #ECEDEF; --ink-2: #A9ADB5; } }
:root[data-theme="dark"] { --page: #08090B; --ink: #ECEDEF; --ink-2: #A9ADB5; }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { background: var(--page); font: 16px/1.4 var(--sans); color: var(--ink); }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
a { color: inherit; }

/* Desktop: a phone-sized window beside a short explanation */
.stage { min-height: 100%; display: flex; align-items: center; justify-content: center; gap: 64px; padding: 24px; }
.about { max-width: 330px; color: var(--ink-2); font-size: 15px; line-height: 1.55; }
.about .kicker { font-size: 13px; color: var(--ink-2); margin: 0 0 10px; opacity: .8; }
.about h1 { font: 600 34px/1.08 var(--serif); color: var(--ink); margin: 0 0 16px; letter-spacing: -0.015em; }
.about .try { color: var(--ink); font-weight: 600; margin: 22px 0 6px; }
.about ul { padding-left: 18px; margin: 0; }
.about li { margin: 5px 0; }
.about .back { margin-top: 26px; }
.device { width: 402px; height: min(874px, calc(100vh - 48px)); padding: 6px; border-radius: 56px; background: #1A1B1F;
          box-shadow: 0 0 0 1px #3A3B40, 0 30px 60px -25px rgba(0,0,0,.55); flex: none; }
.app { position: relative; width: 100%; height: 100%; border-radius: 50px; overflow: hidden; background: var(--bg); color: var(--text); isolation: isolate; }
.statusbar { position: absolute; z-index: 30; top: 0; left: 0; right: 0; height: 50px; display: flex; align-items: center; justify-content: space-between; padding: 4px 30px 0 44px; pointer-events: none; color: var(--text); fill: currentColor; background: rgba(11,13,17,.94); }
.statusbar .clock { font: 600 16px var(--sans); width: 54px; }
.statusbar .island { position: absolute; left: 50%; top: 11px; width: 120px; height: 34px; margin-left: -60px; border-radius: 20px; background: #000; }
.view { position: absolute; inset: 0; overflow-y: auto; overflow-x: hidden; padding-top: 50px; padding-bottom: 110px; scrollbar-width: none; outline: none; }
.view::-webkit-scrollbar { display: none; }
.view.no-tabs { padding-bottom: 40px; }

/* Phone: the app is the page */
@media (max-width: 760px) {
  body { background: var(--bg); }
  .stage { display: block; padding: 0; }
  .about { display: none; }
  .device { width: 100%; height: 100dvh; padding: 0; border-radius: 0; box-shadow: none; background: var(--bg); }
  .app { border-radius: 0; }
  .statusbar { display: none; }
  .view { padding-top: env(safe-area-inset-top, 12px); }
}
.embedded body { background: #000; }
.embedded .stage { display: block; padding: 0; }
.embedded .about { display: none; }
.embedded .device { width: 100%; height: 100vh; padding: 0; border-radius: 0; box-shadow: none; }
.embedded .app { border-radius: 0; }

/* Type */
.serif { font-family: var(--serif); }
.large-title { font: 600 34px/1.1 var(--serif); letter-spacing: -0.015em; margin: 6px 20px 4px; }
.caption { font-size: 14px; color: var(--muted); margin: 0 20px; }
.section-label { font-size: 15px; font-weight: 600; color: var(--muted); margin: 28px 20px 10px; }
.section-head { display: flex; justify-content: space-between; align-items: baseline; margin: 34px 20px 4px; }
.section-head h2 { font: 650 17px var(--sans); margin: 0; }
.section-head a, .section-head button { font-size: 15px; color: var(--muted); text-decoration: none; }
mark { background: none; color: var(--match); }

/* Header bits */
.topbar { display: flex; align-items: center; justify-content: space-between; height: 52px; padding: 0 12px 0 18px; }
.topbar img.logo { height: 30px; width: auto; display: block; }
.icon-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 22px; }
.icon-btn:active { background: var(--fill); }
.navbar { display: flex; align-items: center; height: 48px; padding: 0 8px; }
.back { display: flex; align-items: center; gap: 2px; height: 44px; padding: 0 10px 0 4px; font-size: 17px; }
.back svg { width: 22px; height: 22px; }

/* Search */
.field { display: flex; align-items: center; gap: 10px; height: 42px; margin: 8px 20px; padding: 0 12px 0 14px; border-radius: 12px; background: var(--fill); }
.field svg { flex: none; color: var(--muted); }
.field input { flex: 1; min-width: 0; height: 100%; border: 0; background: none; color: var(--text); font: 16px var(--sans); outline: none; }
.field input::placeholder { color: var(--subtle); }
.field .clear { width: 28px; height: 28px; display: grid; place-items: center; }
.searchbar { display: flex; align-items: center; padding: 0 0 0 4px; }
.searchbar .field { flex: 1; margin-left: 0; }
.access-line { margin: 12px 20px 0; font-size: 14.5px; color: var(--muted); display: flex; align-items: center; gap: 5px; min-height: 30px; }
.access-line a { color: var(--text); font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.menus { display: flex; gap: 20px; padding: 8px 20px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.menus button { display: inline-flex; align-items: center; gap: 6px; font-size: 15px; font-weight: 500; white-space: nowrap; min-height: 32px; }
.menus button.on { color: var(--match); }
.menus svg { color: var(--muted); }
.result-head { display: flex; justify-content: space-between; align-items: center; margin: 16px 20px 0; font-size: 15px; }
.result-head b { font-weight: 600; }
.result-head span { color: var(--muted); }

/* Hero (continue watching) */
.hero { display: block; margin: 0 20px; text-decoration: none; }
.hero .still { position: relative; aspect-ratio: 16 / 9; border-radius: 12px; overflow: hidden; background: var(--surface); }
.hero .still img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .play { position: absolute; left: 12px; bottom: 12px; width: 40px; height: 40px; border-radius: 20px; background: rgba(0,0,0,.55); display: grid; place-items: center; }
.hero h3 { font: 600 24px/1.2 var(--serif); margin: 16px 0 14px; letter-spacing: -0.005em; }
.stepline { font-size: 14px; margin-top: 10px; color: var(--muted); }
.stepline b { color: var(--text); font-weight: 600; margin-right: 4px; }

/* Step ribbon */
.ribbon { display: flex; gap: 3px; height: 5px; }
.ribbon i { display: block; height: 100%; border-radius: 3px; background: rgba(255,255,255,.2); position: relative; overflow: hidden; }
.ribbon i b { position: absolute; inset: 0 auto 0 0; background: var(--red); border-radius: 3px; }
.ribbon i.hit { background: var(--match); }
.ribbon.thin { height: 4px; }

/* Contents-page rows */
.toc { list-style: none; margin: 0; padding: 0; }
.toc > li { border-bottom: 1px solid var(--line); margin-left: 20px; }
.row { display: grid; grid-template-columns: 1fr 104px; gap: 14px; padding: 14px 20px 16px 0; text-decoration: none; color: inherit; }
.no-thumbs .row { grid-template-columns: 1fr; }
.no-thumbs .row .thumb, .no-thumbs .hero .still { display: none; }
.row h4 { font: 600 17px/1.3 var(--serif); margin: 0; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.row.long h4 { -webkit-line-clamp: 4; }
.row .meta { font-size: 13px; color: var(--muted); margin-top: 7px; }
.row .thumb { width: 104px; height: 58px; border-radius: 6px; object-fit: cover; background: var(--surface); margin-top: 3px; }
.row .free { color: #7BE3B0; }
.hits { padding: 0 20px 14px 0; margin-top: -6px; }
.hits .ribbon { margin-bottom: 8px; }
.hits a { display: grid; grid-template-columns: 16px 1fr auto; gap: 6px; font-size: 13.5px; color: #C9CED8; text-decoration: none; padding: 3px 0; min-height: 26px; align-items: center; }
.hits a .n { font-family: var(--serif); color: var(--subtle); }
.hits a span:nth-child(2) { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hits a .t { color: var(--muted); font-size: 13px; }
.more-note { font-size: 13px; color: var(--subtle); margin: 16px 20px; }

/* Sections */
.spec-list { list-style: none; margin: 10px 0 0; padding: 0; }
.spec-list li { border-top: 1px solid var(--line); margin-left: 20px; }
.spec-list a { display: flex; justify-content: space-between; align-items: center; padding: 14px 20px 14px 0; text-decoration: none; min-height: 60px; }
.spec-list .name { font: 600 19px/1.2 var(--serif); }
.spec-list .count { font-size: 13.5px; color: var(--muted); margin-top: 3px; }
.index2 { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 0 20px; border-bottom: 1px solid var(--line); }
.index2 button { text-align: left; font-size: 14.5px; font-weight: 500; padding: 9px 8px 9px 0; border-top: 1px solid var(--line); min-height: 40px; }

/* Article */
.player-wrap { margin-top: -50px; padding-top: 50px; background: #000; }
.player { position: relative; aspect-ratio: 16 / 9; background: #000; }
@media (max-width: 760px) { .player-wrap { margin-top: calc(-1 * env(safe-area-inset-top, 12px)); padding-top: env(safe-area-inset-top, 12px); } }
.embedded .player-wrap { margin-top: -50px; padding-top: 50px; }
.player img { width: 100%; height: 100%; object-fit: cover; display: block; }
.player .shade { position: absolute; inset: auto 0 0 0; height: 96px; background: linear-gradient(transparent, rgba(0,0,0,.7) 50%, rgba(0,0,0,.92)); }
.player .collapse { position: absolute; left: 12px; top: 10px; width: 36px; height: 36px; border-radius: 18px; background: rgba(0,0,0,.45); display: grid; place-items: center; }
.player .controls { position: absolute; left: 16px; right: 16px; bottom: 26px; display: flex; align-items: center; gap: 12px; color: #fff; font-size: 13px; font-weight: 600; }
.player .controls .time span { color: rgba(255,255,255,.6); }
.player .controls .gap { flex: 1; }
.player .controls button { width: 32px; height: 32px; display: grid; place-items: center; }
.player .scrub { position: absolute; left: 20px; right: 20px; bottom: 11px; }
.player .head { position: absolute; top: 50%; width: 13px; height: 13px; margin: -6.5px 0 0 -6.5px; border-radius: 50%; background: #fff; }
.art-head { padding: 26px 20px 0; }
.kick { font-size: 13px; font-weight: 600; color: var(--muted); }
.art-head h1 { font: 600 26px/1.2 var(--serif); letter-spacing: -0.01em; margin: 10px 0 14px; }
.byline { font-size: 15px; font-weight: 600; }
.byline .more { color: var(--muted); font-weight: 400; }
.inst { font-size: 14px; color: var(--muted); margin-top: 3px; }
.cite-line { font-size: 13px; color: var(--subtle); margin-top: 6px; }
.access { margin: 16px 20px 0; font-size: 14px; color: var(--muted); }
.access a { color: var(--text); font-weight: 600; text-decoration: none; }
.actions { display: flex; gap: clamp(16px, 5vw, 26px); padding: 10px 20px 0; border-bottom: 1px solid var(--line); }
.actions button { display: inline-flex; align-items: center; gap: 7px; font-size: 15px; font-weight: 500; min-height: 48px; }
.actions button.on { color: var(--text); font-weight: 600; }
.proc-head { display: flex; justify-content: space-between; align-items: flex-start; margin: 28px 20px 6px; }
.proc-head h2 { font: 700 20px var(--sans); margin: 0; letter-spacing: -0.01em; }
.proc-head .count { font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.seg { display: inline-flex; padding: 3px; border-radius: 9px; background: rgba(255,255,255,.07); }
.seg button { font-size: 13px; font-weight: 500; color: var(--muted); padding: 5px 12px; border-radius: 7px; min-height: 28px; }
.seg button[aria-pressed="true"] { background: rgba(255,255,255,.16); color: var(--text); font-weight: 600; }
.seg.wide { display: flex; margin: 14px 20px 0; }
.seg.wide button { flex: 1; font-size: 14px; padding: 7px 0; }
.steps { list-style: none; margin: 0; padding: 0; }
.steps li { margin-left: 20px; }
.steps button { width: 100%; display: grid; grid-template-columns: 34px 1fr auto; gap: 2px; text-align: left; padding: 13px 20px 13px 0; border-bottom: 1px solid var(--line); margin-left: 0; }
.steps li:last-child button { border-bottom: 0; }
.steps .n { font: 600 20px/1.1 var(--serif); color: var(--subtle); }
.steps .name { font-size: 16px; line-height: 1.32; }
.steps .t { font-size: 14px; color: var(--muted); padding-left: 10px; font-variant-numeric: tabular-nums; }
.steps .cur .n, .steps .cur .t { color: var(--red); }
.steps .cur .name { font-weight: 600; }
.steps .bar { grid-column: 2 / 4; height: 3px; border-radius: 2px; background: rgba(255,255,255,.14); margin-top: 10px; overflow: hidden; }
.steps .bar b { display: block; height: 100%; background: var(--red); }
.abstract { margin: 30px 20px 0; }
.abstract h2 { font: 650 17px var(--sans); margin: 0 0 10px; }
.abstract p { font: 16px/1.5 var(--serif); color: #C9CED8; margin: 0; }
.abstract.clamped p { display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
.abstract button { color: var(--text); font-weight: 600; font-size: 15px; margin-top: 8px; min-height: 36px; }

/* Lists in Settings, Paywall, Library */
.group { list-style: none; margin: 0; padding: 0; }
.group li { margin-left: 20px; border-bottom: 1px solid var(--line); }
.group li:first-child { border-top: 1px solid var(--line); }
.group a, .group button, .group label { display: flex; align-items: center; gap: 14px; width: 100%; min-height: 56px; padding: 10px 20px 10px 0; text-decoration: none; text-align: left; }
.group .ic { flex: none; width: 22px; display: grid; place-items: center; color: var(--text); }
.group .tx { flex: 1; min-width: 0; }
.group .tx b { display: block; font-weight: 500; font-size: 16px; }
.group .tx span { display: block; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.group .end { color: var(--muted); font-size: 15px; display: flex; align-items: center; gap: 6px; }
.profile { display: flex; align-items: center; gap: 14px; margin: 18px 20px 22px; }
.profile .av { width: 56px; height: 56px; border-radius: 28px; background: var(--raised); display: grid; place-items: center; font: 600 20px var(--serif); }
.profile b { display: block; font-size: 18px; font-weight: 600; }
.profile span { font-size: 14px; color: var(--muted); }
.switch { width: 51px; height: 31px; border-radius: 16px; background: rgba(255,255,255,.2); position: relative; flex: none; transition: background .2s; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; transition: transform .2s; }
.switch.on { background: #34C759; }
.switch.on::after { transform: translateX(20px); }
@media (prefers-reduced-motion: reduce) { .switch, .switch::after { transition: none; } }
.empty { margin: 60px 32px; text-align: center; color: var(--muted); }
.empty h3 { font: 600 21px var(--serif); color: var(--text); margin: 0 0 8px; }
.empty p { margin: 0 0 18px; font-size: 15px; line-height: 1.45; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 50px; padding: 0 20px; border-radius: 14px; background: var(--text); color: var(--bg); font-weight: 650; font-size: 17px; text-decoration: none; }
.btn.block { display: flex; width: calc(100% - 40px); margin: 22px 20px 0; }
.btn.quiet { background: var(--fill); color: var(--text); }
.fine { font-size: 12.5px; color: var(--subtle); margin: 12px 20px 0; line-height: 1.4; }
.plans { list-style: none; margin: 22px 0 0; padding: 0; border-top: 1px solid var(--line); }
.plans li { margin-left: 20px; border-bottom: 1px solid var(--line); }
.plans button { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 14px 20px 14px 0; min-height: 70px; }
.radio { width: 22px; height: 22px; border-radius: 11px; border: 1.6px solid var(--muted); flex: none; display: grid; place-items: center; }
[aria-checked="true"] .radio { background: var(--text); border-color: var(--text); color: var(--bg); }
.plans .tx { flex: 1; }
.plans .tx b { display: block; font-size: 17px; font-weight: 600; }
.plans .tx span { font-size: 13.5px; color: var(--muted); }
.plans .pr { text-align: right; }
.plans .pr b { display: block; font-size: 19px; font-weight: 600; }
.plans .pr span { font-size: 13px; color: var(--muted); }
.legal { display: flex; gap: 20px; margin: 22px 20px; font-size: 13.5px; color: var(--muted); }
.notif { display: block; padding: 14px 20px 14px 0; text-decoration: none; }
.notif .when { font-size: 13px; color: var(--muted); }
.notif h4 { font: 600 17px/1.3 var(--serif); margin: 4px 0 0; }
.notif .dot { display: inline-block; width: 8px; height: 8px; border-radius: 4px; background: var(--red); margin-right: 6px; vertical-align: 1px; }

/* Tab bar */
.tabbar { position: absolute; z-index: 20; left: 16px; right: 16px; bottom: max(16px, env(safe-area-inset-bottom)); height: 62px; display: grid; grid-template-columns: repeat(4, 1fr);
          padding: 6px; border-radius: 31px; background: rgba(28,32,40,.94); box-shadow: 0 0 0 1px rgba(255,255,255,.14); }
.tabbar::before { content: ""; position: absolute; z-index: -1; left: -16px; right: -16px; bottom: -40px; height: 150px; background: linear-gradient(transparent, rgba(11,13,17,.92) 55%, var(--bg)); pointer-events: none; }
.tabbar button { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border-radius: 26px; color: var(--muted); font-size: 11px; font-weight: 500; }
.tabbar button[aria-current="page"] { background: rgba(255,255,255,.12); color: var(--text); font-weight: 600; }
.tabbar[hidden] { display: none; }

/* Sheets and toasts */
.sheet-layer { position: absolute; z-index: 40; inset: 0; background: rgba(0,0,0,.5); display: flex; align-items: flex-end; }
.sheet-layer[hidden] { display: none; }
.sheet { width: 100%; max-height: 85%; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; padding: 10px 0 34px; }
.sheet .grab { width: 38px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.25); margin: 0 auto 10px; }
.sheet .sheet-head { display: flex; justify-content: space-between; align-items: center; padding: 4px 12px 8px 20px; }
.sheet h2 { font: 650 18px var(--sans); margin: 0; }
.sheet .opt { display: flex; justify-content: space-between; align-items: center; width: 100%; min-height: 50px; padding: 0 20px; border-top: 1px solid var(--line); text-align: left; font-size: 16px; }
.sheet .opt span { color: var(--muted); font-size: 14px; }
.sheet .opt[aria-checked="true"] { color: var(--match); }
.sheet .body { padding: 0 20px; color: var(--muted); font-size: 15px; line-height: 1.45; }
.sheet .citation { font: 15px/1.5 var(--serif); color: var(--text); background: var(--raised); border-radius: 12px; padding: 14px; margin: 6px 20px 0; }
.scale { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin: 8px 20px 14px; }
.scale button { height: 40px; border-radius: 8px; background: var(--fill); font-weight: 600; }
.scale button[aria-pressed="true"] { background: var(--text); color: var(--bg); }
textarea, .sheet input[type=email] { width: calc(100% - 40px); margin: 0 20px; background: var(--fill); border: 0; border-radius: 12px; color: var(--text); font: 16px var(--sans); padding: 12px 14px; outline: none; }
textarea { min-height: 96px; resize: none; }
.toast { position: absolute; z-index: 50; left: 50%; bottom: 100px; transform: translate(-50%, 20px); max-width: calc(100% - 40px); width: max-content; background: var(--text); color: var(--bg); font-size: 14px; font-weight: 500; padding: 10px 16px; border-radius: 12px; opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.inst-list { font-size: 14px; color: var(--muted); margin: 14px 20px 0; line-height: 1.6; }

/* Screenshot mode: a status bar like the mockups, whatever the width */
.capture .statusbar { display: flex; }
.capture .view { padding-top: 50px; }
.capture .player-wrap { margin-top: -50px; padding-top: 50px; }
.capture .toast { display: none; }
