#diagnoses { scroll-margin-top: 12px; }
.cast-shortcut-wrap { display: flex; justify-content: flex-end; margin-top: 4px; }
.cast-shortcut {
  display: inline-flex; gap: 9px; align-items: center; min-height: 44px;
  text-decoration: none; color: var(--ink); font-size: 14px; font-weight: 700;
}
.cast-shortcut img { width: 36px; height: 36px; object-fit: contain; }
.cast-shortcut:hover { text-decoration: underline; text-underline-offset: 4px; }

.cast-banner {
  margin-top:32px; display:grid; grid-template-columns:auto minmax(0,1fr) auto;
  align-items:center; gap:clamp(14px,3vw,32px);
  min-height:132px; padding:22px clamp(16px,3vw,38px);
  border:1px solid #354756; border-radius:12px;
  background:#263a48; color:#fff9ef; text-decoration:none; text-align:start;
}
.cast-banner h2 { margin:0; color:inherit; font-size:clamp(23px,2.7vw,33px); line-height:1.25; letter-spacing:-.035em; }
.cast-banner p { margin:6px 0 0; color:#d2dee2; font-size:clamp(13px,1.4vw,16px); line-height:1.55; }
html:lang(ko) .cast-banner p { word-break:keep-all; }
.cast-banner-posters { position:relative; width:clamp(54px,7vw,80px); aspect-ratio:1; }
.cast-banner-posters::before,.cast-banner-posters::after {
  content:""; position:absolute; inset:7% 17% 7% 13%; border-radius:2px;
}
.cast-banner-posters::before { transform:translate(-7%,3%) rotate(-12deg); background:#95bcba; }
.cast-banner-posters::after {
  transform:translate(7%,-2%) rotate(7deg); border:3px solid #fff2d9;
  background:
    linear-gradient(#253a48 0 0) 12% 88% / 46% 3% no-repeat,
    linear-gradient(#253a48 0 0) 12% 80% / 70% 4% no-repeat,
    radial-gradient(circle at 35% 30%,#ed906f 0 18%,transparent 19%),
    linear-gradient(145deg,transparent 35%,#446b78 36% 58%,transparent 59%) top / 100% 70% no-repeat,
    #f3e7cc;
}
.cast-banner-arrow {
  width:38px; aspect-ratio:1; display:grid; place-items:center; border:1px solid #91a3ab;
  border-radius:50%; color:#fff9ef; font:22px/1 system-ui,sans-serif;
}
.cast-banner:is(:hover,:focus-visible) .cast-banner-arrow { background:#fff2d9; border-color:#fff2d9; color:#263a48; }
:root[data-theme=dark] .cast-banner { background:#263540; border-color:#51646e; }
:is(.portal-sections a,.cast-shortcut,.cast-banner,.cast-card,.cast-toggle button,.cast-row):focus-visible {
  outline: 3px solid var(--accent); outline-offset: 3px;
}

#gallery { max-width: 1120px; padding: 12px 28px 56px; margin: 0 auto; color: var(--ink); }
.cast-intro { padding: 26px 0 24px; border-top: 2px solid var(--ink); }
.cast-intro h1, .cast-person-intro h1 { font-size: clamp(30px,5vw,52px); margin: 0; line-height: 1.18; letter-spacing: -.045em; }
.cast-intro p, .cast-actions p { font-size: 15px; color: var(--muted); line-height: 1.65; margin: 9px 0 0; }
.cast-grid { display: grid; grid-template-columns: repeat(6,minmax(0,1fr)); gap: clamp(10px,2vw,22px); margin-inline: auto; }
.cast-card {
  display: grid; grid-template-columns: minmax(0,1fr) auto; align-content: start;
  text-decoration: none; text-align: left; color: var(--ink); border-radius: 8px;
  overflow: hidden; background: var(--surface); border: 1px solid var(--line);
}
.cast-card:hover { border-color: #ba576c; }
.cast-card-art { grid-column: 1/-1; position: relative; overflow: hidden; border-bottom: 4px solid #aa3552; }
.cast-portrait { display: block; width: 100%; aspect-ratio: 9/11; object-fit: cover; }
.cast-card-copy { padding: 14px 0 16px 14px; min-width: 0; }
.cast-card-copy h2 { font-size: clamp(17px,2vw,24px); line-height: 1.3; margin: 0 0 3px; overflow-wrap: anywhere; }
.cast-card-copy small, .cast-person-intro small, .cast-row small { color: var(--muted); }
.cast-card-arrow { padding: 0 9px 0 3px; align-self: center; }
.cast-role-stamp { display: inline-block; width: 30px; height: 30px; object-fit: contain; vertical-align: middle; }
.cast-card-art > .cast-role-stamp {
  position: absolute; top: 2%; left: 2%; width: min(30%, 76px); height: auto;
  filter: drop-shadow(0 1px 1px #fff) drop-shadow(0 1px 2px #19243440);
  pointer-events: none;
}
.cast-row-label .cast-role-stamp { margin-inline-start: 3px; }
.cast-curator-note { color: var(--muted); margin: 24px 0 0; font-size: 14px; line-height: 1.7; }
.cast-person-intro .cast-curator-note { margin-top: 10px; }
.cast-person-intro { padding: 7px 0 20px; border-bottom: 2px solid var(--ink); }
.cast-person-intro small { display: block; margin-top: 5px; font-weight: 700; }
.cast-actions { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; margin: 15px 0 18px; }
.cast-actions p { margin: 0; flex: 1 1 240px; }
.cast-toggle { display: inline-flex; gap: 3px; background: var(--soft); border: 1px solid var(--line); padding: 3px; border-radius: 9px; }
.cast-toggle button {
  min-height: 44px; border: 1px solid transparent; background: transparent; border-radius: 6px;
  padding: 8px 14px; cursor: pointer; font: inherit; font-size: 14px; font-weight: 700; color: var(--muted);
}
.cast-toggle button[aria-pressed=true] { color: var(--ink); background: var(--surface); border-color: var(--line); }
.cast-map { position: relative; max-width: 820px; margin: 0 auto; overflow: hidden; }
.cast-original { display: block; width: 100%; height: auto; }
.cast-spot { position: absolute; }
.cast-spot:hover, .cast-spot:focus-visible { outline: 3px solid #fff; outline-offset: -4px; box-shadow: inset 0 0 0 7px #ae3151; background: #ae315122; }
.cast-list h2 { font-size: 19px; margin: 24px 0 10px; }
.cast-rows { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px 12px; padding: 0; margin: 0; list-style: none; }
.cast-row {
  height: 100%; min-height: 64px; display: grid; grid-template-columns: 48px minmax(0,1fr) auto; gap: 10px; align-items: center;
  padding: 6px 10px 6px 6px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none;
  color: var(--ink); background: var(--surface);
}
a.cast-row:hover { border-color: #ba576c; }
.cast-thumb { width: 48px; height: 51px; border-radius: 4px; background-repeat: no-repeat; }
.cast-row-label { display: grid; line-height: 1.4; overflow-wrap: anywhere; }
.cast-row-label strong { font-size: 15px; }
.cast-row-label small, .cast-kind { font-size: 12px; }
.cast-kind { color: var(--muted); line-height: 1.3; text-align: right; max-width: 8em; }
#gallery [hidden] { display: none; }

:root:has(#cast-preview) { scrollbar-gutter: stable; }
:root.cast-preview-open { overflow: hidden; }
#cast-preview {
  position: fixed; inset: 0; margin: 0; width: 100%; max-width: none;
  height: 100%; height: 100dvh; max-height: none; border: 0;
  padding: max(14px,env(safe-area-inset-top)) max(14px,env(safe-area-inset-right)) max(14px,env(safe-area-inset-bottom)) max(14px,env(safe-area-inset-left));
  background: transparent; color: var(--ink); overflow: hidden;
}
#cast-preview[open] { display: grid; place-items: center; }
#cast-preview::backdrop { background: rgb(35 39 43 / 47%); }
.preview-card {
  width: min(100%,680px); max-height: 100%; min-height: 0; display: flex; flex-direction: column;
  border: 1px solid var(--line); border-radius: 14px; background: var(--surface);
  box-shadow: 0 16px 55px #1219213d; overflow: hidden;
}
.preview-head { display: flex; gap: 10px; align-items: flex-start; justify-content: space-between; padding: 10px 12px 10px 18px; flex: none; }
.preview-head > div { min-width: 0; max-height: 20vh; overflow: auto; align-self: center; }
.preview-head h2 { font-size: clamp(17px,2.7vw,23px); margin: 0; line-height: 1.3; overflow-wrap: anywhere; }
.preview-head p { margin: 3px 0 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.preview-close { flex: 0 0 44px; width: 44px; height: 44px; border-radius: 50%; color: var(--ink); background: var(--soft); font: 28px/1 sans-serif; }
.preview-body { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.preview-body iframe { width: 100%; border: 0; display: block; }
.preview-player { aspect-ratio: 16/9; min-height: 200px; max-height: 62dvh; background: #181818; }
.preview-footer { flex: none; padding: 3px 14px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; }
.preview-source { min-height: 44px; display: inline-flex; align-items: center; color: var(--accent); font-size: 14px; font-weight: 700; }
.preview-source:hover { text-decoration: underline; }

@media (max-width: 940px) {
  .cast-grid { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 670px) {
  .cast-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cast-rows { grid-template-columns: 1fr; }
  #gallery { padding: 4px 16px 40px; }
  .cast-intro { padding: 18px 0; }
  .cast-banner { min-height:108px; padding:18px 16px; gap:12px; }
  .cast-banner-arrow { width:30px; font-size:18px; }
}
@media (max-width: 600px) {
  .cast-card-copy { padding: 10px 0 12px 9px; }
}
@media (max-width: 360px) {
  .cast-kind { max-width: 5.6em; }
  .cast-banner { gap:10px; padding-inline:12px; }
  .cast-banner-posters { width:40px; }
}

.cover-gallery .cast-map { max-width: 100%; }
.cover-gallery .cast-thumb { height: 48px; }
.cover-gallery .cast-spot::after {
  content: '▶'; position: absolute; right: 4%; bottom: 29%; display: grid; place-items: center;
  width: clamp(12px,2vw,22px); aspect-ratio: 1; border-radius: 50%;
  background: #151821d9; color: white; font: 700 clamp(7px,1vw,12px)/1 sans-serif;
}
