/* =========================================================
   Automata Room — THE CAST page
   元ネタ: lab/cast-page-import/Automata Room - The Cast.html
   既存サイトの variables.css とは独立した cyber-dashboard 系トークン。
========================================================= */

.cast-page {
  --bg-0: #070912;
  --bg-1: #0b1020;
  --bg-2: #0f172a;
  --bg-3: #131c33;
  --line: rgba(255, 255, 255, 0.06);
  --line-2: rgba(255, 255, 255, 0.12);
  --ink: #e6ecff;
  --ink-dim: #9aa3bf;
  --ink-mute: #586183;
  --silver: #94a3b8;

  /* JS から差し替えられるアクティブカラー */
  --c: #67e8f9;
  --c-rgb: 103, 232, 249;
  --c-soft: rgba(103, 232, 249, 0.15);
  --c-glow: rgba(103, 232, 249, 0.45);

  --f-en: 'Orbitron', ui-sans-serif, system-ui;
  --f-mono: 'JetBrains Mono', ui-monospace, Menlo, monospace;
  --f-jp-h: 'Zen Maru Gothic', 'Noto Sans JP', sans-serif;
  --f-jp: 'Noto Sans JP', sans-serif;

  margin: 0;
  padding: 0;
  background: var(--bg-0);
  color: var(--ink);
  font-family: var(--f-jp);
  overflow-x: hidden;
}
.cast-page * { box-sizing: border-box; }
.cast-page img { display: block; max-width: 100%; }
.cast-page button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; }
.cast-page a { color: inherit; text-decoration: none; }

/* キーボード操作のフォーカスリング */
.cast-page :focus-visible {
  outline: 2px solid var(--c);
  outline-offset: 3px;
  box-shadow: 0 0 0 4px rgba(var(--c-rgb), 0.2);
}

/* ====== 背景FX ====== */
.cast-page .bg-grid {
  position: fixed; inset: 0; pointer-events: none; z-index: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse at 50% 30%, black 30%, transparent 80%);
}
.cast-page .bg-scan {
  position: fixed; inset: 0; pointer-events: none; z-index: 1;
  background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.03) 0 1px, transparent 1px 3px);
  mix-blend-mode: overlay; opacity: 0.6;
}
.cast-page .bg-noise {
  position: fixed; inset: 0; pointer-events: none; z-index: 1; opacity: 0.06; mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='1.6' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 .8 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}
.cast-page .bg-glow {
  position: fixed; inset: -10vmax; pointer-events: none; z-index: 0;
  transition: background 0.9s ease;
  background: radial-gradient(600px 600px at var(--mx, 50%) var(--my, 30%), var(--c-soft), transparent 60%);
}

.cast-page main { position: relative; z-index: 2; }

/* ====== HUD ====== */
.cast-page .hud {
  position: fixed; top: 0; left: 0; right: 0; z-index: 50;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.18em;
  color: var(--ink-dim); text-transform: uppercase;
  background: linear-gradient(to bottom, rgba(7, 9, 18, 0.8), transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--line);
  gap: 14px;
}
.cast-page .hud .hud-l, .cast-page .hud .hud-r { display: flex; gap: 18px; align-items: center; }
.cast-page .hud .hud-home { transition: color 0.25s; }
.cast-page .hud .hud-home:hover { color: var(--c); text-shadow: 0 0 6px var(--c-glow); }
.cast-page .hud .dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--c); box-shadow: 0 0 12px var(--c-glow);
  animation: pulse 1.6s infinite ease;
}
.cast-page .hud .pill { padding: 4px 10px; border: 1px solid var(--line-2); border-radius: 999px; }
.cast-page .hud-nav { display: flex; gap: 18px; }
.cast-page .hud-nav a { transition: color 0.25s; }
.cast-page .hud-nav a:hover, .cast-page .hud-nav a[aria-current="page"] { color: var(--c); text-shadow: 0 0 6px var(--c-glow); }

@keyframes pulse { 50% { opacity: 0.4; } }

/* ====== BOOT ====== */
.cast-page #boot {
  position: fixed; inset: 0; z-index: 200; background: #04060e;
  display: flex; flex-direction: column; justify-content: center; align-items: center;
  font-family: var(--f-mono); color: #cbd5ff;
}
.cast-page #boot.gone { opacity: 0; pointer-events: none; transition: opacity 0.8s ease; }
.cast-page #boot .frame {
  width: min(540px, 84vw); border: 1px solid rgba(103, 232, 249, 0.35);
  padding: 22px 24px; background: rgba(10, 15, 30, 0.7);
  box-shadow: 0 0 60px rgba(103, 232, 249, 0.15) inset, 0 0 30px rgba(103, 232, 249, 0.2);
}
.cast-page #boot .row { font-size: 12px; letter-spacing: 0.12em; line-height: 1.9; white-space: pre; min-height: 1.9em; }
.cast-page #boot .bar { height: 6px; background: rgba(255, 255, 255, 0.06); margin-top: 18px; border: 1px solid rgba(103, 232, 249, 0.3); position: relative; overflow: hidden; }
.cast-page #boot .bar i { position: absolute; inset: 0; width: 0%; background: linear-gradient(to right, #67e8f9, #a78bfa); box-shadow: 0 0 10px #67e8f9; }
.cast-page #boot .ttl { font-family: var(--f-en); font-weight: 800; font-size: 14px; letter-spacing: 0.4em; color: #67e8f9; margin-bottom: 14px; }
.cast-page #boot .ttl span { opacity: 0.4; }

