:root {
  --ink-950: #11141a;
  --ink-900: #171b23;
  --ink-800: #202631;
  --glass-900: rgba(18, 21, 28, 0.82);
  --glass-800: rgba(27, 31, 41, 0.72);
  --line-soft: rgba(232, 200, 112, 0.22);
  --line-faint: rgba(255, 255, 255, 0.08);
  --title-shadow: rgba(0, 0, 0, 0.58);
  --stage-vignette: rgba(8, 10, 14, 0.52);
  --dialogue-width: min(1120px, calc(100vw - 64px));
  --portrait-scale-adjust: 1;
  --portrait-lift: 0px;
  --mood-wash: rgba(0, 0, 0, 0);
  --mood-contrast: 1.04;
  --mood-saturate: 0.94;
  --bg-brightness: 1;
  --bg-soften: 0px;
  --bg-scale: 1.012;
  --stage-busy-matte: rgba(0, 0, 0, 0);
  --stage-busy-edge: rgba(0, 0, 0, 0);
  --dialogue-accent: rgba(232, 200, 112, 0.24);
  --dialogue-edge: rgba(232, 200, 112, 0.18);
  --panel-rail: rgba(232, 200, 112, 0.68);
}

body {
  background:
    radial-gradient(circle at 50% 25%, rgba(232, 200, 112, 0.08), transparent 34%),
    var(--ink-950);
}

body[data-mood="warm"] {
  --mood-wash: rgba(126, 82, 38, 0.08);
  --mood-saturate: 0.98;
  --mood-contrast: 1.03;
  --dialogue-accent: rgba(232, 178, 104, 0.24);
  --dialogue-edge: rgba(232, 178, 104, 0.2);
}

body[data-mood="tea"] {
  --mood-wash: rgba(66, 88, 64, 0.12);
  --mood-saturate: 0.96;
  --mood-contrast: 1.03;
  --dialogue-accent: rgba(171, 185, 134, 0.22);
  --dialogue-edge: rgba(171, 185, 134, 0.2);
}

body[data-mood="cool"] {
  --mood-wash: rgba(73, 112, 138, 0.12);
  --mood-saturate: 0.86;
  --mood-contrast: 1.06;
  --dialogue-accent: rgba(130, 173, 198, 0.2);
  --dialogue-edge: rgba(130, 173, 198, 0.18);
}

body[data-mood="tense"] {
  --mood-wash: rgba(49, 44, 52, 0.16);
  --mood-saturate: 0.88;
  --mood-contrast: 1.08;
  --dialogue-accent: rgba(201, 158, 111, 0.2);
  --dialogue-edge: rgba(201, 158, 111, 0.18);
}

body[data-mood="night"] {
  --mood-wash: rgba(34, 49, 70, 0.22);
  --mood-saturate: 0.82;
  --mood-contrast: 1.1;
  --dialogue-accent: rgba(110, 137, 165, 0.22);
  --dialogue-edge: rgba(144, 166, 190, 0.18);
}

body[data-bg="office"] {
  --bg-brightness: 0.88;
  --bg-soften: 0.8px;
  --bg-scale: 1.018;
  --stage-busy-matte: rgba(6, 8, 12, 0.14);
  --stage-busy-edge: rgba(6, 8, 12, 0.08);
}

body[data-bg="office-corner-dark-desk"] {
  --bg-brightness: 0.78;
  --bg-soften: 0.9px;
  --bg-scale: 1.024;
  --stage-busy-matte: rgba(6, 8, 12, 0.2);
  --stage-busy-edge: rgba(6, 8, 12, 0.12);
}

body[data-bg="office-window-workstations"] {
  --bg-brightness: 0.9;
  --bg-soften: 0.7px;
  --bg-scale: 1.018;
  --stage-busy-matte: rgba(6, 8, 12, 0.12);
  --stage-busy-edge: rgba(6, 8, 12, 0.08);
}

body[data-bg="meeting-room"] {
  --bg-brightness: 0.86;
  --bg-soften: 0.8px;
  --bg-scale: 1.018;
  --stage-busy-matte: rgba(6, 8, 12, 0.14);
  --stage-busy-edge: rgba(6, 8, 12, 0.08);
}

body[data-bg="office-rest-area"],
body[data-bg="business-lobby"],
body[data-bg="outdoor-bench"] {
  --bg-brightness: 0.9;
  --bg-soften: 0.7px;
  --bg-scale: 1.016;
  --stage-busy-matte: rgba(6, 8, 12, 0.12);
  --stage-busy-edge: rgba(6, 8, 12, 0.06);
}

body[data-bg="client-home-living-room"] {
  --bg-brightness: 0.9;
  --bg-soften: 0.7px;
  --bg-scale: 1.018;
  --stage-busy-matte: rgba(8, 9, 12, 0.14);
  --stage-busy-edge: rgba(8, 9, 12, 0.08);
}

