@font-face {
  font-family: "Bebas Neue";
  src: url("./assets/BebasNeue-Regular.ttf") format("truetype");
  font-display: swap;
}

:root {
  --ob-cream: #f6eee4;
  --ob-cream-deep: #efe1cb;
  --ob-red: #f23838;
  --ob-red-deep: #d62828;
  --ob-navy: #10285f;
  --ob-navy-soft: #415e98;
  --ob-ink: #171a22;
  --ob-muted: #61708a;
  --ob-line: rgba(16, 40, 95, 0.12);
  --ob-white: #fffdfa;
  --ob-gold: #f2b233;
  --ob-shadow: 0 26px 80px rgba(16, 40, 95, 0.18);
  --ob-success: #0f7a43;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(242, 56, 56, 0.16), transparent 24%),
    radial-gradient(circle at 88% 8%, rgba(242, 178, 51, 0.18), transparent 22%),
    linear-gradient(180deg, var(--ob-cream) 0%, var(--ob-cream-deep) 100%);
  color: var(--ob-ink);
  font-family: "Helvetica Neue", Arial, sans-serif;
}

a {
  color: inherit;
}

.game-page {
  padding: 2rem 1rem 2.5rem;
}

.game-shell {
  width: min(1200px, 100%);
  margin: 0 auto;
}

.game-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

.game-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.9rem;
  text-decoration: none;
  color: var(--ob-navy);
}

.game-brand img {
  width: 3.2rem;
  height: 3.2rem;
  object-fit: contain;
}

.game-brand span {
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.04em;
}

.game-nav {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem 1.35rem;
  color: var(--ob-navy);
  font-size: 0.84rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.game-nav a {
  text-decoration: none;
  border-bottom: 1px solid transparent;
}

.game-nav a:hover {
  border-bottom-color: currentColor;
}

.poster-copy {
  max-width: 44rem;
  margin-bottom: 1.6rem;
}

.eyebrow,
.overlay-kicker {
  margin: 0 0 0.65rem;
  color: var(--ob-red-deep);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.poster-copy h1,
.overlay-card h2,
.panel-head h2 {
  margin: 0;
  color: var(--ob-navy);
  font-family: "Bebas Neue", sans-serif;
  font-weight: 400;
  line-height: 0.94;
  letter-spacing: 0.02em;
}

.poster-copy h1 {
  max-width: none;
  white-space: nowrap;
  font-size: clamp(3.9rem, 6.15vw, 5.95rem);
}

.lede,
#overlay-copy {
  margin: 0.85rem 0 0;
  color: var(--ob-muted);
  font-size: 1.05rem;
  line-height: 1.7;
}

.poster-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
  margin-top: 1rem;
}

.poster-pills span,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 2.3rem;
  padding: 0.45rem 0.85rem;
  border: 1px solid rgba(16, 40, 95, 0.12);
  border-radius: 999px;
  background: rgba(255, 253, 249, 0.55);
  color: var(--ob-navy);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-pill.active {
  background: rgba(242, 178, 51, 0.18);
  color: #80510d;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.75fr) minmax(290px, 0.95fr);
  gap: 1.1rem;
  align-items: start;
}

.game-card,
.leaderboard-card,
.info-card {
  border: 1px solid var(--ob-line);
  border-radius: 2rem;
  background: rgba(255, 253, 249, 0.7);
  box-shadow: var(--ob-shadow);
  backdrop-filter: blur(8px);
}

