:root {
  --bg: #070b16;
  --panel: #131c33;
  --text: #f2f5fa;
  --muted: #9aa7bd;
  --accent: #2dd4bf;
  --hud-h: 52px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Malgun Gothic", "Noto Sans KR", sans-serif;
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

#app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#hud {
  width: min(100vw, calc((100dvh - var(--hud-h)) * 360 / 640));
  height: var(--hud-h);
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  padding: 0 12px;
}

.hud-item { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.hud-item .label { font-size: 11px; color: var(--muted); }
.hud-item b { font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
#hud-lives { color: var(--accent); letter-spacing: 2px; }

#mute, #lang-hud {
  background: none;
  border: 0;
  font-size: 20px;
  padding: 6px;
  cursor: pointer;
}

#stage {
  position: relative;
  width: min(100vw, calc((100dvh - var(--hud-h)) * 360 / 640));
  aspect-ratio: 360 / 640;
}

#game { display: block; width: 100%; height: 100%; border-radius: 10px; }

#practice-tag {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 12px;
  color: var(--muted);
  background: rgba(16, 24, 40, 0.8);
  padding: 3px 10px;
  border-radius: 999px;
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 20px 24px;
  text-align: center;
  background: rgba(16, 24, 40, 0.93);
  border-radius: 10px;
}

.overlay[hidden], #practice-tag[hidden] { display: none; }

h1 { font-size: 34px; margin: 0; letter-spacing: -0.5px; }
h2 { font-size: 22px; margin: 0; }
.sub { margin: 0; color: var(--muted); font-size: 14px; }

.rules {
  list-style: none;
  margin: 8px 0 10px;
  padding: 14px 16px;
  background: var(--panel);
  border-radius: 12px;
  text-align: left;
  font-size: 14px;
  line-height: 1.5;
  display: grid;
  gap: 6px;
}
.rules b { color: var(--accent); }

button.primary, button.ghost {
  width: 100%;
  max-width: 280px;
  min-height: 50px;
  border-radius: 12px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}
button.primary { background: var(--accent); color: #06231f; border: 0; }
button.ghost { background: none; color: var(--muted); border: 1px solid #33415a; font-size: 14px; font-weight: 500; min-height: 44px; }
button:active { transform: translateY(1px); }

.hint { margin: 0; min-height: 18px; font-size: 13px; color: var(--muted); }
.score { margin: 0; }
.score b { font-size: 52px; font-variant-numeric: tabular-nums; letter-spacing: -1px; }
.score span { font-size: 18px; color: var(--muted); margin-left: 4px; }
.rows { margin: 0; font-size: 24px; letter-spacing: 2px; }
.meta { margin: 0 0 6px; font-size: 14px; color: var(--muted); line-height: 1.6; }
.next { margin: 8px 0 0; font-size: 14px; color: var(--muted); }
.next b { color: var(--text); font-variant-numeric: tabular-nums; }

button.link {
  background: none;
  border: 0;
  color: var(--muted);
  font-size: 13px;
  font-family: inherit;
  text-decoration: underline;
  padding: 10px;
  cursor: pointer;
}
.meta b { color: #fbbf24; font-weight: 700; }


/* 화면 어디를 끌어도 드론이 움직이므로 브라우저의 스크롤·확대를 막는다 */
body { touch-action: none; overflow: hidden; }
.overlay { touch-action: pan-y; }
.rules { font-size: 13px; max-width: 340px; }
.meta b { color: #fbbf24; font-weight: 700; }
#hud-lives { color: #f472b6; }

/* ---- 설치 창, 안내 말풍선 ---- */
.overlay { overflow-y: auto; justify-content: safe center; }
.install-btn[hidden], #install[hidden], #toast[hidden] { display: none; }
#install { position: fixed; inset: 0; z-index: 10; display: flex; align-items: center; justify-content: center; padding: 24px; background: rgba(5, 9, 18, 0.82); }
#install .box { width: 100%; max-width: 320px; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 22px 20px 12px; background: var(--panel); border-radius: 18px; text-align: center; }
#install img { border-radius: 16px; }
#install p { margin: 0 0 4px; font-size: 14px; line-height: 1.7; color: var(--muted); white-space: pre-line; }
#toast { position: fixed; z-index: 20; left: 50%; bottom: 24px; transform: translateX(-50%); white-space: nowrap; padding: 10px 16px; border-radius: 999px; background: #f2f5fa; color: #101828; font-size: 14px; pointer-events: none; }


/* ---- v0.2: 던지기·폭탄·일시정지 ---- */
#pause { background: none; border: 0; font-size: 18px; padding: 6px 2px; color: var(--text); cursor: pointer; }
#hud { gap: 4px; padding: 0 8px; }
#hud-lives { letter-spacing: 0; }
.act { position: absolute; bottom: 14px; width: 64px; height: 64px; padding: 0; border-radius: 50%; border: 2px solid rgba(255,255,255,0.35); background: rgba(30,41,70,0.55); color: #fff; font-family: inherit; touch-action: none; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.act span { font-size: 24px; }
.act b { font-size: 14px; font-variant-numeric: tabular-nums; }
.act[hidden] { display: none; }
.act:active { transform: scale(0.93); }
.act.off { opacity: 0.35; }
.act.ready { border-color: #facc15; background: rgba(202,138,4,0.55); }
#k-toss { left: 10px; }
#k-bomb { right: 10px; }
.goals { margin: 0; font-size: 13px; line-height: 1.7; color: #fde68a; white-space: pre-line; }
.rules { margin: 4px 0; padding: 10px 14px; gap: 3px; }
.overlay { gap: 8px; }

/* 넓은 화면(펼친 폴드·가로·PC): 판을 넓혀 화면을 채우고, 버튼은 판 안쪽 아래 두 모서리.
   판 크기와 --edge(판 옆 여백)·--board(판 너비)는 game.js 의 layout()이 정한다 */
@media (min-aspect-ratio: 3/4) {
  #hud { width: min(100vw, var(--board, 100vw)); max-width: 560px; }
  #stage { width: 100vw; height: calc(100dvh - var(--hud-h)); aspect-ratio: auto; }
  #game { margin: 0 auto; }
  .act { width: 84px; height: 84px; bottom: 18px; }
  .act span { font-size: 31px; }
  .act b { font-size: 17px; }
  #k-toss { left: calc(var(--edge, 0px) + 14px); }
  #k-bomb { right: calc(var(--edge, 0px) + 14px); }
}

/* v0.5 강화 카드 */
#card-list { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
#card-list .card { display: flex; align-items: center; gap: 12px; text-align: left; padding: 12px 14px; border-radius: 14px; border: 2px solid #38bdf8; background: rgba(15, 23, 42, 0.9); color: #e2e8f0; font: inherit; cursor: pointer; }
#card-list .card:active { background: #0c4a6e; }
#card-list .card .ic { font-size: 30px; }
#card-list .card b { display: block; font-size: 16px; }
#card-list .card small { color: #94a3b8; font-size: 12px; }

#lang-hud { font-size: 13px; font-weight: 800; color: var(--muted); border: 1px solid #33415a; border-radius: 8px; padding: 4px 7px; margin-left: 2px; }
