:root {
  color-scheme: dark;
  font: 16px/1.6 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #110a1c;
  color: #f7f1ff;
  --muted: #cfbfdc;
  --violet: #ddcaff;
  --edge: #bc97e744;
}

* { box-sizing: border-box; }
body {
  min-height: 100vh;
  margin: 0;
  background: radial-gradient(ellipse 700px 440px at 8% 0, #37214f, transparent);
}
a { color: var(--violet); text-underline-offset: 4px; }
a:focus-visible { outline: 2px solid #f3dcff; outline-offset: 4px; border-radius: 6px; }
header, footer {
  display: flex;
  align-items: center;
  gap: 12px 20px;
  width: min(100% - 36px, 1040px);
  margin: auto;
  padding: 10px 0;
}
header { justify-content: space-between; border-bottom: 1px solid var(--edge); }
.brand { color: white; font-weight: 800; letter-spacing: .07em; text-decoration: none; }
header a, footer a { display: inline-flex; align-items: center; min-height: 44px; }
header a:last-child { text-align: end; }
footer {
  flex-wrap: wrap;
  border-top: 1px solid var(--edge);
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
  font-size: .875rem;
}
main { width: min(100% - 36px, 1040px); margin: 36px auto; }
h1, h2, p, a { overflow-wrap: anywhere; }
h1 { margin: 0 0 14px; font-size: clamp(1.6rem, 5vw, 3rem); line-height: 1.16; }
h2 { margin: 0 0 12px; font-size: 1.25rem; line-height: 1.35; }
.drama-page {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  align-items: start;
  gap: 22px 32px;
}
.drama-page.no-cover { grid-template-columns: minmax(0, 1fr); }
.cover {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  background: #241733;
  object-fit: cover;
}
.drama-page > .cover { box-shadow: 0 16px 40px #0006; }
.summary { align-self: center; min-width: 0; }
.meta, .catalog-intro p { color: var(--muted); }
.meta { margin: 0 0 16px; }
.primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding: 9px 22px;
  border: 1px solid #c79cf77d;
  border-radius: 12px;
  background: linear-gradient(115deg, #7844b3, #623192);
  color: #fff;
  font-weight: 750;
  text-align: center;
  text-decoration: none;
}
.languages, .synopsis, .episodes { grid-column: 1 / -1; }
.languages { display: flex; flex-wrap: wrap; gap: 3px 16px; }
.languages a { display: inline-flex; align-items: center; min-height: 44px; font-size: .88rem; }
.languages [aria-current] { color: white; font-weight: 700; text-underline-offset: 6px; }
.synopsis p { max-width: 75ch; margin: 0; color: var(--muted); white-space: pre-wrap; }
.episodes ol, .catalog-grid { display: grid; margin: 0; padding: 0; list-style: none; }
.episodes ol { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.episodes a {
  display: grid;
  align-content: center;
  gap: 2px;
  min-height: 66px;
  height: 100%;
  padding: 9px 12px;
  border: 1px solid var(--edge);
  border-radius: 10px;
  background: #20152c;
  text-decoration: none;
}
.episodes span { color: white; font-size: 1.15rem; font-weight: 700; }
.episodes small, .episodes em { font-size: .78rem; }
.episodes small:empty { display: none; }
.episodes em { color: var(--muted); font-style: normal; }
.catalog-intro { max-width: 70ch; margin: 0 0 20px; }
.catalog-intro p { margin: 0 0 8px; }
.catalog-grid { grid-template-columns: repeat(auto-fill, minmax(144px, 1fr)); gap: 14px; }
.catalog-grid li { min-width: 0; }
.catalog-card {
  display: block;
  height: 100%;
  padding: 8px;
  border: 1px solid var(--edge);
  border-radius: 12px;
  background: #1d1228;
  color: #f7f1ff;
  font-weight: 650;
  text-decoration: none;
}
.catalog-card .cover { border-radius: 8px; }
.catalog-card span { display: block; padding: 7px 3px 1px; }
.catalog-card:hover, .episodes a:hover { border-color: #bd91f0; }
.related { margin-top: 30px; }

@media (max-width: 600px) {
  main { margin: 24px auto; }
  .drama-page { grid-template-columns: 100px minmax(0, 1fr); gap: 18px; }
  .drama-page > .cover { border-radius: 10px; }
  .meta { margin-bottom: 12px; font-size: .85rem; }
  .primary { padding: 8px 14px; }
  .episodes ol { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 7px; }
  .episodes a { padding: 8px; text-align: center; }
  .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
}
