:root {
  color-scheme: dark;
  --bg: #0b0d12;
  --panel: rgba(20, 23, 32, .78);
  --panel-2: rgba(29, 33, 45, .88);
  --line: rgba(255,255,255,.09);
  --text: #f6f7fb;
  --muted: #9ba3b4;
  --accent: #8ea1ff;
  --accent-2: #b28cff;
  --shadow: 0 18px 60px rgba(0,0,0,.35);
  --radius: 22px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 10%, rgba(119,91,255,.16), transparent 30rem),
    radial-gradient(circle at 90% 20%, rgba(77,160,255,.10), transparent 34rem),
    linear-gradient(180deg, #090b10 0%, #0d1017 45%, #0a0c11 100%);
  font-family: "Pretendard Variable", "Pretendard JP", Pretendard, -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
}
a { color: inherit; }
button { font: inherit; }
[hidden] { display: none !important; }
:where(a, button):focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.detail-shell { width: min(1180px, calc(100% - 28px)); margin: 0 auto; padding: 38px 0 72px; }

.detail-back { display: inline-flex; margin: 8px 0 13px; color: var(--muted); text-decoration: none; font-size: 12px; font-weight: 750; }
.detail-back:hover { color: var(--text); }
.detail-breadcrumb { margin-bottom: 18px; }

