@font-face {
  font-family: "Gosh Poster";
  src: url("/assets/poster-font.ttf") format("truetype");
  font-display: swap;
}

:root {
  --paper: #f3edcf;
  --ink: #292c1d;
  --red: #cc2d22;
  --poster-x: clamp(22px, 3.7vw, 64px);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    radial-gradient(circle at 20% 30%, rgb(41 44 29 / 0.22) 0 0.55px, transparent 0.75px),
    radial-gradient(circle at 70% 60%, rgb(41 44 29 / 0.14) 0 0.45px, transparent 0.75px);
  background-size: 9px 11px, 13px 15px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  overflow-x: hidden;
}

.poster {
  width: 100%;
  min-height: 100svh;
  margin: 0 auto;
  padding: clamp(20px, 3vw, 58px) var(--poster-x) clamp(16px, 2vw, 34px);
  display: grid;
  grid-template-rows: auto auto minmax(330px, 1fr) auto;
}

.masthead,
footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 20px;
  border-bottom: 2px solid var(--ink);
  min-height: 44px;
}

.masthead p, footer p { margin: 0; }

.motto {
  font-size: clamp(10px, 0.94vw, 15px);
  letter-spacing: 0.08em;
  padding-block: 12px;
  touch-action: manipulation;
  user-select: none;
}

h1 {
  position: relative;
  z-index: 2;
  margin: clamp(18px, 2vw, 34px) 0 -0.03em;
  color: var(--red);
  font-family: "Gosh Poster", Impact, Haettenschweiler, "Arial Narrow Bold", sans-serif;
  font-size: clamp(95px, 17.2vw, 275px);
  font-stretch: condensed;
  font-weight: 900;
  letter-spacing: 0.015em;
  line-height: 0.8;
  text-align: center;
  white-space: nowrap;
  transform: scaleX(1.5);
  touch-action: manipulation;
  user-select: none;
}

.pit {
  position: relative;
  min-height: 330px;
  margin-inline: calc(-1 * var(--poster-x));
  overflow: hidden;
  isolation: isolate;
}

.arena {
  position: absolute;
  inset: 0;
}

#pit-canvas {
  display: block;
  width: 100%;
  height: 100%;
  position: relative;
  cursor: grab;
  touch-action: none;
  outline: none;
}

#pit-canvas:active { cursor: grabbing; }
#pit-canvas:focus-visible { box-shadow: 0 0 0 4px var(--red); }

footer {
  min-height: 75px;
  border-top: 2px solid var(--ink);
  border-bottom: 0;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  min-width: 0;
  align-items: center;
  gap: clamp(14px, 2.2vw, 28px);
  margin-right: auto;
}

.footer-link {
  min-height: 44px;
  padding: 10px 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-align: left;
  text-decoration: underline;
  text-decoration-color: var(--red);
  text-decoration-thickness: 2px;
  text-underline-offset: 5px;
  cursor: pointer;
}

.footer-link:hover { color: var(--red); }
.footer-link:focus-visible { outline: 3px solid var(--red); outline-offset: 3px; }

#sound-toggle {
  min-width: 242px;
  min-height: 52px;
  padding: 0 24px;
  border: 0;
  border-radius: 999px;
  color: var(--paper);
  background: var(--ink);
  font: inherit;
  font-size: 14px;
  letter-spacing: 0.12em;
  cursor: pointer;
}

#sound-toggle:hover { background: #3d402b; }
#sound-toggle:focus-visible { outline: 4px solid var(--red); outline-offset: 3px; }

.speaker {
  position: relative;
  display: inline-block;
  width: 15px;
  height: 16px;
  margin-right: 15px;
  vertical-align: -3px;
  background: currentColor;
  clip-path: polygon(0 32%, 35% 32%, 100% 0, 100% 100%, 35% 68%, 0 68%);
}

#sound-toggle[aria-pressed="false"] .speaker::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 7px;
  width: 11px;
  height: 2px;
  background: var(--red);
  transform: rotate(-45deg);
}

@media (max-width: 700px) {
  :root { --poster-x: 16px; }

  .poster {
    min-height: 100svh;
    padding: 14px var(--poster-x) 12px;
    grid-template-rows: auto auto minmax(380px, 1fr) auto;
  }

  .masthead { min-height: 38px; }
  .motto { font-size: 8px; }
  h1 { margin-top: 18px; font-size: clamp(68px, 23vw, 150px); line-height: 0.85; transform: scaleX(1.1); }
  .pit { min-height: 380px; }
  footer { min-height: 67px; }
  .footer-links { align-items: flex-start; flex-direction: column; gap: 2px; }
  .footer-link { max-width: 112px; padding-block: 3px; font-size: 9px; line-height: 1.45; }
  #sound-toggle { min-width: 164px; min-height: 45px; padding: 0 17px; font-size: 11px; }
}

@media (orientation: landscape) and (max-height: 500px) {
  :root {
    --landscape-top: max(8px, env(safe-area-inset-top, 0px));
    --landscape-right: max(12px, env(safe-area-inset-right, 0px));
    --landscape-bottom: max(8px, env(safe-area-inset-bottom, 0px));
    --landscape-left: max(12px, env(safe-area-inset-left, 0px));
  }

  .poster {
    height: 100dvh;
    min-height: 100svh;
    padding: var(--landscape-top) var(--landscape-right) var(--landscape-bottom) var(--landscape-left);
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    overflow: hidden;
  }

  .masthead { min-height: 30px; }
  .motto { padding-block: 6px; font-size: 8px; }

  h1 {
    margin: 8px 0 0;
    font-size: clamp(52px, 12vw, 92px);
    line-height: 0.78;
    transform: scaleX(1.12);
  }

  .pit {
    min-height: 0;
    margin-left: calc(0px - var(--landscape-left));
    margin-right: calc(0px - var(--landscape-right));
  }

  footer { min-height: 54px; }

  .footer-links { flex-direction: row; gap: 16px; }
  .footer-link { max-width: none; padding-block: 6px; }

  #sound-toggle {
    min-width: 164px;
    min-height: 44px;
    padding: 0 17px;
    font-size: 11px;
  }
}

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