body[data-bg="hospital-icu-corridor"] {
  --bg-brightness: 0.8;
  --bg-soften: 1.25px;
  --bg-scale: 1.024;
  --stage-busy-matte: rgba(7, 12, 18, 0.24);
  --stage-busy-edge: rgba(7, 12, 18, 0.14);
}

body[data-bg="banquet-hall"] {
  --bg-brightness: 0.84;
  --bg-soften: 0.9px;
  --bg-scale: 1.02;
  --stage-busy-matte: rgba(8, 8, 10, 0.18);
  --stage-busy-edge: rgba(8, 8, 10, 0.1);
}

body[data-bg="residential-corridor"],
body[data-bg="car-interior"] {
  --bg-brightness: 0.82;
  --bg-soften: 1px;
  --bg-scale: 1.022;
  --stage-busy-matte: rgba(7, 10, 14, 0.2);
  --stage-busy-edge: rgba(7, 10, 14, 0.12);
}

body[data-bg="cafe"] {
  --bg-brightness: 0.9;
  --bg-soften: 0.6px;
  --bg-scale: 1.016;
  --stage-busy-matte: rgba(6, 8, 12, 0.12);
  --stage-busy-edge: rgba(6, 8, 12, 0.06);
}

body[data-bg="hospital"] {
  --bg-brightness: 0.82;
  --bg-soften: 1.2px;
  --bg-scale: 1.022;
  --stage-busy-matte: rgba(7, 12, 18, 0.2);
  --stage-busy-edge: rgba(7, 12, 18, 0.12);
}

body[data-bg="night"] {
  --bg-brightness: 1.16;
}

body[data-shot="tense"] {
  --mood-contrast: 1.12;
  --mood-saturate: 0.84;
  --stage-busy-matte: rgba(8, 10, 14, 0.2);
}

body[data-shot="close"] {
  --stage-busy-matte: rgba(8, 10, 14, 0.1);
}

body[data-shot="insert"] {
  --stage-busy-matte: rgba(8, 10, 14, 0.16);
}

body[data-shot="cg"] {
  --bg-brightness: 0.62;
  --bg-soften: 1.4px;
  --stage-busy-matte: rgba(4, 6, 9, 0.34);
  --stage-busy-edge: rgba(4, 6, 9, 0.18);
}

.title-screen {
  align-items: flex-start;
  justify-content: flex-end;
  background-image:
    linear-gradient(90deg, rgba(8, 10, 14, 0.94) 0%, rgba(8, 10, 14, 0.76) 36%, rgba(8, 10, 14, 0.22) 72%, rgba(8, 10, 14, 0.5) 100%),
    linear-gradient(180deg, rgba(17, 20, 26, 0.12) 0%, rgba(17, 20, 26, 0.72) 100%),
    url("assets/bg/night.png");
  background-position: center;
  background-size: cover;
  padding: clamp(34px, 6vw, 78px);
  isolation: isolate;
}

.title-screen::before {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 20% 70%, rgba(232, 200, 112, 0.14), transparent 28%);
  background-size: 100% 100%, 100% 100%;
  opacity: 0.9;
  z-index: -1;
}

.title-screen::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, transparent 0%, rgba(0, 0, 0, 0.46) 100%);
  background-size: 96px 100%, 100% 100%;
  mix-blend-mode: soft-light;
  opacity: 0.32;
  z-index: -1;
}

.title-logo {
  text-align: left;
  margin: 0 0 clamp(28px, 6vh, 54px);
  max-width: min(760px, 82vw);
}

.title-logo::after {
  content: "";
  display: block;
  width: min(420px, 58vw);
  height: 1px;
  margin-top: 18px;
  background: linear-gradient(90deg, rgba(232, 200, 112, 0.72), rgba(232, 200, 112, 0.16), transparent);
}

.title-logo h1 {
  color: #f1d58a;
  letter-spacing: 0;
  text-shadow: 0 18px 42px var(--title-shadow), 0 0 28px rgba(232, 200, 112, 0.18);
  margin-bottom: 14px;
  font-size: clamp(46px, 8vw, 92px);
  line-height: 0.98;
}

.title-logo .subtitle {
  color: rgba(236, 229, 212, 0.76);
  letter-spacing: 4px;
  font-size: clamp(13px, 1.5vw, 17px);
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.62);
}

.title-buttons {
  align-items: stretch;
  gap: 10px;
  width: min(300px, 76vw);
}

.title-btn {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line-soft);
  border-left: 3px solid rgba(232, 200, 112, 0.72);
  background: linear-gradient(90deg, rgba(22, 26, 35, 0.82), rgba(22, 26, 35, 0.42));
  box-shadow: 0 16px 42px rgba(0, 0, 0, 0.24);
  color: #ecd596;
  min-width: 0;
  width: 100%;
  padding: 13px 24px;
  text-align: left;
  letter-spacing: 3px;
  backdrop-filter: blur(10px);
}

