* { box-sizing: border-box; margin: 0; }
:root {
  --ink: #e8ecff; --dim: #9aa6cf; --panel: rgba(20, 26, 47, 0.88);
  --edge: #35e0c8; --amber: #ffb056; --bg: #141a2f;
}
html, body { height: 100%; overflow: hidden; background: var(--bg);
  font-family: "Avenir Next", "Segoe UI", system-ui, sans-serif; color: var(--ink); }
#scene { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
#hud { position: fixed; top: 0; left: 0; right: 0; display: flex; gap: 8px;
  padding: 8px 10px; pointer-events: none; flex-wrap: wrap; }
.stat { background: var(--panel); border: 1px solid #2c3760; border-radius: 10px;
  padding: 6px 12px; display: flex; flex-direction: column; align-items: center;
  font-size: 18px; font-weight: 700; min-width: 64px; }
.stat .k { font-size: 10px; letter-spacing: 0.14em; color: var(--dim); text-transform: uppercase; }
.stat.wide { flex-direction: row; gap: 10px; font-size: 13px; margin-left: auto; }
#hud-timer { color: var(--amber); }
#build-bar { position: fixed; left: 50%; transform: translateX(-50%);
  bottom: 10px; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center;
  background: var(--panel); border: 1px solid #2c3760; border-radius: 14px; padding: 8px; }
button { font: inherit; color: var(--ink); background: #232c4e; border: 1px solid #3a4a7d;
  border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 600; }
button:hover { border-color: var(--edge); }
.type-btn.active { border-color: var(--edge); background: #2c4258;
  box-shadow: 0 0 12px rgba(53, 224, 200, 0.45); }
#btn-wave { background: #4a2f23; border-color: var(--amber); color: var(--amber); }
#sel-panel { position: fixed; right: 10px; top: 70px; background: var(--panel);
  border: 1px solid #3a4a7d; border-radius: 14px; padding: 12px; display: flex;
  flex-direction: column; gap: 8px; min-width: 190px; }
#sel-name { font-weight: 800; color: var(--edge); }
#sel-info { font-size: 13px; color: var(--dim); }
#touch-controls { position: fixed; left: 10px; bottom: 10px; display: flex; gap: 8px; }
#touch-controls button { width: 48px; height: 48px; font-size: 20px; border-radius: 50%; }
.overlay { position: fixed; inset: 0; display: flex; align-items: center;
  justify-content: center; background: rgba(10, 13, 26, 0.72); z-index: 10; }
.panel { background: var(--panel); border: 1px solid #3a4a7d; border-radius: 18px;
  padding: 26px 30px; max-width: 560px; margin: 16px; text-align: center;
  box-shadow: 0 0 40px rgba(53, 224, 200, 0.15); }
.panel h1 { color: var(--amber); letter-spacing: 0.12em; font-size: 30px; margin-bottom: 10px; }
.panel .tag { color: var(--ink); font-size: 14px; line-height: 1.5; margin-bottom: 12px; }
.howto { text-align: left; font-size: 13px; color: var(--dim); margin: 0 0 16px;
  list-style: none; display: flex; flex-direction: column; gap: 5px; }
.howto b { color: var(--ink); }
#btn-start, .panel button { background: #4a2f23; border-color: var(--amber);
  color: #ffe6c4; font-size: 17px; padding: 10px 26px; border-radius: 12px; }
.fine { margin-top: 12px; font-size: 11px; color: var(--dim); }
.hidden { display: none !important; }
@media (max-width: 480px) {
  .stat { font-size: 14px; min-width: 52px; padding: 4px 8px; }
  .stat.wide { font-size: 11px; }
  #build-bar { bottom: 64px; padding: 6px; gap: 6px; }
  #build-bar button { padding: 6px 8px; font-size: 12px; }
  #sel-panel { top: auto; bottom: 120px; right: 10px; min-width: 160px; }
  .panel h1 { font-size: 22px; }
}
