/* Every colour, size and space comes from tokens.css. */
* { box-sizing: border-box; margin: 0; }
html, body { height: 100%; overflow: hidden; background: var(--night); color: var(--bone); font-family: var(--face);
  -webkit-user-select: none; user-select: none; -webkit-tap-highlight-color: transparent; overscroll-behavior: none; }
#c { position: fixed; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
[hidden] { display: none !important; }

/* ember closes in from the screen edge while a strike is coming */
#danger { position: fixed; inset: 0; pointer-events: none; opacity: 0; transition: opacity var(--quick) var(--ease);
  box-shadow: inset 0 0 56px 6px var(--ember); }
#danger.on { opacity: 0.8; }
#danger.heavy { opacity: 1; animation: throb 0.24s linear infinite alternate; }
@keyframes throb { to { opacity: 0.55; } }

/* ── fight screen: them at the top, you at the bottom, the fight between ── */
#hud { position: fixed; inset: 0; pointer-events: none; }
.foe, .you { position: absolute; left: var(--gutter); right: var(--gutter); }
.foe { top: calc(env(safe-area-inset-top, 0px) + var(--gutter)); }
.you { bottom: calc(env(safe-area-inset-bottom, 0px) + var(--gutter)); }
.name { font-size: var(--size-label); font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1;
  margin-bottom: var(--gap); text-shadow: 0 2px 0 var(--night); }
.row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: var(--gap);
  font-size: var(--size-label); font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; line-height: 1;
  text-shadow: 0 2px 0 var(--night); }
.row .me { color: var(--moon); }
.row .name { margin: 0; }
/* one diamond per warden on this floor, then the gate's bell */
.pips { display: flex; gap: 6px; align-items: center; }
.pips i { width: 9px; height: 9px; background: var(--ember); transform: rotate(45deg); }
.pips i.gone { background: transparent; box-shadow: inset 0 0 0 1.5px color-mix(in srgb, var(--bone) 45%, transparent); }
.pips b { width: 11px; height: 13px; margin-left: 3px; background: var(--bronze); border-radius: 6px 6px 1px 1px; }
.row .lv { color: var(--bronze); }

.bar { position: relative; height: var(--bar); background: var(--night);
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%); }
.bar i, .bar b { position: absolute; inset: 0; transform-origin: left center; }
.bar i { transition: transform var(--quick) var(--ease); }
.bar b { background: var(--bone); transition: transform var(--slow) var(--ease) 0.25s; }  /* the chunk just lost */
.foe-bar i { background: var(--ember); }
.you-bar i { background: var(--moon); }
.xp-bar { height: var(--bar-thin); margin-top: calc(var(--gap) / 2); }
.xp-bar i { background: var(--bronze); transition-duration: var(--slow); }

#toast { position: absolute; left: 0; right: 0; top: 24%; text-align: center; font-size: var(--size-title); font-weight: 900;
  letter-spacing: 0.04em; text-transform: uppercase; line-height: 1; opacity: 0; text-shadow: 0 3px 0 var(--night); }
#toast.go { animation: toast 1.1s var(--ease) both; }
#toast.moon { color: var(--moon); }
#toast.bronze { color: var(--bronze); }
@keyframes toast { 0% { opacity: 0; transform: scale(1.5); } 14% { opacity: 1; transform: scale(1); }
  75% { opacity: 1; } 100% { opacity: 0; transform: translateY(-14px); } }

#hint { position: absolute; left: 0; right: 0; bottom: calc(env(safe-area-inset-bottom, 0px) + 112px); text-align: center;
  font-size: calc(var(--size-label) * 1.25); font-weight: 900; letter-spacing: 0.08em; text-transform: uppercase;
  opacity: 0; transition: opacity var(--slow) var(--ease); text-shadow: 0 2px 0 var(--night); }
#hint.on { opacity: 1; animation: nudge 0.9s ease-in-out infinite alternate; }
#hint.moon { color: var(--moon); }

/* the answering swipe: a moon arrow that fills as the blow nears and turns white when it is time */
#cut { position: absolute; left: 50%; top: 60%; width: min(60vw, 280px); height: var(--bar);
  background: color-mix(in srgb, var(--night) 60%, transparent); }
