:root {
  /* taken from the dummy itself: body yellow, joint black, damage red */
  --ink: #ece8df;
  --muted: #9c988e;
  --dim: #6b6862;
  --bg: #111111;
  --panel: rgba(17, 17, 17, 0.88);
  --panel-border: #2b2b2b;
  --line: #2b2b2b;
  --accent: #f2c14e;
  --hot: #e5432f;
  --f-stencil: 'Big Shoulders Stencil Display', 'Barlow Condensed', sans-serif;
  --f-cond: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --f-body: 'Barlow', sans-serif;
}

::selection { background: var(--accent); color: #111; }

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--f-body);
  font-variant-numeric: tabular-nums;
  user-select: none;
  -webkit-user-select: none;
}

#app, #app canvas { position: fixed; inset: 0; width: 100%; height: 100%; display: block; }

.panel {
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 2px;
}

.hidden { display: none !important; }

.k {
  display: inline-block;
  min-width: 1.6em;
  padding: 1px 6px;
  border-radius: 2px;
  border: 1px solid #3a3a3a;
  color: var(--ink);
  font-family: var(--f-cond);
  font-weight: 600;
  font-size: 0.85em;
  text-align: center;
}

#hud { position: fixed; inset: 0; pointer-events: none; }
.menu-open #hud { display: none; }

#score-panel {
  position: absolute; top: 16px; left: 16px;
  padding: 10px 16px 12px;
  min-width: 220px;
  border-top: 3px solid var(--hot);
}
#score-panel .label { font-family: var(--f-cond); font-weight: 700; font-size: 13px; letter-spacing: 2px; color: var(--hot); }
#score { font-family: var(--f-cond); font-weight: 700; font-size: 48px; line-height: 1; color: var(--accent); transition: transform .08s; }
#score.bump { transform: scale(1.12); }
#score-panel .sub { margin-top: 6px; font-size: 13px; color: var(--muted); }
#score-panel .sub b { color: var(--ink); }
.combo {
  position: absolute; right: 12px; top: 10px;
  background: var(--hot); color: #fff;
  font-family: var(--f-cond); font-weight: 700; font-size: 15px;
  padding: 1px 6px;
}

#status-panel {
  position: absolute; top: 16px; right: 16px;
  padding: 10px 16px; text-align: right; min-width: 180px;
  border-top: 3px solid var(--accent);
}
#map-name { font-family: var(--f-cond); font-weight: 600; font-size: 13px; color: var(--muted); letter-spacing: 1.5px; }
.state { font-family: var(--f-cond); font-weight: 700; font-size: 20px; letter-spacing: .5px; margin-top: 2px; }
.state.stand, .state.getup { color: var(--ink); }
.state.stumble { color: var(--accent); }
.state.fall, .state.ko { color: var(--hot); }
.state.limp { color: var(--muted); }
#timer { font-family: var(--f-cond); font-weight: 700; font-size: 24px; color: var(--accent); }
#flags { font-family: var(--f-cond); font-weight: 600; font-size: 13px; letter-spacing: 1px; color: var(--accent); margin-top: 2px; min-height: 0; }

#toolbar {
  position: absolute; bottom: 16px; left: 50%; transform: translateX(-50%);
  display: flex; gap: 0; pointer-events: auto;
  background: var(--panel); border: 1px solid var(--panel-border); border-radius: 2px;
}
.tool {
  width: 72px; height: 64px;
  border-right: 1px solid var(--line); border-top: 3px solid transparent;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  cursor: pointer; position: relative; transition: background-color .1s, border-color .1s;
}
.tool:last-child { border-right: 0; }
.tool:hover { background: rgba(255, 255, 255, 0.05); }
.tool.active { border-top-color: var(--accent); background: rgba(242, 193, 78, 0.10); }
.tool .ico { line-height: 0; color: var(--muted); }
.tool.active .ico { color: var(--accent); }
.tool .nm { font-family: var(--f-cond); font-size: 12px; letter-spacing: .5px; margin-top: 5px; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.tool.active .nm { color: var(--ink); }
.tool .num { position: absolute; top: 3px; left: 6px; font-family: var(--f-cond); font-size: 11px; color: var(--dim); font-weight: 700; }

#help {
  position: absolute; bottom: 16px; left: 16px;
  padding: 10px 14px 12px;
  font-family: var(--f-cond); font-size: 14px; color: var(--muted);
}
#help .help-head { font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--ink); font-size: 13px; }
#help .keys {
  display: grid; grid-template-columns: auto auto auto auto; gap: 4px 10px; align-items: center;
  margin: 10px 0 0;
}
#help dt { justify-self: end; font-weight: 700; color: var(--ink); border: 1px solid #3a3a3a; padding: 0 5px; border-radius: 2px; font-size: 13px; }
#help dd { margin: 0 8px 0 0; }
#help.collapsed .keys { display: none; }

#popups { position: absolute; inset: 0; overflow: hidden; }
.pop {
  position: absolute; transform: translate(-50%, -50%);
  font-family: var(--f-cond); font-weight: 700; white-space: nowrap;
  color: var(--accent); text-shadow: 0 2px 0 rgba(0,0,0,.6), 0 0 10px rgba(0,0,0,.4);
  animation: pop 1.1s ease-out forwards;
}
.pop.head { color: var(--hot); }
.pop.big { color: var(--ink); }
@keyframes pop {
  0% { opacity: 0; transform: translate(-50%, -30%) scale(.6); }
  12% { opacity: 1; transform: translate(-50%, -60%) scale(1.15); }
  100% { opacity: 0; transform: translate(-50%, -220%) scale(.95); }
}

