:root {
  --bg: #080405;
  --bg-raised: #160708;
  --panel: rgba(10, 3, 4, 0.78);
  --red: #e3122f;
  --red-hot: #ff334d;
  --red-deep: #5c0713;
  --text: #fff0ed;
  --muted: #c59a95;
  --line: rgba(255, 240, 237, 0.14);
  --safe-top: max(12px, env(safe-area-inset-top));
  --safe-right: max(14px, env(safe-area-inset-right));
  --safe-bottom: max(14px, env(safe-area-inset-bottom));
  --safe-left: max(14px, env(safe-area-inset-left));
  --display: Impact, Haettenschweiler, "Arial Narrow Bold", "Arial Black", sans-serif;
  --body: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  overscroll-behavior: none;
  background: var(--bg);
  color: var(--text);
}

body {
  font-family: var(--display);
  background:
    radial-gradient(circle at 14% 18%, rgba(227, 18, 47, 0.22), transparent 36%),
    radial-gradient(circle at 84% 16%, rgba(255, 51, 77, 0.12), transparent 31%),
    linear-gradient(138deg, #050102 0%, #160609 49%, #050102 100%);
}

body.is-playing {
  position: fixed;
  inset: 0;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

button,
a {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button {
  color: inherit;
}

button:focus-visible,
a:focus-visible,
[role="application"]:focus-visible {
  outline: 3px solid var(--text);
  outline-offset: 4px;
}

[hidden] {
  display: none !important;
}

.app-shell {
  width: 100%;
  min-height: 100svh;
}

.intro-screen {
  position: relative;
  width: 100%;
  min-height: 100svh;
  padding: max(34px, env(safe-area-inset-top)) clamp(28px, 4vw, 58px) max(24px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: minmax(0, 700px);
  align-content: center;
  gap: clamp(20px, 3vh, 34px);
  overflow: hidden;
}

.intro-screen::before {
  content: "BULL&DOG";
  position: absolute;
  right: -3vw;
  bottom: -3vw;
  z-index: 0;
  color: rgba(227, 18, 47, 0.065);
  font-size: clamp(120px, 19vw, 300px);
  line-height: 0.72;
  transform: skewX(-12deg);
  pointer-events: none;
}

.intro-copy,
.dog-picker,
.intro-actions,
.legal-links {
  position: relative;
  z-index: 1;
}

.kicker {
  margin: 0;
  color: var(--red);
  font-size: clamp(14px, 1.6vw, 22px);
  font-weight: 900;
  letter-spacing: 0.34em;
  text-transform: uppercase;
  transform: skewX(-11deg);
  text-shadow: 0 0 24px rgba(227, 18, 47, 0.46);
}

.intro-title {
  margin: 12px 0 0;
  color: var(--red);
  font-size: clamp(116px, 16vw, 230px);
  font-weight: 900;
  line-height: 0.68;
  text-transform: uppercase;
  transform: skewX(-12deg);
  text-shadow: 8px 7px 0 #160204, 0 0 52px rgba(227, 18, 47, 0.42);
}

.intro-title span {
  display: block;
  white-space: nowrap;
}

.intro-lead {
  max-width: 620px;
  margin: 18px 0 0;
  color: rgba(255, 240, 237, 0.76);
  font-size: clamp(20px, 2.1vw, 31px);
  font-weight: 900;
  line-height: 1.04;
  text-transform: uppercase;
  transform: skewX(-9deg);
}

.dog-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.dog-card {
  min-width: 146px;
  min-height: 84px;
  padding: 12px 16px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.035);
  display: grid;
  grid-template-columns: 48px 1fr;
  grid-template-rows: auto auto;
  align-items: center;
  column-gap: 10px;
  text-align: left;
  cursor: pointer;
  transform: skewX(-8deg);
  transition: background 140ms ease, border-color 140ms ease, transform 140ms ease;
}

.dog-card:hover,
.dog-card.is-active {
  border-color: rgba(255, 51, 77, 0.62);
  background: rgba(227, 18, 47, 0.17);
  transform: skewX(-8deg) translateY(-3px);
}

.dog-card img {
  grid-row: 1 / 3;
  width: 58px;
  height: 50px;
  object-fit: contain;
  image-rendering: pixelated;
}

.dog-card__name {
  font-size: 24px;
  line-height: 1;
  text-transform: uppercase;
}

.dog-card__trait {
  color: var(--muted);
  font: 750 12px/1.1 var(--body);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.intro-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px 24px;
}

.primary-button,
.secondary-button {
  min-height: 58px;
  border: 0;
  padding: 0 28px;
  font-size: clamp(20px, 2vw, 28px);
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transform: skewX(-10deg);
  cursor: pointer;
}

.primary-button {
  background: var(--red);
  color: white;
  box-shadow: 6px 6px 0 #39040a;
}

.primary-button:active {
  transform: skewX(-10deg) translate(3px, 3px);
  box-shadow: 3px 3px 0 #39040a;
}

.secondary-button {
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
}

.control-hint {
  max-width: 420px;
  margin: 0;
  color: rgba(255, 240, 237, 0.58);
  font: 750 14px/1.35 var(--body);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.control-hint strong {
  color: var(--text);
}

.legal-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font: 700 12px/1.2 var(--body);
  text-transform: uppercase;
}

.legal-links a {
  color: rgba(255, 240, 237, 0.48);
  text-underline-offset: 3px;
}

.game-screen,
.game-wrap {
  width: 100%;
  height: 100svh;
  min-height: 100svh;
  overflow: hidden;
}

.game-wrap {
  position: relative;
  isolation: isolate;
  background: #0b0506;
  touch-action: none;
}

.game-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  opacity: 0.24;
  background: repeating-linear-gradient(0deg, transparent 0 3px, rgba(255, 255, 255, 0.025) 3px 4px);
  mix-blend-mode: screen;
}

canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
}

.hud {
  position: absolute;
  z-index: 5;
  top: var(--safe-top);
  left: var(--safe-left);
  display: flex;
  align-items: stretch;
  gap: 6px;
  pointer-events: none;
}

.hud-stat {
  min-width: 86px;
  padding: 9px 12px 10px;
  background: rgba(7, 2, 3, 0.64);
  border-top: 1px solid rgba(255, 51, 77, 0.42);
  backdrop-filter: blur(10px);
  transform: skewX(-9deg);
}

.hud-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.14em;
  line-height: 1;
  text-transform: uppercase;
}

