/* Bookworm: спокойная книжная мастерская с ретро-типографикой и пастельными акцентами. */

:root {
  --font-ui: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-display: "Iowan Old Style", Georgia, serif;
  --text-xs: 10px;
  --text-meta: 12px;
  --text-sm: 13px;
  --text-body: 15px;
  --text-title: 20px;
  --bg: #0c0c0e;
  --panel: #17171a;
  --panel-2: #1f1f24;
  --ink: #f5f3ec;
  --muted: #a2a19a;
  --faint: #85837c;
  --line: #26262b;
  --fill: rgba(255, 255, 255, 0.07);

  --lilac: #cdbcf4;
  --sage: #cfe2bd;
  --cream: #f2e3b3;
  --coral: #f0917c;
  --bookmark: #e35b49;
  --on-pastel: #17140e;
  --on-pastel-muted: rgba(23, 20, 14, 0.62);

  --pill-bg: #f5f3ec;
  --pill-ink: #131313;

  --good: #9ed184;
  --bad: #f0917c;

  --blur-bg: rgba(12, 12, 14, 0.82);
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.35);
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f1efe9;
    --panel: #ffffff;
    --panel-2: #f7f5ef;
    --ink: #161512;
    --muted: #5e5c54;
    --faint: #6b685e;
    --line: #e4e1d7;
    --fill: rgba(22, 21, 18, 0.06);
    --pill-bg: #161512;
    --pill-ink: #f5f3ec;
    --good: #44772f;
    --bad: #ad3d26;
    --bookmark: #c64b3d;
    --blur-bg: rgba(241, 239, 233, 0.85);
    --shadow: 0 2px 14px rgba(60, 55, 40, 0.1);
  }

}

:root[data-theme="light"] {
  --bg: #f1efe9;
  --panel: #ffffff;
  --panel-2: #f7f5ef;
  --ink: #161512;
  --muted: #5e5c54;
  --faint: #6b685e;
  --line: #e4e1d7;
  --fill: rgba(22, 21, 18, 0.06);
  --pill-bg: #161512;
  --pill-ink: #f5f3ec;
  --good: #44772f;
  --bad: #ad3d26;
  --bookmark: #c64b3d;
  --blur-bg: rgba(241, 239, 233, 0.85);
  --shadow: 0 2px 14px rgba(60, 55, 40, 0.1);
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html {
  font: 16px/1.45 var(--font-ui);
}

body { background: var(--bg); color: var(--ink); min-height: 100vh; }

button { font: inherit; color: inherit; }

#app {
  max-width: 560px;
  margin: 0 auto;
  position: relative;
  min-height: 100dvh;
  padding-right: 18px;
  padding-left: 18px;
  padding-top: calc(24px + env(safe-area-inset-top));
  padding-bottom: calc(28px + env(safe-area-inset-bottom));
}

/* ---------- типографика ---------- */

h1 { font: 700 34px/1.06 var(--font-display); letter-spacing: -0.5px; margin: 8px 0 6px; }
h2 { font-size: var(--text-title); font-weight: 800; letter-spacing: -0.3px; line-height: 1.16; margin: 26px 2px 10px; }
.greeting { color: var(--muted); font-size: var(--text-body); font-weight: 700; margin-top: 10px; }
.sub { color: var(--muted); font-size: var(--text-body); line-height: 1.45; margin-bottom: 16px; }
.eyebrow { color: var(--muted); font-size: var(--text-meta); font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }

