:root {
  color-scheme: dark;
  --void: #07080a;
  --stone: #151a1f;
  --stone-2: #232a31;
  --ink: #f5f7fa;
  --muted: #9ca7b5;
  --line: rgba(205, 222, 238, 0.18);
  --screen: #bdefff;
  --gold: #b99143;
  --red: #c55245;
  --glass: rgba(8, 11, 15, 0.78);
  --shadow: 0 26px 90px rgba(0, 0, 0, 0.52);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100svh;
  overflow: hidden;
  font-family:
    "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 50% 0%, rgba(189, 239, 255, 0.13), transparent 32rem),
    linear-gradient(180deg, #0d1014 0%, var(--void) 100%);
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.vn-app {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-height: 100svh;
  padding: 12px;
}

.vn-topbar {
  z-index: 10;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  width: min(1180px, 100%);
  min-height: 52px;
  margin: 0 auto 10px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(9, 11, 13, 0.76);
  backdrop-filter: blur(16px);
}

.vn-topbar p,
.vn-topbar h1 {
  margin: 0;
  letter-spacing: 0;
}

.vn-topbar p,
.vn-topbar span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.vn-topbar h1 {
  margin-top: 2px;
  font-size: 18px;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 800;
}

.stage-wrap {
  display: grid;
  place-items: center;
  min-height: 0;
}

.vn-stage {
  position: relative;
  width: min(100%, calc((100svh - 98px) * 16 / 9));
  max-width: 1180px;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101419;
  box-shadow: var(--shadow);
  isolation: isolate;
  cursor: pointer;
}

.vn-stage:focus-visible {
  outline: 2px solid var(--screen);
  outline-offset: 3px;
}

.stage-bg,
.stage-art,
.title-card,
.memory-strip {
  position: absolute;
  inset: 0;
}

.stage-bg {
  z-index: -3;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02), rgba(0, 0, 0, 0.28)),
    var(--scene-image),
    linear-gradient(140deg, rgba(255, 255, 255, 0.08), transparent 24%),
    linear-gradient(180deg, var(--stone-2), var(--stone));
  background-position:
    center,
    var(--scene-position, center),
    center,
    center;
  background-size:
    cover,
    var(--scene-size, cover),
    auto,
    auto;
  transition:
    background-position 420ms ease,
    background-size 420ms ease,
    filter 420ms ease;
}

.stage-bg::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(189, 239, 255, 0.08) 1px, transparent 1px),
    linear-gradient(0deg, rgba(189, 239, 255, 0.08) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at 50% 42%, black, transparent 72%);
}

.vn-stage.has-scene-image .stage-bg::before {
  display: none;
}

.stage-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.68), transparent 24%, transparent 76%, rgba(0, 0, 0, 0.68)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.48));
  transition: background 420ms ease;
}

.vn-stage[data-focus="left"] .stage-bg::after {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08), transparent 34%, rgba(0, 0, 0, 0.72)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.5));
}

.vn-stage[data-focus="right"] .stage-bg::after {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.72), transparent 54%, rgba(0, 0, 0, 0.1)),
    linear-gradient(180deg, rgba(0, 0, 0, 0.04), rgba(0, 0, 0, 0.5));
}

.vn-stage[data-visual="blackout"] .stage-bg {
  background: #000;
}

.vn-stage[data-visual="blackout"] .stage-bg::before,
.vn-stage[data-visual="blackout"] .stage-bg::after {
  display: none;
}

