@charset "UTF-8";

:root {
  color-scheme: light;
  --background: #F2F2F7;
  --surface: #ffffff;
  --surface-subtle: #EBEBF1;
  --ink: #1C1C1E;
  --muted: #63636D;
  --faint: #64646E;
  --line: #D9D9E1;
  --accent: #3B6484;
  --accent-soft: #E5EBF1;
  --link: var(--accent);
  --button-background: color-mix(in srgb, var(--accent) 14%, var(--surface));
  --button-ink: var(--ink);
  --focus: #355F7D;
  --danger: #974b45;
  --radius: 12px;
  --body-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang TC", "Noto Sans TC", "Microsoft JhengHei", sans-serif;
  --reading-font: "Songti TC", "Noto Serif TC", "Noto Serif CJK TC", "PMingLiU", serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --background: #1C1C1E;
  --surface: #2C2C2E;
  --surface-subtle: #343437;
  --ink: #F2F2F7;
  --muted: #B7B7C0;
  --faint: #A5A5B0;
  --line: #48484C;
  --accent: #A8C4DD;
  --accent-soft: #334553;
  --link: #ACCEE9;
  --focus: #AACDE3;
  --danger: #edaaa1;
}

:root[data-theme="light"][data-palette="ocean"] {
  --background: #EEF7FB;
  --ink: #173348;
  --muted: #5B7486;
  --accent: #157BA9;
  --surface: #FBFDFE;
}
:root[data-theme="light"][data-palette="berry"] {
  --background: #F6F0FB;
  --ink: #392C4D;
  --muted: #725F7D;
  --accent: #7A57A4;
  --surface: #FFFDFF;
}
:root[data-theme="light"][data-palette="forest"] {
  --background: #EFF8F3;
  --ink: #1E4035;
  --muted: #587365;
  --accent: #2D8667;
  --surface: #FCFFFD;
}
:root[data-theme="light"]:is([data-palette="ocean"], [data-palette="berry"], [data-palette="forest"]) {
  --surface-subtle: color-mix(in srgb, var(--accent) 3%, var(--surface));
  --accent-soft: color-mix(in srgb, var(--accent) 9%, var(--surface));
  --line: color-mix(in srgb, var(--ink) 15%, var(--surface));
  --link: color-mix(in srgb, var(--accent) 72%, var(--ink));
  --faint: var(--muted);
  --focus: var(--link);
}

