/* =========================================================
   ① 접속 화면 (IHA 통합 인증)
   ========================================================= */
.gate {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 64px 16px 56px;
  overflow: hidden;
  transition: opacity .8s ease;
}
.gate.is-leaving { opacity: 0; }

.gate-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(ellipse 70% 45% at 50% 0%, rgba(124, 58, 237, .22), transparent 70%),
    radial-gradient(ellipse 60% 40% at 50% 100%, rgba(61, 107, 179, .14), transparent 70%),
    linear-gradient(rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 100% 32px,
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px) 0 0 / 32px 100%,
    var(--bg);
}
.gate-bg::after { /* 스캔라인 */
  content: ""; position: absolute; left: 0; right: 0; height: 120px;
  background: linear-gradient(180deg, transparent, rgba(138,180,238,.06), transparent);
  animation: scan 6s linear infinite;
}
@keyframes scan { from { top: -120px; } to { top: 100%; } }

.gate-top, .gate-foot {
  position: absolute; left: 0; right: 0; z-index: 1;
  display: flex; justify-content: space-between; gap: 12px;
  padding: 14px max(16px, env(safe-area-inset-left));
  font-size: 10px; color: var(--dim);
}
.gate-top { top: 0; border-bottom: 1px solid var(--line); background: rgba(7,9,13,.6); backdrop-filter: blur(6px); }
.gate-top .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 8px; box-shadow: 0 0 8px var(--ok); vertical-align: 1px; }
.gate-secure { color: var(--iha); }
.gate-foot { bottom: 0; justify-content: center; text-align: center; letter-spacing: .12em; padding-bottom: max(14px, env(safe-area-inset-bottom)); }

.gate-card {
  position: relative; z-index: 1;
  width: 100%; max-width: 400px;
  padding: 32px 22px 24px;
  border: 1px solid var(--line-2);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(20,26,36,.92), rgba(12,15,21,.94));
  box-shadow: 0 30px 80px rgba(0,0,0,.55), inset 0 1px 0 rgba(255,255,255,.05);
  text-align: center;
}
.gate-card::before { /* 모서리 장식 */
  content: ""; position: absolute; inset: -1px; border-radius: 14px; pointer-events: none;
  background:
    linear-gradient(var(--iha), var(--iha)) top left / 18px 1px no-repeat,
    linear-gradient(var(--iha), var(--iha)) top left / 1px 18px no-repeat,
    linear-gradient(var(--iha), var(--iha)) bottom right / 18px 1px no-repeat,
    linear-gradient(var(--iha), var(--iha)) bottom right / 1px 18px no-repeat;
  opacity: .8;
}

.emblem { width: 58px; height: 58px; color: var(--iha); filter: drop-shadow(0 0 12px rgba(138,180,238,.35)); }
.gate-org { margin-top: 14px; font-size: 9.5px; color: var(--iha); }
.gate-title { margin: 8px 0 2px; font-size: clamp(20px, 5.6vw, 24px); font-weight: 800; letter-spacing: -0.01em; }
.gate-sub { font-size: 12px; color: var(--muted); }

.gate-form { margin-top: 24px; text-align: left; }
.gate-label { font-size: 10px; color: var(--dim); margin-bottom: 10px; }

.lang-list { display: grid; gap: 8px; }
.lang-opt {
  display: flex; align-items: center; gap: 12px;
  width: 100%; min-height: 50px; padding: 0 14px;
  border: 1px solid var(--line-2); border-radius: 8px;
  background: rgba(7,9,13,.55);
  text-align: left;
  transition: border-color .2s, background .2s, transform .1s;
}
.lang-opt:hover, .lang-opt:focus-visible { border-color: rgba(138,180,238,.6); background: rgba(61,107,179,.12); outline: none; }
.lang-opt:active { transform: scale(.99); }
.lang-code {
  flex: 0 0 auto; min-width: 34px; padding: 3px 0; text-align: center;
  font-size: 10.5px; letter-spacing: .08em; color: var(--iha);
  border: 1px solid rgba(138,180,238,.35); border-radius: 4px;
}
.lang-name { flex: 1; font-size: 15px; font-weight: 500; }
.lang-recent { display: none; font-size: 9px; color: var(--gate); letter-spacing: .12em; }
.lang-opt.is-recent .lang-recent { display: inline; }
.lang-opt.is-recent { border-color: rgba(192,132,252,.45); }
.lang-arrow { color: var(--dim); font-size: 18px; }
.lang-opt.is-picked { border-color: var(--ok); background: rgba(110,231,167,.08); }

