/* ========================================
   Novel Reader - Mobile-First PWA Styles
   ======================================== */

/* CSS Variables - Theme System */
:root {
  /* Dark Mode (Default) */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a24;
  --bg-card: rgba(18, 18, 26, 0.8);
  --bg-glass: rgba(18, 18, 26, 0.6);

  --text-primary: #e4e4e7;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  --accent-primary: #8b5cf6;
  --accent-secondary: #a78bfa;
  --accent-gradient: linear-gradient(135deg, #8b5cf6 0%, #6366f1 100%);

  --system-card-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.15) 0%, rgba(139, 92, 246, 0.15) 100%);
  --system-card-border: rgba(139, 92, 246, 0.4);
  --system-card-glow: 0 0 20px rgba(139, 92, 246, 0.3);

  --border-color: rgba(255, 255, 255, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;

  --transition-fast: 150ms ease;
  --transition-normal: 300ms ease;
  --transition-slow: 500ms ease;

  --font-size-base: 18px;
  --font-size-reading: 1.1rem;
  --line-height-reading: 1.6;

  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
}

/* Light Mode */
[data-theme="light"] {
  --bg-primary: #fafafa;
  --bg-secondary: #ffffff;
  --bg-tertiary: #f4f4f5;
  --bg-card: rgba(255, 255, 255, 0.9);
  --bg-glass: rgba(255, 255, 255, 0.7);

  --text-primary: #18181b;
  --text-secondary: #52525b;
  --text-muted: #a1a1aa;

  --accent-primary: #7c3aed;
  --accent-secondary: #8b5cf6;

  --system-card-bg: linear-gradient(135deg, rgba(99, 102, 241, 0.1) 0%, rgba(139, 92, 246, 0.1) 100%);
  --system-card-border: rgba(124, 58, 237, 0.3);
  --system-card-glow: 0 0 15px rgba(124, 58, 237, 0.2);

  --border-color: rgba(0, 0, 0, 0.1);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.15);
}

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

html {
  font-size: var(--font-size-base);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.6;
  overflow-x: hidden;
  padding-top: var(--safe-area-top);
  padding-bottom: var(--safe-area-bottom);
}

/* Scrollbar Styling */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--accent-primary);
  border-radius: 3px;
}

/* ========================================
   Typography
   ======================================== */

h1,
h2,
h3,
h4,
h5,
h6 {
  font-weight: 600;
  line-height: 1.3;
  color: var(--text-primary);
}

h1 {
  font-size: 1.75rem;
}

h2 {
  font-size: 1.5rem;
}

h3 {
  font-size: 1.25rem;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

a:hover {
  color: var(--accent-secondary);
}

/* ========================================
   Layout Components
   ======================================== */

.container {
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  padding: 0 16px;
}

.page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

/* Header */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-color);
  padding: 12px 16px;
}

.header-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 800px;
  margin: 0 auto;
}

.header-title {
  font-size: 1.25rem;
  font-weight: 700;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.header-back {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-primary);
  font-weight: 500;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Bottom Navigation (Mobile) */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-color);
  padding: 8px 16px;
  padding-bottom: calc(8px + var(--safe-area-bottom));
}

.bottom-nav-content {
  display: flex;
  justify-content: space-around;
  align-items: center;
  max-width: 400px;
  margin: 0 auto;
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 16px;
  color: var(--text-secondary);
  font-size: 0.75rem;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
}

.nav-item.active,
.nav-item:hover {
  color: var(--accent-primary);
  background: rgba(139, 92, 246, 0.1);
}

.nav-item svg {
  width: 24px;
  height: 24px;
}

/* ========================================
   Buttons
   ======================================== */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 24px;
  font-size: 1rem;
  font-weight: 500;
  border: none;
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-normal);
  -webkit-tap-highlight-color: transparent;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 14px rgba(139, 92, 246, 0.4);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(139, 92, 246, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: var(--bg-card);
  border-color: var(--accent-primary);
}