.onboarding-shell { min-height: calc(100dvh - 52px); display: flex; flex-direction: column; }
.onboarding-top { min-height: 44px; display: flex; align-items: center; justify-content: space-between; }
.onboarding-top button {
  min-height: 44px; padding: 0 4px; border: 0; background: none;
  color: var(--muted); font-size: 13px; font-weight: 800; cursor: pointer;
}
.onboarding-stage { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 14px 0 18px; }
.onboarding-stage h1 { max-width: 500px; font-size: clamp(34px, 9vw, 48px); line-height: 1.03; margin: 10px 0 15px; }
.welcome-copy { max-width: 480px; color: var(--muted); font-size: 16px; line-height: 1.5; }
.onboarding-visual {
  min-height: 230px; position: relative; display: grid; place-items: center;
  overflow: visible; margin-bottom: 26px; border: 0; border-radius: 0;
  background: transparent;
}
.story-book {
  width: 132px; height: 184px; position: absolute; left: 28px; bottom: 22px;
  display: flex; flex-direction: column; justify-content: space-between;
  padding: 18px; border-radius: 5px; background: var(--lilac); color: var(--on-pastel);
  box-shadow: inset -10px 0 rgba(0, 0, 0, .08), 0 12px 28px rgba(0, 0, 0, .18);
}
.story-book span { font-size: 12px; font-weight: 900; }
.story-book strong { font: 700 21px/1.08 "Iowan Old Style", Georgia, serif; }
.story-page {
  width: 172px; height: 154px; position: absolute; right: 24px; top: 28px;
  display: grid; align-content: center; gap: 12px; padding: 22px;
  border: 1px solid var(--line); border-radius: 4px; background: var(--bg); transform: rotate(3deg);
}
.story-page i { display: block; height: 5px; border-radius: 3px; background: var(--line); }
.story-page i.short { width: 65%; }
.story-page i.unknown { background: var(--coral); }
.story-stack { width: min(310px, 84%); height: 185px; position: relative; }
.story-stack > div {
  width: 190px; min-height: 118px; position: absolute; top: 30px; left: 50%;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  border: 1px solid rgba(23, 20, 14, .12); border-radius: 7px;
  background: var(--cream); color: var(--on-pastel); box-shadow: 0 10px 24px rgba(0, 0, 0, .16);
}
.story-stack > div:nth-child(1) { transform: translateX(-74%) rotate(-8deg); background: var(--sage); }
.story-stack > div:nth-child(2) { transform: translateX(-50%); z-index: 2; }
.story-stack > div:nth-child(3) { transform: translateX(-26%) rotate(8deg); background: var(--lilac); }
.story-stack small { font-size: 9px; font-weight: 850; letter-spacing: .8px; text-transform: uppercase; opacity: .55; }
.story-stack strong { margin-top: 9px; font-size: 25px; }
.story-stack span { font-size: 13px; opacity: .72; }
.story-reader {
  width: min(330px, 88%); min-height: 180px; padding: 25px 27px;
  border-radius: 5px; background: var(--cream); color: var(--on-pastel);
  box-shadow: inset 8px 0 rgba(0, 0, 0, .06), 0 12px 28px rgba(0, 0, 0, .16);
}
.story-reader span { font-size: 10px; font-weight: 850; letter-spacing: 1px; text-transform: uppercase; opacity: .55; }
.story-reader p { margin-top: 18px; font: 19px/1.65 "Iowan Old Style", Georgia, serif; }
.story-reader mark { padding: 1px 2px; background: var(--sage); color: inherit; }
.story-shelf {
  width: min(330px, 88%); height: 176px; display: flex; align-items: flex-end; justify-content: center; gap: 6px;
  border-bottom: 10px solid var(--ink);
}
.story-shelf i {
  width: 54px; height: 132px; display: grid; place-items: center; border-radius: 4px 4px 0 0;
  color: var(--on-pastel); font-size: 18px; font-style: normal; font-weight: 900;
  box-shadow: inset -7px 0 rgba(0, 0, 0, .08);
}
.story-shelf i:nth-child(2) { height: 152px; }
.story-shelf i:nth-child(3) { height: 118px; }
.story-shelf i:nth-child(4) { height: 142px; }
.onboarding-footer { padding-top: 8px; }
.onboarding-progress { min-height: 24px; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; font-weight: 800; }
.onboarding-progress i { width: 22px; height: 3px; border-radius: 2px; background: var(--line); }
.onboarding-progress i.on { background: var(--ink); }
.onboarding-progress span { margin-left: auto; }
.onboarding-actions { display: flex; gap: 8px; }
.onboarding-actions .btn { flex: 1; }
.welcome-back {
  width: 54px; min-height: 54px; align-self: flex-end; border: 1px solid var(--line);
  border-radius: 50%; background: var(--panel); cursor: pointer;
}
.auth-card { margin-top: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--panel); box-shadow: 0 10px 28px rgba(0,0,0,.12); }
.auth-tabs { display: grid; grid-template-columns: 1fr 1.25fr; gap: 4px; padding: 4px; border-radius: 13px; background: var(--panel-2); }
.auth-tab { min-height: 44px; padding: 0 8px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 12px; font-weight: 850; cursor: pointer; }
.auth-tab.is-active { background: var(--lilac); color: var(--on-pastel); box-shadow: 0 3px 0 color-mix(in srgb, var(--lilac) 65%, #000 35%); }
.auth-form { display: grid; gap: 10px; margin-top: 14px; }
.auth-name-field[hidden] { display: none; }
.auth-form .field { gap: 5px; }
.auth-form .field span { font-size: 11px; }
.auth-form .field input { min-height: 45px; }
.auth-form .btn { width: 100%; min-height: 48px; margin-top: 2px; }
.auth-form .btn:disabled { opacity: .55; cursor: wait; }
.auth-note { color: var(--muted); font-size: 11px; line-height: 1.35; text-align: center; }
.flow-head, .focus-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.flow-head { color: var(--muted); font-size: 12px; font-weight: 800; letter-spacing: .5px; text-transform: uppercase; margin-bottom: 22px; }
.focus-head { min-height: 48px; margin-bottom: 12px; }
.focus-head div { min-width: 0; }
.focus-head div span, .focus-head div strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.focus-head div span { color: var(--muted); font-size: 12px; font-weight: 700; }
.focus-head div strong { font-size: 16px; margin-top: 2px; }
.focus-head > span { flex: 0 0 auto; color: var(--muted); font-size: 13px; font-weight: 800; }
.focus-close {
  width: 44px; height: 44px; flex: 0 0 44px; border: 1px solid var(--line);
  border-radius: 50%; background: var(--panel); color: var(--ink); cursor: pointer;
}

/* ---------- новая оболочка главного экрана ---------- */

.home-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 36px; }
.home-actions { display: flex; align-items: center; gap: 10px; }
.brand-lockup { display: flex; align-items: center; gap: 10px; }
.wordmark {
  position: relative; display: inline-flex; align-items: center; gap: 0;
  min-height: 39px; padding: 0 4px 7px; color: var(--ink);
  font: 600 24px/.88 var(--font-display); letter-spacing: 1px;
}
.wordmark::after {
  content: ""; position: absolute; left: 59%; right: 9px; bottom: 2px; height: 2px;
  border-radius: 999px; background: var(--ink); opacity: .72; transform: translateY(-7px);
}
.wordmark span { color: var(--ink); }
.wordmark-glasses {
  position: relative; display: inline-flex !important; align-items: center; gap: 4px;
  width: 55px; height: 28px; margin: 0 3px 0 1px; color: var(--ink) !important;
}
.wordmark-glasses::before {
  content: ""; position: absolute; left: 25px; top: 13px; width: 7px; height: 2px;
  border-radius: 2px; background: currentColor;
}
.wordmark-glasses i {
  width: 25px; height: 25px; display: block; border: 2px solid currentColor;
  border-radius: 50%; font-style: normal;
}
.wordmark-bookmark {
  width: 10px; height: 13px; position: absolute; right: 1px; bottom: -9px; z-index: 1;
  background: var(--bookmark); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 78%, 0 100%); transform: translateY(-7px);
}
@media (max-width: 430px) {
  .wordmark { min-height: 34px; padding-bottom: 6px; font-size: 19px; letter-spacing: .6px; }
  .wordmark-glasses { width: 43px; height: 22px; gap: 3px; margin-right: 2px; }
  .wordmark-glasses i { width: 19px; height: 19px; border-width: 1.8px; }
  .wordmark-glasses::before { left: 20px; top: 10px; width: 6px; height: 1.5px; }
  .wordmark-bookmark { width: 8px; height: 11px; right: 2px; bottom: -7px; }
}
.profile-button {
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%;
  background: var(--panel); font-size: 15px; font-weight: 850; cursor: pointer;
}
.home-intro { margin-bottom: 20px; }
.home-intro > p { color: var(--muted); font-size: 14px; font-weight: 700; }
.home-intro h1 { font-family: var(--font-ui); font-size: 36px; font-weight: 850; line-height: 1.05; margin: 7px 0 14px; }
.quiet-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; margin-top: 2px; }
.quiet-stat {
  min-height: 62px; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  padding: 10px 11px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--panel); color: var(--ink);
}
.quiet-stat:nth-child(1) { box-shadow: inset 0 3px var(--sage); }
.quiet-stat:nth-child(2) { box-shadow: inset 0 3px var(--coral); }
.quiet-stat:nth-child(3) { box-shadow: inset 0 3px var(--lilac); }
.quiet-stat strong { overflow: hidden; font-size: 18px; line-height: 1.05; letter-spacing: -.3px; text-overflow: ellipsis; white-space: nowrap; }
.quiet-stat span { color: var(--muted); font-size: 10px; font-weight: 750; line-height: 1.15; }
.quiet-stat-level strong { font-size: 15px; }
.now-card {
  display: grid; grid-template-columns: 98px minmax(0, 1fr); gap: 18px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 16px; margin-bottom: 12px;
}
.now-card.has-book-accent {
  background: var(--book-accent, var(--panel));
  color: var(--on-pastel);
  border-color: transparent;
}
.now-card.has-book-accent .eyebrow,
.now-card.has-book-accent .now-copy > p:not(.eyebrow),
.now-card.has-book-accent .reading-progress { color: var(--on-pastel-muted); }
.now-card.has-book-accent .reading-cta {
  background: var(--on-pastel);
  color: var(--book-accent, var(--lilac));
}
.book-cover {
  min-height: 146px; display: grid; place-items: center; border-radius: 6px;
  color: var(--on-pastel); font-size: 34px; font-weight: 900;
  box-shadow: inset -8px 0 rgba(0, 0, 0, .08);
}
.real-cover { display: block; object-fit: cover; box-shadow: none; }
.book-cover.real-cover { width: 98px; height: 146px; }
.tone-0 { background: var(--lilac); }
.tone-1 { background: var(--sage); }
.tone-2 { background: var(--cream); }
.tone-3 { background: var(--coral); }
.now-copy { min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.now-copy .eyebrow { font-size: 10px; }
.now-copy h2 { margin: 7px 0 5px; font-size: 24px; line-height: 1.08; }
.now-copy > p:not(.eyebrow) { color: var(--muted); font-size: 13px; }
.reading-progress { width: 100%; margin: 7px 0 12px; }
.reading-progress-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.reading-progress-head span { color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .3px; text-transform: uppercase; }
.reading-progress-head strong { color: inherit; font-size: 18px; line-height: 1; letter-spacing: -.5px; }
.reading-progress-track { height: 7px; overflow: hidden; margin-top: 6px; border-radius: 999px; background: rgba(23, 20, 14, .14); }
.reading-progress-track span { display: block; height: 100%; min-width: 0; border-radius: inherit; background: var(--coral); }
.reading-progress small { display: block; margin-top: 5px; color: var(--muted); font-size: 10px; font-weight: 700; }
/* на пастельной обложке приглушённый цвет — чернильный, на тёмной панели — системный */
.now-card.has-book-accent .reading-progress-head span,
.now-card.has-book-accent .reading-progress small { color: var(--on-pastel-muted); }
.reading-cta {
  width: 100%; min-height: 50px; display: flex; align-items: center; justify-content: space-between;
  gap: 6px; margin-top: auto; padding: 12px 14px; border: none; border-radius: 8px;
  background: var(--ink); color: var(--bg); text-align: left; cursor: pointer;
}
.reading-cta span { min-width: 0; flex: 1 1 auto; white-space: nowrap; font-size: 11px; letter-spacing: -.15px; font-weight: 850; }
.reading-cta small { font-size: 10px; font-weight: 700; opacity: .7; white-space: nowrap; }
/* книга ещё обрабатывается — вместо кнопки спокойный статус */
.reading-cta.is-waiting { flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px; cursor: default; opacity: .72; animation: waiting-pulse 1.6s ease-in-out infinite; }
.reading-cta.is-waiting span { white-space: normal; flex: none; }
@keyframes waiting-pulse { 50% { opacity: .45; } }
.empty-library {
  background: var(--lilac); color: var(--on-pastel); border-radius: 8px;
  padding: 24px; margin-bottom: 12px;
}
.empty-library .eyebrow { color: var(--on-pastel-muted); }
.empty-library h2 { margin: 10px 0 12px; font-size: 28px; line-height: 1.12; }
.empty-library > p:not(.eyebrow) { color: var(--on-pastel-muted); font-size: 15px; line-height: 1.5; }
.empty-library .reading-cta { margin-top: 24px; background: var(--on-pastel); color: var(--lilac); }
.review-strip, .reward-strip {
  width: 100%; min-height: 68px; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 13px 16px; margin-bottom: 12px; border: 1px solid var(--line);
  border-radius: 8px; background: var(--panel); color: var(--ink); text-align: left;
}
button.review-strip, button.reward-strip { cursor: pointer; }
.review-strip > span:first-child { display: grid; gap: 2px; }
.review-strip strong { font-size: 14px; }
.review-strip small, .reward-strip small { color: var(--muted); font-size: 12px; }
.review-strip.is-done { background: color-mix(in srgb, var(--sage) 35%, var(--panel)); }
.reward-strip { position: relative; overflow: visible; background: var(--cream); color: var(--on-pastel); border-color: transparent; font-weight: 850; }
.reward-strip::before {
  content: ""; width: 23px; height: 34px; position: absolute; top: -8px; right: 30px; z-index: 1;
  background: var(--coral); clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 76%, 0 100%);
  box-shadow: 0 3px 0 rgba(23, 20, 14, .16);
}
.reward-strip small { color: var(--on-pastel-muted); }
.community-strip {
  width: 100%; min-height: 68px; display: flex; align-items: center; justify-content: space-between;
  gap: 14px; padding: 13px 16px; margin-bottom: 12px; border: 1px solid transparent;
  border-radius: 14px; background: var(--lilac); color: var(--on-pastel); text-align: left; cursor: pointer;
  box-shadow: inset 0 -5px rgba(23, 20, 14, .06);
}
.community-strip > span { display: grid; gap: 2px; }
.community-strip strong { font-size: 15px; }
.community-strip small { color: var(--on-pastel-muted); font-size: 11px; font-weight: 750; }
.community-strip i { font-size: 22px; font-style: normal; }
.library-link {
  width: 100%; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 14px 16px; margin-top: 12px; border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel); color: var(--ink); text-align: left; cursor: pointer;
}
.library-link > span { display: grid; gap: 3px; }
.library-link strong { font-size: 15px; }
.library-link small { color: var(--muted); font-size: 11px; font-weight: 700; }
.library-link i { color: var(--lilac); font-size: 24px; font-style: normal; }
.library-section { margin-top: 30px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }
.section-head button, .text-action, .detail-head button {
  min-height: 44px; border: none; background: none; color: var(--muted);
  font-size: 13px; font-weight: 800; cursor: pointer;
}
.book-row {
  width: 100%; min-height: 72px; display: flex; align-items: center; gap: 13px;
  padding: 10px 12px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--panel); color: var(--ink); text-align: left; cursor: pointer;
}
.book-row .grow { flex: 1; min-width: 0; }
.mini-cover {
  width: 38px; height: 50px; flex: 0 0 38px; display: grid; place-items: center;
  border-radius: 4px; color: var(--on-pastel); font-size: 15px; font-weight: 900;
  box-shadow: inset -4px 0 rgba(0, 0, 0, .08);
}
.mini-cover.real-cover { object-fit: cover; }
.detail-head { min-height: 44px; display: flex; align-items: center; margin-bottom: 18px; }
.book-toolbar { justify-content: space-between; }
.detail-head button { padding: 0; color: var(--ink); }
.book-toolbar #book-decks {
  min-height: 40px; padding: 0 14px; border: 1px solid transparent; border-radius: 999px;
  background: var(--lilac); color: var(--on-pastel); box-shadow: 0 3px 0 color-mix(in srgb, var(--lilac) 58%, #000 42%);
}
.text-action { color: var(--ink); padding: 0; }
.home-actions .text-action {
  min-height: 40px; padding: 0 13px; border: 1px solid var(--line); border-radius: 999px;
  background: var(--lilac); border-color: transparent; color: var(--on-pastel); font-size: 12px; font-weight: 850; white-space: nowrap;
  box-shadow: 0 3px 0 color-mix(in srgb, var(--lilac) 58%, #000 42%);
}
.home-actions .text-action:active { transform: translateY(1px); box-shadow: 0 2px 0 color-mix(in srgb, var(--lilac) 58%, #000 42%); }

/* ---------- профиль читателя ---------- */

.profile-toolbar { justify-content: space-between; }
.profile-toolbar button:last-child { color: var(--muted); }
.reader-pass {
  display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 16px;
  padding: 20px; border-radius: 8px; background: var(--cream); color: var(--on-pastel);
  box-shadow: inset 0 -8px rgba(0, 0, 0, .035);
}
.reader-monogram {
  width: 62px; height: 76px; display: grid; place-items: center;
  border: 1px solid rgba(23, 20, 14, .2); border-radius: 4px;
  font: 700 31px/1 "Iowan Old Style", Georgia, serif;
}
.reader-pass p { color: var(--on-pastel-muted); font-size: 9px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
.reader-pass h1 { margin: 5px 0 3px; font: 700 30px/1.05 "Iowan Old Style", Georgia, serif; }
.reader-pass span { color: var(--on-pastel-muted); font-size: 12px; font-weight: 750; }
.reader-ledger {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px;
}
.reader-ledger > div {
  min-height: 86px; padding: 13px 14px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--panel-2); display: flex; flex-direction: column; justify-content: center;
}
.reader-ledger > div:nth-child(1) { background: color-mix(in srgb, var(--sage) 38%, var(--panel)); }
.reader-ledger > div:nth-child(2) { background: color-mix(in srgb, var(--lilac) 38%, var(--panel)); }
.reader-ledger > div:nth-child(3) { background: color-mix(in srgb, var(--cream) 38%, var(--panel)); }
.reader-ledger > div:nth-child(4) { background: color-mix(in srgb, var(--coral) 30%, var(--panel)); }
.reader-ledger dt { font: 700 28px/1.1 "Iowan Old Style", Georgia, serif; }
.reader-ledger dd { margin-top: 4px; color: var(--muted); font-size: 11px; font-weight: 750; }
.profile-section { margin-top: 34px; }
.profile-section > h2, .profile-section .section-head h2 { margin: 0 0 12px; }
.profile-section .section-head { margin-bottom: 12px; }
.profile-book {
  width: 100%; min-height: 72px; display: grid; grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center; gap: 13px; padding: 10px 4px; border: 0; border-top: 1px solid var(--line);
  background: none; text-align: left; cursor: pointer;
}
.profile-book:last-child { border-bottom: 1px solid var(--line); }
.profile-book > span:nth-child(2) { min-width: 0; }
.profile-book strong, .profile-book small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.profile-book-copy { min-width: 0; }
.profile-book strong { font-size: 14px; }
.profile-book small { margin-top: 3px; color: var(--muted); font-size: 11px; }
.profile-progress { display: block; height: 5px; margin-top: 7px; overflow: hidden; border-radius: 999px; background: var(--fill); }
.profile-progress > span { display: block; height: 100%; border-radius: inherit; background: var(--book-accent, var(--lilac)); }
.profile-book i { color: var(--muted); font-style: normal; }
.shelf-frame { padding: 18px 12px 0; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); }
.shelf-frame .shelf { min-height: 152px; margin: 0; padding: 0 4px; border-bottom: 9px solid var(--ink); }
.stamp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.achievement-gallery { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(210px, 78%); gap: 10px; overflow-x: auto; padding: 2px 2px 10px; scroll-snap-type: x mandatory; scrollbar-width: none; }
.achievement-gallery::-webkit-scrollbar { display: none; }
.achievement-item { position: relative; min-height: 164px; display: flex; flex-direction: column; justify-content: flex-end; gap: 5px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; scroll-snap-align: start; background: var(--cream); color: var(--on-pastel); box-shadow: inset 0 -22px rgba(0,0,0,.04); }
.achievement-item:nth-child(3n + 2) { background: var(--sage); }
.achievement-item:nth-child(3n) { background: var(--lilac); }
.achievement-item.is-locked { background: var(--panel-2); color: var(--muted); box-shadow: none; border-style: dashed; }
.achievement-index { position: absolute; top: 14px; right: 16px; font: 700 12px/1 var(--font-ui); opacity: .5; }
.achievement-mascot { position: absolute; z-index: 0; right: -2px; bottom: -5px; width: 132px; height: 158px; object-fit: contain; object-position: bottom right; pointer-events: none; user-select: none; }
.achievement-item.is-locked .achievement-mascot { opacity: .34; filter: grayscale(.35); }
.achievement-copy { position: relative; z-index: 1; display: grid; gap: 5px; max-width: 64%; }
.achievement-item strong { max-width: 100%; font-size: 16px; line-height: 1.15; }
.achievement-item small { font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .08em; opacity: .65; }
.achievement-item p { max-width: 100%; font-size: 12px; line-height: 1.3; opacity: .72; }
.reader-stamp {
  position: relative; min-height: 108px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 7px; padding: 12px 8px; border: 0; border-radius: 18px; overflow: hidden;
  background: var(--lilac); color: var(--on-pastel); text-align: center;
  box-shadow: inset 0 -6px rgba(23, 20, 14, .06);
}
.reader-stamp::after { content: "✦"; position: absolute; right: 10px; top: 7px; color: rgba(23, 20, 14, .28); font-size: 16px; }
.reader-stamp:nth-child(2n) { background: var(--sage); }
.reader-stamp:nth-child(3n) { background: var(--cream); }
.reader-stamp span { position: relative; z-index: 1; font-size: 31px; line-height: 1; }
.reader-stamp small { position: relative; z-index: 1; max-width: none; color: var(--on-pastel-muted); font-size: 11px; font-weight: 850; line-height: 1.2; }
.reader-stamp em { position: relative; z-index: 1; color: var(--on-pastel-muted); font-size: 9px; font-style: normal; font-weight: 800; opacity: .72; }
.reader-stamp.is-locked { background: var(--panel-2); color: var(--muted); box-shadow: none; border: 1px dashed var(--line); }
.reader-stamp.is-locked::after { color: var(--faint); }
.reader-stamp.is-locked span { font-size: 34px; color: var(--faint); }
.reader-stamp.is-locked small { color: var(--muted); }
.settings-intro { margin: 12px 0 30px; }
.settings-intro h1 { font-size: 39px; }
.settings-intro > p:last-child { max-width: 440px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.settings-group { padding: 18px; margin-bottom: 12px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 10px 24px rgba(0,0,0,.08); }
.settings-group h2 { margin: 0 0 12px; }
.settings-section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.settings-section-head h2 { margin-top: 3px; }
.settings-live-mark { padding: 5px 8px; border: 1px solid color-mix(in srgb, var(--good) 45%, var(--line)); border-radius: 999px; color: var(--good); font-size: 9px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; }
.field-help { display: block; margin-top: 6px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.check > span { display: grid; gap: 3px; }
.check > span strong { font-size: 13px; }
.check > span small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.mode-options { display: grid; gap: 8px; }
.mode-option {
  min-height: 64px; display: flex; align-items: center; gap: 11px; padding: 12px;
  border: 1px solid var(--line); border-radius: 14px; background: var(--panel-2); cursor: pointer;
}
.mode-option:has(input:checked) { border-color: var(--lilac); background: color-mix(in srgb, var(--lilac) 18%, var(--panel)); box-shadow: inset 3px 0 var(--lilac); }
.mode-option input { width: 20px; height: 20px; accent-color: var(--lilac); flex: 0 0 20px; }
.mode-option span { display: grid; gap: 3px; }
.mode-option strong { font-size: 13px; }
.mode-option small { color: var(--muted); font-size: 11px; line-height: 1.3; }
.theme-options { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; }
.theme-option { min-height: 126px; display: flex; flex-direction: column; align-items: stretch; gap: 10px; padding: 9px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel-2); cursor: pointer; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.theme-option:hover { transform: translateY(-1px); }
.theme-option:has(input:checked) { border-color: var(--lilac); background: color-mix(in srgb, var(--lilac) 16%, var(--panel)); box-shadow: 0 6px 0 color-mix(in srgb, var(--lilac) 34%, transparent); }
.theme-option input { position: absolute; opacity: 0; pointer-events: none; }
.theme-preview { position: relative; display: block; height: 62px; overflow: hidden; border: 1px solid rgba(0,0,0,.12); border-radius: 11px; }
.theme-preview::before { content: ""; position: absolute; left: 8px; top: 9px; width: 29px; height: 6px; border-radius: 6px; background: currentColor; opacity: .88; }
.theme-preview::after { content: ""; position: absolute; left: 8px; right: 8px; bottom: 9px; height: 8px; border-radius: 5px; background: currentColor; opacity: .17; }
.theme-preview i { position: absolute; left: 8px; right: 22px; top: 25px; height: 4px; border-radius: 4px; background: currentColor; opacity: .28; }
.theme-preview i + i { top: 34px; right: 34px; opacity: .18; }
.theme-preview b { position: absolute; right: 8px; top: 8px; width: 11px; height: 11px; border-radius: 50%; background: var(--bookmark); }
.theme-preview-auto { color: #f5f3ec; background: linear-gradient(135deg, #17171a 0 50%, #f2eee4 50%); }
.theme-preview-light { color: #161512; background: #f2eee4; }
.theme-preview-dark { color: #f5f3ec; background: #17171a; }
.theme-label { display: flex; align-items: baseline; justify-content: space-between; gap: 4px; }
.theme-label strong { font-size: 12px; }
.theme-label small { color: var(--muted); font-size: 9px; white-space: nowrap; }
.quiet-danger {
  width: 100%; min-height: 48px; margin-top: 18px; border: 0; background: none;
  color: var(--bad); font-size: 13px; font-weight: 800; cursor: pointer;
}

/* ---------- новый экран книги ---------- */

.book-detail-hero { display: grid; grid-template-columns: 108px minmax(0, 1fr); gap: 20px; align-items: center; }
.detail-cover {
  height: 160px; display: grid; place-items: center; border-radius: 6px;
  color: var(--on-pastel); font-size: 38px; font-weight: 900;
  box-shadow: inset -9px 0 rgba(0, 0, 0, .08);
}
.detail-cover.real-cover { width: 108px; object-fit: cover; }
.book-detail-hero h1 { font-size: 34px; line-height: 1.05; margin: 8px 0; overflow-wrap: anywhere; }
.book-detail-hero > div:last-child > p:not(.eyebrow) { color: var(--muted); font-size: 14px; }
.book-facts { display: grid; gap: 4px; margin-top: 14px; color: var(--muted); font-size: 11px; font-weight: 700; }
.book-progress-summary { margin-top: 14px; }
.book-progress-summary > div:first-child { display: flex; align-items: baseline; gap: 6px; }
.book-progress-summary strong { font: 700 22px/1 "Iowan Old Style", Georgia, serif; }
.book-progress-summary span { color: var(--muted); font-size: 10px; font-weight: 750; }
.book-progress-summary .progress-track { height: 6px; margin-top: 6px; }
.book-progress-summary .progress-fill { background: var(--lilac); }
.book-actions { display: flex; align-items: center; justify-content: flex-start; gap: 10px; margin-top: 14px; }
.book-remove {
  min-height: 40px; padding: 0 12px; border: 1px solid color-mix(in srgb, var(--bad) 40%, var(--line));
  border-radius: 999px; background: transparent; color: var(--bad); font-size: 12px; font-weight: 850; cursor: pointer;
}
.chapter-focus {
  margin-top: 28px; padding: 20px; border-radius: 8px;
  background: var(--lilac); color: var(--on-pastel);
}
.chapter-focus.tone-0 { background: var(--lilac); }
.chapter-focus.tone-1 { background: var(--sage); }
.chapter-focus.tone-2 { background: var(--cream); }
.chapter-focus.tone-3 { background: var(--coral); }
.chapter-focus.is-complete { background: var(--sage); }
.chapter-focus-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.chapter-focus .eyebrow { color: var(--on-pastel-muted); }
.chapter-focus h2 { margin: 6px 0 0; font-size: 23px; line-height: 1.15; }
.chapter-focus-head > strong { font-size: 30px; letter-spacing: -1px; }
.chapter-focus > p:not(.eyebrow) { color: var(--on-pastel-muted); font-size: 13px; line-height: 1.5; }
.readiness-track { height: 7px; overflow: hidden; margin: 18px 0 12px; border-radius: 4px; background: rgba(23, 20, 14, .15); }
.readiness-track span { display: block; height: 100%; border-radius: inherit; background: var(--on-pastel); }
.chapter-focus .reading-cta { margin-top: 18px; background: var(--on-pastel); color: var(--book-accent, var(--lilac)); }
.study-choices { margin-top: 18px; }
.study-choices > p { color: var(--on-pastel-muted); font-size: 10px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; }
.study-choices .reading-cta { margin-top: 8px; }
.page-mode-button {
  width: 100%; min-height: 54px; display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-top: 8px; padding: 12px 14px; border: 1px solid rgba(23, 20, 14, .24);
  border-radius: 8px; background: transparent; color: var(--on-pastel); text-align: left; cursor: pointer;
}
.page-mode-button span { font-size: 14px; font-weight: 850; }
.page-mode-button small { color: var(--on-pastel-muted); font-size: 10px; font-weight: 750; white-space: nowrap; }
.chapters-section { margin-top: 30px; }
.chapters-section > h2 { margin: 0 0 10px; }
.chapter-row {
  min-height: 66px; display: grid; grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center; gap: 12px; border-top: 1px solid var(--line);
}

/* ---------- мастерская стопок ---------- */

.decks-intro { margin: 12px 0 28px; }
.decks-intro h1 { font: 700 43px/1.02 "Iowan Old Style", Georgia, serif; }
.decks-intro > p:last-child { max-width: 450px; color: var(--muted); font-size: 15px; line-height: 1.5; }
.deck-list { display: grid; gap: 10px; }
.deck-recipe {
  min-height: 190px; position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr);
  gap: 14px; padding: 20px 20px 66px; overflow: hidden; border: 0;
  border-radius: 20px; background: var(--cream); color: var(--on-pastel);
  box-shadow: inset 0 -7px rgba(23, 20, 14, .06), 0 8px 20px rgba(0, 0, 0, .12);
}
.deck-recipe::after { content: "✦"; position: absolute; right: 18px; top: 8px; color: rgba(23, 20, 14, .16); font-size: 44px; transform: rotate(14deg); }
.deck-recipe:nth-child(4n+2) { background: var(--sage); }
.deck-recipe:nth-child(4n+3) { background: var(--lilac); }
.deck-recipe:nth-child(4n) { background: var(--coral); }
.deck-recipe.is-empty { filter: saturate(.45); opacity: .68; }
.deck-suit { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 17px; background: rgba(23, 20, 14, .12); font: 700 32px/1 Georgia, serif; }
.deck-copy { min-width: 0; }
.deck-copy small { color: var(--on-pastel-muted); font-size: 9px; font-weight: 900; letter-spacing: .8px; text-transform: uppercase; }
.deck-copy h2 { margin: 4px 0 6px; font: 700 26px/1.05 "Iowan Old Style", Georgia, serif; }
.deck-copy p { max-width: 250px; color: var(--on-pastel-muted); font-size: 13px; line-height: 1.35; }
.deck-tags { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.deck-tags span { padding: 4px 8px; border-radius: 999px; background: rgba(23, 20, 14, .09); color: var(--on-pastel-muted); font-size: 9px; font-weight: 850; }
.deck-progress { grid-column: 1 / -1; align-self: end; }
.deck-progress > span { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 850; }
.deck-progress > span strong { font-size: 14px; }
.deck-progress > div { height: 7px; overflow: hidden; border-radius: 999px; background: rgba(23, 20, 14, .14); }
.deck-progress i { display: block; height: 100%; border-radius: inherit; background: var(--on-pastel); }
.deck-start {
  min-width: 112px; min-height: 42px; position: absolute; right: 20px; bottom: 14px;
  border: 0; border-radius: 999px; background: var(--on-pastel); color: #f5f3ec; font-size: 12px; font-weight: 850; cursor: pointer;
}
.deck-start:disabled { opacity: .35; cursor: default; }
.deck-edit { min-height: 44px; position: absolute; left: 20px; bottom: 17px; padding: 0 10px; border: 0; border-radius: 999px; background: rgba(23, 20, 14, .1); color: var(--on-pastel); font-size: 10px; font-weight: 850; cursor: pointer; }
.deck-delete { width: 44px; height: 44px; position: absolute; right: 6px; top: 4px; border: 0; background: none; color: var(--on-pastel-muted); font-size: 22px; cursor: pointer; }
.deck-builder { margin-top: 24px; padding: 0 16px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); }
.deck-builder summary { min-height: 74px; display: flex; align-items: center; justify-content: space-between; gap: 14px; cursor: pointer; list-style: none; }
.deck-builder summary > span { min-width: 0; display: grid; gap: 3px; }
.deck-builder summary strong { font-size: 16px; }
.deck-builder summary small { color: var(--muted); font-size: 11px; font-weight: 650; }
.deck-builder summary > b { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 34px; border-radius: 50%; background: var(--lilac); color: var(--on-pastel); font-size: 22px; line-height: 1; }
.deck-builder summary::-webkit-details-marker { display: none; }
.deck-builder form { padding: 0 0 20px; }
.deck-builder[open] summary { border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.deck-builder[open] summary > b { transform: rotate(45deg); }
.deck-form-row { display: grid; grid-template-columns: 1fr 1.5fr; gap: 10px; }
.front-translation { margin-top: 54px; font: 700 29px/1.25 "Iowan Old Style", Georgia, serif; }
.context-prompt { margin-top: 44px; font-size: 20px; line-height: 1.55; }
.chapter-row:last-child { border-bottom: 1px solid var(--line); }
.chapter-index {
  width: 30px; height: 30px; display: grid; place-items: center; border-radius: 50%;
  background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 850;
}
.chapter-row strong, .chapter-row small { display: block; }
.chapter-row strong { font-size: 14px; }
.chapter-row small { color: var(--muted); font-size: 11px; margin-top: 2px; }
.chapter-row.locked { opacity: .55; }
.chapter-row.done .chapter-index { background: var(--sage); color: var(--on-pastel); }
.chapter-row.current .chapter-index { background: var(--lilac); color: var(--on-pastel); }
.current-label { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; letter-spacing: .6px; }

.mascot { display: block; margin: 0 auto; border-radius: 28px; }
.mascot.sm { width: 64px; height: 64px; border-radius: 18px; margin: 0; }
.mascot.md { width: 148px; height: 148px; }
.mascot.lg { width: 210px; height: 210px; }
.day-head { display: flex; align-items: center; gap: 14px; }
.day-head .grow { flex: 1; }

/* ---------- герой ---------- */

.hero {
  display: block; width: 100%; text-align: left; border: none; cursor: pointer;
  background: var(--lilac); color: var(--on-pastel);
  border-radius: 24px; padding: 20px; margin: 8px 0 14px;
  transition: transform .1s;
}
.hero:active { transform: scale(.98); }
.hero .kicker { font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--on-pastel-muted); }
.hero .htitle { font-size: 25px; font-weight: 800; letter-spacing: -0.5px; margin-top: 6px; }
.hero .hmeta { font-size: 14px; font-weight: 600; margin-top: 6px; color: var(--on-pastel-muted); }
.hero .harrow {
  float: right; width: 40px; height: 40px; border-radius: 50%;
  background: var(--on-pastel); color: var(--lilac);
  display: grid; place-items: center; font-size: 19px; margin-top: -32px;
}

/* ---------- путь дня ---------- */

.xp-line { display: flex; align-items: center; gap: 10px; margin: 4px 0 16px; color: var(--muted); font-size: 14px; font-weight: 800; }
.xp-line .progress-track { flex: 1; margin-top: 0; }

.plan { margin: 4px 0 6px; }
.plan-step {
  display: flex; align-items: center; gap: 13px;
  border: none; border-radius: 20px;
  padding: 15px 16px; margin-bottom: 9px; cursor: pointer;
  color: var(--on-pastel);
  transition: transform .08s;
}
.plan-step:active { transform: scale(.98); }
.plan-step[data-step="review"] { background: var(--sage); }
.plan-step[data-step="portions"] { background: var(--cream); }
.plan-step[data-step="reward"] { background: var(--coral); }
.plan-step .snum {
  width: 32px; height: 32px; border-radius: 50%; flex-shrink: 0;
  background: var(--on-pastel); color: #f5f3ec;
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
}
.plan-step.done { opacity: .55; cursor: default; }
.plan-step.locked { background: var(--panel); color: var(--muted); opacity: 1; cursor: default; }
.plan-step.locked .snum { background: var(--fill); color: var(--muted); }
.plan-step.locked .stitle { color: var(--ink); }
.plan-step.locked .smeta { color: var(--faint); }
.plan-step.active { box-shadow: 0 0 0 3px var(--bg), 0 0 0 6px var(--lilac); }
.plan-step .stitle { font-weight: 800; font-size: 16px; letter-spacing: -0.2px; }
.plan-step .smeta { font-size: 13px; font-weight: 600; color: var(--on-pastel-muted); margin-top: 1px; }
.plan-step.locked .smeta { color: var(--muted); }

/* ---------- списки-карточки ---------- */

.card-box {
  background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 15px 16px; margin-bottom: 10px; min-height: 44px;
}
.card-box.compact { min-height: 0; }
.card-box.tappable { cursor: pointer; display: flex; align-items: center; gap: 12px; }
.card-box.tappable:active { background: var(--panel-2); }
.card-box .grow { flex: 1; min-width: 0; }
.chevron { color: var(--faint); font-size: 18px; }
.emoji-lead { font-size: 26px; }

.book-title { font-size: 16px; font-weight: 800; letter-spacing: -0.2px; }
.book-meta { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 3px; }

.progress-track { height: 8px; background: var(--fill); border-radius: 5px; margin-top: 10px; overflow: hidden; }
.progress-fill { height: 100%; background: var(--lilac); border-radius: 5px; transition: width .4s; }

/* ---------- кнопки ---------- */

.btn {
  display: block; width: 100%;
  min-height: 54px; padding: 16px 20px; margin-top: 12px;
  font-size: 16px; font-weight: 800; text-align: center; letter-spacing: -0.2px;
  border: none; border-radius: 999px; cursor: pointer;
  background: var(--pill-bg); color: var(--pill-ink);
  transition: transform .08s, opacity .08s;
}
.btn:active { transform: scale(.97); opacity: .9; }
.btn.secondary { background: var(--panel); color: var(--ink); border: 1px solid var(--line); }
.btn.small { width: auto; display: inline-block; min-height: 44px; padding: 12px 20px; font-size: 14px; margin-top: 8px; }
.btn:disabled { opacity: .4; }

.inline-btn, .link-btn {
  min-height: 44px; padding: 8px 14px;
  border: none; border-radius: 999px;
  background: var(--fill); color: var(--ink); cursor: pointer;
  font-size: 13px; font-weight: 800;
}
.link-btn { background: none; color: var(--lilac); padding-left: 0; }

.field { display: block; margin: 10px 0; }
.field span { display: block; color: var(--muted); font-size: 13px; font-weight: 800; margin-bottom: 5px; }
.field input, .field select {
  width: 100%; min-height: 46px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--bg); color: var(--ink); font: inherit;
}

/* ---------- калибровка ---------- */

.chip-grid { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0; }
.chip {
  min-height: 40px; display: inline-flex; align-items: center;
  padding: 8px 15px; border-radius: 999px; font-size: 15px; font-weight: 700;
  background: var(--panel); border: 1px solid var(--line); cursor: pointer; user-select: none;
  transition: transform .08s;
}
.chip:active { transform: scale(.94); }
.chip.on { background: var(--sage); color: var(--on-pastel); border-color: transparent; }
.band-all {
  font-size: 14px; font-weight: 800; color: var(--lilac); background: none; border: none;
  cursor: pointer; padding: 10px 4px; min-height: 44px;
}
label.check {
  display: flex; gap: 12px; align-items: center; margin: 18px 0;
  font-size: 15px; font-weight: 600;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 16px; padding: 14px 16px;
}
label.check input { width: 22px; height: 22px; accent-color: var(--lilac); flex-shrink: 0; }

/* ---------- тренажёр ---------- */

.trainer-progress { display: flex; gap: 4px; margin: 10px 0 16px; }
.trainer-progress i { flex: 1; height: 5px; border-radius: 3px; background: var(--fill); }
.trainer-progress i.done { background: var(--sage); }
.trainer-progress i.cur { background: var(--lilac); }

/* ---------- разбор слов со страницы ---------- */

.screening-meter { height: 5px; overflow: hidden; margin: 4px 0 16px; border-radius: 3px; background: var(--fill); }
.screening-meter span { display: block; height: 100%; border-radius: inherit; background: var(--lilac); transition: width .18s ease; }
.screening-card {
  min-height: 340px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); text-align: center;
}
.screening-card .card-kicker { margin-bottom: 16px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: 1px; text-transform: uppercase; }
.screening-card .word { font-size: 40px; font-weight: 850; letter-spacing: -.8px; }
.screening-card > small { margin-top: 7px; color: var(--muted); font-size: 13px; font-weight: 700; }
.screening-card > p { max-width: 420px; margin-top: 22px; color: var(--muted); font: 17px/1.5 "Iowan Old Style", Georgia, serif; }
.screening-card details { width: 100%; margin-top: 24px; border-top: 1px solid var(--line); }
.screening-card summary { min-height: 48px; display: grid; place-items: center; color: var(--muted); font-size: 12px; font-weight: 800; cursor: pointer; }
.screening-card details div { padding: 4px 0 12px; font-size: 18px; font-weight: 800; }
.screening-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 10px; }
.screening-actions button {
  min-height: 54px; padding: 8px 4px; border: 0; border-radius: 8px;
  color: var(--on-pastel); font-size: 13px; font-weight: 850; cursor: pointer;
}
.screening-actions button:nth-child(1) { background: var(--sage); }
.screening-actions button:nth-child(2) { background: var(--cream); }
.screening-actions button:nth-child(3) { background: var(--lilac); }
.screening-actions button:disabled { opacity: .45; }
.screening-result { padding-top: 20px; }
.screening-result h1 { max-width: 480px; margin: 10px 0 24px; font-size: 39px; line-height: 1.05; }
.screening-result .reader-ledger { margin-bottom: 24px; }

.flashcard {
  width: 100%; color: var(--ink); font: inherit;
  background: var(--panel); border: 1px solid var(--line); border-radius: 26px;
  padding: 38px 24px; min-height: 310px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
  box-shadow: var(--shadow);
  animation: cardIn .18s ease-out;
}
button.flashcard { cursor: pointer; }
section.flashcard { cursor: default; }
@keyframes cardIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .flashcard { animation: none; } }

.flashcard .word { font-size: 40px; font-weight: 800; letter-spacing: -0.8px; }
.flashcard .form-note { color: var(--muted); font-size: 15px; font-weight: 600; margin-top: 8px; }
.flashcard .ipa { color: var(--lilac); font-size: 18px; font-weight: 700; margin-top: 10px; }
.flashcard .translation { font-size: 22px; font-weight: 800; margin-top: 14px; }
.flashcard .card-kicker { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; margin-bottom: 16px; }
.flashcard .card-context {
  max-width: 440px; font-family: "New York", Georgia, serif; font-size: 18px;
  color: var(--muted); margin-top: 22px; line-height: 1.55;
}
.flashcard .card-context b { color: var(--ink); font-style: normal; }
.flashcard .example {
  font-family: "New York", Georgia, serif;
  font-size: 17px; color: var(--muted); margin-top: 18px; font-style: italic; line-height: 1.55;
}
.flashcard .example b { color: var(--on-pastel); background: var(--cream); border-radius: 5px; padding: 0 4px; font-style: normal; }
.flashcard .hint { color: var(--faint); font-size: 13px; font-weight: 700; margin-top: 24px; }
.flashcard.card-deck {
  min-height: 340px; border: 0; border-radius: 22px; background: var(--lilac); color: var(--on-pastel);
  box-shadow: inset 0 -8px rgba(23, 20, 14, .07), 0 12px 26px rgba(0, 0, 0, .16);
}
.flashcard.card-deck .card-kicker, .flashcard.card-deck .hint { color: var(--on-pastel-muted); }
.flashcard.card-deck .translation { color: var(--on-pastel); }
.flashcard.card-breakdown {
  min-height: 360px; border: 1px solid color-mix(in srgb, var(--cream) 60%, var(--line)); border-radius: 8px;
  background: var(--cream); color: var(--on-pastel); box-shadow: 0 10px 18px rgba(23, 20, 14, .1);
}
.flashcard.card-breakdown .card-kicker, .flashcard.card-breakdown .hint { color: var(--on-pastel-muted); }
.flashcard.card-breakdown .word { font: 700 44px/1.05 "Iowan Old Style", Georgia, serif; }
.flashcard.card-adaptive { background: var(--panel); border-radius: 26px; }

.badge {
  display: inline-block; margin-top: 14px; font-size: 11px; font-weight: 800;
  color: var(--on-pastel); background: var(--cream); border-radius: 999px; padding: 4px 10px;
  letter-spacing: .5px;
}

.rating-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-top: 14px; }
.rating-row button {
  min-height: 54px; padding: 12px 4px; font-size: 14px; font-weight: 800;
  border: none; border-radius: 999px; cursor: pointer;
  color: var(--on-pastel);
  transition: transform .08s;
}
.rating-row .r1 { background: var(--coral); }
.rating-row .r2 { background: var(--cream); }
.rating-row .r3 { background: var(--sage); }
.rating-row .r4 { background: var(--lilac); }
.rating-row button:active { transform: scale(.94); }
/* режим новых слов: три действия вместо четырёх оценок */
.rating-row.is-learning { grid-template-columns: repeat(3, 1fr); }
.rating-row .r-known { background: var(--lilac); }

/* ---------- испытание главы ---------- */

.quiz-card {
  background: var(--lilac); color: var(--on-pastel);
  border-radius: 26px; padding: 32px 24px; text-align: center;
}
.quiz-card .kicker { font-size: 11px; font-weight: 800; letter-spacing: 1.4px; text-transform: uppercase; color: var(--on-pastel-muted); }
.quiz-card .word { font-size: 36px; font-weight: 800; letter-spacing: -0.7px; margin-top: 10px; }
.quiz-options { display: grid; gap: 9px; margin-top: 16px; }
.quiz-options button {
  min-height: 54px; padding: 14px 16px; font-size: 15px; font-weight: 700;
  border: 1px solid var(--line); border-radius: 999px; cursor: pointer;
  background: var(--panel); color: var(--ink);
  transition: transform .08s;
}
.quiz-options button:active { transform: scale(.97); }
.quiz-options button.correct { background: var(--sage); color: var(--on-pastel); border-color: transparent; }
.quiz-options button.wrong { background: var(--coral); color: var(--on-pastel); border-color: transparent; }

/* ---------- читалка ---------- */

.reader {
  background: var(--panel); border: 1px solid var(--line); border-radius: 22px;
  padding: 28px 22px;
  font-family: "New York", "Iowan Old Style", Georgia, serif;
  font-size: 20px; line-height: 1.8;
}
.reader .w { cursor: pointer; border-radius: 4px; }
.reader .w:active { background: var(--fill); }
.reader .w.fresh { background: var(--cream); color: var(--on-pastel); padding: 0 2px; border-radius: 5px; }
.reader-note { color: var(--muted); font-size: 13px; font-weight: 600; margin: 12px 6px 0; }

/* ---------- итог ---------- */

.summary { text-align: center; padding-top: 22px; }
.summary .big { font-size: 58px; }
.summary h1 { margin-top: 10px; }
.stat-row { display: flex; justify-content: center; gap: 28px; margin: 22px 0; }
.stat-row .stat { text-align: center; }
.stat-row .num { font-size: 28px; font-weight: 800; letter-spacing: -0.5px; }
.stat-row .lbl { font-size: 12px; font-weight: 700; color: var(--muted); margin-top: 2px; }
.stats-hero { display: grid; grid-template-columns: minmax(0, 1fr) 112px; gap: 14px; align-items: end; margin: 10px 0 14px; padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--lilac); color: var(--on-pastel); box-shadow: inset 0 -7px rgba(23,20,14,.06); }
.stats-hero .eyebrow { color: var(--on-pastel-muted); }
.stats-hero h1 { margin: 7px 0 8px; font-size: 36px; }
.stats-hero p:not(.eyebrow) { max-width: 310px; color: var(--on-pastel-muted); font-size: 13px; line-height: 1.4; }
.stats-streak { display: grid; justify-items: end; align-content: end; text-align: right; }
.stats-streak strong { font: 700 52px/.82 "Iowan Old Style", Georgia, serif; }
.stats-streak span { margin-top: 7px; font-size: 12px; font-weight: 850; }
.stats-streak small { margin-top: 11px; color: var(--on-pastel-muted); font-size: 10px; font-weight: 800; }
.stats-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
.stats-metric { min-height: 92px; display: flex; flex-direction: column; justify-content: space-between; padding: 14px; border: 1px solid var(--line); border-radius: 17px; color: var(--on-pastel); }
.stats-metric strong { font: 700 29px/1 "Iowan Old Style", Georgia, serif; }
.stats-metric span { color: var(--on-pastel-muted); font-size: 10px; font-weight: 850; line-height: 1.2; }
.metric-sage { background: var(--sage); }
.metric-lilac { background: color-mix(in srgb, var(--lilac) 82%, var(--panel)); }
.metric-cream { background: color-mix(in srgb, var(--cream) 86%, var(--panel)); }
.stats-freeze { display: grid; grid-template-columns: 30px minmax(0, 1fr); gap: 12px; align-items: start; margin: 0 0 28px; padding: 15px 16px; border: 1px solid color-mix(in srgb, var(--good) 45%, var(--line)); border-radius: 17px; background: color-mix(in srgb, var(--good) 12%, var(--panel)); }
.stats-freeze.is-used { border-color: var(--line); background: var(--panel-2); }
.stats-freeze-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 10px; background: var(--good); color: var(--on-pastel); font-size: 16px; }
.stats-freeze.is-used .stats-freeze-mark { background: var(--faint); }
.stats-freeze strong { font-size: 14px; }
.stats-freeze p { margin-top: 4px; color: var(--muted); font-size: 11px; line-height: 1.35; }
.stats-section { margin-top: 28px; }
.stats-section .section-head { margin-bottom: 10px; }
.stats-section h2 { margin: 0; }
.chart-legend { display: flex; gap: 14px; margin-top: 10px; color: var(--muted); font-size: 10px; font-weight: 750; }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.legend-portion { background: var(--lilac); }
.legend-review { background: var(--coral); }
.hardest-list { overflow: hidden; border-top: 1px solid var(--line); }
.hardest-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; min-height: 64px; padding: 8px 2px; border-bottom: 1px solid var(--line); }
.hardest-rank { color: var(--faint); font: 700 12px/1 var(--font-display); }
.hardest-copy { min-width: 0; display: grid; gap: 3px; }
.hardest-copy strong { overflow: hidden; font-size: 15px; text-overflow: ellipsis; white-space: nowrap; }
.hardest-copy small { overflow: hidden; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.hardest-lapses { padding: 5px 7px; border-radius: 999px; background: color-mix(in srgb, var(--bad) 14%, var(--panel)); color: var(--bad); font-size: 10px; font-weight: 850; white-space: nowrap; }

.level-tag {
  display: inline-block; font-size: 13px; font-weight: 800; letter-spacing: .4px;
  color: var(--on-pastel); background: var(--lilac); border-radius: 999px; padding: 5px 12px;
  margin-left: 8px; vertical-align: middle;
}

/* ---------- тропа книги ---------- */

.path { position: relative; padding: 6px 0 4px; }
.path::before {
  content: ""; position: absolute; left: 23px; top: 20px; bottom: 24px; width: 3px;
  background: var(--line); border-radius: 2px;
}
.pnode { position: relative; display: flex; gap: 16px; align-items: center; padding: 11px 0; }
.pnode .ring {
  width: 48px; height: 48px; border-radius: 50%; flex-shrink: 0;
  background: conic-gradient(var(--lilac) calc(var(--p, 0) * 1%), var(--line) 0);
  display: grid; place-items: center; position: relative; z-index: 1;
}
.pnode .core {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--panel); display: grid; place-items: center;
  font-size: 13px; font-weight: 800; color: var(--muted);
}
.pnode.done .ring { background: var(--sage); }
.pnode.done .core { background: var(--sage); color: var(--on-pastel); font-size: 17px; }
.pnode.current .ring { box-shadow: 0 0 0 6px color-mix(in srgb, var(--lilac) 25%, transparent); }
.pnode.current .core { color: var(--ink); }
.pnode.locked { opacity: .4; }
.pnode .info { flex: 1; min-width: 0; }
.pnode .ptitle { font-size: 16px; font-weight: 800; letter-spacing: -0.2px; }
.pnode .pmeta { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 2px; }

