* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: #000;
  color: #8a8a8a;
  font-family: -apple-system, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  overflow: hidden;
  cursor: default;
}

#title {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  padding: 16px;
  transition: opacity 2.5s ease;
}
#title h1 {
  margin: 0 0 12px;
  font-size: clamp(40px, 9vw, 72px);
  font-weight: 200;
  letter-spacing: 0.4em;
  color: #cfcfcf;
}
#title .sub { margin: 0; font-size: 15px; }
#title .start {
  margin-top: 40px;
  font-size: 13px;
  color: #555;
  animation: pulse 2.4s ease-in-out infinite;
}
#title .episodes {
  margin-top: 28px;
  font-size: 14px;
  color: #777;
}
#title .episodes a { color: #b7a48e; }
body.playing #title { opacity: 0; pointer-events: none; }

@keyframes pulse { 50% { opacity: 0.3; } }

#subtitle {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 48px;
  margin: 0;
  text-align: center;
  font-size: 17px;
  line-height: 1.6;
  color: #9a9a9a;
  min-height: 1.6em;
}
#subtitle.woman { color: #b7a48e; }
#subtitle.sys { color: #7f97a8; }
#subtitle.narr { font-style: italic; }

/* ---- 무대: 실루엣과 자막 ---- */

#subtitle { display: none; }

#stage {
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  background: radial-gradient(ellipse 65% 50% at 50% 40%, #161a20 0%, #08090b 60%, #000 100%);
  opacity: 0;
  transition: opacity 2.5s ease;
}
body.playing #stage { opacity: 1; }

.fig {
  position: absolute;
  left: 50%;
  top: 12vh;
  height: 44vh;
  aspect-ratio: 1 / 2;
  color: #000;
  opacity: 0;
  transform: translateX(-50%) scale(var(--s, 1));
  transform-origin: 50% 100%;
  transition: left 0.35s ease, opacity 0.6s ease, transform 0.35s ease;
}
.fig svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
  filter: drop-shadow(0 0 1.5px rgba(150, 160, 175, 0.5)) drop-shadow(0 0 18px rgba(120, 130, 150, 0.15));
  transition: filter 0.4s ease;
}
.fig img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: 50% 100%;
  filter: brightness(0) drop-shadow(0 0 1.5px rgba(150, 160, 175, 0.5)) drop-shadow(0 0 18px rgba(120, 130, 150, 0.15));
  transition: filter 0.4s ease;
}
.fig.talk img {
  filter: brightness(0) drop-shadow(0 0 2px rgba(225, 205, 175, 0.85)) drop-shadow(0 0 30px rgba(220, 190, 150, 0.35));
}
.fig.radio.talk img { animation: flicker 0.16s steps(2) infinite; }

/* ---- 실루엣 애니메이션 ---- */

.fig .body { position: relative; width: 100%; height: 100%; }
.fig .art { position: absolute; inset: 0; }

/* 등장: 연기 속에서 떠오르듯 */
.fig.enter .body { animation: figEnter 1.5s cubic-bezier(0.2, 0.7, 0.2, 1) both; }
@keyframes figEnter {
  from { opacity: 0; transform: translateY(26px) scale(0.95); filter: blur(12px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}

/* 말하는 동안: 숨 쉬듯 살짝 움직인다 */
.fig.talk:not(.enter) .body { animation: talk 2.6s ease-in-out infinite; }
@keyframes talk {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.012); }
}

/* 걷는 동안: 걸음에 맞춰 흔들린다 */
.fig.walking:not(.enter) .body { animation: bob 0.42s ease-in-out infinite alternate; }
@keyframes bob {
  from { transform: translateY(0) rotate(-0.6deg); }
  to { transform: translateY(-5px) rotate(0.6deg); }
}

