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

:root {
  --primary: #1428A0;
  --primary-light: #4a6cf7;
  --accent: #FFD700;
  --bg: #f0f2f8;
  --card-bg: #ffffff;
  --text: #1a1a2e;
  --text-muted: #666;
  --radius: 12px;
  --shadow: 0 4px 20px rgba(0,0,0,0.08);
}

body {
  font-family: 'Inter', 'Noto Sans KR', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Navbar */
.navbar {
  background: var(--primary);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2);
}
.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.logo-icon { font-size: 24px; }
.logo-text { color: #fff; font-size: 20px; font-weight: 700; letter-spacing: -0.5px; }
.nav-right { display: flex; align-items: center; gap: 16px; }
.nav-badge {
  background: rgba(255,255,255,0.2);
  color: #fff;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}
.nav-link {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 6px 4px;
  transition: color 0.2s;
}
.nav-link:hover { color: #fff; }
.nav-status {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(255,255,255,0.85);
  font-size: 13px;
}
.pulse {
  width: 8px; height: 8px;
  background: #4eff91;
  border-radius: 50%;
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(1.3); }
}

/* Hero */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, #0a0f4a 100%);
  color: #fff;
  padding: 60px 24px;
}
.hero-inner { max-width: 1200px; margin: 0 auto; text-align: center; }
.hero-eyebrow {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: rgba(255,255,255,0.6);
  margin-bottom: 14px;
}
.hero-eyebrow a { color: var(--accent); text-decoration: none; }
.hero-eyebrow a:hover { text-decoration: underline; }
.hero h1 { font-size: clamp(24px, 4vw, 40px); font-weight: 700; margin-bottom: 12px; }
.hero-sub { font-size: 16px; color: rgba(255,255,255,0.75); margin-bottom: 36px; }

.stats-row {
  display: flex;
  gap: 16px;
  justify-content: center;
  flex-wrap: wrap;
}
.stat-card {
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(255,255,255,0.2);
  border-radius: var(--radius);
  padding: 20px 28px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 100px;
}
.stat-num { font-size: 32px; font-weight: 700; color: var(--accent); }
.stat-label { font-size: 12px; color: rgba(255,255,255,0.7); }

/* Books section */
.books-section { flex: 1; padding: 40px 24px; }
.section-inner { max-width: 1200px; margin: 0 auto; }
.section-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 28px;
  flex-wrap: wrap;
  gap: 8px;
}
.section-header h2 { font-size: 22px; font-weight: 600; }
.last-gen { font-size: 13px; color: var(--text-muted); }
.section-header-right { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.btn-upload {
  background: var(--primary);
  color: #fff;
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 20px;
  transition: background 0.2s;
}
.btn-upload:hover { background: #0f1f7a; }

/* Upload form */
.upload-form { display: flex; flex-direction: column; gap: 18px; }
.upload-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 36px 20px;
  border: 2px dashed #c4cbe0;
  border-radius: var(--radius);
  background: var(--card-bg);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.upload-drop:hover { border-color: var(--primary-light); background: #fbfcff; }
.upload-drop input[type=file] { font-size: 13px; }
.upload-drop-icon { font-size: 34px; }
.upload-drop-text { font-size: 13px; color: var(--text-muted); }
.upload-field { display: flex; flex-direction: column; gap: 6px; }
.upload-field span { font-size: 13px; font-weight: 600; }
.upload-field input {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid #d3d8e8;
  border-radius: 10px;
  outline: none;
}
.upload-field input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}
.upload-note { margin-top: 18px; font-size: 12px; color: var(--text-muted); line-height: 1.7; }

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

.book-card {
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  transition: transform 0.2s, box-shadow 0.2s;
}
.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.14);
}

.book-cover {
  aspect-ratio: 2/3;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 16px 12px 12px;
  position: relative;
}
.book-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, transparent 40%, rgba(0,0,0,0.5));
}
.book-cover-title {
  font-size: 13px;
  font-weight: 600;
  color: #fff;
  line-height: 1.4;
  position: relative;
  z-index: 1;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-cover-author {
  font-size: 10px;
  color: rgba(255,255,255,0.7);
  margin-top: 4px;
  position: relative;
  z-index: 1;
}
.book-lang-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 600;
  z-index: 1;
}
.badge-ko { background: #e8f4fd; color: #1428A0; }
.badge-en { background: #fff3cd; color: #856404; }

.book-meta { padding: 12px; }
.book-category {
  font-size: 10px;
  color: var(--primary-light);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}
.book-title-sm {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 6px;
}
.book-date { font-size: 10px; color: var(--text-muted); }

/* Empty state */
.empty-state {
  text-align: center;
  padding: 80px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 16px; }
.empty-state h3 { font-size: 20px; margin-bottom: 8px; color: var(--text); }

/* Book detail */
.book-detail { max-width: 800px; margin: 0 auto; }
.book-detail-cover {
  padding: 60px 40px;
  position: relative;
  overflow: hidden;
}
.book-detail-cover::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, transparent, rgba(0,0,0,0.3));
}
.detail-cover-inner { position: relative; z-index: 1; }
.detail-lang-badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
}
.detail-title {
  font-size: clamp(24px, 4vw, 36px);
  font-weight: 700;
  color: #fff;
  margin-bottom: 10px;
  line-height: 1.3;
}
.detail-subtitle { font-size: 16px; color: rgba(255,255,255,0.8); margin-bottom: 12px; }
.detail-author { font-size: 14px; color: rgba(255,255,255,0.65); }

