:root {
  /* Naver / Generic Clean Platform Palette - Light Mode Default */
  --primary-color: #00dc64; /* Naver Green */
  --primary-hover: #00c75a;
  --bg-main: #f8f9fa; /* Off-white background */
  --bg-card: #ffffff;
  --bg-hover: #f1f3f5;
  --border-color: #e9ecef;
  --text-main: #1e1e23;
  --text-muted: #868e96;
  --text-inverse: #ffffff;
  --accent-color: #ff3e4e; /* Point red for genres/tags */
  
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
  --shadow-hover: 0 10px 20px rgba(0,0,0,0.12);
  
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 20px;
  
  --ease-soft: cubic-bezier(0.25, 1, 0.5, 1);
}

[data-theme="dark"] {
  /* Naver Series / Webtoon Dark Mode */
  --primary-color: #00dc64;
  --primary-hover: #00c75a;
  --bg-main: #121212;
  --bg-card: #1e1e23; /* Classic Naver dark gray */
  --bg-hover: #2a2a30;
  --border-color: #2c2c34;
  --text-main: #f1f3f5;
  --text-muted: #adb5bd;
  --text-inverse: #1e1e23;
  --accent-color: #ff5f6d;
  
  --shadow-sm: 0 2px 4px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.3);
  --shadow-hover: 0 10px 20px rgba(0,0,0,0.4);
}

/* Base */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scrollbar-color: var(--text-muted) var(--bg-main);
  scrollbar-width: thin;
}

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-main);
  color: var(--text-main);
  transition: background-color 0.3s ease, color 0.3s ease;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  text-wrap: balance;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

p {
  text-wrap: pretty;
}

/* Header */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background-color: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  transition: background-color 0.3s ease;
}

.header-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.logo {
  font-size: 1.5rem;
  font-weight: 800;
  text-decoration: none;
  color: var(--text-main);
  letter-spacing: -0.5px;
}

.logo span {
  color: var(--primary-color);
}

.nav-links {
  display: flex;
  gap: 2rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 1rem;
  transition: color 0.2s;
  padding: 0.5rem 0;
  position: relative;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text-main);
}

.nav-links a.active::after {
  content: '';
  position: absolute;
  bottom: -1.2rem;
  left: 0;
  width: 100%;
  height: 3px;
  background-color: var(--primary-color);
  border-radius: 2px 2px 0 0;
}

.theme-btn {
  background: var(--bg-hover);
  border: none;
  font-size: 1.1rem;
  cursor: pointer;
  color: var(--text-main);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.theme-btn:hover {
  background: var(--border-color);
}

/* Main Layout */
.app-main {
  flex: 1;
  padding: 3rem 2rem;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
}

.section-title {
  margin-bottom: 2rem;
  display: flex;
  align-items: center;
}

.section-title h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-main);
}

/* Novel Grid (index.html) */
.novel-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.5rem;
}

.novel-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
  padding: 0;
  background: transparent;
  border: none;
  transition: transform 0.3s var(--ease-soft);
}

.novel-card:hover {
  transform: translateY(-6px);
}

.card-cover {
  width: 100%;
  aspect-ratio: 3/4;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border-color);
  position: relative;
}

.card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s var(--ease-soft);
}

.novel-card:hover .card-cover {
  box-shadow: var(--shadow-md);
}

.novel-card:hover .card-cover img {
  transform: scale(1.03);
}

.card-info-wrapper {
  padding: 0.2rem 0;
}

.genre-tag {
  display: inline-block;
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(0, 220, 100, 0.1);
  color: var(--primary-color);
  font-weight: 700;
  margin-bottom: 0.4rem;
}

.card-title {
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 0.3rem;
  color: var(--text-main);
}