#banner {
  position: absolute; top: 22%; left: 50%; transform: translateX(-50%);
  font-family: var(--f-stencil); font-size: 72px; letter-spacing: 2px; text-align: center;
  color: var(--ink); text-shadow: 0 3px 0 rgba(0,0,0,.45); opacity: 0; white-space: nowrap;
}
#banner.show { animation: banner 1.6s ease-out forwards; }
#banner small { display: block; font-family: var(--f-cond); font-weight: 700; font-size: 22px; letter-spacing: 2px; color: var(--accent); margin-top: 2px; }
@keyframes banner {
  0% { opacity: 0; transform: translateX(-50%) scale(1.25); }
  8% { opacity: 1; transform: translateX(-50%) scale(1); }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) scale(1); }
}

#vignette {
  position: absolute; inset: 0; opacity: 0;
  background: radial-gradient(ellipse at center, transparent 45%, rgba(255, 30, 20, .55) 100%);
  transition: opacity .5s;
}

#crosshair {
  position: absolute; left: 0; top: 0; width: 22px; height: 22px; margin: -11px 0 0 -11px;
  border: 2px solid rgba(255,255,255,.8); border-radius: 50%;
  box-shadow: 0 0 0 1px rgba(0,0,0,.35);
  display: none;
}

#menu {
  position: fixed; inset: 0; z-index: 10;
  background: linear-gradient(90deg, rgba(10, 10, 10, 0.55), rgba(10, 10, 10, 0) 70%);
}
#menu.hidden { display: none; }
.menu-panel {
  position: absolute; top: 0; bottom: 0; left: 0;
  width: min(540px, 100%);
  background: rgba(14, 14, 14, 0.94);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 0 40px 28px;
  overflow-y: auto;
}
.hazard {
  height: 10px; margin: 0 -40px;
  background: repeating-linear-gradient(-45deg, var(--accent) 0 14px, #111 14px 28px);
  flex: none;
}
.brand { display: flex; align-items: center; gap: 18px; margin: 44px 0 40px; }
.brand .mark { width: 56px; height: 56px; flex: none; }
#menu h1 {
  font-family: var(--f-stencil); font-size: clamp(56px, 8vw, 88px); line-height: .85; margin: 0;
  color: var(--accent); letter-spacing: 3px;
}
#menu .tag {
  margin: 8px 0 0; color: var(--muted);
  font-family: var(--f-cond); font-weight: 600; font-size: 15px; letter-spacing: 2px; text-transform: uppercase;
}
.list-head {
  display: flex; justify-content: space-between;
  font-family: var(--f-cond); font-weight: 600; font-size: 12px; letter-spacing: 2px; text-transform: uppercase;
  color: var(--dim); padding: 0 0 8px; border-bottom: 1px solid var(--line);
}
#map-list { display: flex; flex-direction: column; }
.map-row {
  display: grid; grid-template-columns: 52px 1fr auto; gap: 14px; align-items: baseline;
  width: 100%; padding: 16px 12px 16px 0; margin: 0;
  background: none; border: 0; border-bottom: 1px solid var(--line); border-radius: 0;
  color: var(--ink); font: inherit; text-align: left; cursor: pointer;
  transition: background-color .12s, color .12s, padding-left .12s;
}
.map-row .code { font-family: var(--f-cond); font-weight: 700; font-size: 14px; letter-spacing: 1px; color: var(--accent); }
.map-row .nm { display: block; font-family: var(--f-cond); font-weight: 700; font-size: 26px; line-height: 1.05; text-transform: uppercase; letter-spacing: .5px; }
.map-row .spec { display: block; margin-top: 4px; color: var(--muted); font-size: 15px; line-height: 1.4; }
.map-row .rec { font-family: var(--f-cond); font-weight: 700; font-size: 20px; text-align: right; color: var(--ink); }
.map-row .rec small { display: block; font-size: 14px; font-weight: 600; color: var(--muted); }
.map-row:hover, .map-row:focus-visible { background: var(--accent); color: #111; padding-left: 12px; outline: none; }
.map-row:hover .code, .map-row:hover .spec, .map-row:hover .rec, .map-row:hover .rec small,
.map-row:focus-visible .code, .map-row:focus-visible .spec, .map-row:focus-visible .rec, .map-row:focus-visible .rec small { color: #111; }
.menu-foot { margin-top: auto; padding-top: 28px; color: var(--dim); font-family: var(--f-cond); font-weight: 600; font-size: 14px; letter-spacing: 1px; }

#loading {
  position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 20; font-family: var(--f-cond); font-weight: 600; letter-spacing: 3px; color: var(--accent); font-size: 18px;
}
#loading.hidden { display: none; }

@media (max-width: 760px) {
  .menu-panel { padding: 0 20px 20px; }
  .hazard { margin: 0 -20px; }
  .brand { margin: 28px 0 24px; }
  #help { display: none; }
  .tool { width: 48px; height: 52px; }
  .tool .nm { display: none; }
  #score { font-size: 34px; }
  #banner { font-size: 34px; }
}
