:root {
  --bg: #07040a;
  --ink: #ffd6e2;
  --mute: #ffd6e26e;
  --hot: #ff3d6e;
  --ice: #3dffc4;
  --gold: #ffc857;
  --font: "Outfit", system-ui, sans-serif;
  --serif: "Cormorant Garamond", Georgia, serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; background: var(--bg); color: var(--ink); font-family: var(--font); overflow: hidden; touch-action: none; }
canvas { display: block; width: 100%; height: 100%; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
a { color: var(--ice); }

#hud { position: fixed; inset: 0; pointer-events: none; z-index: 2; }
.top { padding: 12px 16px 0; display: grid; gap: 6px; }
.hp, .xp { height: 8px; border-radius: 99px; background: #fff1; overflow: hidden; }
.hp i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #6a1020, var(--hot)); }
.xp i { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--gold), var(--ice)); }
.meta {
  position: absolute; top: 36px; right: 16px; text-align: right;
  font-variant-numeric: tabular-nums; font-size: 13px; color: var(--mute);
}
.meta b { display: block; font-size: 22px; color: var(--gold); font-weight: 700; }

.panel {
  position: fixed; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 24px; text-align: center;
  background: radial-gradient(ellipse at 50% 30%, #1a0812 0%, #07040acc 55%, #07040a 100%);
}
.stat:disabled { opacity: 0.45; cursor: default; }

.panel[hidden],
#hud[hidden],
#stick[hidden],
#lvlup[hidden],
#dead[hidden],
#menu[hidden] {
  display: none !important;
}
.panel.mid { background: rgba(7,4,10,0.72); backdrop-filter: blur(8px); }
.mark {
  font-family: var(--serif); font-size: clamp(56px, 12vw, 96px);
  letter-spacing: 0.28em; font-weight: 400;
}
.mark.small { font-size: clamp(28px, 6vw, 42px); letter-spacing: 0.2em; }
.sub { letter-spacing: 0.42em; text-transform: uppercase; font-size: 11px; color: var(--mute); margin: 4px 0 18px; }
.lead { max-width: 34em; color: var(--ink); opacity: 0.86; line-height: 1.45; margin-bottom: 18px; }
.panel label { display: grid; gap: 6px; font-size: 12px; color: var(--mute); margin-bottom: 14px; }
.panel input {
  background: #0006; border: 1px solid #ff3d6e44; border-radius: 12px;
  padding: 10px 14px; text-align: center; outline: none; min-width: 220px;
}
.row { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.go {
  padding: 12px 28px; border-radius: 999px;
  background: linear-gradient(160deg, var(--hot), #8b1e3f);
  font-weight: 700; letter-spacing: 0.08em;
  box-shadow: 0 10px 30px #ff3d6e44;
}
.ghost {
  padding: 12px 20px; border-radius: 999px; border: 1px solid #ff3d6e55; color: var(--mute);
}
.board {
  list-style: none; margin-top: 22px; width: min(420px, 92vw);
  text-align: left; font-size: 13px; color: var(--mute);
  max-height: 28vh; overflow: auto;
}
.board li { display: grid; grid-template-columns: 1.6em 1fr auto; gap: 8px; padding: 4px 0; border-bottom: 1px solid #fff1; }
.board b { color: var(--ink); font-weight: 600; }
.tiny { margin-top: 16px; font-size: 12px; color: var(--mute); }

.sh { height: 5px; border-radius: 99px; background: #fff1; overflow: hidden; margin: 0 16px; }
.sh i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, #3d6bff, #7af0ff); }
.bossbar {
  margin: 8px 16px 0; height: 10px; border-radius: 99px; background: #fff1;
  position: relative; overflow: hidden;
}
.bossbar[hidden] { display: none !important; }
.bossbar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, #6a1020, #ff2d55); }
.bossbar span {
  position: absolute; inset: 0; font-size: 9px; letter-spacing: 0.2em;
  display: grid; place-items: center; color: #fff; pointer-events: none;
}
.bars-extra { padding: 4px 0 0; }
#hud-pts { display: block; color: var(--ice); }

.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 8px; width: min(720px, 94vw); margin: 10px 0 16px; pointer-events: auto;
}
.stat {
  text-align: left; padding: 10px 12px; border-radius: 14px;
  border: 1px solid #7af0ff44; background: #0a1220cc;
}
.stat:hover { border-color: var(--ice); }
.stat b { display: block; color: var(--ice); font-size: 14px; }
.stat span { font-size: 11px; color: var(--mute); }
.stat em { font-style: normal; font-size: 11px; color: var(--gold); }

.camp {
  width: min(520px, 94vw); margin-top: 16px; text-align: left;
  font-size: 13px; color: var(--mute);
}
.camp h4 { color: var(--gold); font-weight: 600; margin-bottom: 8px; letter-spacing: 0.08em; }
.camp-row {
  display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center;
  padding: 5px 0; border-bottom: 1px solid #fff1;
}
.camp-row button { padding: 4px 10px; border-radius: 999px; border: 1px solid #ff3d6e55; }

.cards { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 18px; }
.card {
  width: 180px; min-height: 160px; padding: 16px 14px;
  border-radius: 18px; border: 1px solid #ff3d6e55;
  background: #14080fcc; text-align: left; pointer-events: auto;
  transition: transform 0.15s ease, border-color 0.15s;
}
.card:hover { transform: translateY(-4px); border-color: var(--ice); }
.card h3 { font-size: 16px; margin-bottom: 6px; color: var(--gold); }
.card p { font-size: 13px; color: var(--mute); line-height: 1.35; }

#stick {
  position: fixed; left: 28px; bottom: 28px; width: 110px; height: 110px; z-index: 4;
  border-radius: 50%; border: 1px solid #ff3d6e44; background: #0004;
}
#stick i {
  position: absolute; left: 50%; top: 50%; width: 42px; height: 42px; margin: -21px;
  border-radius: 50%; background: var(--hot); opacity: 0.85;
}

@media (min-width: 900px) { #stick { display: none !important; } }