.title-btn:not(:disabled)::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 50%;
  width: 0;
  height: 0;
  transform: translateY(-50%);
  border-top: 5px solid transparent;
  border-bottom: 5px solid transparent;
  border-left: 7px solid rgba(232, 200, 112, 0.7);
}

.title-btn::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -34%;
  width: 28%;
  transform: skewX(-18deg);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.18), transparent);
  opacity: 0;
  transition: left 0.42s ease, opacity 0.42s ease;
}

.title-btn:hover {
  border-color: rgba(232, 200, 112, 0.62);
  background: linear-gradient(90deg, rgba(40, 45, 57, 0.92), rgba(31, 36, 47, 0.62));
  text-shadow: none;
  transform: translateX(4px);
}

.title-btn:hover::after {
  left: 106%;
  opacity: 1;
}

.title-version {
  right: clamp(24px, 4vw, 48px);
  bottom: clamp(18px, 4vw, 42px);
  color: rgba(232, 226, 214, 0.36);
}

.game-screen {
  display: block;
  background: var(--ink-950);
  isolation: isolate;
}

.top-bar {
  position: absolute;
  inset: 0 0 auto 0;
  z-index: 35;
  height: 38px;
  background: linear-gradient(180deg, rgba(15, 18, 24, 0.86), rgba(15, 18, 24, 0.46));
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding: 0 clamp(16px, 2.5vw, 32px);
  backdrop-filter: blur(10px);
}

.top-bar::before {
  content: "";
  position: absolute;
  left: clamp(16px, 2.5vw, 32px);
  right: clamp(16px, 2.5vw, 32px);
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, rgba(232, 200, 112, 0.36), transparent 38%, transparent 62%, rgba(255, 255, 255, 0.08));
}

.act-label {
  color: rgba(232, 200, 112, 0.82);
  font-weight: 700;
  text-shadow: 0 4px 16px rgba(0, 0, 0, 0.52);
}

.progress-bar {
  height: 2px;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 18px rgba(0, 0, 0, 0.38);
}

.progress-fill {
  background: linear-gradient(90deg, rgba(138, 115, 64, 0.8), rgba(232, 200, 112, 0.9));
  box-shadow: 0 0 12px rgba(232, 200, 112, 0.25);
}

#btn-settings {
  width: 34px;
  height: 28px;
  padding: 0;
  border-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(180deg, rgba(32, 37, 48, 0.88), rgba(16, 19, 26, 0.76));
  color: rgba(232, 226, 214, 0.68);
  font-size: 15px;
  line-height: 1;
  display: inline-grid;
  place-items: center;
}

#btn-settings:hover {
  border-color: rgba(232, 200, 112, 0.38);
  color: #f0d486;
}

.scene-area {
  position: absolute;
  inset: 0;
}

.scene-area::before,
.scene-area::after {
  content: "";
  pointer-events: none;
  position: absolute;
  inset: 0;
}

.scene-area::before {
  z-index: 3;
  background:
    radial-gradient(ellipse at 50% 48%, var(--stage-busy-matte), transparent 58%),
    linear-gradient(90deg, var(--stage-busy-edge), transparent 18%, transparent 82%, var(--stage-busy-edge)),
    linear-gradient(180deg, var(--mood-wash), var(--mood-wash)),
    radial-gradient(ellipse at 50% 44%, transparent 0%, transparent 44%, rgba(4, 6, 9, 0.26) 75%, rgba(4, 6, 9, 0.58) 100%),
    linear-gradient(180deg, rgba(5, 7, 11, 0.08) 0%, transparent 34%, rgba(5, 7, 11, 0.22) 74%, rgba(5, 7, 11, 0.58) 100%);
}

.scene-area::after {
  z-index: 4;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.16), transparent 18%, transparent 82%, rgba(0, 0, 0, 0.18)),
    linear-gradient(180deg, transparent 0%, transparent 58%, rgba(7, 9, 13, 0.46) 100%);
}

.bg-layer {
  z-index: 0;
  filter:
    saturate(var(--mood-saturate))
    contrast(var(--mood-contrast))
    brightness(var(--bg-brightness))
    blur(var(--bg-soften));
  transform: scale(var(--bg-scale));
  transform-origin: center;
}

body.is-choice-open .bg-layer {
  filter:
    saturate(calc(var(--mood-saturate) * 0.82))
    contrast(var(--mood-contrast))
    brightness(calc(var(--bg-brightness) * 0.76))
    blur(calc(var(--bg-soften) + 0.5px));
}

body.is-choice-open .portrait {
  opacity: 0.42;
  filter:
    drop-shadow(0 26px 28px rgba(0, 0, 0, 0.44))
    grayscale(0.08);
}

