/* ===== رواق الكتب — visual system ===== */
:root{
  --paper:#f8f3e9;
  --paper-lift:#fffdf7;
  --ink:#221c17;
  --ink-2:#5d534a;
  --ink-3:#8d8279;
  --line:rgba(34,28,23,.11);
  --accent:#bf5230;
  --accent-dark:#9d3f22;
  --accent-soft:#f6e2d8;
  --green:#3c5b48;
  --gold:#c8a44d;
  --radius:20px;
  --shadow-sm:0 1px 2px rgba(34,28,23,.05), 0 10px 24px -18px rgba(34,28,23,.45);
  --shadow-md:0 24px 50px -30px rgba(34,28,23,.6);
}

*{box-sizing:border-box;}
html{-webkit-text-size-adjust:100%;}
body{
  margin:0;
  min-height:100vh;
  font-family:'Tajawal',system-ui,-apple-system,'Segoe UI',sans-serif;
  font-size:16px;
  line-height:1.6;
  color:var(--ink);
  background:
    radial-gradient(900px 480px at 88% -8%, #fdf0e0 0%, rgba(253,240,224,0) 62%),
    radial-gradient(760px 420px at 0% 0%, #f3ece0 0%, rgba(243,236,224,0) 58%),
    var(--paper);
  background-attachment:fixed;
  -webkit-font-smoothing:antialiased;
}
h1,h2,h3,p{margin:0;}
button{font-family:inherit;color:inherit;font-size:inherit;}
button,input{user-select:none;-webkit-user-select:none;-webkit-tap-highlight-color:transparent;}
input{user-select:text;-webkit-user-select:text;}
img{max-width:100%;display:block;}
.hidden{display:none !important;}
.muted{color:var(--ink-3);font-size:13px;}

.shell{max-width:1080px;margin:0 auto;padding:0 16px;}

/* ===== header ===== */
.app-header{
  position:sticky;top:0;z-index:30;
  backdrop-filter:blur(14px);
  -webkit-backdrop-filter:blur(14px);
  background:rgba(248,243,233,.82);
  border-bottom:1px solid var(--line);
}
.header-inner{
  max-width:1080px;margin:0 auto;padding:12px 16px;
  display:flex;align-items:center;justify-content:space-between;gap:12px;
}
.brand{display:flex;align-items:center;gap:10px;min-width:0;}
.brand-mark{
  width:38px;height:38px;flex:0 0 auto;border-radius:12px;
  display:grid;place-items:center;
  background:linear-gradient(150deg,#33261d,#5a3d29);
  color:#f7e9d6;box-shadow:var(--shadow-sm);
}
.brand-text{min-width:0;}
.brand-title{font-size:17px;font-weight:800;letter-spacing:0;line-height:1.25;}
.brand-sub{font-size:11.5px;color:var(--ink-3);line-height:1.2;}
.trial-pill{
  display:flex;align-items:center;gap:7px;
  border:1px solid var(--line);
  background:var(--paper-lift);
  color:var(--ink-2);
  padding:8px 13px;border-radius:999px;
  font-size:12.5px;font-weight:500;white-space:nowrap;
  cursor:pointer;transition:transform .15s, background .2s;
  box-shadow:var(--shadow-sm);
}
.trial-pill:active{transform:scale(.97);}
.trial-pill .dot{width:7px;height:7px;border-radius:50%;background:var(--green);flex:0 0 auto;}
.trial-pill.is-over .dot{background:var(--accent);}

/* ===== generic ===== */
.main{padding:18px 0 108px;}
.view{display:none;}
.view.is-active{display:block;animation:viewIn .32s ease-out both;}
@keyframes viewIn{from{opacity:0;transform:translateY(8px);}to{opacity:1;transform:none;}}
@media (prefers-reduced-motion:reduce){
  .view.is-active{animation:none;}
  *{transition-duration:.01ms !important;}
}

.btn{
  border:0;border-radius:14px;padding:12px 20px;
  font-weight:700;font-size:15px;cursor:pointer;
  transition:transform .14s ease, background .2s, opacity .2s;
  min-height:46px;
}
.btn:active{transform:scale(.975);}
.btn-primary{background:var(--accent);color:#fff;box-shadow:0 12px 26px -16px rgba(191,82,48,.95);}
.btn-primary:hover{background:var(--accent-dark);}
.btn-primary:disabled{background:#d9cfc4;color:#8b8078;box-shadow:none;cursor:not-allowed;}
.btn-cream{background:#f7ecd9;color:#2b2018;box-shadow:0 10px 22px -16px rgba(0,0,0,.9);}
.btn-cream:hover{background:#fff6e7;}
.btn:focus-visible,.trial-pill:focus-visible,.tab:focus-visible,.book-card:focus-visible,.icon-btn:focus-visible,.bar-btn:focus-visible,.tool-btn:focus-visible,.chip:focus-visible{
  outline:2.5px solid var(--accent);outline-offset:2px;
}

.eyebrow{
  font-size:11.5px;font-weight:700;letter-spacing:.06em;
  color:var(--gold);text-transform:none;
}

/* ===== continue card ===== */
.continue-card{
  position:relative;overflow:hidden;
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  padding:22px 20px;border-radius:26px;
  background:linear-gradient(140deg,#2a201a 0%,#46311f 55%,#6a452c 100%);
  color:#f8efe0;box-shadow:var(--shadow-md);
}
.continue-card::before{
  content:"";position:absolute;inset:0;pointer-events:none;
  background:radial-gradient(420px 220px at 100% 0%, rgba(200,164,77,.22), transparent 65%);
}
.continue-text{position:relative;min-width:0;flex:1 1 auto;}
.continue-text h2{
  font-size:21px;line-height:1.35;font-weight:800;margin:6px 0 4px;
  overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;
}
.continue-meta{font-size:12.5px;color:rgba(248,239,224,.72);margin-bottom:12px;}
.bar{height:5px;border-radius:99px;overflow:hidden;margin-bottom:16px;}
.bar-dark{background:rgba(248,239,224,.22);}
.bar-dark span{display:block;height:100%;background:linear-gradient(90deg,#e8c47c,#f4e2b6);border-radius:99px;transition:width .5s ease;}
.continue-cover{
  position:relative;flex:0 0 auto;width:88px;
  border-radius:10px;overflow:hidden;
  transform:rotate(-3deg);
  box-shadow:0 18px 34px -18px rgba(0,0,0,.95), 0 0 0 1px rgba(255,255,255,.14);
  background:linear-gradient(160deg,#7b5a3c,#3f2d20);
}
.continue-cover img{width:100%;aspect-ratio:2/3;object-fit:cover;}

/* ===== stats ===== */
.stats-row{
  display:flex;align-items:stretch;
  margin:18px 0 4px;padding:14px 4px;
  border-top:1px solid var(--line);border-bottom:1px solid var(--line);
}
.stat{flex:1 1 0;text-align:center;padding:0 6px;}
.stat + .stat{border-inline-start:1px solid var(--line);}
.stat b{display:block;font-size:20px;font-weight:800;line-height:1.2;}
.stat span{font-size:11.5px;color:var(--ink-3);}

/* ===== shelf ===== */
.section-head{display:flex;align-items:baseline;justify-content:space-between;margin:26px 0 12px;}
.section-head h2{font-size:18px;font-weight:800;}
.chips{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;margin-bottom:14px;scrollbar-width:none;}
.chips::-webkit-scrollbar{display:none;}
.chip{
  border:1px solid var(--line);background:var(--paper-lift);
  color:var(--ink-2);font-size:13px;font-weight:500;
  padding:7px 15px;border-radius:999px;white-space:nowrap;cursor:pointer;
  transition:background .2s,color .2s,border-color .2s;
  min-height:36px;
}
.chip.is-on{background:var(--ink);color:#f8f3e9;border-color:var(--ink);}

.shelf{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px 14px;}
.book-card{
  display:flex;flex-direction:column;gap:7px;
  background:none;border:0;padding:0;text-align:start;cursor:pointer;
}
.book-cover{
  position:relative;aspect-ratio:2/3;border-radius:12px;overflow:hidden;
  background:linear-gradient(160deg,#e3d7c2,#bfb09a);
  box-shadow:0 16px 30px -22px rgba(34,28,23,.95);
  transition:transform .22s ease, box-shadow .22s ease;
}
.book-card:hover .book-cover{transform:translateY(-3px);box-shadow:0 22px 34px -22px rgba(34,28,23,.9);}
.book-card:active .book-cover{transform:scale(.985);}
.book-cover img{width:100%;height:100%;object-fit:cover;}
.cover-scrim{
  position:absolute;inset:0;
  background:linear-gradient(to top, rgba(18,13,10,.88) 0%, rgba(18,13,10,.28) 42%, rgba(18,13,10,0) 68%);
}
.cover-title{
  position:absolute;inset-inline:10px;bottom:9px;
  color:#fff;font-size:12.5px;font-weight:700;line-height:1.35;
  text-shadow:0 1px 10px rgba(0,0,0,.7);
}
.book-meta{font-size:11.5px;color:var(--ink-3);line-height:1.4;}
.book-progress{height:3px;border-radius:99px;background:rgba(34,28,23,.1);overflow:hidden;}
.book-progress i{display:block;height:100%;background:var(--accent);border-radius:99px;transition:width .4s;}
.fineprint{margin-top:26px;font-size:11.5px;color:var(--ink-3);line-height:1.7;text-align:center;}

/* ===== discover ===== */
.page-head{margin:6px 0 18px;}
.page-head h2{font-size:22px;font-weight:800;margin:6px 0 8px;}
.page-sub{font-size:13.5px;color:var(--ink-2);line-height:1.75;}
.search-form{display:flex;gap:9px;margin-bottom:12px;}
.search-form input{
  flex:1 1 auto;min-width:0;
  border:1px solid var(--line);background:var(--paper-lift);
  border-radius:14px;padding:13px 15px;font-size:15px;color:var(--ink);
  outline:none;transition:border-color .2s, box-shadow .2s;
  min-height:48px;
}
.search-form input::placeholder{color:#a99f95;}
.search-form input:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft);}
.search-form .btn{flex:0 0 auto;font-size:13.5px;padding:12px 16px;}
.status{font-size:12.5px;line-height:1.7;color:var(--ink-2);margin-bottom:14px;min-height:1px;}
.status.warn{color:#9a5a17;}
.status.error{color:#a33a2a;}
.status .wallet-link{color:var(--accent);text-decoration:underline;font-weight:700;}
.results{display:flex;flex-direction:column;gap:10px;}
.result{
  display:block;text-decoration:none;color:inherit;
  background:var(--paper-lift);border:1px solid var(--line);
  border-radius:16px;padding:14px 15px;transition:transform .16s, border-color .2s;
}
.result:active{transform:scale(.995);}
.result h3{font-size:14.5px;font-weight:700;line-height:1.5;margin-bottom:3px;}
.result .r-author{font-size:12px;color:var(--ink-3);}
.result .r-desc{font-size:12.5px;color:var(--ink-2);margin-top:6px;line-height:1.7;
  display:-webkit-box;-webkit-line-clamp:3;-webkit-box-orient:vertical;overflow:hidden;}
.result .r-open{font-size:11.5px;color:var(--accent);font-weight:700;margin-top:8px;display:inline-block;}
.attribution{font-size:11px;color:var(--ink-3);margin-top:14px;text-align:center;}

/* ===== plan ===== */
.plan-card{
  display:flex;align-items:center;gap:16px;
  background:var(--paper-lift);border:1px solid var(--line);
  border-radius:24px;padding:20px;box-shadow:var(--shadow-sm);
  margin-bottom:18px;
}
.ring-wrap{position:relative;width:104px;height:104px;flex:0 0 auto;}
.ring{width:100%;height:100%;}
.ring-track{fill:none;stroke:rgba(34,28,23,.1);stroke-width:9;}
.ring-fill{fill:none;stroke:url(#g) ;stroke:var(--accent);stroke-width:9;stroke-linecap:round;transition:stroke-dashoffset .8s ease;}
.ring-label{position:absolute;inset:0;display:grid;place-content:center;text-align:center;}
.ring-label b{display:block;font-size:26px;font-weight:800;line-height:1;}
.ring-label span{font-size:10.5px;color:var(--ink-3);display:block;margin-top:3px;}
.plan-copy h2{font-size:20px;font-weight:800;margin:6px 0 6px;}
.plan-copy p{font-size:13px;color:var(--ink-2);line-height:1.7;}

.steps{display:flex;flex-direction:column;gap:10px;margin-bottom:18px;}
.step{
  display:flex;gap:12px;align-items:flex-start;
  background:rgba(255,253,247,.6);border:1px solid var(--line);
  border-radius:16px;padding:14px 15px;
}
.step-num{
  flex:0 0 auto;width:26px;height:26px;border-radius:50%;
  display:grid;place-items:center;font-size:12.5px;font-weight:800;
  background:var(--accent-soft);color:var(--accent-dark);
}
.step-body b{font-size:14px;}
.step-body p{font-size:12.5px;color:var(--ink-2);line-height:1.65;margin-top:2px;}

.price-card{
  display:flex;align-items:center;justify-content:space-between;gap:14px;flex-wrap:wrap;
  background:linear-gradient(140deg,#2a201a,#573a26);
  color:#f8efe0;border-radius:22px;padding:20px;
  box-shadow:var(--shadow-md);margin-bottom:20px;
}
.price-label{font-size:11.5px;color:rgba(248,239,224,.65);}
.price{display:flex;align-items:baseline;gap:7px;margin:3px 0 2px;}
.price b{font-size:32px;font-weight:800;line-height:1;}
.price span{font-size:12.5px;color:rgba(248,239,224,.8);}
.price-note{font-size:11.5px;color:rgba(248,239,224,.6);}
.buy-area{display:flex;flex-direction:column;gap:8px;align-items:stretch;flex:1 1 190px;min-width:0;}
.buy-area .btn{width:100%;}
.buy-note{font-size:11px;color:rgba(248,239,224,.62);line-height:1.6;}
.buy-note.on-light{color:var(--ink-3);}

.features{list-style:none;padding:0;margin:0 0 18px;display:flex;flex-direction:column;gap:9px;}
.features li{display:flex;gap:10px;align-items:flex-start;font-size:13.5px;color:var(--ink-2);line-height:1.6;}
.tick{
  flex:0 0 auto;width:20px;height:20px;border-radius:50%;
  background:#e8efe8;color:var(--green);
  display:grid;place-items:center;font-size:11px;font-weight:800;margin-top:2px;
}
.faq details{
  border-top:1px solid var(--line);padding:14px 2px;
}
.faq summary{font-size:14px;font-weight:700;cursor:pointer;list-style:none;display:flex;justify-content:space-between;align-items:center;gap:10px;}
.faq summary::-webkit-details-marker{display:none;}
.faq summary::after{content:"+";font-size:18px;color:var(--ink-3);font-weight:400;}
.faq details[open] summary::after{content:"−";}
.faq p{font-size:12.5px;color:var(--ink-2);line-height:1.75;margin-top:8px;}

/* ===== tabbar ===== */
.tabbar{
  position:fixed;inset-inline:0;bottom:0;z-index:40;
  display:flex;justify-content:center;gap:4px;
  padding:8px 10px 10px;
  background:rgba(248,243,233,.9);
  backdrop-filter:blur(16px);-webkit-backdrop-filter:blur(16px);
  border-top:1px solid var(--line);
}
.tabbar-inner{}
.tab{
  flex:1 1 0;max-width:160px;
  display:flex;flex-direction:column;align-items:center;gap:3px;
  border:0;background:none;color:var(--ink-3);
  padding:7px 8px;border-radius:14px;cursor:pointer;
  font-size:10.5px;font-weight:500;
  transition:color .2s, background .2s;
  min-height:48px;
}
.tab.is-active{color:var(--accent);background:rgba(191,82,48,.09);}

/* ===== reader ===== */
.reader{
  position:fixed;inset:0;z-index:70;
  display:flex;flex-direction:column;
  background:var(--r-bg,#faf6ec);color:var(--r-text,#2a2320);
  transition:background .3s, color .3s;
}
.reader[data-theme="paper"]{--r-bg:#faf6ec;--r-text:#2a2320;--r-soft:#6f635a;--r-line:rgba(42,35,32,.12);--r-panel:rgba(250,246,236,.94);}
.reader[data-theme="sepia"]{--r-bg:#f1e3c7;--r-text:#46351f;--r-soft:#7e6746;--r-line:rgba(70,53,31,.16);--r-panel:rgba(241,227,199,.95);}
.reader[data-theme="night"]{--r-bg:#111417;--r-text:#d8d3c8;--r-soft:#8c8880;--r-line:rgba(216,211,200,.14);--r-panel:rgba(17,20,23,.95);}

.reader-top{
  display:flex;align-items:center;gap:10px;
  padding:10px 12px;border-bottom:1px solid var(--r-line);
  background:var(--r-panel);backdrop-filter:blur(12px);
}
.icon-btn{
  width:40px;height:40px;flex:0 0 auto;border:0;border-radius:12px;
  background:transparent;color:var(--r-text,#221c17);
  display:grid;place-items:center;cursor:pointer;transition:background .18s;
}
.icon-btn:hover{background:rgba(127,127,127,.12);}
.icon-btn:active{transform:scale(.94);}
.reader-titles{flex:1 1 auto;min-width:0;text-align:center;}
.reader-book{
  display:block;font-size:11.5px;color:var(--r-soft);
  overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
}
.reader-chapter{display:block;font-size:13px;font-weight:700;}
.reader-progress{height:3px;background:rgba(127,127,127,.18);}
.reader-progress span{display:block;height:100%;background:var(--accent);transition:width .35s;}

.reader-scroll{flex:1 1 auto;overflow-y:auto;-webkit-overflow-scrolling:touch;overscroll-behavior:contain;}
.reader-inner{max-width:660px;margin:0 auto;padding:26px 22px 40px;}
.reader-heading{
  font-family:'Tajawal',sans-serif;font-size:20px;font-weight:800;
  line-height:1.5;margin-bottom:18px;color:var(--r-text);
}
.reader-heading::after{
  content:"";display:block;width:44px;height:3px;border-radius:99px;
  background:var(--accent);margin-top:12px;
}
.reader-body{
  font-family:'Amiri',Georgia,serif;
  font-size:19px;line-height:2.05;color:var(--r-text);
}
.reader-body p{margin:0 0 1.05em;text-align:justify;text-justify:inter-word;}
.reader-end{display:flex;justify-content:center;margin-top:26px;}

.reader-bar{
  border-top:1px solid var(--r-line);background:var(--r-panel);
  backdrop-filter:blur(12px);padding:8px 12px 10px;
}
.reader-bar-row{display:flex;align-items:center;gap:8px;justify-content:space-between;}
.reader-bar-row.tools{gap:6px;margin-top:7px;justify-content:space-between;}
.reader-pos{font-size:11.5px;color:var(--r-soft);white-space:nowrap;font-variant-numeric:tabular-nums;}
.bar-btn{
  border:1px solid var(--r-line);background:transparent;color:var(--r-text);
  border-radius:11px;padding:9px 10px;font-size:12px;font-weight:600;
  cursor:pointer;min-height:40px;flex:1 1 0;transition:background .18s, opacity .2s;
}
.bar-btn:hover{background:rgba(127,127,127,.1);}
.bar-btn:disabled{opacity:.35;cursor:not-allowed;}
.tool-btn{
  flex:1 1 0;display:flex;align-items:center;justify-content:center;gap:5px;
  border:1px solid var(--r-line);background:transparent;color:var(--r-text);
  border-radius:11px;padding:8px 4px;font-size:11.5px;font-weight:600;
  cursor:pointer;min-height:38px;transition:background .18s, color .2s, border-color .2s;
  white-space:nowrap;
}
.tool-btn:hover{background:rgba(127,127,127,.1);}
.tool-btn.active{background:var(--accent);color:#fff;border-color:var(--accent);}
.tool-btn:disabled{opacity:.4;}

/* ===== sheet ===== */
.sheet{
  position:fixed;inset:0;z-index:85;
  display:flex;align-items:flex-end;justify-content:center;
  background:rgba(24,18,14,.42);
  animation:fadeIn .2s ease-out both;
}
@keyframes fadeIn{from{opacity:0}to{opacity:1}}
.sheet-panel{
  width:100%;max-width:560px;max-height:76vh;
  display:flex;flex-direction:column;
  background:var(--paper-lift);color:var(--ink);
  border-radius:22px 22px 0 0;
  box-shadow:0 -20px 50px -30px rgba(0,0,0,.8);
  animation:sheetUp .26s cubic-bezier(.2,.8,.3,1) both;
}
@keyframes sheetUp{from{transform:translateY(18px);opacity:.6}to{transform:none;opacity:1}}
.sheet-head{
  display:flex;align-items:center;justify-content:space-between;
  padding:16px 18px 10px;border-bottom:1px solid var(--line);
}
.sheet-head h3{font-size:16px;font-weight:800;}
.chapter-list{overflow-y:auto;padding:8px 10px 20px;}
.chapter-item{
  display:flex;align-items:center;gap:12px;width:100%;
  border:0;background:none;padding:13px 10px;border-radius:14px;
  text-align:start;cursor:pointer;transition:background .18s;
}
.chapter-item:hover{background:rgba(34,28,23,.05);}
.chapter-item.is-current{background:var(--accent-soft);}
.chapter-item .ci-num{
  flex:0 0 auto;width:26px;height:26px;border-radius:50%;
  display:grid;place-items:center;font-size:11.5px;font-weight:700;
  background:rgba(34,28,23,.07);color:var(--ink-2);
}
.chapter-item.is-done .ci-num{background:var(--green);color:#fff;}
.chapter-item .ci-title{flex:1 1 auto;font-size:13.5px;font-weight:600;line-height:1.45;}
.chapter-item .ci-state{font-size:11px;color:var(--ink-3);}

/* ===== toast ===== */
.toast{
  position:fixed;inset-inline:0;bottom:92px;margin-inline:auto;
  width:fit-content;max-width:88vw;
  background:#221c17;color:#f8f3e9;
  padding:10px 18px;border-radius:999px;
  font-size:13px;text-align:center;
  opacity:0;transform:translateY(10px);
  pointer-events:none;transition:opacity .25s, transform .25s;
  z-index:95;
}
.toast.show{opacity:1;transform:none;}

/* ===== responsive ===== */
@media (min-width:640px){
  .shell,.header-inner{padding-inline:24px;}
  .shelf{grid-template-columns:repeat(3,minmax(0,1fr));gap:20px;}
  .continue-cover{width:110px;}
  .continue-text h2{font-size:24px;}
  .stat b{font-size:23px;}
  .reader-inner{padding:36px 28px 52px;}
  .reader-body{font-size:21px;}
}
@media (min-width:960px){
  .main{padding-bottom:60px;}
  .shelf{grid-template-columns:repeat(5,minmax(0,1fr));gap:22px;}
  .continue-card{padding:30px 28px;}
  .continue-text h2{font-size:27px;}
  .continue-cover{width:132px;}
  .tabbar{
    position:sticky;bottom:14px;width:fit-content;margin:0 auto 18px;
    border:1px solid var(--line);border-radius:20px;
    box-shadow:var(--shadow-md);padding:6px;
  }
  .tab{min-width:112px;}
  .view.is-active{max-width:100%;}
  .reader-inner{padding-top:44px;}
}
@media (max-width:420px){
  .brand-sub{display:none;}
  .trial-pill{font-size:11.5px;padding:7px 11px;}
  .stats-row{padding:12px 0;}
  .stat b{font-size:18px;}
  .stat span{font-size:10.5px;}
  .reader-inner{padding:20px 16px 34px;}
  .reader-body{font-size:18px;}
  .tool-btn span{display:none;}
  .tool-btn svg{width:18px;height:18px;}
}

/* ===== حقول وأغلفة مولّدة ===== */
.search-row{margin-bottom:10px;}
.text-input{
  width:100%;border:1px solid var(--line);background:var(--paper-lift);
  border-radius:14px;padding:12px 15px;font-size:15px;color:var(--ink);
  font-family:inherit;outline:none;transition:border-color .2s, box-shadow .2s;
  min-height:46px;user-select:text;-webkit-user-select:text;
}
.text-input:focus{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-soft);}
textarea.text-input{resize:vertical;line-height:1.65;min-height:88px;}
select.text-input{appearance:none;-webkit-appearance:none;}
.book-cover.gen{background:linear-gradient(160deg,#5f4633,#2e2118);}
.book-cover.gen[data-g="قصص"]{background:linear-gradient(160deg,#3f5a55,#22322f);}
.book-cover.gen[data-g="رواية"]{background:linear-gradient(160deg,#6a4030,#2f1d16);}
.book-cover.gen[data-g="رحلة"]{background:linear-gradient(160deg,#8a6a34,#3a2c15);}
.book-cover.gen[data-g="تطوير"]{background:linear-gradient(160deg,#40546e,#1f2a36);}
.book-cover.gen[data-g="علوم"]{background:linear-gradient(160deg,#2f5c63,#16302f);}
.book-cover.gen[data-g="شعر"]{background:linear-gradient(160deg,#6b3a51,#2e1824);}
.book-cover.gen[data-g="طفل"]{background:linear-gradient(160deg,#b07a3a,#4a2f19);}
.book-cover.gen[data-g="تاريخ"]{background:linear-gradient(160deg,#7a5a3a,#33251a);}
.book-cover.gen[data-g="فلسفة"]{background:linear-gradient(160deg,#4a4a58,#212127);}
.book-cover.gen[data-g="طبخ"]{background:linear-gradient(160deg,#7d4a2c,#37200f);}
.continue-cover.gen{aspect-ratio:2/3;display:grid;place-items:center;padding:8px;}
.continue-cover.gen::after{
  content:attr(data-t);font-size:9.5px;font-weight:700;line-height:1.35;
  color:#f6ead6;text-align:center;
}

/* ===== التحديات ===== */
.star-card{
  display:flex;align-items:center;gap:14px;flex-wrap:wrap;
  background:linear-gradient(140deg,#2f2419,#5c3f24);
  color:#f8efe0;border-radius:22px;padding:18px;box-shadow:var(--shadow-md);
  margin-bottom:18px;
}
.star-badge{
  flex:0 0 auto;width:52px;height:52px;border-radius:50%;
  display:grid;place-items:center;font-size:25px;
  background:radial-gradient(circle at 35% 30%, rgba(255,232,170,.5), rgba(255,232,170,.06) 70%);
  box-shadow:inset 0 0 0 1px rgba(255,232,170,.35);
}
.star-info{flex:1 1 180px;min-width:0;}
.star-info h3{font-size:17px;font-weight:800;margin:2px 0 4px;}
.star-info p{font-size:12.5px;line-height:1.65;color:rgba(248,239,224,.82);}
.star-info p + p{margin-top:3px;color:rgba(248,239,224,.65);}
.star-info .eyebrow{color:#e2bd77;}
.star-info b{color:#f6e0b0;}
.btn.small{padding:9px 14px;font-size:12.5px;min-height:40px;border-radius:12px;}

.week-card{background:var(--paper-lift);border:1px solid var(--line);border-radius:20px;padding:16px 14px 12px;box-shadow:var(--shadow-sm);margin-bottom:20px;}
.week-card .section-head{margin:0 0 8px;}
.week-bars{display:flex;align-items:flex-end;justify-content:space-between;gap:8px;height:132px;}
.week-col{flex:1 1 0;display:flex;flex-direction:column;align-items:center;gap:5px;height:100%;justify-content:flex-end;min-width:0;}
.week-val{font-size:10.5px;color:var(--ink-3);font-weight:700;}
.week-bar{width:100%;flex:1 1 auto;display:flex;align-items:flex-end;background:rgba(34,28,23,.06);border-radius:8px;overflow:hidden;min-height:8px;}
.week-bar i{display:block;width:100%;background:linear-gradient(180deg,#e09a72,#bf5230);border-radius:8px 8px 0 0;transition:height .5s ease;}
.week-lab{font-size:9.5px;color:var(--ink-3);text-align:center;line-height:1.2;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:100%;}

.challenge-list{display:flex;flex-direction:column;gap:10px;}
.challenge{background:var(--paper-lift);border:1px solid var(--line);border-radius:16px;padding:14px 15px;box-shadow:var(--shadow-sm);}
.challenge.is-done{border-color:rgba(60,91,72,.35);background:linear-gradient(160deg,#f5f8f3,#eef3ec);}
.ch-head{display:flex;align-items:center;justify-content:space-between;gap:10px;}
.ch-head b{font-size:14.5px;}
.pill{font-size:10.5px;font-weight:700;color:var(--ink-2);background:rgba(34,28,23,.07);padding:3px 9px;border-radius:99px;white-space:nowrap;}
.challenge.is-done .pill{background:#dfead9;color:var(--green);}
.ch-desc{font-size:12.5px;color:var(--ink-2);margin:4px 0 10px;line-height:1.6;}
.ch-bar{height:6px;border-radius:99px;background:rgba(34,28,23,.08);overflow:hidden;}
.ch-bar i{display:block;height:100%;background:linear-gradient(90deg,#e09a72,#bf5230);border-radius:99px;transition:width .45s ease;}
.challenge.is-done .ch-bar i{background:linear-gradient(90deg,#7ba88a,#3c5b48);}
.ch-foot{display:flex;justify-content:space-between;gap:10px;margin-top:7px;font-size:11px;color:var(--ink-3);}

/* ===== المجالس ===== */
.profile-card{display:flex;gap:14px;align-items:flex-start;flex-wrap:wrap;background:var(--paper-lift);border:1px solid var(--line);border-radius:22px;padding:16px;box-shadow:var(--shadow-sm);margin-bottom:16px;}
.avatar-pick{display:grid;grid-template-columns:repeat(5,38px);gap:6px;flex:0 0 auto;}
.av{width:38px;height:38px;border-radius:12px;border:1px solid var(--line);background:#fffdf7;font-size:18px;line-height:1;display:grid;place-items:center;cursor:pointer;transition:transform .15s, border-color .2s, background .2s;}
.av:active{transform:scale(.94);}
.av.is-on{border-color:var(--accent);background:var(--accent-soft);}
.av:focus-visible{outline:2.5px solid var(--accent);outline-offset:2px;}
.profile-fields{flex:1 1 190px;min-width:0;display:flex;flex-direction:column;gap:8px;}
.field-label{font-size:11.5px;font-weight:700;color:var(--ink-3);}
.composer{background:var(--paper-lift);border:1px solid var(--line);border-radius:22px;padding:16px;box-shadow:var(--shadow-sm);display:flex;flex-direction:column;gap:8px;margin-bottom:16px;}
.composer-row{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:4px;}
.composer-row .btn{flex:0 0 auto;}
.note-card{background:rgba(200,164,77,.1);border:1px solid rgba(200,164,77,.3);border-radius:16px;padding:13px 15px;margin-bottom:18px;}
.note-card b{font-size:13px;}
.note-card p{font-size:12px;color:var(--ink-2);line-height:1.7;margin-top:3px;}
.posts{display:flex;flex-direction:column;gap:10px;}
.post{background:var(--paper-lift);border:1px solid var(--line);border-radius:16px;padding:14px 15px;box-shadow:var(--shadow-sm);}
.post-head{display:flex;justify-content:space-between;gap:10px;align-items:baseline;}
.post-who{font-size:12.5px;font-weight:700;}
.post-when{font-size:10.5px;color:var(--ink-3);white-space:nowrap;}
.post-book{font-size:11.5px;color:var(--accent);font-weight:700;margin-top:4px;}
.post-text{font-family:'Amiri',Georgia,serif;font-size:16px;line-height:1.9;color:var(--ink);margin-top:6px;word-break:break-word;}
.post-actions{display:flex;gap:8px;margin-top:10px;}
.mini-btn{border:1px solid var(--line);background:transparent;color:var(--ink-2);border-radius:10px;padding:7px 13px;font-size:11.5px;font-weight:600;cursor:pointer;min-height:36px;transition:background .18s;}
.mini-btn:hover{background:rgba(34,28,23,.05);}
.mini-btn.danger{color:#a33a2a;border-color:rgba(163,58,42,.3);}
.empty{border:1px dashed var(--line);border-radius:16px;padding:22px 16px;text-align:center;font-size:12.5px;color:var(--ink-3);line-height:1.75;}

@media (max-width:430px){
  .tab{font-size:9.5px;padding:6px 3px;gap:2px;}
  .tab svg{width:19px;height:19px;}
  .star-card .btn{width:100%;}
  .avatar-pick{grid-template-columns:repeat(10,1fr);width:100%;}
  .av{width:100%;height:auto;aspect-ratio:1;font-size:16px;}
  .week-lab{font-size:8.5px;}
  .week-val{font-size:9.5px;}
}