/* ==========================================================================
   DAILY STORY — DESIGN SYSTEM & THEMES
   ========================================================================== */

/* --- Theme Variables --- */
.theme-warm-amber {
  --bg: #FAF7F2;
  --bg-card: #FFFFFF;
  --bg-quote: #FBF0E0;
  --sidebar-bg: #F2EBE0;
  --accent: #D4713A;
  --accent-rgb: 212, 113, 58;
  --accent2: #8B4513;
  --text: #1C1A17;
  --muted: #8A7D6A;
  --muted2: #C4B49A;
  --border: #E8D8C0;
  --outcome-bg: #E8F5E9;
  --outcome-fg: #2E7D32;
  --idea-fg: #5C4A35;
  --practice-fg: #2A221A;
  --shadow: rgba(100, 70, 30, 0.06);
  --shadow-hover: rgba(100, 70, 30, 0.12);
}

.theme-ocean-blue {
  --bg: #F0F5FA;
  --bg-card: #FFFFFF;
  --bg-quote: #E3EEF8;
  --sidebar-bg: #E0EAF5;
  --accent: #1A6FA8;
  --accent-rgb: 26, 111, 168;
  --accent2: #0D4F7A;
  --text: #0D1B2A;
  --muted: #4A6A8A;
  --muted2: #7AA0C0;
  --border: #C0D8EE;
  --outcome-bg: #E8F4FD;
  --outcome-fg: #0D4F7A;
  --idea-fg: #2A4A6A;
  --practice-fg: #0D1B2A;
  --shadow: rgba(10, 50, 100, 0.06);
  --shadow-hover: rgba(10, 50, 100, 0.12);
}

.theme-forest-green {
  --bg: #F2F6F2;
  --bg-card: #FFFFFF;
  --bg-quote: #E3EEE3;
  --sidebar-bg: #E3EDE3;
  --accent: #2E7D44;
  --accent-rgb: 46, 125, 68;
  --accent2: #1A5C2E;
  --text: #0F1F0F;
  --muted: #527A5A;
  --muted2: #88AA88;
  --border: #B8D8B8;
  --outcome-bg: #FFF8E1;
  --outcome-fg: #E65100;
  --idea-fg: #2A4A2A;
  --practice-fg: #0F1F0F;
  --shadow: rgba(20, 70, 20, 0.06);
  --shadow-hover: rgba(20, 70, 20, 0.12);
}

.theme-rose-pink {
  --bg: #FAF0F4;
  --bg-card: #FFFFFF;
  --bg-quote: #F8E3EA;
  --sidebar-bg: #F5E0E9;
  --accent: #C0385A;
  --accent-rgb: 192, 56, 90;
  --accent2: #8A1A38;
  --text: #1F0D14;
  --muted: #8A5A6A;
  --muted2: #C09AAA;
  --border: #EAC0CC;
  --outcome-bg: #EBF5FA;
  --outcome-fg: #0277BD;
  --idea-fg: #4A1A28;
  --practice-fg: #1F0D14;
  --shadow: rgba(150, 30, 60, 0.06);
  --shadow-hover: rgba(150, 30, 60, 0.12);
}

.theme-lavender {
  --bg: #F5F2FC;
  --bg-card: #FFFFFF;
  --bg-quote: #EBE5F8;
  --sidebar-bg: #EAE3F8;
  --accent: #5B4BA8;
  --accent-rgb: 91, 75, 168;
  --accent2: #3D2E8A;
  --text: #160F2E;
  --muted: #6A5A8A;
  --muted2: #9A8ABA;
  --border: #C8B8EE;
  --outcome-bg: #E8F5E9;
  --outcome-fg: #2E7D32;
  --idea-fg: #2A1A4A;
  --practice-fg: #160F2E;
  --shadow: rgba(50, 30, 120, 0.06);
  --shadow-hover: rgba(50, 30, 120, 0.12);
}