/* 정체 공개: 옛 모습은 흐려지며 흩어지고, 새 모습이 빛 속에서 선명해진다 */
.fig.revealing { opacity: 1 !important; }
.fig.revealing .body { animation: revealPulse 2.8s ease both; }
@keyframes revealPulse {
  0% { transform: scale(1); }
  35% { transform: scale(1.05); }
  100% { transform: scale(1); }
}
.fig .art.reveal-out { animation: revealOut 2.2s ease forwards; }
.fig .art.reveal-in { opacity: 0; animation: revealIn 2.4s ease 0.4s forwards; }
@keyframes revealOut {
  0% { opacity: 1; filter: brightness(0) blur(0); }
  100% { opacity: 0; filter: brightness(0) blur(10px); transform: scale(1.06); }
}
@keyframes revealIn {
  0% { opacity: 0; filter: brightness(0) blur(12px) drop-shadow(0 0 0 rgba(255, 225, 170, 0)); transform: scale(0.94); }
  60% { opacity: 1; filter: brightness(0) blur(1px) drop-shadow(0 0 40px rgba(255, 220, 160, 0.9)); }
  100% { opacity: 1; filter: brightness(0) blur(0) drop-shadow(0 0 3px rgba(225, 205, 175, 0.85)); transform: none; }
}
/* 실루엣 모양 그대로 빛줄기가 위에서 아래로 훑는다 */
.fig .sweep {
  position: absolute;
  inset: 0;
  -webkit-mask: var(--mask) center bottom / contain no-repeat;
  mask: var(--mask) center bottom / contain no-repeat;
  background: linear-gradient(180deg, transparent 0%, rgba(255, 240, 215, 0) 38%, rgba(255, 244, 222, 0.95) 50%, rgba(255, 240, 215, 0) 62%, transparent 100%);
  background-size: 100% 300%;
  background-position: 0 100%;
  opacity: 0;
  animation: sweep 1.9s ease-in-out 0.5s forwards;
}
@keyframes sweep {
  0% { background-position: 0 100%; opacity: 1; }
  90% { opacity: 1; }
  100% { background-position: 0 0%; opacity: 0; }
}
.fig .ember {
  position: absolute;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffe8c4;
  box-shadow: 0 0 7px 2px rgba(255, 210, 140, 0.85);
  opacity: 0;
  animation: ember var(--d) ease-out var(--delay) forwards;
}
@keyframes ember {
  0% { opacity: 0; transform: translate(0, 0); }
  20% { opacity: 1; }
  100% { opacity: 0; transform: translate(var(--dx), var(--dy)); }
}

/* 범인 지목 */
.fig.aim { opacity: 1 !important; }
.fig.aim .art { filter: brightness(0) drop-shadow(0 0 2px rgba(255, 95, 85, 0.95)) drop-shadow(0 0 28px rgba(220, 40, 40, 0.55)) !important; }
.fig.accused {
  opacity: 1 !important;
  z-index: 2;
  transform: translateX(-50%) scale(1.15) !important;
  transition: transform 1.4s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.8s;
}
.fig.accused .art { filter: brightness(0) drop-shadow(0 0 3px rgba(255, 110, 100, 1)) drop-shadow(0 0 50px rgba(200, 30, 30, 0.6)) !important; }
.fig.dim { opacity: 0.06 !important; transition: opacity 1.2s; }

/* ---- 효과음 연출 ---- */

#stage.shake-s { animation: shake 0.35s linear; --amp: 4px; }
#stage.shake-m { animation: shake 0.45s linear; --amp: 9px; }
#stage.shake-l { animation: shake 0.6s linear; --amp: 16px; }
@keyframes shake {
  0%, 100% { transform: none; }
  15% { transform: translate(calc(var(--amp) * -1), calc(var(--amp) * 0.5)); }
  30% { transform: translate(var(--amp), calc(var(--amp) * -0.6)); }
  45% { transform: translate(calc(var(--amp) * -0.7), calc(var(--amp) * -0.3)); }
  60% { transform: translate(calc(var(--amp) * 0.5), calc(var(--amp) * 0.4)); }
  80% { transform: translate(calc(var(--amp) * -0.2), 0); }
}
.flash-fx { position: fixed; inset: 0; pointer-events: none; opacity: 0; }
.flash-fx.lightning { background: #eef3ff; animation: lightning 1.5s ease-out forwards; }
@keyframes lightning {
  0% { opacity: 0; } 4% { opacity: 0.85; } 9% { opacity: 0.08; } 15% { opacity: 0.7; } 32% { opacity: 0; } 100% { opacity: 0; }
}
.flash-fx.muzzle {
  background: radial-gradient(ellipse 60% 55% at var(--x) 42%, rgba(255, 246, 225, 1), rgba(255, 210, 150, 0.45) 30%, rgba(255, 190, 120, 0) 70%);
  animation: muzzle 0.6s ease-out forwards;
}
@keyframes muzzle { 0% { opacity: 1; } 100% { opacity: 0; } }
.flash-fx.blood {
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 30%, rgba(140, 0, 0, 0.8) 100%);
  animation: blood 1.3s ease-out forwards;
}
@keyframes blood { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
.flash-fx.shards {
  background: repeating-linear-gradient(115deg, transparent 0 46px, rgba(235, 245, 255, 0.6) 47px 48px, transparent 49px 110px),
    repeating-linear-gradient(35deg, transparent 0 70px, rgba(235, 245, 255, 0.4) 71px 72px, transparent 73px 150px);
  animation: shards 0.8s ease-out forwards;
}
@keyframes shards { 0% { opacity: 1; } 30% { opacity: 0.3; } 45% { opacity: 0.8; } 100% { opacity: 0; } }

/* 소리 파동: 소리가 난 방향에서 동그랗게 번진다 */
.ripple {
  position: absolute;
  top: 40vh;
  width: 60px;
  height: 60px;
  margin: -30px 0 0 -30px;
  border-radius: 50%;
  border: 1.5px solid rgba(220, 230, 255, 0.55);
  box-shadow: 0 0 18px rgba(200, 215, 255, 0.25);
  opacity: 0;
  animation: ripple 1.6s ease-out forwards;
}
@keyframes ripple {
  0% { transform: scale(0.2); opacity: 0.9; }
  100% { transform: scale(calc(4 * var(--s))); opacity: 0; }
}

/* 심장 소리: 가장자리가 붉게 맥박친다 */
body.heart::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(0, 0, 0, 0) 42%, rgba(110, 0, 0, 0.6) 100%);
  animation: heartPulse 0.9s ease-in-out infinite;
}
@keyframes heartPulse {
  0%, 100% { opacity: 0.2; } 12% { opacity: 0.95; } 24% { opacity: 0.3; } 36% { opacity: 0.75; } 60% { opacity: 0.15; }
}

