:root {
  color-scheme: dark;
  background: #020712;
  font-family: Inter, Pretendard, "Noto Sans KR", system-ui, -apple-system, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }

html,
body,
#studio-shell,
#unity-canvas {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

html,
body { overscroll-behavior: none; }

body {
  background:
    radial-gradient(circle at 50% 38%, rgba(45, 108, 156, .26), transparent 34%),
    radial-gradient(circle at 20% 78%, rgba(93, 55, 156, .2), transparent 38%),
    #020712;
}

#studio-shell {
  position: fixed;
  inset: 0;
  min-width: 280px;
  min-height: 360px;
  isolation: isolate;
}

#unity-canvas {
  display: block;
  background: #020712;
  outline: none;
  touch-action: none;
}

#unity-canvas:focus-visible {
  outline: 2px solid rgba(112, 239, 255, .9);
  outline-offset: -2px;
}

#loading {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 13px;
  padding:
    max(28px, env(safe-area-inset-top))
    max(22px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom))
    max(22px, env(safe-area-inset-left));
  text-align: center;
  background:
    linear-gradient(rgba(2, 7, 18, .4), rgba(2, 7, 18, .9)),
    repeating-radial-gradient(circle at 50% 40%, rgba(102, 223, 255, .08) 0 1px, transparent 1px 26px),
    radial-gradient(circle at 50% 38%, #153c65, #071426 48%, #020712 76%);
}

#loading[hidden],
#focus-hint[hidden],
#instant-film-output[hidden] { display: none; }

#loading p {
  margin: 4px 0 0;
  color: #7eeaff;
  font-size: clamp(10px, 1.4vw, 13px);
  font-weight: 800;
  letter-spacing: .22em;
}

#loading h1 {
  margin: 0;
  color: #f5fbff;
  font-size: clamp(30px, 6vw, 68px);
  font-weight: 850;
  line-height: .92;
  letter-spacing: -.045em;
  text-shadow: 0 0 30px rgba(82, 210, 255, .18);
}

#loading h1 em {
  color: #ffc76b;
  font-style: normal;
  font-weight: 750;
  letter-spacing: .08em;
}

#loading strong {
  color: #e7f9ff;
  font: 750 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}

#loading small {
  color: rgba(218, 236, 246, .7);
  font-size: 12px;
}

.loading-mark {
  position: relative;
  width: clamp(88px, 14vw, 126px);
  aspect-ratio: 1;
  border: 1px solid rgba(126, 234, 255, .62);
  border-radius: 50%;
  transform: rotate(-18deg);
  box-shadow: inset 0 0 32px rgba(46, 172, 230, .08), 0 0 40px rgba(35, 159, 226, .08);
}

.loading-mark::before,
.loading-mark::after {
  content: "";
  position: absolute;
  inset: 12%;
  border: 1px solid rgba(255, 200, 105, .42);
  border-radius: 50%;
}

.loading-mark::after {
  inset: 33%;
  border: 0;
  background: linear-gradient(145deg, #5bd7ed, #254d9a 54%, #182151);
  box-shadow: inset -9px -10px 18px rgba(2, 7, 18, .55), 0 0 24px rgba(91, 215, 237, .45);
}

.loading-mark i {
  position: absolute;
  z-index: 2;
  top: 9%;
  right: 8%;
  width: 11%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #ffd078;
  box-shadow: 0 0 14px #ffc55f;
}

.loading-mark b,
.loading-mark span {
  position: absolute;
  inset: 3% 43%;
  z-index: 3;
  border-radius: 99px;
  background: linear-gradient(transparent, rgba(255,255,255,.65), transparent);
  animation: scan 2.2s ease-in-out infinite;
}

.loading-mark span {
  inset: 43% 3%;
  animation-delay: -.8s;
}

.progress {
  width: min(390px, 74vw);
  height: 7px;
  margin-top: 4px;
  overflow: hidden;
  border: 1px solid rgba(126, 234, 255, .32);
  border-radius: 99px;
  background: rgba(0, 0, 0, .32);
}

.progress span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #5bd7ed, #75f2ba, #ffd078);
  box-shadow: 0 0 14px rgba(91, 215, 237, .7);
  transition: width .14s linear;
}