/* ==========================================================================
   BASE STYLES & RESET
   ========================================================================== */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.3s ease, color 0.3s ease;
}

body.lock-scroll {
  overflow: hidden;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s ease;
}
a:hover {
  opacity: 0.85;
  text-decoration: underline;
}

h1, h2, h3, h4, h5 {
  font-weight: 700;
  line-height: 1.25;
  color: var(--text);
}

/* ==========================================================================
   LAYOUT SHELL
   ========================================================================== */
.app-container {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* --- Sidebar (Drawer on mobile, fixed on desktop) --- */
.app-sidebar {
  width: 320px;
  background-color: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  z-index: 100;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.3s ease;
}

.sidebar-header {
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--border);
}

.sidebar-logo {
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.02em;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.2s;
}
.sidebar-logo:hover { color: var(--accent); }

.sidebar-divider {
  border: 0;
  height: 1px;
  background-color: var(--border);
  margin: 0.5rem 0;
}

.sidebar-section {
  padding: 1rem 1.5rem;
}

/* Scrollable body — wraps everything below the sidebar header */
.sidebar-body {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
  scrollbar-color: var(--border) transparent;
}

.archive-section {
  flex-grow: 1;
  padding-bottom: 2rem;
  display: flex;
  flex-direction: column;
}

.section-label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 0.5rem;
}

.sidebar-footer {
  padding: 1.2rem 1.5rem;
  background-color: rgba(0,0,0,0.02);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.user-email-display {
  color: var(--muted);
  font-weight: 500;
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Main Content Panel --- */
.app-main {
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  min-width: 0; /* Prevents flex items from overflowing */
}

.app-header {
  height: 64px;
  background-color: rgba(250, 247, 242, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  position: sticky;
  top: 0;
  z-index: 90;
  transition: background-color 0.3s ease;
}

.header-title {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.2s;
}
.header-title:hover { color: var(--accent); }

.header-title span {
  color: var(--accent);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}

.header-link {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted);
}
.header-link:hover {
  color: var(--accent);
  text-decoration: none;
}

.content-container {
  max-width: 820px;
  width: 100%;
  margin: 0 auto;
  padding: 2.5rem 2rem 4rem;
  flex-grow: 1;
}

.app-footer {
  border-top: 1px solid var(--border);
  padding: 2.5rem 2rem;
  text-align: center;
  background-color: rgba(0,0,0,0.01);
  font-size: 0.83rem;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ==========================================================================
   COMPONENTS
   ========================================================================== */

/* --- Buttons & Inputs --- */
.btn-primary, .btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  border-radius: 10px;
  border: none;
  cursor: pointer;
  transition: all 0.18s ease;
  touch-action: manipulation;
  min-height: 44px;
}

.btn-primary {
  background-color: var(--accent);
  color: #FFFFFF;
  box-shadow: 0 2px 8px rgba(var(--accent-rgb), 0.16);
}
.btn-primary:hover {
  opacity: 0.9;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(var(--accent-rgb), 0.24);
}
.btn-primary:active {
  transform: translateY(0);
}

.btn-outline {
  background-color: transparent;
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-outline:hover {
  background-color: rgba(0,0,0,0.02);
  border-color: var(--muted);
}

.icon-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  color: var(--text);
  cursor: pointer;
  padding: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  transition: background-color 0.2s;
}
.icon-btn:hover {
  background-color: rgba(0,0,0,0.04);
}

.text-link-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.8rem;
}
.text-link-btn:hover {
  color: var(--accent);
  text-decoration: underline;
}

/* Custom Dropdown Selection */
.custom-select-wrapper {
  position: relative;
  width: 100%;
}
.custom-select-wrapper::after {
  content: "▾";
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--muted);
  pointer-events: none;
}

.theme-select, .filter-select {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: var(--bg-card);
  color: var(--text);
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  transition: border-color 0.2s;
}
.theme-select:focus, .filter-select:focus {
  outline: none;
  border-color: var(--accent);
}