.detail-hero-card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(220px, 300px) minmax(0, 1fr);
  gap: 30px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 30px;
  background:
    linear-gradient(135deg, rgba(132,111,255,.11), rgba(59,102,176,.045)),
    rgba(16,19,27,.82);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  overflow: visible;
}
.detail-hero-card::after {
  content: "";
  position: absolute;
  width: 280px;
  height: 280px;
  right: -90px;
  top: -130px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(178,140,255,.18), transparent 68%);
  pointer-events: none;
}
.detail-poster-wrap { align-self: start; position: sticky; top: 20px; z-index: 2; }
.detail-poster { display: block; width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 18px; background: #151923; border: 1px solid var(--line); box-shadow: 0 16px 34px rgba(0,0,0,.28); }
.detail-poster-fallback { display: grid; place-items: center; color: #5e6678; font-size: 58px; font-weight: 900; }
.detail-wishlist-toggle {
  position: absolute;
  top: 9px;
  right: 9px;
  z-index: 4;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 50%;
  color: rgba(255,255,255,.86);
  background: rgba(8,10,15,.42);
  backdrop-filter: blur(12px);
  cursor: pointer;
  transition: transform .16s ease, background .16s ease, color .16s ease;
}
.detail-wishlist-toggle:hover { transform: scale(1.04); background: rgba(8,10,15,.60); }
.detail-wishlist-toggle svg { width: 17px; height: 17px; fill: transparent; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; }
.detail-wishlist-toggle.is-active { color: #ff5f75; }
.detail-wishlist-toggle.is-active svg { fill: currentColor; }

.detail-main { min-width: 0; position: relative; z-index: 2; }
.detail-kicker { color: #8d96aa; font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: none; }
.anime-localized h1 { margin: 10px 0 7px; max-width: 760px; font-size: clamp(30px, 5vw, 52px); line-height: 1.05; letter-spacing: -.045em; overflow-wrap: anywhere; }
.alternate-titles { display: flex; flex-direction: column; gap: 3px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.detail-badges { display: flex; flex-wrap: wrap; gap: 7px; margin: 18px 0 24px; }
.detail-badge { padding: 6px 9px; border-radius: 999px; border: 1px solid var(--line); color: #cfd5e3; background: rgba(255,255,255,.04); font-size: 10px; font-weight: 850; }

.detail-panel {
  margin-top: 13px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(13,16,23,.62);
  backdrop-filter: blur(10px);
}
.detail-release-panel { display: flex; align-items: center; justify-content: space-between; gap: 18px; background: linear-gradient(135deg, rgba(142,161,255,.09), rgba(178,140,255,.035)), rgba(13,16,23,.62); }
.panel-label { color: var(--muted); font-size: 11px; font-weight: 850; }
.release-value { text-align: right; font-size: 17px; letter-spacing: -.01em; }
.panel-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.panel-heading h2 { margin: 0; font-size: 14px; letter-spacing: -.015em; }
.source-heading span { color: var(--muted); font-size: 9px; }
.panel-note { margin: -3px 0 13px; color: var(--muted); font-size: 10px; line-height: 1.65; }
.detail-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.detail-action,
.streaming-link,
.source-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255,255,255,.027);
  text-decoration: none;
  font-size: 11px;
  font-weight: 800;
  transition: border-color .18s ease, background .18s ease, transform .18s ease;
}
.detail-action:hover,
.streaming-link:hover,
.source-link:hover { border-color: rgba(142,161,255,.32); background: rgba(142,161,255,.075); transform: translateY(-1px); }
.streaming-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.source-list-detail { display: grid; gap: 8px; }
.source-link strong { display: block; font-size: 11px; }
.source-link small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 600; line-height: 1.4; }
.empty-state { margin: 0; color: var(--muted); font-size: 11px; line-height: 1.6; }
.detail-toast { position: fixed; left: 50%; bottom: 22px; z-index: 150; transform: translateX(-50%); padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: rgba(20,23,32,.96); box-shadow: var(--shadow); font-size: 11px; font-weight: 800; }

/* Secondary pages use the same mobile content scale as the homepage from the
   tablet breakpoint down. This avoids a shrunken two-column desktop layout on
   wide mobile viewports. */
@media (max-width: 760px) {
  .detail-shell {
    width: min(calc(100% - 18px), 1180px);
    padding: 16px 0 58px;
  }

  .detail-back {
    margin: 8px 2px 11px;
    font-size: 12px;
  }

  .detail-breadcrumb {
    margin: 0 2px 14px;
    font-size: 10px;
  }

  .detail-hero-card {
    display: block;
    padding: 18px;
    border-radius: 20px;
    overflow: hidden;
  }

  .detail-hero-card::after {
    width: 200px;
    height: 200px;
    right: -68px;
    top: -100px;
  }

  .detail-poster-wrap {
    position: relative;
    float: left;
    width: clamp(122px, 25vw, 162px);
    margin: 0 17px 13px 0;
  }

  .detail-poster { border-radius: 13px; }
  .detail-wishlist-toggle {
    top: 7px;
    right: 7px;
    width: 30px;
    height: 30px;
  }
  .detail-wishlist-toggle svg { width: 15px; height: 15px; }

  .detail-kicker {
    padding-top: 1px;
    font-size: 10px;
  }

  .anime-localized h1 {
    margin: 8px 0 7px;
    font-size: clamp(27px, 5.4vw, 40px);
    line-height: 1.08;
  }

  .alternate-titles {
    font-size: 11px;
    line-height: 1.55;
  }

  .detail-badges {
    gap: 6px;
    margin: 13px 0 16px;
  }
  .detail-badge {
    padding: 5px 8px;
    font-size: 9px;
  }

  .anime-localized::after {
    content: "";
    display: block;
    clear: both;
  }

  .detail-panel {
    clear: both;
    margin-top: 12px;
    padding: 16px;
    border-radius: 16px;
  }

  .detail-release-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
  }
  .panel-label { font-size: 11px; }
  .release-value {
    margin: 0;
    font-size: 17px;
    text-align: right;
  }
  .panel-heading { margin-bottom: 11px; }
  .panel-heading h2 { font-size: 14px; }
  .panel-note { font-size: 10px; }
  .detail-action,
  .streaming-link,
  .source-link {
    min-height: 44px;
    padding: 11px 13px;
    font-size: 11px;
  }
}

@media (max-width: 520px) {
  .detail-hero-card {
    padding: 17px;
    border-radius: 19px;
  }

  .detail-poster-wrap {
    width: clamp(108px, 34vw, 132px);
    margin: 0 14px 11px 0;
  }

  .anime-localized h1 {
    font-size: clamp(25px, 8vw, 32px);
  }

  .alternate-titles { font-size: 10px; }
  .detail-release-panel { display: block; }
  .release-value {
    display: block;
    margin-top: 5px;
    text-align: left;
  }
  .detail-actions,
  .streaming-list { grid-template-columns: 1fr; }
}
