/* ============================================================
   Spotify-Inspired Dark Theme for Manga Site
   Design: Content-first darkness, manga-red accent
   ============================================================ */

:root {
  --bg-base:        #121212;
  --bg-surface:     #181818;
  --bg-interactive: #1f1f1f;
  --bg-card:        #242424;
  --bg-hover:       #2a2a2a;

  --accent:         #e63946;
  --accent-hover:   #c1121f;
  --accent-dim:     rgba(230,57,70,0.15);

  --text-primary:   #ffffff;
  --text-secondary: #b3b3b3;
  --text-muted:     #6a6a6a;

  --border:         #2a2a2a;
  --border-light:   #3a3a3a;

  --radius-sm:      4px;
  --radius-md:      8px;
  --radius-lg:      12px;
  --radius-pill:    9999px;

  --shadow-card:    rgba(0,0,0,0.4) 0px 8px 24px;
  --shadow-hover:   rgba(0,0,0,0.6) 0px 12px 32px;

  --nav-height:     64px;
  --content-width:  1200px;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  background: var(--bg-base);
  color: var(--text-primary);
  font-family: -apple-system, 'Noto Sans TC', 'Segoe UI', Helvetica, Arial, sans-serif;
  line-height: 1.5;
  min-height: 100vh;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
ul, ol { list-style: none; }

/* ── Layout ── */
.sp-container {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: 0 24px;
}

/* ── Navigation ── */
.sp-nav {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--nav-height);
  background: rgba(18,18,18,0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
}
.sp-nav .sp-container {
  display: flex;
  align-items: center;
  gap: 32px;
  width: 100%;
}
.sp-nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
  letter-spacing: -0.5px;
  flex-shrink: 0;
}
.sp-nav-logo span { color: var(--text-primary); }
.sp-nav-links {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.sp-nav-link {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 400;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.sp-nav-link:hover, .sp-nav-link.active {
  color: var(--text-primary);
  background: var(--bg-interactive);
}
.sp-search {
  flex: 1;
  max-width: 320px;
  position: relative;
}
.sp-search input {
  width: 100%;
  background: var(--bg-interactive);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-pill);
  padding: 8px 16px 8px 36px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.sp-search input::placeholder { color: var(--text-muted); }
.sp-search input:focus { border-color: var(--text-secondary); }
.sp-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 14px;
  pointer-events: none;
}
.sp-nav-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.sp-nav-right a {
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.sp-nav-right a:hover { color: var(--text-primary); background: var(--bg-interactive); }
.sp-nav-right .sp-btn-accent {
  background: var(--accent);
  color: #fff;
  font-weight: 700;
}
.sp-nav-right .sp-btn-accent:hover { background: var(--accent-hover); }

/* ── Buttons ── */
.sp-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 24px;
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-transform: uppercase;
  letter-spacing: 1.4px;
}
.sp-btn-primary {
  background: var(--accent);
  color: #fff;
}
.sp-btn-primary:hover { background: var(--accent-hover); transform: scale(1.02); }
.sp-btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-light);
}
.sp-btn-secondary:hover { background: var(--bg-hover); border-color: var(--text-secondary); }
.sp-btn-ghost {
  background: var(--bg-interactive);
  color: var(--text-primary);
}
.sp-btn-ghost:hover { background: var(--bg-hover); }
.sp-btn-sm { padding: 6px 16px; font-size: 12px; letter-spacing: 1px; }
.sp-btn-lg { padding: 14px 36px; font-size: 16px; }

/* ── Hero Banner ── */
.sp-hero {
  position: relative;
  height: 380px;
  overflow: hidden;
  background: var(--bg-surface);
}
.sp-hero-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center top;
  filter: blur(2px) brightness(0.3);
  transform: scale(1.05);
}
.sp-hero-content {
  position: relative;
  z-index: 1;
  height: 100%;
  display: flex;
  align-items: center;
}
.sp-hero-cards {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 0 4px;
  scrollbar-width: none;
}
.sp-hero-cards::-webkit-scrollbar { display: none; }
.sp-hero-card {
  flex-shrink: 0;
  width: 160px;
  border-radius: var(--radius-md);
  overflow: hidden;
  box-shadow: var(--shadow-card);
  transition: transform 0.2s, box-shadow 0.2s;
}
.sp-hero-card:hover { transform: translateY(-4px) scale(1.02); box-shadow: var(--shadow-hover); }
.sp-hero-card img { width: 100%; height: 220px; object-fit: cover; }
.sp-hero-card-info {
  padding: 10px 12px;
  background: var(--bg-surface);
}
.sp-hero-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Section Headers ── */
.sp-section {
  padding: 32px 0 16px;
}
.sp-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.sp-section-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
}
.sp-section-title::before {
  content: '';
  display: inline-block;
  width: 4px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
  margin-right: 10px;
  vertical-align: middle;
}
.sp-section-more {
  font-size: 13px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
  font-weight: 700;
  transition: color 0.15s;
}
.sp-section-more:hover { color: var(--text-primary); }

