/* Semantic UI palette. Artwork, marker swatches and provider branding keep their own colors. */
html[data-app-theme] {
  --theme-strong: #490b3b;
  --theme-secondary: #4f60a1;
  --theme-decoration: #bac6f7;
  --theme-stage: #f7f5f8;
  --theme-input: #fff;
  --theme-on-accent: #fff;
  --theme-on-soft: var(--theme-ink);
  --theme-success: #2b7a57;
  --theme-error: #9e3457;
}
html[data-app-theme="violet"] { --theme-strong: #422c60; --theme-secondary: #46788b; --theme-decoration: #c7b5e3; --theme-stage: #f0ebf5; }
html[data-app-theme="coral"] { --theme-strong: #753d37; --theme-secondary: #6760a3; --theme-decoration: #efbdad; --theme-stage: #f7eeea; }
html[data-app-theme="blue"] { --theme-strong: #293f60; --theme-secondary: #8560a7; --theme-decoration: #acc9ec; --theme-stage: #eaf0f8; }
html[data-app-theme="night"] { --theme-strong: #f4edf2; --theme-secondary: #acb9e7; --theme-decoration: #736285; --theme-stage: #241f2b; --theme-input: #342b39; --theme-success: #99d1b3; --theme-error: #ffb3c7; }
html[data-app-theme] {
  --surface-soft: var(--theme-soft);
  --paper-deep: var(--theme-soft);
  --ink-faint: var(--theme-muted);
  --line-strong: var(--theme-accent);
}
html[data-app-theme] :is(.app-shell,.book-page,.illustration-overlay,.sheet,.achievement-celebration,.admin-shell) {
  --app-ink: var(--theme-ink); --app-muted: var(--theme-muted); --app-line: var(--theme-line);
  --app-pink: var(--theme-accent); --app-pink-dark: var(--theme-action); --app-blue-dark: var(--theme-strong);
  --luni-ink: var(--theme-ink); --luni-line: var(--theme-line); --luni-pink-strong: var(--theme-action); --luni-blue-deep: var(--theme-secondary);
  --luna-pink: var(--theme-accent); --luna-pink-strong: var(--theme-action); --luna-plum: var(--theme-strong); --luna-line: var(--theme-line); --luna-muted: var(--theme-muted); --luna-cream: var(--theme-background);
  --favorites-ink: var(--theme-ink); --favorites-muted: var(--theme-muted); --favorites-line: var(--theme-line); --favorites-pink: var(--theme-accent);
  --viewer-navy: var(--theme-ink); --viewer-pink: var(--theme-accent); --viewer-blue: var(--theme-secondary); --viewer-bg: var(--theme-stage); --viewer-surface: var(--theme-surface); --viewer-border: var(--theme-line); --viewer-muted: var(--theme-muted); --viewer-soft: var(--theme-soft); --viewer-yellow: var(--theme-secondary); --viewer-error: var(--theme-error);
}
/* Controls use the action palette; surfaces and border colors are shared across routes. */
html[data-app-theme] :is(.book-progress-panel__cta,.catalog-book-card__add,.viewer-complete,.illustration-card__open,.achievement-celebration__cta) { background: var(--theme-action); border-color: var(--theme-action); color: var(--theme-on-accent) !important; }
html[data-app-theme] :is(.book-progress-panel__cta,.catalog-book-card__add,.viewer-complete,.illustration-card__open,.achievement-celebration__cta) * { color: var(--theme-on-accent) !important; }
html[data-app-theme] :is(.button--secondary,.button--ghost,.profile-yandex-link,.text-link) { color: var(--theme-ink); border-color: var(--theme-line); }
html[data-app-theme] .app-shell .reward-list .button { border-color: var(--theme-action); color: var(--theme-action) !important; background: transparent; }
html[data-app-theme] .app-shell .reward-list .button:hover:not(:disabled) { background: var(--theme-action); color: #fff !important; }
html[data-app-theme] .app-shell .reward-list .button:hover:not(:disabled) * { color: #fff !important; }
html[data-app-theme] :is(input:not([type="radio"]):not([type="checkbox"]):not([type="color"]):not([type="file"]),textarea,select,.handle-field) { background-color: var(--theme-input); border-color: var(--theme-line); color: var(--theme-ink); }
html[data-app-theme] :is(input,textarea)::placeholder { color: var(--theme-muted); opacity: .75; }
html[data-app-theme] input:is([type="checkbox"],[type="radio"]) { accent-color: var(--theme-action); }
html[data-app-theme] :is(.app-shell,.sheet,.illustration-viewer,.admin-shell) :focus-visible { outline-color: var(--theme-accent); }
html[data-app-theme] :is(.button,.viewer-complete):disabled { background: var(--theme-soft); border-color: var(--theme-line); color: var(--theme-muted) !important; }
html[data-app-theme] :is(.button,.viewer-complete):disabled * { color: var(--theme-muted) !important; }
html[data-app-theme] .book-page .book-poster-hero { background: var(--theme-surface); border-color: var(--theme-line); }
html[data-app-theme] .book-page .book-current-preview { background: var(--theme-accent); }
html[data-app-theme] .book-page .book-current-preview__media { background: var(--theme-soft); border-color: color-mix(in srgb,var(--theme-accent) 35%,var(--theme-surface)); }
html[data-app-theme] .book-page .book-current-preview__label { background: var(--theme-action); color: #fff !important; }
html[data-app-theme] .book-page .book-catalog-card { background: var(--theme-surface); border-color: var(--theme-line); }
html[data-app-theme] .book-page .book-catalog-card[data-status="in_progress"]::before { background: var(--theme-accent); }
html[data-app-theme] .book-page .book-catalog-card[data-status="in_progress"]:is(:hover,:focus-within) { border-color: var(--theme-accent) !important; }
html[data-app-theme] :is(.book-catalog__filters button[data-active="true"],.favorites-filter button.is-active,.status-control button.is-active) { border-color: var(--theme-accent); background: var(--theme-soft); }
html[data-app-theme] .favorite-button { background: var(--theme-surface); color: var(--theme-accent) !important; border-color: var(--theme-line); }
html[data-app-theme] .favorite-button svg { color: var(--theme-accent); }
html[data-app-theme] .collection-progress__trim svg circle { fill: var(--theme-decoration); }
html[data-app-theme] .collection-progress__trim svg rect { fill: var(--theme-surface); }
html[data-app-theme] :is(.book-progress-panel__stats i,.book-progress-ticks li)[data-state="done"] { background: var(--theme-accent); }
html[data-app-theme] :is(.book-progress-panel__stats i,.book-progress-ticks li)[data-state="in-progress"] { background: var(--theme-secondary); }
html[data-app-theme] :is(.book-progress-panel__stats i,.book-progress-ticks li)[data-state="not-started"] { background: transparent; border-color: var(--theme-line); }
/* The viewer and dialogs live under overlay-root, outside app-shell. */
html[data-app-theme] :is(.illustration-viewer,.viewer-stage) { background: var(--theme-stage); color: var(--theme-ink); }
html[data-app-theme] :is(.viewer-topbar,.viewer-panel,.marker-panel-header,.viewer-panel-footer,.viewer-toolbar-button,.viewer-status-trigger,.viewer-status-menu,.viewer-zoom-controls,.stage-arrow,.sheet) { background: var(--theme-surface); color: var(--theme-ink); border-color: var(--theme-line); }
html[data-app-theme] :is(.marker-mapping-row,.viewer-panel-scroll,.marker-recents,.viewer-topbar,.viewer-panel-footer) { border-color: var(--theme-line); }
html[data-app-theme] .marker-input-wrap input { background: var(--theme-input); border-color: var(--theme-line); color: var(--theme-ink); }
html[data-app-theme] .marker-input-wrap input:focus { border-color: var(--theme-accent); box-shadow: 0 0 0 3px color-mix(in srgb,var(--theme-accent) 15%,transparent); }
html[data-app-theme] :is(.marker-recent-menu,.marker-recents__list button,.viewer-status-menu button:hover,.viewer-status-menu button[data-selected]) { background: var(--theme-soft); color: var(--theme-ink); }
html[data-app-theme] .marker-tracker__progress { background: var(--theme-soft); }
html[data-app-theme] .marker-tracker__progress span { background: var(--theme-accent); }
html[data-app-theme] .proof-file { background: var(--theme-soft); border-color: var(--theme-line); }
html[data-app-theme] .proof-file:hover { border-color: var(--theme-accent); }
html[data-app-theme] .proof-status { background: var(--theme-soft); color: var(--theme-ink); }
html[data-app-theme] .proof-status * { color: var(--theme-ink) !important; }
/* Theme-aware podium decoration keeps each place distinct. */
html[data-app-theme] .podium-platform { background: repeating-linear-gradient(90deg,var(--theme-decoration) 0 25px,var(--theme-soft) 25px 50px); }
html[data-app-theme] .podium-platform::before { background-image: radial-gradient(ellipse 25px 17px at 25px 18px,var(--theme-decoration) 98%,transparent); }
html[data-app-theme] .podium-place[data-slot="1"] .podium-platform { background: repeating-linear-gradient(90deg,color-mix(in srgb,var(--theme-accent) 50%,var(--theme-surface)) 0 25px,var(--theme-soft) 25px 50px); }
html[data-app-theme] .podium-place[data-slot="1"] .podium-platform::before { background-image: radial-gradient(ellipse 25px 17px at 25px 18px,color-mix(in srgb,var(--theme-accent) 50%,var(--theme-surface)) 98%,transparent); }
html[data-app-theme] .podium-place[data-slot="3"] .podium-platform { background: repeating-linear-gradient(90deg,color-mix(in srgb,var(--theme-decoration) 55%,var(--theme-surface)) 0 25px,var(--theme-soft) 25px 50px); }
html[data-app-theme] .podium-place[data-slot="3"] .podium-platform::before { background-image: radial-gradient(ellipse 25px 17px at 25px 18px,color-mix(in srgb,var(--theme-decoration) 55%,var(--theme-surface)) 98%,transparent); }
html[data-app-theme] .podium-platform > span { background: var(--theme-background); }
html[data-app-theme] .ranking-list .ranking-person.is-self { background: var(--theme-soft); }
html[data-app-theme] .ranking-list .is-self .ranking-name small { background: var(--theme-decoration); color: var(--theme-strong) !important; }
/* A provider button is branded; inherited text themes must never recolor it. */
html[data-app-theme] .auth-shell .auth-panel a.auth-yandex,html[data-app-theme] .auth-shell .auth-panel a.auth-yandex * { color: #fff !important; }
html[data-app-theme] .auth-shell .auth-panel a.auth-yandex { background: #202020; }
html[data-app-theme] .auth-yandex__mark { background: #fc3f1d; }
html[data-app-theme] .marker-panel-header [data-marker-panel-save] svg { background: var(--theme-action); color: #fff; }
html[data-app-theme] .book-catalog-card__continue,html[data-app-theme] .book-catalog-card__continue * { background: var(--theme-action); color: #fff !important; }
html[data-app-theme] .book-page .book-identity:not(.book-identity--promo-art) h1,
html[data-app-theme] .book-page .book-identity:not(.book-identity--promo-art) h1 * { color: #fff !important; }
html[data-app-theme] .marker-mapping-row[data-state="error"] input,
html[data-app-theme] :is(input,textarea)[aria-invalid="true"] { border-color: var(--theme-error); }
html[data-app-theme="night"] .app-shell .reward-list .button { color: var(--theme-accent) !important; border-color: var(--theme-accent); }
html[data-app-theme] :is(.profile-privacy-note,.profile-help-card) { background: var(--theme-soft); border-color: var(--theme-line); }
html[data-app-theme] .profile-toggle { background: var(--theme-line); }
html[data-app-theme] input:checked + .profile-toggle { background: var(--theme-action); }
html[data-app-theme] .achievement-celebration__card { background: var(--theme-surface); border-color: var(--theme-line); color: var(--theme-ink); }
html[data-app-theme] .achievement-celebration__card :is(h2,p,span,small) { color: var(--theme-ink) !important; }
html[data-app-theme] .app-shell {
 --luni-canvas: var(--theme-background); --luni-surface: var(--theme-surface); --luni-white: var(--theme-surface);
 --luni-ink-soft: var(--theme-muted); --luni-muted: var(--theme-muted); --luni-coral: var(--theme-accent); --luni-blue: var(--theme-secondary); --luni-blush: var(--theme-soft); --luni-lavender: var(--theme-decoration);
}
html[data-app-theme] .palette-composer { background: var(--theme-surface); border-color: var(--theme-line); }
html[data-app-theme] .skip-link { background: var(--theme-action); color: #fff !important; }
html[data-app-theme] .admin-shell .wordmark > span { background: var(--theme-action); color: #fff !important; }