.search-input {
  width: 100%;
  padding: 0.65rem 1rem;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background-color: var(--bg-card);
  color: var(--text);
  transition: border-color 0.2s;
}
.search-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* --- Hero Section --- */
.di-hero {
  padding: 0.5rem 0 1.5rem;
  margin-bottom: 2rem;
  border-bottom: 2px solid var(--border);
}

.di-hero h1 {
  font-size: 2.3rem;
  font-weight: 800;
  letter-spacing: -0.04em;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.di-hero h1 span {
  color: var(--accent);
}

.di-hero p {
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.5;
}

/* --- Readings Archive Cards --- */
.archive-list {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  overflow-y: auto;
  max-height: 100%;
}

.story-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 0.85rem 1.1rem;
  cursor: pointer;
  box-shadow: 0 1px 3px var(--shadow);
  transition: all 0.18s ease;
  display: block;
}

.story-card:hover {
  box-shadow: 0 4px 12px var(--shadow-hover);
  transform: translateY(-1px);
}

.story-card.active {
  border-color: var(--accent);
  background-color: rgba(var(--accent-rgb), 0.03);
}

.story-card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.2rem;
}

.story-card-date {
  color: var(--muted2);
  font-size: 0.72rem;
  font-weight: 600;
}

.story-card-title {
  font-weight: 700;
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.35;
  margin-bottom: 0.2rem;
}

