/* ── Card: Film ── */
.card-film {
  flex: 0 0 180px; border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none; color: inherit; display: block; position: relative;
}
.card-film:hover { transform: scale(1.04); box-shadow: 0 8px 24px rgba(26,22,18,0.15); }
.card-film-poster { aspect-ratio: 2/3; background: var(--bg-warm); position: relative; overflow: hidden; }
.card-film-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-film-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.05) 40%, transparent 60%); pointer-events: none; }
.card-film-info { position: absolute; bottom: 0; left: 0; right: 0; padding: 12px; }
.card-film-title { color: #fff; font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-film-meta { color: rgba(255,255,255,0.65); font-size: 11px; margin-top: 3px; }

/* YouTube badge */
.card-yt-badge {
  position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 4px; z-index: 2;
  background: #FF0000; color: #fff;
}

/* ── Card: YouTube ── */
.card-yt {
  flex: 0 0 260px; border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none; color: inherit; display: block; background: var(--surface);
}
.card-yt:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(26,22,18,0.12); }
.card-yt-thumb { aspect-ratio: 16/9; background: var(--bg-warm); overflow: hidden; position: relative; }
.card-yt-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-yt-duration {
  position: absolute; bottom: 6px; right: 6px;
  background: rgba(0,0,0,0.75); color: #fff; font-size: 11px; font-weight: 600;
  padding: 2px 6px; border-radius: 4px;
}
.card-yt-info { padding: 10px 12px; }
.card-yt-title { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-yt-channel { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Card: Series */
.card-series {
  flex: 0 0 180px; border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none; color: inherit; display: block; position: relative;
}
.card-series:hover { transform: scale(1.04); box-shadow: 0 8px 24px rgba(26,22,18,0.15); }
.card-series-poster { aspect-ratio: 2/3; background: var(--bg-warm); position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; }
.card-series-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-series-overlay { position: absolute; inset: 0; background: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0.05) 40%, transparent 60%); pointer-events: none; }
.card-series-info { position: absolute; bottom: 0; left: 0; right: 0; padding: 12px; }
.card-series-title { color: #fff; font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-series-meta { color: rgba(255,255,255,0.65); font-size: 11px; margin-top: 3px; }
.card-series-badge { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px; z-index: 2; background: rgba(193,127,62,0.9); color: #fff; }
.card-series-icon { position: absolute; top: 8px; right: 8px; font-size: 11px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px; z-index: 2; background: rgba(0,0,0,0.55); color: #fff; backdrop-filter: blur(4px); }
.card-series-placeholder { font-size: 28px; font-weight: 700; color: var(--muted); opacity: 0.3; }

/* Card: Audiobook */
.card-audiobook {
  flex: 0 0 160px; border-radius: var(--radius-sm); overflow: hidden;
  cursor: pointer; transition: transform 0.2s, box-shadow 0.2s;
  text-decoration: none; color: inherit; display: block; background: var(--surface);
}
.card-audiobook:hover { transform: translateY(-3px); box-shadow: 0 8px 24px rgba(26,22,18,0.12); }
.card-audiobook-cover { aspect-ratio: 2/3; background: var(--bg-warm); position: relative; overflow: hidden;
  display: flex; align-items: center; justify-content: center; }
.card-audiobook-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.card-audiobook-icon { position: absolute; top: 8px; right: 8px; font-size: 14px; background: rgba(0,0,0,0.5); padding: 3px 6px; border-radius: 4px; }
.card-audiobook-badge { position: absolute; top: 8px; left: 8px; font-size: 10px; font-weight: 700;
  padding: 3px 8px; border-radius: 6px; z-index: 2; background: rgba(193,127,62,0.9); color: #fff; }
.card-audiobook-info { padding: 10px 12px; }
.card-audiobook-title { font-size: 13px; font-weight: 600; line-height: 1.3; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-audiobook-author { font-size: 11px; color: var(--muted); margin-top: 3px; }
.card-audiobook-detail { font-size: 11px; color: var(--muted); margin-top: 2px; }
.card-audiobook-placeholder { font-size: 36px; }

/* ── Popup ── */
.popup-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; }
.popup-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(8px); }
.popup-content { position: relative; background: #fff; border-radius: 16px; max-width: 500px; width: 90%; padding: 28px; max-height: 85vh; overflow-y: auto; animation: popupFadeIn 0.2s ease; }
@keyframes popupFadeIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
.popup-close { position: absolute; top: 12px; right: 16px; background: none; border: none; font-size: 24px; cursor: pointer; color: var(--muted); line-height: 1; }
.popup-header { display: flex; gap: 16px; margin-bottom: 16px; }
.popup-poster { width: 120px; height: 180px; object-fit: cover; border-radius: 10px; flex-shrink: 0; }
.popup-poster--landscape { width: 220px; height: 124px; }
.popup-title { font-size: 20px; font-weight: 700; margin: 0 0 8px; }
.popup-meta { font-size: 13px; color: var(--muted); }
.popup-description { font-size: 14px; color: var(--muted); line-height: 1.6; margin: 0 0 16px; }
.popup-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 20px; }
.popup-tag { font-size: 11px; padding: 4px 10px; border-radius: 100px; background: var(--accent-light); color: var(--accent); font-weight: 500; }
.popup-actions { display: flex; gap: 10px; }
.popup-actions .popup-cta { flex: 1; }
.popup-cta { display: block; text-align: center; padding: 14px; border-radius: 12px; background: var(--accent); color: #fff; font-weight: 600; font-size: 15px; text-decoration: none; transition: background 0.2s; border: none; cursor: pointer; width: 100%; font-family: inherit; }
.popup-cta:hover { background: var(--accent-hover); }
.popup-cta--add { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.popup-cta--add:hover { background: var(--accent); color: #fff; }
.popup-cta--phrases { background: transparent; border: 1.5px solid var(--accent); color: var(--accent); }
.popup-cta--phrases:hover { background: var(--accent); color: #fff; }
.popup-pro-notice { background: #FFF3E0; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; display: flex; align-items: center; gap: 8px; }
.popup-ling { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.stat-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 4px 10px; border-radius: 100px; }
.stat-idiom { background: rgba(240,160,80,0.12); color: #d48a30; }
.stat-phrasal { background: rgba(80,160,240,0.12); color: #3088d0; }
.stat-expression { background: rgba(192,128,224,0.12); color: #9060b0; }

/* CW-card link wrapper for middle-click / Cmd+Click */
.cw-card-link { display: block; text-decoration: none; color: inherit; }
.cw-card-link:hover { text-decoration: none; }

/* Progress overlay on poster (used in /me/ CW) */
.cw-progress-overlay {
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 5px; background: rgba(0,0,0,0.3);
  z-index: 5; pointer-events: none;
}
.cw-progress-overlay-fill { height: 100%; background: var(--accent, #C17F3E); }

/* S×E badge over the poster (hotfix CW-dedup, /me/ rail).
   Poster wrappers (.card-*-poster) are position:relative — badge anchors
   to the top-left corner, above the progress overlay (z:6 > 5). */
.cw-ep-badge {
  position: absolute;
  top: 8px;
  left: 8px;
  background: rgba(0,0,0,0.7);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  letter-spacing: 0.04em;
  z-index: 6;
  pointer-events: none;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .card-film { flex: 0 0 140px; }
  .card-yt { flex: 0 0 220px; }
  .card-series { flex: 0 0 140px; }
  .card-audiobook { flex: 0 0 130px; }
  .popup-overlay { align-items: flex-end; }
  .popup-content { width: 100%; max-width: none; border-radius: 16px 16px 0 0; max-height: 85vh; animation: popupSlideUp 0.25s ease; }
  @keyframes popupSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }
  .popup-poster { width: 80px; height: 120px; }
  .popup-poster--landscape { width: 160px; height: 90px; }
}
@media (max-width: 480px) {
  .card-film { flex: 0 0 calc((100vw - 48px) / 3); }
  .catalog-grid .card-yt { flex: 0 0 calc((100vw - 48px) / 3); }
  .carousel-track .card-yt { flex: 0 0 220px; }
  .card-film-info { padding: 6px; }
  .card-film-title { font-size: 11px; -webkit-line-clamp: 1; }
  .card-film-meta { font-size: 9px; }
  .card-yt-info { padding: 6px 8px; }
  .card-yt-title { font-size: 11px; -webkit-line-clamp: 1; }
  .card-yt-channel { font-size: 9px; }
  .card-yt-duration { font-size: 9px; padding: 1px 4px; }
}
