/* HoardGuard 프로토타입 공통 스타일.
   전장은 전부 Canvas로 그리므로 CSS가 하는 일은 캔버스를 화면에 꽉 채우고
   개발용 로그 패널을 얹는 것뿐이다. 세로 화면 전용이라 스크롤과 확대는 막는다. */

:root {
  --bg: #0c0a07;
  --panel: #171a23;
  --line: #2a2f3d;
  --text: #dfe3ec;
  --dim: #8b93a7;
  --accent: #ffc861;
  --error: #ff7a7a;
  --warn: #ffc861;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", "Malgun Gothic", sans-serif;
}

body {
  /* 모바일에서 드래그가 스크롤·새로고침으로 새지 않게 한다. 카메라 드래그(M1)의 전제다. */
  touch-action: none;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#stage {
  display: block;
  width: 100vw;
  height: 100vh;
  /* iOS 노치 대응은 M1 UI 레이아웃에서 safe-area-inset으로 다시 다룬다. */
}

/* ------------------------------------------------------------ HUD

   05 문서 레이아웃: 화면 대부분은 전장, 하단에 선택 정보와 명령, 우측 하단에 미니맵.
   미니맵은 세로가 하단 바보다 길어서 하단 바 위로 겹쳐 올린다.
   입력 우선순위(하단 UI > 미니맵 > 전장)는 좌표로 판정하므로 여기서는
   pointer-events를 끄지 않는다 — 캔버스가 포인터를 받아야 한다. */

.hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.hud-bottom {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--line);
  background: rgba(12, 13, 18, .88);
}

.hud-selection-title {
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.hud-selection-body {
  margin-top: 4px;
  color: var(--dim);
  font-size: 11px;
  line-height: 1.4;
  /* 미니맵이 오른쪽을 덮으므로 그만큼 비운다 */
  padding-right: 108px;
}

.hud-minimap {
  position: absolute;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: rgba(12, 13, 18, .92);
}

/* ------------------------------------------------------------ 개발용 로그 */

.log-toggle {
  position: fixed;
  top: max(8px, env(safe-area-inset-top));
  right: max(8px, env(safe-area-inset-right));
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(23, 26, 35, .8);
  color: var(--dim);
  font: 11px system-ui, sans-serif;
  cursor: pointer;
}

.log-toggle:hover { color: var(--text); }

/* display를 지정한 클래스가 브라우저 기본 [hidden] { display: none }을 덮어쓰므로
   hidden 상태를 명시적으로 다시 숨긴다. 이게 없으면 로그 패널이 항상 열려 있다. */
.log-panel[hidden] { display: none; }

.log-panel {
  position: fixed;
  left: 8px;
  right: 8px;
  bottom: 8px;
  max-height: 45vh;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(12, 13, 18, .94);
  overflow: hidden;
}

.log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-size: 11px;
  letter-spacing: .04em;
}

.log-close {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--dim);
  font: 11px system-ui, sans-serif;
  padding: 2px 8px;
  cursor: pointer;
}

.log-list {
  overflow-y: auto;
  padding: 6px 10px 10px;
  font: 11px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
}

.log-line { padding: 1px 0; }
.log-info { color: var(--dim); }
.log-warn { color: var(--warn); }
.log-error { color: var(--error); }

.noscript {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  margin: 0;
  color: var(--dim);
}