/* ---- 선택지 카드 ---- */

#choice {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 34px;
  z-index: 6;
  text-align: center;
}
#choice .q {
  margin: 0 0 14px;
  font-size: 17px;
  color: #d6dbe0;
  text-shadow: 0 0 10px #000;
  animation: fadeUp 0.5s ease both;
}
#choice .opts {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-areas: ". up ." "left . right" ". down .";
  gap: 10px;
  max-width: 680px;
  margin: 0 auto;
}
#choice .opt {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 13px 14px;
  font: inherit;
  font-size: 15px;
  color: #ece6dc;
  background: rgba(12, 14, 18, 0.8);
  border: 1px solid rgba(200, 190, 170, 0.3);
  border-radius: 14px;
  backdrop-filter: blur(6px);
  cursor: pointer;
  opacity: 0;
  animation: optIn 0.6s cubic-bezier(0.2, 0.8, 0.2, 1) forwards;
  transition: border-color 0.2s, background 0.2s;
}
#choice .opt:hover { border-color: rgba(235, 215, 175, 0.7); background: rgba(30, 28, 24, 0.85); }
#choice .opt .arrow { font-size: 12px; color: #c9b496; }
#choice .opt.up { grid-area: up; --fy: -28px; }
#choice .opt.left { grid-area: left; --fx: -44px; }
#choice .opt.right { grid-area: right; --fx: 44px; }
#choice .opt.down { grid-area: down; --fy: 28px; }
@keyframes optIn {
  from { opacity: 0; transform: translate(var(--fx, 0), var(--fy, 0)) scale(0.92); filter: blur(6px); }
  to { opacity: 1; transform: none; filter: none; }
}
#choice.picked .opt:not(.chosen) { animation: optOut 0.45s ease forwards; }
#choice .opt.chosen { opacity: 1; animation: optChosen 0.8s ease forwards; }
@keyframes optOut { to { opacity: 0; transform: scale(0.9); filter: blur(5px); } }
@keyframes optChosen {
  0% { opacity: 1; }
  30% { transform: scale(1.08); background: rgba(70, 55, 32, 0.9); border-color: rgba(255, 225, 170, 0.95); box-shadow: 0 0 44px rgba(255, 214, 150, 0.6); }
  100% { opacity: 1; transform: scale(1.04); background: rgba(50, 40, 26, 0.85); border-color: rgba(255, 225, 170, 0.7); box-shadow: 0 0 24px rgba(255, 214, 150, 0.35); }
}
#choice.out { animation: fadeOut 0.45s ease forwards; }
body.choosing #sublog { opacity: 0; transition: opacity 0.4s; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes fadeOut { to { opacity: 0; transform: translateY(8px); } }

/* ---- 방향 나침반 ---- */

