@font-face {
  font-family: "Anton";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Anton-Regular.ttf") format("truetype");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("../fonts/Inter-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("../fonts/Inter-Medium.woff2") format("woff2");
}

@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url("../fonts/Inter-Bold.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #000000;
  --ink: #f1ede4;
  --dim: #b5afa4;
  --rule: #2b2824;
  --red: #e5212e;
  --red-bg: #c41622;
  --panel: #0d0c0b;
  --max: 920px;
  --pad-x: clamp(16px, 4vw, 40px);
}

* {
  box-sizing: border-box;
  min-width: 0;
}

html,
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.45 "Inter", system-ui, sans-serif;
  overflow-x: clip;
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

a {
  color: inherit;
}

:focus-visible {
  outline: 3px solid #ffffff;
  outline-offset: 2px;
  box-shadow: 0 0 0 7px #000000;
}

.skip-link {
  position: fixed;
  top: 8px;
  left: 8px;
  z-index: 100;
  display: inline-flex;
  align-items: center;
  min-height: 48px;
  padding: 0 18px;
  background: var(--ink);
  color: #000000;
  font-weight: 700;
  text-decoration: none;
}

.skip-link:not(:focus):not(:focus-visible) {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

.wrap {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-left: max(var(--pad-x), env(safe-area-inset-left, 0px));
  padding-right: max(var(--pad-x), env(safe-area-inset-right, 0px));
}

.site-header {
  border-bottom: 1px solid var(--rule);
  background: #000000;
}

.bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-block: 6px;
}

.home-link {
  display: inline-flex;
  align-items: center;
  gap: 0;
  min-height: 48px;
  min-width: 48px;
  padding: 8px 12px;
  margin-left: -12px;
  font: 400 22px/1 "Anton", Impact, sans-serif;
  letter-spacing: 0.02em;
  text-decoration: none;
}

.home-link b,
h1 b {
  color: var(--red);
  font-weight: 400;
}

.home-link:hover {
  background: var(--panel);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.route-tag {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--dim);
  border: 1px solid var(--rule);
  padding: 4px 8px;
}

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-block: clamp(12px, 2.5vh, 24px);
}

.runner-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.hud-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
}

h1 {
  margin: 0;
  font: 400 clamp(28px, 5vw, 42px)/1 "Anton", Impact, sans-serif;
  letter-spacing: 0.02em;
}

.scoreboard {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 10px;
  background: var(--panel);
  border: 1px solid var(--rule);
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.chip-state {
  border-color: var(--ink);
}

.live-status {
  margin: 0;
  padding: 8px 12px;
  background: var(--panel);
  border-left: 3px solid var(--red);
  color: var(--dim);
  font-size: 14px;
}

.stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: clamp(290px, 52dvh, 460px);
  background: #050505;
  border: 2px solid var(--rule);
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  cursor: pointer;
}

.stage:hover {
  border-color: #46413b;
}

.canvas-frame {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
}

#runner {
  display: block;
  width: 100%;
  height: auto;
  max-height: 380px;
  aspect-ratio: 680 / 360;
}

.tap-deck {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 56px;
  padding: 10px 14px;
  border-top: 1px dashed var(--rule);
  background: var(--panel);
  color: var(--dim);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-align: center;
}

.tap-glyph {
  color: var(--red);
  font-size: 14px;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(0, 0, 0, 0.86);
}

.overlay[hidden],
.mercy-bar[hidden] {
  display: none !important;
}

.overlay-card {
  width: 100%;
  max-width: 440px;
  padding: 20px;
  background: #000000;
  border: 2px solid var(--ink);
  text-align: center;
}

.pause-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 4px 10px;
  border: 1px solid var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.pause-msg {
  margin: 0;
  font: 400 clamp(20px, 4.5vw, 28px)/1.15 "Anton", Impact, sans-serif;
  letter-spacing: 0.03em;
}

.win-card {
  border-color: var(--ink);
  box-shadow: 0 0 0 4px var(--red-bg);
}

.win-kicker {
  margin: 0 0 6px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--ink);
}

.win-title {
  margin: 0 0 8px;
  font: 400 clamp(28px, 6vw, 40px)/1.05 "Anton", Impact, sans-serif;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.win-sub {
  margin: 0 0 16px;
  font-size: 15px;
  color: var(--dim);
}

.win-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
}

.btn-primary,
.btn-secondary,
.btn-mercy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  min-width: 48px;
  padding: 12px 22px;
  font: 700 16px/1.1 "Inter", system-ui, sans-serif;
  letter-spacing: 0.04em;
  text-decoration: none;
  cursor: pointer;
}

.btn-primary {
  background: var(--red-bg);
  color: #ffffff;
  border: 2px solid #ffffff;
  font-family: "Anton", Impact, sans-serif;
  font-weight: 400;
  font-size: 22px;
  letter-spacing: 0.04em;
}

.btn-primary:hover {
  background: var(--ink);
  color: #000000;
}

.btn-secondary {
  background: #000000;
  color: var(--ink);
  border: 2px solid var(--ink);
}

.btn-secondary:hover {
  background: var(--ink);
  color: #000000;
}

.mercy-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 12px 14px;
  background: var(--panel);
  border: 2px solid var(--ink);
}

.mercy-label {
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
}

.btn-mercy {
  background: var(--ink);
  color: #000000;
  border: 2px solid var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.btn-mercy:hover {
  background: var(--red-bg);
  color: #ffffff;
  border-color: #ffffff;
  text-decoration: none;
}

@media (max-width: 520px) {
  .scoreboard {
    width: 100%;
  }

  .chip {
    font-size: 12px;
    padding: 4px 8px;
  }

  .mercy-bar {
    justify-content: center;
    text-align: center;
  }

  .btn-mercy,
  .btn-primary,
  .btn-secondary {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
