/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg:       #04040e;
  --surface:  #09091a;
  --surface2: #0e0e24;
  --border:   rgba(139,92,246,0.15);
  --purple:   #8b5cf6;
  --purple2:  #a78bfa;
  --cyan:     #06b6d4;
  --red:      #f87171;
  --green:    #4ade80;
  --text:     #e8e8f0;
  --dim:      #6b6b8a;
  --radius:   12px;
}

html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }

/* ===== Buttons ===== */
.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--purple); color: #fff;
  border: none; border-radius: 8px;
  padding: 13px 26px; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-primary:hover {
  background: var(--purple2);
  transform: translateY(-1px);
  box-shadow: 0 8px 30px rgba(139,92,246,0.4);
}
.btn-lg { padding: 16px 36px; font-size: 17px; }
.btn-support {
  background: rgba(248,113,113,0.12);
  border: 1px solid rgba(248,113,113,0.25);
  color: var(--red);
  border-radius: 7px; padding: 7px 16px;
  font-size: 13px; font-weight: 600;
  transition: background 0.2s;
}
.btn-support:hover { background: rgba(248,113,113,0.22); }
.btn-support-sm {
  background: rgba(248,113,113,0.1);
  border: 1px solid rgba(248,113,113,0.2);
  color: var(--red);
  border-radius: 6px; padding: 6px 12px;
  font-size: 12px; font-weight: 600; cursor: pointer;
  white-space: nowrap; transition: background 0.2s;
}
.btn-support-sm:hover { background: rgba(248,113,113,0.2); }
.share-btn {
  flex: 1; background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: 7px; padding: 9px 14px;
  font-size: 13px; font-weight: 600; color: var(--text);
  cursor: pointer; transition: border-color 0.2s;
}
.share-btn:hover { border-color: var(--purple); }

/* ===== Nav ===== */
#navbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 200;
  background: rgba(4,4,14,0.9); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.nav-inner {
  max-width: 1100px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; justify-content: space-between;
}
.nav-logo {
  font-family: 'Syne', sans-serif; font-weight: 800; font-size: 18px;
  color: var(--cyan); letter-spacing: -0.3px;
}
.nav-links { display: flex; align-items: center; gap: 28px; font-size: 14px; font-weight: 500; }
.nav-links a:not(.btn-support) { color: var(--dim); transition: color 0.2s; }
.nav-links a:not(.btn-support):hover { color: var(--text); }

/* ===== Sections ===== */
.section-inner { max-width: 1100px; margin: 0 auto; padding: 96px 24px; }
.section-tag {
  display: inline-block; font-size: 11px; font-weight: 600;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--cyan); margin-bottom: 14px;
}
.section-title {
  font-family: 'Syne', sans-serif;
  font-size: clamp(28px, 5vw, 46px);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 14px;
}
.section-sub {
  font-size: 16px; color: var(--dim);
  max-width: 560px; margin-bottom: 52px; line-height: 1.75;
}

/* ===== Hero ===== */
#hero {
  min-height: 100vh; display: flex; align-items: center;
  justify-content: center; position: relative; overflow: hidden;
  padding: 80px 24px 120px;
}
#hero::before {
  content: ''; position: absolute; top: 40%; left: 50%;
  transform: translate(-50%, -50%);
  width: 800px; height: 800px;
  background: radial-gradient(circle, rgba(6,182,212,0.1) 0%, rgba(139,92,246,0.08) 40%, transparent 70%);
  pointer-events: none;
}

/* Stars */
.stars { position: absolute; inset: 0; pointer-events: none; }
.star {
  position: absolute; border-radius: 50%; background: #fff;
  animation: twinkle var(--d,3s) ease-in-out infinite alternate;
  opacity: var(--o,0.4);
}
@keyframes twinkle {
  from { opacity: var(--o,0.4); }
  to   { opacity: calc(var(--o,0.4) * 0.15); }
}

