:root{
  --sf-bg:#050505;
  --sf-panel:rgba(17,17,17,.55);
  --sf-border:rgba(255,255,255,.10);
  --sf-text:rgba(255,255,255,.92);
  --sf-muted:rgba(255,255,255,.64);
  --sf-accent:rgba(225,29,42,1);
}

.sf-shell{min-height:100vh; color:var(--sf-text);}
.sf-topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;justify-content:space-between;gap:16px;padding:14px 18px;border-bottom:1px solid rgba(255,255,255,.08);backdrop-filter: blur(6px);background:rgba(0,0,0,.45);} 
.sf-brand{font-weight:900;letter-spacing:.4px;text-decoration:none;color:var(--sf-text);display:flex;align-items:center;gap:10px;} 
.sf-brand-logo{width:22px;height:22px;object-fit:contain;filter:drop-shadow(0 2px 10px rgba(0,0,0,.55));}

.sf-top-actions{display:flex;gap:12px;align-items:center;}
.sf-link{color:rgba(255,255,255,.72);text-decoration:none;font-weight:800;border:1px solid transparent;padding:8px 10px;border-radius:12px;}
.sf-link:hover{border-color:rgba(225,29,42,.45);color:rgba(255,255,255,.92)}

.sf-top-books{padding:12px 16px 0;}
.sf-top-books-inner{max-width:1200px;margin:0 auto;background:rgba(17,17,17,.50);border:1px solid rgba(255,255,255,.10);border-radius:18px;padding:14px 14px 12px;backdrop-filter: blur(6px);}
.sf-top-books-title{font-weight:900;letter-spacing:.12em;text-transform:uppercase;color:rgba(255,255,255,.78);font-size:12px;margin-bottom:10px;}
.sf-top-books-grid{display:grid;grid-template-columns: repeat(3, minmax(0, 1fr));gap:10px;}
.sf-top-bookbtn{cursor:pointer;display:flex;align-items:center;justify-content:space-between;gap:10px;border:1px solid rgba(255,255,255,.10);background:rgba(0,0,0,.14);border-radius:16px;padding:12px 14px;transition:transform .12s ease,border-color .12s ease;}
.sf-top-bookbtn:hover{transform:translateY(-1px);border-color:rgba(225,29,42,.45);} 
.sf-top-bookbtn.active{border-color:rgba(225,29,42,.65);background:rgba(225,29,42,.10);} 
.sf-top-bookname{font-weight:900;}
.sf-top-bookcta{font-weight:900;font-size:12px;opacity:.85;border:1px solid rgba(255,255,255,.14);padding:6px 10px;border-radius:999px;}
.sf-top-bookbtn:hover .sf-top-bookcta{border-color:rgba(225,29,42,.45);} 

.sf-main{display:grid;grid-template-columns: 380px 1fr; gap:16px; padding:16px;}
.sf-sidebar{background:var(--sf-panel); border:1px solid var(--sf-border); border-radius:18px; overflow:hidden; /* release: fixed üst menü + farklı ekranlarda gereksiz uzama olmasın */ min-height:unset;}
.sf-side-head{padding:14px 14px 12px; border-bottom:1px solid rgba(255,255,255,.08);}
.sf-title{font-size:18px;font-weight:900;}
.sf-sub{font-size:12px;color:var(--sf-muted); margin-top:4px; line-height:1.5;}

.sf-section{padding:12px;}
.sf-section-title{font-weight:900; font-size:12px; letter-spacing:.12em; text-transform:uppercase; color:rgba(255,255,255,.74); margin:6px 2px 10px;}
.sf-divider{height:1px;background:rgba(255,255,255,.08);margin:0 12px;}

.sf-booklist{display:flex;flex-direction:column; gap:10px;}
.sf-book{cursor:pointer; border:1px solid rgba(255,255,255,.10); background:rgba(0,0,0,.14); border-radius:16px; padding:12px; transition:transform .12s ease, border-color .12s ease; display:flex; align-items:center; justify-content:space-between; gap:10px;}
.sf-book:hover{transform:translateY(-1px); border-color:rgba(225,29,42,.45);} 
.sf-book.active{border-color:rgba(225,29,42,.65); background:rgba(225,29,42,.10);} 
.sf-book-name{font-weight:900;}
.sf-book-cta{font-weight:900; font-size:12px; opacity:.85; border:1px solid rgba(255,255,255,.14); padding:6px 10px; border-radius:999px;}
.sf-book:hover .sf-book-cta{border-color:rgba(225,29,42,.45);}

