@import url("https://fonts.googleapis.com/css2?family=Archivo+Black&family=IBM+Plex+Mono:wght@400;600&display=swap");

:root {
  --black: #111110;
  --grey: #777770;
  --paper: #f3f3ef;
  --line: #c9c9c1;
}

* { box-sizing: border-box; }

html, body {
  min-height: 100%;
  margin: 0;
  overflow: hidden;
  color: var(--black);
  background: var(--paper);
  font-family: "IBM Plex Mono", monospace;
}

button, a { font: inherit; }

.game-shell {
  display: grid;
  grid-template-rows: 72px 1fr 38px;
  height: 100vh;
  min-height: 560px;
  padding: 0 clamp(12px, 3vw, 44px);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid var(--black);
}

.brand {
  display: flex;
  align-items: center;
  color: var(--black);
  text-decoration: none;
}

.brand-copy {
  display: grid;
  min-width: 116px;
  border: 2px solid var(--black);
  line-height: 1;
}

.brand-copy b {
  padding: 5px 8px 4px;
  color: white;
  background: var(--black);
  font-family: "Archivo Black", sans-serif;
  font-size: 12px;
  letter-spacing: 2.5px;
}

.brand-copy small {
  padding: 4px 8px;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 2px;
}

.top-stats {
  display: flex;
  align-self: stretch;
  border-inline: 1px solid var(--line);
}

.top-stats div {
  display: grid;
  align-content: center;
  min-width: 108px;
  text-align: center;
  border-right: 1px solid var(--line);
}
.top-stats div:last-child { border: 0; }
.top-stats span { color: var(--grey); font-size: 8px; letter-spacing: 2px; }
.top-stats strong { font-size: 20px; font-weight: 600; letter-spacing: 2px; }

.text-button {
  padding: 8px 11px;
  color: var(--black);
  border: 1px solid var(--black);
  background: transparent;
  font-size: 8px;
  letter-spacing: 1px;
  cursor: pointer;
}
.text-button:hover { color: white; background: var(--black); }

.game-frame {
  position: relative;
  min-height: 0;
  margin: 12px 0 7px;
  overflow: hidden;
  border: 2px solid var(--black);
  background: #fff;
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  image-rendering: pixelated;
}

.health {
  position: absolute;
  z-index: 4;
  top: 18px;
  left: 20px;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 8px;
  letter-spacing: 2px;
  pointer-events: none;
}

#healthPips { display: flex; gap: 3px; }
#healthPips i {
  display: block;
  width: 15px;
  height: 7px;
  background: var(--black);
}
#healthPips i.off {
  border: 1px solid #aaa;
  background: white;
}

.overlay {
  position: absolute;
  z-index: 3;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,.92);
  transition: opacity .25s, visibility .25s;
}
.overlay.hidden { visibility: hidden; opacity: 0; pointer-events: none; }

.hero-mark {
  width: 113px;
  height: 79px;
  margin-bottom: 8px;
  background: var(--black);
  -webkit-mask: url("assets/felt-logo.png") center / contain no-repeat;
  mask: url("assets/felt-logo.png") center / contain no-repeat;
}

.eyebrow {
  margin: 0 0 10px;
  font-size: 9px;
  letter-spacing: 3px;
}

h1, h2 {
  margin: 0;
  font-family: "Archivo Black", sans-serif;
  font-size: clamp(50px, 7vw, 90px);
  line-height: .79;
  text-align: center;
  letter-spacing: -5px;
}
h1 em, h2 em {
  color: white;
  font-style: normal;
  -webkit-text-stroke: 2px var(--black);
}
h1 em {
  font-size: .72em;
  white-space: nowrap;
}
h2 { font-size: clamp(52px, 6vw, 78px); }

.lead {
  margin: 20px 0;
  color: #64645f;
  text-align: center;
  font-size: 11px;
  line-height: 1.6;
}