.story-card-hook {
  color: var(--muted);
  font-size: 0.81rem;
  font-style: italic;
  line-height: 1.45;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

/* ==========================================================================
   DYNAMIC STORY RENDERING
   ========================================================================== */
.reading-pane {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 2.5rem 3rem;
  box-shadow: 0 4px 20px var(--shadow);
  margin-bottom: 2rem;
  transition: background-color 0.3s ease;
}

/* Tag Pill */
.di-tag {
  display: inline-block;
  background-color: var(--accent);
  color: #FFFFFF;
  padding: 4px 14px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 1.25rem;
}

/* Editorial Story Typography */
.reading-content h1 {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.1rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  margin-bottom: 0.6rem;
}

.reading-meta {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 1.8rem;
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.reading-content h2 {
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-top: 2.2rem;
  margin-bottom: 0.8rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border);
}

.reading-content p {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.18rem;
  line-height: 1.8;
  color: var(--text);
  margin-bottom: 1.4rem;
  letter-spacing: 0.01em;
}

.reading-content p strong {
  font-family: 'Inter', sans-serif;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.reading-content ul, .reading-content ol {
  margin: 1rem 0 1.5rem 1.5rem;
}

.reading-content li {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.75;
  margin-bottom: 0.6rem;
  color: var(--text);
}

.reading-content blockquote {
  background: var(--bg-quote);
  border-left: 4px solid var(--accent);
  border-radius: 0 12px 12px 0;
  padding: 1.1rem 1.6rem;
  margin: 1.6rem 0;
}

.reading-content blockquote p {
  color: var(--idea-fg);
  font-style: italic;
  margin: 0;
  font-size: 1.15rem;
  line-height: 1.6;
}

.reading-content hr {
  border: 0;
  height: 1px;
  background-color: var(--border);
  margin: 2rem 0;
}

/* ==========================================================================
   FEEDBACK & RATINGS WIDGET
   ========================================================================== */
.fb-section {
  margin-bottom: 2rem;
}

.fb-card {
  background-color: var(--bg-quote);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.8rem 2.2rem;
  text-align: center;
  box-shadow: 0 2px 8px var(--shadow);
}

.fb-card h3 {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.fb-sub {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 1.25rem;
}

.rating-stars {
  font-size: 2rem;
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  cursor: pointer;
  user-select: none;
  margin-bottom: 1rem;
}

.star {
  color: var(--muted2);
  transition: color 0.15s, transform 0.1s;
}

.star:hover {
  transform: scale(1.15);
}

.star.active {
  color: var(--accent);
}

.feedback-inputs {
  max-width: 460px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  animation: fadeIn 0.3s ease;
}

.feedback-inputs textarea {
  width: 100%;
  padding: 0.8rem 1rem;
  font-size: 0.88rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  resize: vertical;
  background-color: var(--bg-card);
  color: var(--text);
}
.feedback-inputs textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.feedback-success-msg {
  color: var(--outcome-fg);
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.5rem;
  animation: scaleIn 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

/* ==========================================================================
   BOOKS RECOMMENDATION SECTION
   ========================================================================== */
.di-books-section {
  padding-top: 1rem;
}

.di-books-header {
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.2rem;
}

.di-books-sub {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1.5rem;
}

.book-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1.2rem;
  margin-bottom: 1rem;
}

.book-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  font-size: 0.9rem;
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  display: flex;
  flex-direction: column;
}

.book-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 18px var(--shadow-hover);
}

.book-card h4 {
  margin: 0 0 0.15rem 0;
  color: var(--text);
  font-size: 0.98rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.book-card .author {
  color: var(--muted);
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
  font-weight: 500;
}

.book-outcome {
  display: inline-block;
  align-self: flex-start;
  background-color: var(--outcome-bg);
  color: var(--outcome-fg);
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
}

.book-card .idea {
  color: var(--idea-fg);
  font-style: italic;
  margin-bottom: 0.75rem;
  line-height: 1.55;
  font-size: 0.86rem;
  flex-grow: 1;
}

.book-card .practice-label {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.7rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.book-card .practice {
  color: var(--practice-fg);
  line-height: 1.5;
  font-size: 0.86rem;
}

.book-buy-link {
  display: inline-block;
  margin-top: 0.8rem;
  font-size: 0.76rem;
  font-weight: 600;
  color: var(--accent);
}
.book-buy-link:hover {
  text-decoration: underline;
}

.di-refresh-note {
  color: var(--muted2);
  font-size: 0.76rem;
  text-align: center;
  margin-top: 1rem;
}

/* ==========================================================================
   EMAIL GATE OVERLAY
   ========================================================================== */
.email-gate-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  transition: opacity 0.3s ease, visibility 0.3s;
}

.email-gate-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.gate-card {
  max-width: 420px;
  width: 100%;
  background-color: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 3rem 2.2rem;
  text-align: center;
  box-shadow: 0 10px 30px var(--shadow-hover);
  animation: scaleIn 0.35s cubic-bezier(0.175, 0.885, 0.32, 1.15);
}

.gate-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.gate-card h2 {
  font-size: 1.8rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.3rem;
}

.gate-sub {
  color: var(--muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin-bottom: 1.8rem;
}

#email-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

#gate-email {
  width: 100%;
  padding: 0.75rem 1.2rem;
  font-size: 0.95rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background-color: var(--bg);
  color: var(--text);
  text-align: center;
  transition: border-color 0.2s;
}
#gate-email:focus {
  outline: none;
  border-color: var(--accent);
}

.gate-caption {
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

.gate-hint {
  font-size: 0.75rem;
  color: var(--muted2);
  margin: 6px 0 0 2px;
  font-style: normal;
  line-height: 1.4;
}

.privacy-link {
  font-weight: 600;
  text-decoration: underline;
}

/* ==========================================================================
   LOADING OVERLAY & SKELETONS
   ========================================================================== */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: var(--bg);
  z-index: 999; /* below email-gate (1000) so gate is never obscured */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  transition: opacity 0.4s ease, visibility 0.4s;
}

.loading-overlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  max-width: 320px;
  padding: 0 1rem;
}

.loading-icon {
  font-size: 2.6rem;
  margin-bottom: 1rem;
  animation: pulse 1.8s ease-in-out infinite;
}

.loading-text {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text);
  line-height: 1.55;
}

.loading-bar-container {
  width: 56px;
  height: 4px;
  background-color: var(--border);
  border-radius: 2px;
  margin-top: 1.8rem;
  overflow: hidden;
}