.sf-lib{display:flex;flex-direction:column;gap:10px;min-height:0;}
.sf-lib--combined{min-height:0;}
.sf-lib-scroll{display:grid;gap:14px;max-height:min(58vh,680px);overflow:auto;padding-right:4px;scrollbar-width:thin;overscroll-behavior:contain;}
.sf-lib-group{display:grid;gap:10px;min-width:0;}
.sf-section-title--inner{margin:2px 2px 2px;font-size:11px;color:rgba(255,255,255,.68);}
.sf-divider--group{margin:0;}
#lib{display:grid;gap:10px;min-width:0;}
.sf-lib-loading{display:grid;place-items:center;min-height:112px;border:1px dashed rgba(255,255,255,.12);border-radius:18px;background:rgba(0,0,0,.16);padding:16px;}
.sf-lib-item{border:1px solid rgba(255,255,255,.10); background:rgba(0,0,0,.14); border-radius:16px; padding:12px;}
.sf-lib-item--archive{background:linear-gradient(180deg, rgba(17,17,17,.78), rgba(7,7,9,.86));}
.sf-lib-title{font-weight:900;}
.sf-lib-meta{margin-top:6px; color:rgba(255,255,255,.62); font-size:12px; display:flex; gap:10px; flex-wrap:wrap;}
.sf-lib-desc{margin-top:10px;color:rgba(255,255,255,.78);font-size:13px;line-height:1.65;}
.sf-lib-actions{margin-top:10px; display:flex; gap:10px; flex-wrap:wrap;}
.sf-btn{cursor:pointer; font-weight:900; border-radius:12px; border:1px solid rgba(255,255,255,.14); background:rgba(0,0,0,.18); color:rgba(255,255,255,.92); padding:9px 12px; text-decoration:none; display:inline-flex; align-items:center; gap:8px;}
.sf-btn:hover{border-color:rgba(225,29,42,.45);} 

.sf-reader{background:var(--sf-panel); border:1px solid var(--sf-border); border-radius:18px; overflow:hidden; /* release: doğal yükseklik */ min-height:unset; display:flex;flex-direction:column;}
.sf-reader-head{padding:14px 14px 12px; border-bottom:1px solid rgba(255,255,255,.08); display:flex; align-items:flex-end; justify-content:space-between; gap:12px; flex-wrap:wrap;}
.sf-reader-title{font-size:18px; font-weight:900;}
.sf-reader-sub{font-size:12px; color:var(--sf-muted); margin-top:4px;}

.sf-content{padding:16px 18px; overflow:auto;}
.sf-content p{line-height:1.7; color:rgba(255,255,255,.90);} 
.sf-content a{color:rgba(255,255,255,.92); text-decoration:underline; text-decoration-color: rgba(225,29,42,.55);} 

.sf-empty{padding:34px; border:1px dashed rgba(255,255,255,.14); border-radius:18px; background:rgba(0,0,0,.12);}
.sf-empty-title{font-weight:900; font-size:18px;}
.sf-empty-sub{color:rgba(255,255,255,.70); margin-top:8px;}
.sf-note{color:rgba(255,255,255,.62); font-size:12px; margin-top:12px; line-height:1.5;}
.sf-muted{color:rgba(255,255,255,.70); font-size:12px;}

.sf-landing-foot{max-width:920px;margin:0 auto;padding:0 14px 18px;}

@media (max-width: 980px){
  .sf-top-books-grid{grid-template-columns:1fr;}
  .sf-main{grid-template-columns:1fr;}
  .sf-sidebar{min-height:auto;}
  .sf-reader{min-height:auto;}
}

/* Login modal (library gate) */
.sf-btn-primary{background:rgba(225,29,42,.20); border-color:rgba(225,29,42,.55);}
.sf-btn-primary:hover{background:rgba(225,29,42,.28); border-color:rgba(225,29,42,.70);}
.sf-btn-disabled{opacity:.55; cursor:not-allowed;}
.sf-modal-backdrop{
  position:fixed; inset:0; z-index:9999;
  background:rgba(0,0,0,.65);
  backdrop-filter: blur(6px);
  display:flex; align-items:center; justify-content:center;
  padding:18px;
}
.sf-modal{
  width:min(420px, 100%);
  background:rgba(17,17,17,.92);
  border:1px solid rgba(225,29,42,.35);
  border-radius:18px;
  box-shadow: 0 18px 48px rgba(0,0,0,.52);
  padding:16px 16px 14px;
}
.sf-modal-title{font-weight:950; letter-spacing:.08em; text-transform:uppercase; font-size:16px;}
.sf-modal-sub{margin-top:6px; color:var(--sf-muted); font-weight:700; font-size:13px;}
.sf-modal-label{display:block; margin-top:12px; margin-bottom:6px; font-weight:900; color:rgba(255,255,255,.78); font-size:13px;}
.sf-modal-input{
  width:100%;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(255,255,255,.12);
  background:rgba(0,0,0,.25);
  color:rgba(255,255,255,.92);
  outline:none;
}
.sf-modal-input:focus{border-color:rgba(225,29,42,.55); box-shadow:0 0 0 3px rgba(225,29,42,.18);}
.sf-modal-actions{display:flex; justify-content:flex-end; gap:10px; margin-top:14px;}
.sf-modal-error{
  margin-top:10px;
  border:1px solid rgba(225,29,42,.40);
  background:rgba(225,29,42,.10);
  border-radius:14px;
  padding:10px 12px;
  font-weight:800;
  color:rgba(255,255,255,.92);
}


