.opening {
  --opening-font: BookkMyungjo, Batang, "Noto Serif KR", serif;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  width: min(100%, 1240px);
  margin: 0 auto;
  aspect-ratio: 16 / 9;
  min-height: 350px;
  background: #100e19;
  color: #fff1ef;
  font-family: var(--opening-font);
  container-type: inline-size;
}
@media (min-width: 761px) {
  .opening {
    width: min(1240px, calc(100% - 3rem));
    width: min(1240px, calc(100% - 3rem), max(720px, calc((100svh - 104px) * 1.77778)));
    margin-top: 1rem;
    border-radius: 14px;
  }
}
#opening, #storyHome { scroll-margin-top: 76px; }
.opening[hidden], .opening [hidden] { display: none !important; }
.opening .frame { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; z-index: -3; }
.opening[data-mode="preview"] .frame { filter: blur(5px); transform: scale(1.04); }
.opening::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(90deg, #110f1cd6, transparent 80%), linear-gradient(0deg, #110e21c9, transparent 38%);
}
.opening .hud { position: absolute; inset: 6% 6% auto; display: flex; justify-content: space-between; align-items: center; font-size: 13px; letter-spacing: .08em; }
.opening :is(button, a) {
  color: #fff4ef; background: #282038db; border: 1px solid #d9bad7a1; border-radius: 8px;
  cursor: pointer; padding: 8px 15px; font: 550 15px var(--opening-font);
}
.opening :is(button, a):focus-visible { outline: 2px solid #f3d9ff; outline-offset: 4px; }
.opening .copy { position: absolute; left: 6%; bottom: 10%; max-width: 85%; }
.opening h2 { font-size: clamp(28px, 4vw, 52px); margin: 0 0 12px; }
.opening .copy p { margin: 0 0 18px; word-break: keep-all; }
.opening .go {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  border-radius: 50%; width: 78px; height: 78px; font-size: 32px; padding-left: 20px;
  background: #30213b94; box-shadow: 0 0 28px #fde4f455;
}
.opening .skip { position: absolute; bottom: 5%; right: 5%; font-size: 13px; }
.opening .appear { animation: velo-opening-appear .55s ease-out; }
@keyframes velo-opening-appear { from { opacity: .15; } to { opacity: 1; } }

.opening[data-receipt="true"] { background: #000; }
.opening[data-receipt="true"] :is(.frame, .hud, .skip, .copy),
.opening[data-receipt="true"]::before { display: none; }
.opening .receipt, .opening .ending {
  position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%);
  width: min(82%, 640px); border: 1px solid #999; padding: clamp(12px, 2vw, 24px);
  background: #000; color: #f2f2f2; font: 400 clamp(15px, 1.65vw, 19px)/1.55 var(--opening-font);
}
.opening .receipt p { margin: 0 0 1.35em; }
.opening .receipt button, .opening .ending a {
  background: none; color: inherit; border: 0; border-radius: 0; padding: 4px 0; font: inherit;
}
.opening .ending a { display: block; padding: 0; }
.opening .ending a:hover { text-decoration: underline; }
.opening:is([data-mode="complete"], [data-mode="sender"]) { background: #000; }
.opening:is([data-mode="complete"], [data-mode="sender"])::before,
.opening:is([data-mode="complete"], [data-mode="sender"]) > :not(.ending) { display: none !important; }

.opening[data-index-open="true"] :is(.hud, .skip, .copy > h2, .copy > p) { display: none; }
.opening[data-index-open="true"] .copy {
  left: 50%; top: 50%; bottom: auto; transform: translate(-50%, -50%);
  width: min(88%, 700px); max-width: none;
}
.opening .files { display: grid; border: 1px solid #c4bec8; background: #0c0a11cf; padding: clamp(12px, 2vw, 24px) 10px; }
.opening .files button {
  justify-self: start; text-align: left; border: 0; border-radius: 0; background: transparent; padding: 3px 0;
  color: #fff7f2; font: 400 clamp(16px, 1.8vw, 20px)/1.45 var(--opening-font);
}
.opening .files button:disabled { color: #b4abb8; cursor: default; }
.opening .files button:enabled:hover { text-decoration: underline; }

.opening :is(.footage, .record-mark) { display: none; }
.opening[data-mode="playing"] .footage { display: block; position: absolute; inset: 0; overflow: hidden; z-index: -2; pointer-events: none; }
.opening .footage img {
  position: absolute; bottom: -50%; height: calc(146% * var(--height-ratio, 1));
  width: auto; max-width: none; transform: translateX(-50%);
}
.opening .footage img:first-child { left: 30%; }
.opening .footage img + img { left: 70%; }
.opening[data-mode="playing"] :is(.frame, .footage) {
  animation: velo-opening-handheld 6.7s ease-in-out infinite alternate; transform-origin: 50% 60%;
}
@keyframes velo-opening-handheld {
  0% { transform: scale(1.035) translate(-.45%, .25%) rotate(-.24deg); }
  50% { transform: scale(1.04) translate(.25%, -.35%) rotate(.13deg); }
  100% { transform: scale(1.045) translate(.5%, .1%) rotate(.22deg); }
}
.opening[data-mode="playing"]::before {
  background: linear-gradient(to bottom, transparent 66%, #c4abeb07 81.3%, #c4abeb14),
    linear-gradient(to bottom, transparent 66%, #0006 75.5%, #000c 87.1%, #000d);
}
.opening[data-mode="playing"] .hud b { visibility: hidden; }
.opening[data-mode="playing"] .record-mark {
  display: flex; gap: 10px; align-items: center; position: absolute; left: 6%; top: 7%;
  color: white; text-shadow: 0 1px 4px black; font: 600 13px/1.4 var(--opening-font);
  font-variant-numeric: tabular-nums; letter-spacing: .06em;
}
.opening .record-mark::before { content: ""; width: 8px; height: 8px; background: #f76175; border-radius: 50%; }
.opening .line {
  position: absolute; inset: 0; color: #fff; pointer-events: none;
  font: 600 clamp(15px, 1.67cqw, 23px)/1.65 var(--opening-font); text-shadow: 0 1px 2px #0007;
}
.opening .line :is(.who, .speech) { position: absolute; left: 17%; width: 66%; word-break: keep-all; overflow-wrap: break-word; }
.opening .line .who { top: 75%; font-size: clamp(14px, 1.35cqw, 19px); line-height: 1.4; }
.opening .line .speech { top: 79.5%; }
.opening .line .step { position: absolute; right: 4%; bottom: 4%; pointer-events: auto; }
.opening[data-mode="preview"] h2 { font-size: clamp(18px, 2.3vw, 28px); }
@media (max-width: 650px) {
  .opening { min-height: 390px; }
  .opening .copy { bottom: 16%; }
  .opening .hud { font-size: 12px; }
  .opening .go { width: 64px; height: 64px; font-size: 25px; }
  .opening .footage img { height: calc(113% * var(--height-ratio, 1)); bottom: -21%; }
  .opening .line .speech { top: 81%; }
  .opening .line .step { bottom: 2%; font-size: 13px; padding: 7px 10px; }
}
