/* ==========================================================
   SỔ MẸO 600 CÂU LÝ THUYẾT GPLX - GIAO DIỆN SÁCH MỞ CAO CẤP
   ========================================================== */
:root{
  --ink: #1e293b;
  --ink-soft: #475569;
  --paper: #FFFDF9;
  --rule: #E2E8F0;
  --orange: #EA580C;
  --orange-d: #C2410C;
  --gold: #F59E0B;
  --navy: #1E3A8A;
  --red: #DC2626;
  --ok: #16A34A;
  --top-h: 52px;
  --bottom-nav-height: 56px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

*{box-sizing:border-box;margin:0;padding:0}
html,body{height:100%;overflow:hidden}
html{-webkit-text-size-adjust:100%}
button,[role=button]{cursor:pointer;font-family:inherit;-webkit-tap-highlight-color:transparent}
button:disabled{opacity:.35}
a{color:inherit;text-decoration:none}

.meo-body{
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  color: var(--ink);
  background: #0f172a;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding-top: calc(var(--top-h) + var(--safe-t));
  padding-bottom: calc(var(--bottom-nav-height) + var(--safe-b));
  padding-left: var(--safe-l);
  padding-right: var(--safe-r);
  -webkit-font-smoothing: antialiased;
}

/* THANH TIÊU ĐỀ TRÊN CÙNG */
.meo-top{
  position:fixed; top:0; left:0; right:0; z-index:40;
  padding-top: var(--safe-t);
  background: linear-gradient(135deg, #1e3a8a 0%, #1d4ed8 100%);
  color: #fff;
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}
.meo-top-inner{
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  max-width: 720px;
  margin: 0 auto;
}
.meo-back{
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(255,255,255,0.15);
  color: #fff; font-size: 18px;
  display: grid; place-items: center;
  flex-shrink: 0;
  transition: background 0.2s;
}
.meo-back:active{background:rgba(255,255,255,0.3)}
.meo-top h1{
  flex: 1; min-width: 0;
  font-size: 0.95rem; font-weight: 800;
}
.meo-top h1 small{
  display: block;
  font-size: 0.7rem; font-weight: 400;
  opacity: 0.85;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.meo-toc-btn{
  height: 34px; min-width: 42px;
  padding: 0 12px; border: 0; border-radius: 999px;
  background: var(--gold); color: #78350F;
  font-weight: 800; font-size: 0.75rem;
  flex-shrink: 0;
  box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

/* KHUNG SÁCH CHÍNH */
.meo-stage{
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
  width: 100%; max-width: 600px;
  margin: 0 auto;
  padding: 8px 10px 0;
}
.book-desk{
  flex: 1; min-height: 0;
  display: flex; align-items: stretch; justify-content: center;
  perspective: 1800px;
  background: radial-gradient(ellipse at 50% 80%, rgba(15,23,42,0.8), transparent 70%);
}
.book-wrap{
  position: relative;
  width: 100%; height: 100%;
  margin-left: 4px;
  filter: drop-shadow(0 16px 30px rgba(0,0,0,0.45));
}
.book-spine{
  position: absolute; left: -8px; top: 4px; bottom: 4px; width: 12px;
  border-radius: 6px 0 0 6px;
  background: linear-gradient(90deg, #1e3a8a, #2563eb 55%, var(--gold));
  z-index: 8; pointer-events: none;
}
.book-edge{
  position: absolute; right: -4px; top: 8px; bottom: 8px; width: 6px;
  border-radius: 0 4px 4px 0;
  background: repeating-linear-gradient(180deg, #FDE68A 0 2px, #E2E8F0 2px 3px);
  z-index: 1; pointer-events: none;
}
.book{
  position: relative; width: 100%; height: 100%;
  transform-style: preserve-3d; user-select: none; touch-action: pan-y;
}

/* CÁC TRANG SÁCH */
.page{
  position: absolute; inset: 0;
  border-radius: 0 14px 14px 2px;
  overflow: hidden;
  transform-origin: left center;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: linear-gradient(90deg, rgba(0,0,0,0.06) 0, transparent 14px), linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);
  color: var(--ink);
  box-shadow: inset 12px 0 16px -14px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.08);
  transform: rotateY(0deg); will-change: transform;
}
.page.cover,.page.backcover{
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 100%);
}
.page.is-current{z-index:5}
.page.is-next{z-index:3;pointer-events:none}
.page.is-prev{z-index:1;pointer-events:none;opacity:0}
.page.flipping{z-index:7!important}
.page.animating{transition:transform .5s cubic-bezier(.22,.82,.18,1)}
@media (prefers-reduced-motion:reduce){.page.animating{transition:none}}

.page-shade{
  position: absolute; inset: 0; pointer-events: none; z-index: 3;
  background: linear-gradient(90deg, rgba(0,0,0,0.18) 0%, rgba(0,0,0,0.04) 20%, transparent 45%);
  opacity: 0;
}
.page.flipping .page-shade{opacity:1}

.page-inner{
  position: relative; z-index: 5; height: 100%;
  overflow-x: hidden; overflow-y: auto;
  -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  padding: 14px 16px 52px 16px;
}
.page.cover .page-inner,.page.backcover .page-inner{padding:0;overflow:hidden}

/* BÌA TRƯỚC SÁCH */
.cover-art{
  height: 100%; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 24px 20px 56px 20px; color: #fff;
  background: radial-gradient(ellipse 90% 55% at 75% 18%, rgba(245,158,11,0.25), transparent 55%), linear-gradient(165deg, #2563eb, #1e4a7a 50%, #0f172a);
  position: relative;
}
.cover-art::before{
  content:""; position:absolute; left:16px; right:16px; top:12%; height:40%;
  border: 2px solid rgba(245,158,11,0.4); border-radius: 12px; pointer-events: none;
}
.cover-badge{
  align-self: flex-start;
  background: var(--gold); color: #78350F;
  font-size: 0.7rem; font-weight: 800;
  padding: 4px 12px; border-radius: 999px; margin-bottom: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.2);
}
.cover-art .kicker{
  font-size: 0.65rem; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--gold); margin-bottom: 4px;
}
.cover-art .big-num{
  font-size: clamp(52px, 15vw, 80px); font-weight: 900; line-height: 1; color: var(--gold);
  text-shadow: 0 4px 8px rgba(0,0,0,0.3); margin: 2px 0 8px;
}
.cover-art h2{
  font-size: clamp(22px, 6.5vw, 32px); line-height: 1.15; font-weight: 800; margin-bottom: 8px;
  font-family: Georgia, serif;
}
.cover-art .sub{font-size: 0.82rem; opacity: 0.9; line-height: 1.4;}
.cover-hint{
  position: absolute; left: 14px; right: 14px; bottom: 14px; text-align: center;
  color: #78350F; font-size: 0.75rem; font-weight: 800;
  background: var(--gold); padding: 10px 14px; border-radius: 999px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.25); pointer-events: none;
}
.page-curl{
  position: absolute; right: 0; bottom: 0; width: 44px; height: 44px;
  background: linear-gradient(135deg, transparent 48%, rgba(0,0,0,0.06) 50%, rgba(255,255,255,0.6) 100%);
  pointer-events: none; z-index: 4; border-radius: 0 0 14px 0;
}

/* NỘI DUNG TRONG SÁCH */
.sheet-kicker{
  font-size: 0.65rem; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase; color: var(--orange); margin-bottom: 3px;
}
.sheet-title{
  font-size: 1.15rem; font-weight: 800; line-height: 1.3; color: var(--navy); margin-bottom: 8px;
  font-family: Georgia, serif; border-bottom: 2px solid #e2e8f0; padding-bottom: 6px;
}
.sheet-lead{font-size: 0.82rem; color: var(--ink-soft); line-height: 1.5; margin-bottom: 12px;}
.running{
  display: flex; justify-content: space-between; gap: 8px; font-size: 0.65rem; font-weight: 700; color: #94a3b8;
  margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--rule);
}