/* Signal rings */
.signal-rings {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.ring {
  position: absolute; border-radius: 50%;
  border: 1px solid;
  transform: translate(-50%, -50%);
  animation: pulse var(--spd,4s) ease-out infinite;
  opacity: 0;
}
.r1 { width:200px;height:200px; border-color:rgba(6,182,212,0.4); --spd:3s; animation-delay:0s; }
.r2 { width:400px;height:400px; border-color:rgba(6,182,212,0.2); --spd:3s; animation-delay:1s; }
.r3 { width:600px;height:600px; border-color:rgba(6,182,212,0.1); --spd:3s; animation-delay:2s; }
@keyframes pulse {
  0%   { opacity:0.8; transform:translate(-50%,-50%) scale(0.3); }
  100% { opacity:0;   transform:translate(-50%,-50%) scale(1); }
}

.hero-inner { text-align:center; position:relative; z-index:1; max-width:700px; }

.live-badge {
  display:inline-flex; align-items:center; gap:8px;
  font-size:12px; font-weight:600; letter-spacing:1.5px; text-transform:uppercase;
  color:var(--cyan); background:rgba(6,182,212,0.08);
  border:1px solid rgba(6,182,212,0.2); border-radius:100px;
  padding:6px 16px; margin-bottom:24px;
}
.live-dot {
  width:7px; height:7px; border-radius:50%;
  background:var(--cyan);
  animation: blink 1.4s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.2} }