.hud-stat strong {
  display: block;
  margin-top: 4px;
  font-size: clamp(24px, 4vw, 34px);
  line-height: 0.92;
  text-transform: uppercase;
}

.combo-chip {
  align-self: center;
  margin-left: 4px;
  padding: 8px 10px;
  background: var(--red);
  color: white;
  font-size: 24px;
  transform: skewX(-9deg);
}

.pause-button {
  position: absolute;
  z-index: 6;
  top: var(--safe-top);
  right: var(--safe-right);
  min-width: 64px;
  min-height: 44px;
  border: 1px solid rgba(255, 240, 237, 0.2);
  background: rgba(7, 2, 3, 0.66);
  color: var(--text);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  backdrop-filter: blur(10px);
  cursor: pointer;
}

.attack-alert {
  position: absolute;
  z-index: 5;
  top: calc(var(--safe-top) + 76px);
  left: 50%;
  min-width: 148px;
  padding: 8px 12px;
  background: rgba(227, 18, 47, 0.92);
  color: white;
  text-align: center;
  text-transform: uppercase;
  transform: translateX(-50%) skewX(-9deg);
  box-shadow: 0 0 28px rgba(227, 18, 47, 0.44);
  pointer-events: none;
}

.attack-alert span {
  display: block;
  font-size: 11px;
  letter-spacing: 0.14em;
}

.attack-alert strong {
  display: block;
  font-size: 28px;
  line-height: 0.95;
}

.touch-controls {
  position: absolute;
  z-index: 6;
  left: var(--safe-left);
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  display: none;
  align-items: end;
  justify-content: space-between;
  pointer-events: none;
}