* { box-sizing: border-box; }
html { margin: 0; background: var(--background); -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { margin: 0; color: var(--ink); font-family: var(--body-font); font-size: 16px; line-height: 1.6; overflow: hidden; }
html, body, .app-frame, #app-scroll { touch-action: pan-x pan-y; }
button, input, textarea, select { font: inherit; }
button, a, input, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
button, input, textarea { border-radius: 0; }
button { border: 0; background: none; }
svg { flex: none; vertical-align: middle; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
button:disabled { opacity: .5; cursor: default; }
h1, h2, h3, p { margin: 0; }
ul, ol { padding-left: 1.35em; }
img { display: block; max-width: 100%; }
button, a, input, textarea, summary { touch-action: manipulation; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 4px; }
main:focus { outline: none; }
::selection { background: var(--accent-soft); color: var(--ink); }
.skip-link { position: fixed; top: -100px; left: 12px; z-index: 100; padding: 12px 18px; border-radius: 8px; background: var(--surface); color: var(--link); }
.skip-link:focus { top: calc(8px + env(safe-area-inset-top, 0px)); }

.app-frame { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; height: var(--app-height, 100vh); height: var(--app-height, 100dvh); max-width: 1120px; margin: 0 auto; background: var(--background); }
.app-header { display: grid; grid-template-columns: 44px minmax(0, 1fr) 44px; align-items: center; gap: 8px; min-height: 56px; padding: calc(6px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 6px max(12px, env(safe-area-inset-left, 0px)); background: var(--background); position: relative; z-index: 4; }
.header-leading { min-width: 0; min-height: 44px; }
.header-identity { display: flex; align-items: center; justify-content: flex-start; min-width: 0; }
.app-header:has(#back-link[hidden]) { grid-template-columns: minmax(0, 1fr) 44px; padding-left: max(20px, env(safe-area-inset-left, 0px)); }
.app-header:has(#back-link[hidden]) .header-leading { display: none; }
.app-header:has(#back-link:not([hidden])) .header-identity { justify-content: center; }
.app-header:has(#back-link:not([hidden])) .wordmark { display: none; }
.app-header:has(#back-link:not([hidden])) #screen-title { position: static; width: auto; height: auto; margin: 0; clip: auto; overflow: visible; white-space: normal; font-size: 17px; line-height: 1.5; font-weight: 600; color: var(--ink); letter-spacing: 0; }
.wordmark { font-family: var(--body-font); font-size: 17px; line-height: 1.35; font-weight: 500; letter-spacing: .015em; }
#screen-title { font-size: 11px; line-height: 1.7; letter-spacing: .16em; color: var(--muted); }
.icon-button { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; padding: 0; border-radius: 50%; flex: none; }
.icon-button:active { background: var(--surface-subtle); }
.app-scroll { min-height: 0; overflow-y: auto; overflow-x: clip; scrollbar-width: thin; scrollbar-gutter: stable; overscroll-behavior-y: contain; -webkit-overflow-scrolling: touch; scroll-padding-block: 20px; }
#main { max-width: 740px; width: 100%; min-height: 100%; margin: 0 auto; padding: 20px max(20px, env(safe-area-inset-right, 0px)) 26px max(20px, env(safe-area-inset-left, 0px)); overflow-wrap: anywhere; }
.main-nav { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 5px max(18px, env(safe-area-inset-right, 0px)) calc(5px + env(safe-area-inset-bottom, 0px)) max(18px, env(safe-area-inset-left, 0px)); border-top: 1px solid var(--line); background: var(--surface); z-index: 5; }
.main-nav a { position: relative; display: flex; min-width: 0; min-height: 56px; padding: 5px 8px 4px; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 11px; line-height: 1.3; color: var(--muted); border-radius: 8px; }
.main-nav a[aria-current="page"] { color: var(--link); font-weight: 650; }
.main-nav svg { width: 22px; height: 22px; }
.main-nav a[aria-current="page"]::before { content: none; }
body.keyboard-open .main-nav { display: none; }

.eyebrow { display: block; color: var(--link); font-size: 11px; font-weight: 650; letter-spacing: .13em; line-height: 1.7; text-transform: uppercase; }
.page-heading { display: block; margin: 0 0 20px; }
.page-heading h1 { margin: 0; font-family: var(--body-font); font-size: 26px; line-height: 1.4; letter-spacing: -.01em; font-weight: 600; }
.page-intro { margin-top: 6px; max-width: 38em; font-size: 13px; line-height: 1.8; color: var(--muted); }
.section-heading { margin-top: 18px; margin-bottom: 4px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 14px; }
.section-heading h2 { font-size: 14px; line-height: 1.6; font-weight: 500; letter-spacing: .035em; color: var(--muted); }
.section-heading > a { color: var(--link); display: inline-flex; align-items: center; min-height: 44px; font-size: 13px; }
body[data-view="explore"] .section-heading { margin-top: 0; }
body[data-view="explore"] .page-heading { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 14px; }
body[data-view="explore"] .page-intro { margin-top: 0; }
.explore-layout { display: grid; gap: 28px; }
.explore-reading, .explore-themes { min-width: 0; }
.explore-reading .continue-reading { margin: 0 0 18px; }
.game-preview-entry { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:12px 0 18px; margin-bottom:18px; border-bottom:1px solid var(--line); min-height:66px; }
.game-preview-entry strong { display:block; font-size:17px; font-weight:500; }
.game-preview-entry small { display:block; color:var(--muted); font-size:12px; margin-top:3px; }
.game-preview-entry > span:last-child { font-size:24px; color:var(--link); }
.discovery-feature { padding: 20px; border-radius: 16px; background: var(--surface); }
.discovery-label { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; color: var(--muted); font-size: 12px; line-height: 1.7; }
.discovery-label h2 { margin: 0; font-size: 12px; line-height: inherit; font-weight: 500; letter-spacing: .05em; color: var(--link); }
.discovery-quote { min-block-size: 6.6em; margin: 14px 0; padding: 0; border: 0; font-family: var(--reading-font); font-size: 20px; font-weight: 400; line-height: 1.65; letter-spacing: .015em; white-space: pre-wrap; text-wrap: balance; overflow-wrap: anywhere; }
.discovery-attribution { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 13px; line-height: 1.65; }
.discovery-attribution small { color: var(--muted); font-size: 11px; }
.discovery-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 12px; margin-top: 18px; }
.discovery-actions .primary-button { min-width: 112px; font-weight: 500; }
.discovery-actions .text-button { margin-right: -8px; }
body[data-view="mine"] .page-heading { margin-bottom: 18px; }
.muted { color: var(--muted); }
.text-button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 44px; padding: 8px 10px; font-size: 14px; line-height: 1.6; color: var(--link); border-radius: 8px; }
.primary-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 10px 17px; border-radius: 9px; background: var(--button-background); color: var(--button-ink); font-size: 14px; line-height: 1.6; font-weight: 600; }
.continue-reading { display: block; margin: 4px 0 20px; padding: 0; border-bottom: 1px solid color-mix(in srgb, var(--line) 65%, var(--surface)); }
.continue-reading h2, .continue-reading h3 { font-size: 17px; line-height: 1.5; font-weight: 500; margin: 0; }
.continue-reading p { color: var(--muted); font-size: 13px; }
.continue-reading .eyebrow { font-size: 10px; }
.continue-reading > a { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 68px; padding-bottom: 14px; }
.continue-copy { min-width: 0; }
.continue-copy > p { font-size: 12px; line-height: 1.6; margin-bottom: 5px; }

.theme-list { background: var(--surface); border-radius: 14px; overflow: hidden; }
.theme-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 16px; gap: 12px; align-items: center; min-height: 92px; padding: 17px 16px; }
.theme-row + .theme-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; border-top: 1px solid color-mix(in srgb, var(--line) 65%, var(--surface)); }
.theme-text { min-width: 0; }
.theme-preview { margin-top: 6px; font-size: 13px; line-height: 1.7; color: var(--muted); overflow-wrap: anywhere; }
.theme-copy h3 { font-family: var(--body-font); font-size: 18px; line-height: 1.5; letter-spacing: .015em; font-weight: 500; }
.theme-copy p { margin-top: 4px; color: var(--muted); font-size: 13px; line-height: 1.8; }
.theme-copy { display: flex; align-items: baseline; justify-content: flex-start; gap: 12px; min-width: 0; }
.theme-copy > .muted { flex: none; display: inline-block; font-size: 12px; line-height: 1.8; margin: 0; }
.row-arrow { font-size: 20px; color: var(--muted); line-height: 1.8; align-self: center; }
.article-list { border-radius: 16px; background: var(--surface); overflow: hidden; }
.article-row { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) 44px; align-items: center; gap: 8px; min-height: 88px; padding: 14px 12px 14px 16px; }
.article-row + .article-row::before { content: ""; position: absolute; top: 0; left: 16px; right: 16px; border-top: 1px solid color-mix(in srgb, var(--line) 65%, var(--surface)); }
.article-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px 11px; color: var(--muted); font-size: 12px; line-height: 1.6; letter-spacing: 0; }
.article-row h3 { margin-top: 5px; font-family: var(--body-font); font-size: 17px; line-height: 1.6; font-weight: 500; }
.article-row > p, .article-row a > p { margin-top: 6px; color: var(--muted); font-size: 14px; line-height: 1.85; }
.article-row > a { display: flex; flex-direction: column; justify-content: center; min-height: 44px; min-width: 0; }
.bookmark-button { display: inline-flex; flex: none; align-items: center; justify-content: center; width: 44px; min-width: 44px; height: 44px; min-height: 44px; margin: 0; padding: 0; font-size: 12px; }
.article-row .bookmark-button[aria-pressed="true"] { font-weight: 650; }
.text-link { display: inline-flex; align-items: center; gap: 8px; margin-top: 8px; min-height: 32px; color: var(--link); font-size: 13px; }

.search-form { margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.search-field { display: flex; flex: 1; align-items: center; gap: 10px; min-width: 0; padding: 0 14px; min-height: 48px; border-radius: 10px; background: var(--surface-subtle); color: var(--muted); border: 1px solid transparent; }
.search-field:focus-within { border-color: var(--accent); }
.search-field input { display: block; width: 100%; min-width: 0; height: 46px; padding: 8px 0; border: 0; color: var(--ink); background: transparent; font-size: 16px; line-height: 1.6; appearance: none; }
.search-field input::placeholder { color: var(--muted); opacity: 1; }
.search-field input:focus-visible { outline: none; }
.search-field button, .search-form > button { display: inline-flex; align-items: center; justify-content: center; min-width: 44px; min-height: 44px; padding: 6px 8px; color: var(--link); font-size: 13px; }
.search-field button { margin-right: -10px; }
.results-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; margin-bottom: 12px; }
.labelled-select { display: flex; align-items: center; gap: 7px; min-width: 0; flex: 1; color: var(--muted); font-size: 13px; }
.labelled-select label { flex: none; }
#theme-select { min-width: 0; max-width: 180px; min-height: 44px; padding: 8px 22px 8px 0; border: 0; background: transparent; color: var(--ink); font-family: var(--body-font); font-size: 14px; cursor: pointer; }
#result-controls { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 4px 8px; color: var(--muted); font-size: 12px; }
#result-controls .text-button { font-size: 12px; padding-inline: 4px; }
.result-meta { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--muted); min-height: 30px; margin-bottom: 4px; }
.result-meta .text-button { font-size: 12px; }
.empty-state, .loading-state, .error-state { padding: 18px 0; max-width: 36em; }
.empty-state h2, .error-state h1, .error-state h2 { font-size: 19px; margin-bottom: 10px; font-weight: 600; }
.empty-state p, .loading-state p, .error-state p { font-size: 15px; color: var(--muted); line-height: 1.9; }
.empty-state .primary-button, .error-state .primary-button, .empty-state .text-button, .error-state .text-button { margin-top: 17px; }

