:root{
  --blue:#0B63CE;
  --blue2:#1E7BE8;
  --blue-dark:#073F8F;
  --blue-soft:#EAF3FF;
  --sky:#F4F9FF;
  --text:#10233F;
  --muted:#6C7A90;
  --line:#E5EBF2;
  --white:#FFFFFF;
  --danger:#D83B36;
  --success:#0A9B61;
  --warning:#D78A00;
  --shadow:0 14px 35px rgba(16,35,63,.10);
  --radius:22px;
}

*{box-sizing:border-box}
html{scroll-behavior:smooth}
body{
  margin:0;
  font-family:'Inter',system-ui,-apple-system,Segoe UI,Roboto,sans-serif;
  background:linear-gradient(180deg,#EAF4FF 0,#F7FAFE 28%,#F7FAFE 100%);
  color:var(--text);
}
button,input,select,textarea{font:inherit}
button{cursor:pointer}
button:disabled{opacity:.55;cursor:not-allowed}

.app-shell{
  width:min(100%,540px);
  min-height:100vh;
  margin:0 auto;
  background:#fff;
  position:relative;
  padding-bottom:92px;
  box-shadow:0 0 42px rgba(16,35,63,.09);
}

.topbar{
  position:sticky;
  top:0;
  z-index:40;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding:18px 18px 13px;
  background:rgba(255,255,255,.94);
  border-bottom:1px solid rgba(229,235,242,.9);
  backdrop-filter:blur(16px);
}
.eyebrow,.section-kicker{
  margin:0 0 4px;
  color:var(--blue);
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.08em;
  font-size:10px;
}
.topbar h1{margin:0;font-size:24px;letter-spacing:-.6px}
.top-actions{display:flex;gap:8px}
.icon-btn,.avatar-btn{
  width:42px;height:42px;border-radius:14px;
  border:1px solid var(--line);background:#fff;color:var(--blue);
  display:grid;place-items:center;font-weight:900;
}
.icon-btn{font-size:24px}
.avatar-btn{background:var(--blue-soft);font-size:12px}

.page{display:none;padding:0 17px 28px}
.page.active{display:block}

.hero{
  margin-top:17px;
  padding:23px;
  display:grid;
  grid-template-columns:1fr 96px;
  gap:16px;
  color:#fff;
  border-radius:28px;
  background:linear-gradient(135deg,var(--blue-dark),var(--blue2));
  box-shadow:0 20px 42px rgba(11,99,206,.24);
  position:relative;
  overflow:hidden;
}
.hero:before,.hero:after{
  content:"";position:absolute;border-radius:50%;border:22px solid rgba(255,255,255,.07)
}
.hero:before{width:190px;height:190px;right:-110px;top:-110px}
.hero:after{width:150px;height:150px;left:-95px;bottom:-105px}
.hero-copy,.hero-book{position:relative;z-index:1}
.hero h2{margin:14px 0 9px;font-size:27px;line-height:1.08;letter-spacing:-.9px}
.hero p{margin:0 0 18px;color:#DFEEFF;font-size:12px;line-height:1.6}
.hero-pill{
  display:inline-block;padding:7px 10px;border-radius:999px;
  background:rgba(255,255,255,.14);font-size:9px;font-weight:800;letter-spacing:.06em
}
.hero-book{
  align-self:center;width:88px;height:118px;border-radius:15px;
  background:linear-gradient(160deg,#FFFFFF,#D6E9FF);
  color:var(--blue);display:flex;flex-direction:column;align-items:center;justify-content:center;
  box-shadow:0 14px 25px rgba(0,0,0,.17);transform:rotate(3deg)
}
.hero-book span{font-size:28px;font-weight:900}.hero-book small{font-weight:800}

.btn{
  border:0;border-radius:13px;padding:12px 15px;font-weight:800;
  transition:.15s ease
}
.btn:active{transform:scale(.98)}
.btn-light{background:#fff;color:var(--blue)}
.btn-primary{background:var(--blue);color:#fff;box-shadow:0 8px 18px rgba(11,99,206,.22)}
.btn-outline{background:#fff;color:var(--blue);border:1px solid #B9D5F5}
.full{width:100%}
.link-btn{border:0;background:transparent;color:var(--blue);font-weight:800}

.section-block{padding-top:27px}
.section-head{
  display:flex;justify-content:space-between;align-items:flex-end;gap:10px;margin-bottom:14px
}
.section-head h3,.page-title h2{margin:0;font-size:23px;letter-spacing:-.4px}
.select,.input,.textarea{
  border:1px solid var(--line);background:#fff;color:var(--text);
  border-radius:13px;outline:none
}
.select{padding:9px 10px;max-width:145px;font-size:12px;font-weight:700}
.input{width:100%;padding:12px 13px;margin-bottom:10px}
.textarea{width:100%;min-height:110px;padding:12px 13px;resize:vertical;margin-bottom:10px}
.input:focus,.textarea:focus,.select:focus{border-color:#8CBAF1;box-shadow:0 0 0 4px #EEF6FF}
.field-label{display:block;font-size:11px;font-weight:800;margin:10px 0 6px;color:#536176}

.book-grid{
  display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:15px
}
.book-card{
  border:1px solid var(--line);border-radius:18px;padding:10px;background:#fff;
  box-shadow:0 8px 20px rgba(16,35,63,.055)
}
.book-cover{
  aspect-ratio:3/4;border-radius:13px;padding:13px;display:flex;flex-direction:column;
  justify-content:space-between;color:#fff;position:relative;overflow:hidden;
  box-shadow:0 9px 18px rgba(16,35,63,.17)
}
.book-cover::after{
  content:"";position:absolute;width:86px;height:86px;border-radius:50%;
  border:13px solid rgba(255,255,255,.11);right:-36px;top:-35px
}
.cover-cat{font-size:8px;font-weight:900;text-transform:uppercase;letter-spacing:.07em}
.cover-title{font-size:16px;line-height:1.02;font-weight:900;position:relative;z-index:1}
.cover-author{font-size:8px;font-weight:700;opacity:.9}
.book-info{padding:10px 2px 1px}
.book-info h4{margin:0 0 5px;font-size:13px;line-height:1.3}
.book-info p{margin:0 0 8px;color:var(--muted);font-size:10px;line-height:1.4}
.price{font-weight:900;color:var(--blue);font-size:14px;margin-bottom:9px}

.page-title{padding:23px 2px 17px}
.page-title p:last-child{margin:7px 0 0;color:var(--muted);font-size:12px;line-height:1.5}

.panel{
  border:1px solid var(--line);border-radius:19px;background:#fff;padding:16px;
  box-shadow:0 8px 18px rgba(16,35,63,.045)
}

.library-list,.orders-list{display:grid;gap:12px}
.library-item,.order-item{
  border:1px solid var(--line);border-radius:17px;background:#fff;padding:12px;
  display:grid;grid-template-columns:78px 1fr;gap:12px
}
.library-item .book-cover,.order-item .book-cover{width:78px}
.library-copy h4,.order-copy h4{margin:0 0 5px;font-size:14px}
.library-copy p,.order-copy p{margin:0 0 8px;color:var(--muted);font-size:10px;line-height:1.45}
.progress{height:6px;background:#EEF2F7;border-radius:99px;overflow:hidden;margin:8px 0}
.progress span{display:block;height:100%;background:var(--blue);border-radius:99px}
.status{
  display:inline-flex;padding:5px 8px;border-radius:999px;font-size:9px;font-weight:900
}
.status.PAID{background:#E8F8F0;color:var(--success)}
.status.PENDING{background:#FFF4DB;color:var(--warning)}
.status.CANCELLED{background:#FDECEC;color:var(--danger)}

.faq-list{display:grid;gap:10px;margin-bottom:16px}
.faq-item{border:1px solid var(--line);border-radius:15px;background:#fff;overflow:hidden}
.faq-question{
  width:100%;border:0;background:#fff;color:var(--text);padding:15px;text-align:left;
  display:flex;justify-content:space-between;gap:10px;font-weight:800;font-size:13px
}
.faq-answer{display:none;padding:0 15px 15px;color:var(--muted);font-size:12px;line-height:1.6}
.faq-item.open .faq-answer{display:block}
.ask-panel h3{margin:0 0 13px;font-size:17px}

.profile-panel{display:grid;grid-template-columns:48px 1fr auto;gap:12px;align-items:center}
.profile-avatar{
  width:48px;height:48px;border-radius:50%;background:var(--blue-soft);color:var(--blue);
  display:grid;place-items:center;font-weight:900
}
.profile-panel strong{display:block;font-size:13px}
.profile-panel span{display:block;color:var(--muted);font-size:10px;margin-top:3px}

.settings-panel{margin-top:13px}
.setting-row{
  display:flex;justify-content:space-between;align-items:center;gap:12px;
  padding:13px 0;border-bottom:1px solid var(--line)
}
.setting-row strong{display:block;font-size:12px}
.setting-row span{display:block;color:var(--muted);font-size:9px;margin-top:3px}
.switch{position:relative;width:44px;height:25px;flex:0 0 auto}
.switch input{display:none}
.slider{position:absolute;inset:0;border-radius:99px;background:#CCD6E3;transition:.2s}
.slider:before{
  content:"";position:absolute;width:19px;height:19px;left:3px;top:3px;border-radius:50%;
  background:#fff;box-shadow:0 2px 6px rgba(0,0,0,.17);transition:.2s
}
.switch input:checked + .slider{background:var(--blue)}
.switch input:checked + .slider:before{transform:translateX(19px)}

.settings-link{
  width:100%;border:0;border-bottom:1px solid var(--line);background:#fff;
  padding:14px 0;display:flex;justify-content:space-between;color:var(--text);font-weight:700;font-size:12px
}
.settings-link:last-child{border-bottom:0}

.bottom-nav{
  position:fixed;left:50%;bottom:0;transform:translateX(-50%);
  width:min(100%,540px);height:78px;background:rgba(255,255,255,.97);
  border-top:1px solid var(--line);display:grid;grid-template-columns:repeat(5,1fr);
  z-index:50;padding:7px 5px 10px;backdrop-filter:blur(16px)
}
.nav-item{
  border:0;background:transparent;color:#8390A3;border-radius:13px;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:3px
}
.nav-item span{font-size:18px;font-weight:900;line-height:1}
.nav-item small{font-size:8px;font-weight:800}
.nav-item.active{color:var(--blue);background:var(--blue-soft)}

.modal{
  position:fixed;inset:0;z-index:100;display:flex;justify-content:center;align-items:flex-end
}
.hidden{display:none!important}
.modal-backdrop{position:absolute;inset:0;background:rgba(10,24,42,.5)}
.modal-card{
  position:relative;z-index:1;width:min(100%,540px);max-height:90vh;overflow:auto;
  border-radius:27px 27px 0 0;background:#fff;padding:20px 18px 28px
}
.small-modal{padding-top:28px}
.modal-close{
  position:absolute;right:14px;top:12px;width:38px;height:38px;border-radius:50%;
  border:0;background:#F0F4F9;color:var(--text);font-size:23px;z-index:3
}
.modal-title h2{margin:0 0 16px;font-size:22px}
.modal-book{
  display:grid;grid-template-columns:120px 1fr;gap:16px;align-items:start;padding-top:27px
}
.modal-book .book-cover{width:120px}
.modal-book h2{font-size:21px;line-height:1.12;margin:0 0 7px}
.modal-book p{color:var(--muted);font-size:11px;line-height:1.5;margin:0}
.modal-desc{
  border-top:1px solid var(--line);margin-top:17px;padding-top:15px;
  color:#47566C;font-size:12px;line-height:1.65
}
.checkout-book{
  display:grid;grid-template-columns:75px 1fr;gap:12px;padding:24px 0 13px;border-bottom:1px solid var(--line)
}
.checkout-book .book-cover{width:75px}
.checkout-book h3{margin:0 0 5px;font-size:14px}
.checkout-summary{padding:15px 0}
.summary-row{display:flex;justify-content:space-between;padding:6px 0;font-size:12px}
.summary-row.total{font-size:15px;font-weight:900;border-top:1px solid var(--line);margin-top:6px;padding-top:12px}
.payment-options{display:grid;gap:8px;margin:10px 0 16px}
.payment-option{
  display:flex;justify-content:space-between;align-items:center;border:1px solid var(--line);
  border-radius:12px;padding:11px 12px;font-size:12px
}

.loading-overlay{
  position:fixed;inset:0;background:rgba(255,255,255,.84);z-index:200;
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:11px
}
.spinner{
  width:36px;height:36px;border:4px solid #DCEBFC;border-top-color:var(--blue);
  border-radius:50%;animation:spin .8s linear infinite
}
@keyframes spin{to{transform:rotate(360deg)}}
.loading-overlay p{font-size:12px;font-weight:700;color:var(--muted)}

.toast{
  position:fixed;left:50%;bottom:92px;transform:translate(-50%,18px);
  z-index:300;max-width:calc(100% - 34px);width:max-content;
  background:#10233F;color:#fff;padding:11px 14px;border-radius:12px;
  font-size:11px;text-align:center;opacity:0;pointer-events:none;transition:.23s
}
.toast.show{opacity:1;transform:translate(-50%,0)}

.empty{
  padding:30px 18px;text-align:center;background:var(--sky);
  border:1px dashed #BCD4EF;border-radius:17px;color:var(--muted);font-size:12px;line-height:1.6
}

.compact .book-card{padding:7px}
.compact .book-info p{display:none}
.compact .book-cover{aspect-ratio:4/4.6}

@media(min-width:541px){
  body{padding:18px 0}
  .app-shell{min-height:calc(100vh - 36px);border-radius:28px;overflow:hidden}
  .bottom-nav{bottom:18px;border-radius:0 0 28px 28px}
}