.joystick-zone {
  position: relative;
  width: 166px;
  height: 166px;
  display: grid;
  place-items: center;
  touch-action: none;
  pointer-events: auto;
  cursor: grab;
}

.joystick-zone.is-active {
  cursor: grabbing;
}

.joystick-track {
  position: relative;
  width: 140px;
  height: 140px;
  border: 2px solid rgba(255, 240, 237, 0.42);
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 240, 237, 0.035) 0 44%, rgba(8, 2, 3, 0.74) 45% 100%);
  box-shadow:
    inset 0 0 38px rgba(227, 18, 47, 0.16),
    0 0 0 8px rgba(227, 18, 47, 0.08),
    0 0 0 10px rgba(255, 240, 237, 0.11),
    0 0 30px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.joystick-track::before,
.joystick-track::after {
  content: "";
  position: absolute;
  background: rgba(255, 240, 237, 0.13);
  pointer-events: none;
}

.joystick-track::before {
  top: 18px;
  bottom: 18px;
  left: calc(50% - 1px);
  width: 2px;
}

.joystick-track::after {
  left: 18px;
  right: 18px;
  top: calc(50% - 1px);
  height: 2px;
}

.joystick-arrow {
  position: absolute;
  z-index: 2;
  width: 17px;
  height: 17px;
  opacity: 0.56;
  filter: brightness(0) invert(1);
  image-rendering: pixelated;
  pointer-events: none;
}

.joystick-arrow--up {
  top: 5px;
  left: calc(50% - 8px);
}

.joystick-arrow--right {
  top: calc(50% - 8px);
  right: 5px;
}

.joystick-arrow--down {
  bottom: 5px;
  left: calc(50% - 8px);
}

.joystick-arrow--left {
  top: calc(50% - 8px);
  left: 5px;
}

.joystick-knob {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 3;
  width: 68px;
  height: 68px;
  border: 3px solid rgba(255, 240, 237, 0.78);
  border-radius: 50%;
  background: radial-gradient(circle at 38% 32%, rgba(255, 240, 237, 0.23), rgba(68, 35, 38, 0.84) 54%, rgba(12, 4, 5, 0.95) 100%);
  box-shadow:
    inset 0 0 0 4px rgba(8, 2, 3, 0.48),
    0 0 0 8px rgba(227, 18, 47, 0.13),
    0 0 30px rgba(227, 18, 47, 0.28);
  transform: translate(-50%, -50%);
  will-change: transform;
  pointer-events: none;
}

.joystick-label {
  position: absolute;
  bottom: 0;
  color: rgba(255, 240, 237, 0.5);
  font: 800 10px/1 var(--body);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  pointer-events: none;
}

.dash-button {
  --dash-ring-color: rgba(255, 240, 237, 0.92);
  position: relative;
  isolation: isolate;
  width: 136px;
  min-height: 136px;
  padding: 20px 14px 22px;
  border: 3px solid rgba(255, 240, 237, 0.86);
  border-radius: 50%;
  background: radial-gradient(circle at 42% 35%, #ff334d 0, #e3122f 46%, #8f0719 100%);
  color: white;
  display: grid;
  place-content: center;
  gap: 1px;
  text-align: center;
  text-transform: uppercase;
  box-shadow:
    inset 0 0 0 5px rgba(79, 3, 14, 0.5),
    0 0 0 8px rgba(227, 18, 47, 0.13),
    0 0 44px rgba(227, 18, 47, 0.42),
    6px 6px 0 #39040a;
  touch-action: none;
  pointer-events: auto;
  cursor: pointer;
  transform: rotate(-4deg);
}

.dash-button::before {
  content: "";
  position: absolute;
  z-index: -2;
  inset: -13px;
  border-radius: 50%;
  background: repeating-conic-gradient(from -90deg, var(--dash-ring-color) 0 8deg, transparent 8deg 14deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 8px), #000 calc(100% - 7px));
  filter: drop-shadow(0 0 7px rgba(255, 51, 77, 0.42));
}

.dash-button::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 9px;
  border: 1px solid rgba(255, 240, 237, 0.34);
  border-radius: 50%;
  pointer-events: none;
}