/* ====== HERO ====== */
.cast-page .hero { min-height: 100vh; position: relative; display: flex; align-items: center; padding: 80px 5vw 60px; }
.cast-page .hero .collage { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.cast-page .hero .collage img {
  position: absolute; top: 0; left: 0; width: 100%; height: 100%;
  object-fit: cover;
  filter: saturate(0.5) contrast(1.05) blur(2px) brightness(0.55);
  opacity: 0;
  transition: opacity 1.6s ease, filter 1.6s ease;
}
.cast-page .hero .collage img.on { opacity: 0.5; filter: saturate(0.7) contrast(1.05) blur(0px) brightness(0.7); }
.cast-page .hero .collage::after {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(1100px 700px at 50% 50%, transparent 0%, rgba(7, 9, 18, 0.55) 60%, var(--bg-0) 92%),
    linear-gradient(to bottom, rgba(7, 9, 18, 0.4), rgba(7, 9, 18, 0.95));
}
.cast-page .hero .holo-frame {
  position: absolute; inset: 60px 5vw 60px; border: 1px solid var(--c); opacity: 0.18;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  pointer-events: none;
}
.cast-page .hero .holo-frame::before, .cast-page .hero .holo-frame::after {
  content: ""; position: absolute; width: 14px; height: 14px; border: 1px solid var(--c);
}
.cast-page .hero .holo-frame::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.cast-page .hero .holo-frame::after { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }

.cast-page .hero-inner { position: relative; z-index: 2; width: 100%; display: grid; grid-template-columns: 1fr; gap: 28px; max-width: 1400px; margin: 0 auto; }
.cast-page .eyebrow { font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.4em; color: var(--c); text-transform: uppercase; display: flex; gap: 14px; align-items: center; }
.cast-page .eyebrow .tick { width: 18px; height: 1px; background: var(--c); box-shadow: 0 0 6px var(--c-glow); }
.cast-page .hero-title {
  font-family: var(--f-en); font-weight: 900; font-size: clamp(64px, 12vw, 180px);
  line-height: 0.92; letter-spacing: -0.02em; margin: 14px 0 6px;
  background: linear-gradient(180deg, #fff 0%, #cdd6ff 60%, #7d8bb6 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 0 80px rgba(103, 232, 249, 0.15);
}
.cast-page .hero-title em { font-style: normal; color: var(--c); text-shadow: 0 0 40px var(--c-glow); font-weight: 800; }
.cast-page .hero .sub-en { font-family: var(--f-mono); font-size: 13px; letter-spacing: 0.32em; color: var(--ink-dim); text-transform: uppercase; }
.cast-page .hero .sub-jp { font-family: var(--f-jp-h); font-weight: 500; font-size: clamp(15px, 1.6vw, 20px); max-width: 560px; color: #cdd6ff; margin-top: 18px; line-height: 1.8; }

.cast-page .hero .stats {
  display: flex; gap: 28px; margin-top: 36px; flex-wrap: wrap;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--ink-dim); text-transform: uppercase;
}
.cast-page .hero .stats .v { color: var(--c); font-size: 22px; display: block; font-weight: 700; letter-spacing: 0; text-shadow: 0 0 12px var(--c-glow); }

.cast-page .hero-edit-note {
  margin-top: 14px;
  font-size: 12px;
  color: rgba(255,255,255,.55);
  letter-spacing: 0.02em;
  font-family: var(--f-jp);
}
.cast-page .hero-edit-note small { font-size: inherit; }

.cast-page .hero .scroll {
  position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%);
  font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.5em; color: var(--ink-dim);
  text-transform: uppercase; display: flex; align-items: center; gap: 10px; z-index: 3;
}
.cast-page .hero .scroll::after {
  content: ""; width: 1px; height: 30px;
  background: linear-gradient(to bottom, var(--c), transparent);
  animation: slide 1.6s infinite;
}
@keyframes slide { 0% { transform: translateY(-10px); opacity: 0; } 50% { opacity: 1; } 100% { transform: translateY(10px); opacity: 0; } }

/* ====== セクション共通 ====== */
.cast-page section { position: relative; padding: 120px 5vw; }
.cast-page .s-head { display: flex; align-items: flex-end; gap: 28px; flex-wrap: wrap; margin-bottom: 48px; max-width: 1400px; margin-left: auto; margin-right: auto; width: 100%; }
.cast-page .s-num { font-family: var(--f-mono); font-size: 12px; letter-spacing: 0.3em; color: var(--c); text-shadow: 0 0 8px var(--c-glow); }
.cast-page .s-en { font-family: var(--f-en); font-weight: 800; font-size: clamp(34px, 5vw, 72px); letter-spacing: 0.02em; line-height: 1; color: #fff; }
.cast-page .s-jp { font-family: var(--f-jp-h); font-weight: 500; color: var(--ink-dim); font-size: 14px; letter-spacing: 0.2em; }
.cast-page .s-rule { flex: 1; height: 1px; background: linear-gradient(to right, var(--c), transparent); min-width: 60px; align-self: center; margin-bottom: 8px; box-shadow: 0 0 6px var(--c-glow); }

.cast-page .fade-up { opacity: 0; transform: translateY(28px); transition: opacity 0.9s ease, transform 0.9s cubic-bezier(0.2, 0.7, 0.2, 1); }
.cast-page .fade-up.in { opacity: 1; transform: none; }

/* ====== Character Select ====== */
.cast-page .cs-wrap { max-width: 1400px; margin: 0 auto; width: 100%; }
.cast-page .cs-rail { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.cast-page .cs-card {
  position: relative; border: 1px solid var(--line-2); background: rgba(15, 23, 42, 0.55);
  aspect-ratio: 3/4; overflow: hidden; cursor: pointer;
  transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1), border-color 0.3s, box-shadow 0.3s, filter 0.35s;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
}
.cast-page .cs-card .img { position: absolute; inset: 0; }
.cast-page .cs-card .img img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; object-position: center 12%;
  filter: grayscale(0.6) saturate(0.7) brightness(0.7);
  transition: filter 0.5s, transform 0.8s;
}
.cast-page .cs-card .veil { position: absolute; inset: 0; background: linear-gradient(to top, rgba(7, 9, 18, 0.95) 0%, rgba(7, 9, 18, 0.45) 45%, rgba(7, 9, 18, 0.1) 100%); }
.cast-page .cs-card .scan { position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 4px); mix-blend-mode: overlay; opacity: 0.5; }
.cast-page .cs-card .meta { position: absolute; left: 14px; right: 14px; bottom: 14px; z-index: 2; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.22em; color: #fff; text-transform: uppercase; display: flex; flex-direction: column; gap: 6px; }
.cast-page .cs-card .meta .id { color: var(--cc); }
.cast-page .cs-card .name-en { font-family: var(--f-en); font-weight: 800; font-size: 22px; letter-spacing: 0.05em; color: #fff; line-height: 1; }
.cast-page .cs-card .name-jp { font-family: var(--f-jp-h); font-weight: 700; color: #dbe1ff; font-size: 13px; letter-spacing: 0.2em; }
.cast-page .cs-card .top { position: absolute; top: 12px; left: 12px; right: 12px; z-index: 2; display: flex; justify-content: space-between; font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.25em; text-transform: uppercase; color: var(--cc); }
.cast-page .cs-card .top .stat::before { content: "●"; margin-right: 6px; color: var(--cc); }
.cast-page .cs-card:hover { transform: translateY(-8px); border-color: var(--cc); box-shadow: 0 18px 60px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--cc), 0 0 40px rgba(var(--cc-rgb), 0.35); }
.cast-page .cs-card:hover .img img { filter: none; transform: scale(1.04); }
.cast-page .cs-card.active { border-color: var(--cc); box-shadow: 0 0 0 1px var(--cc), 0 0 60px rgba(var(--cc-rgb), 0.45); }
.cast-page .cs-card.active .img img { filter: none; }
.cast-page .cs-card.active::after {
  content: ""; position: absolute; inset: 0; border: 1px solid var(--cc); pointer-events: none;
  clip-path: inherit; animation: flick 2.6s infinite;
}
@keyframes flick { 0%, 100% { opacity: 0.4; } 50% { opacity: 1; } }
.cast-page .cs-card .num { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); font-family: var(--f-en); font-weight: 900; font-size: 120px; color: #fff; opacity: 0.04; pointer-events: none; line-height: 1; }
.cast-page .cs-card .hint {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  padding: 10px 14px;
  background: linear-gradient(to top, rgba(7, 9, 18, 0.95), rgba(7, 9, 18, 0));
  font-family: var(--f-mono); font-size: 9.5px; letter-spacing: 0.18em; color: #dbe1ff; text-transform: uppercase;
  display: flex; justify-content: space-between; gap: 8px;
  transform: translateY(110%); transition: transform 0.35s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.cast-page .cs-card:hover .hint, .cast-page .cs-card.active .hint { transform: none; }
.cast-page .cs-card .hint .k { color: var(--cc); }

.cast-page .cs-help { margin-top: 18px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.2em; color: var(--ink-mute); text-transform: uppercase; display: flex; gap: 18px; flex-wrap: wrap; justify-content: center; }
.cast-page .cs-help kbd { font-family: var(--f-mono); background: rgba(255, 255, 255, 0.05); border: 1px solid var(--line-2); border-bottom-width: 2px; padding: 2px 8px; border-radius: 4px; color: #dbe1ff; font-size: 10px; }

/* ====== Character Detail ====== */
.cast-page .detail { max-width: 1400px; margin: 0 auto; width: 100%; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 48px; align-items: start; }
.cast-page .portrait {
  position: relative; aspect-ratio: 3/4; border: 1px solid var(--c); background: rgba(15, 23, 42, 0.6); overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 22px) 0, 100% 22px, 100% 100%, 22px 100%, 0 calc(100% - 22px));
  box-shadow: 0 0 60px rgba(var(--c-rgb), 0.18);
}
.cast-page .portrait .ph { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7, 9, 18, 0) 0%, rgba(7, 9, 18, 0.6) 100%); z-index: 2; pointer-events: none; }

