/* ── Ending Toast ──────────────────────────────────────────────── */
.sg-ending-toast {
  position: fixed;
  bottom: -64px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  padding: 10px 20px 11px;
  border: 1px solid rgba(212, 169, 106, 0.45);
  border-radius: 8px;
  background: rgba(9, 8, 6, 0.96);
  backdrop-filter: blur(8px);
  box-shadow: 0 6px 28px rgba(0, 0, 0, 0.65);
  color: #f0e8d8;
  font-family: 'Song Myung', 'Noto Serif KR', serif;
  font-size: 15px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: bottom 0.38s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.38s ease;
}

.sg-ending-toast.show {
  bottom: 28px;
  opacity: 1;
}

.sg-ending-toast.hide {
  bottom: -64px;
  opacity: 0;
  transition: bottom 0.38s ease, opacity 0.38s ease;
}

/* ── Ending Book Modal ─────────────────────────────────────────── */
.sg-book-overlay {
  position: fixed;
  inset: 0;
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: rgba(4, 5, 7, 0.88);
  backdrop-filter: blur(4px);
  animation: sgFadeIn 0.18s ease;
}

@keyframes sgFadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.sg-book-card {
  width: min(380px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  border: 1px solid rgba(212, 169, 106, 0.28);
  border-radius: 10px;
  background: linear-gradient(180deg, #101318, #0d1014);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.72);
  display: flex;
  flex-direction: column;
}

.sg-book-hdr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 14px;
  border-bottom: 1px solid rgba(212, 169, 106, 0.14);
  flex-shrink: 0;
}

.sg-book-title {
  font-family: 'Song Myung', serif;
  font-size: 19px;
  font-weight: 400;
  color: #d4a96a;
}

.sg-book-progress {
  font-family: 'JetBrains Mono', 'Courier New', monospace;
  font-size: 13px;
  color: rgba(212, 169, 106, 0.65);
}

.sg-book-body {
  padding: 14px 20px 4px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  overflow-y: auto;
  flex: 1;
}

.sg-book-ep {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.sg-book-ep-title {
  font-family: 'Noto Serif KR', 'Song Myung', serif;
  font-size: 11.5px;
  color: rgba(212, 169, 106, 0.6);
  letter-spacing: 0.04em;
  padding-left: 9px;
  border-left: 2px solid rgba(212, 169, 106, 0.3);
  margin-bottom: 2px;
}

.sg-book-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 11px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-family: 'Noto Serif KR', serif;
  font-size: 14px;
  line-height: 1.4;
}

.sg-book-row.sg-got {
  border-color: rgba(212, 169, 106, 0.2);
  background: rgba(212, 169, 106, 0.055);
  color: #dbd5c9;
}

.sg-book-row.sg-locked {
  border-color: rgba(255, 255, 255, 0.04);
  background: rgba(255, 255, 255, 0.018);
  color: rgba(216, 209, 197, 0.22);
}

.sg-row-icon {
  width: 15px;
  flex-shrink: 0;
  font-size: 12px;
  text-align: center;
}

.sg-book-row.sg-got .sg-row-icon {
  color: #72a880;
}

.sg-book-row.sg-locked .sg-row-icon {
  color: rgba(216, 209, 197, 0.18);
}

.sg-book-close {
  display: block;
  width: calc(100% - 40px);
  margin: 16px 20px 18px;
  padding: 10px;
  flex-shrink: 0;
  border: 1px solid rgba(212, 169, 106, 0.3);
  border-radius: 7px;
  background: rgba(212, 169, 106, 0.08);
  color: #d4a96a;
  font-family: 'Noto Serif KR', serif;
  font-size: 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.sg-book-close:hover {
  background: rgba(212, 169, 106, 0.16);
}