body.is-choice-open .dialogue-box {
  opacity: 0.72;
}

body[data-shot="tense"] .bg-layer,
body[data-shot="insert"] .bg-layer {
  filter:
    saturate(calc(var(--mood-saturate) * 0.82))
    contrast(var(--mood-contrast))
    brightness(calc(var(--bg-brightness) * 0.82))
    blur(calc(var(--bg-soften) + 0.7px));
}

body[data-shot="cg"] .bg-layer {
  filter:
    saturate(calc(var(--mood-saturate) * 0.62))
    contrast(var(--mood-contrast))
    brightness(calc(var(--bg-brightness) * 0.72))
    blur(calc(var(--bg-soften) + 1px));
}

.portrait-container {
  z-index: 8;
  bottom: clamp(154px, 22vh, 230px);
  --portrait-scale-adjust: 1;
  --portrait-enter-scale: 0.985;
  --portrait-changing-scale: 0.992;
  --portrait-lift: 0px;
  transition: left 0.42s ease, bottom 0.42s ease;
}

.portrait-container::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 10%;
  width: 80%;
  height: 30px;
  background: radial-gradient(ellipse at 50% 0%, rgba(0,0,0,0.35) 0%, rgba(0,0,0,0.12) 40%, transparent 70%);
  pointer-events: none;
  z-index: -1;
}

body[data-cast-size="duo"] .portrait-container {
  left: 42%;
}

body[data-cast-size="duo"] .portrait-container[data-anchor="left"] {
  left: 37%;
}

body[data-cast-size="duo"] .portrait-container[data-anchor="right"] {
  left: 68%;
}

body[data-cast-size="duo"][data-customer-slug=""] .portrait-container[data-anchor="center"] {
  left: 62%;
}

body[data-cast-size="duo"][data-customer-slug=""] .support-portrait-container[data-side="left"] {
  left: 31%;
}

body[data-shot="close"] .portrait-container,
body[data-shot="tense"] .portrait-container {
  bottom: clamp(140px, 21vh, 214px);
}

body.is-narration:not([data-focus-slug]) .portrait-container,
body.is-narration[data-focus-slug=""] .portrait-container {
  visibility: hidden;
}

.portrait-container[data-anchor="left"] {
  left: 40%;
}

.portrait-container[data-anchor="right"] {
  left: 60%;
}

.portrait-container[data-role="direct"],
.portrait-container[data-role="spark"] {
  --portrait-enter-scale: 0.998;
  --portrait-changing-scale: 1.002;
}

.portrait-container[data-role="observer"],
.portrait-container[data-role="analyst"],
.portrait-container[data-role="hope"] {
  --portrait-enter-scale: 0.965;
  --portrait-changing-scale: 0.972;
}

.portrait-container::after {
  content: "";
  pointer-events: none;
  position: absolute;
  left: 50%;
  bottom: 2px;
  width: min(260px, 52vw);
  height: 34px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0) 68%);
  filter: blur(3px);
  opacity: 0;
  transition: opacity 0.36s ease;
}

.portrait-container:has(.portrait.visible)::after {
  opacity: 1;
}

.portrait-container[data-role="direct"]::after,
.portrait-container[data-role="spark"]::after {
  width: min(288px, 56vw);
  opacity: 1;
}

.portrait-container[data-role="observer"]::after,
.portrait-container[data-role="listener"]::after,
.portrait-container[data-role="hope"]::after {
  width: min(232px, 48vw);
}

.portrait {
  width: clamp(250px, 28vw, 390px);
  height: clamp(350px, 62vh, 560px);
  filter:
    drop-shadow(0 0 1px rgba(0, 0, 0, 0.5))
    drop-shadow(0 28px 30px rgba(0, 0, 0, 0.42))
    drop-shadow(0 5px 8px rgba(0, 0, 0, 0.45));
  transform: translateY(calc(10px + var(--portrait-lift))) scale(var(--portrait-enter-scale));
  transition: opacity 0.32s ease, transform 0.42s ease, filter 0.36s ease;
}

.portrait.visible {
  transform: translateY(var(--portrait-lift)) scale(var(--portrait-scale-adjust));
}

.portrait.pose-changing {
  opacity: 0.35;
  transform: translateY(calc(2px + var(--portrait-lift))) scale(var(--portrait-changing-scale));
}

.portrait-container[data-role="mentor"] .portrait,
.portrait-container[data-role="teacher"] .portrait {
  filter:
    drop-shadow(0 30px 30px rgba(0, 0, 0, 0.44))
    drop-shadow(0 0 12px rgba(232, 200, 112, 0.1));
}