.cast-page .portrait .slot { position: absolute; inset: 0; overflow: hidden; }
.cast-page .portrait video, .cast-page .portrait .fb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 8%; cursor: zoom-in; opacity: 0; transition: opacity 0.6s ease; }
.cast-page .portrait video.in, .cast-page .portrait .fb.in { opacity: 1; }
.cast-page .portrait .fb { background: #0b1020; }

.cast-page .portrait .warp { position: absolute; inset: 0; pointer-events: none; opacity: 0; mix-blend-mode: screen; z-index: 3; }
.cast-page .portrait .warp.run { animation: warpFx 0.9s cubic-bezier(0.6, 0.2, 0.2, 1); }
.cast-page .portrait .warp::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(var(--c-rgb), 0.6) 0 2px, transparent 2px 8px); filter: blur(1px); }
.cast-page .portrait .warp::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent 0%, rgba(var(--c-rgb), 0.55) 45%, rgba(255, 255, 255, 0.85) 50%, rgba(var(--c-rgb), 0.55) 55%, transparent 100%); transform: translateX(-110%); }
.cast-page .portrait .warp.run::after { animation: warpSweep 0.9s cubic-bezier(0.6, 0.2, 0.2, 1); }
@keyframes warpFx { 0% { opacity: 0; } 30% { opacity: 1; } 100% { opacity: 0; } }
@keyframes warpSweep { 0% { transform: translateX(-110%) skewX(-12deg); } 100% { transform: translateX(110%) skewX(-12deg); } }