.dash-button > * {
  position: relative;
  z-index: 1;
}

.dash-button:active,
.dash-button.is-active {
  transform: rotate(-4deg) translate(3px, 3px) scale(0.97);
  box-shadow: 0 0 0 6px rgba(255, 240, 237, 0.12), 0 0 44px rgba(255, 51, 77, 0.56), 3px 3px 0 #39040a;
}

.dash-button.is-cooling {
  --dash-ring-color: rgba(255, 240, 237, 0.2);
  background: rgba(36, 10, 13, 0.9);
  border-color: rgba(255, 240, 237, 0.22);
  color: rgba(255, 240, 237, 0.56);
  box-shadow: 0 0 0 8px rgba(227, 18, 47, 0.07), 4px 4px 0 #240207;
}

.dash-button__arrows {
  display: flex;
  justify-content: center;
  width: 52px;
  height: 30px;
  margin: -8px auto -1px;
}

.dash-button__arrows img {
  width: 30px;
  height: 30px;
  margin-left: -11px;
  image-rendering: pixelated;
  filter: brightness(0) invert(1);
}

.dash-button__arrows img:first-child {
  margin-left: 0;
  opacity: 0.64;
}

.dash-button strong {
  font-size: 21px;
  line-height: 1;
  letter-spacing: 0.04em;
}

.dash-button__status {
  font: 900 10px/1.2 var(--body);
  letter-spacing: 0.11em;
}

.dash-meter {
  position: absolute;
  left: 22px;
  right: 22px;
  bottom: 14px;
  height: 4px;
  overflow: hidden;
  background: rgba(5, 1, 2, 0.46);
}

.dash-meter span {
  display: block;
  width: 100%;
  height: 100%;
  background: white;
  transform-origin: left;
  transform: scaleX(1);
}

.keyboard-hint {
  position: absolute;
  z-index: 5;
  right: var(--safe-right);
  bottom: var(--safe-bottom);
  margin: 0;
  color: rgba(255, 240, 237, 0.5);
  font: 800 12px/1.3 var(--body);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  pointer-events: none;
}

.countdown {
  position: absolute;
  z-index: 7;
  top: 50%;
  left: 50%;
  color: var(--text);
  font-size: clamp(112px, 25vw, 240px);
  line-height: 0.7;
  transform: translate(-50%, -50%) skewX(-11deg);
  text-shadow: 8px 7px 0 var(--red-deep), 0 0 44px rgba(227, 18, 47, 0.65);
  pointer-events: none;
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 12;
  padding: var(--safe-top) var(--safe-right) var(--safe-bottom) var(--safe-left);
  display: grid;
  place-items: center;
  background: rgba(5, 1, 2, 0.72);
  backdrop-filter: blur(12px);
}

.modal {
  width: min(620px, 100%);
  display: grid;
  justify-items: start;
  gap: 16px;
  padding: clamp(24px, 6vw, 56px);
  background: rgba(11, 4, 5, 0.84);
  border-top: 2px solid var(--red);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.52);
}

.modal h2 {
  margin: 0;
  color: var(--red);
  font-size: clamp(72px, 18vw, 176px);
  line-height: 0.72;
  text-transform: uppercase;
  transform: skewX(-11deg);
  text-shadow: 6px 5px 0 #150205, 0 0 38px rgba(227, 18, 47, 0.42);
}

.modal p:not(.kicker) {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  font: 750 17px/1.35 var(--body);
}

.modal .primary-button,
.modal .secondary-button {
  width: min(320px, 100%);
}

.result-line {
  color: var(--text) !important;
  font-size: 21px !important;
  font-weight: 850 !important;
}

.result-detail {
  font-size: 14px !important;
  text-transform: uppercase;
}