#focus-hint {
  position: fixed;
  left: 50%;
  bottom: max(96px, calc(env(safe-area-inset-bottom) + 88px));
  z-index: 12;
  width: min(520px, calc(100vw - 32px));
  min-height: 58px;
  padding: 10px 18px 10px 54px;
  transform: translateX(-50%);
  border: 1px solid rgba(126, 234, 255, .52);
  border-radius: 13px;
  color: #fff;
  background: linear-gradient(110deg, rgba(2, 11, 28, .94), rgba(11, 35, 63, .88));
  box-shadow: 0 14px 34px rgba(0, 0, 0, .35), inset 0 0 20px rgba(88, 210, 239, .05);
  pointer-events: none;
  animation: focus-in .24s ease-out both;
}

#focus-hint i {
  position: absolute;
  left: 18px;
  top: 50%;
  width: 22px;
  height: 28px;
  border: 2px solid #7eeaff;
  border-radius: 12px;
  transform: translateY(-50%);
}

#focus-hint i::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 4px;
  width: 2px;
  height: 7px;
  border-radius: 2px;
  background: #ffc76b;
  transform: translateX(-50%);
}

#focus-hint strong,
#focus-hint span { display: block; }

#focus-hint strong {
  font-size: 14px;
  letter-spacing: -.01em;
}

#focus-hint span {
  margin-top: 3px;
  color: rgba(218, 236, 246, .72);
  font: 650 10px/1.35 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .025em;
}

#runtime-banners {
  position: fixed;
  top: max(12px, env(safe-area-inset-top));
  left: 50%;
  z-index: 30;
  display: grid;
  width: min(640px, calc(100vw - 28px));
  gap: 6px;
  transform: translateX(-50%);
  pointer-events: none;
}

.runtime-banner {
  padding: 10px 14px;
  border: 1px solid rgba(255, 202, 108, .58);
  border-radius: 9px;
  color: #fff1d6;
  background: rgba(42, 25, 6, .94);
  box-shadow: 0 8px 26px rgba(0, 0, 0, .3);
  font-size: 12px;
}

.runtime-banner.error {
  border-color: rgba(255, 111, 111, .72);
  color: #ffe1e1;
  background: rgba(55, 8, 16, .96);
}

.runtime-banner.notice {
  border-color: rgba(126, 234, 255, .58);
  color: #e6fbff;
  background: rgba(3, 25, 44, .94);
}

#instant-film-output {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow: auto;
  opacity: 0;
  color: #eafaff;
  background:
    repeating-linear-gradient(0deg, rgba(126, 234, 255, .025) 0 1px, transparent 1px 4px),
    radial-gradient(circle at 70% 28%, rgba(255, 196, 93, .12), transparent 32%),
    rgba(0, 4, 11, .9);
  backdrop-filter: blur(9px) saturate(.72);
  transition: opacity .22s ease-out;
}

#instant-film-output.is-active { opacity: 1; }

.film-console {
  position: relative;
  width: min(1120px, 100%);
  max-height: 100%;
  overflow: auto;
  border: 1px solid rgba(126, 234, 255, .33);
  border-radius: 20px;
  background:
    linear-gradient(135deg, rgba(6, 22, 38, .98), rgba(2, 8, 18, .98)),
    #020712;
  box-shadow:
    0 32px 90px rgba(0, 0, 0, .72),
    inset 0 0 58px rgba(71, 178, 217, .055),
    inset 0 0 0 5px rgba(255, 255, 255, .018);
}

.film-console::before {
  content: "";
  position: absolute;
  inset: 9px;
  z-index: 0;
  border: 1px solid rgba(255, 202, 108, .12);
  border-radius: 14px;
  pointer-events: none;
}

.film-console-head,
.film-layout,
.film-printer { position: relative; z-index: 1; }

.film-console-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 70px;
  padding: 17px clamp(18px, 3vw, 34px) 12px;
  border-bottom: 1px solid rgba(126, 234, 255, .16);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

