:root {
  --ink: #172c40; --muted: #607286; --blue: #2864e9; --pale: #edf3ff;
  --line: #e1e8f0; --bg: #f6f8fc; --green: #23765f; --sidebar: 232px;
  --mobile-bar: 64px; --bottom-bar: 68px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans TC", Arial, sans-serif;
  color: var(--ink); font-synthesis: none; -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--mobile-bar) + env(safe-area-inset-top) + 16px); }
body { margin: 0; background: var(--bg); font-size: 15px; line-height: 1.7; }
body.modal-open { position: fixed; top: var(--page-scroll-offset, 0); width: 100%; overflow: hidden; }
button, input, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button { cursor: pointer; min-height: 44px; min-width: 44px; }
button:disabled { cursor: wait; opacity: .55; }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid #81a8ff; outline-offset: 3px; }
input, select { border: 1px solid #ced9e5; border-radius: 12px; background: white; color: var(--ink); padding: 11px 12px; min-width: 0; min-height: 48px; font-size: 16px; }
input::placeholder { color: #718095; opacity: 1; }
select { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 28px; letter-spacing: -.7px; line-height: 1.4; }
h2 { font-size: 22px; line-height: 1.5; }
h3 { line-height: 1.55; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; color: var(--muted); margin-bottom: 10px; }
.icon-definitions { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.icon { width: 22px; height: 22px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.primary, .button { border: 0; border-radius: 12px; font-weight: 600; padding: 11px 16px; transition: background .15s; line-height: 1.5; }
.primary { background: var(--blue); color: white; box-shadow: 0 3px 8px #2864e914; }
.primary:hover { background: #1854d6; }
.button { background: white; border: 1px solid var(--line); color: #415972; }
.button:hover { background: #f0f5ff; color: var(--blue); }
.small { font-size: 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-size: 15px; font-weight: 750; white-space: nowrap; color: inherit; letter-spacing: 1px; }
.brand:hover { text-decoration: none; }
.brand-light { font-weight: 450; font-size: 12px; }
.brand-mark { background: var(--blue); color: white; border-radius: 9px; width: 34px; height: 34px; display: grid; place-items: center; font-size: 28px; font-weight: 450; line-height: 1; flex-shrink: 0; }
.live-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #2a9a7f; margin-right: 8px; }
.accent { color: var(--blue); }
.icon-button { display: grid; place-items: center; width: 44px; height: 44px; padding: 0; background: #f0f4fa; border: 0; border-radius: 14px; color: #415a76; flex-shrink: 0; }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 0; background: transparent; color: var(--blue); padding: 0 0 0 8px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.text-button .icon { width: 17px; height: 17px; }

/* Unlock remains scrollable when the on-screen keyboard reduces the viewport. */
.lock-screen { min-height: 100svh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 24px; position: relative; overflow: hidden; background: #f0f5fd; padding: calc(28px + env(safe-area-inset-top)) 20px calc(24px + env(safe-area-inset-bottom)); }
.unlock-card { position: relative; z-index: 2; width: 470px; max-width: 100%; background: #fffffffa; border: 1px solid #fff; box-shadow: 0 25px 100px #2242660b; padding: 28px 24px; border-radius: 24px; }
.lock-brand { margin-bottom: 32px; }
.unlock-card .eyebrow { font-size: 10px; line-height: 1.8; }
.unlock-card h1 { font-size: clamp(23px, 6vw, 28px); letter-spacing: -.9px; margin-bottom: 16px; }
.lock-intro { color: var(--muted); font-size: 15px; line-height: 1.9; margin-bottom: 28px; }
.unlock-card label, .settings-dialog form > label { display: block; font-size: 14px; font-weight: 650; margin-bottom: 9px; }
.password-wrap { position: relative; }
.password-wrap input { width: 100%; height: 54px; padding-right: 64px; background: #fafcfe; }
.password-wrap button { position: absolute; right: 5px; top: 5px; padding: 0 8px; border: 0; background: transparent; color: #4d6380; font-size: 14px; }
.unlock-button { width: 100%; display: flex; justify-content: space-between; align-items: center; height: 52px; }
.error { font-size: 14px; color: #ac3636; min-height: 24px; margin: 8px 0; }
.lock-languages { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; font-size: 12px; color: #5d718a; margin-top: 26px; }
.lock-languages i { font-style: normal; color: #a6b4c3; }
.lock-footer { position: relative; text-align: center; font-size: 11px; letter-spacing: 1px; color: #617890; margin: 0; }
.lock-footer span { display: block; font-size: 12px; letter-spacing: .5px; margin-top: 4px; }
.lock-art { position: absolute; inset: 0; pointer-events: none; }
.orbit { position: absolute; width: 800px; height: 800px; border: 1px solid #dce6f2; border-radius: 50%; left: calc(50% - 400px); top: calc(50% - 400px); }
.orbit.two { width: 1040px; height: 1040px; left: calc(50% - 520px); top: calc(50% - 520px); }
.orbit.three { width: 1280px; height: 1280px; left: calc(50% - 640px); top: calc(50% - 640px); }
.lock-art svg { position: absolute; width: 700px; right: -170px; bottom: 100px; fill: none; stroke: #2864e925; stroke-width: 2; }
.lock-art circle { fill: #c4d7fa; stroke: none; }
.art-label { display: none; }

/* Mobile navigation uses persistent, labelled targets within thumb reach. */
.workspace { min-height: 100svh; }
.sidebar, .topbar, .explorer-bar { display: none; }
.mobile-header { position: sticky; top: 0; z-index: 20; padding-top: env(safe-area-inset-top); background: #ffffffed; border-bottom: 1px solid var(--line); backdrop-filter: blur(16px); }
.mobile-header-inner { height: var(--mobile-bar); max-width: 960px; margin: auto; padding: 0 max(16px, env(safe-area-inset-right)) 0 max(16px, env(safe-area-inset-left)); display: flex; align-items: center; gap: 10px; }
.mobile-brand { min-height: 44px; gap: 8px; font-size: 14px; }
.mobile-brand > span:last-child { line-height: 1.1; }
.mobile-brand small { display: block; color: #6f8196; font-size: 9px; letter-spacing: 2px; margin-top: 5px; }
.mobile-brand .brand-mark { width: 30px; height: 30px; font-size: 25px; }
.language-switch { margin-left: auto; max-width: 156px; min-width: 80px; display: flex; align-items: center; justify-content: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 13px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 600; }
.language-switch span { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.language-switch .icon { width: 18px; height: 18px; }
.mobile-nav { position: fixed; z-index: 25; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); background: #fffffff5; backdrop-filter: blur(16px); border-top: 1px solid var(--line); padding: 4px max(8px, env(safe-area-inset-right)) max(4px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left)); }
.mobile-nav button { height: 60px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; border-radius: 14px; background: transparent; color: #607286; min-width: 0; font-size: 12px; font-weight: 500; white-space: nowrap; }
.mobile-nav button.active { color: var(--blue); background: #edf3ff; font-weight: 700; }
.mobile-nav .icon { width: 21px; height: 21px; }
.main { min-width: 0; }
.content { max-width: 960px; margin: 0 auto; padding: 24px max(16px, env(safe-area-inset-right)) calc(var(--bottom-bar) + env(safe-area-inset-bottom) + 24px) max(16px, env(safe-area-inset-left)); }
.intro { margin-bottom: 18px; }
.intro .eyebrow { font-size: 10px; letter-spacing: 1px; margin-bottom: 7px; }
.intro h1 { font-size: clamp(21px, 5.6vw, 27px); line-height: 1.5; margin-bottom: 7px; }
.intro-sub { display: none; }
.edition-dot { margin: 0 5px; color: #9eafc2; }
.mobile-updated { font-size: 12px; color: var(--muted); margin: 0; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); background: #fff; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; margin-bottom: 16px; }
.stats > div { min-width: 0; padding: 13px 16px 11px; }
.stats > div:first-child { border-right: 1px solid var(--line); }
.stats span { display: block; color: #607286; font-size: 12px; }
.stats strong { display: block; color: var(--ink); font-size: 28px; line-height: 1.35; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats small { display: none; }
.stats > div:nth-child(n+3) { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 9px 16px; border-top: 1px solid var(--line); background: #fbfcfe; }
.stats > div:nth-child(n+3) strong { font-size: 13px; color: #526c88; font-weight: 600; }
.stats > div:nth-child(n+3) span { font-size: 11px; }
.digest { border: 1px solid #d9e4fa; border-radius: 16px; padding: 0 16px 12px; background: linear-gradient(105deg, #edf3ff, #f7faff); margin-bottom: 22px; min-width: 0; }
.digest-heading { display: flex; align-items: center; min-height: 44px; gap: 8px; }
.digest-label { font-size: 13px; font-weight: 650; color: #3c62a4; white-space: nowrap; }
.digest-label span { margin-right: 4px; }
.digest-engine { display: none; font-size: 10px; color: #526d94; }
#digest-toggle { margin-left: auto; }
#digest-toggle[aria-expanded=true] .icon { transform: rotate(180deg); }
.digest-copy { min-width: 0; }
.digest p { margin: 0; font-size: 14px; line-height: 1.8; color: #4e6582; overflow-wrap: anywhere; }
.digest:not(.expanded) #digest-text { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.digest-copy small { display: none; font-size: 12px; line-height: 1.7; color: #607592; margin-top: 10px; }
.digest.expanded .digest-copy small { display: block; }
.explorer { scroll-margin-top: calc(var(--mobile-bar) + env(safe-area-inset-top) + 14px); }
.mobile-section-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.mobile-section-heading h2 { font-size: 19px; margin: 0; }
.mobile-section-heading > span { font-size: 12px; color: #647891; }
.filters { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; }
.search-wrap { position: relative; flex: 1; min-width: 0; }
.search-wrap > span { position: absolute; left: 12px; top: 4px; font-size: 25px; color: #617c98; pointer-events: none; }
.search-wrap input { width: 100%; height: 48px; padding: 10px 10px 10px 37px; font-size: 16px; }
.filter-button { display: flex; align-items: center; justify-content: center; gap: 6px; height: 48px; flex-shrink: 0; font-size: 13px; padding: 8px 10px; position: relative; }
.filter-button .icon { width: 18px; height: 18px; }
.filter-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--blue); position: absolute; right: 7px; top: 6px; }
.active-filters { font-size: 12px; color: #355c9e; margin: -5px 0 16px; overflow-wrap: anywhere; }
.control-label, .date-control label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 8px; color: #3e5670; }
.source-control, .date-control, .analysis-control { min-width: 0; }
.source-control select, .date-control select, .analysis-control select { width: 100%; }
.analysis-control { display: grid; gap: 10px; }
.analysis-control .control-label { margin-bottom: -2px; }
.analysis-control button { min-height: 48px; }

/* Reading surfaces stay legible at 320px without hiding source evidence. */
.topic-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.topic-card { background: white; border: 1px solid var(--line); border-radius: 18px; padding: 19px 18px 10px; display: flex; flex-direction: column; min-width: 0; text-align: left; }
.card-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; }
.category { font-size: 12px; color: #5a7090; }
.card-index { font-size: 12px; color: #7388a4; font-variant-numeric: tabular-nums; }
.topic-card h3 { font-size: 18px; margin: 0 0 10px; font-weight: 650; line-height: 1.55; overflow-wrap: anywhere; }
.topic-card .summary { font-size: 15px; line-height: 1.8; color: #5e7288; margin-bottom: 14px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.keyword-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; min-width: 0; }
.chip { font-size: 12px; line-height: 1.6; background: #f1f5fb; color: #536d8a; padding: 4px 8px; border-radius: 7px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-foot { margin-top: auto; border-top: 1px solid #e8eef5; padding-top: 6px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.source-pill { font-size: 11px; color: #657a91; }
.status-pill { padding: 4px 7px; border-radius: 6px; font-size: 11px; background: #f0f4f8; color: #5e748a; }
.status-pill.multiple_sources { color: #3d69b0; background: #eef4ff; }
.status-pill.observed_growth { color: #22765d; background: #eaf7f2; }
.read-brief { margin-left: auto; border: 0; background: transparent; color: var(--blue); font-size: 13px; font-weight: 650; padding: 10px 0 10px 8px; min-height: 48px; }
.empty { border: 1px dashed #cbd8e8; border-radius: 16px; padding: 34px 20px; text-align: center; background: #ffffffa0; color: var(--muted); }
.empty-icon { font-size: 30px; color: #5c86cd; }
.empty h3 { font-size: 17px; margin: 12px 0 8px; color: #425d7a; }
.empty p { font-size: 14px; margin: 0 auto; max-width: 500px; }
.empty button { margin-top: 20px; }
.data-list { background: white; border: 1px solid var(--line); border-radius: 16px; overflow: hidden; }
.data-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); align-items: start; gap: 3px 10px; padding: 14px; border-bottom: 1px solid var(--line); min-width: 0; }
.data-row:last-child { border: 0; }
.row-number { font-size: 12px; color: #7489a2; padding-top: 10px; }
.row-body { min-width: 0; }
.row-body h3 { font-size: 15px; margin: 0 0 5px; overflow-wrap: anywhere; }
.row-body h3 a { display: block; color: #315876; padding: 7px 0; min-height: 44px; }
.row-meta { font-size: 12px; color: #657b92; display: flex; gap: 4px 10px; flex-wrap: wrap; overflow-wrap: anywhere; }
.row-metric { grid-column: 2; font-size: 13px; font-weight: 600; color: #456e97; font-variant-numeric: tabular-nums; }
.row-note { font-size: 12px; color: #637a91; margin: 7px 0 0; line-height: 1.8; }
.keyword-view, .health-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.keyword-block, .health-card { background: white; border: 1px solid var(--line); border-radius: 16px; padding: 18px; min-width: 0; }
.keyword-block h3 { font-size: 17px; margin-bottom: 6px; }
.keyword-block > p { font-size: 13px; color: var(--muted); margin-bottom: 14px; }
.keyword-line { min-height: 48px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid #e9eff6; gap: 10px; font-size: 15px; overflow-wrap: anywhere; }
.keyword-line:last-child { border: 0; }
.keyword-line > a { display: flex; align-items: center; flex: 1; min-height: 48px; padding: 10px 0; }
.keyword-line > span { padding: 10px 0; }
.keyword-line small { font-size: 12px; color: #647d98; white-space: nowrap; }
.health-card h3 { font-size: 16px; display: flex; align-items: start; justify-content: space-between; gap: 10px; margin-bottom: 13px; overflow-wrap: anywhere; }
.health-card h3 span:last-child { font-size: 12px; flex-shrink: 0; padding: 3px 0; }
.health-card p { font-size: 14px; color: #5d738b; margin: 6px 0; overflow-wrap: anywhere; }
.health-card a { display: inline-flex; align-items: center; min-height: 44px; font-size: 14px; margin-top: 7px; }
.health-ok { color: var(--green); }
.health-limited { color: #906322; }
.health-error { color: #ac4c49; }
.job-banner { padding: 11px 14px; border: 1px solid #d8e4fa; color: #395f94; background: #eff5ff; border-radius: 12px; margin-bottom: 16px; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.spinner { width: 15px; height: 15px; flex-shrink: 0; border: 2px solid #c6d8f5; border-top-color: #467bd6; border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.page-footer { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 7px; font-size: 12px; color: #657d96; }

/* Native modal sheets: a persistent close control and independent scrolling. */
dialog { position: fixed; inset: auto 0 0; margin: 0 auto; width: 100%; max-width: 680px; max-height: calc(100dvh - env(safe-area-inset-top) - 12px); border: 1px solid var(--line); border-bottom: 0; border-radius: 24px 24px 0 0; padding: 0 20px max(22px, env(safe-area-inset-bottom)); color: var(--ink); background: #fff; box-shadow: 0 -15px 80px #172c4020; overflow-x: hidden; overflow-y: auto; overscroll-behavior-y: contain; scrollbar-gutter: stable; scroll-padding-top: 80px; }
dialog::backdrop { background: #14263e80; backdrop-filter: blur(4px); }
.dialog-head { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 74px; margin: 0 -2px 18px; padding: 14px 0; border-bottom: 1px solid var(--line); background: #fff; }
.dialog-head .eyebrow, .dialog-head h2 { margin: 0; font-size: 16px; line-height: 1.4; letter-spacing: 0; color: #35506d; }
dialog > p { font-size: 14px; }
.detail-title { font-size: 23px; line-height: 1.55; margin-bottom: 12px; overflow-wrap: anywhere; }
.detail-summary { font-size: 16px; color: #526b85; line-height: 1.9; overflow-wrap: anywhere; }
.detail-meta { font-size: 12px; color: #607a96; margin: 15px 0 22px; }
.detail-section { border-top: 1px solid var(--line); padding-top: 21px; margin-top: 22px; overflow-wrap: anywhere; }
.detail-section > h3 { font-size: 17px; margin-bottom: 12px; }
.detail-section > p, .detail-section li { font-size: 15px; line-height: 1.9; color: #526b85; }
.detail-section ul { padding-left: 22px; }
.angles { display: grid; gap: 14px; }
.angle { background: #f4f8fe; border: 1px solid #dde7f6; padding: 17px 16px; border-radius: 14px; min-width: 0; }
.angle h4 { font-size: 15px; color: #38629f; margin: 0 0 10px; }
.angle .hook { font-size: 17px; color: #294b78; margin-bottom: 12px; font-weight: 600; line-height: 1.8; }
.angle ol { padding-left: 20px; margin-bottom: 0; }
.angle li { font-size: 15px; color: #526e8f; margin-top: 8px; }
.evidence-item { padding: 10px 0 15px; border-bottom: 1px solid var(--line); }
.evidence-item a { font-size: 15px; overflow-wrap: anywhere; display: block; padding: 8px 0; min-height: 44px; }
.evidence-item p { font-size: 13px; color: #5e7790; margin: 7px 0; }
.detail-actions { margin-top: 24px; }
.detail-actions button { width: 100%; min-height: 50px; }
.settings-dialog h2 { font-size: 23px; }
.settings-dialog form { margin-top: 24px; }
.settings-dialog select { width: 100%; margin-bottom: 20px; }
.settings-dialog .check-row { display: flex; gap: 11px; align-items: center; min-height: 48px; font-size: 15px; margin-bottom: 18px; }
input[type=checkbox] { min-width: 22px; min-height: 22px; width: 22px; height: 22px; flex-shrink: 0; margin: 0; accent-color: var(--blue); }
fieldset { border: 1px solid var(--line); padding: 12px; border-radius: 14px; margin: 0; min-width: 0; }
legend { font-size: 14px; padding: 0 7px; color: #4c6783; }
.language-checks { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 8px; }
.language-checks label { min-height: 48px; font-size: 14px; color: #425f7d; display: flex; gap: 8px; align-items: center; overflow-wrap: anywhere; }
.settings-note { font-size: 14px; color: #60768e; line-height: 1.9; margin: 18px 0; }
.settings-dialog form > button { width: 100%; min-height: 52px; }
.jobs-title { font-size: 14px; font-weight: 650; color: #506d8b; border-top: 1px solid var(--line); margin-top: 26px; padding-top: 20px; }
.job-item { padding: 12px 0; border-bottom: 1px solid #e7edf5; font-size: 12px; color: #607991; display: flex; justify-content: space-between; gap: 12px; }
.job-item > span:last-child { flex-shrink: 0; }
.mobile-logout { margin-top: 22px; width: 100%; min-height: 48px; }
.language-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.language-choice { padding: 12px; border: 1px solid var(--line); border-radius: 15px; background: white; display: flex; align-items: center; text-align: left; gap: 10px; min-height: 74px; min-width: 0; color: #3d5673; }
.language-choice.active { border-color: #85aaf5; background: var(--pale); color: var(--blue); box-shadow: inset 0 0 0 1px #85aaf5; }
.language-code { width: 29px; height: 29px; flex-shrink: 0; border: 1px solid #dce5f1; border-radius: 8px; display: grid; place-items: center; font-size: 11px; font-weight: 700; background: white; }
.language-text { min-width: 0; flex: 1; }
.language-text strong { font-size: 14px; font-weight: 600; display: block; line-height: 1.5; }
.language-text small { font-size: 11px; color: #657d98; display: block; }
.language-choice .language-count { display: none; }
.filter-fields { display: grid; gap: 18px; }
.filter-analysis, .filter-actions { border-top: 1px solid var(--line); margin-top: 24px; padding-top: 20px; }
.filter-analysis h3, .filter-actions h3 { font-size: 16px; margin-bottom: 8px; }
.filter-analysis > p { font-size: 14px; margin-bottom: 18px; }
#mobile-actions-slot { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
#mobile-actions-slot button { font-size: 14px; min-height: 48px; padding: 10px 8px; }
.sheet-footer { position: sticky; bottom: calc(-1 * max(22px, env(safe-area-inset-bottom))); background: #fff; padding: 16px 0 max(22px, env(safe-area-inset-bottom)); margin-bottom: calc(-1 * max(22px, env(safe-area-inset-bottom))); margin-top: 20px; border-top: 1px solid var(--line); }
.sheet-footer button { width: 100%; min-height: 50px; }
.toast { position: fixed; bottom: calc(var(--bottom-bar) + env(safe-area-inset-bottom) + 16px); left: 50%; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); background: #17344f; color: white; padding: 13px 18px; border-radius: 14px; font-size: 14px; box-shadow: 0 8px 35px #17344f25; z-index: 100; text-align: center; }
dialog .toast { bottom: max(20px, env(safe-area-inset-bottom)); }
.fatal-error { color: #a14141; padding: 24px; text-align: center; }

@media (max-width: 359px) {
  .content { padding-top: 20px; }
  .intro h1 { font-size: 21px; }
  .stats > div { padding-left: 12px; padding-right: 12px; }
  .stats > div:nth-child(n+3) { padding-left: 12px; padding-right: 12px; }
  .filter-button { padding: 8px; font-size: 12px; gap: 4px; }
  .filter-button .icon { width: 16px; }
  .topic-card { padding-left: 15px; padding-right: 15px; }
  .source-pill { font-size: 10px; }
  .read-brief { font-size: 12px; }
  dialog { padding-left: 16px; padding-right: 16px; }
  .language-choice { padding: 10px; gap: 7px; }
  .language-text strong { font-size: 13px; }
  .language-checks label { font-size: 13px; }
  .unlock-card { padding: 24px 20px; }
}
@media (min-width: 600px) {
  .content { padding-top: 30px; padding-left: 28px; padding-right: 28px; }
  .topic-grid, .keyword-view, .health-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .stats > div, .stats > div:nth-child(n+3) { display: block; border: 0; border-right: 1px solid var(--line); background: white; padding: 17px 18px; }
  .stats > div:last-child { border-right: 0; }
  .stats > div:nth-child(n+3) span { font-size: 12px; }
  .stats > div:nth-child(n+3) strong { font-size: 25px; line-height: 1.5; }
  .stats > div strong { line-height: 1.35; }
  .stats .stat-word { padding-top: 5px; }
  .digest-engine { display: block; margin-left: 8px; }
  .filter-fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .unlock-card { padding: 42px; }
  .language-choices { gap: 12px; }
  .language-choice { min-height: 80px; }
}
@media (min-width: 1024px) {
  html { scroll-padding-top: 20px; }
  .mobile-header, .mobile-nav, .mobile-updated, .mobile-section-heading, #mobile-filter-button, #digest-toggle, .mobile-logout { display: none; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #fff; border-right: 1px solid var(--line); padding: 30px 18px 22px; display: flex; flex-direction: column; z-index: 10; overflow-y: auto; }
  .sidebar .brand { margin: 0 6px 35px; }
  .sidebar-heading { font-size: 11px; letter-spacing: 1.5px; color: #627a92; padding: 0 12px; margin-bottom: 14px; display: flex; justify-content: space-between; }
  #languages { display: flex; flex-direction: column; gap: 5px; }
  .language-item { border: 0; border-radius: 12px; background: transparent; display: flex; align-items: center; text-align: left; padding: 11px 10px; color: #526c87; gap: 10px; width: 100%; min-height: 59px; }
  .language-item:hover { background: #f3f7fd; }
  .language-item.active { background: var(--pale); color: var(--blue); }
  .language-count { font-size: 11px; color: #607c99; font-variant-numeric: tabular-nums; }
  .sidebar-bottom { margin-top: auto; padding-top: 24px; }
  .daily-note { border-top: 1px solid var(--line); padding: 20px 10px 12px; }
  .daily-note strong { font-size: 12px; font-weight: 600; }
  .daily-note p { font-size: 12px; color: #677f96; margin: 6px 0 0 15px; }
  .sidebar-button { border: 0; background: transparent; padding: 11px 12px; color: #4f6882; display: flex; gap: 10px; align-items: center; width: 100%; border-radius: 9px; }
  .sidebar-button span { font-size: 13px; }
  .sidebar-button:hover { background: var(--bg); }
  .main { margin-left: var(--sidebar); }
  .topbar { min-height: 76px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 12px 32px; background: #ffffffb3; gap: 14px; }
  .breadcrumb, .slash { font-size: 13px; color: #667f99; }
  .slash { margin: 0 12px; }
  .topbar strong { font-size: 14px; font-weight: 600; }
  .top-actions { display: flex; align-items: center; gap: 18px; }
  .updated { font-size: 12px; color: #627b94; }
  .content { max-width: 1550px; padding: 32px 32px 24px; }
  .intro { display: flex; justify-content: space-between; align-items: center; gap: 24px; margin-bottom: 26px; }
  .intro h1 { font-size: 28px; }
  .intro-sub { display: block; font-size: 14px; color: #637b93; margin: 0; }
  .date-control label { font-size: 12px; font-weight: 500; margin-bottom: 5px; }
  .date-control select { min-width: 160px; font-size: 14px; }
  .stats { margin-bottom: 22px; }
  .stats > div, .stats > div:nth-child(n+3) { padding: 20px; }
  .stats strong, .stats > div:nth-child(n+3) strong { font-size: 30px; }
  .stats > div .stat-word { font-size: 22px; min-height: 45px; }
  .stats small { display: block; font-size: 11px; color: #637c93; margin-top: 6px; }
  .digest { padding: 12px 22px 18px; margin-bottom: 24px; }
  .digest-engine { margin-left: auto; }
  .digest:not(.expanded) #digest-text { display: block; }
  .digest-copy small { display: block; }
  .explorer { scroll-margin-top: 20px; }
  .explorer-bar { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); gap: 14px; }
  .tabs { display: flex; gap: 22px; min-width: 0; }
  .tabs button { border: 0; background: transparent; padding: 16px 0; color: #647b92; font-size: 14px; position: relative; white-space: nowrap; }
  .tabs button.active { color: var(--blue); font-weight: 650; }
  .tabs button.active::after { content: ""; position: absolute; bottom: -1px; left: 0; right: 0; height: 2px; background: var(--blue); }
  .tabs button span { margin-left: 5px; background: #eaf0fc; color: #486eae; padding: 1px 6px; border-radius: 5px; font-size: 11px; }
  .filters { flex-wrap: wrap; gap: 12px; margin: 20px 0; }
  .search-wrap { flex: 1 1 220px; }
  .source-control { flex: 0 1 170px; }
  .source-control select, .analysis-control select { font-size: 14px; }
  .control-label { display: none; }
  .analysis-control { margin-left: auto; display: flex; align-items: center; gap: 8px; }
  .analysis-control select { width: 165px; }
  .analysis-control button { font-size: 14px; white-space: nowrap; }
  .topic-card { padding: 23px 24px 12px; }
  .topic-card h3 { font-size: 19px; }
  .topic-card .summary { font-size: 14px; }
  .data-row { grid-template-columns: 24px minmax(0, 1fr) auto; padding: 16px 20px; gap: 14px; }
  .row-metric { grid-column: 3; padding-top: 9px; }
  .page-footer { flex-direction: row; justify-content: space-between; font-size: 11px; }
  dialog { inset: 0; margin: auto; max-height: min(90dvh, 1000px); border: 1px solid var(--line); border-radius: 22px; padding: 0 32px 30px; }
  .topic-dialog { width: 800px; max-width: calc(100vw - 48px); }
  .settings-dialog, .filters-dialog { width: 570px; }
  .detail-actions { display: flex; justify-content: flex-end; }
  .detail-actions button { width: auto; }
  .toast { bottom: 26px; }
  .art-label { display: block; position: absolute; left: 50px; top: 50%; writing-mode: vertical-rl; font-size: 10px; letter-spacing: 3px; color: #8ea3bf; }
}
@media (min-width: 1440px) {
  :root { --sidebar: 248px; }
  .content { padding: 38px 40px 26px; }
  .topbar { padding-left: 40px; padding-right: 40px; }
  .intro h1 { font-size: 32px; }
  .topic-card { padding: 26px 26px 14px; }
}
@media (max-height: 520px) and (max-width: 1023px) {
  :root { --mobile-bar: 54px; }
  .mobile-nav button { height: 48px; flex-direction: row; gap: 7px; }
  .mobile-nav { --bottom-bar: 56px; }
  .lock-screen { justify-content: flex-start; padding-top: 18px; }
  dialog { max-height: calc(100dvh - 8px); }
}
@media (hover: hover) {
  .topic-card:hover { border-color: #b8ccec; box-shadow: 0 7px 26px #17375a08; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