.hero-title {
  font-family:'Syne',sans-serif;
  font-size: clamp(56px, 14vw, 110px);
  font-weight:800; line-height:1;
  margin-bottom:20px;
  background: linear-gradient(135deg, #fff 30%, var(--cyan) 70%, var(--purple2) 100%);
  -webkit-background-clip:text; -webkit-text-fill-color:transparent; background-clip:text;
  letter-spacing:-2px;
}
.hero-sub {
  font-size:clamp(14px,2.5vw,17px); color:var(--dim);
  line-height:1.8; margin-bottom:36px;
}

/* ===== Books Grid ===== */
#books { background: var(--surface); }

.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.book-tile {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px 24px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.book-tile::before {
  content:''; position:absolute; inset:0;
  background: linear-gradient(135deg, var(--tile-color, rgba(139,92,246,0.05)) 0%, transparent 60%);
  pointer-events:none;
}
.book-tile:hover {
  border-color: rgba(139,92,246,0.5);
  transform: translateY(-4px);
  box-shadow: 0 16px 48px rgba(0,0,0,0.5);
}
.book-tile.active { border-color: var(--cyan); }

.tile-glyph { font-size:40px; margin-bottom:16px; }
.tile-tag {
  font-size:10px; font-weight:600; letter-spacing:1.5px; text-transform:uppercase;
  color:var(--cyan); margin-bottom:8px;
}
.tile-title {
  font-family:'Syne',sans-serif; font-size:18px; font-weight:700;
  margin-bottom:10px; line-height:1.3;
}
.tile-chapters {
  font-size:12px; color:var(--dim); margin-bottom:20px;
}
.tile-play-btn {
  display:flex; align-items:center; gap:8px;
  background:var(--purple); color:#fff;
  border:none; border-radius:7px;
  padding:9px 18px; font-size:13px; font-weight:600;
  cursor:pointer; width:100%; justify-content:center;
  transition:background 0.2s;
}
.tile-play-btn:hover { background:var(--purple2); }
.tile-play-btn.playing {
  background:var(--cyan);
  color:#000;
}

/* ===== Player Bar ===== */
.player-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 300;
  background: rgba(9,9,26,0.97);
  backdrop-filter: blur(20px);
  border-top: 1px solid rgba(6,182,212,0.3);
  box-shadow: 0 -8px 40px rgba(0,0,0,0.6);
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
}
.player-bar.hidden { transform: translateY(100%); }

.player-inner {
  max-width: 1200px; margin: 0 auto;
  padding: 14px 24px;
  display: grid;
  grid-template-columns: 240px auto 1fr auto;
  align-items: center;
  gap: 20px;
}

.player-book-info { display:flex; align-items:center; gap:14px; min-width:0; }
.player-book-cover {
  width:44px; height:44px; border-radius:7px;
  background:linear-gradient(135deg,var(--surface2),#1a1a40);
  border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:20px; flex-shrink:0;
}
.player-book-title { font-size:13px; font-weight:600; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.player-chapter-title { font-size:11px; color:var(--dim); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }

.player-controls { display:flex; align-items:center; gap:10px; }
.player-btn {
  background:none; border:none; color:var(--dim);
  font-size:18px; cursor:pointer; padding:6px;
  border-radius:6px; transition:color 0.15s, background 0.15s;
}
.player-btn:hover { color:var(--text); background:var(--surface2); }
.player-btn-main {
  width:44px; height:44px; border-radius:50%;
  background:var(--purple); color:#fff; font-size:16px;
  display:flex; align-items:center; justify-content:center;
  transition: background 0.2s, transform 0.1s;
}
.player-btn-main:hover { background:var(--purple2); transform:scale(1.05); }
.player-btn-main.playing { background:var(--cyan); color:#000; }

.player-progress-wrap { min-width:0; }
.player-time-bar {
  display:flex; align-items:center; gap:10px;
  font-size:11px; color:var(--dim); font-variant-numeric:tabular-nums;
}
.progress-track {
  flex:1; height:4px; background:var(--surface2);
  border-radius:2px; position:relative; overflow:hidden;
}
.progress-fill {
  height:100%; background:linear-gradient(90deg, var(--cyan), var(--purple2));
  border-radius:2px; width:0%; transition:width 0.5s linear;
}
/* This overlay blocks any click/drag seeking */
.progress-blocker {
  position:absolute; inset:0;
  cursor:not-allowed;
}
.player-chapter-info { font-size:11px; color:var(--dim); margin-top:5px; text-align:center; }

.player-right { display:flex; align-items:center; gap:14px; }
.player-volume { display:flex; align-items:center; gap:8px; font-size:14px; }
.player-volume input[type=range] {
  width:80px; accent-color:var(--purple2);
  cursor:pointer;
}

@media(max-width:768px) {
  .player-inner { grid-template-columns:1fr auto; grid-template-rows:auto auto; gap:10px; padding:12px 16px; }
  .player-book-info { grid-column:1; }
  .player-controls { grid-column:2; grid-row:1; }
  .player-progress-wrap { grid-column:1/-1; }
  .player-right { display:none; }
}

/* ===== Chapter Sidebar ===== */
.chapter-sidebar {
  position: fixed; right: 0; top: 60px; bottom: 80px;
  width: 280px; z-index: 150;
  background: rgba(9,9,26,0.97);
  backdrop-filter: blur(16px);
  border-left: 1px solid var(--border);
  transition: transform 0.4s cubic-bezier(0.4,0,0.2,1);
  overflow-y: auto;
}
.chapter-sidebar.hidden { transform: translateX(100%); }

.sidebar-inner { padding: 20px; }
.sidebar-title {
  font-family:'Syne',sans-serif; font-size:15px; font-weight:700;
  margin-bottom:16px; color:var(--text);
}

.chapter-list { display:flex; flex-direction:column; gap:4px; margin-bottom:20px; }

.chapter-item {
  padding:10px 12px; border-radius:8px;
  border:1px solid transparent;
  font-size:13px; cursor:pointer;
  transition:background 0.15s, border-color 0.15s;
  display:flex; align-items:center; gap:10px;
}
.chapter-item:hover { background:var(--surface2); }
.chapter-item.active { background:rgba(6,182,212,0.08); border-color:rgba(6,182,212,0.3); }
.chapter-item.locked { opacity:0.4; cursor:default; }
.chapter-item.locked:hover { background:none; }

.ch-num {
  width:22px; height:22px; border-radius:50%;
  background:var(--surface2); border:1px solid var(--border);
  display:flex; align-items:center; justify-content:center;
  font-size:10px; font-weight:600; color:var(--dim); flex-shrink:0;
}
.chapter-item.active .ch-num { background:var(--cyan); border-color:var(--cyan); color:#000; }
.chapter-item.locked .ch-num::after { content:'🔒'; font-size:9px; }

.ch-title { font-size:12px; line-height:1.4; }
.ch-duration { font-size:10px; color:var(--dim); margin-left:auto; white-space:nowrap; }

.sidebar-unlock {
  background:var(--surface2); border:1px solid var(--border);
  border-radius:var(--radius); padding:16px;
}
.unlock-title { font-size:13px; font-weight:600; margin-bottom:8px; }
.sidebar-unlock p { font-size:12px; color:var(--dim); line-height:1.6; margin-bottom:12px; }
.sidebar-unlock input {
  width:100%; background:var(--bg); border:1px solid var(--border);
  border-radius:6px; padding:9px 12px; font-size:13px;
  color:var(--text); outline:none;
}
.sidebar-unlock input:focus { border-color:var(--purple); }

/* ===== About / Support ===== */
#about { background:var(--bg); }
.about-inner {
  display:grid; grid-template-columns:1fr 360px; gap:64px; align-items:start;
}
@media(max-width:820px) { .about-inner { grid-template-columns:1fr; gap:40px; } }

.about-text { font-size:16px; color:var(--dim); line-height:1.8; margin-bottom:18px; }

.support-card {
  background:var(--surface);
  border:1px solid rgba(139,92,246,0.25);
  border-radius:var(--radius); padding:28px;
  position:sticky; top:80px;
}
.support-title {
  font-family:'Syne',sans-serif; font-size:20px; font-weight:700;
  margin-bottom:12px; color:var(--red);
}

/* ===== Modals ===== */
.modal-overlay {
  position:fixed; inset:0; z-index:500;
  background:rgba(4,4,14,0.85); backdrop-filter:blur(8px);
  display:flex; align-items:center; justify-content:center;
  padding:24px;
  opacity:0; pointer-events:none;
  transition:opacity 0.25s;
}
.modal-overlay.open { opacity:1; pointer-events:all; }

.modal {
  background:var(--surface);
  border:1px solid rgba(139,92,246,0.3);
  border-radius:16px; padding:36px;
  max-width:420px; width:100%;
  text-align:center; position:relative;
  overflow:hidden;
}
.modal-glow {
  position:absolute; top:0; left:50%; transform:translateX(-50%);
  width:200px; height:100px;
  background:radial-gradient(ellipse, rgba(139,92,246,0.2) 0%, transparent 70%);
  pointer-events:none;
}
.modal-title { font-family:'Syne',sans-serif; font-size:22px; font-weight:800; margin-bottom:12px; }

.modal input[type=email] {
  width:100%; background:var(--bg);
  border:1px solid var(--border); border-radius:8px;
  padding:12px 16px; font-size:14px; color:var(--text); outline:none;
}
.modal input[type=email]:focus { border-color:var(--purple); }

/* ===== Footer ===== */
footer {
  background:var(--bg); border-top:1px solid var(--border);
  padding-bottom:100px; /* space for player bar */
}
.footer-inner { max-width:1100px; margin:0 auto; padding:48px 24px; text-align:center; }
.footer-logo { font-family:'Syne',sans-serif; font-size:20px; font-weight:800; color:var(--cyan); margin-bottom:10px; }

/* ===== Utility ===== */
.hidden { display:none !important; }
@media(max-width:600px) {
  .nav-links { display:none; }
  .chapter-sidebar { width:100%; border-left:none; border-top:1px solid var(--border); top:auto; bottom:80px; max-height:50vh; }
}

/* ===== Chapter Progress Bars ===== */
.chapter-item {
  padding: 10px 12px !important;
  gap: 10px !important;
}
.ch-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.ch-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
}
.ch-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-duration { font-size: 10px; color: var(--dim); flex-shrink: 0; }

.ch-progress-track {
  height: 5px;
  border-radius: 3px;
  background: rgba(255,255,255,0.06);
  overflow: hidden;
  position: relative;
}
.ch-progress-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(to right, #22c55e 0%, #eab308 55%, #ef4444 100%);
  width: 0%;
  transition: width 0.8s ease;
}
.ch-progress-fill.active-fill {
  position: relative;
}
.ch-progress-fill.active-fill::after {
  content: '';
  position: absolute;
  right: 0; top: 0;
  width: 6px; height: 100%;
  background: rgba(255,255,255,0.7);
  border-radius: 3px;
  animation: pulse-tip 1.2s ease-in-out infinite;
}
@keyframes pulse-tip {
  0%,100% { opacity:0.7; }
  50%      { opacity:0.2; }
}

/* ===== Book Tile Cover Image ===== */
.tile-cover {
  width: 100%;
  aspect-ratio: 1 / 1; object-fit: cover; border-radius: 8px;
  background-size: cover;
  background-position: center;
  border-radius: 8px;
  margin-bottom: 14px;
}