.rotate-notice {
  display: none;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

@media (max-width: 900px), (hover: none) and (pointer: coarse) {
  .game-screen,
  .game-wrap {
    height: 100dvh;
    min-height: 100dvh;
  }

  .touch-controls {
    display: flex;
  }

  .keyboard-hint {
    display: none;
  }

}

@media (max-width: 600px) {
  .intro-screen {
    align-content: center;
    padding-left: 24px;
    padding-right: 24px;
    gap: 18px;
  }

  .intro-screen::before {
    display: none;
  }

  .intro-title {
    margin-top: 10px;
    font-size: clamp(104px, 33vw, 148px);
  }

  .intro-lead {
    margin-top: 14px;
    font-size: clamp(18px, 5.5vw, 23px);
  }

  .dog-picker {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 7px;
  }

  .dog-card {
    min-width: 0;
    min-height: 92px;
    padding: 9px 5px;
    grid-template-columns: 1fr;
    grid-template-rows: 44px auto auto;
    justify-items: center;
    text-align: center;
  }

  .dog-card img {
    grid-row: auto;
    width: 54px;
    height: 44px;
    object-fit: contain;
  }

  .dog-card__name {
    font-size: 18px;
  }

  .dog-card__trait {
    font-size: 9px;
  }

  .intro-actions {
    align-items: stretch;
    gap: 14px;
  }

  .primary-button {
    width: 100%;
  }

  .control-hint {
    font-size: 12px;
  }

  .legal-links {
    gap: 10px;
    font-size: 10px;
  }

  .hud {
    right: 74px;
    gap: 4px;
  }

  .hud-stat {
    min-width: 67px;
    padding: 7px 8px 8px;
  }

  .hud-stat span {
    font-size: 9px;
  }

  .hud-stat strong {
    font-size: 22px;
  }

  .hud-stat--dog {
    min-width: 82px;
  }

  .combo-chip {
    position: absolute;
    top: 62px;
    left: 0;
    font-size: 18px;
  }

  .pause-button {
    min-width: 58px;
    min-height: 40px;
    font-size: 9px;
  }

  .attack-alert {
    top: calc(var(--safe-top) + 64px);
  }

  .touch-controls {
    align-items: flex-end;
  }

  .joystick-zone {
    width: 158px;
    height: 158px;
  }

  .joystick-track {
    width: 134px;
    height: 134px;
  }

  .dash-button {
    width: 128px;
    min-height: 128px;
  }

  .modal {
    min-height: 100%;
    align-content: center;
    background: transparent;
    border: 0;
    box-shadow: none;
  }

  .modal h2 {
    font-size: clamp(76px, 25vw, 112px);
  }
}

@media (max-width: 370px) {
  .joystick-zone {
    width: 138px;
    height: 138px;
  }

  .joystick-track {
    width: 116px;
    height: 116px;
  }

  .dash-button {
    width: 112px;
    min-height: 112px;
  }
}

@media (max-height: 720px) and (max-width: 900px) {
  .intro-screen {
    gap: 12px;
    padding-top: max(16px, env(safe-area-inset-top));
    padding-bottom: max(14px, env(safe-area-inset-bottom));
  }

  .intro-title {
    font-size: clamp(88px, 28vw, 124px);
  }

  .intro-lead {
    font-size: 17px;
  }

  .dog-card {
    min-height: 78px;
  }

  .legal-links {
    display: none;
  }

  .joystick-zone {
    width: 130px;
    height: 130px;
  }

  .joystick-track {
    width: 108px;
    height: 108px;
  }

  .dash-button {
    width: 108px;
    min-height: 108px;
  }
}

@media (orientation: landscape) and (max-height: 520px) {
  .rotate-notice {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: grid;
    place-content: center;
    gap: 8px;
    padding: 24px;
    background: rgba(8, 4, 5, 0.96);
    text-align: center;
    text-transform: uppercase;
  }

  .rotate-notice strong {
    color: var(--red);
    font-size: clamp(38px, 9vw, 72px);
    transform: skewX(-10deg);
  }

  .rotate-notice span {
    color: var(--muted);
    font: 800 13px/1.3 var(--body);
    letter-spacing: 0.08em;
  }
}

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

  .game-wrap::after {
    display: none;
  }
}

/* The game's poster language uses one consistent forward-leaning voice. */
.app-shell,
.app-shell * {
  font-style: italic;
  font-synthesis: style;
}