.film-console-head span,
.film-console-head strong { display: block; }

.film-console-head span {
  color: #7eeaff;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .19em;
}

.film-console-head strong {
  margin-top: 4px;
  color: #f3fbff;
  font-size: clamp(12px, 1.3vw, 15px);
  letter-spacing: .08em;
}

.film-console-head b {
  color: #ffca6c;
  font-size: 10px;
  letter-spacing: .15em;
}

.film-printer {
  display: grid;
  grid-template-columns: auto minmax(120px, 1fr) auto;
  align-items: center;
  gap: 14px;
  margin: 12px clamp(18px, 3vw, 34px) 0;
  color: rgba(206, 235, 244, .5);
  font: 750 8px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .13em;
}

.film-printer i {
  display: block;
  height: 9px;
  border: 1px solid rgba(255, 202, 108, .32);
  border-radius: 99px;
  background: #00040b;
  box-shadow: inset 0 2px 4px #000, 0 0 16px rgba(255, 196, 93, .08);
}

.film-printer b { color: rgba(255, 202, 108, .66); }

.film-layout {
  display: grid;
  grid-template-areas: "copy ticket";
  grid-template-columns: minmax(280px, .78fr) minmax(360px, 1.08fr);
  align-items: center;
  gap: clamp(20px, 4vw, 54px);
  padding: clamp(20px, 3.5vw, 42px);
  padding-top: clamp(22px, 3vw, 34px);
}

.film-ticket {
  grid-area: ticket;
  position: relative;
  width: 100%;
  max-width: 610px;
  justify-self: center;
  padding: clamp(13px, 2vw, 19px);
  color: #18222a;
  background:
    linear-gradient(92deg, rgba(30, 48, 53, .035), transparent 17% 83%, rgba(30, 48, 53, .035)),
    #e9eadf;
  border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: 0 22px 54px rgba(0, 0, 0, .54), 0 0 0 1px rgba(0, 0, 0, .18);
  opacity: .08;
  transform: translateY(-78px) rotate(-.65deg) scale(.98);
  transform-origin: 50% 0;
  transition: opacity .25s ease-out, transform .42s cubic-bezier(.16, .82, .25, 1);
}

#instant-film-output.is-active .film-ticket {
  opacity: 1;
  transform: translateY(0) rotate(-.65deg) scale(1);
}

.film-ticket::after {
  content: "DIGITAL IMAGINATION PAPER · WHITE GUIDE OUTPUT";
  display: block;
  margin-top: 12px;
  color: rgba(24, 34, 42, .58);
  font: 750 7px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .16em;
  text-align: center;
}

.film-ticket > header,
.film-ticket-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font: 800 8px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}

.film-ticket > header { padding: 0 2px 10px; }

.film-image-shell {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1400 / 990;
  overflow: hidden;
  border: 1px dashed #aaa89d;
  background: #fff;
  box-shadow: inset 0 0 0 8px #f7f6f0;
}

.film-image-shell::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  opacity: .42;
  background: repeating-linear-gradient(0deg, rgba(68,68,63,.035) 0 1px, transparent 1px 4px);
  transition: opacity .3s ease-out;
}

.film-ticket[data-stage="ready"] .film-image-shell::after { opacity: 0; }

#instant-film-preview {
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #fff;
  opacity: .12;
  filter: none;
  transition: opacity .62s ease-out;
}

.film-ticket[data-stage="edge-dot"] #instant-film-preview { opacity: .54; }
.film-ticket[data-stage="white-paper"] #instant-film-preview { opacity: .82; }
.film-ticket[data-stage="ready"] #instant-film-preview { opacity: 1; }

.film-develop-mask {
  position: absolute;
  inset: 0;
  z-index: 2;
  background: #f1f0e8;
  opacity: .84;
  transition: opacity .62s ease-out;
  pointer-events: none;
}

.film-ticket[data-stage="edge-dot"] .film-develop-mask { opacity: .46; }
.film-ticket[data-stage="white-paper"] .film-develop-mask { opacity: .16; }
.film-ticket[data-stage="ready"] .film-develop-mask { opacity: 0; }