.reading-article { max-width: 680px; margin: 0 auto; }
.reading-header { padding: 0; margin-bottom: 12px; }
.reading-header h1 { font-family: var(--body-font); font-size: 24px; line-height: 1.5; font-weight: 500; letter-spacing: .01em; margin-top: 0; text-wrap: balance; }
.reading-subtitle { color: var(--muted); font-size: 15px; line-height: 1.9; margin-top: 15px; }
.reading-meta { display: flex; align-items: center; flex: 1; min-width: 0; margin: 0; font-size: 11px; color: var(--muted); }
.reading-header > a.eyebrow { display: inline-flex; align-items: center; min-height: 44px; margin-top: -10px; }
.reading-body { font-family: var(--reading-font); font-size: 17px; line-height: 1.85; letter-spacing: .015em; }
.original-text { margin: 0; white-space: normal; font: inherit; letter-spacing: inherit; word-break: normal; overflow-wrap: anywhere; }
.original-heading { margin: 22px 0 8px; white-space: pre-wrap; font: inherit; font-size: 18px; line-height: 1.65; font-weight: 600; }
.original-paragraph { white-space: pre-wrap; margin: 0 0 .75em; }
.original-verse { margin-bottom: .2em; }
.original-blank { display: block; min-height: .45em; }
.original-heading:first-child { margin-top: 0; }
.reading-lead { margin-bottom: 27px; }
.reading-section + .reading-section { margin-top: 31px; }
.reading-section h2 { font-size: 21px; line-height: 1.6; margin: 0 0 17px; font-weight: 600; }
.reading-section p + p { margin-top: 1.2em; }
.reading-body blockquote { margin: 24px 0; padding: 3px 0 3px 18px; border-left: 2px solid var(--accent); color: var(--muted); }
.reading-body a, .reading-section a { color: var(--link); text-decoration: underline; text-underline-offset: 4px; }
.reading-body ul, .reading-body ol { margin-block: 18px; }
.reading-body li + li { margin-top: 10px; }
.reading-toolbar, .reading-actions { display: flex; align-items: center; gap: 4px; min-height: 44px; padding: 0 0 8px; margin: 0 0 16px; border-bottom: 1px solid var(--line); }
.action-button { display: inline-flex; flex: none; justify-content: center; align-items: center; gap: 6px; min-width: 44px; min-height: 44px; padding: 8px; border-radius: 8px; background: none; color: var(--link); font-size: 12px; line-height: 1.7; }
.action-button[aria-pressed="true"] { color: var(--link); font-weight: 650; }
.reflection-section { margin-top: 31px; padding: 22px 0; border-top: 1px solid var(--line); }
.reflection-section h2 { margin-bottom: 12px; font-size: 15px; font-weight: 650; }
.reflection-section p { color: var(--muted); font-family: var(--reading-font); font-size: 17px; line-height: 1.9; }
.reflection-section ol { color: var(--muted); font-family: var(--reading-font); font-size: 17px; line-height: 1.9; margin-bottom: 0; }
.reflection-section li + li { margin-top: 12px; }
.note-editor { margin-top: 21px; }
.note-editor > h2 { margin-bottom: 7px; font-size: 16px; line-height: 1.7; font-weight: 650; }
.note-editor > p { font-size: 13px; line-height: 1.8; margin-bottom: 15px; }
.note-editor label { display: block; margin-bottom: 10px; font-size: 14px; font-weight: 600; }
.note-editor textarea { width: 100%; display: block; min-height: 154px; padding: 13px 15px; resize: vertical; border: 1px solid var(--line); border-radius: 10px; color: var(--ink); background: var(--surface); font-size: 16px; line-height: 1.85; }
.note-editor textarea::placeholder { color: var(--muted); opacity: 1; }
.note-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 14px; margin-top: 10px; }
.note-actions p, .note-actions span { color: var(--muted); font-size: 12px; }
.note-actions .primary-button { min-width: 90px; }
.reading-pagination { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 28px 0 30px; padding-bottom: 14px; gap: 20px; }
.reading-pagination a { display: flex; flex-direction: column; gap: 5px; padding: 22px 0 9px; font-size: 14px; line-height: 1.7; color: var(--link); min-height: 72px; }
.reading-pagination a:last-child { text-align: right; align-items: flex-end; }
.reading-pagination a span:first-child { color: var(--muted); font-size: 11px; }
.reading-pagination strong { font-weight: 600; }
.mine-section { margin-top: 22px; }
.mine-tabs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px; margin-bottom: 18px; border-radius: 11px; background: var(--surface-subtle); }
.mine-tabs button { min-width: 0; min-height: 44px; padding: 8px 4px; color: var(--muted); font-size: 13px; line-height: 1.7; border-radius: 8px; border: 1px solid transparent; }
.mine-tabs button[aria-pressed="true"] { color: var(--ink); background: var(--surface); border-color: var(--line); font-weight: 600; }
#mine-content { min-width: 0; }
#mine-content .empty-state { max-width: none; padding: 32px 20px; background: var(--surface); border-radius: 16px; }
#mine-content .empty-state h2 { font-family: var(--body-font); font-size: 17px; line-height: 1.6; margin-bottom: 8px; }
#mine-content .empty-state p { max-width: 29em; font-size: 14px; line-height: 1.8; }
#mine-content .empty-state .text-button, #mine-content .empty-state .primary-button { margin-top: 18px; }
.mine-section .empty-state { padding: 9px 0; }
.mine-section .empty-state h2 { font-size: 15px; margin-bottom: 5px; }
.empty-inline { padding: 10px 0 14px; color: var(--muted); font-size: 14px; line-height: 1.85; }
.mine-section > h2 { margin-bottom: 14px; font-size: 15px; font-weight: 650; }
.note-list { background: var(--surface); border-radius: 16px; overflow: hidden; }
.note-item { padding: 18px 16px; }
.note-item + .note-item { border-top: 1px solid var(--line); }
.note-item h3 { font-family: var(--body-font); font-size: 17px; line-height: 1.7; margin: 4px 0 8px; font-weight: 500; }
.note-preview { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow: hidden; white-space: pre-wrap; overflow-wrap: anywhere; font-family: var(--body-font); color: var(--muted); font-size: 14px; line-height: 1.8; }
.note-item .text-button { margin: 9px 0 -5px -10px; }
.note-status, .note-count, .progress-label { color: var(--muted); font-size: 12px; line-height: 1.8; }
.source-note { margin-top: 20px; padding-top: 12px; border-top: 1px solid var(--line); color: var(--muted); font-family: var(--body-font); font-size: 12px; line-height: 1.9; letter-spacing: 0; }
.source-note a { color: var(--link); text-decoration: underline; text-underline-offset: 3px; }
.source-note summary { min-height: 44px; padding-block: 10px; cursor: pointer; color: var(--link); }
.source-note summary + p { margin-top: 7px; }
.source-note p + p { margin-top: 7px; }
.theme-choice { font-size: 12px; color: var(--muted); }
#confirm-dialog { width: min(420px, calc(100% - 36px)); max-height: calc(100dvh - 60px); padding: 25px; border: 1px solid var(--line); border-radius: 17px; color: var(--ink); background: var(--surface); }
#confirm-dialog::backdrop { background: rgba(20, 28, 29, .38); }
#confirm-dialog h2 { font-size: 18px; line-height: 1.7; }
#confirm-dialog p { font-size: 14px; line-height: 1.9; color: var(--muted); margin-top: 11px; }
.dialog-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 23px; }
.dialog-actions button { min-height: 44px; min-width: 70px; padding: 9px 13px; border-radius: 8px; font-size: 14px; }
.dialog-actions button:last-child { background: var(--button-background); color: var(--button-ink); }