.portrait-container[data-role="direct"] .portrait,
.portrait-container[data-role="guard"] .portrait {
  filter:
    drop-shadow(0 30px 32px rgba(0, 0, 0, 0.48))
    drop-shadow(0 4px 6px rgba(0, 0, 0, 0.52));
}

.portrait-container[data-role="warmth"] .portrait,
.portrait-container[data-role="hope"] .portrait {
  filter:
    drop-shadow(0 28px 28px rgba(0, 0, 0, 0.38))
    drop-shadow(0 0 12px rgba(232, 178, 104, 0.12));
}

body[data-shot="close"] .portrait,
body[data-shot="tense"] .portrait {
  width: clamp(270px, 30vw, 410px);
  height: clamp(378px, 64vh, 586px);
}

body[data-shot="tense"] .portrait {
  filter:
    drop-shadow(0 34px 34px rgba(0, 0, 0, 0.52))
    drop-shadow(0 3px 8px rgba(0, 0, 0, 0.58));
}

.support-portrait-container {
  position: absolute;
  z-index: 7;
  left: 34%;
  bottom: clamp(156px, 22vh, 232px);
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease, left 0.42s ease, transform 0.42s ease;
}

.support-portrait-container[data-side="right"] {
  left: 66%;
}

.support-portrait-container.visible {
  opacity: 1;
}

.support-portrait-container::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: min(210px, 42vw);
  height: 26px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.34), rgba(0, 0, 0, 0) 68%);
  filter: blur(3px);
}

.support-portrait {
  display: block;
  width: clamp(210px, 22vw, 315px);
  height: clamp(294px, 52vh, 450px);
  object-fit: contain;
  object-position: bottom center;
  opacity: 0;
  transform: translateY(8px) scale(0.94);
  filter:
    grayscale(0.12)
    brightness(0.72)
    drop-shadow(0 22px 24px rgba(0, 0, 0, 0.42));
  transition: opacity 0.32s ease, transform 0.42s ease, filter 0.36s ease;
}

.support-portrait.visible {
  opacity: 0.58;
  transform: translateY(0) scale(0.94);
}

body[data-shot="tense"] .support-portrait.visible {
  opacity: 0.48;
  filter:
    grayscale(0.18)
    brightness(0.62)
    drop-shadow(0 22px 24px rgba(0, 0, 0, 0.48));
}

.customer-portrait-container {
  position: absolute;
  z-index: 7;
  left: 68%;
  bottom: clamp(156px, 22vh, 232px);
  transform: translateX(-50%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.32s ease, left 0.42s ease, transform 0.42s ease;
}

.customer-portrait-container[data-side="left"] {
  left: 33%;
}

.customer-portrait-container.visible {
  opacity: 1;
}

.customer-portrait-container::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 1px;
  width: min(214px, 42vw);
  height: 28px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: radial-gradient(ellipse, rgba(0, 0, 0, 0.36), rgba(0, 0, 0, 0) 68%);
  filter: blur(3px);
}

.customer-portrait {
  display: block;
  width: clamp(220px, 23vw, 330px);
  height: clamp(308px, 54vh, 462px);
  object-fit: contain;
  object-position: bottom center;
  opacity: 0;
  transform: translateY(8px) scale(0.95);
  filter:
    brightness(0.84)
    saturate(0.92)
    drop-shadow(0 24px 28px rgba(0, 0, 0, 0.46));
  transition: opacity 0.32s ease, transform 0.42s ease, filter 0.36s ease;
}

.customer-portrait.visible {
  opacity: 0.78;
  transform: translateY(0) scale(0.95);
}

body[data-shot="tense"] .customer-portrait.visible {
  opacity: 0.7;
  filter:
    brightness(0.76)
    saturate(0.86)
    drop-shadow(0 26px 30px rgba(0, 0, 0, 0.52));
}

.event-cg-layer {
  position: absolute;
  inset: clamp(54px, 8vh, 78px) clamp(30px, 6vw, 80px) clamp(204px, 26vh, 260px);
  z-index: 6;
  display: grid;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px) scale(0.985);
  transition: opacity 0.42s ease, transform 0.52s ease;
}

.event-cg-layer::before {
  content: "";
  position: absolute;
  inset: -18px;
  border: 1px solid rgba(232, 200, 112, 0.18);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 30%),
    rgba(8, 10, 14, 0.32);
  box-shadow:
    0 30px 90px rgba(0, 0, 0, 0.52),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(2px);
}

.event-cg-layer.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.event-cg-image {
  position: relative;
  z-index: 1;
  display: block;
  width: min(100%, 940px);
  height: auto;
  max-height: 100%;
  object-fit: contain;
  opacity: 0;
  filter:
    saturate(0.95)
    contrast(1.04)
    drop-shadow(0 22px 34px rgba(0, 0, 0, 0.5));
  transition: opacity 0.38s ease;
}

.event-cg-image.visible {
  opacity: 1;
}

