:root {
  --bg-top: #f6b45a;
  --bg-bottom: #eb6e41;
  --frame: #311b18;
  --frame-shadow: #161113;
  --panel-border: #ffd86f;
  --panel-accent: #ff7f50;
  --text-main: #fff6d8;
  --text-soft: #ffd5a3;
  --hud-card: rgba(39, 34, 58, 0.9);
  --hud-card-border: #7ee0ff;
  --danger: #ff5d5d;
  --success: #79ff92;
  --pixel-shadow: 0 6px 0 rgba(0, 0, 0, 0.3);
  --frame-radius: 18px;
}

* {
  box-sizing: border-box;
}

.is-hidden {
  display: none !important;
}

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

body {
  font-family: 'VT323', monospace;
  color: var(--text-main);
  background:
    radial-gradient(circle at top, rgba(255, 226, 124, 0.22), transparent 28%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  overflow: hidden;
}

.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: none;
  place-items: center;
  padding: 16px;
  background: radial-gradient(circle at top, #4ca7ff 0%, #173777 45%, #110f1e 100%);
}

.loading-screen--visible {
  display: grid;
}

.loading-screen--hide {
  opacity: 0;
  transition: opacity 380ms ease;
}

.loading-screen__content {
  width: min(460px, 100%);
  border: 6px solid #ffd86f;
  box-shadow: 0 0 0 8px #1d1635, 0 16px 0 rgba(0, 0, 0, 0.35);
  background: #100f1f;
  padding: 12px;
  text-align: center;
}

.loading-screen__cover {
  width: 100%;
  max-height: 70vh;
  display: block;
  object-fit: cover;
  object-position: center top;
  border: 4px solid #20355e;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.loading-screen__title {
  margin: 12px 0 6px;
  font-family: 'Press Start 2P', monospace;
  font-size: clamp(0.7rem, 2.6vw, 1rem);
  color: #ffe38a;
}

.loading-screen__subtitle {
  margin: 0;
  color: #d5e7ff;
  font-size: clamp(1rem, 3.5vw, 1.4rem);
}

.loading-dots::after {
  content: '';
  display: inline-block;
  width: 1.2em;
  text-align: left;
  animation: loadingDots 1.1s steps(4, end) infinite;
}

@keyframes loadingDots {
  0% {
    content: '';
  }
  25% {
    content: '.';
  }
  50% {
    content: '..';
  }
  75% {
    content: '...';
  }
  100% {
    content: '';
  }
}

button,
input,
select,
textarea {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.12;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.18) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0, 0, 0, 0.14) 1px, transparent 1px);
  background-size: 5px 5px, 5px 5px;
  mix-blend-mode: overlay;
}

.game-shell {
  position: relative;
  width: min(1180px, 100%);
  display: grid;
  gap: 16px;
}

.hud {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
}

.hud__title h1,
.panel h2,
.leaderboard-box h3 {
  margin: 0;
  font-family: 'Press Start 2P', monospace;
  line-height: 1.15;
}

.hud__eyebrow,
.panel__kicker,
.stat-card__label {
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.hud__eyebrow {
  display: inline-block;
  margin-bottom: 12px;
  padding: 4px 8px;
  background: rgba(49, 27, 24, 0.9);
  border: 3px solid #ffe08a;
  box-shadow: var(--pixel-shadow);
  color: var(--text-soft);
}

.hud__stats {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.stat-card {
  min-width: 148px;
  padding: 8px 10px;
  background: var(--hud-card);
  border: 4px solid var(--hud-card-border);
  box-shadow: var(--pixel-shadow);
}

.stat-card strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  color: white;
}

.game-frame {
  position: relative;
  min-height: min(74vh, 820px);
  border: 8px solid var(--frame);
  border-radius: var(--frame-radius);
  box-shadow: 0 0 0 6px #ffd86f, 0 18px 0 var(--frame-shadow);
  overflow: hidden;
  background: linear-gradient(180deg, #87b1ff 0%, #f8c96f 52%, #ec8f44 100%);
}

.game-root {
  position: absolute;
  inset: 0;
}

.game-root canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}

.in-game-topbar {
  position: absolute;
  top: 8px;
  left: 8px;
  right: 8px;
  z-index: 6;
  display: flex;
  justify-content: space-between;
  pointer-events: none;
}

.in-game-icon-btn {
  width: 38px;
  height: 38px;
  border: 3px solid #1b1414;
  border-radius: 8px;
  background: rgba(255, 237, 182, 0.92);
  color: #241716;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.75rem;
  line-height: 1;
  box-shadow: var(--pixel-shadow);
  pointer-events: auto;
}

.in-game-icon-btn:active {
  transform: translateY(2px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.32);
}

.touch-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: none;
  justify-content: space-between;
  align-items: end;
  padding: 0 12px;
  z-index: 5;
  pointer-events: none;
}