.gate-note { margin-top: 16px; font-size: 11px; color: var(--muted); text-align: center; line-height: 1.6; }
.gate-note span { color: var(--dim); font-size: 10.5px; }
.gate-skip { display: block; margin-top: 10px; font-size: 11.5px; color: var(--iha); text-align: center; text-decoration: none; opacity: .8; }
.gate-skip:hover { opacity: 1; text-decoration: underline; }

/* 인증 연출 */
.auth { margin-top: 26px; text-align: left; animation: fadeUp .4s ease both; }
.auth-ring { position: relative; width: 46px; height: 46px; margin: 0 auto 18px; }
.auth-ring::before, .auth-ring i {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid transparent; border-top-color: var(--iha); border-right-color: var(--iha);
  animation: spin 1s linear infinite;
}
.auth-ring i { inset: 8px; border-top-color: var(--gate); border-right-color: transparent; border-left-color: var(--gate); animation-duration: 1.6s; animation-direction: reverse; }
.auth.is-done .auth-ring::before, .auth.is-done .auth-ring i { border-color: var(--ok); animation: none; }

.auth-lines { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; min-height: 84px; }
.auth-lines li { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; animation: fadeUp .35s ease both; }
.auth-lines li::before { content: "›"; color: var(--iha); font-family: var(--mono); }
.auth-lines li.is-ok::before { content: "✓"; color: var(--ok); }
.auth-lines li.is-final { color: var(--ok); font-weight: 700; }

.auth-bar { margin-top: 16px; height: 3px; border-radius: 3px; background: rgba(255,255,255,.07); overflow: hidden; }
.auth-bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--iha-deep), var(--iha), var(--gate)); transition: width 2.4s cubic-bezier(.3,.7,.4,1); }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeUp { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* =========================================================
   ② 인트로
   ========================================================= */
.intro {
  position: fixed; inset: 0; z-index: 20;
  background: #000;
  overflow: hidden;
  user-select: none;
  cursor: pointer;
  animation: introIn 1s ease both;
}
.intro.is-leaving { animation: introOut .9s ease forwards; }
@keyframes introIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes introOut { to { opacity: 0; } }

.intro-progress {
  position: absolute; z-index: 5; top: 0; left: 0; right: 0;
  display: flex; gap: 4px;
  padding: max(12px, env(safe-area-inset-top)) 16px 0;
}
.intro-progress span { flex: 1; height: 2px; border-radius: 2px; background: rgba(255,255,255,.18); overflow: hidden; }
.intro-progress span i { display: block; height: 100%; width: 0; background: rgba(255,255,255,.85); }
.intro-progress span.is-done i { width: 100%; }

.intro-skip {
  position: absolute; z-index: 5;
  top: calc(max(12px, env(safe-area-inset-top)) + 14px); right: 16px;
  padding: 6px 12px;
  font-size: 10.5px; letter-spacing: .14em; color: rgba(255,255,255,.75);
  background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.2); border-radius: 99px;
  backdrop-filter: blur(4px);
}
.intro-skip::after { content: " »"; }
.intro-skip:hover { color: #fff; border-color: rgba(255,255,255,.45); }

.intro-stage { position: absolute; inset: 0; }

.scene { position: absolute; inset: 0; opacity: 0; transition: opacity 1s ease; }
.scene.is-active { opacity: 1; }

.scene-backdrop { /* 화면 전체를 채우는 흐린 배경 (이미지가 잘리지 않게 하기 위함) */
  position: absolute; inset: -60px;
  background-size: cover; background-position: center;
  filter: blur(30px) brightness(.32) saturate(1.25);
  transform: scale(1.1);
}
.scene::after { /* 비네트 */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(0,0,0,.65) 100%);
}