.vn-stage[data-visual="memory"]:not(.has-scene-image) .stage-bg {
  background:
    radial-gradient(circle at 50% 45%, rgba(189, 239, 255, 0.14), transparent 38%),
    linear-gradient(180deg, #22262d, #0d1014);
}

.vn-stage[data-visual="rich"]:not(.has-scene-image) .stage-bg {
  background:
    radial-gradient(circle at 46% 48%, rgba(185, 145, 67, 0.22), transparent 32%),
    linear-gradient(180deg, #26231f, #0d0f10);
}

.vn-stage[data-visual="door"]:not(.has-scene-image) .stage-bg {
  background:
    radial-gradient(circle at 70% 52%, rgba(189, 239, 255, 0.12), transparent 26%),
    linear-gradient(180deg, #22282f, #08090b);
}

.stage-art {
  z-index: 1;
  transition: opacity 260ms ease;
}

.prop {
  position: absolute;
  display: block;
}

.floor {
  left: 8%;
  right: 8%;
  bottom: 7%;
  height: 25%;
  border: 1px solid rgba(189, 239, 255, 0.08);
  transform: perspective(580px) rotateX(62deg);
  background: linear-gradient(180deg, rgba(189, 239, 255, 0.05), rgba(0, 0, 0, 0.24));
}

.desk {
  left: 25%;
  right: 25%;
  bottom: 23%;
  height: 11%;
  border: 1px solid rgba(189, 239, 255, 0.24);
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 20%, rgba(189, 239, 255, 0.24), transparent 58%),
    rgba(4, 6, 8, 0.74);
  box-shadow: 0 0 46px rgba(189, 239, 255, 0.13);
}

.screen {
  left: 36%;
  top: 22%;
  width: 28%;
  height: 22%;
  border: 1px solid rgba(189, 239, 255, 0.44);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(189, 239, 255, 0.27), rgba(189, 239, 255, 0.02));
  box-shadow: 0 0 42px rgba(189, 239, 255, 0.2);
  transform: skewX(-8deg);
}

.recorder,
.saja {
  bottom: 24%;
  width: 14%;
  height: 36%;
}

.recorder {
  left: 23%;
}

.saja {
  right: 23%;
}

.recorder::before,
.saja::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  width: 34%;
  aspect-ratio: 1;
  border-radius: 50%;
  transform: translateX(-50%);
}

.recorder::before {
  background:
    radial-gradient(circle at 50% 52%, rgba(189, 239, 255, 0.22), transparent 38%),
    #d7dde2;
  box-shadow:
    0 0 28px rgba(189, 239, 255, 0.3),
    inset 0 0 0 1px rgba(5, 9, 12, 0.16);
}

.saja::before {
  background: #aeb3b7;
  box-shadow: inset -8px -8px 0 rgba(0, 0, 0, 0.12);
}

.recorder::after,
.saja::after {
  content: "";
  position: absolute;
  left: 18%;
  right: 18%;
  top: 28%;
  bottom: 0;
  border-radius: 42% 42% 8% 8%;
}

.recorder::after {
  background: linear-gradient(180deg, #050607, #11161b);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06);
}

.saja::after {
  background: linear-gradient(180deg, #32363a, #17191c);
}

.ring {
  left: 49%;
  bottom: 24%;
  width: clamp(14px, 2.2vw, 26px);
  aspect-ratio: 1;
  border: clamp(3px, 0.45vw, 5px) solid var(--gold);
  border-radius: 50%;
  box-shadow: 0 0 22px rgba(185, 145, 67, 0.3);
}

.empty-suit {
  left: 42%;
  bottom: 24%;
  width: 16%;
  height: 26%;
  border-radius: 42% 42% 12% 12%;
  background: linear-gradient(180deg, rgba(40, 44, 48, 0.95), rgba(16, 18, 21, 0.78));
  transform: rotate(-2deg);
  filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.38));
}

.door {
  right: 11%;
  bottom: 15%;
  width: 18%;
  height: 58%;
  border: 1px solid rgba(189, 239, 255, 0.18);
  border-radius: 48% 48% 4px 4px;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.74), transparent),
    linear-gradient(180deg, #2d3339, #101316);
  box-shadow: inset 18px 0 38px rgba(0, 0, 0, 0.58);
}

.memory-strip {
  z-index: 2;
  inset: 12%;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.memory-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.1), transparent 40%),
    rgba(15, 18, 22, 0.78);
}

.memory-card::before {
  content: "";
  position: absolute;
  inset: 18% 22% 36%;
  border-radius: 50%;
  background: var(--tone, #bdefff);
  filter: blur(10px);
  opacity: 0.62;
}

.memory-card::after {
  content: attr(data-label);
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 10px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  font-weight: 800;
}

.memory-card:nth-child(1) {
  --tone: #9fb5d7;
}

.memory-card:nth-child(2) {
  --tone: #d7d2c4;
}

.memory-card:nth-child(3) {
  --tone: #c55245;
}

.memory-card:nth-child(4) {
  --tone: #9ec6d3;
}

.memory-card:nth-child(5) {
  --tone: #d7a348;
}

.title-card {
  z-index: 5;
  display: grid;
  align-content: end;
  padding: 0 5% 32%;
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.74), transparent 62%),
    linear-gradient(180deg, transparent 38%, rgba(0, 0, 0, 0.72));
}

.title-card p,
.title-card h2 {
  margin: 0;
}

.title-card p {
  color: var(--screen);
  font-size: clamp(13px, 1.6vw, 18px);
  font-weight: 900;
}