.touch-controls__left,
.touch-controls__right {
  display: flex;
  gap: 8px;
}

.touch-btn {
  min-width: 64px;
  min-height: 64px;
  border: 4px solid #20120f;
  background: linear-gradient(180deg, #fff0b8 0%, #ffbf62 100%);
  color: #2f1812;
  box-shadow: var(--pixel-shadow);
  font-family: 'Press Start 2P', monospace;
  font-size: 0.72rem;
  pointer-events: auto;
  touch-action: none;
  user-select: none;
}

.touch-btn:active,
.touch-btn.is-pressed {
  transform: translateY(3px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.32);
}

.touch-btn--accel {
  background: linear-gradient(180deg, #b6ffbd 0%, #5ed67d 100%);
}

.touch-btn--brake {
  background: linear-gradient(180deg, #ffc1c1 0%, #ff7777 100%);
}

.meme-banner {
  position: absolute;
  left: 50%;
  top: 18px;
  transform: translateX(-50%);
  padding: 10px 18px;
  max-width: calc(100% - 32px);
  border: 4px solid #121212;
  background: #ffe87c;
  color: #331e16;
  box-shadow: var(--pixel-shadow);
  opacity: 0;
  transition: opacity 120ms ease-out;
  text-align: center;
  font-size: clamp(1.05rem, 2vw, 1.35rem);
  z-index: 4;
}

.meme-banner.is-visible {
  opacity: 1;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(26, 15, 15, 0.58);
  z-index: 3;
}

.overlay--hidden {
  display: none;
}

.panel {
  width: min(620px, 100%);
  max-height: calc(100vh - 80px);
  overflow: auto;
  padding: 24px;
  border: 6px solid var(--panel-border);
  background: linear-gradient(180deg, rgba(75, 34, 30, 0.96) 0%, rgba(37, 18, 17, 0.96) 100%);
  box-shadow: 0 0 0 6px rgba(49, 27, 24, 0.9), 0 18px 0 rgba(0, 0, 0, 0.34);
  position: relative;
  z-index: 1;
}

.panel__kicker {
  margin: 0 0 16px;
  color: var(--panel-accent);
}

.panel__text {
  margin: 18px 0;
  font-size: 1.45rem;
  color: var(--text-soft);
}

.panel__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 18px 0 24px;
}

.panel__chips span,
.panel__controls {
  border: 3px solid rgba(255, 216, 111, 0.72);
  background: rgba(255, 255, 255, 0.06);
  padding: 8px 10px;
}

.panel__controls {
  margin: 18px 0 0;
  color: var(--text-soft);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.results-grid div {
  padding: 8px;
  border: 3px solid rgba(126, 224, 255, 0.75);
  background: rgba(15, 34, 58, 0.5);
}

.results-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 1.25rem;
}

.results-grid span {
  font-size: 0.86rem;
}

.record-save {
  margin: 12px 0 16px;
  padding: 10px;
  border: 4px solid rgba(255, 216, 111, 0.62);
  background: rgba(255, 255, 255, 0.05);
}

.record-save label {
  display: block;
  margin-bottom: 8px;
  color: var(--text-soft);
}

.record-save__row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.record-save input {
  border: 4px solid #2b1a14;
  background: #fff7dc;
  color: #2b1a14;
  padding: 8px 10px;
  font-size: 1.3rem;
}

.save-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: #ffe9b5;
}

.share-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: #cfe6ff;
}

.share-status--ok {
  color: var(--success);
}

.share-status--error {
  color: #ffc7c7;
}

.save-status--ok {
  color: var(--success);
}

.save-status--error {
  color: #ffc7c7;
}

.leaderboard-box {
  margin-top: 16px;
  border: 4px solid #7ee0ff;
  background: rgba(15, 34, 58, 0.5);
  padding: 10px;
}

.leaderboard-box h3 {
  font-size: 0.85rem;
  margin-bottom: 10px;
}

.leaderboard-box--compact {
  margin-top: 10px;
}

.leaderboard-list {
  margin: 0;
  padding-left: 24px;
}

.leaderboard-list li {
  margin: 4px 0;
  color: #eff7ff;
  line-height: 1.1;
}

.leaderboard-meta {
  color: #9fd9ff;
}