/* release library refinement */
.sf-main{grid-template-columns:minmax(290px,340px) minmax(0,1fr);align-items:start;}
.sf-sidebar,.sf-reader{border-radius:24px;}
.sf-reader-head{padding:1rem 1rem .9rem;}
.sf-content{padding:1.1rem 1.15rem 1.4rem;}
@media (max-width:980px){.sf-main{display:flex;flex-direction:column;gap:12px;padding:12px 0 18px;}.sf-reader{order:1;}.sf-sidebar{order:2;}.sf-reader-head{position:static;}.sf-content{padding:1rem;}}
@media (max-width:640px){.sf-section{padding:10px;}.sf-sidebar,.sf-reader,.sf-modal{border-radius:20px;}.sf-book,.sf-lib-item{padding:11px 12px;}.sf-booklist{gap:8px;}.sf-reader-title,.sf-title{font-size:1.1rem;}.sf-reader-actions,#bookDlWrap{width:100%;justify-content:stretch;}.sf-reader-actions .sf-btn,#bookDlWrap .sf-btn{flex:1 1 auto;justify-content:center;min-height:44px;}}


/* clearer mobile library flow */
@media (max-width: 980px){
  .sf-main{ gap:10px; padding:10px 0 18px; }
  .sf-sidebar{ min-height:0; }
}

@media (max-width: 640px){
  .sf-top-books-inner{ padding:12px; border-radius:20px; }
  .sf-sidebar,
  .sf-reader,
  .sf-modal{ border-radius:22px; }
  .sf-side-head,
  .sf-reader-head{ padding:12px; }
  .sf-search{ min-height:46px; }
  .sf-book{ padding:12px 13px; border-radius:18px; }
  .sf-book-name{ line-height:1.3; }
  .sf-reader-sub{ line-height:1.55; }
  .sf-reader-actions,
  #bookDlWrap{ width:100%; gap:8px; }
  .sf-reader-actions .sf-btn,
  #bookDlWrap .sf-btn{ width:100%; justify-content:center; min-height:46px; }
  .sf-content{ padding:1rem; }
  .sf-content .sf-article{ font-size:1rem; line-height:1.8; }
}



/* Library cleanup and smoother scrolling */
.sf-reader-actions--book{display:flex;align-items:center;gap:10px;}
.sf-library-page .sf-sidebar,
.sf-library-page .sf-reader,
.sf-library-page .sf-section,
.sf-library-page .sf-lib-item,
.sf-library-page .sf-booklist{content-visibility:auto;contain-intrinsic-size:260px;}
@media (max-width: 1024px), (prefers-reduced-motion: reduce){
  .sf-library-page .sf-sidebar,
  .sf-library-page .sf-reader,
  .sf-library-page .sf-modal,
  .sf-library-page .sf-lib-item,
  .sf-library-page .sf-book{box-shadow:none!important;backdrop-filter:none!important;}
}


/* library reader cleanup and lighter surface */
.sf-reader{position:relative;}
.sf-book-plain p{margin:0 0 1rem;line-height:1.9;}
.sf-library-page .sf-sidebar,.sf-library-page .sf-reader{box-shadow:0 10px 24px rgba(0,0,0,.22)!important;}


/* library reader fix: internal scroll, steadier header, lighter actions */
.sf-reader-head{position:sticky;top:0;z-index:3;background:rgba(8,8,12,.94);backdrop-filter:blur(8px);} 
.sf-reader-actions .sf-btn,
#bookDlWrap .sf-btn{min-height:44px;justify-content:center;}
.sf-btn-disabled{opacity:.62;cursor:not-allowed;pointer-events:none;}
.sf-book-plain{display:grid;gap:.9rem;}
.sf-book-plain p{margin:0;}
.sf-content{scroll-behavior:smooth;overscroll-behavior:contain;-webkit-overflow-scrolling:touch;}
@media (min-width: 981px){
  .sf-main{height:calc(100dvh - var(--sf-nav-h, 72px) - 28px);min-height:calc(100dvh - var(--sf-nav-h, 72px) - 28px);}
  .sf-sidebar,
  .sf-reader{min-height:0;max-height:100%;}
  .sf-sidebar{overflow:auto;overscroll-behavior:contain;}
  .sf-reader{overflow:hidden;}
  .sf-content{flex:1 1 auto;min-height:0;overflow:auto;}
}
@media (max-width: 980px){
  .sf-reader{max-height:calc(100dvh - var(--sf-nav-h, 72px) - 18px);overflow:hidden;}
  .sf-content{flex:1 1 auto;min-height:0;overflow:auto;}
}

.sf-lib-scroll::-webkit-scrollbar{width:10px;}
.sf-lib-scroll::-webkit-scrollbar-thumb{background:rgba(255,255,255,.14);border-radius:999px;border:2px solid rgba(0,0,0,0);background-clip:padding-box;}
.sf-lib-scroll::-webkit-scrollbar-track{background:transparent;}
@media (max-width:980px){.sf-lib-scroll{max-height:min(48dvh,520px);overflow:auto;padding-right:2px;}}
