/* Читопотам: approved comic identity, isolated preview skin. */
:root {
  --ui:'Rubik',sans-serif; --bg:#faf9f5; --surface:#fffdf8;
  --ink:#20283e; --muted:#606579; --line:#dedbe5;
  --blue:#6750a4; --blue-hover:#503982; --tint:#ece6fa; --soft:#f0edf5;
  --brand-navy:#1e2942; --brand-yellow:#ffd34d; --brand-lilac:#ad97f8;
  --shadow:0 7px 20px #17203516;
}
:root[data-theme=dark],body[data-theme=dark] {
  --bg:#172035; --surface:#1e2942; --ink:#fff6e4; --muted:#bcc4d6;
  --line:#3c4761; --blue:#bda9ff; --blue-hover:#d2c5ff; --tint:#34324f; --soft:#28324b;
  --shadow:0 7px 20px #090e1d40;
}
::selection{background:#ffd34d;color:#172035}
html{scrollbar-color:var(--blue) var(--bg)}
input{caret-color:var(--blue)}
.header-inner,.shell{max-width:1280px;padding-inline:40px}
.site-header{background:var(--brand-navy);border-bottom:1px solid #3c4761;color:#fff6e4}
.header-inner{min-height:112px;gap:28px}
.brand{flex-shrink:0;line-height:1;letter-spacing:0}
.brand-logo{width:236px;height:96px;object-fit:contain}
.site-nav{margin-left:18px;gap:24px}
.site-nav a{color:#bcc4d6;font-size:15px;font-weight:500}
.site-nav a:hover,.site-nav a[aria-current=page]{color:#fff6e4}
.site-nav a[aria-current=page]::after{background:var(--brand-yellow);bottom:0}
.theme-toggle{margin-left:auto;color:#fff6e4;flex-shrink:0}
.site-header .icon-button:hover{background:#343b57}
.site-header .icon-button:focus-visible,.site-header a:focus-visible,.site-header input:focus-visible{outline-color:var(--brand-yellow)}
.search-box{width:235px;margin-left:0}
.site-header .search-input{background:#172035;border:1px solid #46516b;color:#fff6e4;border-radius:12px}
.site-header .search-input::placeholder,.site-header .search-box>.icon{color:#bcc4d6}
body[data-theme=light] .site-header{background:#fff;border-color:var(--line);color:var(--ink)}
body[data-theme=light] .site-nav a{color:var(--muted)}
body[data-theme=light] .site-nav a:hover,body[data-theme=light] .site-nav a[aria-current=page]{color:var(--blue)}
body[data-theme=light] .site-nav a[aria-current=page]::after{background:var(--blue)}
body[data-theme=light] .site-header .icon-button{color:var(--ink)}
body[data-theme=light] .site-header .icon-button:hover{background:var(--soft)}
body[data-theme=light] .site-header .search-input{background:var(--bg);border-color:var(--line);color:var(--ink)}
body[data-theme=light] .site-header .search-input::placeholder,body[data-theme=light] .site-header .search-box>.icon{color:var(--muted)}
body[data-theme=light] .site-header :focus-visible{outline-color:var(--blue)}
.shell{padding-top:34px;padding-bottom:40px}
.library-intro{gap:32px;margin-bottom:26px}
.library-intro h1,.page-intro h1{font:750 clamp(30px,3.2vw,44px)/1.1 var(--ui);letter-spacing:-.035em;max-width:750px}
.library-intro p{font-size:14px;max-width:240px}
.page-intro h1{margin-bottom:12px}
.library .filters{gap:24px}
.library .chip{font-size:15px;padding:13px 8px 16px}
.library .chip[aria-pressed=true]{color:var(--blue)}
.library .chip[aria-pressed=true]::after{background:var(--blue);height:4px}
body[data-theme=dark] .library .chip[aria-pressed=true]{color:var(--brand-yellow)}
body[data-theme=dark] .library .chip[aria-pressed=true]::after{background:var(--brand-yellow)}
.book-grid{grid-template-columns:repeat(3,minmax(0,1fr));gap:40px 28px}
.book-card{max-width:none}
.book-card .book-cover{border-radius:12px;box-shadow:var(--shadow)}
.book-cover::before{display:none}
.book-card>.card-title{font:700 22px/1.22 var(--ui);letter-spacing:-.025em;margin-top:16px}
.book-card>.card-meta{font-size:13px}
.book-card>.card-blurb{font-size:14px;line-height:1.55}
.library .book-card>.card-blurb{display:none}
.book-save{background:var(--soft);color:var(--blue);border-radius:10px}
body[data-theme=dark] .book-save{color:var(--blue)}
.book-save[aria-pressed=true]{background:var(--tint);color:var(--blue)}
.card-actions .card-series{font-size:12px}
.button{border-radius:10px;font-weight:600}
.button.primary,body[data-theme=dark] .button.primary{background:var(--brand-yellow);color:#172035;box-shadow:none}
.button.primary:hover{background:#ffe084}
.button.secondary{background:var(--tint);color:var(--blue)}
.button:focus-visible{outline-color:var(--blue)}
.continue-card{border:0;border-radius:12px;background:var(--soft);padding:16px 20px;gap:18px;margin-bottom:22px}
.continue-card>img{width:48px;height:60px;border-radius:6px}
.continue-info h2{font:650 18px/1.3 var(--ui)}
.continue-info .label{font-size:13px}
.continue-card .progress-line{display:flex;max-width:320px;margin-top:8px}
.progress-track{background:var(--line)}
.continue-card .button{font-size:14px;border-radius:9px}
.library-series h2,.section-heading h2,.hero-card h2,.series-hero h1{font-family:var(--ui);font-weight:700;letter-spacing:-.025em}
.library-series-item strong{font-family:var(--ui);font-weight:650;font-size:19px}
.site-footer{font-size:13px;gap:16px}
.bottom-nav{background:var(--surface);border-color:var(--line)}
.bottom-nav a[aria-current=page]{color:var(--blue)}
.bottom-nav a[aria-current=page] .nav-icon-container{background:var(--tint)}
.shelf-tabs{gap:10px;flex-wrap:wrap;overflow:visible;padding:0;margin-bottom:28px}
.shelf-tabs .chip{border:0;background:var(--soft);color:var(--muted);border-radius:10px;min-height:44px;font-size:14px;padding:12px 16px}
.shelf-tabs .chip[aria-pressed=true],body[data-theme=dark] .shelf-tabs .chip[aria-pressed=true]{background:var(--brand-yellow);color:#172035;box-shadow:none}
.tab-number{font-variant-numeric:tabular-nums}
.shelf-list{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:24px 40px}
.shelf-book{display:flex;gap:22px;padding-block:8px 24px;border-bottom:1px solid var(--line);min-width:0}
.shelf-cover{width:112px;flex-shrink:0;align-self:flex-start;border-radius:10px;overflow:hidden}
.shelf-cover img{width:100%;height:auto;aspect-ratio:4/5;object-fit:cover}
.shelf-copy{flex:1;min-width:0}
.shelf-copy h2{font:700 22px/1.2 var(--ui);letter-spacing:-.02em;margin:0 0 9px}
.shelf-meta{color:var(--muted);font-size:13px;line-height:1.4;margin:0 0 12px}
.shelf-progress{display:flex;align-items:center;gap:12px;color:var(--muted);font-size:13px;font-variant-numeric:tabular-nums}
.shelf-actions{display:flex;align-items:center;gap:12px;margin-top:14px}
.shelf-actions .button{min-height:44px;padding:10px 18px;font-size:14px}
.shelf-actions .book-save{margin-left:auto}
.empty-state h2{font-family:var(--ui);font-weight:700}
.empty-state>.icon{color:var(--blue)}
.hero-card,.hero-card.is-earned{border-color:var(--line);border-radius:14px;box-shadow:none}
.hero-token,.is-earned .hero-token{background:var(--surface);color:var(--ink)}
.is-earned .hero-token{background:var(--brand-yellow);color:#172035}
.hero-card .hero-series{text-transform:none;letter-spacing:0;color:var(--muted);font-size:12px}
.collection-counter,body[data-theme=dark] .collection-counter{background:var(--tint);color:var(--blue)}
.series-hero{border-radius:14px}
.reader-header,.reader-start,.reader-links{font-family:var(--ui)}
.reader-header{border-color:var(--line)}
.reader-progress>span{background:var(--blue)}
.finish-panel{border-radius:14px}
.segmented button[aria-pressed=true]{background:var(--tint);color:var(--blue)}
@media(min-width:1200px){.library .book-grid{grid-template-columns:repeat(4,minmax(0,1fr))}}
@media(max-width:959px){
  .header-inner,.shell{padding-inline:24px}
  .header-inner{min-height:100px;gap:16px;flex-wrap:wrap;padding-block:6px}
  .brand-logo{width:206px;height:86px}
  .site-nav{display:none}
  .mobile-search-button{display:inline-flex;color:#fff6e4}
  .search-box{display:none;width:100%;order:5;margin:0 0 8px}
  .search-box.expanded{display:block}
  .bottom-nav{display:flex;position:fixed;bottom:0;left:0;right:0;z-index:25;justify-content:space-around;padding:7px 12px max(8px,env(safe-area-inset-bottom));box-shadow:none}
  .bottom-nav a{flex:1;min-height:55px;font-size:12px;color:var(--muted);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;border-radius:10px}
  .nav-icon-container{display:inline-flex;align-items:center;justify-content:center;width:49px;height:29px;border-radius:8px}
  .bottom-nav .icon{width:23px;height:23px}
  .shell{padding-bottom:110px}
  .library-intro p{display:none}
  .book-grid{gap:34px 24px}
  .shelf-list{grid-template-columns:1fr;max-width:760px}
}
@media(min-width:600px) and (max-width:760px){.book-grid{grid-template-columns:repeat(3,minmax(0,1fr))}}
@media(max-width:599px){
  .header-inner,.shell{padding-inline:18px}
  .header-inner{gap:10px;min-height:88px;padding-block:0}
  .brand-logo{width:184px;height:82px}
  .shell{padding-top:25px}
  .library-intro{margin-bottom:18px}
  .library-intro h1,.page-intro h1{font-size:34px;line-height:1.09;letter-spacing:-.03em}
  .library-intro h1{max-width:330px;text-wrap:balance}
  .library .filters{display:flex;gap:0 12px;flex-wrap:wrap;justify-content:flex-start}
  .library .chip{font-size:13px;padding:12px 4px 14px;min-height:44px}
  .library .chip[aria-pressed=true]::after{left:4px;right:4px}
  .catalog-tools{margin-bottom:22px}
  .catalog-count{display:none}
  .book-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:30px 18px}
  .book-card>.card-title{font-size:20px;margin:13px 0 8px;min-height:2.44em}
  .book-card>.card-meta{font-size:12px;gap:4px;margin-bottom:9px}
  .book-card>.card-blurb{font-size:14px;line-height:1.5;margin-bottom:10px}
  .book-save{font-size:13px;min-height:44px}
  .card-actions{gap:0}
  .continue-card{padding:12px;gap:12px}
  .continue-card>img{width:34px;height:43px}
  .continue-info h2{font-size:14px}
  .continue-info .label{font-size:12px}
  .continue-card .progress-line{display:none}
  .continue-card .button{font-size:12px;padding:10px}
  .shelf-tabs{gap:6px;margin-bottom:22px}
  .shelf-tabs .chip{font-size:12px;padding:11px 10px;gap:5px}
  .shelf-book{gap:18px;padding-bottom:24px}
  .shelf-cover{width:86px}
  .shelf-copy h2{font-size:21px}
  .shelf-meta{font-size:12px}
  .shelf-actions .button{padding-inline:16px;font-size:13px}
  .site-footer{align-items:flex-start;font-size:12px}
}
@media(max-width:359px){
  .header-inner,.shell{padding-inline:16px}
  .header-inner{gap:4px}
  .brand-logo{width:166px;height:76px}
  .library-intro h1,.page-intro h1{font-size:30px}
  .book-grid{column-gap:14px}
  .book-card>.card-title{font-size:18px}
  .shelf-tabs .chip{font-size:11px;padding-inline:8px}
  .shelf-copy h2{font-size:19px}
}
@media(orientation:landscape) and (max-height:500px){
  .header-inner{min-height:76px}.brand-logo{height:68px;width:170px}
}

/* Compact catalog header: phone search below, tablet search alongside. */
.site-header .header-inner{display:grid;grid-template-columns:auto auto minmax(160px,1fr) 44px auto;gap:16px}
.site-header .site-nav{margin-left:0;gap:20px}
.site-header .search-box{display:block;min-width:0;width:100%;margin:0;order:initial}
.site-header .theme-toggle{margin:0}
.header-account{min-width:44px;max-width:144px;min-height:44px;padding:8px 12px;gap:8px;font-weight:500;white-space:nowrap}
.header-account:not(.has-profile){max-width:none}
.header-account-name{min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.header-account>span[aria-hidden]{flex:none}
.header-account .portrait-frame{width:28px;height:28px;border-radius:50%}
.library-intro{margin-bottom:18px}
.library-intro h1{font-size:clamp(28px,3vw,36px);letter-spacing:-.03em}
.shell.library{padding-top:26px}
@media(max-width:1099px){
  .site-header .header-inner{grid-template-columns:190px minmax(0,1fr) 44px auto;gap:16px;min-height:88px;padding-block:8px}
  .site-header .site-nav{display:none}
  .site-header .brand{display:block;position:relative;grid-column:1;grid-row:1;width:190px;max-width:100%;height:72px}
  .site-header .brand-logo{position:absolute;top:50%;left:0;width:100%;height:auto;transform:translateY(-48%)}
  .site-header .theme-toggle{grid-column:3;grid-row:1}
  .header-account{grid-column:4;grid-row:1}
  .site-header .search-box{grid-column:2;grid-row:1}
  .site-header .search-input{border-radius:10px}
  .bottom-nav{display:flex;position:fixed;bottom:0;left:0;right:0;z-index:25;justify-content:space-around;padding:7px 12px max(8px,env(safe-area-inset-bottom));box-shadow:none}
  .bottom-nav a{flex:1;min-height:55px;font-size:12px;color:var(--muted);display:flex;flex-direction:column;align-items:center;justify-content:center;gap:5px;border-radius:10px}
  .nav-icon-container{display:inline-flex;align-items:center;justify-content:center;width:49px;height:29px;border-radius:8px}
  .bottom-nav .icon{width:23px;height:23px}
  .shell{padding-bottom:110px}
}
@media(max-width:767px){
  .site-header .header-inner{grid-template-columns:minmax(0,1fr) 44px auto;gap:6px 8px;min-height:0;padding-top:8px;padding-bottom:12px}
  .site-header .brand{width:154px;height:64px}
  .site-header .theme-toggle{grid-column:2}
  .header-account{grid-column:3;padding-inline:8px}
  .header-account.has-profile{max-width:calc(100vw - 250px)}
  .site-header .search-box{grid-column:1 / -1;grid-row:2}
}
@media(max-width:599px){
  .shell.library{padding-top:22px}
  .library-intro h1{font-size:30px}
}
@media(max-width:359px){
  .header-account.has-profile .header-account-name{display:none}
  .header-account.has-profile{width:44px;justify-content:center}
  .library-intro h1{font-size:28px}
}

/* The Sites catalog keeps its books in one native, keyboard-accessible row. */
.library .book-grid{
  position:relative;
  grid-template-columns:none;
  grid-template-rows:repeat(5,auto);
  grid-auto-flow:column;
  grid-auto-columns:min(76vw,15.5rem);
  align-items:stretch;
  gap:0 28px;
  overflow-x:auto;
  overscroll-behavior-x:contain;
  scroll-snap-type:x proximity;
  scroll-padding-inline:8px;
  scrollbar-color:var(--blue) var(--soft);
  padding:8px 8px 20px;
  margin-inline:-8px;
}
.library .book-grid:focus-visible{outline:3px solid var(--blue);outline-offset:4px;border-radius:6px}
.library .book-grid>.book-card{
  container-type:normal;
  display:grid;
  grid-template-columns:minmax(0,1fr);
  grid-template-rows:subgrid;
  grid-row:1 / span 5;
  row-gap:0;
  align-items:start;
  scroll-snap-align:start;
  scroll-margin-inline:8px;
}
.library .book-card>.cover-wrap{grid-row:1}
.library .book-card>.card-title{grid-row:2;align-self:end;min-height:0;line-height:1.25;margin:8px 0 0}
.library .book-card>.card-meta{grid-row:3}
.library .book-card>.card-recommendation{grid-row:4}
.library .book-card>.card-actions{grid-row:5}
.library .book-card .book-save .favorite-label{display:none}
.library .book-card>.card-title>a{
  display:-webkit-box;
  -webkit-box-orient:vertical;
  -webkit-line-clamp:2;
  line-clamp:2;
  overflow:hidden;
}
@media(max-width:599px){.library .book-grid{gap:0 18px}}
@media(max-width:359px){.library .book-grid{gap:0 14px}}

/* Catalog rail: two books and the edge of a third on a phone. State sits on the cover. */
@media(max-width:599px){
  .library .book-grid{grid-auto-columns:clamp(9.25rem,41vw,15.5rem);gap:0 14px}
}
.library .book-card--compact>.cover-wrap{position:relative}
.library .book-card--compact>.card-title{align-self:start}
.library .book-card--compact>.card-title>a{font-weight:600;letter-spacing:0}
@media(max-width:599px){
  .library .book-grid .book-card--compact .card-meta-main{flex:1 1 100%;flex-wrap:nowrap;white-space:nowrap;gap:0 8px}
  .library .book-grid .book-card--compact .card-meta-main>span{display:block;flex:none;white-space:nowrap}
  .library .book-grid .book-card--compact .card-meta-main>.card-kind{display:none}
  .library .book-grid .book-card--compact .card-meta-main>.card-kind+span::before{content:none;margin:0}
  .library .book-grid .book-card--compact .card-meta-main>.card-duration{display:inline-flex}
  .library .book-card--compact>.card-title>a{font-size:1.125rem;letter-spacing:-.02em;hyphens:auto}
  .library .book-card--compact>.card-actions{flex-wrap:wrap;gap:0}
  .library .book-card--compact .card-read{flex:1 1 auto;min-width:max-content;padding-inline:6px;font-size:.9375rem}
  .library .book-card--compact .card-read .reading-label{white-space:nowrap;overflow-wrap:normal}
}
.library .book-card--compact .reading-fill,
.library .book-card--compact .reading-bubbles{display:none}
.cover-done{
  position:absolute;top:8px;right:8px;z-index:2;
  display:grid;place-items:center;width:30px;height:30px;border-radius:50%;
  background:rgba(23,32,53,.88);color:#bda9ff;pointer-events:none;
  box-shadow:0 0 0 1.5px rgba(255,255,255,.28);
}
.cover-done .icon{width:18px;height:18px}
.cover-progress{
  position:absolute;left:0;right:0;bottom:0;z-index:2;height:5px;overflow:hidden;
  border-radius:0 0 12px 12px;background:rgba(23,32,53,.72);pointer-events:none;
}
.cover-progress>span{display:block;height:100%;background:#ffd34d;border-radius:0 3px 3px 0}

/* Homepage shelves reuse the catalog row; headings carry the arrows. */
.homepage-row{margin:0 0 42px;min-width:0}
.homepage-row-heading{display:flex;align-items:center;justify-content:space-between;gap:16px;margin-bottom:16px}
.homepage-row-heading h2{margin:0;font:700 var(--type-section)/1.25 var(--ui);letter-spacing:-.025em;overflow-wrap:anywhere}
.homepage-row-note{margin:6px 0 0;color:var(--muted);font-size:var(--type-meta);line-height:1.5}
.homepage-row-controls{display:flex;flex-shrink:0;gap:8px}
.homepage-row-controls .icon-button{width:44px;height:44px;border:1px solid var(--line);border-radius:10px;background:var(--surface);color:var(--ink)}
.homepage-row-controls .icon-button:hover{background:var(--tint);color:var(--blue)}
.homepage-row-controls .icon-button:disabled{opacity:.35;cursor:default;background:var(--surface);color:var(--muted)}
.homepage-row-prev .icon{transform:rotate(180deg)}
.homepage-row-track:focus-visible{outline:3px solid var(--blue);outline-offset:4px;border-radius:4px}
.library-catalog .library-intro h2{margin:0;font:750 var(--type-page)/1.1 var(--ui);letter-spacing:-.03em;overflow-wrap:anywhere}
.library-catalog{scroll-margin-top:24px}
@media(max-width:599px){.homepage-row{margin-bottom:34px}.homepage-row-heading{gap:8px;margin-bottom:12px}.homepage-row-controls{gap:4px}}