#compass {
  position: fixed;
  left: 50%;
  bottom: 150px;
  width: 150px;
  height: 150px;
  margin-left: -75px;
  pointer-events: none;
  z-index: 5;
  animation: fadeUp 0.5s ease both;
}
#compass.out { animation: fadeOut 0.45s ease forwards; }
#compass .dial {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(200, 212, 228, 0.28);
  background: radial-gradient(circle, rgba(22, 26, 32, 0.7), rgba(10, 12, 15, 0.25));
  box-shadow: 0 0 30px rgba(150, 170, 200, 0.12) inset;
  transform: rotate(var(--r, 0deg));
}
#compass .tick {
  position: absolute;
  left: 50%;
  top: 0;
  width: 2px;
  height: 9px;
  margin-left: -1px;
  background: rgba(220, 228, 240, 0.55);
  transform-origin: 1px 75px;
  transform: rotate(var(--a));
}
#compass .n { position: absolute; font-size: 11px; font-weight: 500; color: #c9d2dc; }
#compass .n.f { left: 50%; top: 14px; transform: translateX(-50%) rotate(calc(var(--r, 0deg) * -1)); color: #f0d9a8; }
#compass .n.b { left: 50%; bottom: 14px; transform: translateX(-50%) rotate(calc(var(--r, 0deg) * -1)); }
#compass .n.l { left: 12px; top: 50%; transform: translateY(-50%) rotate(calc(var(--r, 0deg) * -1)); }
#compass .n.r { right: 8px; top: 50%; transform: translateY(-50%) rotate(calc(var(--r, 0deg) * -1)); }
#compass .needle {
  position: absolute;
  left: 50%;
  top: -6px;
  margin-left: -7px;
  border-left: 7px solid transparent;
  border-right: 7px solid transparent;
  border-top: 13px solid #f0d9a8;
  filter: drop-shadow(0 0 6px rgba(240, 200, 140, 0.9));
}

/* ---- 결말: 영화처럼 ---- */

body.ending #stage { filter: saturate(0.4) brightness(0.55); transition: filter 2.5s ease; }
#endcard { position: fixed; inset: 0; pointer-events: none; display: flex; align-items: center; justify-content: center; }
#endcard .bar { position: absolute; left: 0; right: 0; height: 0; background: #000; animation: bar 1.4s cubic-bezier(0.6, 0, 0.2, 1) forwards; }
#endcard .bar.top { top: 0; }
#endcard .bar.bottom { bottom: 0; }
@keyframes bar { to { height: 13vh; } }
#endcard .inner { position: relative; text-align: center; padding: 0 16px; margin-top: -8vh; }
#endcard .no {
  margin: 0;
  font-size: 13px;
  letter-spacing: 0.5em;
  color: #9a8e7a;
  opacity: 0;
  animation: fadeUp 0.8s ease 0.6s forwards;
}
#endcard h2 {
  margin: 12px 0 16px;
  font-size: clamp(28px, 6.5vw, 44px);
  font-weight: 300;
  letter-spacing: 0.15em;
  color: #efe2cb;
  text-shadow: 0 0 26px rgba(235, 200, 150, 0.4);
}
#endcard h2 span { display: inline-block; opacity: 0; animation: letterIn 0.7s cubic-bezier(0.2, 0.7, 0.2, 1) forwards; white-space: pre; }
@keyframes letterIn {
  from { opacity: 0; transform: translateY(14px); filter: blur(8px); }
  to { opacity: 1; transform: none; filter: blur(0); }
}
#endcard .count { margin: 0; font-size: 14px; color: #8f969d; opacity: 0; animation: fadeUp 0.8s ease forwards; }

.fig.seen { opacity: 0.45; }
.fig.behind { --s: 0.7; opacity: 0.2; }
.fig.talk { opacity: 1; }
.fig.talk svg {
  filter: drop-shadow(0 0 2px rgba(225, 205, 175, 0.85)) drop-shadow(0 0 30px rgba(220, 190, 150, 0.35));
}
.fig .name {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 14px;
  color: #b7a48e;
  opacity: 0;
  transition: opacity 0.3s;
}
.fig.talk .name { opacity: 1; }
.fig.radio.talk svg { animation: flicker 0.16s steps(2) infinite; }
@keyframes flicker { 50% { opacity: 0.7; } }

/* ---- 반짝이는 물건: 화면 전체가 빛난다 ---- */

#aura {
  --i: 0;
  --x: 50%;
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1s ease;
}
#aura.on { opacity: 1; }

