/* 앱 전체 뼈대. 전장 좌표·스케일은 W00-03에서 별도로 다룬다. */

:root {
  --bg: #080b14;
  --panel: #111726;
  --line: #223049;
  --text: #e8eefc;
  --dim: #9aa8c4;
  --accent: #ff5fd2;
  --warn: #ff6b6b;

  /* 노치·홈 인디케이터 여백. 실제 전장 여백 계산은 W00-03. */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
  -webkit-text-size-adjust: 100%;
}

/* 세로 게임이라 확대·당겨서 새로고침·길게 눌러 선택이 모두 조작을 방해한다. */
body {
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
}

/* 화면 하나가 들어갈 자리. */
.screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* 없으면 자식 전장이 넘칠 때 화면이 늘어난다 */
}

/* 01 §3의 세로 구성: 위 HUD / 전장 / 아래 안내. 전장은 그 사이 남은 자리만 쓴다. */
.dev-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.hud-band {
  flex: 0 0 auto;
  padding: 10px 14px;
  color: var(--dim);
  font-size: 12px;
  text-align: center;
}

/* 전장 아래 상태줄 (05 §2) */
.path-hud {
  position: relative;
  flex: 0 0 auto;
  padding: 10px 16px calc(12px + var(--safe-bottom));
  text-align: center;
}

/*
 * 집중 잔량 (02 §4, 05 §4). 색만으로 알리지 않고 테두리 자체가 줄어든다.
 * viewBox 100×100을 상태줄 크기로 늘려 쓰므로, 줄어드는 비율은 화면 크기와 무관하다.
 */
.focus-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  transition: opacity .15s ease;
}

.focus-hidden { opacity: 0; }

.focus-ring-line {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  vector-effect: non-scaling-stroke;
  opacity: .5;
}

/* 다 쓰면 테두리가 사라지고 상태줄에 '시간 정상'이 나온다. */
.focus-empty .focus-ring-line { stroke: rgba(255, 255, 255, 0.18); }

.ink {
  width: min(280px, 70%);
  height: 4px;
  margin: 0 auto 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
  overflow: hidden;
  transition: opacity .15s ease;
}

.ink-hidden { opacity: 0; }

.ink-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--accent);
}

/* 다 쓰면 번쩍이지 않고 바 끝이 떤다 (05 §4). 번쩍임은 적의 예고를 가린다. */
.ink-empty .ink-fill {
  background: #ffa8e4;
  animation: ink-shake .18s linear infinite;
}

@keyframes ink-shake {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(2px); }
}

.path-hud-text {
  color: var(--dim);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

@media (prefers-reduced-motion: reduce) {
  .ink-empty .ink-fill { animation: none; }
}

.hud-band-error {
  color: var(--warn);
  white-space: pre-wrap;
  text-align: left;
  -webkit-user-select: text;
  user-select: text;
}

.stage-host {
  position: relative;
  flex: 1;
  min-height: 0;
}

.stage-canvas {
  display: block;
  /* 캔버스 크기는 stage.js가 잰 값으로 직접 정한다. 여기서 늘이면 논리 좌표가 어긋난다. */
}

.boot-note {
  margin: 0;
  padding: 24px;
  color: var(--dim);
  font-size: 14px;
  text-align: center;
}

/* 부트가 실패하면 흰 화면 대신 이유를 보여 준다. 원인을 못 찾는 시간이 제일 아깝다. */
.boot-failure {
  margin: auto;
  max-width: 34rem;
  border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line));
  border-radius: 12px;
  background: var(--panel);
  padding: 18px 20px;
  text-align: left;
}

.boot-failure h1 {
  margin: 0 0 8px;
  font-size: 17px;
  color: var(--warn);
}

.boot-failure p {
  margin: 0 0 10px;
  color: var(--dim);
  font-size: 14px;
}

.boot-failure pre {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  background: #0a0e18;
  color: #ffb4b4;
  font-size: 12.5px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  overflow-x: auto;
  -webkit-user-select: text;
  user-select: text;
}