.film-scan-line {
  position: absolute;
  inset: -20% 0 auto;
  z-index: 4;
  height: 18%;
  opacity: .75;
  background: linear-gradient(transparent, rgba(126, 120, 103, .24), transparent);
  animation: film-scan 1.05s linear infinite;
  pointer-events: none;
}

#instant-film-output.is-ready .film-scan-line { display: none; }

#instant-film-output.is-error .film-scan-line,
#instant-film-output.is-error .film-develop-mask { display: none; }

.film-ticket[data-stage="error"] .film-image-shell::before {
  content: "DIGITAL GUIDE\A CONVERSION PAUSED";
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-items: center;
  padding: 20px;
  color: #7b5549;
  white-space: pre;
  text-align: center;
  font: 800 11px/1.6 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .13em;
  background: #fff;
}

.film-ticket-meta {
  min-height: 34px;
  padding: 10px 2px 0;
  color: rgba(24, 34, 42, .72);
}

.film-ticket-meta strong {
  color: #765314;
  font-size: 9px;
}

.film-progress {
  height: 5px;
  margin-top: 8px;
  overflow: hidden;
  border: 1px solid rgba(24, 34, 42, .25);
  background: rgba(24, 34, 42, .1);
}

.film-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #2a6670, #58b6ad, #c08d31);
  transition: width .52s ease-out;
}

.film-copy {
  grid-area: copy;
  align-self: center;
  min-width: 0;
}

.film-copy > p:first-child {
  margin: 0 0 10px;
  color: #7eeaff;
  font: 800 9px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .14em;
}

.film-copy h2 {
  margin: 0;
  color: #f5fbff;
  font-size: clamp(30px, 4.1vw, 54px);
  line-height: .96;
  letter-spacing: -.055em;
}

.film-copy h2 em {
  color: #ffc76b;
  font-style: normal;
}

.film-status {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  margin-top: clamp(20px, 3vw, 34px);
  padding: 12px 0 10px;
  border-top: 1px solid rgba(126, 234, 255, .24);
  border-bottom: 1px solid rgba(126, 234, 255, .12);
  color: #a9c9d2;
  font: 800 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .13em;
}

.film-status strong {
  color: #ffc76b;
  font-size: 17px;
}

.film-description {
  margin: 13px 0 17px;
  color: rgba(220, 239, 246, .7);
  font-size: 12px;
  line-height: 1.65;
}

.film-error {
  margin: -7px 0 14px;
  padding: 9px 11px;
  border: 1px solid rgba(255, 143, 122, .48);
  border-radius: 4px;
  color: #ffe4dc;
  background: rgba(73, 17, 13, .58);
  font-size: 11px;
  line-height: 1.55;
}

.film-error[hidden],
.film-actions button[hidden] { display: none; }

.film-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.film-actions button {
  position: relative;
  display: grid;
  grid-template-columns: 28px 1fr;
  grid-template-rows: auto auto;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid rgba(126, 234, 255, .28);
  border-radius: 4px;
  color: #f4fbff;
  text-align: left;
  background: rgba(5, 25, 42, .72);
  cursor: pointer;
  transition: border-color .16s ease, background .16s ease, transform .16s ease;
}

.film-actions button:hover:not(:disabled),
.film-actions button:focus-visible {
  border-color: #ffc76b;
  background: rgba(55, 38, 12, .76);
  transform: translateY(-1px);
  outline: none;
}

.film-actions button:disabled {
  opacity: .36;
  cursor: wait;
}