/* ---------- закладка дня ---------- */

.quote-view {
  background: var(--cream); color: var(--on-pastel);
  border-radius: 26px; padding: 34px 26px; text-align: center; margin-top: 14px;
}
.quote-view .qmark { font-size: 44px; color: var(--on-pastel-muted); font-family: Georgia, serif; line-height: .4; }
.quote-view .qtext {
  font-family: "New York", Georgia, serif; font-style: italic;
  font-size: 21px; line-height: 1.6; margin: 14px 0;
}
.quote-view .qbook { color: var(--on-pastel-muted); font-size: 14px; font-weight: 700; }

.quote-mini {
  border-left: 3px solid var(--cream); padding: 8px 12px; margin-bottom: 10px;
  font-family: "New York", Georgia, serif; font-style: italic; font-size: 15px;
  color: var(--muted); line-height: 1.5;
}
.quote-mini .qday { font-style: normal; font-size: 12px; font-weight: 700; color: var(--faint); margin-top: 4px; font-family: var(--font-ui); }

/* ---------- статистика ---------- */

.chart { display: flex; gap: 5px; align-items: flex-end; padding: 12px 4px 2px; }
.day-bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 7px; min-width: 0; }
.day-bar i { position: relative; display: block; width: 100%; max-width: 19px; overflow: hidden; background: color-mix(in srgb, var(--coral) 40%, var(--panel)); border-radius: 7px 7px 3px 3px; }
.day-bar i b { position: absolute; left: 0; right: 0; bottom: 0; display: block; background: var(--lilac); }
.day-bar.is-empty i { background: var(--line); }
.day-bar span { font-size: 9px; font-weight: 700; color: var(--faint); white-space: nowrap; }

