.account-page {
  --account-night: #0d1737;
  --account-night-soft: #19264e;
  --account-gold: #ffe45c;
  --account-paper: #fffdf8;
  --account-ink: #292842;
  --account-muted: #66677b;
  background: #f5f3ee;
}

.account-hero {
  position: relative;
  overflow: hidden;
  padding: clamp(54px, 7vw, 92px) 0 62px;
  color: #fff;
  background:
    radial-gradient(circle at 84% 16%, rgba(255, 228, 92, .13), transparent 23rem),
    radial-gradient(circle at 8% 100%, rgba(153, 135, 203, .19), transparent 26rem),
    linear-gradient(125deg, var(--account-night), #19234b 70%, #24294f);
}

.account-hero::after {
  position: absolute;
  right: 8%;
  bottom: -155px;
  width: 310px;
  height: 310px;
  border: 1px solid rgba(255, 228, 92, .12);
  border-radius: 50%;
  box-shadow: 0 0 0 28px rgba(255, 228, 92, .025), 0 0 0 56px rgba(255, 228, 92, .018);
  content: "";
  pointer-events: none;
}

.account-eyebrow { color: #f4df82; }
.account-hero-row {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  margin-top: 21px;
}
.account-hero h1 {
  max-width: 760px;
  margin: 0 0 15px;
  color: #fff;
  font-family: var(--heading);
  font-size: clamp(44px, 5.6vw, 70px);
  font-weight: 600;
  line-height: .98;
  letter-spacing: -.035em;
}
.account-hero h1 em { color: var(--account-gold); font-style: italic; }
.account-hero-row p { max-width: 650px; margin: 0; color: #e0e3f0; font-size: 15px; line-height: 1.75; }
.demo-pill {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 9px;
  padding: 11px 15px;
  border: 1px solid rgba(255, 228, 92, .35);
  border-radius: 999px;
  color: #fff7ce;
  background: rgba(255, 255, 255, .06);
  font-size: 12px;
  font-weight: 800;
}
.demo-pill span { color: var(--account-gold); }

.account-content { padding-top: 48px; padding-bottom: 88px; }
.account-grid {
  display: grid;
  grid-template-columns: minmax(260px, .78fr) minmax(0, 1.45fr);
  align-items: start;
  gap: 28px;
}
.login-panel, .library-panel {
  border: 1px solid rgba(42, 40, 66, .09);
  border-radius: 28px;
  background: var(--account-paper);
  box-shadow: 0 22px 56px rgba(36, 32, 58, .08);
}
.login-panel { padding: clamp(24px, 3vw, 36px); }
.login-mark {
  display: grid;
  width: 46px;
  height: 46px;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 16px;
  color: #fff1a2;
  background: var(--account-night-soft);
  font-size: 23px;
}
.login-panel .eyebrow, .library-heading .eyebrow { color: #806f91; font-size: 10px; }
.login-panel h2, .library-heading h2 {
  margin: 10px 0 12px;
  color: var(--account-ink);
  font-family: var(--heading);
  font-size: clamp(30px, 3vw, 39px);
  line-height: 1.04;
}
.login-copy { margin: 0 0 22px; color: #55566b; font-size: 14px; line-height: 1.7; }
#demoLoginForm { display: grid; gap: 10px; }
#demoLoginForm label, .share-fallback label { color: #39384f; font-size: 13px; font-weight: 800; }
#demoEmail, #publicDemoLink {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid #c8c5d1;
  border-radius: 13px;
  color: #292842;
  background: #fff;
  font-size: 15px;
}
#demoEmail::placeholder { color: #757486; }
.login-submit { width: 100%; margin-top: 5px; min-height: 52px; }
.login-status {
  min-height: 54px;
  margin: 17px 0 0;
  padding: 12px 14px;
  border-left: 3px solid #c19b4d;
  border-radius: 0 12px 12px 0;
  color: #45455d;
  background: #f6f1df;
  font-size: 12px;
  line-height: 1.55;
}
.login-note { display: flex; align-items: center; gap: 8px; margin-top: 17px; color: #56566b; font-size: 12px; font-weight: 700; }
.login-note span { color: #8c719c; font-size: 17px; }

.library-panel { padding: clamp(22px, 3vw, 34px); }
.library-heading { display: flex; align-items: center; justify-content: space-between; gap: 18px; margin-bottom: 23px; }
.library-heading h2 { margin-bottom: 0; }
.library-count {
  padding: 8px 12px;
  border-radius: 999px;
  color: #4b4660;
  background: #f0edf4;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.library-card {
  display: grid;
  grid-template-columns: minmax(190px, .72fr) minmax(0, 1.28fr);
  overflow: hidden;
  border: 1px solid #e8e3e9;
  border-radius: 22px;
  background: #fff;
}
.library-cover {
  position: relative;
  display: flex;
  min-height: 300px;
  flex-direction: column;
  justify-content: flex-end;
  overflow: hidden;
  padding: 23px;
  color: #fff8df;
  background:
    radial-gradient(circle at 70% 25%, rgba(255, 228, 92, .92) 0 2px, transparent 3px),
    radial-gradient(circle at 28% 31%, rgba(255, 255, 255, .9) 0 1px, transparent 2px),
    radial-gradient(circle at 52% 18%, rgba(255, 255, 255, .75) 0 1px, transparent 2px),
    linear-gradient(155deg, #202c5c, #56527f 61%, #b18b9f);
}
.library-cover::before, .library-cover::after {
  position: absolute;
  right: -20%;
  bottom: -30%;
  width: 140%;
  height: 58%;
  border: 1px solid rgba(255, 238, 178, .42);
  border-radius: 50%;
  content: "";
  transform: rotate(-12deg);
}
.library-cover::after { right: -35%; bottom: -37%; border-color: rgba(255, 255, 255, .18); }
.cover-orbit { position: absolute; top: 14%; right: 13%; width: 112px; height: 112px; border: 1px solid rgba(255, 235, 151, .34); border-radius: 50%; }
.orbit-two { top: 18%; right: 7%; width: 145px; height: 83px; transform: rotate(-27deg); }
.cover-moon { position: absolute; top: 17%; right: 27%; color: #fff1a0; font-size: 62px; line-height: 1; text-shadow: 0 0 30px rgba(255, 228, 92, .75); }
.cover-star { position: absolute; z-index: 1; color: #fff4c3; }
.star-one { top: 18%; left: 20%; font-size: 19px; }
.star-two { top: 42%; right: 15%; font-size: 15px; }
.cover-label, .cover-title, .cover-subtitle { position: relative; z-index: 2; }
.cover-label { margin-bottom: 12px; color: #fff0b5; font-size: 9px; font-weight: 900; letter-spacing: .18em; }
.cover-title { font-family: var(--heading); font-size: clamp(26px, 3vw, 34px); font-weight: 700; line-height: .98; }
.cover-subtitle { margin-top: 10px; color: #f1e6ee; font-size: 10px; }
.library-story { min-width: 0; padding: clamp(19px, 2.8vw, 30px); }
.story-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.story-badges span { padding: 6px 9px; border-radius: 999px; color: #3f4263; background: #eff0f7; font-size: 9px; font-weight: 900; letter-spacing: .07em; }
.story-badges span:first-child { color: #695416; background: #fff3c7; }
.library-story h3 { margin: 14px 0 7px; color: #292842; font-family: var(--heading); font-size: clamp(25px, 3vw, 34px); line-height: 1.05; }
.library-story > p { margin: 0 0 16px; color: #56566b; font-size: 13px; line-height: 1.6; }
.library-audio { display: block; width: 100%; min-height: 44px; margin: 8px 0 17px; accent-color: #73608a; }
.library-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.download-button { min-height: 46px; color: #433957; background: #eee9f2; font-size: 12px; }
.share-button { min-height: 46px; padding-inline: 16px; color: white; background: var(--account-night-soft); font-size: 12px; }
.share-button:hover { background: #283866; }
.share-button svg { width: 18px; height: 18px; }
.share-fallback { display: grid; gap: 8px; margin-top: 15px; padding: 13px; border: 1px solid #ddd6e6; border-radius: 14px; background: #f8f6fb; }
.share-link-row { display: flex; gap: 8px; }
#publicDemoLink { min-width: 0; min-height: 42px; padding-inline: 10px; font-size: 12px; }
.copy-button { flex: 0 0 auto; min-height: 42px; padding: 0 13px; border: 0; border-radius: 11px; color: white; background: #5d4d73; font-size: 12px; font-weight: 800; cursor: pointer; }
.share-status { min-height: 20px; margin: 8px 0 0; color: #4f4e64; font-size: 12px; line-height: 1.5; }
.library-disclaimer {
  display: flex;
  gap: 10px;
  margin: 16px 3px 0;
  color: #55556b;
  font-size: 12px;
  line-height: 1.6;
}
.library-disclaimer span { flex: 0 0 auto; color: #907d9d; }
.account-footer { padding: 22px 0; border-top: 1px solid rgba(42, 40, 66, .1); background: #f1eee8; }
.account-footer-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.account-footer-inner p { margin: 0; color: #5b596a; font-size: 12px; }
.account-footer-inner > a:last-child { color: #4a4260; font-size: 12px; font-weight: 800; }
.footer-brand { font-size: 16px; }
.footer-brand .brand-mark { width: 32px; height: 32px; color: #76627f; font-size: 18px; }

@media (max-width: 980px) {
  .account-page .header-inner { width: min(100% - 36px, 720px); height: 72px; }
  .account-page .main-nav, .account-page .header-cta { display: none; }
  .account-page .menu-toggle {
    display: flex;
    width: 46px;
    height: 46px;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1px solid rgba(71, 61, 83, .18);
    border-radius: 14px;
    color: #45384c;
    background: #fffdf8;
    cursor: pointer;
  }
  .account-page .menu-toggle span { display: block; width: 19px; height: 2px; border-radius: 2px; background: currentColor; }
  .account-page .mobile-nav:not([hidden]) {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 8px 20px 16px;
    border-top: 1px solid rgba(123, 102, 140, .1);
    background: rgba(250, 246, 239, .98);
  }
  .account-page .mobile-nav-link { padding: 12px 4px; border-bottom: 1px solid rgba(123, 102, 140, .1); font-size: 14px; }
  .account-grid { grid-template-columns: minmax(235px, .78fr) minmax(0, 1.22fr); gap: 18px; }
  .library-card { grid-template-columns: minmax(160px, .62fr) minmax(0, 1.38fr); }
  .library-cover { min-height: 275px; }
}

@media (max-width: 760px) {
  .account-page .container { width: min(100% - 36px, 600px); }
  .account-hero { padding: 48px 0 42px; }
  .account-hero-row { align-items: flex-start; flex-direction: column; gap: 18px; }
  .account-hero h1 { font-size: clamp(42px, 10vw, 56px); }
  .account-hero-row p { font-size: 14px; }
  .demo-pill { font-size: 11px; }
  .account-content { padding-top: 26px; padding-bottom: 58px; }
  .account-grid { grid-template-columns: 1fr; gap: 18px; }
  .login-panel, .library-panel { border-radius: 22px; }
  .login-panel { order: 2; }
  .library-panel { order: 1; }
  .library-card { grid-template-columns: 1fr; }
  .library-cover { min-height: 205px; }
  .library-story { padding: 20px; }
  .library-actions { align-items: stretch; }
  .library-actions .button { flex: 1 1 145px; }
  .account-footer-inner { align-items: flex-start; flex-wrap: wrap; }
  .account-footer-inner p { order: 3; width: 100%; }
}

@media (max-width: 420px) {
  .account-page .header-inner { width: calc(100% - 28px); }
  .account-page .container { width: calc(100% - 28px); }
  .library-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
  .library-count { font-size: 10px; }
  .share-link-row { align-items: stretch; flex-direction: column; }
  .account-footer-inner > a:last-child { margin-left: auto; }
}

@media (prefers-reduced-motion: reduce) {
  .account-page *, .account-page *::before, .account-page *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

.share-fallback[hidden] { display: none; }

/* Keep the accessible skip link available to keyboard users without overlaying the default view. */
.account-page .skip-link:not(:focus):not(:active) {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.account-page .skip-link:focus {
  position: fixed;
  z-index: 1200;
  top: 16px;
  left: 16px;
}


/* Живая авторизация и личная библиотека текстовых сказок. */
.auth-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; margin: 0 0 18px; padding: 5px; border-radius: 14px; background: #f0edf4; }
.auth-switch-button { min-height: 42px; padding: 8px 10px; border: 0; border-radius: 10px; color: #514b62; background: transparent; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.auth-switch-button.is-active { color: #fff; background: #19264e; box-shadow: 0 4px 12px rgba(25, 38, 78, .18); }
.auth-form { display: grid; gap: 9px; }
.auth-form[hidden] { display: none; }
.auth-form > label:not(.account-consent) { margin-top: 4px; color: #39384f; font-size: 13px; font-weight: 800; }
.auth-form input:not([type="checkbox"]) { width: 100%; min-height: 48px; padding: 0 13px; border: 1px solid #c8c5d1; border-radius: 13px; color: #292842; background: #fff; font: inherit; font-size: 15px; }
.auth-form input:focus-visible, .share-link-input:focus-visible { outline: 3px solid rgba(124, 102, 148, .35); outline-offset: 2px; }
.account-consent { display: flex; align-items: flex-start; gap: 10px; margin: 10px 0 3px; color: #55566b; font-size: 12px; line-height: 1.6; }
.account-consent input { flex: 0 0 auto; width: 18px; height: 18px; margin-top: 2px; accent-color: #5d4d73; }
.auth-form .login-submit { margin-top: 4px; }
.account-grid.is-authenticated { grid-template-columns: minmax(0, 1fr); }
.library-heading-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 9px; }
.library-greeting { margin: 9px 0 0; color: #606075; font-size: 13px; line-height: 1.5; }
.logout-button { min-height: 40px; color: #493e5b; background: #eee9f2; }
.retention-notice { margin: 0 0 18px; padding: 14px 16px; border: 1px solid #eadcae; border-radius: 15px; color: #514c45; background: #fff8df; font-size: 12px; line-height: 1.65; }
.retention-notice strong { color: #493a16; }
.story-list { display: grid; gap: 16px; }
.saved-story-card { display: grid; grid-template-columns: minmax(176px, 220px) minmax(0, 1fr); align-items: start; gap: clamp(18px, 2.5vw, 26px); padding: clamp(18px, 2.5vw, 26px); border: 1px solid #e6e0e8; border-radius: 22px; background: #fff; }
.saved-story-body { min-width: 0; }
.story-cover { position: relative; width: 100%; aspect-ratio: 4 / 5; overflow: hidden; margin: 0; border: 1px solid rgba(255, 255, 255, .5); border-radius: 18px; background: linear-gradient(145deg, #243a72, #8170ab 60%, #e4aa9e); box-shadow: 0 12px 28px rgba(30, 39, 79, .2); isolation: isolate; }
.story-cover--sleep { background: linear-gradient(155deg, #283f78, #8176b1 62%, #eab4b2); }
.story-cover--road { background: linear-gradient(155deg, #3b8db7, #9dcbe1 58%, #f0c49c); }
.story-cover--adventure { background: linear-gradient(155deg, #172d66, #665bab 58%, #e3a27d); }
.story-cover-illustration { position: absolute; z-index: -1; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.story-cover--fallback .story-cover-illustration { display: none; }
.story-cover::after { position: absolute; z-index: 0; inset: 24% 0 0; background: linear-gradient(180deg, rgba(15, 24, 60, 0), rgba(15, 24, 60, .16) 24%, rgba(15, 24, 60, .9)); content: ""; pointer-events: none; }
.story-cover-caption { position: absolute; z-index: 1; inset: 0; display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 8px; padding: clamp(14px, 1.8vw, 18px); color: #fff; }
.story-cover-brand { position: absolute; top: clamp(13px, 1.8vw, 17px); left: clamp(14px, 1.8vw, 18px); color: #fff8e6; font-size: 9px; font-weight: 900; letter-spacing: .16em; text-shadow: 0 1px 8px rgba(18, 29, 66, .65); }
.story-cover-kind { color: #ffedc4; font-size: 10px; font-weight: 900; letter-spacing: .06em; text-shadow: 0 1px 8px rgba(18, 29, 66, .75); }
.story-cover-title { display: -webkit-box; max-width: 100%; overflow: hidden; margin: 0; color: #fff; font-family: var(--heading); font-size: clamp(19px, 2vw, 25px); font-weight: 800; line-height: 1.08; letter-spacing: -.02em; text-shadow: 0 2px 12px rgba(18, 29, 66, .55); line-clamp: 3; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.story-cover-duration { padding: 6px 10px; border: 1px solid rgba(255, 246, 224, .45); border-radius: 999px; color: #fff9eb; background: rgba(22, 32, 70, .4); font-size: 10px; font-weight: 900; letter-spacing: .04em; }
.saved-story-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; }
.saved-story-head h3 { margin: 13px 0 5px; color: #292842; font-family: var(--heading); font-size: clamp(23px, 2.8vw, 31px); line-height: 1.08; }
.saved-story-head p { margin: 0; color: #5c5c70; font-size: 12px; line-height: 1.55; }
.story-expiry { flex: 0 0 auto; max-width: 210px; padding: 8px 11px; border-radius: 999px; color: #57516a !important; background: #f0edf4; font-weight: 800; text-align: right; }
.story-expiry.is-warning { color: #7b311e !important; background: #fff0e8; }
.saved-story-excerpt { margin: 17px 0; color: #4e4d62; font-size: 13px; line-height: 1.7; }
.saved-story-full { max-height: 520px; overflow: auto; margin: 14px 0; padding: 18px; border: 1px solid #ebe6ed; border-radius: 15px; color: #3e3d53; background: #fffdf9; font-size: 14px; line-height: 1.85; }
.saved-story-full[hidden] { display: none; }
.saved-story-full p { margin: 0 0 1em; }
.saved-story-full p:last-child { margin-bottom: 0; }
.saved-story-actions { align-items: stretch; }
.saved-story-actions .button, .saved-story-actions a { min-height: 42px; padding: 0 13px; font-size: 11px; }
.delete-story-button { border: 1px solid #e5d7d6; border-radius: 999px; color: #7d3f3b; background: #fff; font: inherit; font-size: 11px; font-weight: 800; cursor: pointer; }
.delete-story-button:hover { background: #fff4f2; }
.share-link-input { width: 100%; min-height: 43px; margin-top: 12px; padding: 0 11px; border: 1px solid #d8d0df; border-radius: 10px; color: #423d52; background: #fff; font-size: 12px; }
.story-empty { padding: 34px 18px; border: 1px dashed #cfc6d6; border-radius: 20px; text-align: center; }
.story-empty > div { color: #a489a2; font-size: 38px; }
.story-empty h3 { margin: 9px 0; color: #292842; font-family: var(--heading); font-size: 27px; }
.story-empty p { max-width: 420px; margin: 0 auto 18px; color: #5c5b70; font-size: 13px; line-height: 1.7; }
.library-bottom-actions { margin-top: 20px; }
.load-more-stories { display: block; margin: 16px auto 0; }
.load-more-stories[hidden] { display: none; }
.share-content { max-width: 900px; }
.share-story-panel { padding: clamp(22px, 4vw, 42px); }
.share-story-cover { width: min(100%, 260px); margin: 0 auto 23px; }
.share-story-meta { margin: 0 0 18px; color: #6b5a76; font-size: 12px; font-weight: 800; }
.share-story-text { color: #39384f; font-size: 16px; line-height: 1.9; }
.share-story-text p { margin: 0 0 1.2em; }
.share-story-text p:last-child { margin-bottom: 0; }
.share-story-panel .library-disclaimer { margin-top: 28px; }
.share-page .account-content { min-height: 45vh; }
@media (max-width: 760px) {
  .saved-story-card { grid-template-columns: minmax(0, 1fr); gap: 17px; }
  .saved-story-card > .story-cover { width: min(100%, 230px); justify-self: center; }
  .saved-story-head { flex-direction: column; }
  .story-expiry { max-width: none; text-align: left; }
  .library-heading-actions { justify-content: flex-start; }
  .saved-story-actions .button, .saved-story-actions a { flex: 1 1 145px; }
  .share-story-text { font-size: 14px; }
  .share-story-cover { width: min(100%, 220px); }
}


/* Кабинет сначала проверяет сессию: форма входа не должна вспыхивать поверх уже открытой библиотеки. */
.auth-check-status {
  display: flex;
  grid-column: 1 / -1;
  width: min(100%, 760px);
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 0;
}
.auth-check-status > span { flex: 1 1 auto; }
.auth-retry-button { flex: 0 0 auto; margin: 0; }
.auth-check-status[hidden],
.account-page .login-panel[hidden],
.account-page .library-panel[hidden] {
  display: none !important;
}
@media (max-width: 760px) {
  .auth-check-status { align-items: stretch; flex-direction: column; }
  .auth-retry-button { width: 100%; }
}

/* Главное аудиодействие находится отдельно от скачивания и пересылки MP3. */
.listen-story-button {
  display: inline-flex;
  width: fit-content;
  min-height: 52px;
  align-items: center;
  gap: 11px;
  margin: -3px 0 17px;
  padding: 0 21px;
  font-size: 14px;
  font-weight: 900;
  box-shadow: 0 7px 18px rgba(84, 69, 113, .18);
}
.listen-story-button::before {
  content: "▶";
  font-size: 12px;
}
.listen-story-button[aria-pressed="true"]::before {
  content: "Ⅱ";
  font-size: 17px;
  letter-spacing: -.12em;
}
.audio-not-available {
  margin: -2px 0 17px;
  padding: 12px 14px;
  border: 1px solid #e8e0ed;
  border-radius: 13px;
  color: #565268;
  background: #f7f4f8;
  font-size: 13px;
  line-height: 1.55;
}
@media (max-width: 760px) {
  .listen-story-button { width: 100%; justify-content: center; }
}



.account-page.is-story-focus .account-hero { display: none; }
.account-page.is-story-focus .account-content { padding-top: 18px; }
.account-page.is-story-focus .library-panel { padding-top: 20px; }


/* Desktop guest state: center the single visible form instead of reserving an empty library column. */
.account-grid:not(.is-authenticated) {
  grid-template-columns: minmax(0, 600px);
  justify-content: center;
}
@media (max-width: 760px) {
  .account-grid:not(.is-authenticated) { grid-template-columns: minmax(0, 1fr); }
}

.auth-switch-button { font-size: 14px; }
.auth-form > label:not(.account-consent) { font-size: 14px; }
.login-status { font-size: 13px; }
.account-consent { color: #4e4c61; font-size: 13px; line-height: 1.68; }
.account-consent strong { color: #2f2c48; }
.login-note {
  align-items: flex-start;
  padding: 12px 14px;
  border-left: 3px solid #b79bcd;
  border-radius: 0 12px 12px 0;
  color: #514a60;
  background: #f3eff7;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.6;
}
.login-note > span:first-child { flex: 0 0 auto; color: #765d88; font-size: 16px; }
.login-note > span:last-child { flex: 1 1 auto; min-width: 0; color: inherit; font-size: inherit; }
.account-footer .footer-brand { color: #51445e; }
.account-footer .footer-brand > span:last-child > span { color: #765d88; }
.account-footer .footer-brand .brand-mark { color: #725b83; background: #e9e1ee; }
.account-footer .legal-footer-links--site a { color: #55536e; }

/* Компактный верх кабинета: библиотека начинается ближе к первому экрану. */
.account-hero { padding: clamp(27px, 3.2vw, 44px) 0 clamp(26px, 3vw, 38px); }
.account-hero-row { align-items: center; gap: 24px; margin-top: 12px; }
.account-hero h1 { max-width: 720px; margin-bottom: 9px; font-size: clamp(36px, 4.5vw, 56px); line-height: 1.02; }
.account-hero-row p { max-width: 700px; font-size: 14px; line-height: 1.62; }
.account-content { padding-top: clamp(18px, 2.2vw, 28px); }
.account-page.is-authenticated .account-hero { padding-block: 22px; }
.account-page.is-authenticated .account-eyebrow,
.account-page.is-authenticated .account-hero-row p { display: none; }
.account-page.is-authenticated .account-hero-row { margin-top: 0; }
.account-page .library-panel { position: relative; border-color: #e6dfec; box-shadow: 0 18px 48px rgba(36, 32, 58, .09); }
.account-page .library-panel::before { position: absolute; top: 0; left: 30px; width: 118px; height: 3px; border-radius: 0 0 4px 4px; background: linear-gradient(90deg, #b79bcd, #f0d58b); content: ""; }
.account-page .saved-story-card { box-shadow: 0 8px 24px rgba(36, 32, 58, .045); }

.account-theme-toggle {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  padding: 0 13px;
  border: 1px solid #eadba8;
  border-radius: 999px;
  color: #403856;
  background: #fff7d7;
  box-shadow: 0 5px 14px rgba(42, 40, 66, .07);
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, box-shadow .18s ease;
}
.account-theme-toggle:hover { transform: translateY(-1px); box-shadow: 0 8px 18px rgba(42, 40, 66, .12); }
.account-theme-toggle:focus-visible { outline: 3px solid #9a83ae; outline-offset: 3px; }
.account-theme-icon { font-size: 16px; line-height: 1; }

@media (max-width: 980px) {
  .account-page .account-theme-toggle { min-height: 40px; padding-inline: 11px; }
}
@media (max-width: 760px) {
  .account-hero { padding: 24px 0 26px; }
  .account-hero-row { gap: 12px; margin-top: 8px; }
  .account-hero h1 { margin-bottom: 7px; font-size: clamp(32px, 8.4vw, 42px); line-height: 1.02; }
  .account-hero-row p { font-size: 13px; line-height: 1.55; }
  .account-content { padding-top: 17px; }
  .account-page.is-authenticated .account-hero { padding-block: 17px; }
  .account-page .header-inner { gap: 9px; }
  .account-theme-toggle { min-height: 38px; gap: 5px; padding-inline: 9px; font-size: 11px; }
  .account-theme-icon { font-size: 15px; }
}

/* Ночная тема остаётся мягкой и контрастной, а не превращает библиотеку в чёрный экран. */
html[data-account-theme="night"] .account-page {
  color-scheme: dark;
  background: #11182d;
  --account-paper: #1b2440;
  --account-ink: #f3efff;
  --account-muted: #c2bfd2;
}
html[data-account-theme="night"] .account-page .site-header,
html[data-account-theme="night"] .account-page .account-footer {
  border-color: rgba(224, 218, 246, .12);
  background: #111a34;
}
html[data-account-theme="night"] .account-page .main-nav a,
html[data-account-theme="night"] .account-page .account-footer-inner > a:last-child,
html[data-account-theme="night"] .account-page .account-footer-inner p,
html[data-account-theme="night"] .account-page .legal-footer-links--site a { color: #e1def0; }
html[data-account-theme="night"] .account-page .menu-toggle {
  border-color: rgba(231, 225, 248, .22);
  color: #f3efff;
  background: #202b4b;
}
html[data-account-theme="night"] .account-page .mobile-nav { border-color: rgba(231, 225, 248, .13); background: #17213d; }
html[data-account-theme="night"] .account-page .mobile-nav-link { border-color: rgba(231, 225, 248, .1); color: #eeebf8; }
html[data-account-theme="night"] .account-page .account-content { background: #11182d; }
html[data-account-theme="night"] .account-page .login-panel,
html[data-account-theme="night"] .account-page .library-panel,
html[data-account-theme="night"] .account-page .saved-story-card {
  border-color: rgba(224, 218, 246, .13);
  background: #1b2440;
  box-shadow: 0 18px 44px rgba(0, 0, 0, .2);
}
html[data-account-theme="night"] .account-page .login-panel h2,
html[data-account-theme="night"] .account-page .library-heading h2,
html[data-account-theme="night"] .account-page .saved-story-head h3,
html[data-account-theme="night"] .account-page .story-empty h3 { color: #f3efff; }
html[data-account-theme="night"] .account-page .login-copy,
html[data-account-theme="night"] .account-page .library-greeting,
html[data-account-theme="night"] .account-page .saved-story-head p,
html[data-account-theme="night"] .account-page .saved-story-excerpt,
html[data-account-theme="night"] .account-page .story-empty p { color: #cbc8d9; }
html[data-account-theme="night"] .account-page .login-status { border-color: #c5a96d; color: #e9e3d5; background: #2a2c43; }
html[data-account-theme="night"] .account-page .login-note { border-color: #b79bcd; color: #e4dfee; background: #282541; }
html[data-account-theme="night"] .account-page .account-consent { color: #d1cddd; }
html[data-account-theme="night"] .account-page .account-consent strong { color: #fff1be; }
html[data-account-theme="night"] .account-page .auth-switch { background: #252e4b; }
html[data-account-theme="night"] .account-page .auth-switch-button { color: #e5e0f0; }
html[data-account-theme="night"] .account-page .auth-switch-button.is-active { color: #fff; background: #564872; }
html[data-account-theme="night"] .account-page .auth-form > label:not(.account-consent) { color: #e6e1f0; }
html[data-account-theme="night"] .account-page .auth-form input:not([type="checkbox"]),
html[data-account-theme="night"] .account-page .share-link-input {
  border-color: #465171;
  color: #f4f0ff;
  background: #202a47;
}
html[data-account-theme="night"] .account-page .auth-form input::placeholder,
html[data-account-theme="night"] .account-page .share-link-input::placeholder { color: #a9aac0; }
html[data-account-theme="night"] .account-page .retention-notice { border-color: #726344; color: #e5decf; background: #343247; }
html[data-account-theme="night"] .account-page .retention-notice strong { color: #ffedb2; }
html[data-account-theme="night"] .account-page .library-count,
html[data-account-theme="night"] .account-page .story-expiry { color: #e5e1f0 !important; background: #303958; }
html[data-account-theme="night"] .account-page .story-expiry.is-warning { color: #ffd5c5 !important; background: #513633; }
html[data-account-theme="night"] .account-page .saved-story-full { border-color: #465171; color: #e7e2f2; background: #151e37; }
html[data-account-theme="night"] .account-page .logout-button,
html[data-account-theme="night"] .account-page .download-button { color: #ede8f7; background: #34324f; }
html[data-account-theme="night"] .account-page .delete-story-button { border-color: #684b4c; color: #ffd9d1; background: #332a39; }
html[data-account-theme="night"] .account-page .delete-story-button:hover { background: #49343c; }
html[data-account-theme="night"] .account-page .share-fallback { border-color: #414a68; background: #202943; }
html[data-account-theme="night"] .account-page .share-fallback label,
html[data-account-theme="night"] .account-page .share-status,
html[data-account-theme="night"] .account-page .library-disclaimer { color: #d0cbdc; }
html[data-account-theme="night"] .account-page .story-empty { border-color: #59627f; }
html[data-account-theme="night"] .account-page .account-theme-toggle { border-color: #515b7b; color: #fff0bb; background: #283353; }
html[data-account-theme="night"] .account-page .account-theme-toggle:hover { background: #344061; }
html[data-account-theme="night"] .account-page .account-footer .footer-brand { color: #eee8ff; }
html[data-account-theme="night"] .account-page .account-footer .footer-brand > span:last-child > span { color: #e1caff; }
html[data-account-theme="night"] .account-page .account-footer .footer-brand .brand-mark { color: #eee3ff; background: #39324f; }
