:root{
  --bg:#f6f7fb;
  --text:#111827;
  --muted:#6b7280;
  --radius:14px;

  --orange:#f97316;
  --orangeHover:#ea580c;
  --orangeActive:#c2410c;
  --onOrange:#ffffff;
}

*{ box-sizing:border-box; }

body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

/* ===============================
   FLOATING LEFT NAV
   =============================== */

.nav-float-wrap{
  position: fixed;
  left: 12px;
  top: 0;
  z-index: 120;
  pointer-events: none;
  transform: translateY(calc(50vh - 50%));
}

.nav-rail{
  display:flex;
  align-items:center;
  gap:12px;
  pointer-events:auto;
}

/* ðŸ”¥ Thin + Long Glass Handle */
.nav-handle{
  width: 34px;          /* THIN */
  height: 340px;        /* LONG */

  display:flex;
  align-items:center;
  justify-content:center;

  border-radius: 22px;
  cursor:pointer;
  user-select:none;

  background: rgba(255,255,255,.55);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255,255,255,.65);
  box-shadow: 0 25px 70px rgba(17,24,39,.20);

  transition: box-shadow 220ms ease, transform 120ms ease;
  will-change: transform;
}

.nav-handle:hover{
  box-shadow: 0 30px 85px rgba(17,24,39,.25);
}

/* Vertical LESSON text */
.nav-handle .handle-text{
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 8px;
  color: var(--text);
}

/* Panel (glass) */
.nav-float-panel{
  width: 380px;
  max-height: 75vh;
  overflow:auto;
  padding:14px;

  border-radius: 18px;

  background: rgba(255,255,255,.65);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 30px 80px rgba(17,24,39,.18);

  opacity:0;
  transform: translateX(-16px) scale(.96);
  pointer-events:none;
  visibility:hidden;

  transition:
    transform 280ms cubic-bezier(.2,.9,.2,1),
    opacity 240ms ease,
    visibility 0s linear 280ms;
}

.nav-float-wrap.open .nav-float-panel{
  opacity:1;
  transform: translateX(0) scale(1);
  pointer-events:auto;
  visibility:visible;
  transition:
    transform 280ms cubic-bezier(.2,.9,.2,1),
    opacity 240ms ease,
    visibility 0s;
}

/* ===============================
   PANEL CONTENT
   =============================== */

.nav-title{
  font-weight:900;
  font-size:15px;
  margin-bottom:12px;
}

.search-box{
  display:flex;
  gap:10px;
  margin-bottom:12px;
}

.search-box input{
  flex:1;
  padding:10px 12px;
  border-radius:12px;
  border:1px solid rgba(229,231,235,.9);
  background: rgba(255,255,255,.8);
  outline:none;
}

.search-box button{
  padding:10px 14px;
  border-radius:12px;
  border:none;
  background:#111827;
  color:white;
  font-weight:800;
  cursor:pointer;
}

.tree .para-item{
  border-radius:12px;
  margin-bottom:8px;
  overflow:hidden;
  background: rgba(255,255,255,.75);
  border:1px solid rgba(229,231,235,.85);
}

.tree .para-header{
  width:100%;
  padding:10px 14px;
  display:flex;
  justify-content:space-between;
  font-weight:900;
  cursor:pointer;
  border:none;
  background:transparent;
}

.tree .para-header:hover{
  background: rgba(243,244,246,.6);
}

.tree .para-pages{
  display:none;
  padding:10px;
  border-top:1px solid rgba(229,231,235,.8);
}

.tree .para-item.open .para-pages{
  display:block;
}

.pages{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
}

.page-btn{
  padding:6px 10px;
  font-size:12px;
  border-radius:10px;
  border:1px solid rgba(229,231,235,.9);
  background:white;
  cursor:pointer;
  transition:transform 140ms ease, background 160ms ease;
}

.page-btn:hover{
  transform:translateY(-1px);
}

.page-btn.active{
  background:#111827;
  color:white;
}

/* ===============================
   MAIN LAYOUT
   =============================== */

.main{
  padding:24px;
}

@media (min-width:901px){
  .main{ padding-left:100px; }
}

.topbar{
  display:flex;
  justify-content:center;  /* 🔥 center everything */
  align-items:center;
  padding:20px;
  border-radius:var(--radius);

  background: rgba(255,255,255,.65);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border:1px solid rgba(255,255,255,.6);
  box-shadow: 0 25px 60px rgba(17,24,39,.15);

  margin-bottom:16px;
}


.centered-controls{
  display:flex;
  align-items:center;
  gap:18px;
  justify-content:center;
  flex-wrap:wrap; /* mobile safe */
}



.brand-title{ font-weight:950; font-size:20px; }
.brand-sub{ color:var(--muted); font-size:14px; }

.controls{
  display:flex;
  gap:14px;
  align-items:center;
}

/* ðŸ”¥ Large Orange Buttons */
.nav-btn{
  padding:16px 22px;
  border-radius:16px;
  border:none;
  font-size:16px;
  font-weight:950;
  cursor:pointer;

  background:var(--orange);
  color:var(--onOrange);

  box-shadow:0 18px 40px rgba(249,115,22,.35);
  transition: all 160ms ease;
}

.nav-btn:hover{
  background:var(--orangeHover);
  transform:translateY(-2px);
  box-shadow:0 22px 55px rgba(249,115,22,.45);
}

.nav-btn:active{
  background:var(--orangeActive);
  transform:scale(.97);
}

.nav-btn:disabled{
  opacity:.5;
  cursor:not-allowed;
  box-shadow:none;
}

.pill{
  padding:10px 16px;
  border-radius:999px;
  background:white;
  font-weight:900;
  border:1px solid rgba(229,231,235,.9);
}

/* ===============================
   VIEWER
   =============================== */

.viewer-card{
  border-radius:var(--radius);
  overflow:hidden;

  background: rgba(255,255,255,.7);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border:1px solid rgba(255,255,255,.6);
  box-shadow:0 25px 60px rgba(17,24,39,.12);
}

.viewer{
  padding:20px;
  display:flex;
  justify-content:center;
}

.viewer img{
  width:100%;
  max-width:820px;
  border-radius:12px;
  background:white;
  box-shadow:0 15px 35px rgba(17,24,39,.08);
}

/* ===============================
   MOBILE ADJUSTMENT
   =============================== */

@media (max-width:900px){

  .nav-handle{
    width:30px;     /* thinner mobile */
    height:280px;   /* long but fits phone */
  }

  .nav-handle .handle-text{
    font-size:12px;
    letter-spacing:6px;
  }

  .main{
    padding-left:20px;
  }

  .nav-float-panel{
    position:fixed;
    left:70px;
    width:min(85vw,360px);
  }
}