/* ---------- шторка ---------- */

#sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--panel); border: 1px solid var(--line); border-bottom: none;
  border-radius: 24px 24px 0 0;
  box-shadow: 0 -8px 40px rgba(0, 0, 0, .35);
  padding: 8px 20px calc(22px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
  transition: transform .25s cubic-bezier(.32, .72, .35, 1);
}
#sheet.hidden { transform: translateY(calc(100% + 32px)); visibility: hidden; pointer-events: none; }
.grabber { width: 44px; height: 6px; border-radius: 999px; background: var(--fill); margin: 6px auto 14px; touch-action: none; cursor: grab; }
#sheet .word { font-size: 27px; font-weight: 800; letter-spacing: -0.5px; }
#sheet .ipa { color: var(--lilac); font-weight: 700; margin-top: 2px; }
#sheet .translation { font-size: 18px; margin-top: 8px; }

/* ---------- прочее ---------- */

.upload-zone {
  border: 1.5px dashed var(--faint); border-radius: 20px;
  min-height: 72px; display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 15px; font-weight: 700; cursor: pointer; margin-top: 12px;
}
.upload-zone:active { background: var(--fill); }

.shelf { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; align-items: flex-end; }
.shelf .spine {
  background: var(--lilac); color: var(--on-pastel); border-radius: 6px 10px 10px 6px;
  padding: 20px 11px; font-size: 13px; font-weight: 800;
  writing-mode: vertical-rl; max-height: 170px; overflow: hidden;
}
.shelf .spine:nth-child(3n+2) { background: var(--sage); }
.shelf .spine:nth-child(3n) { background: var(--cream); }
.empty-note { color: var(--muted); font-size: 15px; padding: 4px 2px; }