.book-detail-body {
  background: var(--card-bg);
  padding: 36px 40px;
}
.detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.meta-tag {
  background: var(--bg);
  color: var(--primary);
  padding: 4px 14px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
}
.meta-date { font-size: 13px; color: var(--text-muted); }
.detail-description h2 { font-size: 18px; margin-bottom: 12px; }
.detail-description p { line-height: 1.8; color: #444; }
.download-section {
  margin-top: 36px;
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}
.btn-download {
  background: var(--primary);
  color: #fff;
  padding: 14px 28px;
  border-radius: var(--radius);
  text-decoration: none;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s;
}
.btn-download:hover { background: #0f1f7a; }
.btn-back {
  color: var(--text-muted);
  padding: 14px 20px;
  border-radius: var(--radius);
  text-decoration: none;
  font-size: 15px;
  border: 1px solid #ddd;
  transition: background 0.2s;
}
.btn-back:hover { background: var(--bg); }
.delete-form { margin: 0; }
.btn-delete {
  font: inherit;
  font-weight: 600;
  font-size: 15px;
  color: #b3261e;
  background: #fff;
  border: 1px solid #f1c4c0;
  padding: 14px 24px;
  border-radius: var(--radius);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background 0.2s, border-color 0.2s;
}
.btn-delete:hover { background: #fdecec; border-color: #e8a39d; }

/* Card delete (grid) */
.book-card-wrap { position: relative; }
.card-delete-form { position: absolute; top: 8px; left: 8px; z-index: 3; margin: 0; }
.card-delete {
  width: 30px; height: 30px;
  border: none;
  border-radius: 50%;
  background: rgba(0,0,0,0.45);
  color: #fff;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.book-card-wrap:hover .card-delete { opacity: 1; }
.card-delete:hover { background: #b3261e; }
@media (hover: none) {
  .card-delete { opacity: 1; }
}

/* Footer */
.footer {
  text-align: center;
  padding: 24px;
  background: #1a1a2e;
  color: rgba(255,255,255,0.5);
  font-size: 13px;
  margin-top: auto;
}
.footer-sub { margin-top: 4px; font-size: 11px; }

/* Hub — services grid */
.services-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}
.service-card {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}
.service-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 32px rgba(0,0,0,0.14);
}
.service-icon {
  flex: 0 0 auto;
  width: 56px; height: 56px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  color: #fff;
}
.service-body { min-width: 0; }
.service-name {
  font-size: 17px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}
.service-tagline { font-size: 13px; color: var(--text-muted); line-height: 1.5; }
.service-status {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 10px;
}
.status-live { background: #e3fcef; color: #0a7d4b; }
.service-card--soon {
  border: 2px dashed #d3d8e8;
  background: transparent;
  box-shadow: none;
  cursor: default;
}
.service-card--soon:hover { transform: none; box-shadow: none; }
.service-icon--soon { background: #e7eaf4; color: #9aa3bd; font-weight: 300; }

/* About — prose */
.prose { max-width: 760px; }
.prose h2 {
  font-size: 19px;
  font-weight: 700;
  margin: 32px 0 12px;
  color: var(--primary);
}
.prose > h2:first-child { margin-top: 0; }
.prose p { line-height: 1.85; color: #444; margin-bottom: 8px; }
.about-services { margin: 8px 0 4px; }
.about-service-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  text-decoration: none;
  color: inherit;
  margin-bottom: 12px;
  transition: transform 0.15s;
}
.about-service-row:hover { transform: translateX(4px); }
.about-service-icon {
  flex: 0 0 auto;
  width: 44px; height: 44px;
  border-radius: 11px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; color: #fff;
}
.about-service-text { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.about-service-text strong { font-size: 15px; }
.about-service-text span { font-size: 12px; color: var(--text-muted); }
.about-cta { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 32px; }

.nav-link--auth {
  background: rgba(255,255,255,0.16);
  border-radius: 16px;
  padding: 6px 14px;
}
.nav-link--auth:hover { background: rgba(255,255,255,0.28); }

/* Login */
.auth-section {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 60px 20px;
  background: linear-gradient(135deg, var(--primary) 0%, #0a0f4a 100%);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--card-bg);
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.28);
  padding: 36px 32px;
}
.auth-head { text-align: center; margin-bottom: 24px; }
.auth-icon { font-size: 36px; }
.auth-head h1 { font-size: 24px; font-weight: 700; margin: 10px 0 6px; }
.auth-head p { font-size: 13px; color: var(--text-muted); }
.auth-error {
  background: #fdecec;
  color: #b3261e;
  font-size: 13px;
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 18px;
  text-align: center;
}
.auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; }
.auth-form label span { font-size: 13px; font-weight: 600; color: var(--text); }
.auth-form input {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid #d3d8e8;
  border-radius: 10px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.auth-form input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(74,108,247,0.15);
}
.auth-btn {
  font: inherit;
  font-weight: 700;
  color: #fff;
  background: var(--primary);
  border: none;
  border-radius: 10px;
  padding: 13px;
  cursor: pointer;
  margin-top: 4px;
  transition: background 0.2s;
}
.auth-btn:hover { background: #0f1f7a; }
.auth-back {
  display: block;
  text-align: center;
  margin-top: 18px;
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}
.auth-back:hover { color: var(--text); }

/* Responsive */
@media (max-width: 600px) {
  .books-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
  .book-detail-body { padding: 24px 20px; }
  .book-detail-cover { padding: 40px 20px; }
  .services-grid { grid-template-columns: 1fr; }
  .nav-right { gap: 10px; }
  .nav-link { font-size: 13px; }
}
