.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.78);
  display: grid;
  place-items: center;
  z-index: 100;
  animation: fade-in 0.2s ease-out;
}
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--color-cream);
  color: var(--color-dark);
  border-radius: 16px;
  padding: 0;
  max-width: 400px;
  width: calc(100vw - 32px);
  position: relative;
  box-shadow: var(--shadow-deep);
  animation: scale-in 0.3s var(--ease-bounce);
  max-height: 88vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
@keyframes scale-in {
  from { transform: scale(0.92); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.modal-close {
  position: absolute;
  top: 12px; right: 16px;
  font-size: 22px;
  color: var(--color-dark);
  opacity: 0.45;
  z-index: 5;
  width: 32px; height: 32px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(244, 229, 217, 0.7);
}
.modal-close:hover { opacity: 1; background: var(--color-orange); color: var(--color-cream); }

/* === Modal body — 전체 스크롤 가능 === */
.modal-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(218, 119, 86, 0.5) transparent;
}
.modal-body::-webkit-scrollbar {
  width: 8px;
}
.modal-body::-webkit-scrollbar-track {
  background: transparent;
}
.modal-body::-webkit-scrollbar-thumb {
  background: rgba(218, 119, 86, 0.4);
  border-radius: 4px;
}
.modal-body::-webkit-scrollbar-thumb:hover {
  background: rgba(218, 119, 86, 0.7);
}

.modal-head {
  padding: 24px 28px 16px;
  text-align: left;
}
.modal .ep-no {
  font-size: 13px;
  letter-spacing: 0.2em;
  color: var(--color-orange);
  font-weight: 700;
}
.modal h2 {
  font-size: 26px;
  margin: 4px 0 6px;
  letter-spacing: -0.02em;
  word-break: keep-all;
}
.modal .subtitle {
  font-size: 14px;
  opacity: 0.65;
}

/* === Cardnews 가로 캐러셀 + 화살표 버튼 === */
.cardnews-section {
  position: relative;
}
.cn-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: rgba(20, 20, 20, 0.78);
  color: var(--color-cream);
  font-size: 14px;
  display: grid;
  place-items: center;
  z-index: 8;
  cursor: pointer;
  transition: background 0.2s, transform 0.2s, opacity 0.2s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.4);
  user-select: none;
}
.cn-arrow:hover { background: var(--color-orange); transform: translateY(-50%) scale(1.1); }
.cn-arrow:disabled { opacity: 0.3; cursor: default; transform: translateY(-50%) scale(1); }
.cn-prev { left: 6px; }
.cn-next { right: 6px; }
.cardnews-counter {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 20, 20, 0.78);
  color: var(--color-cream);
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 12px;
  z-index: 8;
  letter-spacing: 0.05em;
}

.cardnews-carousel {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  -ms-overflow-style: none;
  background: var(--color-dark);
  padding: 12px;
  gap: 12px;
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
}
.cardnews-carousel.is-dragging {
  cursor: grabbing;
  scroll-snap-type: none;
  scroll-behavior: auto;
}
.cardnews-carousel::-webkit-scrollbar { display: none; }
.cardnews-carousel img {
  flex: 0 0 100%;
  width: 100%;
  height: auto;
  scroll-snap-align: center;
  border-radius: 10px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  pointer-events: auto;
}

.cardnews-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  padding: 12px 0 8px;
  background: var(--color-dark);
}
.cardnews-dots .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(244, 229, 217, 0.25);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.cardnews-dots .dot:hover { transform: scale(1.3); }
.cardnews-dots .dot.active {
  background: var(--color-orange);
  transform: scale(1.4);
}

/* === Body text === */
.modal-body-text {
  padding: 20px 28px 28px;
  overflow-y: auto;
}
.modal .preview {
  margin: 0 0 8px;
  font-style: italic;
  font-size: 15px;
  line-height: 1.5;
}
.modal .meta {
  font-size: 12px;
  opacity: 0.55;
  margin-bottom: 18px;
}
.modal .read-btn {
  display: block;
  width: 100%;
  background: var(--color-orange);
  color: var(--color-cream);
  font-weight: 800;
  padding: 14px;
  border-radius: 12px;
  text-align: center;
  font-size: 15px;
  letter-spacing: -0.01em;
  transition: transform var(--dur-fast), box-shadow var(--dur-fast);
  box-shadow: 0 6px 14px rgba(218, 119, 86, 0.25);
}
.modal .read-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(218, 119, 86, 0.4);
}
.modal .completed-note {
  margin-top: 12px;
  text-align: center;
  font-size: 13px;
  color: var(--color-orange);
  font-weight: 700;
}
.modal .notion-pending {
  margin: 0;
  padding: 14px;
  text-align: center;
  font-size: 13px;
  color: var(--color-dark);
  opacity: 0.4;
  background: rgba(20, 20, 20, 0.05);
  border-radius: 10px;
  font-weight: 600;
}
.modal .mark-done-btn {
  display: block;
  width: 100%;
  margin-top: 8px;
  background: var(--color-cream);
  color: var(--color-dark);
  border: 2px solid var(--color-orange);
  font-weight: 800;
  padding: 12px;
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  letter-spacing: -0.01em;
  transition: transform var(--dur-fast), background var(--dur-fast), color var(--dur-fast);
  cursor: pointer;
}
.modal .mark-done-btn:hover {
  background: var(--color-orange);
  color: var(--color-cream);
  transform: translateY(-2px);
}

/* 모바일 */
@media (max-width: 768px) {
  .modal { width: calc(100vw - 16px); border-radius: 14px; }
  .modal-head { padding: 18px 20px 12px; }
  .modal h2 { font-size: 22px; }
  .modal-body-text { padding: 16px 20px 20px; }
}