.loading-bar {
  height: 100%;
  width: 0%;
  background-color: var(--accent);
  border-radius: 2px;
  animation: fillAnimation 2.2s cubic-bezier(0.4, 0, 0.2, 1) infinite;
}

/* Skeleton Loading Elements */
.skeleton-line, .skeleton-tag, .skeleton-heading, .skeleton-paragraph, .book-skeleton {
  background: linear-gradient(90deg, rgba(0,0,0,0.04) 25%, rgba(0,0,0,0.08) 37%, rgba(0,0,0,0.04) 63%);
  background-size: 400% 100%;
  animation: skeletonPulse 1.4s ease infinite;
}

.skeleton-line {
  height: 10px;
  border-radius: 4px;
  margin-bottom: 6px;
  width: 100%;
}
.skeleton-line.short {
  width: 60%;
}

.skeleton-tag {
  height: 22px;
  width: 80px;
  border-radius: 999px;
  margin-bottom: 1.25rem;
}

.skeleton-heading {
  height: 36px;
  width: 70%;
  border-radius: 6px;
  margin-bottom: 2rem;
}

.skeleton-paragraph {
  height: 14px;
  border-radius: 4px;
  margin-bottom: 12px;
  width: 100%;
}
.skeleton-paragraph:nth-child(even) {
  width: 90%;
}

.book-skeleton {
  height: 220px;
  border-radius: 12px;
}

.archive-skeleton {
  padding: 0.85rem 1.1rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: 0.4rem;
}

/* ==========================================================================
   AD CONTAINERS & UTILS
   ========================================================================== */
.sidebar-ad-container, .bottom-ad-container {
  background-color: rgba(0,0,0,0.01);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 0.5rem;
  text-align: center;
  position: relative;
}

.sidebar-ad-container {
  margin: 1rem 1.5rem;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bottom-ad-container {
  margin: 2rem 0;
  min-height: 90px;
}

.ad-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.05rem;
  color: var(--muted2);
  margin-top: 4px;
}

.hidden {
  display: none !important;
}

/* ==========================================================================
   ANIMATIONS
   ========================================================================== */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleIn {
  from { transform: scale(0.95); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.85; }
}

@keyframes fillAnimation {
  0% { width: 0%; }
  65% { width: 88%; }
  100% { width: 100%; }
}

@keyframes skeletonPulse {
  0% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ==========================================================================
   RESPONSIVE MEDIA QUERIES
   ========================================================================== */

/* --- High-end Desktop (Larger main panel widths) --- */
@media screen and (min-width: 1200px) {
  .content-container {
    max-width: 900px;
  }
}

/* --- Mobile / Drawer Sidebar Breakpoint (≤ 992px) --- */
@media screen and (max-width: 992px) {
  .app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    transform: translateX(-100%);
    box-shadow: 10px 0 30px rgba(0,0,0,0.15);
  }

  .app-sidebar.active {
    transform: translateX(0);
  }

  .sidebar-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0, 0, 0, 0.4);
    z-index: 99;
    animation: fadeIn 0.25s ease;
  }

  .app-header {
    padding: 0 1.25rem;
  }

  .header-menu-btn {
    display: flex !important;
  }

  .content-container {
    padding: 1.5rem 1.25rem 3rem;
  }

  .book-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- Tablet / Compact-only (≤ 768px) --- */
@media screen and (max-width: 768px) {
  .reading-pane {
    padding: 1.8rem 1.6rem;
  }
  
  .reading-content h1 {
    font-size: 1.65rem;
  }

  .reading-content p {
    font-size: 1.08rem;
  }

  .reading-content li {
    font-size: 1.05rem;
  }

  .reading-content blockquote p {
    font-size: 1.05rem;
  }

  .di-hero h1 {
    font-size: 1.8rem;
  }

  .compact-only {
    display: inline-flex !important;
  }
}

