:root {
  --ink: #eef2ff;
  --accent: #ffcc33;
  --danger: #ff4d5e;
  --panel: rgba(10, 12, 24, 0.86);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05060d;
  color: var(--ink);
  font-family: "Pretendard", "Noto Sans KR", system-ui, sans-serif;
  user-select: none;
}

#game { display: block; width: 100vw; height: 100vh; }

.hidden { display: none !important; }

/* ---------- 화면(메뉴) ---------- */
.screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background: radial-gradient(circle at 30% 20%, #1b2140 0%, #05060d 70%);
  z-index: 20;
  padding: 24px;
  text-align: center;
}

.screen.overlay { background: rgba(5, 6, 13, 0.82); }

.title {
  font-size: clamp(42px, 9vw, 96px);
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 0.95;
  text-shadow: 0 6px 0 #000, 0 0 42px rgba(255, 204, 51, 0.35);
}
.title span { color: var(--accent); display: block; }

.subtitle { opacity: 0.75; font-size: 15px; }

.menu-buttons { display: flex; flex-direction: column; gap: 10px; min-width: 260px; }

.menu-buttons button {
  font: inherit;
  font-size: 20px;
  font-weight: 800;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.06);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 12px 26px;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.08s ease;
}

.menu-buttons button.focused,
.menu-buttons button:hover {
  background: var(--accent);
  color: #14140a;
  border-color: var(--accent);
  transform: translateX(6px);
}

.best { color: var(--accent); font-weight: 800; }
.footnote { position: absolute; bottom: 14px; opacity: 0.45; font-size: 12px; }

h2 { font-size: 34px; font-weight: 900; letter-spacing: 0.03em; }

.end-title { font-size: clamp(48px, 10vw, 110px); color: var(--danger); text-shadow: 0 5px 0 #000; }

.controls-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px 22px;
  max-width: 720px;
  width: 100%;
}
.controls-grid div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  padding: 9px 14px;
  font-size: 15px;
}
.controls-grid span { color: var(--accent); font-weight: 700; }

.tip { max-width: 640px; font-size: 14px; line-height: 1.55; opacity: 0.85; }

/* 설정 화면: 토글 + 상세 설명(스크롤) */
.screen.scrollable { justify-content: flex-start; overflow-y: auto; padding: 40px 24px 60px; }

.settings-help {
  max-width: 660px;
  width: 100%;
  text-align: left;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 20px 24px;
  font-size: 14px;
  line-height: 1.6;
}

.settings-help h3 {
  font-size: 19px;
  color: var(--accent);
  margin: 18px 0 8px;
}
.settings-help h3:first-child { margin-top: 0; }

.settings-help h4 {
  font-size: 15px;
  margin: 14px 0 6px;
  color: #9fd0ff;
}

.settings-help dl {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 4px 14px;
  margin: 0;
}

.settings-help dt {
  font-weight: 800;
  color: var(--ink);
  white-space: nowrap;
}

.settings-help dd { margin: 0; opacity: 0.88; }

@media (max-width: 560px) {
  .settings-help dl { grid-template-columns: 1fr; }
  .settings-help dd { margin: 0 0 6px 10px; }
}

/* ---------- HUD ---------- */
#hud { position: fixed; inset: 0; pointer-events: none; z-index: 10; font-weight: 800; }

.hud-top-left {
  position: absolute;
  top: 14px;
  left: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 14px;
  min-width: 190px;
}

.bar-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.bar-label { width: 30px; opacity: 0.8; }
.bar { flex: 1; height: 10px; background: rgba(255, 255, 255, 0.12); border-radius: 5px; overflow: hidden; }
.bar-fill { height: 100%; width: 100%; border-radius: 5px; transition: width 0.15s ease; }
.bar-fill.health { background: linear-gradient(90deg, #ff4d5e, #ff8a5e); }
.bar-fill.armor { background: linear-gradient(90deg, #5ed4ff, #8d9cff); }

#weaponInfo, #vehicleInfo { font-size: 14px; }
#vehicleInfo { color: var(--accent); }

.hud-top-right {
  position: absolute;
  top: 14px;
  right: 14px;
  text-align: right;
  background: var(--panel);
  border-radius: 12px;
  padding: 10px 14px;
}

#stars { font-size: 24px; color: var(--accent); letter-spacing: 3px; text-shadow: 0 2px 0 #000; }
#stars.hot { animation: starFlash 0.5s steps(2) infinite; }
@keyframes starFlash { 50% { opacity: 0.35; } }

#money { font-size: 18px; color: #7dff9b; }
#hint { font-size: 12px; opacity: 0.85; max-width: 220px; }

#minimap {
  position: absolute;
  left: 14px;
  bottom: 14px;
  border: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: #0a0c18;
}

/* ---------- 터치 조작 ---------- */
#touchUI { position: fixed; inset: 0; z-index: 15; pointer-events: none; }

#stick {
  position: absolute;
  left: 26px;
  bottom: 210px;
  width: 140px;
  height: 140px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(255, 255, 255, 0.22);
  pointer-events: auto;
  touch-action: none;
}

#stickKnob {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.35);
  transform: translate(-50%, -50%);
}

.touch-buttons {
  position: absolute;
  right: 20px;
  bottom: 26px;
  display: grid;
  grid-template-columns: repeat(2, auto);
  gap: 12px;
  justify-items: end;
  align-items: end;
  pointer-events: auto;
}

.touch-btn {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.25);
  background: rgba(10, 12, 24, 0.6);
  font-size: 28px;
  touch-action: none;
  color: var(--ink);
}
.touch-btn.big { width: 92px; height: 92px; font-size: 38px; }
.touch-btn.small { width: 52px; height: 52px; font-size: 20px; }
.touch-btn:active { background: rgba(255, 204, 51, 0.5); }

@media (pointer: coarse) {
  #minimap { width: 120px; height: 120px; }
}
