:root { --bg:#ffffff; --fg:#111; --muted:#666; --accent:#111; --green:#16a34a; --red:#dc2626; }
* { box-sizing: border-box; }
html, body { height:100%; }
body {
  margin:0; background:var(--bg); color:var(--fg);
  font-family: "Noto Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  overflow:hidden;
}
#game { position:fixed; inset:0; width:100vw; height:100vh; display:block; }

.hud {
  position: fixed; top:16px; left:16px; right:16px; display:flex; justify-content:space-between; align-items:center; gap:12px;
  pointer-events:none;
}
.hud-left, .hud-right { display:flex; align-items:center; gap:12px; }
.hp-bar { width:240px; max-width:40vw; height:12px; background:#eee; border-radius:6px; overflow:hidden; box-shadow: inset 0 0 0 1px #ddd; }
.hp-fill { height:100%; background:linear-gradient(90deg, #16a34a, #22c55e); transition:width .15s ease; }
.xp-bar { width:200px; max-width:36vw; height:8px; background:#eef2ff; border-radius:6px; overflow:hidden; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.03); margin-left:10px; align-self:center; }
.xp-fill { height:100%; background:linear-gradient(90deg,#3b82f6,#60a5fa); transition: width .2s ease; }
.stat { font-weight:700; letter-spacing:.02em; }

.weapon-chip { pointer-events:auto; display:flex; align-items:center; gap:10px; padding:8px 12px; border:1px solid #e5e5e5; border-radius:12px; background:rgba(255,255,255,.86); backdrop-filter:saturate(1.2) blur(6px); }
.weapon-chip { -webkit-backdrop-filter: saturate(1.2) blur(6px); backdrop-filter: saturate(1.2) blur(6px); }
.weapon-icon { width:28px; height:28px; background:#f5f5f5; border-radius:6px; overflow:hidden; display:grid; place-items:center; }
.weapon-icon img { width:100%; height:100%; object-fit:cover; display:block; }
.weapon-name { font-weight:600; font-size:14px; }

.modal {
  position:fixed; inset:0; display:none; place-items:center; background:rgba(0,0,0,.06);
  z-index: 60; /* ensure modal sits above the canvas so choices are clickable */
}
.modal.show { display:grid; }
.modal-card {
  width:min(880px, calc(100vw - 32px)); background:#fff; border:1px solid #eaeaea; border-radius:16px; padding:20px 20px 16px;
  box-shadow: 0 10px 30px rgba(0,0,0,.08);
}
.modal-card h1 { margin:0; font-size:28px; letter-spacing:.01em; }
.sub { margin:.25rem 0 1rem; color:var(--muted); }
.choices { display:grid; grid-template-columns: repeat(3, 1fr); gap:12px; }
.choice {
  display:flex; flex-direction:row; align-items:center; gap:12px; padding:12px; border:1px solid #eee; border-radius:12px; cursor:pointer;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  background:#fff;
}
.choice:hover { transform: translateY(-2px); box-shadow:0 8px 20px rgba(0,0,0,.06); border-color:#e5e5e5; }
.choice .icon { width:56px; height:56px; border-radius:10px; overflow:hidden; background:#f6f6f6; display:grid; place-items:center; }
.choice .icon img { width:100%; height:100%; object-fit:cover; display:block; }
.choice .meta { display:flex; flex-direction:column; gap:4px; }
.choice .title { font-weight:800; }
.choice .desc { color:var(--muted); font-size:13px; line-height:1.2; }

button.ghost {
  pointer-events:auto; margin-top:12px; border:1px solid #e6e6e6; background:#fff; padding:8px 12px; border-radius:10px; font-weight:600; cursor:pointer;
}
button.ghost:hover { border-color:#dcdcdc; transform: translateY(-1px); }
/* modal buttons spacing / default hidden restart */
#restartBtn { display:none; margin-left:8px; }

.toast {
  position:fixed; bottom:16px; left:50%; transform:translateX(-50%); background:#111; color:#fff; padding:8px 12px; border-radius:10px; font-weight:600; display:none;
}
.toast.show { display:block; }

@media (max-width: 720px) {
  .choices { grid-template-columns: 1fr; }
  .weapon-chip { display:none; }
  .hp-bar { width:40vw; }
}

.weapon-list { display:flex; flex-direction:column; gap:8px; max-width:300px; }
.weapon-row {
  display:flex; align-items:center; gap:10px; padding:8px 10px; border:1px solid #e5e5e5; border-radius:12px; background:rgba(255,255,255,.9);
}
.weapon-row .icon { width:28px; height:28px; border-radius:6px; overflow:hidden; background:#f5f5f5; display:grid; place-items:center; }
.weapon-row .icon img { width:100%; height:100%; object-fit:cover; display:block; }
.weapon-row .meta { display:flex; flex-direction:column; gap:4px; min-width:120px; }
.weapon-row .title { font-weight:700; font-size:13px; }
.weapon-row .lvl { color:#666; font-size:11px; }
.weapon-row .bar { width:140px; height:6px; background:#f1f1f1; border-radius:4px; overflow:hidden; }
.weapon-row .fill { height:100%; width:0%; background:linear-gradient(90deg,#3b82f6,#60a5fa); transition:width .2s ease; }
.score { pointer-events:auto; display:flex; align-items:center; gap:6px; padding:8px 12px; border:1px solid #e5e5e5; border-radius:12px; background:rgba(255,255,255,.86); font-weight:700; }

/* Bottom UI panel (outside the game canvas) */
#bottom-ui { position: fixed; left: 16px; right: 16px; bottom: 16px; pointer-events: none; z-index: 50; }
.bottom-panel { pointer-events: auto; margin: 0 auto; max-width: 1100px; display:flex; align-items:center; gap:12px; justify-content: center; padding: 12px 16px; border-radius: 14px; background: rgba(255,255,255,0.9); border: 1px solid #eaeaea; box-shadow: 0 6px 20px rgba(0,0,0,0.06); }
.bottom-panel .hp-bar { width: 340px; max-width: 60vw; height:12px; }
.bottom-panel .xp-bar { width: 280px; max-width: 48vw; height:10px; }
.hud-controls { margin-left: 8px; display:flex; align-items:center; gap:8px; }

/* Bottom centered score */
#bottom-score { position: fixed; left: 50%; transform: translateX(-50%); bottom: 28px; pointer-events: auto; z-index: 55; display:flex; align-items:center; gap:8px; padding:8px 14px; border-radius:12px; background: rgba(255,255,255,0.95); border:1px solid #eaeaea; font-weight:800; }

/* Small screens adjustments */
@media (max-width: 720px) {
  .bottom-panel { flex-direction: column; gap:8px; padding:10px; }
  #bottom-score { bottom: 86px; }
}

/* Top center score */
#top-score { position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 70; pointer-events: none; font-weight: 800; color: #facc15; background: rgba(0,0,0,0.0); padding: 6px 10px; border-radius: 8px; font-size: 18px; }
#top-score span { color: #facc15; font-weight: 900; }

/* small score element used in bottom panel */
.score.small { padding:6px 10px; font-weight:700; font-size:14px; }