body[data-shot="cg"] .portrait-container,
body[data-shot="cg"] .support-portrait-container,
body[data-shot="cg"] .customer-portrait-container,
body[data-shot="cg"] .visual-insert {
  opacity: 0;
  visibility: hidden;
}

body.is-transitioning .dialogue-box {
  opacity: 0;
  pointer-events: none;
}

body[data-shot="cg"] .dialogue-box {
  background:
    linear-gradient(180deg, rgba(22, 26, 35, 0.58), rgba(10, 13, 18, 0.84)),
    linear-gradient(90deg, color-mix(in srgb, var(--dialogue-accent), transparent 66%), transparent 38%);
}

.visual-insert {
  position: absolute;
  z-index: 10;
  right: clamp(72px, 8vw, 132px);
  top: clamp(82px, 15vh, 150px);
  width: clamp(132px, 16vw, 230px);
  min-height: 120px;
  border: 1px solid rgba(232, 200, 112, 0.2);
  border-radius: 5px;
  background:
    linear-gradient(180deg, rgba(31, 36, 47, 0.78), rgba(12, 15, 21, 0.88)),
    linear-gradient(90deg, rgba(232, 200, 112, 0.12), transparent 44%);
  box-shadow:
    0 24px 56px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  padding: 12px 12px 10px;
  opacity: 0;
  transform: translateY(10px) scale(0.96);
  pointer-events: none;
  transition: opacity 0.28s ease, transform 0.34s ease;
}

.visual-insert.visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}

.visual-insert-label {
  color: rgba(232, 200, 112, 0.78);
  font-family: var(--font-ui);
  font-size: 10px;
  letter-spacing: 3px;
  line-height: 1;
  margin-bottom: 8px;
}

.visual-insert-image {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: contain;
  filter:
    drop-shadow(0 12px 16px rgba(0, 0, 0, 0.34))
    saturate(0.9);
}

.visual-insert-title {
  margin-top: 7px;
  color: rgba(247, 243, 232, 0.78);
  font-size: 12px;
  line-height: 1.2;
  letter-spacing: 1px;
}

.dialogue-box {
  left: 50%;
  right: auto;
  bottom: clamp(16px, 3vh, 30px);
  width: var(--dialogue-width);
  height: clamp(158px, 21vh, 200px);
  transform: translateX(-50%);
  border: 1px solid var(--dialogue-edge);
  border-top-color: color-mix(in srgb, var(--dialogue-edge), rgba(255, 255, 255, 0.28) 45%);
  border-radius: 6px;
  background:
    linear-gradient(180deg, rgba(27, 31, 41, 0.74), rgba(12, 15, 21, 0.92)),
    linear-gradient(90deg, color-mix(in srgb, var(--dialogue-accent), transparent 50%), transparent 34%, rgba(255, 255, 255, 0.04));
  box-shadow:
    0 26px 76px rgba(0, 0, 0, 0.46),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: clamp(15px, 2vh, 22px) clamp(22px, 3.5vw, 44px) 22px;
  backdrop-filter: blur(14px);
}

.dialogue-box::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  background:
    linear-gradient(90deg, var(--dialogue-accent), transparent 20%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), transparent 38%);
  opacity: 0.45;
}

body.is-narration .dialogue-box {
  border-color: rgba(255, 255, 255, 0.1);
  background:
    linear-gradient(180deg, rgba(27, 31, 41, 0.54), rgba(12, 15, 21, 0.78)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), transparent 34%);
}

body.is-narration .dialogue-box::before {
  opacity: 0.18;
}

body.is-narration .dialogue-text {
  color: rgba(247, 243, 232, 0.86);
}

body.is-long-text .dialogue-text {
  font-size: clamp(15px, 1.42vw, 18px);
  line-height: 1.82;
}

.speaker-name {
  position: relative;
  color: #f0d486;
  min-height: 24px;
  margin-bottom: 8px;
  padding-left: 14px;
  font-size: 14px;
  letter-spacing: 2px;
  text-shadow: 0 4px 12px rgba(0, 0, 0, 0.62);
}

.speaker-name:empty {
  min-height: 0;
  margin-bottom: 0;
  padding-left: 0;
}

.speaker-name:empty::before {
  display: none;
}

.speaker-name::before {
  content: "";
  position: absolute;
  left: 0;
  top: 4px;
  bottom: 4px;
  width: 3px;
  background: linear-gradient(180deg, rgba(232, 200, 112, 0.98), rgba(138, 115, 64, 0.42));
}

.dialogue-text {
  position: relative;
  color: rgba(247, 243, 232, 0.94);
  max-width: 980px;
  font-size: clamp(16px, 1.55vw, 19px);
  line-height: 1.88;
  letter-spacing: 0;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.32);
}