.action-dialog { position: fixed; inset: auto 0 0; width: min(100%, 460px); max-height: calc(100dvh - 32px - env(safe-area-inset-top, 0px)); margin: auto auto 0; padding: 10px 18px calc(16px + env(safe-area-inset-bottom, 0px)); border: 0; border-radius: 20px 20px 0 0; color: var(--ink); background: var(--surface); overflow: auto; }
.action-dialog::backdrop { background: rgba(20, 28, 29, .38); }
.dialog-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 8px; }
.dialog-header h2 { font-size: 17px; font-weight: 650; }
.dialog-header .icon-button { margin-right: -10px; }
.appearance-group { padding: 0; margin: 12px 0 16px; border: 0; min-width: 0; }
.appearance-group legend { padding: 0; margin-bottom: 8px; font-size: 13px; line-height: 1.6; font-weight: 600; color: var(--muted); }
.choice-list { background: var(--surface-subtle); border-radius: 10px; }
.choice-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 46px; padding: 10px 13px; cursor: pointer; font-size: 14px; line-height: 1.7; color: var(--ink); }
.choice-row + .choice-row { border-top: 1px solid var(--line); }
.choice-row input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--link); cursor: pointer; }
.choice-row:has(input:checked) { font-weight: 600; }
.choice-row:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 8px; }
.choice-row input:focus-visible { outline: none; }
.appearance-mode .choice-list { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 3px; padding: 3px; }
.appearance-mode .choice-row { position: relative; justify-content: center; min-width: 0; min-height: 44px; padding: 8px 4px; font-size: 13px; white-space: nowrap; border: 1px solid transparent; border-radius: 8px; }
.appearance-mode .choice-row:has(input:checked) { background: var(--surface); border-color: var(--line); }
.appearance-mode .choice-row:has(input:checked)::after { content: ""; position: absolute; bottom: 4px; height: 2px; width: 18px; border-radius: 1px; background: var(--link); }
.appearance-mode .choice-row input { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); border: 0; }
.appearance-palette .choice-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; background: none; }
.appearance-palette .choice-row { min-width: 0; min-height: 46px; gap: 8px; padding: 9px 11px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-subtle); }
.appearance-palette .choice-row:has(input:checked) { border-color: var(--link); }
.choice-label { display: inline-flex; align-items: center; gap: 10px; }
.theme-swatch { width: 12px; height: 12px; border-radius: 4px; background: #3B6484; flex: none; }
.theme-swatch[data-swatch="ocean"] { background: #157BA9; }
.theme-swatch[data-swatch="berry"] { background: #7A57A4; }
.theme-swatch[data-swatch="forest"] { background: #2D8667; }
.action-list { border-top: 1px solid var(--line); margin-top: 6px; }
.action-list > a, .action-list > button { display: flex; width: 100%; min-height: 44px; padding: 8px 1px; align-items: center; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); font-size: 15px; text-align: left; }
.action-list > a span:last-child, .action-list > button span:last-child { color: var(--link); }
.dialog-note { margin-top: 12px; color: var(--muted); font-size: 12px; line-height: 1.8; }
.toast { position: fixed; z-index: 30; left: 50%; bottom: calc(83px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%) translateY(8px); width: max-content; max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 10px; background: var(--ink); color: var(--background); font-size: 13px; line-height: 1.7; text-align: center; pointer-events: none; opacity: 0; transition: opacity 140ms ease, transform 140ms ease; }
.toast.visible, .toast.show, .toast[data-visible="true"] { opacity: 1; transform: translateX(-50%) translateY(0); }
body.keyboard-open .toast { bottom: 14px; }

@media (hover: hover) {
  .theme-row:hover, .article-row:hover { background: var(--surface-subtle); }
  .text-button:hover, .icon-button:hover, .filter-chip:hover { background: var(--surface-subtle); }
  .main-nav a:hover { background: var(--surface-subtle); }
  .action-list > a:hover, .action-list > button:hover { color: var(--link); }
}
@media (max-width: 359px) {
  #main { padding-inline: 16px; }
  .app-header { padding-inline: 16px; }
  .discovery-feature { padding: 16px; }
  .discovery-quote { min-block-size: 6.4em; font-size: 18px; line-height: 1.6; margin: 12px 0; }
  .discovery-actions { margin-top: 12px; }
  .reading-toolbar, .reading-actions { gap: 2px; }
  .action-button { padding-inline: 6px; }
}
@media (min-width: 768px) {
  .app-frame { grid-template-columns: 152px minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .app-header { grid-column: 1 / -1; min-height: 64px; padding: 10px 24px; border-bottom: 1px solid var(--line); }
  .app-header:has(#back-link[hidden]) { padding-inline: 24px; }
  .app-scroll { grid-column: 2; grid-row: 2; }
  #main { padding: 28px 32px; margin-inline: 0; }
  .main-nav { grid-column: 1; grid-row: 2; display: flex; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 6px; padding: 26px 12px; border-top: 0; border-right: 1px solid var(--line); }
  .main-nav a { min-height: 48px; flex-direction: row; justify-content: flex-start; gap: 12px; font-size: 14px; font-weight: 500; padding-inline: 12px; }
  .main-nav svg { width: 20px; height: 20px; }
  .main-nav a[aria-current="page"] { background: none; }
  .page-heading h1 { font-size: 28px; }
  .reading-header h1 { font-size: 28px; }
  .reading-body { font-size: 18px; line-height: 1.85; }
  .original-heading { font-size: 20px; }
  .action-dialog { inset: 0; margin: auto; border-radius: 17px; padding: 12px 22px 18px; }
  .toast { bottom: 30px; }
}
@media (min-width: 1100px) {
  body[data-view="explore"] #main { max-width: 940px; }
  .explore-layout { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; gap: 28px; }
  .explore-themes .section-heading { margin-top: 0; }
  .explore-themes .theme-row { min-height: 88px; padding-block: 15px; }
  .explore-themes .theme-copy h3 { font-size: 16px; }
  .explore-themes .theme-preview { font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}
@media print {
  body { overflow: visible; background: #fff; color: #111; }
  .app-frame { display: block; height: auto; }
  .app-scroll { overflow: visible; }
  #main { max-width: none; padding: 0; }
  .app-header, .main-nav, .app-footer, .reading-actions, .note-editor, .reading-pagination, .toast, .skip-link { display: none; }
  .reading-body { font-size: 12pt; }
}