.card-author {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Novel Info Hero (novel.html) */
.novel-hero {
  display: flex;
  gap: 2.5rem;
  padding: 2.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  margin-bottom: 3rem;
}

.hero-cover {
  width: 220px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
}

.hero-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-details {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hero-title {
  font-size: 2.2rem;
  font-weight: 800;
  margin-bottom: 1rem;
  color: var(--text-main);
}

.hero-meta {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  color: var(--text-muted);
  font-size: 1rem;
  align-items: center;
}

.hero-meta .genre {
  display: inline-block;
  font-size: 0.85rem;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  background: rgba(0, 220, 100, 0.1);
  color: var(--primary-color);
  font-weight: 700;
}

.hero-meta .divider {
  color: var(--border-color);
}

.hero-desc {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-muted);
}

/* Episode List */
.episode-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.episode-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.5rem 2rem;
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
}

.episode-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
}

.sort-controls button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  margin-left: 1rem;
}

.sort-controls button.active {
  color: var(--text-main);
}

.episode-list {
  display: flex;
  flex-direction: column;
}

.episode-item {
  display: flex;
  align-items: center;
  padding: 1.2rem 2rem;
  text-decoration: none;
  color: var(--text-main);
  border-bottom: 1px solid var(--border-color);
  background: var(--bg-card);
  transition: background 0.2s;
}

.episode-item:last-child {
  border-bottom: none;
}

.episode-item:hover {
  background: var(--bg-hover);
}

.ep-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-muted);
  width: 50px;
}

.ep-title {
  flex: 1;
  font-size: 1.05rem;
  font-weight: 600;
}

.ep-date {
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* Reader (reader.html) */
.reader-container {
  max-width: 720px;
  margin: 0 auto;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3rem 4rem;
  box-shadow: var(--shadow-sm);
}

.reader-header {
  text-align: center;
  margin-bottom: 3rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
}

.reader-title {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
}

.reader-content {
  font-size: 1.15rem; /* Standard comfortable reading size */
  line-height: 2.1;   /* Generous line height for reading */
  color: var(--text-main);
  white-space: pre-wrap;
  word-break: keep-all;
  text-align: left;
}

.reader-nav {
  display: flex;
  justify-content: space-between;
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
}

.nav-btn {
  padding: 0.8rem 1.8rem;
  background: var(--primary-color);
  color: var(--text-inverse);
  text-decoration: none;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 1rem;
  transition: background 0.2s;
}

.nav-btn:hover {
  background: var(--primary-hover);
}

.nav-btn.secondary {
  background: var(--bg-hover);
  color: var(--text-main);
}

.nav-btn.secondary:hover {
  background: var(--border-color);
}

/* Admin Specific */
.admin-container {
  max-width: 1000px;
  margin: 3rem auto;
}
.admin-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 2.5rem;
  margin-bottom: 2rem;
  box-shadow: var(--shadow-sm);
}
.admin-btn {
  padding: 1rem 2rem;
  background: var(--primary-color);
  color: var(--text-inverse);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 0.2s;
}
.admin-btn:hover {
  background: var(--primary-hover);
}
.admin-btn:active {
  transform: scale(0.98);
}

/* Mobile Responsiveness */
@media (max-width: 768px) {
  .header-content {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem;
  }
  .nav-links {
    gap: 1rem;
  }
  .app-main {
    padding: 1.5rem 1rem;
  }
  .novel-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    gap: 1rem;
  }
  .novel-hero {
    flex-direction: column;
    padding: 1.5rem;
    align-items: center;
    text-align: center;
  }
  .hero-cover {
    width: 160px;
  }
  .hero-meta {
    justify-content: center;
    flex-wrap: wrap;
  }
  .episode-header {
    flex-direction: column;
    gap: 1rem;
    align-items: flex-start;
    padding: 1rem;
  }
  .sort-controls {
    margin-left: 0;
  }
  .episode-item {
    padding: 1rem;
  }
  .ep-title {
    font-size: 0.95rem;
  }
  .reader-container {
    padding: 1.5rem 1rem;
    border-radius: 0;
    border-left: none;
    border-right: none;
  }
  .reader-title {
    font-size: 1.4rem;
  }
  .reader-content {
    font-size: 1.05rem;
  }
  .reader-nav {
    flex-wrap: wrap;
    gap: 0.5rem;
  }
  .nav-btn {
    padding: 0.8rem 1rem;
    font-size: 0.95rem;
    flex: 1 1 auto;
    text-align: center;
  }
}