/* 물건 쪽에서 화면 전체로 번지는 은은한 빛 */
#aura .wash {
  position: absolute;
  inset: -20%;
  background: radial-gradient(ellipse 75% 65% at var(--x) 45%,
    rgba(255, 255, 255, 0.95) 0%, rgba(228, 236, 255, 0.45) 30%, rgba(205, 220, 255, 0.12) 60%, rgba(205, 220, 255, 0) 80%);
  opacity: calc(0.04 + var(--i) * var(--i) * 0.4);
  transition: opacity 0.6s ease, background-position 0.3s;
}
#aura.near .wash { animation: auraBreathe 2.4s ease-in-out infinite; }
@keyframes auraBreathe {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.58; }
}

/* 화면 전체에 흩뿌려진 별가루. 가까울수록 진해진다 */
#aura .stars {
  position: absolute;
  inset: 0;
  opacity: calc(0.12 + var(--i) * 0.88);
  transition: opacity 0.6s ease;
}
#aura .star {
  position: absolute;
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 6px 2px rgba(232, 240, 255, 0.8);
  opacity: 0;
  animation: starTwinkle var(--d) ease-in-out var(--delay) infinite;
}
#aura .star.cross::before,
#aura .star.cross::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 22px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.9), transparent);
  transform: translate(-50%, -50%);
}
#aura .star.cross::after { transform: translate(-50%, -50%) rotate(90deg); }
#aura.near .star { animation-duration: calc(var(--d) * 0.55); }
#aura.burst .stars { opacity: 1; }
@keyframes starTwinkle {
  0%, 100% { opacity: 0; transform: scale(0.3); }
  50% { opacity: 1; transform: scale(1); }
}

/* 손 닿는 거리에 들어서는 순간: 부드럽게 "빠아~" */
#aura .flash {
  position: absolute;
  inset: -30%;
  background: radial-gradient(ellipse 70% 60% at var(--x) 45%,
    rgba(255, 255, 255, 0.95) 0%, rgba(235, 242, 255, 0.55) 35%, rgba(220, 232, 255, 0) 75%);
  opacity: 0;
  animation: flash 2s ease-out forwards;
}
@keyframes flash {
  0% { opacity: 0; transform: scale(0.7); }
  30% { opacity: 0.75; }
  100% { opacity: 0; transform: scale(1.25); }
}
#aura.pulse .wash { animation: auraPulse 0.5s ease-out; }
@keyframes auraPulse {
  40% { opacity: 0.6; }
}

/* 집었을 때: 화면 전체가 따뜻한 금빛으로 물든다 */
.gold {
  --x: 50%;
  position: fixed;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
.gold i { position: absolute; display: block; }
.gold .glow {
  inset: -30%;
  background: radial-gradient(ellipse 70% 60% at var(--x) 45%,
    rgba(255, 236, 196, 0.95) 0%, rgba(255, 210, 145, 0.5) 32%, rgba(255, 185, 105, 0.12) 60%, rgba(255, 185, 105, 0) 80%);
  opacity: 0;
  animation: goldBloom 2.4s ease-out forwards;
}
.gold .dust {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: #fff0d2;
  box-shadow: 0 0 8px 2px rgba(255, 214, 150, 0.9);
  opacity: 0;
  animation: rise var(--d) ease-out var(--delay) forwards;
}
@keyframes goldBloom {
  0% { opacity: 0; transform: scale(0.8); }
  25% { opacity: 0.8; }
  100% { opacity: 0; transform: scale(1.2); }
}
@keyframes rise {
  0% { transform: translate(0, 0); opacity: 0; }
  15% { opacity: 1; }
  100% { transform: translate(var(--dx), -220px); opacity: 0; }
}

#sublog {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: 40px;
  text-align: center;
  pointer-events: none;
}
#sublog p {
  text-shadow: 0 0 3px #000, 0 1px 10px rgba(0, 0, 0, 0.95), 0 0 24px rgba(0, 0, 0, 0.8);
  margin: 6px auto;
  max-width: 720px;
  font-size: 18px;
  line-height: 1.5;
  color: #dedede;
  transition: opacity 0.4s;
}
#sublog p.old1 { opacity: 0.45; }
#sublog p.old2 { opacity: 0.2; }
#sublog p.narr { font-style: italic; color: #a9b0b8; }
#sublog p.sys { color: #8fa6b6; }
/* 더블클릭할 때 글자가 선택되지 않게 */
body { -webkit-user-select: none; user-select: none; }