#cut i { position: absolute; inset: 0; background: var(--moon); transform-origin: left center; }
#cut b { position: absolute; left: 100%; top: 50%; margin-top: calc(var(--bar) * -1.1);
  border-left: calc(var(--bar) * 1.6) solid var(--moon); border-top: calc(var(--bar) * 1.1) solid transparent;
  border-bottom: calc(var(--bar) * 1.1) solid transparent; }
#cut.now { filter: drop-shadow(0 0 12px var(--moon)); }
#cut.now i { background: var(--bone); }
#cut.now b { border-left-color: var(--bone); }

/* where a touchpad or key cut passes: the middle of the view */
#dot { position: absolute; left: 50%; top: 50%; width: 6px; height: 6px; margin: -3px; background: var(--bone); opacity: 0.55; transform: rotate(45deg); }
body.touch #dot { display: none; }

/* thumb controls, phones only: the stick walks, Jump jumps; they sit with your health because they are you */
#stick, #jump { display: none; position: absolute; bottom: calc(env(safe-area-inset-bottom, 0px) + 92px); }
body.touch #stick, body.touch #jump { display: block; }
#stick { left: calc(var(--gutter) + 6px); width: 104px; height: 104px; border-radius: 50%;
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bone) 40%, transparent); background: color-mix(in srgb, var(--night) 35%, transparent); }
#knob { position: absolute; left: 50%; top: 50%; width: 44px; height: 44px; margin: -22px; border-radius: 50%; background: var(--moon); opacity: 0.85; }
#jump { right: var(--gutter); width: 84px; height: 84px; border-radius: 50%; border: 0; pointer-events: auto;
  font: inherit; font-weight: 900; font-size: var(--size-label); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--night); background: var(--moon); opacity: 0.9; touch-action: none; }
#jump:active { transform: scale(0.94); }
body.touch #hint { bottom: calc(env(safe-area-inset-bottom, 0px) + 214px); }

#combo { position: absolute; right: var(--gutter); top: 30%; font-size: var(--size-title); font-weight: 900; line-height: 1;
  color: var(--moon); text-shadow: 0 3px 0 var(--night); }
#combo.pop { animation: pop var(--quick) var(--ease); }
@keyframes pop { from { transform: scale(1.6); } }
@keyframes nudge { to { transform: translateY(-6px); } }

/* ── title and end screens: what it is at the top, the one action under the thumb ── */
.screen { position: fixed; inset: 0; display: flex; flex-direction: column; justify-content: space-between;
  padding: calc(env(safe-area-inset-top, 0px) + var(--gutter)) var(--gutter) calc(env(safe-area-inset-bottom, 0px) + var(--gutter));
  background: linear-gradient(to bottom, color-mix(in srgb, var(--night) 82%, transparent), transparent 42%,
    transparent 62%, color-mix(in srgb, var(--night) 88%, transparent)); }
#end { background: color-mix(in srgb, var(--night) 72%, transparent); }
.screen h1 { font-size: var(--size-title); font-weight: 900; letter-spacing: 0.06em; text-transform: uppercase; line-height: 0.95; }
.screen h2 { font-size: var(--size-title); font-weight: 900; letter-spacing: 0.04em; text-transform: uppercase; line-height: 0.95; }
.screen p { font-size: var(--size-label); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  margin-top: var(--gutter); opacity: 0.8; }
.screen footer { display: flex; flex-direction: column; gap: var(--gap); width: 100%; max-width: 420px; margin: 0 auto; }
#end.won h2 { color: var(--bronze); }

.btn { font: inherit; font-weight: 900; font-size: calc(var(--size-label) * 1.2); letter-spacing: 0.08em; text-transform: uppercase;
  height: var(--press); border: 0; cursor: pointer; color: var(--night); background: var(--ember);
  clip-path: polygon(0 0, 100% 0, calc(100% - var(--cut)) 100%, 0 100%); transition: transform var(--quick) var(--ease); }
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.55; }
.screen .alt { margin: 0; text-align: center; font-size: var(--size-small); opacity: 0.6; }
body.touch .screen .alt { display: none; }
.btn.quiet { background: transparent; color: var(--bone); height: calc(var(--press) * 0.75); font-size: var(--size-label);
  clip-path: none; box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--bone) 55%, transparent); }

@media (min-aspect-ratio: 1/1) { /* landscape and desktop: same three blocks, bars kept short */
  .foe, .you { left: 50%; right: auto; width: min(520px, 60vw); transform: translateX(-50%); }
}
@media (prefers-reduced-motion: reduce) {
  #hint.on, #danger.heavy { animation: none; }
}