/* --- Mobile Portrait (≤ 576px) --- */
@media screen and (max-width: 576px) {
  .book-grid {
    grid-template-columns: 1fr;
  }

  .di-hero h1 {
    font-size: 1.5rem;
  }
  .di-hero p {
    font-size: 0.9rem;
  }

  .fb-card {
    padding: 1.25rem 1.2rem;
  }

  .rating-stars {
    font-size: 1.7rem;
  }

  .btn-primary, .btn-outline {
    width: 100%;
    min-height: 52px; /* Touch target optimized */
  }

  .sidebar-ad-container {
    margin: 1rem;
    min-height: 120px;
  }

  .app-footer {
    padding: 2rem 1rem;
  }
}

/* Global utility menu show/hide triggers */
.header-menu-btn {
  display: none;
}

.compact-only {
  display: none;
}

/* ==========================================================================
   TAB NAVIGATION BAR
   ========================================================================== */
.tab-bar {
  display: flex;
  gap: 0.25rem;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 64px;
  z-index: 90;
  overflow-x: auto;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar { display: none; }

.tab-btn {
  display: inline-flex;
  align-items: center;
  padding: 0.7rem 1.1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--muted);
  text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  white-space: nowrap;
  margin-bottom: -1px;
}

.tab-btn:hover {
  color: var(--accent);
}

.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ==========================================================================
   LIBRARY / WEEKLY TAB VIEW
   ========================================================================== */
.library-view {
  padding: 1.75rem 0;
}

.library-controls {
  display: flex;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.library-controls .search-input {
  flex: 1;
  min-width: 180px;
}

.library-controls .custom-select-wrapper {
  min-width: 200px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.library-card {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 1.25rem 1.4rem;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.library-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-hover);
}

.library-card-date {
  font-size: 0.72rem;
  color: var(--muted2);
  font-weight: 500;
}

.library-card-cat {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.library-card-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  margin-top: 0.2rem;
}

.library-card-hook {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.55;
  flex: 1;
}

.library-card-link {
  display: inline-block;
  margin-top: 0.9rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.2s;
}

.library-card-link:hover {
  opacity: 0.75;
}

/* ==========================================================================
   REQUEST A STORY TAB
   ========================================================================== */
.request-view {
  padding: 2rem 0;
  max-width: 640px;
  margin: 0 auto;
}

.request-card {
  background: var(--bg-card);
  border-radius: 16px;
  padding: 2rem 2.25rem;
  border: 1px solid var(--border);
}

.request-card h2 {
  font-family: 'Playfair Display', serif;
  font-size: 1.65rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.5rem;
}

.request-sub {
  font-size: 0.9rem;
  color: var(--muted);
  line-height: 1.6;
  margin-bottom: 1.5rem;
}

.request-card textarea {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  font-family: inherit;
  font-size: 0.9rem;
  line-height: 1.55;
  resize: vertical;
  min-height: 100px;
  transition: border-color 0.2s;
}

.request-card textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.request-email-note {
  font-size: 0.78rem;
  color: var(--muted2);
  margin-top: 0.75rem;
  font-style: italic;
}

.request-success {
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 10px;
  padding: 1.25rem 1.5rem;
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
  text-align: center;
}

.request-error-msg {
  color: #c0392b;
  font-size: 0.84rem;
  font-weight: 600;
  margin-top: 0.75rem;
}

@media (max-width: 768px) {
  .tab-bar {
    padding: 0 1rem;
    top: 56px;
  }

  .library-grid {
    grid-template-columns: 1fr;
  }

  .library-controls {
    flex-direction: column;
  }

  .library-controls .custom-select-wrapper {
    min-width: unset;
  }

  .request-card {
    padding: 1.5rem 1.25rem;
  }
}

/* ==========================================================================
   ADMIN PANEL (SIDEBAR)
   ========================================================================== */
.admin-panel {
  background: rgba(var(--accent-rgb), 0.04);
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 10px;
  padding: 1rem 1rem 0.75rem;
  margin-bottom: 0.5rem;
}

.admin-gh-connect {
  margin-bottom: 0.6rem;
}

.admin-gh-hint {
  font-size: 0.74rem;
  color: var(--muted);
  margin-bottom: 0.4rem;
  line-height: 1.4;
}

.admin-gh-hint code {
  background: rgba(var(--accent-rgb), 0.1);
  color: var(--accent);
  border-radius: 3px;
  padding: 0 0.3em;
  font-size: 0.85em;
}

.admin-gh-row {
  display: flex;
  gap: 0.4rem;
}

.admin-gh-row .search-input {
  flex: 1;
  min-width: 0;
  font-size: 0.78rem;
  padding: 0.35rem 0.6rem;
}

.admin-gh-btn {
  padding: 0.35rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 6px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
}

.admin-gh-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--outcome-fg);
  background: rgba(var(--accent-rgb), 0.06);
  border: 1px solid rgba(var(--accent-rgb), 0.15);
  border-radius: 6px;
  padding: 0.35rem 0.6rem;
  margin-bottom: 0.6rem;
}