/* ── Manga Grid ── */
.sp-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}
.sp-grid-5 { grid-template-columns: repeat(5, 1fr); }
.sp-grid-4 { grid-template-columns: repeat(4, 1fr); }

.sp-card {
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  overflow: hidden;
  transition: background 0.2s, transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}
.sp-card:hover {
  background: var(--bg-card);
  transform: translateY(-4px);
  box-shadow: var(--shadow-card);
}
.sp-card-cover {
  position: relative;
  width: 100%;
  padding-top: 140%;
  overflow: hidden;
  background: var(--bg-interactive);
}
.sp-card-cover img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s;
}
.sp-card:hover .sp-card-cover img { transform: scale(1.04); }
.sp-card-badge {
  position: absolute;
  bottom: 6px;
  right: 6px;
  background: rgba(0,0,0,0.75);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.sp-card-lock {
  position: absolute;
  top: 6px;
  right: 6px;
  background: rgba(230,57,70,0.85);
  color: #fff;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  font-weight: 700;
}
.sp-card-body {
  padding: 10px 12px 12px;
}
.sp-card-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.sp-card-desc {
  font-size: 12px;
  color: var(--text-secondary);
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}

/* ── Rank List ── */
.sp-rank-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sp-rank-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  transition: background 0.15s;
}
.sp-rank-item:hover { background: var(--bg-card); }
.sp-rank-num {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-muted);
  width: 28px;
  text-align: center;
  flex-shrink: 0;
}
.sp-rank-item:nth-child(1) .sp-rank-num { color: var(--accent); }
.sp-rank-item:nth-child(2) .sp-rank-num { color: #b3b3b3; }
.sp-rank-item:nth-child(3) .sp-rank-num { color: #cd7f32; }
.sp-rank-cover {
  width: 48px;
  height: 64px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.sp-rank-cover img { width: 100%; height: 100%; object-fit: cover; }
.sp-rank-info { flex: 1; min-width: 0; }
.sp-rank-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 4px;
}
.sp-rank-desc {
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── Tags ── */
.sp-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 16px 0;
}
.sp-tag {
  padding: 6px 16px;
  background: var(--bg-interactive);
  border-radius: var(--radius-pill);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
}
.sp-tag:hover, .sp-tag.active {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid var(--accent);
}

/* ── Book Detail Page ── */
.sp-book-hero {
  padding: 40px 0 32px;
}
.sp-book-hero-inner {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}
.sp-book-cover {
  flex-shrink: 0;
  width: 200px;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}
.sp-book-cover img { width: 100%; display: block; }
.sp-book-info { flex: 1; }
.sp-book-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 8px;
  line-height: 1.2;
}
.sp-book-author {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 16px;
}
.sp-book-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
}
.sp-book-tag {
  padding: 4px 12px;
  background: var(--bg-interactive);
  border-radius: var(--radius-pill);
  font-size: 12px;
  color: var(--text-secondary);
}
.sp-book-summary {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.7;
  margin-bottom: 24px;
  max-width: 560px;
}
.sp-book-meta {
  display: flex;
  gap: 24px;
  margin-bottom: 24px;
}
.sp-book-meta-item { font-size: 14px; color: var(--text-secondary); }
.sp-book-meta-item span { color: var(--text-primary); font-weight: 600; }
.sp-book-actions { display: flex; gap: 12px; }