.spinner {
  margin: 40px auto; width: 30px; height: 30px;
  border: 3px solid var(--fill); border-top-color: var(--lilac);
  border-radius: 50%; animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
.center { text-align: center; color: var(--muted); }

/* ---------- растровый маскот ---------- */
/* PNG с альфа-каналом: иллюстрация остаётся частью блока, а не наклейкой рядом. */
.mascot-asset {
  display: block;
  width: auto;
  height: auto;
  object-fit: contain;
  pointer-events: none;
}
.mascot-welcome-stage {
  position: relative;
  width: 100%;
  min-height: 230px;
  display: grid;
  place-items: end center;
  overflow: hidden;
  background: transparent;
}
.mascot-welcome-stage::before {
  content: "";
  position: absolute;
  z-index: 0;
  width: 76%;
  height: 84%;
  left: 12%;
  top: 8%;
  background: var(--mascot-blob, var(--lilac));
  border-radius: 52% 48% 42% 58% / 38% 48% 52% 62%;
  transform: rotate(-6deg) scale(1.03);
}
.mascot-welcome { position: relative; z-index: 1; width: 84%; max-width: 310px; height: 225px; max-height: 225px; object-fit: contain; }
.mascot-breakdown-stage { background: transparent; }
.mascot-breakdown { width: 86%; max-width: 320px; max-height: 220px; }
.mascot-reader-stage { background: transparent; }
.mascot-reader { width: 87%; max-width: 320px; max-height: 220px; }
.mascot-deck-stage { background: transparent; }
.mascot-deck { width: 58%; max-width: 235px; height: 220px; max-height: 220px; }
.mascot-auth-stage::before { background: var(--sage); transform: rotate(5deg) scale(.96); }
.mascot-auth { width: 78%; max-width: 290px; height: 220px; }
.mascot-empty { width: min(280px, 82%); max-height: 168px; margin: -8px auto 8px; }
.mascot-processing { width: min(260px, 72%); max-height: 210px; margin: 0 auto 4px; }
.mascot-reward { width: min(280px, 78%); max-height: 235px; margin: -4px auto 0; }
.onboarding-visual { overflow: visible; padding: 0; }

.calibration-intro { position: relative; min-height: 164px; padding-right: 138px; }
.calibration-intro .sub { margin-bottom: 0; }
.mascot-calibration { position: absolute; right: -3px; bottom: -6px; width: 148px; max-height: 146px; }

.decks-intro { position: relative; min-height: 156px; padding-right: 128px; }
.decks-intro h1 { margin-top: 5px; }
.mascot-decks { position: absolute; right: -4px; bottom: -8px; width: 132px; max-height: 150px; }

.shelf-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 0 20px; }
.shelf-toolbar button:first-child { justify-self: start; }
.shelf-toolbar button:last-child { justify-self: end; white-space: nowrap; }
.shelf-intro { position: relative; min-height: 190px; padding: 22px 130px 22px 22px; margin: 4px 0 26px; overflow: hidden; }
.shelf-intro h1 { margin: 7px 0 9px; font-size: 34px; line-height: 1.05; }
.shelf-intro p:last-child { color: var(--muted); font-size: var(--text-body); line-height: 1.45; }
.shelf-toolbar button:last-child { min-height: 40px; padding: 0 13px; border-radius: 999px; background: var(--lilac); color: var(--on-pastel); }
.mascot-shelf { position: absolute; right: -8px; bottom: -20px; width: 188px; max-height: 225px; object-fit: contain; }
@media (max-width: 430px) {
  .shelf-toolbar { padding: 0 2px; }
  .shelf-intro { padding: 18px 124px 20px 18px; }
  .shelf-intro h1 { font-size: 31px; }
  .mascot-shelf { right: -16px; bottom: -20px; width: 166px; }
}
.shelf-books .section-head { margin-bottom: 12px; }
.shelf-count { min-width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: var(--cream); color: var(--on-pastel); font-size: 12px; font-weight: 850; }
.shelf-book-row { width: 100%; min-height: 92px; display: grid; grid-template-columns: 52px minmax(0, 1fr) auto; align-items: center; gap: 13px; padding: 12px 10px; margin-bottom: 9px; border: 1px solid var(--line); border-radius: 15px; background: var(--panel); color: var(--ink); text-align: left; cursor: pointer; }
.shelf-book-cover { width: 52px; height: 68px; display: grid; place-items: center; border-radius: 6px; color: var(--on-pastel); font-size: 18px; font-weight: 900; box-shadow: inset -5px 0 rgba(0,0,0,.08); }
.shelf-book-cover.real-cover { object-fit: cover; }
.shelf-book-copy { min-width: 0; display: grid; gap: 3px; }
.shelf-book-copy strong { overflow: hidden; font-size: 16px; white-space: nowrap; text-overflow: ellipsis; }
.shelf-book-copy small, .shelf-book-meta { overflow: hidden; color: var(--muted); font-size: 11px; white-space: nowrap; text-overflow: ellipsis; }
.shelf-book-progress { display: block; height: 5px; margin-top: 4px; overflow: hidden; border-radius: 999px; background: var(--fill); }
.shelf-book-progress i { display: block; height: 100%; border-radius: inherit; background: var(--book-accent, var(--lilac)); }
.shelf-book-row > .chevron { color: var(--muted); }
.shelf-empty { margin-top: 0; }