/* BANNER MẸO & KHUNG HƯỚNG DẪN */
.tip-banner{
  display: flex; align-items: flex-start; gap: 8px;
  background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
  color: #fff; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px;
  box-shadow: 0 3px 10px rgba(37,99,235,0.2);
}
.tip-banner b{flex-shrink:0; font-size: 0.85rem; font-weight: 800;}
.tip-banner h2{font-size: 0.9rem; font-weight: 800; line-height: 1.35; color: #fff; font-family: inherit;}

.tip-hook{
  background: #EFF6FF; border-left: 4px solid var(--navy); color: #1e3a8a; font-weight: 700;
  border-radius: 0 8px 8px 0; padding: 10px 12px; margin-bottom: 10px; font-size: 0.85rem; line-height: 1.45;
}
.guide-box{
  background: #F0FDF4; border-left: 4px solid #16A34A; color: #166534;
  border-radius: 0 8px 8px 0; padding: 10px 12px; margin-bottom: 10px; font-size: 0.85rem; line-height: 1.45;
}
.tip-warn{
  background: #FEF2F2; border-left: 4px solid var(--red); color: #991B1B;
  border-radius: 0 8px 8px 0; padding: 10px 12px; margin-top: 10px; font-size: 0.8rem; line-height: 1.45;
}
.guide-box b, .tip-hook b, .tip-warn b{
  display: block; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 3px; opacity: 0.85;
}

/* BƯỚC LÀM & CÔNG THỨC CHỐT */
.how-box{
  margin: 10px 0 12px; background: #FFFBEB; border: 1.5px solid #FDE68A; border-radius: 10px; padding: 12px;
}
.how-title{font-size: 0.75rem; font-weight: 800; color: #B45309; text-transform: uppercase; margin-bottom: 8px;}
.how-steps{list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px;}
.how-steps li{display: flex; gap: 10px; align-items: flex-start; font-size: 0.85rem; line-height: 1.5; color: #1e293b;}
.how-n{
  flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--orange); color: #fff;
  font-size: 0.7rem; font-weight: 800; display: grid; place-items: center; margin-top: 1px;
}

.tip-key{
  margin: 10px 0; background: #F8FAFC; border: 1.5px solid var(--rule); border-radius: 10px; padding: 12px;
}
.tip-list{list-style: none; padding: 0; margin: 0; display: grid; gap: 6px;}
.tip-list li{position: relative; padding: 4px 4px 4px 18px; font-size: 0.85rem; line-height: 1.45;}
.tip-list li::before{content:"•"; position: absolute; left: 4px; color: var(--navy); font-weight: bold; font-size: 1.1rem;}

/* NÚT ĐÃ THUỘC */
.tip-actions{display: flex; margin-top: 14px;}
.btn-known{
  flex: 1; height: 44px; border-radius: 10px; font-weight: 800; font-size: 0.88rem; border: 0;
  background: var(--ok); color: #fff; box-shadow: 0 2px 6px rgba(22,163,74,0.3); transition: transform 0.1s;
}
.btn-known.is-on{background: #14532D;}
.btn-known:active{transform: scale(0.98)}

/* ẢNH ĐỀ THẬT & VÍ DỤ */
.tip-real{
  margin: 10px 0 12px; background: #fff; border: 1.5px solid var(--rule); border-radius: 10px; overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.tip-real img{display: block; width: 100%; height: auto; max-height: 200px; object-fit: contain; background: #f8fafc;}
.tip-real figcaption{padding: 8px 10px 10px; display: flex; flex-direction: column; gap: 3px;}
.tr-qid{font-size: 0.68rem; font-weight: 800; color: var(--red); text-transform: uppercase;}
.tr-q{font-size: 0.8rem; line-height: 1.4; color: var(--ink-soft);}

.ex-item{
  background: #fff; border: 1.5px solid var(--rule); border-radius: 10px; padding: 12px; margin-top: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.03);
}
.ex-head{font-size: 0.7rem; font-weight: 800; color: var(--red); text-transform: uppercase; margin-bottom: 4px;}
.ex-q{font-size: 0.85rem; line-height: 1.45; color: var(--ink); font-weight: 600; margin-bottom: 8px;}
.ex-img{display: block; width: 100%; max-height: 150px; object-fit: contain; background: #f8fafc; border-radius: 6px; margin-bottom: 8px;}
.ex-opts{display: flex; flex-direction: column; gap: 5px;}
.ex-opt{
  display: flex; gap: 8px; align-items: flex-start; padding: 7px 10px; border-radius: 6px; background: #f8fafc; font-size: 0.82rem; line-height: 1.4;
}
.ex-opt.is-ans{background: #F0FDF4; border: 1.5px solid #4ADE80; color: #166534; font-weight: 600;}
.ex-key{
  flex-shrink: 0; width: 20px; height: 20px; border-radius: 4px; background: #fff; border: 1px solid #cbd5e1;
  display: grid; place-items: center; font-size: 0.7rem; font-weight: 800;
}
.ex-opt.is-ans .ex-key{background: #16A34A; border-color: #16A34A; color: #fff;}
.ex-why{margin-top: 8px; padding: 8px 10px; background: #FFFBEB; border-radius: 6px; font-size: 0.8rem; line-height: 1.4; color: #78350F;}
.ex-why b{display: block; font-size: 0.65rem; text-transform: uppercase; color: #D97706; margin-bottom: 2px;}

/* THANH ĐIỀU HƯỚNG & MỤC LỤC CHƯƠNG */
.meo-progress{height: 3px; background: rgba(255,255,255,0.15); border-radius: 99px; overflow: hidden; margin: 4px 6px 0; flex-shrink: 0;}
.meo-progress i{display: block; height: 100%; width: 0; background: var(--gold); border-radius: 99px; transition: width .2s ease;}

.ch-pills{
  display: flex; gap: 6px; overflow-x: auto; padding: 6px 4px 0; flex-shrink: 0;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.ch-pills::-webkit-scrollbar{display:none}
.ch-pills button{
  flex: 0 0 auto; height: 28px; padding: 0 12px; border-radius: 999px; border: 0;
  background: rgba(255,255,255,0.15); color: #FDE68A; font-size: 0.72rem; font-weight: 700; white-space: nowrap;
  transition: background 0.2s;
}
.ch-pills button.on{background: var(--gold); color: #78350F;}

.book-ctrl{display: flex; align-items: center; gap: 8px; margin-top: 6px; margin-bottom: 2px; flex-shrink: 0;}
.book-ctrl button{
  height: 42px; min-width: 44px; padding: 0 12px; border: 0; border-radius: 10px;
  background: #ffffff; color: var(--navy); font-weight: 800; font-size: 0.8rem;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.book-ctrl button:active:not(:disabled){transform: scale(0.97)}
.book-ctrl .pg{flex: 1; text-align: center; font-size: 0.78rem; font-weight: 700; color: #FDE68A;}

/* MỤC LỤC SHEET & FULLSCREEN READER */
.toc-sheet{position: fixed; inset: 0; z-index: 80; background: rgba(15,23,42,0.6); display: none; align-items: flex-end; justify-content: center;}
.toc-sheet.open{display: flex;}
.toc-sheet-card{
  width: min(100%, 560px); max-height: 78dvh; overflow: auto; background: var(--paper);
  border-radius: 20px 20px 0 0; padding: 16px 16px calc(80px + var(--safe-b));
}
.toc-sheet-card h3{font-size: 1rem; margin-bottom: 10px; color: var(--navy);}
.toc-ch-label{font-size: 0.65rem; font-weight: 800; letter-spacing: 0.5px; text-transform: uppercase; color: var(--orange); margin: 12px 0 4px;}
.toc-tip{
  display: flex; gap: 8px; align-items: center; padding: 10px 4px; border-bottom: 1px solid var(--rule);
  width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; text-align: left; color: inherit;
}
.toc-tip b{flex-shrink: 0; width: 28px; color: var(--orange); font-size: 0.78rem;}
.toc-tip span{font-size: 0.82rem;}
.toc-tip.is-known span{color: var(--ok);}

.hotspot{position: absolute; top: 0; bottom: 0; width: 25px; z-index: 6; background: transparent; border: 0;}
.hotspot.left{left:0}.hotspot.right{right:0}

/* CHẾ ĐỘ ĐỌC TOÀN MÀN HÌNH (FULLSCREEN) */
.meo-fs{
  position: fixed; inset: 0; z-index: 200; display: none; flex-direction: column; background: #0f172a;
  padding-top: var(--safe-t); padding-bottom: var(--safe-b); padding-left: var(--safe-l); padding-right: var(--safe-r);
}
.meo-fs.open{display: flex;}
.meo-fs-bar{
  flex-shrink: 0; height: 50px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: #1e3a8a; border-bottom: 1px solid rgba(245,158,11,0.3); color: #fff;
}
.meo-fs-close{
  width: 38px; height: 38px; border: 0; border-radius: 10px; background: rgba(255,255,255,0.15);
  color: #fff; font-size: 18px; display: grid; place-items: center; flex-shrink: 0;
}
.meo-fs-title{flex: 1; min-width: 0; font-size: 0.85rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;}
.meo-fs-pg{font-size: 0.78rem; font-weight: 700; opacity: 0.9;}
.meo-fs-body{flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 16px; background: #1e293b;}
.meo-fs-paper{
  max-width: 600px; margin: 0 auto; background: #FFFDF9; border-radius: 12px;
  box-shadow: 0 15px 35px rgba(0,0,0,0.5); padding: 24px 20px; color: #1e293b;
}
.meo-fs-nav{
  flex-shrink: 0; display: flex; gap: 10px; padding: 10px 12px calc(10px + var(--safe-b)); background: #1e3a8a; border-top: 1px solid rgba(245,158,11,0.3);
}
.meo-fs-nav button{flex: 1; height: 44px; border: 0; border-radius: 10px; font-size: 0.9rem; font-weight: 800; color: #fff;}
.meo-fs-nav .fs-prev{background: rgba(255,255,255,0.15);}
.meo-fs-nav .fs-next{background: var(--gold); color: #78350F;}

.fs-hint{
  position: absolute; right: 10px; bottom: 10px; font-size: 0.65rem; font-weight: 700; color: #64748b;
  background: rgba(255,255,255,0.8); padding: 3px 8px; border-radius: 999px; pointer-events: none; z-index: 3;
}
.page.cover .fs-hint, .page.backcover .fs-hint{display: none;}

/* THANH ĐIỀU HƯỚNG ĐÁY TRANG CHUNG */
.bottom-nav{
  position: fixed; bottom: 0; left: 0; right: 0; height: calc(var(--bottom-nav-height) + var(--safe-b));
  padding-bottom: var(--safe-b); background: #fff; border-top: 1px solid #E2E8F0; display: flex; justify-content: center; z-index: 100;
}
.bottom-nav-inner{display: flex; width: 100%; max-width: 480px;}
.nav-item{flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; padding: 6px 2px; color: #64748B; font-size: 10px; font-weight: 500;}
.nav-item.active{color: var(--navy);}
.nav-icon{font-size: 18px; line-height: 1;}
.nav-item.primary-nav{color: var(--red);}
.nav-item.primary-nav .nav-icon{
  background: var(--red); color: #fff; width: 38px; height: 38px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin-top: -6px; box-shadow: 0 2px 4px rgba(220,38,38,0.3); font-size: 16px;
}

/* FIX CÔ LẬP TRANG SÁCH HOÀN HẢO */
.book{isolation: isolate; transform-style: preserve-3d;}
.page{opacity: 0; visibility: hidden; pointer-events: none; z-index: 1; background-color: #F8FAFC;}
.page.is-current{opacity: 1 !important; visibility: visible !important; pointer-events: auto; z-index: 5; background-color: #F8FAFC;}
.page.is-next{opacity: 1 !important; visibility: visible !important; pointer-events: none; z-index: 2; background-color: #F8FAFC;}
.page.is-prev{opacity: 0 !important; visibility: hidden !important; pointer-events: none; z-index: 1;}
.page.flipping{opacity: 1 !important; visibility: visible !important; z-index: 8 !important; pointer-events: none;}
.page.cover,.page.backcover{background-color: #0f172a;}
.page-inner{min-height: 100%; background: linear-gradient(180deg, #FFFFFF 0%, #F8FAFC 100%);}
.page.cover > .page-inner,.page.backcover > .page-inner{background: transparent;}

.page-foot{
  position: absolute; left: 14px; right: 12px; bottom: 6px; display: flex; justify-content: space-between; align-items: center;
  font-size: 0.6rem; font-weight: 700; color: #94a3b8; pointer-events: none; letter-spacing: 0.3px; z-index: 4;
}
.pg-num{background: var(--navy); color: #fff; min-width: 24px; height: 18px; padding: 0 6px; border-radius: 3px 0 8px 0; display: grid; place-items: center; font-size: 0.65rem;}

.back-cta{display: grid; place-items: center; height: 100%; background: linear-gradient(135deg, #1e3a8a, #0f172a); color: #fff; text-align: center; padding: 20px 16px;}
.back-cta h2{font-size: 1.3rem; margin: 6px 0; font-family: Georgia, serif;}
.back-cta p{opacity: 0.9; font-size: 0.82rem; line-height: 1.4;}
.back-cta a,.back-cta button.cta{
  margin-top: 10px; display: inline-block; background: var(--gold); color: #78350F; font-weight: 800;
  padding: 10px 16px; border-radius: 10px; border: 0; font-size: 0.88rem; min-height: 42px;
}
.back-cta .ghost{background: transparent; color: #fff; border: 1.5px solid rgba(255,255,255,0.45); margin-left: 6px;}

@media (min-width: 600px){
  .meo-stage{padding: 10px 12px 4px;}
  .book-desk{align-items: center;}
  .book-wrap{width: min(100%, 440px); height: auto; aspect-ratio: 3/4.2; max-height: 100%;}
  .page-inner{padding: 18px 22px 48px 20px;}
}
