/* ==========================================================================
   CẨM NANG NGỦ ÊM KHÔNG TRÀO NGƯỢC BAN ĐÊM — EBOOK #3
   Midnight Indigo × Twilight Blue × Moonlit Gold + 1-Tap Night Dark Mode
   ========================================================================== */

:root {
  --indigo-deep: #0F1B33;
  --indigo-main: #1D3561;
  --indigo-mid: #2E4D85;
  --indigo-soft: #EEF2FA;
  --indigo-border: #CDD8EE;

  --gold-main: #B9892C;
  --gold-light: #E8D5A7;
  --gold-bg: #FCF9F0;

  --bg-page: #FAF8F3;
  --surface: #FFFFFF;
  --surface-soft: #F3F5FA;

  --text-heading: #101C36;
  --text-main: #263248;
  --text-muted: #5A6882;

  --danger-bg: #FEF2F2;
  --danger-border: #FECACA;
  --danger-text: #B91C1C;

  --safe-bg: #ECFDF5;
  --safe-border: #A7F3D0;
  --safe-text: #065F46;

  --zalo-blue: #0068FF;
  --font-serif: 'Lora', Georgia, serif;
  --font-sans: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-size-base: 17px;

  --radius-xl: 24px;
  --radius-lg: 18px;
  --shadow-card: 0 8px 28px rgba(15, 27, 51, 0.06);
  --shadow-elevated: 0 20px 50px rgba(15, 27, 51, 0.16);
}

/* 1-TAP NIGHT READING MODE (DARK MODE FOR BEDTIME READING) */
body.night-mode {
  --bg-page: #0B1222;
  --surface: #131E36;
  --surface-soft: #192642;
  --indigo-soft: #1E2E50;
  --indigo-border: #2C406B;
  --gold-bg: #1D2538;
  --gold-light: #7A6030;
  --text-heading: #F3F6FC;
  --text-main: #D7E0F0;
  --text-muted: #9AA9C5;
  --danger-bg: #2E151B;
  --danger-border: #7F1D1D;
  --danger-text: #FCA5A5;
  --safe-bg: #0F2922;
  --safe-border: #065F46;
  --safe-text: #6EE7B7;
  --shadow-card: 0 8px 28px rgba(0, 0, 0, 0.35);
}