.actions-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.share-bar {
  margin-top: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.home-top5 {
  margin-top: 8px;
}

.creator-credit {
  margin: 8px 0 0;
  text-align: center;
  color: rgba(255, 245, 220, 0.72);
}

.creator-credit a {
  color: rgba(190, 232, 255, 0.9);
  text-decoration: none;
}

.creator-credit a:hover {
  text-decoration: underline;
}

body.game-running #hud-section,
body.game-running #share-bar,
body.game-running #home-top5-section,
body.game-running #creator-credit {
  display: none !important;
}

.arcade-button {
  padding: 14px 20px;
  border: 4px solid #1a120f;
  background: linear-gradient(180deg, #ffee79 0%, #ff9d47 100%);
  color: #221611;
  text-transform: uppercase;
  font-family: 'Press Start 2P', monospace;
  font-size: 0.9rem;
  cursor: pointer;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.32);
}

.arcade-button--small {
  font-size: 0.66rem;
  padding: 10px 12px;
}

.arcade-button:hover {
  transform: translateY(1px);
}

.arcade-button:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.32);
}

.arcade-button--danger {
  background: linear-gradient(180deg, #ff9a9a 0%, #ff5959 100%);
}

.arcade-button--ghost {
  background: linear-gradient(180deg, #d3f0ff 0%, #85c5f3 100%);
}

@media (max-width: 900px) {
  .page-shell {
    padding: 12px;
  }

  .hud {
    align-items: stretch;
    flex-direction: column;
  }

  .game-frame {
    min-height: 72vh;
  }

  .hud__title h1,
  .panel h2 {
    font-size: 11px;
  }

  .stat-card {
    padding: 6px 8px;
  }

  .stat-card strong {
    margin-top: 6px;
    font-size: 0.95rem;
  }
}

@media (max-width: 720px) {
  body {
    font-size: 0.9rem;
  }

  .hud__eyebrow,
  .panel__kicker,
  .stat-card__label {
    letter-spacing: 0.08em;
  }

  .stat-card {
    min-width: 0;
    padding: 6px 8px;
    border-width: 3px;
  }

  .stat-card strong {
    margin-top: 3px;
    font-size: 1rem;
  }

  .stat-card__label {
    font-size: 0.55rem;
  }

  .panel {
    padding: 12px;
  }

  .panel__text {
    margin: 10px 0;
    font-size: 1.05rem;
  }

  .panel__chips span,
  .panel__controls {
    padding: 6px 8px;
    font-size: 0.9rem;
  }

  .leaderboard-box {
    padding: 8px;
  }

  .leaderboard-box h3 {
    font-size: 0.62rem;
  }

  .leaderboard-list {
    padding-left: 18px;
  }

  .leaderboard-list li {
    font-size: 0.88rem;
  }

  .record-save label,
  .save-status,
  .share-status {
    font-size: 0.9rem;
  }

  .results-grid strong {
    font-size: 1.05rem;
  }

  .results-grid span {
    font-size: 0.75rem;
  }

  .creator-credit {
    font-size: 0.68rem;
  }

  .record-save input {
    font-size: 1rem;
    padding: 6px 8px;
  }

  .arcade-button {
    padding: 8px 10px;
    font-size: 0.58rem;
    border-width: 3px;
  }

  .arcade-button--small {
    padding: 7px 9px;
    font-size: 0.54rem;
  }

  .touch-btn {
    min-width: 50px;
    min-height: 50px;
    font-size: 0.54rem;
    border-width: 3px;
  }

  .meme-banner {
    font-size: 0.92rem;
    padding: 7px 10px;
    top: 10px;
  }

  .record-save__row,
  .actions-row,
  .results-grid {
    grid-template-columns: 1fr;
  }

  .arcade-button,
  .arcade-button--small {
    width: 100%;
  }
}

@media (hover: none), (pointer: coarse) {
  .touch-controls {
    display: flex;
  }

  .game-frame {
    min-height: 78vh;
  }

  body.game-running-mobile .page-shell {
    padding: 0;
  }

  body.game-running-mobile .hud,
  body.game-running-mobile .share-bar,
  body.game-running-mobile .home-top5 {
    display: none !important;
  }

  body.game-running-mobile .game-shell {
    width: 100%;
    max-width: 100%;
    gap: 0;
  }

  body.game-running-mobile .game-frame {
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .in-game-icon-btn {
    width: 34px;
    height: 34px;
    font-size: 0.62rem;
    border-width: 2px;
  }
}
.material-symbols-outlined {
  font-variation-settings:
  'FILL' 0,
  'wght' 400,
  'GRAD' 0,
  'opsz' 24
}