.cast-page .portrait .slot.warp-out > .layer:first-child video,
.cast-page .portrait .slot.warp-out > .layer:first-child .fb { animation: rgbOut 0.9s cubic-bezier(0.6, 0.2, 0.2, 1) forwards; }
.cast-page .portrait .slot.warp-in > .layer:last-child video,
.cast-page .portrait .slot.warp-in > .layer:last-child .fb { animation: rgbIn 0.9s cubic-bezier(0.6, 0.2, 0.2, 1) forwards; }
@keyframes rgbOut {
  0% { filter: none; transform: none; opacity: 1; }
  40% { filter: blur(1px) hue-rotate(20deg); transform: scale(1.04) translateX(-2%); opacity: 0.9; }
  100% { filter: blur(8px) hue-rotate(60deg) saturate(1.4); transform: scale(1.18) translateX(-12%); opacity: 0; }
}
@keyframes rgbIn {
  0% { filter: blur(8px) hue-rotate(-60deg) saturate(1.4); transform: scale(1.18) translateX(12%); opacity: 0; }
  60% { filter: blur(2px) hue-rotate(-10deg); transform: scale(1.04) translateX(2%); opacity: 0.9; }
  100% { filter: none; transform: none; opacity: 1; }
}

.cast-page .portrait:hover video, .cast-page .portrait:hover .fb { transform: scale(1.02); }
.cast-page .portrait .corners span { position: absolute; width: 18px; height: 18px; border: 1px solid var(--c); z-index: 4; box-shadow: 0 0 6px var(--c-glow); }
.cast-page .portrait .corners span:nth-child(1) { top: 8px; left: 8px; border-right: 0; border-bottom: 0; }
.cast-page .portrait .corners span:nth-child(2) { top: 8px; right: 8px; border-left: 0; border-bottom: 0; }
.cast-page .portrait .corners span:nth-child(3) { bottom: 8px; left: 8px; border-right: 0; border-top: 0; }
.cast-page .portrait .corners span:nth-child(4) { bottom: 8px; right: 8px; border-left: 0; border-top: 0; }
.cast-page .portrait .scan { position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 4px); pointer-events: none; z-index: 2; opacity: 0.4; }
.cast-page .portrait .tag { position: absolute; top: 14px; left: 14px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.25em; color: var(--c); text-transform: uppercase; z-index: 4; background: rgba(7, 9, 18, 0.7); padding: 4px 10px; border: 1px solid var(--c); }
.cast-page .portrait .pulse { position: absolute; bottom: 14px; right: 14px; font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.25em; color: #fff; z-index: 4; display: flex; gap: 8px; align-items: center; }
.cast-page .portrait .pulse i { width: 6px; height: 6px; background: var(--c); border-radius: 50%; box-shadow: 0 0 10px var(--c-glow); animation: pulse 1.4s infinite; }

.cast-page .portrait .dots { position: absolute; left: 14px; bottom: 14px; display: flex; gap: 6px; z-index: 4; }
.cast-page .portrait .dots b { display: block; width: 18px; height: 2px; background: rgba(255, 255, 255, 0.18); transition: background 0.3s, box-shadow 0.3s; cursor: pointer; }
.cast-page .portrait .dots b.on { background: var(--c); box-shadow: 0 0 8px var(--c-glow); }

.cast-page .dpanel { position: relative; display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.cast-page .dpanel .name-id { display: flex; align-items: center; gap: 14px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.3em; color: var(--c); text-transform: uppercase; }
.cast-page .dpanel .name-id .b { height: 1px; flex: 1; background: linear-gradient(to right, var(--c), transparent); box-shadow: 0 0 6px var(--c-glow); }
.cast-page .dpanel .name-en { font-family: var(--f-en); font-weight: 800; font-size: clamp(48px, 7vw, 96px); line-height: 0.95; letter-spacing: 0.02em; color: #fff; text-shadow: 0 0 40px rgba(var(--c-rgb), 0.25); }
.cast-page .dpanel .name-jp { font-family: var(--f-jp-h); font-weight: 700; font-size: 18px; color: var(--c); letter-spacing: 0.3em; }

.cast-page .box {
  position: relative; background: rgba(7, 9, 18, 0.78); border: 1px solid var(--c); padding: 22px 24px;
  clip-path: polygon(0 0, calc(100% - 14px) 0, 100% 14px, 100% 100%, 14px 100%, 0 calc(100% - 14px));
  box-shadow: 0 0 30px rgba(var(--c-rgb), 0.18) inset, 0 0 40px rgba(var(--c-rgb), 0.12);
}
.cast-page .box::before { content: ""; position: absolute; left: 0; top: 0; width: 6px; height: 100%; background: var(--c); box-shadow: 0 0 16px var(--c-glow); }
.cast-page .box .label { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.3em; color: var(--c); text-transform: uppercase; margin-bottom: 8px; }

.cast-page .catch { font-family: var(--f-jp-h); font-weight: 700; font-size: clamp(18px, 2vw, 24px); line-height: 1.6; color: #fff; min-height: 1.6em; }
.cast-page .catch .cur { display: inline-block; width: 0.55em; background: var(--c); height: 1.05em; vertical-align: -2px; margin-left: 2px; animation: cursor 1s steps(2) infinite; box-shadow: 0 0 10px var(--c-glow); }
@keyframes cursor { 50% { opacity: 0; } }

.cast-page .profile { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 18px; font-size: 13px; }
.cast-page .profile .row { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px dashed var(--line-2); }
.cast-page .profile .k { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.22em; color: var(--c); text-transform: uppercase; min-width: 74px; }
.cast-page .profile .v { color: #dbe1ff; font-family: var(--f-jp); font-weight: 500; }

.cast-page .voices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cast-page .voice { position: relative; padding: 12px 14px 12px 18px; border: 1px solid var(--line-2); background: rgba(11, 16, 32, 0.6); font-family: var(--f-jp); font-size: 13px; color: #dbe1ff; line-height: 1.55; transition: border-color 0.3s, transform 0.3s, background 0.3s; }
.cast-page .voice::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--c); box-shadow: 0 0 8px var(--c-glow); }
.cast-page .voice:hover { border-color: var(--c); transform: translateX(4px); background: rgba(var(--c-rgb), 0.06); }
.cast-page .voice .who { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.3em; color: var(--c); text-transform: uppercase; display: block; margin-bottom: 4px; }
.cast-page .voice .wav { display: flex; align-items: flex-end; gap: 2px; height: 14px; margin-top: 8px; }
.cast-page .voice .wav i { width: 2px; background: var(--c); box-shadow: 0 0 4px var(--c-glow); height: 30%; opacity: 0.3; transition: height 0.25s, opacity 0.25s; }
.cast-page .voice:hover .wav i { animation: wav 1.1s infinite ease-in-out; }
.cast-page .voice .wav i:nth-child(1) { animation-delay: 0s; }
.cast-page .voice .wav i:nth-child(2) { animation-delay: 0.08s; }
.cast-page .voice .wav i:nth-child(3) { animation-delay: 0.16s; }
.cast-page .voice .wav i:nth-child(4) { animation-delay: 0.24s; }
.cast-page .voice .wav i:nth-child(5) { animation-delay: 0.32s; }
.cast-page .voice .wav i:nth-child(6) { animation-delay: 0.4s; }
.cast-page .voice .wav i:nth-child(7) { animation-delay: 0.48s; }
.cast-page .voice .wav i:nth-child(8) { animation-delay: 0.56s; }
.cast-page .voice .wav i:nth-child(9) { animation-delay: 0.64s; }
.cast-page .voice .wav i:nth-child(10) { animation-delay: 0.72s; }
.cast-page .voice .wav i:nth-child(11) { animation-delay: 0.8s; }
.cast-page .voice .wav i:nth-child(12) { animation-delay: 0.88s; }
@keyframes wav { 0%, 100% { height: 25%; opacity: 0.4; } 50% { height: 100%; opacity: 1; } }

.cast-page .dnav { display: flex; justify-content: space-between; gap: 14px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.22em; color: var(--ink-dim); text-transform: uppercase; margin-top: 8px; }
.cast-page .dnav button {
  display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border: 1px solid var(--line-2); transition: all 0.25s; color: #dbe1ff;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.cast-page .dnav button:hover { border-color: var(--c); color: var(--c); box-shadow: 0 0 16px rgba(var(--c-rgb), 0.25); }

/* ====== Activities ====== */
.cast-page .acts { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; }
.cast-page .act {
  position: relative; border: 1px solid var(--line-2); padding: 22px 20px 24px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.6), rgba(11, 16, 32, 0.4)); overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: transform 0.35s, border-color 0.3s, box-shadow 0.3s;
}
.cast-page .act::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; height: 3px; background: var(--cc); box-shadow: 0 0 10px rgba(var(--cc-rgb), 0.6); }
.cast-page .act:hover { transform: translateY(-6px); border-color: var(--cc); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 30px rgba(var(--cc-rgb), 0.2); }
.cast-page .act .ico {
  width: 54px; height: 54px; border: 1px solid var(--cc);
  display: flex; align-items: center; justify-content: center; color: var(--cc);
  font-family: var(--f-en); font-weight: 800; font-size: 20px; letter-spacing: 0.05em;
  clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
  background: rgba(var(--cc-rgb), 0.08); box-shadow: 0 0 20px rgba(var(--cc-rgb), 0.2) inset; flex-shrink: 0;
}
.cast-page .act .head { display: flex; align-items: center; gap: 14px; margin-bottom: 6px; }
.cast-page .act .chibi {
  position: relative; aspect-ratio: 1/1; width: 100%; margin: 14px 0 6px;
  border: 1px solid var(--line-2); background: rgba(11, 16, 32, 0.6); overflow: hidden;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.cast-page .act .chibi img {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
  background: radial-gradient(ellipse at 50% 70%, rgba(var(--cc-rgb), 0.18), transparent 60%);
  transition: transform 0.5s;
}
.cast-page .act:hover .chibi img { transform: scale(1.05); }
.cast-page .act .chibi::after { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 4px); pointer-events: none; opacity: 0.5; }
.cast-page .act .who { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.3em; color: var(--cc); text-transform: uppercase; margin-top: 14px; }
.cast-page .act h3 { font-family: var(--f-jp-h); font-weight: 700; font-size: 18px; margin: 6px 0 10px; color: #fff; line-height: 1.4; }
.cast-page .act p { margin: 0 0 12px; color: #cdd6ff; font-size: 13.5px; line-height: 1.7; }
.cast-page .act .quote { position: relative; border-top: 1px dashed var(--line-2); padding-top: 12px; margin-top: auto; font-family: var(--f-jp); font-size: 12.5px; color: #dbe1ff; line-height: 1.6; font-style: italic; }
.cast-page .act .quote::before { content: "//"; color: var(--cc); font-family: var(--f-mono); font-style: normal; margin-right: 6px; letter-spacing: 0.1em; }
.cast-page .act .tags { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; }
.cast-page .act .tags span { font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--cc); border: 1px solid rgba(var(--cc-rgb), 0.4); padding: 3px 8px; border-radius: 2px; }

/* ====== Gallery ====== */
.cast-page .gal-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.22em; color: var(--ink-dim); text-transform: uppercase; flex-wrap: wrap; gap: 12px; }
.cast-page .gal-bar .pill-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.cast-page .gal-bar .pill-tabs button {
  padding: 6px 12px; border: 1px solid var(--line-2); font-family: var(--f-mono);
  font-size: 10px; letter-spacing: 0.22em; color: var(--ink-dim); transition: all 0.25s;
  clip-path: polygon(0 0, calc(100% - 8px) 0, 100% 8px, 100% 100%, 8px 100%, 0 calc(100% - 8px));
}
.cast-page .gal-bar .pill-tabs button:hover { color: #fff; }
.cast-page .gal-bar .pill-tabs button.on { border-color: var(--c); color: var(--c); box-shadow: 0 0 16px rgba(var(--c-rgb), 0.25); background: rgba(var(--c-rgb), 0.06); }

.cast-page .gal { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 140px; gap: 14px; }
.cast-page .gal .it {
  position: relative; overflow: hidden; border: 1px solid var(--line-2); background: rgba(11, 16, 32, 0.6); cursor: zoom-in;
  clip-path: polygon(0 0, calc(100% - 12px) 0, 100% 12px, 100% 100%, 12px 100%, 0 calc(100% - 12px));
  transition: border-color 0.35s, transform 0.35s, box-shadow 0.35s;
}
.cast-page .gal .it img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform 1.2s cubic-bezier(0.2, 0.7, 0.2, 1), filter 0.5s; filter: saturate(0.85) brightness(0.92); }
.cast-page .gal .it::after { content: ""; position: absolute; inset: 0; background: linear-gradient(to top, rgba(7, 9, 18, 0.6) 0%, transparent 35%); pointer-events: none; opacity: 0.7; }
.cast-page .gal .it::before { content: ""; position: absolute; inset: 0; background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, 0.04) 0 1px, transparent 1px 4px); mix-blend-mode: overlay; pointer-events: none; opacity: 0.4; z-index: 1; }
.cast-page .gal .it:hover { border-color: var(--c); transform: translateY(-3px); box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 30px rgba(var(--c-rgb), 0.18); }
.cast-page .gal .it:hover img { transform: scale(1.06); filter: none; }
.cast-page .gal .it .cap { position: absolute; left: 12px; bottom: 10px; font-family: var(--f-mono); font-size: 9px; letter-spacing: 0.25em; color: #dbe1ff; text-transform: uppercase; z-index: 2; opacity: 0.85; display: flex; gap: 8px; align-items: center; }
.cast-page .gal .it .cap .k { color: var(--c); text-shadow: 0 0 6px var(--c-glow); }

.cast-page .gal .it:nth-child(1) { grid-column: span 3; grid-row: span 2; }
.cast-page .gal .it:nth-child(2) { grid-column: span 3; grid-row: span 1; }
.cast-page .gal .it:nth-child(3) { grid-column: span 1; grid-row: span 1; }
.cast-page .gal .it:nth-child(4) { grid-column: span 2; grid-row: span 1; }
.cast-page .gal .it:nth-child(5) { grid-column: span 2; grid-row: span 2; }
.cast-page .gal .it:nth-child(6) { grid-column: span 2; grid-row: span 1; }
.cast-page .gal .it:nth-child(7) { grid-column: span 2; grid-row: span 1; }
.cast-page .gal .it:nth-child(8) { grid-column: span 2; grid-row: span 1; }
.cast-page .gal .it:nth-child(9) { grid-column: span 2; grid-row: span 1; }

@media (max-width: 980px) {
  .cast-page .gal { grid-template-columns: repeat(4, 1fr); grid-auto-rows: 120px; }
  .cast-page .gal .it:nth-child(1) { grid-column: span 4; grid-row: span 2; }
  .cast-page .gal .it:nth-child(2) { grid-column: span 2; grid-row: span 1; }
  .cast-page .gal .it:nth-child(3) { grid-column: span 2; grid-row: span 1; }
  .cast-page .gal .it:nth-child(4) { grid-column: span 2; grid-row: span 1; }
  .cast-page .gal .it:nth-child(5) { grid-column: span 2; grid-row: span 2; }
  .cast-page .gal .it:nth-child(6) { grid-column: span 2; grid-row: span 1; }
  .cast-page .gal .it:nth-child(7) { grid-column: span 2; grid-row: span 1; }
  .cast-page .gal .it:nth-child(8) { grid-column: span 2; grid-row: span 1; }
  .cast-page .gal .it:nth-child(9) { grid-column: span 4; grid-row: span 1; }
}
@media (max-width: 640px) {
  .cast-page .gal { grid-template-columns: repeat(2, 1fr); grid-auto-rows: 90px; }
  .cast-page .gal .it:nth-child(1) { grid-column: span 2; grid-row: span 2; }
  .cast-page .gal .it:nth-child(n+2) { grid-column: span 1; grid-row: span 1; }
  .cast-page .gal .it:nth-child(5) { grid-column: span 2; grid-row: span 2; }
}

/* ====== About / Terminal ====== */
.cast-page .about { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); gap: 32px; align-items: start; }
.cast-page .about .copy p { color: #cdd6ff; font-size: 15px; line-height: 1.95; margin: 0 0 14px; }
.cast-page .about .copy h2 { font-family: var(--f-jp-h); font-weight: 700; color: #fff; font-size: 22px; margin: 0 0 18px; }
.cast-page .about table { margin-top: 24px; width: 100%; border-collapse: collapse; font-size: 13px; }
.cast-page .about table th, .cast-page .about table td { padding: 10px 12px; border-bottom: 1px solid var(--line-2); text-align: left; vertical-align: top; }
.cast-page .about table th { font-family: var(--f-mono); font-size: 10px; letter-spacing: 0.25em; color: var(--c); text-transform: uppercase; width: 130px; font-weight: 500; }
.cast-page .about table td { color: #dbe1ff; }

.cast-page .terminal {
  position: relative; background: #04060e; border: 1px solid var(--line-2);
  font-family: var(--f-mono); font-size: 12.5px; line-height: 1.85; color: #cbd5ff;
  box-shadow: 0 0 60px rgba(103, 232, 249, 0.08); min-height: 420px;
}
.cast-page .terminal .tbar { display: flex; justify-content: space-between; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line-2); background: #0a0e1c; font-size: 10px; letter-spacing: 0.3em; color: var(--silver); text-transform: uppercase; }
.cast-page .terminal .tbar .dots { display: flex; gap: 6px; }
.cast-page .terminal .tbar .dots i { width: 9px; height: 9px; border-radius: 50%; background: #3a3a3a; display: inline-block; }
.cast-page .terminal .tbar .dots i:nth-child(1) { background: #ef4444; }
.cast-page .terminal .tbar .dots i:nth-child(2) { background: #f59e0b; }
.cast-page .terminal .tbar .dots i:nth-child(3) { background: #10b981; }
.cast-page .terminal .body { padding: 18px 18px 22px; white-space: pre-wrap; min-height: 380px; }
.cast-page .terminal .body .pp { color: #67e8f9; }
.cast-page .terminal .body .ok { color: #10b981; }
.cast-page .terminal .body .wn { color: #f59e0b; }
.cast-page .terminal .body .me { color: #94a3b8; }
.cast-page .terminal .body .ts { color: #586183; }
.cast-page .terminal .body .nm { color: #a78bfa; }
.cast-page .terminal .body .blink { animation: cursor 1s steps(2) infinite; }

/* ====== About Disclaimer (notice) ====== */
.cast-page .about-disclaimer {
  max-width: 1100px;
  margin: 36px auto 0;
  padding: 16px 22px 4px;
  font-size: 12.5px;
  line-height: 1.85;
  color: var(--ink-mute);
  border-top: 1px dashed var(--line-2);
  text-align: center;
  font-family: var(--f-jp);
  letter-spacing: 0.02em;
}
@media (max-width: 640px) {
  .cast-page .about-disclaimer { font-size: 11.5px; padding: 14px 14px 0; }
}

/* ====== Footer ====== */
.cast-page .cast-foot {
  padding: 50px 5vw 36px; border-top: 1px solid var(--line); position: relative;
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--ink-mute); display: flex; justify-content: space-between; flex-wrap: wrap; gap: 20px;
}
.cast-page .cast-foot nav { display: flex; gap: 20px; flex-wrap: wrap; }
.cast-page .cast-foot nav a { transition: color 0.25s; }
.cast-page .cast-foot nav a:hover { color: var(--c); text-shadow: 0 0 6px var(--c-glow); }

/* ====== Lightbox ====== */
.cast-page .lb { position: fixed; inset: 0; background: rgba(4, 6, 14, 0.92); z-index: 300; display: none; align-items: center; justify-content: center; padding: 30px; cursor: zoom-out; }
.cast-page .lb.on { display: flex; }
.cast-page .lb img { max-width: 92vw; max-height: 90vh; border: 1px solid var(--c); box-shadow: 0 0 90px rgba(var(--c-rgb), 0.3); }
.cast-page .lb .x { position: absolute; top: 18px; right: 24px; font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.3em; color: #cbd5ff; border: 1px solid var(--line-2); padding: 6px 12px; text-transform: uppercase; }

/* ====== Responsive ====== */
@media (max-width: 980px) {
  .cast-page .detail { grid-template-columns: 1fr; }
  .cast-page .acts { grid-template-columns: repeat(2, 1fr); }
  .cast-page .about { grid-template-columns: 1fr; }
  .cast-page .cs-rail { grid-template-columns: repeat(5, 1fr); gap: 8px; }
  .cast-page .cs-card .name-en { font-size: 14px; }
  .cast-page .cs-card .name-jp { font-size: 10px; letter-spacing: 0.15em; }
  .cast-page .cs-card .num { font-size: 60px; }
  .cast-page .cs-card .top, .cast-page .cs-card .meta { font-size: 8px; }
  .cast-page .hud-nav { display: none; }
}
@media (max-width: 640px) {
  .cast-page section { padding: 80px 5vw; }
  .cast-page .hero { padding: 90px 5vw 70px; }
  .cast-page .cs-rail { grid-template-columns: repeat(3, 1fr); }
  .cast-page .cs-card:nth-child(n+4) { display: none; }
  .cast-page .voices { grid-template-columns: 1fr; }
  .cast-page .acts { grid-template-columns: 1fr; }
  .cast-page .profile { grid-template-columns: 1fr; }
  .cast-page .cast-foot { flex-direction: column; align-items: flex-start; }
  .cast-page .hud { padding: 10px 14px; font-size: 9px; letter-spacing: 0.12em; }
  .cast-page .hud .hide-sm { display: none; }
}

/* ====== Reduced motion ====== */
@media (prefers-reduced-motion: reduce) {
  .cast-page *, .cast-page *::before, .cast-page *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
  .cast-page #boot { display: none !important; }
}