.btn-icon {
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-icon:hover {
  background: var(--bg-card);
  color: var(--accent-primary);
  border-color: var(--accent-primary);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   Cards
   ======================================== */

.card {
  background: var(--bg-card);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 16px;
  transition: all var(--transition-normal);
}

.card:hover {
  border-color: var(--accent-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

/* Novel Card */
.novel-card {
  display: flex;
  gap: 16px;
  cursor: pointer;
}

.novel-cover {
  width: 80px;
  height: 120px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  flex-shrink: 0;
  overflow: hidden;
}

.novel-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.novel-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
}

.novel-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
}

.novel-meta {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.novel-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.progress-bar {
  flex: 1;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 2px;
  transition: width var(--transition-normal);
}

/* Chapter Card */
.chapter-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px;
  cursor: pointer;
}

.chapter-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.chapter-number {
  font-size: 0.8rem;
  color: var(--accent-primary);
  font-weight: 600;
}

.chapter-title {
  font-size: 1rem;
  color: var(--text-primary);
}

.chapter-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.chapter-status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.chapter-read {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
}

.chapter-unread {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 2px solid var(--text-muted);
}

/* ========================================
   System Card (ORV Cyberpunk Style)
   ======================================== */

.system-card {
  background: linear-gradient(180deg,
      rgba(6, 182, 212, 0.08) 0%,
      rgba(14, 165, 233, 0.15) 50%,
      rgba(6, 182, 212, 0.08) 100%);
  border: 2px solid rgba(56, 189, 248, 0.6);
  border-radius: 4px;
  padding: 20px 24px;
  margin: 24px 0;
  position: relative;
  box-shadow:
    0 0 20px rgba(14, 165, 233, 0.3),
    inset 0 0 30px rgba(6, 182, 212, 0.1);
}

/* Corner frames - top left */
.system-card::before {
  content: '';
  position: absolute;
  top: -2px;
  left: -2px;
  width: 20px;
  height: 20px;
  border-top: 3px solid #38bdf8;
  border-left: 3px solid #38bdf8;
  border-top-left-radius: 4px;
}

/* Corner frames - bottom right */
.system-card::after {
  content: '';
  position: absolute;
  bottom: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  border-bottom: 3px solid #38bdf8;
  border-right: 3px solid #38bdf8;
  border-bottom-right-radius: 4px;
}

/* Window controls indicator */
.system-card-icon {
  position: absolute;
  top: 8px;
  right: 12px;
  display: flex;
  gap: 4px;
  font-size: 0;
}

.system-card-icon::before {
  content: '─ □ ×';
  font-family: 'Courier New', monospace;
  font-size: 10px;
  color: rgba(56, 189, 248, 0.7);
  letter-spacing: 2px;
}

.system-card-content {
  font-family: 'Inter', 'Segoe UI', sans-serif;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.6;
  color: #7dd3fc;
  text-align: center;
  text-shadow: 0 0 10px rgba(125, 211, 252, 0.5);
  padding: 8px 0;
}

/* Glow animation for emphasis */
@keyframes systemCardPulse {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(14, 165, 233, 0.3), inset 0 0 30px rgba(6, 182, 212, 0.1);
  }

  50% {
    box-shadow: 0 0 30px rgba(14, 165, 233, 0.5), inset 0 0 40px rgba(6, 182, 212, 0.15);
  }
}

.system-card:hover {
  animation: systemCardPulse 2s ease-in-out infinite;
}

/* Dark System Card Variant for 【】 */
.system-card.system-card-dark {
  background: linear-gradient(180deg,
      rgba(15, 15, 25, 0.95) 0%,
      rgba(25, 25, 40, 0.9) 50%,
      rgba(15, 15, 25, 0.95) 100%);
  border: 2px solid rgba(100, 100, 120, 0.5);
  box-shadow:
    0 0 15px rgba(0, 0, 0, 0.5),
    inset 0 0 20px rgba(0, 0, 0, 0.3);
}

.system-card.system-card-dark::before {
  border-top: 3px solid rgba(120, 120, 140, 0.7);
  border-left: 3px solid rgba(120, 120, 140, 0.7);
}

.system-card.system-card-dark::after {
  border-bottom: 3px solid rgba(120, 120, 140, 0.7);
  border-right: 3px solid rgba(120, 120, 140, 0.7);
}

.system-card.system-card-dark .system-card-icon::before {
  color: rgba(120, 120, 140, 0.6);
}

.system-card.system-card-dark .system-card-content {
  color: #a1a1aa;
  text-shadow: none;
}

@keyframes darkCardPulse {

  0%,
  100% {
    box-shadow: 0 0 15px rgba(0, 0, 0, 0.5), inset 0 0 20px rgba(0, 0, 0, 0.3);
  }

  50% {
    box-shadow: 0 0 20px rgba(50, 50, 70, 0.4), inset 0 0 25px rgba(0, 0, 0, 0.4);
  }
}

.system-card.system-card-dark:hover {
  animation: darkCardPulse 2s ease-in-out infinite;
}

/* Phone Message Card for 「」 */
.phone-message {
  display: flex;
  justify-content: center;
  margin: 24px 0;
}

.phone-frame {
  width: 280px;
  max-width: 90%;
  background: linear-gradient(145deg, #1a1a1a 0%, #2d2d2d 50%, #1a1a1a 100%);
  border-radius: 28px;
  padding: 8px;
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(80, 80, 80, 0.3);
}

.phone-notch {
  width: 80px;
  height: 20px;
  background: #0a0a0a;
  border-radius: 0 0 12px 12px;
  margin: 0 auto 8px;
  position: relative;
}

.phone-notch::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: #2a2a2a;
  border-radius: 2px;
}

.phone-notch::after {
  content: '';
  position: absolute;
  top: 5px;
  right: 12px;
  width: 6px;
  height: 6px;
  background: radial-gradient(circle, #333 30%, #1a1a1a 70%);
  border-radius: 50%;
}

.phone-screen {
  background: linear-gradient(180deg, #1a4a4a 0%, #0d3535 50%, #1a4a4a 100%);
  border-radius: 20px;
  padding: 20px 16px;
  min-height: 80px;
  position: relative;
  overflow: hidden;
}

/* Scanlines effect */
.phone-screen::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: repeating-linear-gradient(0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.1) 2px,
      rgba(0, 0, 0, 0.1) 4px);
  pointer-events: none;
}

.phone-content {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.6;
  color: #b8e8e8;
  text-align: center;
  text-shadow: 0 0 8px rgba(184, 232, 232, 0.4);
  position: relative;
  z-index: 1;
}

/* Phone glow effect on hover */
.phone-frame:hover {
  box-shadow:
    0 10px 40px rgba(0, 0, 0, 0.5),
    inset 0 1px 0 rgba(255, 255, 255, 0.1),
    0 0 0 1px rgba(80, 80, 80, 0.3),
    0 0 30px rgba(26, 74, 74, 0.3);
}

/* ========================================
   Reading Page
   ======================================== */

.reader-container {
  flex: 1;
  padding: 24px 16px;
  padding-bottom: 100px;
  max-width: 700px;
  margin: 0 auto;
}

.reader-content {
  font-size: var(--font-size-reading);
  line-height: var(--line-height-reading);
  color: var(--text-primary);
}

.reader-content p {
  margin-bottom: 0.8em;
  text-align: justify;
  text-justify: inter-word;
}

/* Dialogue styling - quoted text */
.reader-content .dialogue {
  color: #f5f5f5 !important;
  font-weight: 500;
  text-shadow: 0 0 1px rgba(255, 255, 255, 0.3);
}

/* Dark Smoke Card - [[]] */
.smoke-card {
  display: flex;
  justify-content: center;
  margin: 32px 0;
}

.smoke-card-inner {
  position: relative;
  padding: 40px 60px;
  text-align: center;
  min-width: 280px;
  max-width: 90%;
}

.smoke-card-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: radial-gradient(ellipse at center,
      rgba(20, 20, 20, 0.95) 0%,
      rgba(30, 30, 30, 0.9) 30%,
      rgba(40, 40, 40, 0.7) 60%,
      rgba(50, 50, 50, 0.3) 80%,
      transparent 100%);
  filter: blur(8px);
  z-index: 0;
}