/* ── Chapter List ── */
.sp-chapters {
  padding: 24px 0;
}
.sp-chapter-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
}
.sp-chapter-item {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border-radius: var(--radius-md);
  font-size: 13px;
  color: var(--text-secondary);
  transition: all 0.15s;
  border: 1px solid transparent;
}
.sp-chapter-item:hover {
  background: var(--bg-card);
  color: var(--text-primary);
  border-color: var(--border-light);
}
.sp-chapter-item.locked {
  color: var(--text-muted);
  cursor: pointer;
}
.sp-chapter-item.locked:hover {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.sp-chapter-lock {
  font-size: 11px;
  flex-shrink: 0;
}

/* ── Pay Wall ── */
.sp-paywall {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.sp-paywall-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  max-width: 480px;
  width: 100%;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}
.sp-paywall-icon {
  font-size: 56px;
  margin-bottom: 20px;
  display: block;
}
.sp-paywall-book {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 6px;
}
.sp-paywall-chapter {
  font-size: 16px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}
.sp-paywall-desc {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 32px;
}
.sp-paywall-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.sp-paywall-register {
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
}
.sp-paywall-register a { color: var(--accent); }

/* ── Buy Chapter ── */
.sp-buy-box {
  max-width: 560px;
  margin: 60px auto;
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.sp-buy-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 24px;
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  transition: all 0.15s;
}
.sp-buy-back:hover { background: var(--bg-interactive); color: var(--text-primary); }
.sp-buy-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.sp-buy-info {
  display: flex;
  gap: 20px;
  margin-bottom: 28px;
  align-items: flex-start;
}
.sp-buy-cover {
  width: 80px;
  height: 110px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.sp-buy-cover img { width: 100%; height: 100%; object-fit: cover; }
.sp-buy-details { flex: 1; }
.sp-buy-book { font-size: 16px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.sp-buy-chapter { font-size: 14px; color: var(--text-secondary); margin-bottom: 12px; }
.sp-buy-price {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}
.sp-buy-currency { font-size: 14px; color: var(--text-secondary); margin-left: 4px; }
.sp-buy-confirm { width: 100%; }
.sp-buy-note { margin-top: 12px; font-size: 12px; color: var(--text-muted); text-align: center; }

/* ── Feedback / Payment Result ── */
.sp-result {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.sp-result-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 48px 40px;
  text-align: center;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-card);
  border: 1px solid var(--border);
}
.sp-result-icon { font-size: 56px; margin-bottom: 20px; display: block; }
.sp-result-title { font-size: 24px; font-weight: 700; color: var(--text-primary); margin-bottom: 8px; }
.sp-result-msg { font-size: 14px; color: var(--text-secondary); margin-bottom: 28px; line-height: 1.6; }
.sp-result-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: sp-spin 0.8s linear infinite;
  margin: 0 auto 20px;
}
@keyframes sp-spin { to { transform: rotate(360deg); } }

/* ── UCenter ── */
.sp-ucenter {
  max-width: 760px;
  margin: 48px auto;
  padding: 0 24px;
}
.sp-ucenter-title {
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 32px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sp-ucenter-title::before {
  content: '';
  width: 4px;
  height: 28px;
  background: var(--accent);
  border-radius: 2px;
  display: block;
}
.sp-ucenter-card {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  overflow: hidden;
  margin-bottom: 16px;
}
.sp-ucenter-row {
  display: flex;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
.sp-ucenter-row:last-child { border-bottom: none; }
.sp-ucenter-label {
  width: 130px;
  font-size: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.sp-ucenter-value {
  flex: 1;
  font-size: 14px;
  color: var(--text-primary);
  word-break: break-all;
}
.sp-ucenter-value.uuid { font-size: 12px; color: var(--text-muted); font-family: monospace; }
.sp-ucenter-action { margin-left: auto; }

/* ── Buy History ── */
.sp-history-item {
  display: flex;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  transition: background 0.15s;
}
.sp-history-item:last-child { border-bottom: none; }
.sp-history-item:hover { background: var(--bg-interactive); }
.sp-history-cover {
  width: 64px;
  height: 88px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  flex-shrink: 0;
}
.sp-history-cover img { width: 100%; height: 100%; object-fit: cover; }
.sp-history-info { flex: 1; min-width: 0; }
.sp-history-book { font-size: 15px; font-weight: 600; color: var(--text-primary); margin-bottom: 4px; }
.sp-history-chapter { font-size: 13px; color: var(--accent); margin-bottom: 6px; }
.sp-history-meta { font-size: 12px; color: var(--text-muted); }
.sp-empty {
  text-align: center;
  padding: 60px 0;
  color: var(--text-muted);
  font-size: 16px;
}

/* ── Auth Pages ── */
.sp-auth {
  min-height: calc(100vh - var(--nav-height));
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.sp-auth-box {
  background: var(--bg-surface);
  border-radius: var(--radius-lg);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-card);
}
.sp-auth-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 28px;
  text-align: center;
}
.sp-form-group { margin-bottom: 16px; }
.sp-form-label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; font-weight: 600; letter-spacing: 0.5px; }
.sp-form-input {
  width: 100%;
  background: var(--bg-interactive);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}
.sp-form-input:focus { border-color: var(--accent); }
.sp-form-input::placeholder { color: var(--text-muted); }
.sp-form-submit { width: 100%; margin-top: 8px; }
.sp-form-tip { margin-top: 6px; font-size: 12px; color: var(--text-muted); min-height: 18px; }
.sp-form-tip.error { color: var(--accent); }
.sp-auth-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: var(--text-muted);
}
.sp-auth-footer a { color: var(--accent); }

/* ── Footer ── */
.sp-footer {
  border-top: 1px solid var(--border);
  padding: 24px 0;
  margin-top: 48px;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
}

/* ── Alert / Dialog ── */
.alertTop_1 {
  position: fixed;
  top: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 12px 24px;
  z-index: 9999;
  box-shadow: var(--shadow-card);
}
.alertTop_1 p { color: var(--text-primary); font-size: 14px; }

/* ── Responsive ── */
@media (max-width: 1100px) {
  .sp-grid { grid-template-columns: repeat(5, 1fr); }
  .sp-chapter-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 900px) {
  .sp-grid { grid-template-columns: repeat(4, 1fr); }
  .sp-book-hero-inner { flex-direction: column; }
  .sp-book-cover { width: 160px; }
  .sp-chapter-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 680px) {
  .sp-grid { grid-template-columns: repeat(3, 1fr); }
  .sp-nav-links { display: none; }
  .sp-nav-right { display: none; }
  .sp-chapter-grid { grid-template-columns: repeat(2, 1fr); }
}
