:root {
  --bg: #070510;
  --panel: #110d20;
  --border: #2c234a;
  --text: #eef2ff;
  --muted: #928ab8;
  --cyan: #38e8ff;
  --pink: #ff3db4;
  --green: #3dff8f;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  background: radial-gradient(circle at top, #1b1138 0%, var(--bg) 72%);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
  user-select: none;
}
.shell { width: 100%; max-width: 960px; display: flex; flex-direction: column; gap: 8px; }
.hud {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px; padding: 8px 14px;
}
.hud-left, .hud-right { display: flex; align-items: center; gap: 16px; }
.brand { font-weight: 900; letter-spacing: 0.16em; color: var(--cyan); text-shadow: 0 0 12px rgba(56, 232, 255, 0.45); }
.stat { display: flex; align-items: center; gap: 7px; }
.lbl { font-size: 0.7rem; font-weight: 800; color: var(--muted); }
.val { font-family: ui-monospace, monospace; font-size: 1rem; font-weight: 800; }
.cyan { color: var(--cyan); }
.green { color: var(--green); }
.pips { display: flex; gap: 4px; }
.pip { width: 14px; height: 11px; border-radius: 3px; background: var(--pink); box-shadow: 0 0 6px rgba(255, 61, 180, 0.6); }
.pip.empty { background: #261f3d; box-shadow: none; }
.icon-btn { background: #1d1734; border: 1px solid var(--border); color: var(--text); border-radius: 6px; width: 34px; height: 30px; cursor: pointer; }

.xp-bar-wrap { height: 7px; background: #130e24; border: 1px solid var(--border); border-radius: 999px; overflow: hidden; }
.xp-bar { height: 100%; width: 0%; background: linear-gradient(90deg, var(--green), var(--cyan)); transition: width 0.12s; }

.arena-wrap {
  position: relative; background: #06040e; border: 2px solid var(--border);
  border-radius: 12px; overflow: hidden; aspect-ratio: 940 / 520;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}
#gameCanvas { width: 100%; height: 100%; display: block; touch-action: none; }

.overlay {
  position: absolute; inset: 0; background: rgba(7, 5, 16, 0.86); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; padding: 14px; z-index: 10;
}
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 24px; max-width: 470px; width: 100%; max-height: 100%; overflow-y: auto;
  text-align: center; display: flex; flex-direction: column; gap: 10px;
}
.card h1 { color: var(--cyan); letter-spacing: 0.12em; }
.card p { font-size: 0.85rem; color: var(--muted); line-height: 1.4; }
.stats-box { background: #090614; border: 1px solid var(--border); border-radius: 8px; padding: 8px; font-family: monospace; font-size: 0.84rem; }
.lb-panel { background: #090614; border: 1px solid var(--border); border-radius: 8px; padding: 9px 11px; text-align: left; }
.lb-head { display: flex; justify-content: space-between; font-size: 0.72rem; font-weight: 800; color: var(--pink); margin-bottom: 5px; }
.lb-list { display: flex; flex-direction: column; gap: 3px; font-family: monospace; font-size: 0.77rem; color: var(--muted); }
.lb-row { display: flex; justify-content: space-between; }
.lb-submit { display: flex; gap: 6px; margin-top: 7px; }
.lb-submit input { flex: 1; background: #130e24; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 0.8rem; }
.ok-btn { background: var(--green); color: #05180c; border: none; border-radius: 6px; padding: 6px 12px; font-weight: 800; cursor: pointer; font-size: 0.75rem; }
.actions { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.primary-btn, .sec-btn { width: 100%; max-width: 260px; border-radius: 8px; padding: 10px 18px; font-weight: 800; cursor: pointer; }
.primary-btn { background: linear-gradient(90deg, var(--cyan), var(--pink)); color: #070510; border: none; letter-spacing: 0.08em; }
.sec-btn { background: rgba(56, 232, 255, 0.14); color: var(--cyan); border: 1px solid rgba(56, 232, 255, 0.45); }
.share-out { background: #090614; color: var(--cyan); border: 1px solid var(--border); border-radius: 6px; padding: 6px; font-size: 0.72rem; font-family: monospace; text-align: center; }
.challenge-box { background: rgba(56, 232, 255, 0.12); border: 1px solid rgba(56, 232, 255, 0.45); color: var(--cyan); padding: 7px; border-radius: 8px; font-size: 0.82rem; font-weight: 700; }

.upg-box { width: 100%; max-width: 680px; text-align: center; }
.upg-title { font-size: 1.3rem; font-weight: 900; color: var(--green); letter-spacing: 0.1em; }
.upg-sub { font-size: 0.82rem; color: var(--muted); margin: 4px 0 14px; }
.upg-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.upg-card {
  background: linear-gradient(180deg, #1b1434 0%, #100b20 100%);
  border: 1px solid #413370; border-radius: 12px; padding: 15px 13px; text-align: left;
  cursor: pointer; color: var(--text); display: flex; flex-direction: column; gap: 7px;
  transition: transform 0.12s, border-color 0.15s;
}
.upg-card:hover { transform: translateY(-4px); border-color: var(--cyan); }
.upg-top { display: flex; justify-content: space-between; align-items: center; }
.upg-name { font-weight: 800; font-size: 0.94rem; color: var(--cyan); }
.upg-desc { font-size: 0.79rem; color: var(--muted); line-height: 1.35; }
.footer { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); padding: 0 4px; }
.footer a { color: var(--cyan); text-decoration: none; font-weight: 700; }
.hidden { display: none !important; }
