﻿/* --- Earth-Tone Gothic Theme --- */
:root {
  --bg:       #0a1f0e;
  --panel:    rgba(18, 24, 32, 0.88);
  --panel-solid: #0e4600;
  --border:   rgba(180, 100, 108, 0.25);
  --accent:   #c9925a;
  --accent2:  #8b6a4a;
  --text:     #e8ddd0;
  --muted:    rgba(232, 221, 208, 0.55);
  --hover:    rgba(201, 146, 90, 0.18);
  --shadow:   rgba(0, 0, 0, 0.5);
  --sidebar-w: 320px;
  --bc-h:     120px;
  --radius:   6px;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html {
  height: 100%;
  background: var(--bg);
}

body {
  height: 100%;
  font-family: sans-serif, 'avant garde', serif;
  background: transparent;
  color: var(--text);
  overflow: hidden;
}

/* --- Background video --- */
#video {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
}

/* --- Beta badge --- */
#betaBadge {
  position: fixed;
  top: 10px;
  right: 12px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 2px 8px;
  z-index: 100;
  pointer-events: none;
  opacity: 0.75;
}

/* --- Welcome overlay --- */
#welcomeOverlay {
  position: fixed;
  inset: 0;
  z-index: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transition: opacity 0.6s ease;
}
#welcomeOverlay.hidden {
  opacity: 0;
  pointer-events: none;
}
#welcomeOverlay h1 {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 3.5rem;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  margin-bottom: 0.4em;
  text-shadow: 0 2px 12px rgba(0,0,0,0.6);
}
#welcomeOverlay p {
  font-family: 'Cormorant Garamond', Georgia, serif;
  font-size: 1.25rem;
  color: var(--muted);
  font-style: italic;
  letter-spacing: 0.05em;
  text-shadow: 0 1px 6px rgba(0,0,0,0.5);
}

/* --- Sidebar toggle hamburger --- */
.sidebar-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 1100;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--accent);
  font-size: 26px;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  transition: background 0.2s, opacity 0.3s;
}
.sidebar-toggle:hover { background: var(--hover); }

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: 0;
  left: calc(-1 * var(--sidebar-w) - 20px);
  width: var(--sidebar-w);
  height: 100%;
  background: var(--panel-solid);
  border-right: 1px solid var(--border);
  z-index: 1050;
  overflow-y: auto;
  transition: left 0.3s ease;
  padding: 20px 18px 30px;
  box-shadow: 4px 0 24px var(--shadow);
}
.sidebar.open {
  left: 0;
}

.sidebar-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  color: var(--muted);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
}
.sidebar-close:hover { color: var(--accent); }

.sidebar-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 18px;
  letter-spacing: 0.5px;
}

.sidebar-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-section:last-child { border-bottom: none; }

.sidebar-section h3 {
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--accent);
  margin-bottom: 10px;
  font-weight: 600;
}

.sidebar-meta {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

.sidebar-hint {
  font-size: 13px;
  line-height: 1.5;
  color: var(--muted);
}
.sidebar-hint a {
  color: var(--accent);
  text-decoration: underline;
}
.sidebar-hint a:hover { color: #e0a96a; }

.sidebar-auth-btns {
  display: flex;
  gap: 6px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.sidebar-select-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.sidebar-select-row select { flex: 1; }

.sidebar-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.library-dropdown {
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.library-dropdown[open] {
  background: rgba(255, 255, 255, 0.03);
}
.library-heading {
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 12px;
  cursor: pointer;
  list-style: none;
  user-select: none;
}
.library-heading::-webkit-details-marker { display: none; }
.library-heading::before {
  content: '▸ ';
  font-size: 11px;
}
.library-dropdown[open] > .library-heading::before {
  content: '▾ ';
}
.library-dropdown ul {
  list-style: none;
  padding: 4px 12px 8px;
  margin: 0;
  font-size: 13px;
  color: var(--text);
}

/* Sidebar overlay */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1040;
}
.sidebar-overlay.active { display: block; }

/* --- Buttons --- */
.btn {
  background: rgba(180, 140, 100, 0.15);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 14px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}
.btn:hover {
  background: var(--hover);
  border-color: var(--accent);
}
.btn-sm {
  padding: 5px 10px;
  font-size: 12px;
}
.sidebar-btn {
  display: block;
  width: 100%;
  text-align: left;
  margin-bottom: 6px;
}
.sidebar-link {
  text-align: center;
  text-decoration: none;
}

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 12px;
  cursor: pointer;
  padding: 2px 0;
  margin-top: 4px;
  text-decoration: underline;
  font-family: inherit;
  display: inline-block;
}
.btn-link:hover { color: #e0a96a; }

/* --- Inputs / selects --- */
input[type="email"],
input[type="password"],
select {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  margin-bottom: 6px;
}
input[type="email"]:focus,
input[type="password"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
}
select option {
  background: var(--panel-solid);
  color: var(--text);
}

/* --- Status line --- */
.status-line {
  position: fixed;
  top: 14px;
  left: 70px;
  color: var(--muted);
  font-size: 13px;
  z-index: 100;
  pointer-events: none;
}

/* --- Error log --- */
.error-log {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-height: 160px;
  overflow: auto;
  background: rgba(0, 0, 0, 0.85);
  color: #f5c6c6;
  padding: 8px 12px;
  font-size: 12px;
  font-family: 'Consolas', monospace;
  display: none;
  z-index: 9999;
}

/* --- Bottom controls --- */
.bottom-controls {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  padding: 10px 18px 14px;
  z-index: 1000;
  transition: transform 0.35s ease, opacity 0.35s ease;
  box-shadow: 0 -4px 20px var(--shadow);
}
.bottom-controls.hidden {
  transform: translateY(100%);
  opacity: 0;
  pointer-events: none;
}

.bc-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.bc-row:last-child { margin-bottom: 0; }

.bc-transport {
  flex-wrap: wrap;
}

.bc-btn {
  white-space: nowrap;
}

.bc-chapter-select {
  flex: 1;
  max-width: 280px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
}

/* Progress bar */
.bc-progress span {
  min-width: 56px;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--muted);
}
.bc-progress span:last-child { text-align: right; }

/* Range inputs (progress + volume) */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: rgba(180, 140, 100, 0.25);
  outline: none;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel-solid);
  cursor: pointer;
}
input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--panel-solid);
  cursor: pointer;
}

.bc-volume label {
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
}

/* --- Scrollbar --- */
::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--accent2);
  border-radius: 3px;
}

/* --- Mobile tweaks --- */
@media (max-width: 480px) {
  :root { --sidebar-w: 85vw; }
  .bc-transport { gap: 6px; }
  .bc-chapter-select { max-width: 100%; }
  .sidebar-title { font-size: 17px; }
}