.click-indicator {
  right: clamp(18px, 3vw, 36px);
  bottom: 13px;
  color: rgba(232, 226, 214, 0.42);
  letter-spacing: 1px;
}

.choice-panel {
  z-index: 32;
  width: min(720px, calc(100vw - 48px));
  gap: 12px;
  top: 48%;
}

.choice-panel::before {
  content: "";
  display: block;
  width: min(340px, 70%);
  height: 1px;
  margin: 0 0 2px;
  background: linear-gradient(90deg, var(--dialogue-accent), transparent);
}

.choice-btn {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(232, 200, 112, 0.22);
  border-left: 4px solid var(--panel-rail);
  border-radius: 5px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--dialogue-accent), transparent 68%), transparent 38%),
    linear-gradient(180deg, rgba(28, 33, 43, 0.96), rgba(13, 16, 23, 0.93));
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.42),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(12px);
  min-height: 74px;
  padding: 15px 22px 15px 64px;
  color: rgba(247, 243, 232, 0.92);
}

.choice-btn::before {
  content: attr(data-choice-label);
  position: absolute;
  left: 20px;
  top: 50%;
  width: 28px;
  height: 28px;
  transform: translateY(-50%);
  border: 1px solid rgba(232, 200, 112, 0.48);
  color: #f0d486;
  display: grid;
  place-items: center;
  font-family: var(--font-ui);
  font-size: 13px;
  line-height: 1;
  background: rgba(232, 200, 112, 0.08);
}

.choice-btn::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.08), transparent);
  transform: translateX(-110%) skewX(-16deg);
  transition: transform 0.46s ease;
}

.choice-label {
  color: rgba(232, 200, 112, 0.88);
  margin-bottom: 5px;
  font-size: 12px;
  letter-spacing: 2px;
}

.choice-btn:hover {
  border-color: rgba(232, 200, 112, 0.48);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--dialogue-accent), transparent 54%), transparent 42%),
    linear-gradient(180deg, rgba(41, 46, 58, 0.98), rgba(20, 24, 33, 0.95));
  transform: translateX(8px);
}

.choice-btn:hover::after {
  transform: translateX(110%) skewX(-16deg);
}

.manual-overlay {
  border-color: rgba(232, 200, 112, 0.28);
  background: rgba(18, 22, 30, 0.9);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(14px);
}

.monologue-overlay {
  background: rgba(8, 10, 14, 0.72);
  backdrop-filter: blur(5px);
}

.monologue-text {
  color: rgba(247, 243, 232, 0.8);
  font-size: clamp(17px, 1.8vw, 22px);
  text-shadow: 0 6px 22px rgba(0, 0, 0, 0.58);
}

.settings-panel {
  top: 38px;
  width: min(320px, calc(100vw - 24px));
  border-left: 1px solid rgba(232, 200, 112, 0.2);
  border-bottom: 1px solid rgba(232, 200, 112, 0.16);
  background:
    linear-gradient(90deg, rgba(232, 200, 112, 0.08), transparent 34%),
    linear-gradient(180deg, rgba(29, 34, 45, 0.96), rgba(14, 17, 24, 0.94));
  box-shadow: -18px 26px 70px rgba(0, 0, 0, 0.44);
  backdrop-filter: blur(14px);
  padding: 22px;
}

.settings-panel::before {
  content: "";
  position: absolute;
  left: 0;
  top: 18px;
  bottom: 18px;
  width: 3px;
  background: linear-gradient(180deg, rgba(232, 200, 112, 0.82), rgba(232, 200, 112, 0.12));
}

.settings-title {
  color: #f0d486;
  font-size: 13px;
  letter-spacing: 3px;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.settings-row {
  min-height: 38px;
  margin-bottom: 12px;
  color: rgba(232, 226, 214, 0.68);
  letter-spacing: 1px;
}

.settings-row > div:last-child {
  display: flex;
  gap: 6px;
}

.settings-btn {
  border-color: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.035);
  color: rgba(232, 226, 214, 0.62);
  min-height: 30px;
}

.settings-btn:hover,
.settings-btn.is-active {
  border-color: rgba(232, 200, 112, 0.42);
  background: rgba(232, 200, 112, 0.1);
  color: #f0d486;
}

.settings-btn.danger {
  border-color: rgba(154, 90, 90, 0.42);
  color: rgba(230, 158, 148, 0.8);
}

.settings-btn.danger:hover {
  background: rgba(154, 90, 90, 0.12);
  color: #f1b0a8;
}

.act-transition {
  background:
    linear-gradient(90deg, rgba(8, 10, 14, 0.98), rgba(8, 10, 14, 0.82) 42%, rgba(8, 10, 14, 0.96)),
    url("assets/bg/night.png");
  background-position: center;
  background-size: cover;
  isolation: isolate;
}

