@font-face {
  font-family: "Pixelify";
  src: url("pixelify.woff2") format("woff2");
  font-display: block;
}
:root {
  --ground: #1c1f1b;
  --wall: #4a5547;
  --moss: #6b8f71;
  --light: #d9c9a3;
  --ember: #e07a5f;
  --ember-hi: #f2b878;
  --ink: #121411;
  --px: 3px;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: var(--ground); color: var(--light);
  font-family: "Pixelify", monospace; font-size: 18px; line-height: 1.25;
  -webkit-tap-highlight-color: transparent; user-select: none; -webkit-user-select: none;
  touch-action: none; overscroll-behavior: none;
}
canvas#c {
  position: fixed; inset: 0; width: 100vw; height: 100vh; height: 100dvh;
  image-rendering: pixelated; image-rendering: crisp-edges; display: block;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; cursor: pointer; }

/* stepped pixel corners, no round corners anywhere */
.btn, .card, #dash, #pausebtn {
  border: 0; background: var(--wall);
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--ink), 0 var(--px) 0 0 var(--ink),
    calc(var(--px) * -1) 0 0 0 var(--ink), var(--px) 0 0 0 var(--ink),
    inset 0 calc(var(--px) * -1) 0 0 rgba(0, 0, 0, .28), inset 0 var(--px) 0 0 rgba(255, 255, 255, .1);
}
.btn { padding: 10px 22px; margin: 8px var(--px); font-size: 20px; }
.btn.big { background: var(--ember); color: var(--ink); font-size: 28px; padding: 12px 40px; }
.btn:hover { filter: brightness(1.1); }
.btn:active { transform: translateY(var(--px)); }
.btn:focus-visible, .card:focus-visible { outline: var(--px) solid var(--ember-hi); outline-offset: 6px; }

.screen {
  position: fixed; inset: 0; z-index: 5; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; padding: 24px;
  padding-top: max(24px, env(safe-area-inset-top)); padding-bottom: max(24px, env(safe-area-inset-bottom));
}
.screen.dim { background: rgba(14, 16, 13, .72); }
h1, h2 { margin: 0; font-weight: 400; color: var(--light); text-shadow: 0 var(--px) 0 var(--ink); }
h2 { font-size: 40px; margin-bottom: 10px; }

/* menu: title high, play button low, arena shows through */
#menu { justify-content: space-between; align-items: flex-start; padding-left: 7vw; padding-right: 7vw;
  background: linear-gradient(180deg, rgba(14, 16, 13, .85) 0%, rgba(14, 16, 13, .2) 45%, rgba(14, 16, 13, .2) 60%, rgba(14, 16, 13, .85) 100%); }
#menu h1 { font-size: clamp(64px, 14vw, 140px); line-height: .9; color: var(--ember-hi); text-shadow: 0 6px 0 #8f3a2c, 0 12px 0 var(--ink); }
.lede { max-width: 30em; margin: 18px 0 0; color: var(--light); }
#record { margin: 10px 0 0; color: var(--moss); }
.menu-low { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; }
.keys { margin: 0; font-size: 15px; color: #a9a48d; }
.touch { display: none; }
@media (hover: none) and (pointer: coarse) { .desk { display: none; } .touch { display: block; } }

/* HUD */
#hud { position: fixed; inset: 0 0 auto 0; z-index: 3; pointer-events: none;
  display: flex; justify-content: space-between; align-items: flex-start; flex-wrap: wrap;
  padding: 10px 14px; padding-top: max(10px, env(safe-area-inset-top)); text-shadow: 0 2px 0 var(--ink); }
#hearts { display: flex; gap: 3px; flex-wrap: wrap; max-width: 50vw; }
#hearts img { width: 27px; height: 24px; image-rendering: pixelated; }
.hud-r { display: flex; gap: 16px; font-size: 20px; padding-right: 44px; }
#kills::before { content: "✕ "; color: var(--ember); }
#bossbar { flex-basis: 100%; display: flex; align-items: center; gap: 10px; margin-top: 8px; justify-content: center; font-size: 16px; }
#bossbar i { display: block; width: min(60vw, 420px); height: 12px; background: var(--ink); box-shadow: 0 0 0 var(--px) var(--ink); }
#bossbar b { display: block; height: 100%; width: 100%; background: var(--ember); transition: width .12s linear; }
#banner { position: fixed; left: 0; right: 0; top: 30%; z-index: 4; text-align: center; font-size: 44px; pointer-events: none;
  color: var(--ember-hi); text-shadow: 0 4px 0 #8f3a2c, 0 8px 0 var(--ink); }

#pausebtn { position: fixed; z-index: 4; top: max(8px, env(safe-area-inset-top)); right: 10px; width: 34px; height: 34px; padding: 0; font-size: 16px; }
#dash { position: fixed; z-index: 4; right: 22px; bottom: max(26px, calc(env(safe-area-inset-bottom) + 14px));
  width: 92px; height: 92px; padding: 0; background: #6a3a30; overflow: hidden; font-size: 15px; }
#dash span { position: relative; z-index: 1; }
#dash i { position: absolute; inset: auto 0 0 0; height: 100%; background: var(--ember); }
#stick { position: fixed; z-index: 2; width: 84px; height: 84px; margin: -42px 0 0 -42px; pointer-events: none;
  border: var(--px) dashed rgba(217, 201, 163, .45); border-radius: 50%; }
#stick i { position: absolute; left: 50%; top: 50%; width: 26px; height: 26px; margin: -13px 0 0 -13px; background: rgba(217, 201, 163, .55); }

/* upgrade cards */
#pick { background: rgba(14, 16, 13, .6); }
#cards { display: flex; gap: 22px; flex-wrap: wrap; justify-content: center; max-width: 960px; }
.card { width: 230px; min-height: 270px; padding: 18px 16px; display: flex; flex-direction: column; align-items: center; gap: 10px;
  background: #2c322a; text-align: center; }
.card:hover { background: #374034; }
.card img { width: 96px; height: 96px; image-rendering: pixelated; }
.card b { font-weight: 400; font-size: 24px; color: var(--ember-hi); }
.card span { color: var(--light); font-size: 17px; }
.card small { color: var(--moss); font-size: 14px; margin-top: auto; }
.card kbd { font: inherit; color: #8b876f; font-size: 13px; }
@media (max-width: 760px) {
  #cards { flex-direction: column; gap: 14px; width: 100%; align-items: stretch; }
  .card { width: auto; min-height: 0; flex-direction: row; text-align: left; padding: 12px 14px; gap: 14px; }
  .card img { width: 64px; height: 64px; flex: none; }
  .card div { display: flex; flex-direction: column; gap: 2px; }
  .card small { margin-top: 2px; }
  .card kbd { display: none; }
  h2 { font-size: 32px; }
}
.card div { display: contents; }
@media (max-width: 760px) { .card div { display: flex; } }

#overStats { font-size: 20px; text-align: center; margin: 0 0 12px; line-height: 1.6; }
#loading { position: fixed; inset: 0; z-index: 9; background: var(--ground); display: flex; align-items: center; justify-content: center; font-size: 24px; }