body.night-mode .reader-topbar { background: rgba(11, 18, 34, 0.94); }
body.night-mode .preface-card { background: linear-gradient(180deg, #16223C 0%, #121B30 100%); }
body.night-mode .pledge-item,
body.night-mode .check-item,
body.night-mode .radio-pill,
body.night-mode .form-input,
body.night-mode .cta-step,
body.night-mode .fb-card,
body.night-mode .social-pill,
body.night-mode .filter-tab,
body.night-mode .acu-tab,
body.night-mode .score-row,
body.night-mode .day-check,
body.night-mode .desktop-sidebar,
body.night-mode .toc-drawer { background: #192642; border-color: #2C406B; color: var(--text-main); }
body.night-mode .font-btn { color: #D7E0F0; }
body.night-mode .font-btn.active { background: #2E4D85; color: #FFFFFF; }
body.night-mode .figure-caption { background: #15213A; border-top-color: #26385E; }
body.night-mode .dual-card { background: #172440; }
body.night-mode .dual-card.eastern { background: #1E263A; }
body.night-mode .btn-menu-icon,
body.night-mode .btn-toc-inline,
body.night-mode .btn-music-top,
body.night-mode .btn-night-top { background: #1E2E50; color: #F3F6FC; border-color: #354D7E; }
body.night-mode .btn-share-gift { background: #27231A; color: #F5E6C4; border-color: #7A6030; }
body.night-mode .back-to-top { background: #192642; color: #F5E6C4; border-color: #354D7E; }
body.night-mode .msg-preview { background: #0E172B; border-color: #4A669C; color: #E2E8F0; }
body.night-mode .chapter-head { border-bottom-color: #25365C; }
body.night-mode .section-card { border-color: #243559; }
body.night-mode .section-card h2,
body.night-mode .section-card h3,
body.night-mode .preface-card h2,
body.night-mode .footer-name,
body.night-mode .topbar-brand,
body.night-mode .drawer-header h3 { color: #F5E6C4; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; font-size: var(--font-size-base); }
body {
  margin: 0; font-family: var(--font-sans);
  color: var(--text-main); background: var(--bg-page);
  line-height: 1.72; -webkit-font-smoothing: antialiased;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.hidden { display: none !important; }
.print-only { display: none; }
img { max-width: 100%; height: auto; }
.ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.ico-lg { width: 22px; height: 22px; }

/* ================= LEAD GATE ================= */
.gate-wrapper {
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 10%, rgba(29, 53, 97, 0.14) 0%, transparent 45%),
    radial-gradient(circle at 88% 85%, rgba(185, 137, 44, 0.14) 0%, transparent 45%),
    var(--bg-page);
  padding: 20px 14px 48px;
  display: flex; flex-direction: column; align-items: center;
}
.gate-shell { width: 100%; max-width: 1040px; }
.gate-card {
  background: var(--surface); border-radius: 26px; overflow: hidden;
  box-shadow: var(--shadow-elevated);
  border: 1px solid rgba(185, 137, 44, 0.25);
  display: grid; grid-template-columns: 1fr;
}
.gate-hero {
  position: relative; padding: 30px 22px 28px; color: #FFFFFF;
  background:
    linear-gradient(150deg, rgba(15, 27, 51, 0.90) 0%, rgba(29, 53, 97, 0.78) 54%, rgba(15, 27, 51, 0.92) 100%),
    url('images/ebook-cover-art.jpg') center/cover no-repeat;
  overflow: hidden;
}
.gate-hero::after {
  content: ""; position: absolute; inset: 12px;
  border: 1px solid rgba(232, 213, 167, 0.35); border-radius: 18px; pointer-events: none;
}
.gate-hero-content { position: relative; z-index: 2; }
.gate-badge {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 6px 13px; border-radius: 999px;
  background: rgba(255, 253, 247, 0.13); border: 1px solid rgba(232, 213, 167, 0.45);
  color: #F6E6BC; font-size: 0.75rem; font-weight: 700;
  letter-spacing: 0.05em; text-transform: uppercase; margin-bottom: 18px;
}
.gate-book-row { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; }
.book-mockup {
  width: 112px; min-width: 112px; height: 156px;
  border-radius: 4px 12px 12px 4px;
  background:
    linear-gradient(155deg, rgba(15, 27, 51, 0.74) 0%, rgba(46, 77, 133, 0.50) 54%, rgba(15, 27, 51, 0.90) 100%),
    url('images/ebook-cover-art.jpg') center/cover no-repeat;
  border: 1px solid rgba(246, 230, 188, 0.68);
  box-shadow: -6px 12px 24px rgba(0, 0, 0, 0.42), inset 7px 0 12px rgba(255, 255, 255, 0.22);
  padding: 12px 10px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; transform: perspective(600px) rotateY(-8deg); transition: transform 0.35s ease;
}
.book-mockup:hover { transform: perspective(600px) rotateY(-2deg) translateY(-3px); }
.book-mockup::before { content: ""; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.25); }
.book-kicker { font-size: 0.52rem; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: #F6E6BC; }
.book-title-mini { font-family: var(--font-serif); font-size: 0.78rem; line-height: 1.26; font-weight: 700; color: #FFFFFF; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5); }
.book-author-mini { font-size: 0.5rem; letter-spacing: 0.06em; text-transform: uppercase; color: #DBEAFE; border-top: 1px solid rgba(232, 213, 167, 0.4); padding-top: 5px; }

.gate-hero h1 { font-family: var(--font-serif); font-size: 1.56rem; line-height: 1.28; margin: 0 0 8px; color: #FFFFFF; }
.gate-sub { margin: 0; font-size: 0.92rem; line-height: 1.58; color: #E2E8F0; }
.gate-highlights { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.gate-highlights li {
  display: flex; align-items: flex-start; gap: 10px; font-size: 0.89rem; line-height: 1.5;
  color: #F1F5F9; background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(232, 213, 167, 0.22); padding: 10px 12px; border-radius: 12px;
}
.gate-highlights .check-dot {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(232, 213, 167, 0.22); color: #F6E6BC;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; margin-top: 2px;
}
.gate-author-bar { margin-top: 18px; padding-top: 14px; border-top: 1px solid rgba(232, 213, 167, 0.25); font-size: 0.82rem; color: #CBD5E1; }
.gate-author-bar strong { color: #F6E6BC; }

.gate-form-panel { padding: 28px 22px 30px; background: #FFFFFF; }
.gate-form-panel h2 { font-family: var(--font-serif); margin: 0 0 6px; font-size: 1.35rem; color: var(--indigo-deep); }
.gate-form-desc { margin: 0 0 18px; font-size: 0.88rem; color: var(--text-muted); }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.86rem; font-weight: 700; color: var(--text-heading); margin-bottom: 6px; }
.req-star { color: #DC2626; }
.form-input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 11px;
  border: 1.5px solid #D3DCEB; background: #FCFDFE; font-family: inherit;
  font-size: 0.94rem; color: var(--text-heading); transition: border-color 0.18s, box-shadow 0.18s;
}
.form-input:focus { outline: none; border-color: var(--indigo-main); box-shadow: 0 0 0 3px rgba(29, 53, 97, 0.12); background: var(--surface); }
.form-error { background: var(--danger-bg); border: 1px solid var(--danger-border); color: var(--danger-text); border-radius: 10px; padding: 10px 12px; font-size: 0.86rem; font-weight: 600; margin-bottom: 12px; }
.btn-primary {
  width: 100%; min-height: 52px; border: none; border-radius: 13px;
  background: linear-gradient(135deg, #0F1B33 0%, #1D3561 55%, #2E4D85 100%);
  color: #FFFFFF; font-family: inherit; font-size: 0.96rem; font-weight: 700;
  cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 10px 24px rgba(15, 27, 51, 0.28); transition: transform 0.16s ease;
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-primary:disabled { opacity: 0.72; cursor: wait; }
.form-privacy { margin: 12px 0 0; font-size: 0.8rem; color: var(--text-muted); text-align: center; line-height: 1.5; }

.gate-proof { margin-top: 22px; background: var(--surface); border: 1px solid var(--indigo-border); border-radius: 20px; padding: 20px 18px; box-shadow: var(--shadow-card); }
.gate-proof-head { text-align: center; margin-bottom: 14px; }
.gate-proof-head span { font-size: 0.76rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--indigo-main); }
.gate-proof-head h3 { font-family: var(--font-serif); margin: 4px 0 0; font-size: 1.12rem; color: var(--indigo-deep); }
.proof-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.proof-card { background: var(--gold-bg); border: 1px solid #EFE4C8; border-radius: 14px; padding: 14px 15px; }
.proof-stars { color: #D97706; font-size: 0.82rem; letter-spacing: 1px; margin-bottom: 6px; }
.proof-quote { margin: 0 0 8px; font-size: 0.88rem; line-height: 1.55; color: var(--text-heading); font-style: italic; }
.proof-who { font-size: 0.78rem; font-weight: 700; color: var(--indigo-main); }
.proof-disclaimer { margin: 12px 0 0; font-size: 0.78rem; color: var(--text-muted); text-align: center; }

/* ================= TOPBAR & DRAWER ================= */
.reader-topbar { position: sticky; top: 0; z-index: 60; background: rgba(250, 248, 243, 0.94); backdrop-filter: blur(12px); border-bottom: 1px solid var(--indigo-border); }
.progress-track { height: 3.5px; background: var(--indigo-soft); width: 100%; }
.progress-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--indigo-main), var(--gold-main)); transition: width 0.12s linear; }
.topbar-inner { max-width: 1120px; margin: 0 auto; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.topbar-left { display: flex; align-items: center; gap: 7px; min-width: 0; }
.btn-menu-icon {
  display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 10px;
  border-radius: 10px; border: 1px solid var(--indigo-border); background: var(--surface);
  color: var(--indigo-deep); font-family: inherit; font-size: 0.8rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.topbar-brand { font-family: var(--font-serif); font-weight: 700; font-size: 0.92rem; color: var(--indigo-deep); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-controls { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

.btn-night-top, .btn-music-top {
  display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 9px;
  border-radius: 9px; border: 1px solid var(--indigo-border); background: var(--indigo-soft);
  color: var(--indigo-deep); font-family: inherit; font-size: 0.76rem; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.btn-night-top.is-active, .btn-music-top.is-playing, .btn-music-welcome.is-playing {
  background: linear-gradient(135deg, #0F1B33 0%, #2E4D85 100%);
  color: #F6E6BC; border-color: rgba(232, 213, 167, 0.5);
}
.music-bars { display: none; align-items: flex-end; gap: 2px; height: 13px; }
.btn-music-top.is-playing .music-ico { display: none; }
.btn-music-top.is-playing .music-bars { display: inline-flex; }
.music-bars span { width: 2.5px; background: #F6E6BC; border-radius: 2px; animation: musicBarBounce 0.9s ease-in-out infinite; }
.music-bars span:nth-child(1) { height: 6px; }
.music-bars span:nth-child(2) { height: 12px; animation-delay: 0.2s; }
.music-bars span:nth-child(3) { height: 8px; animation-delay: 0.4s; }
@keyframes musicBarBounce { 0%, 100% { transform: scaleY(0.45); } 50% { transform: scaleY(1); } }

.font-controls-wrap { display: inline-flex; align-items: center; gap: 4px; }
.font-controls { display: inline-flex; background: var(--surface-soft); border-radius: 9px; padding: 2px; border: 1px solid var(--indigo-border); }
.font-btn { border: none; background: transparent; color: var(--indigo-deep); font-weight: 700; font-family: inherit; height: 30px; min-width: 28px; padding: 0 6px; border-radius: 7px; cursor: pointer; font-size: 0.76rem; }
.font-btn.active { background: #FFFFFF; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); }
.btn-download-top {
  display: inline-flex; align-items: center; gap: 4px; height: 36px;
  background: var(--indigo-deep); color: #FFFFFF; text-decoration: none;
  font-weight: 700; font-size: 0.78rem; padding: 0 10px; border-radius: 9px; white-space: nowrap;
}
@media (max-width: 580px) {
  .btn-music-top .music-label, .btn-night-top .night-label, .topbar-brand { display: none; }
}

.drawer-backdrop { position: fixed; inset: 0; background: rgba(11, 18, 34, 0.5); z-index: 90; backdrop-filter: blur(2px); }
.toc-drawer {
  position: fixed; top: 0; left: 0; bottom: 0; width: min(320px, 86vw);
  background: var(--surface); z-index: 100; box-shadow: 8px 0 32px rgba(0, 0, 0, 0.24);
  display: flex; flex-direction: column; padding: 18px 16px 24px; overflow-y: auto;
}
.drawer-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--indigo-border); }
.drawer-header h3 { font-family: var(--font-serif); margin: 0; font-size: 1.05rem; color: var(--indigo-deep); }
.btn-close-drawer { width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--indigo-border); background: var(--surface-soft); color: var(--text-heading); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.drawer-links { display: grid; gap: 5px; }
.drawer-links a { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border-radius: 10px; text-decoration: none; color: var(--text-main); font-size: 0.88rem; font-weight: 500; }
.drawer-links a:hover, .drawer-links a.active { background: var(--indigo-soft); color: var(--indigo-main); font-weight: 700; }
body.night-mode .drawer-links a:hover, body.night-mode .drawer-links a.active { color: #F5E6C4; }
.drawer-num { width: 24px; height: 24px; border-radius: 7px; background: var(--surface-soft); color: var(--indigo-main); font-size: 0.72rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.drawer-links a.active .drawer-num { background: var(--indigo-main); color: #FFFFFF; }

/* ================= WORKSPACE & COVER ================= */
.reader-workspace { max-width: 1120px; margin: 0 auto; padding: 18px 14px 72px; display: grid; grid-template-columns: 1fr; gap: 28px; align-items: start; }
.desktop-sidebar { display: none; }
.reader-container { max-width: 800px; margin: 0 auto; width: 100%; }

.welcome-banner {
  background: var(--surface); border: 1px solid var(--indigo-border); border-left: 4px solid var(--indigo-main);
  border-radius: var(--radius-lg); padding: 16px 18px; margin-bottom: 20px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: var(--shadow-card);
}
.welcome-banner p { margin: 0; font-size: 0.91rem; color: var(--text-heading); }
.welcome-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-pdf-large { display: inline-flex; align-items: center; gap: 7px; background: var(--indigo-deep); color: #FFFFFF; text-decoration: none; font-weight: 700; font-size: 0.86rem; padding: 9px 14px; border-radius: 10px; }
.btn-toc-inline { display: inline-flex; align-items: center; gap: 7px; background: var(--indigo-soft); color: var(--indigo-deep); border: 1px solid var(--indigo-border); font-family: inherit; font-weight: 700; font-size: 0.86rem; padding: 9px 13px; border-radius: 10px; cursor: pointer; }
.btn-emergency-jump { display: inline-flex; align-items: center; gap: 6px; background: #991B1B; color: #FFFFFF; text-decoration: none; font-weight: 700; font-size: 0.86rem; padding: 9px 14px; border-radius: 10px; box-shadow: 0 4px 12px rgba(153, 27, 27, 0.25); }
.btn-share-gift { display: inline-flex; align-items: center; gap: 7px; background: var(--gold-bg); color: #8A5D12; border: 1px solid var(--gold-light); font-family: inherit; font-weight: 700; font-size: 0.86rem; padding: 9px 13px; border-radius: 10px; cursor: pointer; }

.ebook-cover {
  background:
    linear-gradient(148deg, rgba(15, 27, 51, 0.90) 0%, rgba(29, 53, 97, 0.78) 54%, rgba(15, 27, 51, 0.94) 100%),
    url('images/ebook-cover-art.jpg') center/cover no-repeat;
  color: #FFFFFF; border-radius: 26px; padding: 34px 22px; margin-bottom: 24px;
  box-shadow: var(--shadow-elevated); position: relative; overflow: hidden;
  border: 1px solid rgba(232, 213, 167, 0.45);
}
.ebook-cover::after { content: ""; position: absolute; inset: 11px; border: 1px solid rgba(232, 213, 167, 0.3); border-radius: 18px; pointer-events: none; }
.ebook-cover-inner { position: relative; z-index: 2; }
.cover-hero-grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: center; margin-bottom: 20px; }
.cover-book-stage { display: flex; justify-content: center; perspective: 900px; }
.cover-book-3d {
  width: 156px; height: 216px; border-radius: 5px 14px 14px 5px;
  background:
    linear-gradient(155deg, rgba(15, 27, 51, 0.72) 0%, rgba(46, 77, 133, 0.48) 52%, rgba(15, 27, 51, 0.90) 100%),
    url('images/ebook-cover-art.jpg') center/cover no-repeat;
  border: 1.5px solid rgba(246, 230, 188, 0.75);
  box-shadow: -10px 18px 34px rgba(0, 0, 0, 0.46), inset 9px 0 14px rgba(255, 255, 255, 0.22), 0 0 28px rgba(232, 213, 167, 0.2);
  padding: 15px 13px; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; animation: bookFloat 5.5s ease-in-out infinite;
}
.cover-book-3d::before { content: ""; position: absolute; left: 8px; top: 0; bottom: 0; width: 2px; background: rgba(255, 255, 255, 0.26); }
@keyframes bookFloat { 0%, 100% { transform: rotateY(-12deg) translateY(0px); } 50% { transform: rotateY(-8deg) translateY(-6px); } }
.cover-kicker { display: inline-flex; font-size: 0.75rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: #F6E6BC; margin-bottom: 8px; }
.ebook-cover h1 { font-family: var(--font-serif); margin: 0 0 8px; font-size: 1.68rem; line-height: 1.26; }
.ebook-cover .cover-sub { margin: 0; font-size: 0.96rem; color: #DBEAFE; line-height: 1.58; }
.cover-stats-strip { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 18px; }
.cover-stat-pill { background: rgba(255, 255, 255, 0.09); border: 1px solid rgba(232, 213, 167, 0.32); border-radius: 12px; padding: 9px 10px; text-align: center; backdrop-filter: blur(6px); }
.cover-stat-pill strong { display: block; font-family: var(--font-serif); font-size: 1.02rem; color: #F6E6BC; }
.cover-stat-pill span { font-size: 0.73rem; color: #E2E8F0; }
.cover-for-box { background: rgba(255, 255, 255, 0.09); border: 1px solid rgba(232, 213, 167, 0.28); border-radius: 14px; padding: 15px 17px; margin-bottom: 16px; }
.cover-for-box p { margin: 0 0 8px; font-weight: 700; font-size: 0.9rem; color: #F6E6BC; }
.cover-for-box ul { margin: 0; padding-left: 20px; font-size: 0.89rem; line-height: 1.6; color: #F8FAFC; }
.cover-for-box li { margin-bottom: 4px; }
.cover-author { margin: 0; font-size: 0.85rem; color: #CBD5E1; padding-top: 13px; border-top: 1px solid rgba(232, 213, 167, 0.24); }

/* ================= SECTIONS & PREFACE ================= */
.section-card { background: var(--surface); border: 1px solid var(--indigo-border); border-radius: var(--radius-xl); padding: 26px 20px; margin-bottom: 22px; box-shadow: var(--shadow-card); }
.preface-card {
  background: linear-gradient(180deg, #FFFDF7 0%, #FAF5E8 100%);
  border: 1.5px solid var(--gold-light); border-radius: var(--radius-xl);
  padding: 28px 22px; margin-bottom: 24px; box-shadow: 0 12px 32px rgba(185, 137, 44, 0.1);
}
.preface-seal { display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px; border-radius: 999px; background: var(--indigo-deep); color: #F6E6BC; font-size: 0.73rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; margin-bottom: 12px; }
.preface-card h2 { font-family: var(--font-serif); margin: 0 0 14px; font-size: 1.38rem; color: var(--indigo-deep); }
.preface-pledges { display: grid; gap: 11px; margin: 15px 0 0; }
.pledge-item { display: flex; gap: 12px; align-items: flex-start; background: #FFFFFF; border: 1px solid #EFE4C8; border-radius: 14px; padding: 13px 15px; font-size: 0.92rem; }
.pledge-num { width: 28px; height: 28px; border-radius: 50%; background: var(--indigo-soft); color: var(--indigo-main); font-weight: 800; font-size: 0.84rem; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

.chapter-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; padding-bottom: 14px; border-bottom: 1px solid #E8EDF7; }
.chapter-meta { font-size: 0.74rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.07em; color: var(--indigo-main); margin-bottom: 4px; }
body.night-mode .chapter-meta { color: #93C5FD; }
.section-card h2 { font-family: var(--font-serif); margin: 0; font-size: 1.36rem; line-height: 1.32; color: var(--indigo-deep); }
.section-card h3 { font-family: var(--font-serif); color: var(--indigo-deep); font-size: 1.1rem; margin: 20px 0 10px; }
.chapter-num { font-family: var(--font-serif); font-size: 2rem; font-weight: 700; line-height: 1; color: var(--gold-light); flex-shrink: 0; }

.pull-quote {
  font-family: var(--font-serif); font-style: italic; font-size: 1rem; line-height: 1.66;
  color: var(--text-heading); background: var(--gold-bg); border-left: 4px solid var(--gold-main);
  padding: 15px 18px; border-radius: 0 14px 14px 0; margin: 14px 0 18px;
}

.dual-grid { display: grid; grid-template-columns: 1fr; gap: 14px; margin: 16px 0; }
.dual-card { border-radius: 16px; padding: 17px; border: 1px solid var(--indigo-border); background: #F7F9FE; }
.dual-card.eastern { background: var(--gold-bg); border-color: var(--gold-light); }
.dual-pill { display: inline-block; font-size: 0.71rem; font-weight: 800; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--indigo-main); color: #FFFFFF; margin-bottom: 8px; }
.dual-card.eastern .dual-pill { background: var(--gold-main); }
.dual-card h3 { margin: 0 0 8px !important; font-size: 1.03rem; }

.figure-box { position: relative; margin: 18px 0; border-radius: 18px; overflow: hidden; border: 1px solid var(--indigo-border); background: var(--surface); box-shadow: var(--shadow-card); }
.figure-box.zoomable { cursor: zoom-in; }
.figure-box img { width: 100%; display: block; }
.zoom-hint { position: absolute; top: 10px; right: 10px; background: rgba(15, 27, 51, 0.82); color: #FFFFFF; font-size: 0.72rem; font-weight: 700; padding: 5px 10px; border-radius: 999px; display: inline-flex; align-items: center; gap: 4px; }
.figure-caption { padding: 11px 14px; font-size: 0.83rem; color: var(--text-muted); background: #F9FAFD; border-top: 1px solid #EAEFF8; }

/* Survey & Checkboxes */
.survey-box { background: var(--surface-soft); border: 1px solid var(--indigo-border); border-radius: 16px; padding: 18px; }
.radio-group { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 6px; }
.radio-pill { display: inline-flex; align-items: center; gap: 7px; padding: 9px 13px; border-radius: 10px; background: #FFFFFF; border: 1.5px solid var(--indigo-border); font-size: 0.88rem; font-weight: 600; cursor: pointer; }
.radio-pill input { accent-color: var(--indigo-main); width: 17px; height: 17px; }

.quiz-group { border: 1px solid var(--indigo-border); border-radius: 16px; padding: 15px; margin-bottom: 13px; background: var(--surface-soft); }
.quiz-group-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.quiz-group-header h3 { margin: 0 !important; font-size: 0.98rem; }
.score-badge { background: var(--indigo-soft); color: var(--indigo-main); font-size: 0.77rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
body.night-mode .score-badge { color: #F5E6C4; }

.check-item { display: flex; align-items: flex-start; gap: 11px; padding: 11px 12px; margin-bottom: 8px; border-radius: 12px; border: 1.5px solid var(--indigo-border); background: #FFFFFF; cursor: pointer; font-size: 0.91rem; transition: all 0.16s ease; }
.check-item:last-child { margin-bottom: 0; }
.check-item.checked { background: var(--indigo-soft); border-color: var(--indigo-main); }
.check-item input[type="checkbox"] { width: 20px; height: 20px; flex-shrink: 0; accent-color: var(--indigo-main); margin-top: 2px; }

.quiz-result-box { background: linear-gradient(135deg, #0F1B33 0%, #1D3561 100%); color: #FFFFFF; border-radius: 18px; padding: 19px; margin-top: 14px; }
.quiz-result-box h3 { color: #F6E6BC !important; margin: 0 0 8px !important; font-size: 1.06rem; }
.quiz-result-box p, .quiz-result-box li { color: #E2E8F0; font-size: 0.92rem; }
.quiz-result-box a { color: #F6E6BC; font-weight: 700; }

/* ================= TOOL #1: 60S CARDIAC VS REFLUX TRIAGE ================= */
.triage-box { border: 1.5px solid var(--indigo-border); border-radius: 18px; padding: 18px; background: var(--surface-soft); margin: 18px 0; }
.triage-result { margin-top: 14px; border-radius: 14px; padding: 15px 16px; font-size: 0.92rem; }
.triage-result.safe { background: var(--safe-bg); border: 1.5px solid var(--safe-border); color: var(--safe-text); }
.triage-result.danger { background: var(--danger-bg); border: 1.5px solid var(--danger-border); color: var(--danger-text); }

/* ================= TOOL #3: ACUPRESSURE 60S TIMER + 4-7-8 BREATHING ORB ================= */
.acu-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 12px 0; }
.acu-tab {
  min-height: 48px; padding: 8px 10px; border-radius: 12px;
  border: 1.5px solid var(--indigo-border); background: #FFFFFF; color: var(--indigo-deep);
  font-family: inherit; font-size: 0.84rem; font-weight: 700; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-align: center;
}
.acu-tab span.acu-sub { font-size: 0.69rem; font-weight: 600; color: var(--text-muted); }
.acu-tab.active { background: linear-gradient(135deg, #0F1B33, #2E4D85); color: #FFFFFF; border-color: transparent; box-shadow: 0 6px 16px rgba(15, 27, 51, 0.25); }
.acu-tab.active span.acu-sub { color: #F6E6BC; }

.acu-panel { border: 1.5px solid var(--indigo-border); border-radius: 18px; padding: 18px; background: var(--surface-soft); }
.acu-timer-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px;
  background: linear-gradient(135deg, #0F1B33 0%, #1D3561 100%);
  color: #FFFFFF; border-radius: 14px; padding: 14px 16px; margin-top: 14px;
}
.acu-timer-readout { font-family: var(--font-serif); font-size: 1.45rem; font-weight: 700; color: #F6E6BC; }
.btn-timer {
  padding: 9px 16px; border-radius: 10px; border: 1px solid rgba(246, 230, 188, 0.5);
  background: rgba(255, 255, 255, 0.14); color: #FFFFFF;
  font-family: inherit; font-size: 0.86rem; font-weight: 700; cursor: pointer;
}
.btn-timer:hover { background: rgba(255, 255, 255, 0.24); }

/* 4-7-8 Breathing Orb */
.breathe-widget {
  background: linear-gradient(145deg, #0F1B33 0%, #1D3561 60%, #2B4570 100%);
  color: #FFFFFF; border-radius: 20px; padding: 24px 18px; text-align: center; margin: 18px 0 0;
  border: 1px solid rgba(232, 213, 167, 0.35);
}
.breathe-widget h4 { font-family: var(--font-serif); margin: 0 0 6px; font-size: 1.15rem; color: #F6E6BC; }
.breathe-sub { margin: 0 0 18px; font-size: 0.88rem; color: #CBD5E1; }
.breathe-stage { display: flex; justify-content: center; align-items: center; height: 170px; }
.breathe-orb {
  width: 112px; height: 112px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #F6E6BC 0%, #C99A3B 45%, #2E4D85 100%);
  box-shadow: 0 0 32px rgba(246, 230, 188, 0.35);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  transition: transform 4s ease-in-out, box-shadow 1s ease;
}
.breathe-orb.inhale { transform: scale(1.42); transition-duration: 4s; box-shadow: 0 0 48px rgba(246, 230, 188, 0.6); }
.breathe-orb.hold { transform: scale(1.42); transition-duration: 0.4s; box-shadow: 0 0 54px rgba(147, 197, 253, 0.55); }
.breathe-orb.exhale { transform: scale(0.95); transition-duration: 8s; box-shadow: 0 0 24px rgba(246, 230, 188, 0.25); }
.breathe-phase { font-size: 0.78rem; font-weight: 800; color: #0F1B33; text-transform: uppercase; }
.breathe-count { font-family: var(--font-serif); font-size: 1.45rem; font-weight: 700; color: #0F1B33; line-height: 1.1; }
.breathe-cycle { font-size: 0.85rem; color: #E2E8F0; margin: 10px 0 14px; font-weight: 600; }
.btn-breathe {
  display: inline-flex; align-items: center; gap: 8px; padding: 11px 22px;
  border-radius: 999px; border: none; background: #F6E6BC; color: #0F1B33;
  font-family: inherit; font-size: 0.92rem; font-weight: 800; cursor: pointer;
}

/* ================= TOOL #4: 2AM EMERGENCY PROTOCOL ================= */
.emergency-card {
  border: 2px solid #DC2626;
  background: linear-gradient(180deg, var(--danger-bg) 0%, var(--surface) 45%);
}
.emergency-steps { display: grid; gap: 11px; margin: 16px 0; }
.emergency-step {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--indigo-border);
  border-radius: 14px; padding: 14px 15px; font-size: 0.92rem;
}
.em-num {
  width: 30px; height: 30px; border-radius: 9px;
  background: #991B1B; color: #FFFFFF; font-weight: 800; font-size: 0.85rem;
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* ================= TOOL #5: 7-NIGHT SLEEP TRACKER & SCORECARD ================= */
.score-grid { display: grid; gap: 10px; margin: 12px 0 16px; }
.score-row {
  display: flex; flex-direction: column; gap: 10px;
  background: #FFFFFF; border: 1px solid var(--indigo-border);
  border-radius: 14px; padding: 13px 15px;
}
.score-pair { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.stepper-box { display: inline-flex; align-items: center; gap: 6px; font-size: 0.84rem; font-weight: 700; }
.step-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--indigo-border);
  background: var(--indigo-soft); color: var(--indigo-deep); font-weight: 800; font-size: 1rem; cursor: pointer;
}
.tracker-score {
  width: 46px; height: 34px; text-align: center; border-radius: 8px;
  border: 1.5px solid var(--indigo-border); font-family: inherit; font-weight: 800; font-size: 0.92rem;
  background: var(--surface); color: var(--text-heading);
}
.day-check {
  display: flex; align-items: flex-start; gap: 12px; padding: 13px 14px; margin-bottom: 9px;
  border: 1.5px solid var(--indigo-border); border-radius: 13px; background: #FFFFFF; cursor: pointer; font-size: 0.91rem;
}
.day-check.checked { background: var(--safe-bg); border-color: #10B981; }
.day-check input { width: 22px; height: 22px; flex-shrink: 0; accent-color: #10B981; margin-top: 2px; }

.scorecard-box {
  background: linear-gradient(135deg, #0F1B33 0%, #1D3561 100%);
  color: #FFFFFF; border-radius: 18px; padding: 20px; margin-top: 16px;
}
.scorecard-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 12px; }
.sc-metric { background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(232, 213, 167, 0.3); border-radius: 12px; padding: 10px; text-align: center; }
.sc-metric strong { display: block; font-family: var(--font-serif); font-size: 1.15rem; color: #F6E6BC; }
.sc-metric span { font-size: 0.74rem; color: #CBD5E1; }

/* ================= CTA, FEEDBACK GALLERY, FOOTER, LIGHTBOX ================= */
.cta-step { border: 1px solid var(--indigo-border); border-radius: 18px; padding: 20px 18px; margin-bottom: 16px; background: #FFFFFF; }
.cta-step h3 { margin: 0 0 8px !important; }
.btn-zalo-group, .btn-zalo-personal, .btn-zalo-coach {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 50px; color: #FFFFFF !important; text-decoration: none;
  font-weight: 700; font-size: 0.93rem; padding: 12px 18px; border-radius: 12px; text-align: center; margin-top: 8px;
}
.btn-zalo-group { background: #146C43; }
.btn-zalo-personal { background: var(--zalo-blue); }
.btn-zalo-coach { background: var(--indigo-deep); }
.msg-preview { background: var(--surface-soft); border: 1px dashed var(--indigo-main); border-radius: 12px; padding: 12px 14px; font-size: 0.88rem; margin: 10px 0; line-height: 1.6; white-space: pre-line; }
.btn-copy-msg { display: inline-flex; align-items: center; justify-content: center; gap: 8px; width: 100%; min-height: 46px; background: var(--indigo-soft); color: var(--indigo-deep); border: 1.5px solid var(--indigo-border); font-family: inherit; font-weight: 700; font-size: 0.91rem; padding: 10px 16px; border-radius: 12px; cursor: pointer; }

.filter-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 16px; }
.filter-tab { min-height: 38px; padding: 6px 13px; border-radius: 999px; border: 1.5px solid var(--indigo-border); background: #FFFFFF; color: var(--text-main); font-family: inherit; font-size: 0.83rem; font-weight: 700; cursor: pointer; }
.filter-tab.active { background: var(--indigo-deep); border-color: var(--indigo-deep); color: #F6E6BC; }

.feedback-gallery { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; align-items: start; }
.fb-card { margin: 0; background: #FFFFFF; border: 1px solid var(--indigo-border); border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-card); display: flex; flex-direction: column; }
.fb-card.fb-wide { grid-column: 1 / -1; }
.fb-card img { width: 100%; height: auto; display: block; }
.fb-card .figure-caption { font-weight: 600; font-size: 0.8rem; line-height: 1.45; padding: 9px 10px; color: var(--text-heading); }
.fb-card .fb-tag { display: inline-block; font-size: 0.69rem; font-weight: 700; color: var(--indigo-main); background: var(--indigo-soft); padding: 2px 8px; border-radius: 999px; margin-bottom: 4px; }
body.night-mode .fb-card .fb-tag { color: #F5E6C4; }

.footer-sign { text-align: center; padding: 26px 16px 10px; color: var(--text-muted); font-size: 0.9rem; }
.footer-name { font-family: var(--font-serif); color: var(--indigo-deep); font-size: 1.08rem; font-weight: 700; margin: 8px 0 14px; }
.social-pills { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.social-pill { display: inline-flex; align-items: center; gap: 6px; padding: 8px 13px; border-radius: 999px; background: #FFFFFF; border: 1px solid var(--indigo-border); color: var(--indigo-deep); text-decoration: none; font-size: 0.84rem; font-weight: 600; }
.music-credit { margin: 14px 0 0; font-size: 0.74rem; opacity: 0.78; }

.lightbox-modal { position: fixed; inset: 0; z-index: 200; background: rgba(7, 13, 26, 0.94); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 20px; backdrop-filter: blur(6px); }
.lightbox-close { position: absolute; top: 16px; right: 16px; width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.25); background: rgba(255, 255, 255, 0.12); color: #FFFFFF; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; }
.lightbox-img { max-width: 94vw; max-height: 80vh; border-radius: 12px; object-fit: contain; }
.lightbox-cap { color: #E2E8F0; font-size: 0.88rem; margin-top: 12px; text-align: center; max-width: 680px; }

.toast-pill { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px); background: var(--indigo-deep); color: #F6E6BC; border: 1px solid rgba(232, 213, 167, 0.4); padding: 11px 18px; border-radius: 999px; font-size: 0.86rem; font-weight: 600; box-shadow: 0 12px 30px rgba(0, 0, 0, 0.32); opacity: 0; pointer-events: none; transition: all 0.25s ease; z-index: 210; max-width: 92vw; text-align: center; }
.toast-pill.show { opacity: 1; transform: translateX(-50%) translateY(0); }

.back-to-top { position: fixed; right: 18px; bottom: 20px; width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--indigo-border); background: rgba(255, 255, 255, 0.95); color: var(--indigo-deep); box-shadow: 0 6px 20px rgba(15, 27, 51, 0.16); display: inline-flex; align-items: center; justify-content: center; cursor: pointer; z-index: 55; }

/* ================= DESKTOP RESPONSIVE ================= */
@media (min-width: 768px) {
  :root { --font-size-base: 18px; }
  .gate-wrapper { padding: 36px 24px 56px; }
  .gate-card { grid-template-columns: 1.15fr 0.95fr; }
  .gate-hero { padding: 40px 34px; display: flex; flex-direction: column; justify-content: center; }
  .gate-hero h1 { font-size: 1.9rem; }
  .gate-form-panel { padding: 40px 32px; display: flex; flex-direction: column; justify-content: center; }
  .book-mockup { width: 126px; min-width: 126px; height: 174px; }
  .proof-grid { grid-template-columns: repeat(3, 1fr); }
  .dual-grid { grid-template-columns: 1fr 1fr; }
  .cover-hero-grid { grid-template-columns: 168px 1fr; gap: 26px; }
  .cover-stats-strip { grid-template-columns: repeat(4, 1fr); }
  .score-row { flex-direction: row; align-items: center; justify-content: space-between; }
  .section-card, .preface-card { padding: 32px 34px; }
  .ebook-cover { padding: 40px 38px; }
  .ebook-cover h1 { font-size: 2.08rem; }
  .welcome-banner { flex-direction: row; align-items: center; justify-content: space-between; }
  .feedback-gallery { grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .btn-zalo-group, .btn-zalo-personal, .btn-zalo-coach, .btn-copy-msg { width: auto; padding-left: 24px; padding-right: 24px; }
}

@media (min-width: 1080px) {
  .reader-workspace { grid-template-columns: 270px minmax(0, 790px); justify-content: center; padding: 28px 24px 88px; }
  .desktop-sidebar { display: block; position: sticky; top: 76px; background: var(--surface); border: 1px solid var(--indigo-border); border-radius: 20px; padding: 16px; box-shadow: var(--shadow-card); max-height: calc(100vh - 96px); overflow-y: auto; }
  .ring-card { display: flex; align-items: center; gap: 12px; padding: 14px; border-radius: 15px; background: linear-gradient(135deg, #0F1B33 0%, #1D3561 70%, #2E4D85 100%); color: #FFFFFF; margin-bottom: 14px; }
  .ring-wrap { position: relative; width: 52px; height: 52px; flex-shrink: 0; }
  .ring-wrap svg { transform: rotate(-90deg); }
  .ring-pct { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 0.74rem; font-weight: 800; color: #FFFFFF; }
  .ring-info { font-size: 0.78rem; line-height: 1.4; }
  .ring-info strong { display: block; font-size: 0.86rem; color: #F6E6BC; }
  .sidebar-nav-title { font-size: 0.72rem; font-weight: 800; text-transform: uppercase; letter-spacing: 0.08em; color: var(--text-muted); margin: 4px 0 8px 6px; }
  .sidebar-pdf-btn { margin-top: 14px; width: 100%; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 11px 14px; border-radius: 11px; background: var(--gold-bg); border: 1.5px solid var(--gold-light); color: var(--indigo-deep); font-weight: 700; font-size: 0.84rem; text-decoration: none; }
}

/* ================= PRINT STYLES (PDF — ALWAYS CLEAN LIGHT THEME) ================= */
@media print {
  body, body.night-mode { background: #FFFFFF !important; color: #1E293B !important; font-size: 10.5pt; line-height: 1.55; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .reader-topbar, .welcome-banner, .drawer-backdrop, .toc-drawer, .desktop-sidebar, .back-to-top,
  .filter-tabs, .acu-tabs, .acu-timer-bar, .breathe-widget, .zoom-hint, .lightbox-modal,
  .toast-pill, .step-btn, .btn-copy-msg, .btn-share-gift, .scorecard-box, #gate-view { display: none !important; }
  .print-only { display: block !important; }
  #reader-view { display: block !important; }
  .reader-workspace { display: block !important; padding: 0 !important; }
  .reader-container { max-width: 100%; padding: 0; }
  .section-card, .preface-card, .figure-box, .cta-step, .emergency-step { box-shadow: none; break-inside: avoid-page; }
  .feedback-gallery { grid-template-columns: repeat(3, 1fr) !important; gap: 10px !important; }
  .fb-card.hidden { display: flex !important; }
  .fb-card img { max-height: 220px; object-fit: contain; }
  .fb-card.fb-wide img { max-height: 290px; }
  .fb-card .figure-caption { font-size: 8.5pt; padding: 6px 8px; }
}