.act-transition::before,
.act-transition::after {
  content: "";
  position: absolute;
  pointer-events: none;
}

.act-transition::before {
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12) 0 1px, transparent 1px 100%),
    radial-gradient(circle at 50% 48%, rgba(232, 200, 112, 0.16), transparent 28%);
  background-size: 100% 100%, 100% 100%;
  opacity: 0.72;
  z-index: -1;
}

.act-transition::after {
  left: 50%;
  top: calc(50% + 56px);
  width: min(520px, 72vw);
  height: 1px;
  transform: translateX(-50%);
  background: linear-gradient(90deg, transparent, rgba(232, 200, 112, 0.72), transparent);
}

.act-transition h2 {
  position: relative;
  max-width: min(880px, calc(100vw - 48px));
  padding: 0 28px 22px;
  color: #f1d58a;
  font-size: clamp(30px, 4.2vw, 58px);
  line-height: 1.24;
  letter-spacing: 4px;
  text-align: center;
  text-shadow:
    0 18px 42px rgba(0, 0, 0, 0.72),
    0 0 26px rgba(232, 200, 112, 0.22);
}

.act-transition h2::before {
  content: "CHAPTER";
  display: block;
  margin-bottom: 12px;
  color: rgba(232, 226, 214, 0.36);
  font-family: var(--font-ui);
  font-size: 12px;
  line-height: 1;
  letter-spacing: 5px;
}

@media (max-width: 720px) {
  :root {
    --dialogue-width: calc(100vw - 24px);
  }

  .title-screen {
    padding: 28px 22px 34px;
  }

  .title-logo h1 {
    font-size: clamp(38px, 14vw, 58px);
  }

  .title-logo .subtitle {
    letter-spacing: 2px;
    line-height: 1.7;
  }

  .portrait-container {
    bottom: clamp(258px, 34vh, 300px);
  }

  .portrait-container[data-anchor="left"],
  .portrait-container[data-anchor="right"] {
    left: 50%;
  }

  .portrait {
    width: min(68vw, 300px);
    height: min(47vh, 380px);
  }

  body[data-shot="close"] .portrait,
  body[data-shot="tense"] .portrait {
    width: min(72vw, 318px);
    height: min(48vh, 398px);
  }

  body[data-cast-size="duo"] .portrait-container,
  body[data-cast-size="duo"] .portrait-container[data-anchor="left"],
  body[data-cast-size="duo"] .portrait-container[data-anchor="right"] {
    left: 63%;
  }

  .support-portrait-container,
  .support-portrait-container[data-side="right"] {
    left: 19%;
    bottom: clamp(270px, 36vh, 320px);
  }

  .support-portrait {
    width: min(36vw, 154px);
    height: min(34vh, 242px);
  }

  .customer-portrait-container,
  .customer-portrait-container[data-side="left"],
  .customer-portrait-container[data-side="right"] {
    left: 19%;
    bottom: clamp(270px, 36vh, 320px);
  }

  .customer-portrait {
    width: min(35vw, 156px);
    height: min(35vh, 258px);
  }

  body[data-cast-size="duo"][data-customer-slug=""] .portrait-container[data-anchor="center"] {
    left: 66%;
  }

  body[data-cast-size="duo"][data-customer-slug=""] .support-portrait-container[data-side="left"] {
    left: 18%;
  }

  body[data-cast-size="duo"][data-customer-slug=""] .support-portrait {
    width: min(31vw, 118px);
  }

  .event-cg-layer {
    inset: 72px 14px min(250px, 30vh);
  }

  .event-cg-layer::before {
    inset: -8px;
  }

  .visual-insert {
    right: 14px;
    top: 92px;
    width: min(30vw, 118px);
    min-height: 96px;
    padding: 8px;
  }

  .visual-insert-label {
    font-size: 8px;
    letter-spacing: 2px;
    margin-bottom: 5px;
  }

  .visual-insert-title {
    font-size: 10px;
  }

  .dialogue-box {
    bottom: 12px;
    height: min(260px, 31vh);
    padding: 15px 18px 22px;
  }

  .dialogue-text {
    font-size: 14px;
    line-height: 1.66;
    max-width: none;
    padding-right: 4px;
  }

  body.is-long-text .dialogue-text {
    font-size: 13.5px;
    line-height: 1.62;
  }

  .top-bar {
    padding: 0 14px;
  }

  .choice-panel {
    width: calc(100vw - 24px);
    top: 47%;
    gap: 9px;
  }

  .choice-btn {
    min-height: 70px;
    padding: 13px 15px 13px 54px;
    font-size: 13px;
    line-height: 1.5;
  }

  .choice-btn::before {
    left: 16px;
    width: 25px;
    height: 25px;
  }

  .settings-panel {
    top: 74px;
    right: 12px;
  }

  .act-transition h2 {
    letter-spacing: 2px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
