* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
}

body {
  font-family: system-ui, -apple-system, "Malgun Gothic", "Apple SD Gothic Neo", sans-serif;
  background: radial-gradient(120% 90% at 20% 0%, #141d3d 0%, #0a0e1e 45%, #05060e 100%);
  color: #e9eef7;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #05060e;
  overflow: hidden;
}

/* 화면 가장자리를 살짝 어둡게 하고 위쪽에 은은한 빛을 깔아 깊이를 준다. */
.stage::after {
  content: '';
  position: absolute;
  z-index: 1;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 90px rgba(2, 4, 12, 0.72);
  background: linear-gradient(180deg, rgba(120, 150, 255, 0.07), rgba(0, 0, 0, 0) 34%);
}

#view {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.camera-source {
  position: absolute;
  left: 0;
  top: 0;
  width: 2px;
  height: 2px;
  opacity: 0;
  pointer-events: none;
}

/* ---------- 점수판 ---------- */

.hud {
  position: absolute;
  z-index: 3;
  left: 0;
  right: 0;
  top: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  pointer-events: none;
  font-variant-numeric: tabular-nums;
}

.hud.is-hidden { display: none; }

.hud-item,
.hud-lives {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 0;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1px solid rgba(140, 168, 235, 0.22);
  background: rgba(18, 25, 46, 0.62);
  box-shadow: 0 4px 14px rgba(3, 6, 16, 0.45);
  backdrop-filter: blur(6px);
}

.hud-label {
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  color: #93a1bd;
}

.hud-value {
  font-size: 1.12rem;
  font-weight: 700;
  color: #ffffff;
}

.hud-lives {
  margin: 0 0 0 auto;
  font-size: 1rem;
  letter-spacing: 2px;
  color: #ff6b7f;
}

/* ---------- 안내 화면 ---------- */

.overlay {
  position: absolute;
  z-index: 2;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 20px;
  text-align: center;
  background: radial-gradient(90% 70% at 50% 40%, rgba(24, 34, 68, 0.82), rgba(5, 7, 16, 0.94) 70%);
  backdrop-filter: blur(3px);
}

.overlay.is-hidden { display: none; }

.overlay-title {
  margin: 0;
  font-size: clamp(1.4rem, 4.6vw, 2rem);
  font-weight: 800;
  line-height: 1.15;
  text-shadow: 0 3px 18px rgba(4, 8, 22, 0.85);
}

.overlay.is-danger .overlay-title {
  color: #ff8b76;
  text-shadow: 0 0 24px rgba(255, 96, 64, 0.55), 0 3px 18px rgba(4, 8, 22, 0.85);
}

.overlay-text {
  margin: 0;
  max-width: 32rem;
  font-size: 0.9rem;
  line-height: 1.65;
  color: #b6c2d8;
}

.overlay-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

/* ---------- 스토리 건너뛰기 ---------- */

.intro-skip {
  position: absolute;
  z-index: 4;
  right: 12px;
  bottom: 12px;
}

.intro-skip.is-hidden { display: none; }

/* ---------- 아래 조작 줄 ---------- */

.panel {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 10px 12px 12px;
  background: linear-gradient(180deg, #101529, #0b0f1c);
  border-top: 1px solid rgba(120, 148, 220, 0.18);
  box-shadow: 0 -8px 24px rgba(3, 6, 16, 0.45);
}

.row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.btn {
  font: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 999px;
  border: 1px solid rgba(132, 158, 226, 0.28);
  background: linear-gradient(180deg, #1c2542, #151c30);
  color: #e8eefb;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.btn:hover:not(:disabled) {
  background: linear-gradient(180deg, #253159, #1a2338);
  box-shadow: 0 6px 18px rgba(4, 8, 22, 0.5);
  transform: translateY(-1px);
}

.btn:active:not(:disabled) { transform: translateY(0); }

.btn:focus-visible {
  outline: 2px solid rgba(122, 162, 255, 0.85);
  outline-offset: 2px;
}

.btn:disabled { opacity: 0.42; cursor: default; box-shadow: none; }

.btn.primary {
  border-color: rgba(126, 168, 255, 0.75);
  background: linear-gradient(180deg, #4a7bf7, #3358de);
  color: #ffffff;
  box-shadow: 0 6px 20px rgba(58, 100, 235, 0.35);
}

.btn.primary:hover:not(:disabled) {
  background: linear-gradient(180deg, #5a89ff, #3d63e8);
  box-shadow: 0 8px 24px rgba(58, 100, 235, 0.45);
}

.status {
  flex: 1 1 14rem;
  min-width: 0;
  margin: 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #adbad0;
}

.notice {
  margin: 0;
  font-size: 0.73rem;
  line-height: 1.5;
  color: #7481a0;
}

@media (max-height: 520px) {
  .notice { display: none; }
  .overlay-title { font-size: 1.25rem; }
  .overlay-text { font-size: 0.84rem; }
}
