:root {
  color-scheme: dark;
  --night: #121827;
  --raised: #1b2437;
  --line: #344057;
  --text: #edf0f5;
  --muted: #a3adbf;
  --brass: #d7b875;
  --danger: #f0aaa5;
  --body: 'Golos Text', sans-serif;
  --display: 'Literata', Georgia, serif;
  --safe-bottom: max(env(safe-area-inset-bottom, 0px), var(--tg-safe-area-inset-bottom, 0px));
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: 24px; }
body { margin: 0; background: var(--night); color: var(--text); font: 15px/1.6 var(--body); -webkit-font-smoothing: antialiased; }
body::before { content: ''; position: fixed; z-index: -1; inset: 0; pointer-events: none; background: radial-gradient(ellipse at 20% 12%, #26334c66, transparent 55%); }
button, textarea, select { font: inherit; }
button, a, select, summary { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button, select, summary { cursor: pointer; }
button { color: inherit; }
button:disabled, select:disabled { cursor: default; opacity: .55; }
a { color: inherit; text-underline-offset: .25em; }
button, a, textarea, select, summary { outline-offset: 5px; }
:focus-visible { outline: 2px solid var(--brass); }
h1, h2, h3, p, figure { margin: 0; }
h1, h2 { font-family: var(--display); font-weight: 400; line-height: 1.25; text-wrap: balance; }
h1 { font-size: clamp(29px, 5.6vw, 43px); letter-spacing: -.045em; }
h2 { font-size: 25px; letter-spacing: -.025em; }
h3 { font-size: 15px; font-weight: 500; }
svg { display: block; }
img { display: block; max-width: 100%; }
button { border-radius: 0; }
.app-shell { width: min(100%, 1160px); margin-inline: auto; padding: max(22px, var(--tg-content-safe-area-inset-top, 0px)) max(20px, env(safe-area-inset-right)) calc(110px + var(--safe-bottom)) max(20px, env(safe-area-inset-left)); }
.app-header { display: flex; align-items: center; justify-content: space-between; min-height: 52px; margin-bottom: 25px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; font-family: var(--display); font-size: 27px; line-height: 1.05; letter-spacing: -.06em; }
.brand svg { width: 27px; height: 36px; fill: none; stroke: var(--brass); stroke-width: 1; }
.brand-caption { display: block; margin-top: 6px; color: var(--muted); font: 10px var(--body); letter-spacing: .08em; }
.header-note { font-size: 10px; line-height: 1.65; text-align: right; color: var(--muted); }
.preview-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; border-block: 1px solid var(--line); margin-bottom: 25px; padding: 5px 0; color: var(--muted); font-size: 11px; }
.preview-tag { color: var(--brass); text-transform: uppercase; letter-spacing: .12em; font-size: 10px; }
.preview-banner .text-button { margin-left: auto; font-size: 11px; min-height: 38px; }
.storage-note { flex-basis: 100%; padding-bottom: 8px; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-block: 26px; }
.page-heading > .small-note { display: none; }
.eyebrow { color: var(--brass); font-size: 10px; font-weight: 500; line-height: 1.6; letter-spacing: .12em; text-transform: uppercase; }
.page-heading .eyebrow { margin-bottom: 8px; }
.small-note { font-size: 11px; color: var(--muted); }
.page-footnote { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 11px; line-height: 1.7; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 12px; min-height: 48px; padding: 12px 18px; border: 1px solid transparent; border-radius: 6px; font-size: 13px; font-weight: 500; line-height: 1.5; text-align: center; transition: background .18s, border-color .18s; }
.button-primary { background: var(--brass); color: var(--night); }
.button-primary:hover:not(:disabled) { background: #e6ca90; }
.button-secondary { background: transparent; border-color: var(--line); color: var(--text); }
.button-secondary:hover:not(:disabled) { border-color: var(--brass); }
.text-button { min-height: 44px; padding: 5px 0; background: none; border: 0; color: var(--brass); text-decoration: underline; text-underline-offset: 4px; font-size: 12px; }
.icon-button { display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; padding: 0; color: var(--muted); background: transparent; border: 1px solid var(--line); border-radius: 50%; font-size: 27px; line-height: 1; }
.icon-button:hover { color: var(--text); border-color: var(--brass); }
.reading-layout { display: grid; gap: 28px; }
.daily-art { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.art-button { display: block; position: relative; padding: 0; border: 0; background: none; border-radius: 5px; }
.daily-art .art-button { width: min(100%, 245px); width: min(100%, 32svh, 270px); }
.image-frame { display: block; position: relative; aspect-ratio: 755 / 1080; width: 100%; overflow: hidden; border-radius: 4px; background: var(--raised); }
.image-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; transition: opacity .25s; }
.image-frame.is-missing img { display: none; }
.image-fallback { display: none; position: absolute; inset: 8px; align-items: center; justify-content: center; flex-direction: column; gap: 10px; border: 1px solid var(--line); color: var(--muted); text-align: center; font-size: 11px; line-height: 1.6; }
.image-fallback > span:first-child { color: var(--brass); font-size: 38px; }
.is-missing .image-fallback { display: flex; }
.daily-art .image-frame { box-shadow: 0 20px 55px #080c1880, 0 0 0 1px #d7b87533; }
.expand-hint { display: flex; align-items: center; gap: 6px; position: absolute; right: 8px; bottom: 8px; padding: 5px 9px; border-radius: 4px; background: #121827e8; color: var(--text); font-size: 10px; }
.expand-hint > span { font-size: 16px; }
.daily-art figcaption { max-width: 100%; margin-top: 16px; color: var(--muted); font-size: 10px; text-align: center; overflow-wrap: anywhere; }
.daily-art figcaption span { margin-inline: 5px; color: var(--brass); }
.reading-copy { min-width: 0; }
.card-title { margin: 10px 0 20px; font-size: clamp(31px, 6.5vw, 48px); line-height: 1.15; }
.meaning { color: #d4dbe6; font-size: 14px; line-height: 1.85; overflow-wrap: anywhere; }
.meaning p { margin-bottom: 14px; white-space: pre-wrap; }
.meaning p:last-child { margin-bottom: 0; }
.meaning-more summary { display: flex; align-items: center; justify-content: space-between; min-height: 44px; gap: 15px; width: fit-content; color: var(--brass); font-size: 12px; list-style: none; }
summary::-webkit-details-marker { display: none; }
.meaning-more summary > span:last-child { transition: transform .2s; }
.meaning-more[open] summary > span:last-child { transform: rotate(180deg); }
.meaning-more .less-label, .meaning-more[open] .more-label { display: none; }
.meaning-more[open] .less-label { display: inline; }
.meaning-more > div { padding-top: 8px; }
.meaning .meaning-source { margin-top: 15px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.topics-section { margin-top: 26px; padding-top: 23px; border-top: 1px solid var(--line); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.topic-controls { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.topic-button { display: flex; flex-direction: column; justify-content: space-between; gap: 12px; min-height: 78px; padding: 12px 10px; border: 1px solid var(--line); border-radius: 6px; background: transparent; text-align: left; font-size: 13px; }
.topic-button:hover:not(:disabled), .topic-button[aria-pressed='true'] { border-color: var(--brass); background: #d7b8750c; }
.topic-button[aria-pressed='true'] { color: var(--brass); }
.topic-status { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 10px; }
.topic-status .spinner { width: 14px; height: 14px; }
.topic-reading { position: relative; display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 20px; margin-top: 30px; padding: 24px 0; border-block: 1px solid var(--line); animation: reveal .22s ease-out; }
.topic-art { align-self: start; }
.topic-art .expand-hint { font-size: 16px; padding: 0 7px; right: 4px; bottom: 4px; }
.topic-copy { min-width: 0; }
.topic-copy > .eyebrow { padding-right: 34px; }
.topic-copy h2 { margin: 8px 0 16px; font-size: 25px; }
.topic-copy .meaning { font-size: 13px; }
.topic-close { position: absolute; top: 12px; right: 0; border-color: transparent; }
.daily-details { display: grid; gap: 38px; margin-top: 40px; }
.question-section, .history-section { min-width: 0; }
.question-section > .eyebrow, .history-section .eyebrow { margin-bottom: 8px; }
.section-copy { margin-top: 12px; color: var(--muted); font-size: 13px; line-height: 1.8; }
textarea { display: block; width: 100%; min-height: 114px; margin-top: 20px; padding: 15px; border: 1px solid var(--line); border-radius: 6px; resize: vertical; background: #0f1523; color: var(--text); font-size: 16px; line-height: 1.6; }
textarea::placeholder { color: var(--muted); opacity: .8; }
.question-footer { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; }
.question-footer .button { flex: 1; }
.answer-entry { margin-top: 24px; padding: 20px 0; border-top: 1px solid var(--line); }
.answer-question { margin-bottom: 18px; padding-left: 13px; border-left: 2px solid var(--brass); white-space: pre-wrap; overflow-wrap: anywhere; color: var(--muted); font-size: 13px; }
.answer-entry .eyebrow { margin-bottom: 10px; }
.history-mark { color: var(--brass); font-size: 28px; }
.history-list { margin: 0; padding: 0; list-style: none; }
.history-row { display: grid; grid-template-columns: 70px minmax(0, 1fr); align-items: baseline; gap: 15px; padding-block: 14px; border-bottom: 1px solid var(--line); font-size: 13px; }
.history-row time { color: var(--muted); font-size: 11px; }
.history-row small { display: block; color: var(--muted); font-size: 10px; }
.history-row span { overflow-wrap: anywhere; }
.history-more summary { display: flex; align-items: center; justify-content: space-between; min-height: 48px; color: var(--brass); font-size: 12px; list-style: none; }
.album-monogram { color: var(--brass); font-size: 43px; }
.album-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 15px; }
.album-toolbar > p { color: var(--muted); font-size: 11px; line-height: 1.7; }
.select-label { display: flex; flex-direction: column; gap: 6px; color: var(--muted); font-size: 11px; }
select { min-height: 44px; max-width: 100%; padding: 10px 32px 10px 12px; border: 1px solid var(--line); border-radius: 5px; background: var(--raised); color: var(--text); font-size: 13px; }
.collection-summary { margin-top: 25px; }
.progress-copy { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 13px; }
.progress-copy strong { color: var(--brass); font: 38px/1.2 var(--display); }
.progress-total { color: var(--muted); font-size: 18px; }
.progress-copy > span:last-child { color: var(--muted); font-size: 11px; }
progress { display: block; width: 100%; height: 3px; appearance: none; border: 0; background: var(--line); color: var(--brass); }
progress::-webkit-progress-bar { background: var(--line); }
progress::-webkit-progress-value { background: var(--brass); }
progress::-moz-progress-bar { background: var(--brass); }
.collection-tools { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin-block: 22px; }
.filter-group { display: flex; flex-wrap: wrap; gap: 5px; }
.filter-group button { min-height: 44px; padding: 8px 11px; border: 1px solid transparent; border-radius: 5px; background: none; color: var(--muted); font-size: 11px; }
.filter-group [aria-pressed='true'] { color: var(--brass); border-color: var(--line); background: var(--raised); }
.collection-tools > select { min-width: 132px; font-size: 11px; }
.collection-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px 12px; align-items: start; }
.album-card { display: block; min-width: 0; padding: 0; border: 0; border-radius: 4px; background: none; text-align: left; }
.album-card .image-frame { box-shadow: 0 5px 15px #090e1966; }
.album-card-name { display: block; margin-top: 9px; font-size: 10px; line-height: 1.5; overflow-wrap: anywhere; }
.album-card-state { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; line-height: 1.5; }
.is-opened .album-card-state { color: var(--brass); }
.is-locked .album-card-name { color: var(--muted); }
.is-opened:hover .image-frame { outline: 1px solid var(--brass); outline-offset: 3px; }
.album-card .image-fallback { font-size: 9px; }
.album-card .image-fallback > span:first-child { font-size: 23px; }
.decks-intro { margin-bottom: 20px; color: var(--muted); font-size: 14px; }
.deck-notice { padding: 16px 18px; border-left: 2px solid var(--brass); background: #1b243780; color: var(--muted); font-size: 12px; }
.decks-list { display: grid; gap: 0; }
.deck-card { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 22px; padding-block: 30px; border-bottom: 1px solid var(--line); }
.deck-art { padding-top: 5px; min-width: 0; }
.deck-copy { min-width: 0; }
.deck-copy h2 { margin-top: 8px; font-size: 26px; }
.deck-copy > .select-label { margin-top: 20px; }
.deck-copy .button { margin-top: 17px; width: 100%; }
.deck-copy .section-copy { font-size: 12px; }
.artwork-note, .pending-note { margin-top: 10px; color: var(--muted); font-size: 11px; line-height: 1.8; }
.pending-cover { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; aspect-ratio: 755 / 1080; border: 1px dashed var(--line); border-radius: 4px; color: var(--muted); }
.pending-cover > span:first-child { font: 35px var(--display); }
.pending-cover > span:last-child { font-size: 9px; line-height: 1.6; text-align: center; }
.is-pending .eyebrow { color: var(--muted); }
.bottom-nav { position: fixed; z-index: 10; bottom: 0; left: 0; right: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; padding: 8px 15px calc(8px + var(--safe-bottom)); border-top: 1px solid var(--line); background: #121827f7; }
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; min-height: 52px; border-radius: 6px; color: var(--muted); font-size: 10px; text-decoration: none; }
.bottom-nav a[aria-current='page'] { color: var(--brass); background: #d7b8750b; }
.bottom-nav svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.boot-state { min-height: 55vh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 15px; }
.loading-state { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 100px; padding: 20px 0; color: var(--muted); font-size: 13px; }
.spinner { display: inline-block; flex: 0 0 auto; width: 19px; height: 19px; border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 1s linear infinite; }
.reading-skeleton { display: flex; flex-direction: column; align-items: center; }
.reading-skeleton > .image-frame { width: min(245px, 32svh); }
.error-state, .empty-state { padding: 30px 18px; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); font-size: 13px; }
.error-state p { max-width: 520px; margin-block: 12px 20px; overflow-wrap: anywhere; }
.error-symbol { display: inline-grid; place-items: center; width: 26px; height: 26px; border: 1px solid var(--brass); border-radius: 50%; color: var(--brass); }
.inline-error { margin-top: 14px; color: var(--danger); font-size: 12px; line-height: 1.7; }
.empty-copy { color: var(--muted); font-size: 13px; line-height: 1.8; }
.empty-state { text-align: center; }
.empty-state > span { color: var(--brass); font-size: 38px; }
.empty-state h2 { margin-block: 10px; color: var(--text); font-size: 24px; }
.empty-state .button { margin-top: 20px; }
.collection-grid > .loading-state, .collection-grid > .error-state, .collection-grid > .empty-state { grid-column: 1 / -1; width: 100%; }
.collection-invitation { display: flex; justify-content: space-between; align-items: center; gap: 15px; min-height: 52px; margin-top: 15px; color: var(--brass); font-size: 13px; }
.card-dialog { width: 100%; max-width: none; height: 100%; height: 100dvh; max-height: none; margin: 0; padding: max(12px, env(safe-area-inset-top), var(--tg-content-safe-area-inset-top, 0px)) 20px calc(25px + var(--safe-bottom)); border: 0; background: #0e1421; color: var(--text); overflow-y: auto; overscroll-behavior: contain; }
.card-dialog::backdrop { background: #080c18ed; }
.dialog-open { overflow: hidden; }
.dialog-toolbar { position: sticky; z-index: 2; top: -1px; display: flex; align-items: center; justify-content: space-between; gap: 15px; padding: 8px 0 14px; background: #0e1421f7; }
.dialog-content { display: grid; gap: 26px; width: min(100%, 1120px); margin: 0 auto; padding-top: 8px; }
.dialog-art { display: flex; align-items: center; flex-direction: column; min-width: 0; }
.dialog-art .image-frame { width: min(100%, 45svh, 580px); }
.dialog-art .image-retry { display: none; margin-top: 14px; }
.dialog-art:has(.is-missing) .image-retry { display: block; }
.dialog-copy { min-width: 0; }
.dialog-copy h2 { margin-block: 10px 15px; font-size: 32px; }
.dialog-copy > .small-note { margin-bottom: 24px; }
.dialog-hint { margin-top: 24px; color: var(--muted); font-size: 11px; }
.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; }
.skip-link { position: fixed; z-index: 30; top: 10px; left: 20px; transform: translateY(-150%); padding: 10px 16px; background: var(--brass); color: var(--night); }
.skip-link:focus { transform: translateY(0); }
.noscript { position: fixed; inset: 30% 20px auto; padding: 25px; background: var(--raised); }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes reveal { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 560px) {
  .collection-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 26px 18px; }
  .album-card-name { font-size: 12px; }
  .deck-card { grid-template-columns: 160px minmax(0, 1fr); gap: 32px; }
  .question-footer .button { flex: initial; }
  .topic-reading { grid-template-columns: 145px minmax(0, 1fr); gap: 28px; }
}
@media (min-width: 768px) {
  .app-shell { padding: 32px 40px 140px; }
  .app-header { margin-bottom: 35px; }
  .brand { font-size: 31px; }
  .brand-caption { font-size: 11px; }
  .header-note { font-size: 11px; }
  .preview-banner { font-size: 12px; }
  .page-heading { margin-block: 36px; }
  .page-heading > .small-note { display: block; }
  .reading-layout { grid-template-columns: minmax(0, .9fr) minmax(0, 1fr); align-items: start; gap: 44px; }
  .daily-art { position: sticky; top: 25px; padding: 10px 0; }
  .daily-art .art-button { width: min(100%, 350px); }
  .daily-art figcaption { max-width: 290px; font-size: 11px; }
  .reading-copy { padding-top: 10px; }
  .card-title { margin-bottom: 23px; font-size: 39px; }
  .topics-section { margin-top: 28px; }
  .topic-button { font-size: 12px; padding: 10px 8px; }
  .topic-reading { grid-template-columns: 180px minmax(0, 1fr); padding-block: 30px; gap: 36px; margin-top: 40px; }
  .topic-copy { max-width: 650px; }
  .topic-copy .meaning { font-size: 14px; }
  .daily-details { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 44px; margin-top: 55px; padding-top: 36px; border-top: 1px solid var(--line); }
  .question-footer { align-items: flex-start; flex-direction: column; }
  .collection-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .album-toolbar > p { text-align: right; }
  .deck-card { grid-template-columns: 190px minmax(0, 1fr); gap: 44px; padding-block: 40px; }
  .deck-copy { max-width: 560px; }
  .deck-copy h2 { font-size: 32px; }
  .deck-copy .button { width: auto; }
  .deck-copy .section-copy { font-size: 14px; }
  .deck-copy > .select-label { max-width: 360px; }
  .pending-cover > span:first-child { font-size: 62px; }
  .pending-cover > span:last-child { font-size: 12px; }
  .bottom-nav { right: auto; left: 50%; width: min(540px, calc(100% - 80px)); transform: translateX(-50%); bottom: 18px; padding: 7px; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 10px 40px #080c1899; }
  .bottom-nav a { flex-direction: row; gap: 12px; min-height: 49px; font-size: 12px; }
  .bottom-nav svg { width: 21px; }
  .dialog-content { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 40px; padding: 15px 20px; }
  .dialog-art { position: sticky; top: 80px; align-self: start; }
  .dialog-art .image-frame { width: min(100%, 53svh); }
  .dialog-copy { padding-top: 20px; }
}
@media (min-width: 1080px) {
  .reading-layout { grid-template-columns: minmax(0, .95fr) minmax(0, 1fr); gap: 74px; }
  .daily-art .art-button { width: 360px; }
  .card-title { font-size: 48px; }
  .meaning { font-size: 15px; }
  .topic-button { min-height: 85px; padding: 14px; font-size: 14px; }
  .daily-details { gap: 74px; }
  .question-footer { flex-direction: row; align-items: center; }
  .collection-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 30px 22px; }
  .album-card-name { font-size: 13px; }
  .album-card-state { font-size: 10px; }
}
@media (max-width: 359px) {
  .app-shell { padding-inline: 15px; }
  .preview-banner { gap: 5px; font-size: 10px; }
  .topic-reading { grid-template-columns: 80px minmax(0, 1fr); gap: 14px; }
  .collection-grid { gap: 18px 9px; }
  .deck-card { grid-template-columns: 65px minmax(0, 1fr); gap: 16px; }
  .progress-copy > span:last-child { font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