.fab-action { width: 58px; height: 58px; position: fixed; right: max(20px, calc((100vw - 430px) / 2)); bottom: 24px; z-index: 10; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--lilac); color: var(--on-pastel); font-size: 31px; line-height: 1; cursor: pointer; box-shadow: 0 7px 0 color-mix(in srgb, var(--lilac) 62%, #000 38%), 0 13px 24px rgba(0,0,0,.2); }
.fab-action:active { transform: translateY(2px); box-shadow: 0 5px 0 color-mix(in srgb, var(--lilac) 62%, #000 38%), 0 10px 18px rgba(0,0,0,.18); }
.fab-hint { max-width: 180px; margin: 0 0 18px auto; color: var(--muted); font-size: 11px; font-weight: 750; text-align: right; }
.group-fab-shell { position: fixed; right: max(20px, calc((100vw - 430px) / 2)); bottom: 24px; z-index: 12; }
.group-fab-shell .fab-action { position: static; }
.group-fab-menu { position: absolute; right: 0; bottom: 70px; display: grid; gap: 8px; width: 218px; padding: 10px; border: 1px solid var(--line); border-radius: 18px; background: var(--panel); box-shadow: 0 12px 30px rgba(0,0,0,.2); }
.group-fab-menu[hidden] { display: none; }
.group-fab-menu button { min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: var(--panel-2); color: var(--ink); text-align: left; font-size: 12px; font-weight: 800; cursor: pointer; }
.group-fab-menu button:first-child { background: var(--lilac); color: var(--on-pastel); }
.group-feed-card { position: relative; min-height: 188px; display: flex; flex-direction: column; justify-content: space-between; margin: 0 0 12px; padding: 18px; overflow: hidden; border: 1px solid var(--line); border-radius: 20px; background: var(--sage); color: var(--on-pastel); cursor: pointer; isolation: isolate; }
.group-card-cover, .group-card-pastel, .group-card-shade { position: absolute; inset: 0; width: 100%; height: 100%; }
.group-card-cover { z-index: -3; object-fit: cover; }
.group-card-pastel { z-index: -3; }
.group-card-shade { z-index: -2; background: linear-gradient(180deg, rgba(10,8,7,.05), rgba(10,8,7,.72)); }
.group-feed-card.no-cover .group-card-shade { background: transparent; }
.group-feed-card.no-cover .group-card-copy, .group-feed-card.no-cover .group-card-action { text-shadow: none; }
.group-card-copy, .group-card-action { position: relative; z-index: 1; }
.group-card-copy { color: var(--ink); }
.group-feed-card:has(.group-card-cover) .group-card-copy, .group-feed-card:has(.group-card-cover) .group-card-action { color: #fff; text-shadow: 0 1px 8px rgba(0,0,0,.45); }
.group-card-copy small { font-size: 10px; font-weight: 850; letter-spacing: .08em; text-transform: uppercase; opacity: .78; }
.group-card-copy h3 { max-width: 88%; margin-top: 7px; font: 700 28px/1.03 var(--font-display); }
.group-card-copy p { margin-top: 7px; font-size: 13px; font-weight: 700; opacity: .82; }
.group-card-action { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 12px; font-weight: 850; }
.group-card-action .inline-btn { border-color: currentColor; color: inherit; background: rgba(255,255,255,.14); }
.group-card-role { opacity: .7; }
.group-feed-card:nth-of-type(3n + 2) .group-card-pastel { background: var(--lilac); }
.group-feed-card:nth-of-type(3n) .group-card-pastel { background: var(--cream); }
.sheet-dialog { width: min(100% - 24px, 430px); margin: auto; padding: 20px; border: 1px solid var(--line); border-radius: 22px; background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.28); }
.sheet-dialog::backdrop { background: rgba(10, 9, 8, .55); backdrop-filter: blur(3px); }
.sheet-dialog-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.sheet-dialog-head h2 { margin-top: 5px; font-size: 24px; line-height: 1.08; }
.sheet-close { width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%; background: var(--panel-2); color: var(--ink); font-size: 24px; cursor: pointer; }
.invite-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 9px; }
.invite-code { min-width: 0; overflow-wrap: anywhere; color: var(--muted); font-size: 12px; }

.reader-pass { position: relative; min-height: 154px; padding: 24px 146px 24px 24px; overflow: hidden; }
.reader-pass h1 { font-size: 34px; }
.reader-monogram { width: 72px; height: 88px; }
.mascot-profile { position: absolute; right: 5px; bottom: -10px; width: 136px; max-height: 150px; }

.groups-intro { position: relative; min-height: 150px; padding-right: 134px; }
.groups-intro h1 { margin-top: 8px; }
.groups-intro .sub { margin-bottom: 0; }
.group-chat { margin-top: 28px; }
.group-chat h2 { margin-bottom: 10px; }
.group-chat.is-locked { padding: 16px; border: 1px dashed var(--line); border-radius: 16px; background: var(--panel); }
.group-chat.is-locked h2 { margin-top: 0; }
.group-chat.is-locked p { color: var(--muted); font-size: 13px; line-height: 1.45; }
.chat-log { display: grid; gap: 8px; max-height: 360px; overflow-y: auto; padding: 12px; border: 1px solid var(--line); border-radius: 16px; background: var(--panel); }
.chat-message { padding: 9px 10px; border-radius: 12px; background: var(--panel-2); }
.chat-message strong { font-size: 12px; }
.chat-message p { margin-top: 2px; font-size: 13px; line-height: 1.35; }
.chat-message small { display: block; margin-top: 4px; color: var(--faint); font-size: 9px; }
.chat-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; margin-top: 8px; }
.chat-form input { min-width: 0; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); color: var(--ink); font: inherit; }
.mascot-groups { position: absolute; right: -5px; bottom: -7px; width: 150px; max-height: 154px; }

.empty-library { overflow: hidden; }
.empty-library .eyebrow,
.empty-library h2,
.empty-library > p:not(.eyebrow),
.empty-library .reading-cta { position: relative; z-index: 1; }
.empty-library .mascot-empty { transform: rotate(-2deg); }

@media (max-width: 390px) {
  .mascot-welcome-stage { min-height: 205px; }
  .mascot-welcome { max-height: 200px; }
}