.scene-body {
  position: absolute; inset: 0; z-index: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(18px, 3.5vh, 30px);
  padding: 64px 0 calc(48px + env(safe-area-inset-bottom));
}

.scene-frame {
  position: relative;
  width: min(100vw, calc((100svh - 230px) * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: #0b0d12;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
@media (min-width: 700px) { .scene-frame { border-radius: 6px; } }

.scene-frame img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: cover; /* 프레임 비율이 이미지(16:9)와 같아서 잘리지 않음 */
  transform-origin: var(--origin, 50% 50%);
}
.scene.is-active .scene-frame img { animation: kenburns var(--hold, 6s) ease-out both; }
@keyframes kenburns { from { transform: scale(1); } to { transform: scale(1.07); } }

.scene-tag {
  position: absolute; z-index: 2; left: 12px; top: 12px;
  padding: 3px 9px;
  font-family: var(--mono); font-size: clamp(9px, 2.4vw, 11px); letter-spacing: .14em;
  color: var(--tag, #a9c3ea);
  background: rgba(0,0,0,.55); border: 1px solid currentColor; border-radius: 4px;
  opacity: .9;
}

.scene-caption {
  margin: 0; max-width: 780px; padding: 0 22px;
  min-height: 4.8em;
  text-align: center;
  font-size: clamp(15px, 4.1vw, 23px);
  font-weight: 700; line-height: 1.6;
  color: #f4f6fa;
  text-shadow: 0 2px 14px rgba(0,0,0,.8);
}
.scene-caption .line { display: block; opacity: 0; transform: translateY(8px); filter: blur(4px); }
.scene.is-active .scene-caption .line { animation: lineIn 1.1s ease forwards; }
.scene.is-active .scene-caption .line:nth-child(1) { animation-delay: .6s; }
.scene.is-active .scene-caption .line:nth-child(2) { animation-delay: 1.7s; }
.scene.is-active .scene-caption .line:nth-child(3) { animation-delay: 2.8s; }
@keyframes lineIn { to { opacity: 1; transform: none; filter: none; } }

/* 장면 효과 */
.fx { position: absolute; inset: 0; z-index: 1; pointer-events: none; mix-blend-mode: screen; opacity: 0; }
.scene.is-active .fx-flash .fx { background: radial-gradient(ellipse at 50% 20%, rgba(216,180,254,.9), transparent 60%); animation: flash 1.6s ease-out .2s both; }
.scene.is-active .fx-glitch .fx { background: linear-gradient(180deg, rgba(248,113,113,.0), rgba(248,113,113,.35)); animation: glitchTint 2.6s steps(1) .3s both; }
.scene.is-active .fx-glitch img { animation: kenburns var(--hold, 6s) ease-out both, glitch 2.6s steps(1) .3s both; }
.scene.is-active .fx-ember .fx { background: radial-gradient(ellipse at 50% 60%, rgba(251,146,60,.35), transparent 70%); animation: ember 3s ease-in-out infinite; }
.scene.is-active .fx-glow .fx { background: radial-gradient(ellipse at 55% 45%, rgba(253,224,71,.28), transparent 55%); animation: ember 4s ease-in-out infinite; }
.scene.is-active .fx-rift .fx { background: radial-gradient(ellipse at 50% 50%, rgba(192,132,252,.85), transparent 65%); animation: flash 2.2s ease-out .4s both; }

@keyframes flash { 0% { opacity: 0; } 12% { opacity: 1; } 100% { opacity: 0; } }
@keyframes ember { 0%, 100% { opacity: .35; } 50% { opacity: .8; } }
@keyframes glitchTint { 0% { opacity: .9; } 8% { opacity: 0; } 14% { opacity: .7; } 20% { opacity: 0; } 40% { opacity: .5; } 44%, 100% { opacity: 0; } }
@keyframes glitch {
  0% { transform: translate(-6px, 2px) scale(1.02); filter: hue-rotate(-20deg) contrast(1.4); }
  6% { transform: translate(5px, -2px) scale(1.02); filter: none; }
  12% { transform: translate(-3px, 0) scale(1.02); filter: saturate(2) contrast(1.3); }
  18% { transform: scale(1.02); filter: none; }
  40% { transform: translate(4px, 1px) scale(1.03); filter: hue-rotate(15deg); }
  44%, 100% { transform: scale(1.03); filter: none; }
}

.intro-hint {
  position: absolute; z-index: 5; left: 0; right: 0;
  bottom: calc(18px + env(safe-area-inset-bottom));
  text-align: center; font-size: 11px; color: rgba(255,255,255,.45);
  transition: opacity .6s;
  animation: hintPulse 2.4s ease-in-out infinite;
}
.intro-hint.is-hidden { opacity: 0; animation: none; }
@keyframes hintPulse { 0%, 100% { opacity: .35; } 50% { opacity: .75; } }

/* =========================================================
   ③ 타이틀
   ========================================================= */
.title {
  position: fixed; inset: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  padding: 24px 16px;
  text-align: center;
  overflow: hidden;
}
.title-bg {
  position: absolute; inset: -40px;
  background:
    radial-gradient(ellipse 60% 45% at 50% 40%, rgba(124,58,237,.35), transparent 70%),
    radial-gradient(ellipse 80% 60% at 50% 110%, rgba(61,107,179,.25), transparent 70%),
    var(--bg);
}
.title-bg::after { /* 균열 선 */
  content: ""; position: absolute; left: 50%; top: 18%; width: 2px; height: 22%;
  transform: translateX(-50%);
  background: linear-gradient(180deg, transparent, #e9d5ff, var(--gate), transparent);
  box-shadow: 0 0 24px 4px rgba(192,132,252,.55);
  animation: riftOpen 1.4s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes riftOpen { from { transform: translateX(-50%) scaleY(0); opacity: 0; } to { transform: translateX(-50%) scaleY(1); opacity: 1; } }

.title-inner { position: relative; z-index: 1; width: 100%; max-width: 560px; padding-top: 18vh; }
.title-inner > * { animation: fadeUp .9s ease both; }
.title-org { font-size: 10px; color: var(--iha); animation-delay: .5s; }
.title-name { margin: 10px 0 0; font-size: clamp(34px, 10vw, 58px); font-weight: 900; letter-spacing: .02em; line-height: 1.15; text-shadow: 0 0 30px rgba(168,85,247,.45); animation-delay: .7s; }
.title-en { margin-top: 8px; font-size: clamp(10px, 2.8vw, 12.5px); color: var(--gate); letter-spacing: .38em; animation-delay: .9s; }
.title-tag { margin: 18px 0 0; font-size: clamp(13px, 3.6vw, 15px); color: #b9c0cd; animation-delay: 1.1s; }

.title-enter {
  display: inline-flex; align-items: center; gap: 10px;
  margin-top: 36px; padding: 14px 30px;
  font-size: 15px; font-weight: 700; color: #f3e8ff; text-decoration: none;
  border: 1px solid rgba(192,132,252,.6); border-radius: 8px;
  background: linear-gradient(180deg, rgba(124,58,237,.28), rgba(124,58,237,.12));
  box-shadow: 0 0 30px rgba(124,58,237,.25);
  animation-delay: 1.4s;
  transition: background .2s, box-shadow .2s;
}
.title-enter:hover { background: rgba(124,58,237,.38); box-shadow: 0 0 40px rgba(124,58,237,.45); }
.title-enter b { font-weight: 400; }
.title-replay {
  display: block; margin: 18px auto 0; padding: 6px 10px;
  background: none; border: 0; font-size: 12px; color: var(--muted);
  text-decoration: underline; text-underline-offset: 3px;
  animation-delay: 1.6s;
}
.title-replay:hover { color: var(--text); }

[hidden] { display: none !important; }