.smoke-card-content {
  position: relative;
  z-index: 1;
  font-family: 'Impact', 'Arial Black', sans-serif;
  font-size: 1.3rem;
  font-weight: 600;
  color: #e8e8e8;
  text-shadow:
    0 0 6px rgba(255, 255, 255, 0.3),
    1px 1px 3px rgba(0, 0, 0, 0.7);
  line-height: 1.4;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.reader-chapter-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 32px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-color);
  text-align: center;
}

/* Reading Navigation */
.reader-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border-color);
}

.reader-nav .btn {
  flex: 1;
  max-width: 150px;
}

.reader-nav .chapter-indicator {
  font-size: 0.9rem;
  color: var(--text-secondary);
}

/* ========================================
   Settings Panel
   ======================================== */

.settings-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(4px);
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.settings-overlay.active {
  opacity: 1;
  visibility: visible;
}

.settings-panel {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px;
  padding-bottom: calc(24px + var(--safe-area-bottom));
  z-index: 201;
  transform: translateY(100%);
  transition: transform var(--transition-normal);
}

.settings-overlay.active .settings-panel {
  transform: translateY(0);
}

.settings-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.settings-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 12px;
  display: block;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

/* Font Size Control */
.font-size-control {
  display: flex;
  align-items: center;
  gap: 16px;
}