#skipfx {
  position: fixed;
  left: 50%;
  top: 46vh;
  transform: translate(-50%, -50%);
  font-size: 30px;
  letter-spacing: -0.1em;
  color: rgba(240, 225, 200, 0.9);
  text-shadow: 0 0 18px rgba(240, 210, 160, 0.7);
  pointer-events: none;
  animation: skipfx 0.55s ease-out forwards;
}
@keyframes skipfx {
  0% { opacity: 0; transform: translate(-70%, -50%) scale(0.8); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1.1); }
  100% { opacity: 0; transform: translate(-20%, -50%) scale(1); }
}

#sublog .caret {
  margin-left: 2px;
  font-style: normal;
  color: #8a9097;
  animation: blink 0.8s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }
#sublog .who { color: #c9b496; font-weight: 600; margin-right: 0.6em; }

/* ---- 휴대폰 버튼 ---- */

body.touch {
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
body.touch #sublog { bottom: 250px; }
body.touch #sublog p { font-size: 16px; }
body.touch .fig { top: 5vh; height: 25vh; }
body.touch .ripple { top: 18vh; }
body.touch #choice { bottom: 250px; }
body.touch #choice .opt { padding: 11px 8px; font-size: 14px; }
body.touch #compass { bottom: auto; top: 34vh; width: 120px; height: 120px; margin-left: -60px; }
body.touch #compass .tick { transform-origin: 1px 60px; }
body.touch #title { justify-content: flex-start; padding-top: 18vh; }

#pad {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 0 16px calc(20px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  z-index: 10;
}
#pad button {
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  font: inherit;
  color: #8a8a8a;
  background: #0d0d0d;
  border: 1px solid #2a2a2a;
  border-radius: 18px;
}
#pad button.on {
  background: #262626;
  color: #e0e0e0;
  border-color: #555;
}
#pad .row.top {
  display: flex;
  justify-content: space-between;
  width: 100%;
  max-width: 340px;
}
#pad .row.top button {
  padding: 10px 18px;
  font-size: 14px;
}
/* 조이스틱 + 확인 버튼 */
#pad {
  display: grid;
  grid-template-columns: 1fr auto;
  grid-template-areas: "top top" "stick ok";
  align-items: center;
  gap: 6px;
}
#pad .row.top { grid-area: top; justify-self: center; }
#pad .stick-zone {
  grid-area: stick;
  position: relative;
  height: 180px;
  touch-action: none;
}
#pad .stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 128px;
  height: 128px;
  margin: -64px 0 0 -64px;
  border-radius: 50%;
  border: 1.5px solid rgba(205, 210, 220, 0.22);
  background: radial-gradient(circle, rgba(255, 255, 255, 0.06), rgba(255, 255, 255, 0.01) 70%);
  opacity: 0.5;
  transition: opacity 0.25s, left 0.2s, top 0.2s;
}
#pad .stick::before,
#pad .stick::after {
  content: '';
  position: absolute;
  left: 50%;
  top: 50%;
  width: 104px;
  height: 1px;
  margin-left: -52px;
  background: linear-gradient(90deg, rgba(220, 225, 235, 0.25), transparent 30%, transparent 70%, rgba(220, 225, 235, 0.25));
}
#pad .stick::after { transform: rotate(90deg); }
#pad .stick-zone.active .stick { opacity: 1; transition: opacity 0.1s; }
#pad .knob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  margin: -28px 0 0 -28px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, rgba(245, 240, 230, 0.6), rgba(150, 150, 160, 0.25) 70%);
  box-shadow: 0 0 16px rgba(230, 220, 200, 0.2);
  transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1);
}
#pad .stick-zone.active .knob { transition: none; box-shadow: 0 0 28px rgba(245, 225, 185, 0.5); }
#pad .stick-zone .hint {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  text-align: center;
  font-size: 11px;
  color: #5a5a5a;
  pointer-events: none;
}
#pad button.ok {
  grid-area: ok;
  width: 92px;
  height: 92px;
  margin-right: 8px;
  border-radius: 50%;
  font-size: 17px;
  color: #d8d8d8;
  border-color: #444;
}

#pad .dpad {
  display: grid;
  grid-template-columns: repeat(3, 84px);
  grid-template-rows: repeat(3, 72px);
  gap: 8px;
}
#pad .dpad button { font-size: 22px; }
#pad .up { grid-area: 1 / 2; }
#pad .left { grid-area: 2 / 1; }
#pad .ok { grid-area: 2 / 2; font-size: 17px !important; color: #cfcfcf; border-color: #444; }
#pad .right { grid-area: 2 / 3; }
#pad .down { grid-area: 3 / 2; }

#debug {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}