.film-actions button > span {
  grid-row: 1 / span 2;
  color: #ffc76b;
  font: 800 11px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.film-actions button strong { font-size: 13px; }
.film-actions button small {
  color: rgba(204, 230, 238, .56);
  font: 750 7px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: .12em;
}

.film-actions .retry,
.film-actions .continue {
  grid-column: 1 / -1;
}

.film-actions .retry {
  border-color: rgba(255, 143, 122, .5);
  background: rgba(67, 18, 14, .68);
}

.film-actions .continue {
  border-color: rgba(255, 199, 107, .34);
}

.film-help {
  display: block;
  margin-top: 11px;
  color: rgba(197, 221, 230, .48);
  font-size: 9px;
}

@keyframes film-scan {
  from { transform: translateY(0); }
  to { transform: translateY(680%); }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes scan {
  0%, 100% { opacity: .22; transform: rotate(0deg) scaleY(.72); }
  50% { opacity: .88; transform: rotate(180deg) scaleY(1); }
}

@keyframes focus-in {
  from { opacity: 0; transform: translate(-50%, 10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@media (orientation: portrait) {
  #loading { gap: 16px; }
  #loading h1 { font-size: clamp(35px, 11vw, 66px); }
  .loading-mark { width: clamp(102px, 31vw, 150px); }
  #focus-hint {
    bottom: max(122px, calc(env(safe-area-inset-bottom) + 112px));
    width: calc(100vw - 24px);
    padding-right: 12px;
  }
  #focus-hint span { font-size: 9px; }

  #instant-film-output {
    place-items: start center;
    padding: max(10px, env(safe-area-inset-top)) 10px max(10px, env(safe-area-inset-bottom));
  }

  .film-console { border-radius: 14px; }
  .film-console-head { min-height: 58px; padding: 13px 16px 10px; }
  .film-console-head b { display: none; }
  .film-printer {
    grid-template-columns: minmax(90px, 1fr) auto;
    margin: 9px 16px 0;
  }
  .film-printer span { display: none; }
  .film-layout {
    grid-template-areas: "ticket" "copy";
    grid-template-columns: minmax(0, 1fr);
    gap: 16px;
    padding: 18px 16px 20px;
  }
  .film-ticket { width: min(92%, 520px); }
  .film-image-shell {
    height: auto;
    aspect-ratio: 1400 / 990;
  }
  .film-copy h2 { font-size: clamp(29px, 9vw, 48px); }
  .film-copy h2 br { display: block; }
  .film-status { margin-top: 14px; }
  .film-description { margin-block: 10px 13px; }
}

@media (max-width: 520px) and (orientation: portrait) {
  .film-console-head strong { font-size: 11px; }
  .film-ticket { width: min(94%, 430px); }
  .film-image-shell { height: auto; }
  .film-copy h2 { font-size: clamp(28px, 8.6vw, 39px); }
  .film-actions button { min-height: 56px; }
}

@media (max-width: 760px) and (orientation: landscape) {
  #instant-film-output {
    place-items: start center;
    padding: max(8px, env(safe-area-inset-top)) 8px max(8px, env(safe-area-inset-bottom));
  }
  .film-console { border-radius: 12px; }
  .film-console-head { padding-inline: 14px; }
  .film-console-head b { display: none; }
  .film-layout {
    grid-template-areas: "ticket" "copy";
    grid-template-columns: minmax(0, 1fr);
    gap: 14px;
    padding-inline: 14px;
  }
  .film-ticket { width: min(94%, 520px); }
  .film-image-shell { aspect-ratio: 1400 / 990; }
  .film-copy h2 br { display: block; }
}

@media (max-height: 520px) and (orientation: landscape) {
  #loading { gap: 8px; }
  .loading-mark { width: 72px; }
  #loading h1 { font-size: 31px; }
  #loading small { display: none; }
  #focus-hint { bottom: max(78px, calc(env(safe-area-inset-bottom) + 70px)); }
  .film-console-head { min-height: 50px; padding-top: 10px; }
  .film-printer { display: none; }
  .film-layout { padding-top: 14px; padding-bottom: 14px; }
  .film-ticket { max-width: 460px; }
  .film-copy h2 { font-size: 27px; }
  .film-status { margin-top: 12px; padding-block: 8px; }
  .film-description { display: none; }
  .film-actions button { min-height: 52px; }
}

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

@supports (height: 100dvh) {
  html,
  body,
  #studio-shell,
  #unity-canvas { height: 100dvh; }
}