.main-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 210px;
  padding: 13px 15px 13px 19px;
  color: white;
  border: 2px solid var(--black);
  background: var(--black);
  box-shadow: 5px 5px 0 #aaa;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 2px;
  cursor: pointer;
  transition: transform .12s, box-shadow .12s;
}
.main-button b { font-size: 18px; }
.main-button:hover { transform: translate(-2px,-2px); box-shadow: 7px 7px 0 #aaa; }
.main-button:active { transform: translate(3px,3px); box-shadow: 2px 2px 0 #aaa; }

.controls {
  display: flex;
  gap: 20px;
  margin-top: 20px;
  color: #696965;
  font-size: 8px;
  letter-spacing: 1px;
}
.controls span { display: flex; align-items: center; gap: 5px; }
kbd { padding: 3px 5px; border: 1px solid #777; color: var(--black); background: white; font: inherit; }

.final-score { margin: 22px 0; color: var(--grey); font-size: 10px; letter-spacing: 3px; }
.final-score strong { color: var(--black); font-size: 23px; }

.wave-banner {
  position: absolute;
  z-index: 2;
  top: 40%;
  width: 100%;
  text-align: center;
  font-family: "Archivo Black", sans-serif;
  font-size: 28px;
  letter-spacing: 8px;
  opacity: 0;
  pointer-events: none;
}
.wave-banner.show { animation: announce 1.5s ease both; }
@keyframes announce {
  0% { opacity: 0; transform: translateY(15px); }
  18%, 72% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-15px); }
}

.paper-noise {
  position: absolute;
  z-index: 5;
  inset: 0;
  opacity: .035;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.mobile-pad {
  display: none;
  position: absolute;
  z-index: 7;
  inset: auto 12px 14px 12px;
  pointer-events: none;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.dpad {
  position: absolute;
  left: 0;
  bottom: 0;
  width: 148px;
  height: 148px;
  pointer-events: none;
}

.pad-btn,
.attack-btn {
  position: absolute;
  display: grid;
  place-items: center;
  margin: 0;
  padding: 0;
  color: #111;
  border: 2px solid #111;
  background: rgba(255, 255, 255, .82);
  box-shadow: 3px 3px 0 rgba(0, 0, 0, .18);
  font: 700 16px "IBM Plex Mono", monospace;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.pad-btn {
  width: 48px;
  height: 48px;
}

.pad-btn[data-dir="up"] { left: 50px; top: 0; }
.pad-btn[data-dir="left"] { left: 0; top: 50px; }
.pad-btn[data-dir="right"] { left: 100px; top: 50px; }
.pad-btn[data-dir="down"] { left: 50px; top: 100px; }

.attack-btn {
  right: 0;
  bottom: 18px;
  width: 78px;
  height: 78px;
  border-radius: 50%;
  font-size: 14px;
  letter-spacing: 1px;
}

.pad-btn:active,
.attack-btn:active,
.pad-btn.is-active,
.attack-btn.is-active {
  color: #fff;
  background: #111;
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 rgba(0, 0, 0, .18);
}

.mobile-hint { display: none; }

footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 8px;
  letter-spacing: 1.5px;
}
footer i {
  display: inline-block;
  width: 6px;
  height: 6px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--black);
}

@media (hover: none) and (pointer: coarse) {
  .mobile-pad.is-active { display: block; }
  .mobile-hint { display: flex; }
}

@media (max-width: 700px) {
  .game-shell { grid-template-rows: 58px 1fr 29px; padding: 0 7px; }
  .brand-copy { min-width: 93px; }
  .brand-copy b { padding: 4px 6px 3px; font-size: 9px; letter-spacing: 1.5px; }
  .brand-copy small { padding: 3px 6px; font-size: 6px; letter-spacing: 1.4px; }
  .top-stats div { min-width: 62px; }
  .top-stats div:last-child, .text-button { display: none; }
  .top-stats strong { font-size: 16px; }
  .game-frame { margin-top: 7px; }
  .hero-mark { width: 86px; height: 60px; }
  h1 { font-size: 50px; }
  .controls { max-width: 280px; flex-wrap: wrap; justify-content: center; gap: 8px 13px; }
  footer p:first-child { display: none; }
  .health { top: 14px; left: 14px; }
}