.admin-badge {
  color: var(--accent) !important;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  letter-spacing: 0.07em;
}

.admin-gen-form {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-top: 0.6rem;
}

.admin-gen-form select,
.admin-gen-form input {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.45rem 0.75rem;
  font-size: 0.82rem;
  font-family: inherit;
}

.admin-gen-form select:focus,
.admin-gen-form input:focus {
  outline: none;
  border-color: var(--accent);
}

.admin-quick-btns {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.admin-quick-btns button {
  flex: 1;
  min-width: 60px;
  min-height: unset;
  padding: 0.3rem 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
}

.admin-quick-btns button:hover {
  border-color: var(--accent);
  color: var(--accent);
}

#admin-generate-btn {
  width: 100%;
  padding: 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
  border-radius: 7px;
  border: none;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.2s;
}

#admin-generate-btn:hover {
  opacity: 0.85;
}

#admin-generate-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-status {
  font-size: 0.78rem;
  color: var(--muted);
  text-align: center;
  min-height: 1.2rem;
}

.admin-status.success { color: var(--outcome-fg); }
.admin-status.error   { color: #c0392b; }

#admin-requests-list {
  max-height: 260px;
  overflow-y: auto;
  margin-top: 0.4rem;
}

.admin-request-card {
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.5rem;
  background: var(--bg-card);
  font-size: 0.8rem;
}

.admin-request-email {
  font-weight: 700;
  color: var(--accent);
  font-size: 0.75rem;
  margin-bottom: 0.2rem;
}

.admin-request-text {
  color: var(--text);
  line-height: 1.45;
  margin-bottom: 0.25rem;
}

.admin-request-theme {
  color: var(--muted2);
  font-size: 0.72rem;
  font-style: italic;
}

.admin-request-date {
  color: var(--muted2);
  font-size: 0.7rem;
  margin-top: 0.3rem;
}

/* ==========================================================================
   BREADCRUMB / BACK NAVIGATION
   ========================================================================== */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
  position: sticky;
  top: 108px; /* below header (64px) + tab-bar (44px) */
  z-index: 80;
}

.breadcrumb-back {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  background: rgba(var(--accent-rgb), 0.08);
  border: 1px solid rgba(var(--accent-rgb), 0.18);
  transition: all 0.18s;
  white-space: nowrap;
}

.breadcrumb-back:hover {
  background: rgba(var(--accent-rgb), 0.15);
  transform: translateX(-2px);
}

.breadcrumb-arrow {
  font-size: 0.9rem;
  line-height: 1;
}

.breadcrumb-sep {
  color: var(--muted2);
  font-size: 0.75rem;
  flex-shrink: 0;
}

.breadcrumb-current {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

@media (max-width: 768px) {
  .breadcrumb {
    top: 96px; /* header (56px) + tab-bar (40px) */
    padding: 0.45rem 1rem;
  }
  .breadcrumb-current {
    max-width: 160px;
  }
}