.font-size-btn {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  font-size: 1.25rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.font-size-btn:hover {
  background: var(--accent-primary);
  color: white;
}

.font-size-value {
  min-width: 50px;
  text-align: center;
  font-weight: 600;
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  padding: 4px;
  gap: 4px;
}

.theme-btn {
  flex: 1;
  padding: 10px 20px;
  border: none;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.9rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.theme-btn.active {
  background: var(--accent-primary);
  color: white;
}

/* ========================================
   Dictionary Panel
   ======================================== */

.dictionary-panel {
  max-height: 60vh;
  overflow-y: auto;
}

.dictionary-input {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.dictionary-input input {
  flex: 1 1 120px;
  min-width: 0;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
}

.dictionary-input input:focus {
  outline: none;
  border-color: var(--accent-primary);
}

.dictionary-input input::placeholder {
  color: var(--text-muted);
}

.dictionary-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dictionary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
}

.dictionary-item-text {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dictionary-original {
  color: var(--text-secondary);
  text-decoration: line-through;
}

.dictionary-arrow {
  color: var(--accent-primary);
}

.dictionary-replacement {
  color: var(--text-primary);
  font-weight: 500;
}

.dictionary-delete {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
}

.dictionary-delete:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

/* ========================================
   Search
   ======================================== */

.search-container {
  position: relative;
  margin-bottom: 24px;
}

.search-input {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  color: var(--text-primary);
  font-size: 1rem;
  transition: all var(--transition-fast);
}

.search-input:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.2);
}

.search-input::placeholder {
  color: var(--text-muted);
}

.search-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  width: 20px;
  height: 20px;
}

/* ========================================
   Bookmarks
   ======================================== */

.bookmark-btn {
  position: relative;
}

.bookmark-btn.active svg {
  fill: var(--accent-primary);
  color: var(--accent-primary);
}

.bookmark-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--bg-secondary);
  color: var(--text-primary);
  padding: 12px 24px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  z-index: 300;
  opacity: 0;
  transition: all var(--transition-normal);
}

.bookmark-toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* ========================================
   Loading & Empty States
   ======================================== */

.loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px;
  gap: 16px;
}