.game-card {
  padding: 1rem;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.hud-left,
.hud-right {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.hud-group {
  display: flex;
  align-items: baseline;
  gap: 0.55rem;
}

.hud-label {
  color: var(--ob-muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.hud strong {
  color: var(--ob-navy);
  font-family: "Bebas Neue", sans-serif;
  font-size: 2.1rem;
  font-weight: 400;
  letter-spacing: 0.05em;
}

.hud-button,
.start-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 3rem;
  padding: 0.85rem 1.2rem;
  border: 0;
  border-radius: 999px;
  background: var(--ob-red);
  color: var(--ob-white);
  cursor: pointer;
  font-weight: 800;
  letter-spacing: 0.03em;
  box-shadow: 0 14px 34px rgba(242, 56, 56, 0.26);
}

.hud-button:hover,
.start-button:hover {
  background: var(--ob-red-deep);
}

.canvas-wrap {
  position: relative;
  overflow: hidden;
  border-radius: 1.6rem;
  border: 1px solid rgba(16, 40, 95, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 248, 236, 0.76), rgba(255, 252, 247, 0.3));
  touch-action: none;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
}

.mobile-controls {
  display: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(246, 238, 228, 0.28);
}

.overlay.hidden,
.hidden {
  display: none;
}

.overlay-card {
  width: min(100%, 28rem);
  max-height: calc(100% - 0.4rem);
  padding: 1.2rem;
  border: 1px solid rgba(16, 40, 95, 0.12);
  border-radius: 1.5rem;
  background: rgba(255, 253, 249, 0.92);
  text-align: center;
  box-shadow: 0 24px 60px rgba(16, 40, 95, 0.14);
  overflow: auto;
}

.overlay-card h2 {
  max-width: 11ch;
  margin-inline: auto;
  font-size: clamp(2rem, 5vw, 3.2rem);
}

.overlay-kicker.game-over-kicker {
  margin-bottom: 0.35rem;
}

.overlay-card h2.overlay-title-inline {
  width: 100%;
  max-width: none;
  margin-inline: 0;
  white-space: nowrap;
  text-align: center;
  font-size: clamp(1.08rem, 2.05vw, 1.68rem) !important;
  letter-spacing: 0;
}

.overlay.is-game-over .overlay-card {
  width: min(100%, 26rem);
  padding: 1rem;
}

.overlay.is-game-over .overlay-card h2 {
  font-size: clamp(1.9rem, 4vw, 2.8rem);
}

.overlay-actions {
  display: flex;
  justify-content: center;
  margin-top: 1rem;
}

.score-form {
  margin-top: 1rem;
  text-align: left;
}

.score-form label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--ob-navy);
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.score-form-row {
  display: flex;
  gap: 0.6rem;
}

.score-form input {
  width: 100%;
  min-height: 3rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid rgba(16, 40, 95, 0.18);
  border-radius: 999px;
  background: var(--ob-white);
  color: var(--ob-navy);
  font: inherit;
}

.score-form input:disabled,
.start-button:disabled,
.jump-button:disabled {
  cursor: progress;
  opacity: 0.72;
}

.score-form input:focus {
  outline: 2px solid rgba(16, 40, 95, 0.12);
  border-color: rgba(16, 40, 95, 0.34);
}

.form-message {
  min-height: 1.3rem;
  margin: 0.55rem 0 0;
  color: var(--ob-muted);
  font-size: 0.9rem;
}

.form-message.is-error {
  color: var(--ob-red-deep);
}

.form-message.is-success {
  color: var(--ob-success);
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 0.9rem 1.15rem;
  align-items: center;
  margin-top: 1rem;
  padding: 0 0.15rem 0.2rem;
  color: var(--ob-navy);
  font-size: 0.84rem;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.legend-dot {
  width: 0.8rem;
  height: 0.8rem;
  border-radius: 50%;
}

.dot-runner {
  background: var(--ob-red);
}

.dot-obstacle {
  background: #8a5a26;
}

.dot-boost {
  background: var(--ob-gold);
}

.dot-skyline {
  background: var(--ob-navy);
}

.side-panel {
  display: grid;
  gap: 1rem;
}

.leaderboard-card,
.info-card {
  padding: 1.1rem 1.1rem 1rem;
}

.panel-head h2 {
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.leaderboard-list {
  margin: 1rem 0 0;
  padding: 0;
  list-style: none;
}

.leaderboard-list li {
  display: grid;
  grid-template-columns: 2.1rem 1fr auto;
  align-items: center;
  gap: 0.8rem;
  padding: 0.75rem 0;
  border-bottom: 1px solid rgba(16, 40, 95, 0.09);
}

.leaderboard-list li:last-child {
  border-bottom: 0;
}

.leaderboard-rank {
  color: var(--ob-red-deep);
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.55rem;
  letter-spacing: 0.05em;
}

.leaderboard-name {
  color: var(--ob-navy);
  font-weight: 800;
}

.leaderboard-meta {
  display: block;
  margin-top: 0.2rem;
  color: var(--ob-muted);
  font-size: 0.8rem;
  font-weight: 600;
}

.leaderboard-score {
  color: var(--ob-navy);
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.7rem;
  letter-spacing: 0.05em;
}

.leaderboard-empty {
  display: block;
  padding: 0.25rem 0 0.1rem;
  color: var(--ob-muted);
  border-bottom: 0;
}

.leaderboard-rank.rank-1 { color: #b8892a; }
.leaderboard-rank.rank-2 { color: #7a8fa8; }
.leaderboard-rank.rank-3 { color: #8a5a26; }

.leaderboard-list li.rank-1 .leaderboard-name { color: #7d5a10; }

.personal-best-banner {
  margin: 0.6rem 0 0;
  padding: 0.45rem 0.85rem;
  border-radius: 999px;
  background: rgba(242, 178, 51, 0.18);
  color: #6e4c0a;
  font-size: 0.82rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.info-list {
  margin: 1rem 0 0;
  padding-left: 1rem;
  color: var(--ob-navy);
  line-height: 1.65;
}

.info-list li + li {
  margin-top: 0.45rem;
}

.page-footer {
  padding: 0 1rem 2rem;
}

.footer-inner {
  width: min(1200px, 100%);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  color: var(--ob-navy);
  font-size: 0.9rem;
  font-weight: 700;
}

.footer-inner img {
  width: 2.5rem;
  height: 2.5rem;
  object-fit: contain;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 9999;
}

@media (max-width: 1024px) {
  .game-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .game-page {
    padding: 1rem 0.75rem 2rem;
  }

  .game-topbar,
  .hud,
  .hud-left,
  .hud-right,
  .score-form-row,
  .footer-inner {
    flex-direction: column;
    align-items: stretch;
  }

  .game-nav {
    gap: 0.75rem 1rem;
  }

  .poster-copy h1 {
    font-size: clamp(3rem, 14vw, 4.7rem);
    white-space: normal;
  }

  .lede,
  #overlay-copy {
    font-size: 0.98rem;
  }

  .game-card,
  .leaderboard-card,
  .info-card {
    border-radius: 1.45rem;
  }

  .game-card {
    padding: 0.85rem;
  }

  .hud {
    margin-bottom: 0.65rem;
  }

  .hud strong {
    font-size: 2.45rem;
  }

  .status-pill,
  .hud-button {
    width: 100%;
    justify-content: center;
  }

  .canvas-wrap {
    border-radius: 1.1rem;
  }

  .mobile-controls {
    display: block;
    margin-top: 0.75rem;
  }

  .jump-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 3.5rem;
    padding: 0.95rem 1.2rem;
    border: 0;
    border-radius: 1.1rem;
    background: var(--ob-navy);
    color: var(--ob-white);
    font: inherit;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    box-shadow: 0 18px 34px rgba(16, 40, 95, 0.22);
    touch-action: manipulation;
  }

  .overlay {
    padding: 0.65rem;
  }

  .overlay-card {
    max-height: calc(100% - 0.2rem);
    padding: 0.9rem 0.85rem 1rem;
    border-radius: 1rem;
  }

  .overlay-card h2 {
    font-size: clamp(1.7rem, 8vw, 2.5rem);
  }

  .overlay-card h2.overlay-title-inline {
    white-space: normal;
    font-size: clamp(1.05rem, 4.8vw, 1.35rem) !important;
  }

  .score-form {
    text-align: left;
  }

  .score-form input,
  .start-button,
  .score-form-row .start-button {
    width: 100%;
  }

  .overlay-actions {
    margin-top: 0.8rem;
  }

  .leaderboard-list li {
    grid-template-columns: 1.6rem minmax(0, 1fr) auto;
    gap: 0.55rem;
  }

  .leaderboard-name,
  .leaderboard-score {
    word-break: break-word;
  }

  .legend {
    gap: 0.55rem 0.8rem;
    font-size: 0.74rem;
  }
}