.title-card h2 {
  margin-top: 10px;
  font-size: clamp(48px, 10vw, 116px);
  line-height: 0.92;
  letter-spacing: 0;
}

.dialogue-box {
  position: absolute;
  left: 4%;
  right: 4%;
  bottom: 4%;
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  min-height: 25%;
  padding: clamp(14px, 2vw, 22px);
  border: 1px solid rgba(189, 239, 255, 0.24);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(189, 239, 255, 0.08), transparent 36%),
    var(--glass);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.46);
  backdrop-filter: blur(16px);
  transition:
    border-color 240ms ease,
    box-shadow 240ms ease;
}

.dialogue-box::before {
  content: "";
  position: absolute;
  top: -2px;
  width: 96px;
  height: 2px;
  border-radius: 999px;
  background: transparent;
  transition:
    left 240ms ease,
    right 240ms ease,
    background 240ms ease;
}

.vn-stage[data-focus="left"] .dialogue-box {
  border-left-color: rgba(189, 239, 255, 0.78);
  box-shadow:
    -8px 0 0 rgba(189, 239, 255, 0.08),
    0 18px 50px rgba(0, 0, 0, 0.46);
}

.vn-stage[data-focus="left"] .dialogue-box::before {
  left: 18px;
  background: linear-gradient(90deg, var(--screen), transparent);
}

.vn-stage[data-focus="right"] .dialogue-box {
  border-right-color: rgba(185, 145, 67, 0.78);
  box-shadow:
    8px 0 0 rgba(185, 145, 67, 0.08),
    0 18px 50px rgba(0, 0, 0, 0.46);
}

.vn-stage[data-focus="right"] .dialogue-box::before {
  right: 18px;
  background: linear-gradient(270deg, var(--gold), transparent);
}

.speaker {
  min-height: 20px;
  color: var(--screen);
  font-size: clamp(13px, 1.5vw, 17px);
  font-weight: 900;
  transition:
    color 240ms ease,
    text-align 240ms ease;
}

.vn-stage[data-focus="right"] .speaker {
  color: #f0cf87;
  text-align: right;
}

.vn-stage[data-focus="left"] .speaker {
  text-align: left;
}

.dialogue-text {
  margin: 0;
  color: var(--ink);
  font-size: clamp(16px, 2.15vw, 26px);
  font-weight: 700;
  line-height: 1.62;
  word-break: keep-all;
}

.dialogue-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: auto;
}

#progress-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.next-button {
  min-width: 74px;
  min-height: 36px;
  border: 1px solid rgba(189, 239, 255, 0.36);
  border-radius: 8px;
  background: rgba(189, 239, 255, 0.12);
  color: var(--ink);
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}

.next-button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.orientation-note {
  display: none;
  margin: 10px auto 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.vn-stage.is-transitioning .stage-art,
.vn-stage.is-transitioning .memory-strip,
.vn-stage.is-transitioning .title-card {
  opacity: 0;
}

@media (max-width: 820px) {
  .vn-app {
    padding: 8px;
  }

  .vn-topbar {
    min-height: 46px;
    gap: 10px;
    margin-bottom: 8px;
    padding: 6px 8px;
  }

  .vn-topbar h1 {
    font-size: 16px;
  }

  .back-link {
    min-height: 32px;
    padding: 0 10px;
  }

  .dialogue-box {
    min-height: 31%;
    left: 3%;
    right: 3%;
    bottom: 3%;
  }

  .memory-strip {
    inset: 10%;
    gap: 6px;
  }

  .memory-card::after {
    left: 7px;
    right: 7px;
    bottom: 7px;
    font-size: 11px;
  }
}

@media (orientation: portrait) and (max-width: 820px) {
  .orientation-note {
    display: block;
  }

  .vn-stage {
    width: min(100%, calc((100svw - 16px)));
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .vn-app {
    padding: 6px 8px;
  }

  .vn-topbar {
    min-height: 40px;
    margin-bottom: 6px;
  }

  .vn-topbar p,
  .vn-topbar span {
    font-size: 11px;
  }

  .vn-topbar h1 {
    font-size: 15px;
  }

  .back-link {
    min-height: 30px;
    font-size: 12px;
  }

  .vn-stage {
    width: min(100%, calc((100svh - 76px) * 16 / 9));
  }

  .dialogue-box {
    min-height: 30%;
    padding: 10px 12px;
  }

  .dialogue-text {
    font-size: clamp(14px, 2.4vw, 18px);
    line-height: 1.5;
  }

  .speaker {
    font-size: 12px;
  }

  .next-button {
    min-height: 30px;
  }
}