.loading-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--bg-tertiary);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
  color: var(--text-secondary);
}

.empty-state-icon {
  font-size: 3rem;
  margin-bottom: 16px;
}

.empty-state-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--text-primary);
}

/* ========================================
   Modals
   ======================================== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal {
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  padding: 24px;
  max-width: 400px;
  width: 100%;
  max-height: 80vh;
  overflow-y: auto;
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal-overlay.active .modal {
  transform: scale(1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.modal-title {
  font-size: 1.25rem;
  font-weight: 600;
}

.modal-close {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--accent-primary);
  color: white;
}

/* ========================================
   Animations
   ======================================== */

@keyframes fadeIn {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn var(--transition-normal) ease;
}

.slide-up {
  animation: slideUp var(--transition-normal) ease;
}

/* Stagger animation for lists */
.stagger>* {
  animation: slideUp var(--transition-normal) ease both;
}

.stagger>*:nth-child(1) {
  animation-delay: 0ms;
}

.stagger>*:nth-child(2) {
  animation-delay: 50ms;
}

.stagger>*:nth-child(3) {
  animation-delay: 100ms;
}

.stagger>*:nth-child(4) {
  animation-delay: 150ms;
}

.stagger>*:nth-child(5) {
  animation-delay: 200ms;
}

.stagger>*:nth-child(6) {
  animation-delay: 250ms;
}

.stagger>*:nth-child(7) {
  animation-delay: 300ms;
}

.stagger>*:nth-child(8) {
  animation-delay: 350ms;
}

.stagger>*:nth-child(9) {
  animation-delay: 400ms;
}

.stagger>*:nth-child(10) {
  animation-delay: 450ms;
}

/* ========================================
   SVG Icons
   ======================================== */

.icon {
  width: 24px;
  height: 24px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.icon-sm {
  width: 16px;
  height: 16px;
}

.icon-md {
  width: 24px;
  height: 24px;
}

.icon-lg {
  width: 32px;
  height: 32px;
}

.icon-xl {
  width: 48px;
  height: 48px;
}

.novel-cover svg {
  width: 40px;
  height: 40px;
  stroke: white;
  stroke-width: 1.5;
}

.empty-state-icon svg {
  width: 64px;
  height: 64px;
  stroke: var(--accent-primary);
  stroke-width: 1.5;
}

/* ========================================
   Utility Classes
   ======================================== */

.hidden {
  display: none !important;
}

.flex {
  display: flex;
}

.flex-col {
  flex-direction: column;
}

.items-center {
  align-items: center;
}

.justify-center {
  justify-content: center;
}

.justify-between {
  justify-content: space-between;
}

.gap-sm {
  gap: 8px;
}

.gap-md {
  gap: 16px;
}

.gap-lg {
  gap: 24px;
}

.text-center {
  text-align: center;
}

.text-muted {
  color: var(--text-muted);
}

.mt-auto {
  margin-top: auto;
}

.mb-md {
  margin-bottom: 16px;
}

/* ========================================
   Responsive Adjustments
   ======================================== */

@media (min-width: 768px) {
  .container {
    padding: 0 24px;
  }

  .header {
    padding: 16px 24px;
  }

  .bottom-nav {
    display: none;
  }

  .novel-card {
    padding: 20px;
  }

  .novel-cover {
    width: 100px;
    height: 150px;
  }

  .reader-container {
    padding: 32px 24px;
    padding-bottom: 48px;
  }

  .reader-content {
    font-size: 1.15rem;
  }
}

/* Tablet landscape and up */
@media (min-width: 1024px) {
  :root {
    --font-size-base: 16px;
  }

  .novel-cards-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }
}

/* Print styles for offline reading */
@media print {

  .header,
  .bottom-nav,
  .reader-nav,
  .settings-overlay {
    display: none !important;
  }

  body {
    background: white;
    color: black;
  }

  .reader-content {
    font-size: 12pt;
    line-height: 1.6;
  }
}