:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #0d1110;
  color: #f4f1e8;
}

* {
  box-sizing: border-box;
}

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

body {
  background:
    radial-gradient(circle at 16% 18%, rgba(221, 54, 74, 0.24), transparent 27%),
    radial-gradient(circle at 84% 76%, rgba(53, 196, 136, 0.18), transparent 30%),
    linear-gradient(135deg, #111817 0%, #171313 48%, #101314 100%);
}

button {
  font: inherit;
}

.app {
  width: min(1200px, 100%);
  min-height: 100svh;
  margin: 0 auto;
  padding: 22px;
  display: grid;
  grid-template-columns: minmax(320px, 740px) minmax(280px, 1fr);
  gap: 22px;
  align-items: center;
}

.game-card {
  height: min(760px, calc(100svh - 44px));
  min-height: 620px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(11, 14, 13, 0.88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.hud {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: rgba(255, 255, 255, 0.08);
  gap: 1px;
}

.hud > div {
  min-width: 0;
  padding: 12px 14px;
  background: #151b1a;
}

.hud span {
  display: block;
  margin-bottom: 3px;
  color: #9fb0ac;
  font-size: 10px;
  letter-spacing: 0;
}

.hud strong {
  font-size: clamp(18px, 4vw, 28px);
  color: #f6d05f;
  line-height: 1;
}

#game {
  min-height: 0;
  background: #0b0f0f;
}

#game canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.bottom-hud {
  padding: 12px;
  background: #151b1a;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.xp-track {
  height: 14px;
  border-radius: 999px;
  background: #27302d;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.xp-track span {
  display: block;
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #35c488, #f6d05f);
  transition: width 160ms ease;
}

.controls {
  display: flex;
  gap: 8px;
}

.controls button,
.upgrade-options button {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: #25302d;
  color: #f4f1e8;
  font-weight: 800;
  cursor: pointer;
}

.controls button {
  min-width: 64px;
  padding: 0 12px;
}

.controls button:active,
.upgrade-options button:active {
  transform: translateY(1px);
}

.info {
  padding: 26px;
  border-left: 1px solid rgba(255, 255, 255, 0.12);
}

.info h1 {
  margin: 0 0 12px;
  font-size: clamp(34px, 5vw, 58px);
  line-height: 0.96;
}

.info p {
  color: #c8d2cf;
  line-height: 1.55;
}

.info ul {
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 10px;
}

.info li {
  padding: 12px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  color: #dce4e1;
}

.info b {
  color: #5ee0a3;
}

.upgrade {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(4, 6, 6, 0.72);
  backdrop-filter: blur(6px);
}

.upgrade.hidden {
  display: none;
}

.upgrade-box {
  width: min(560px, 100%);
  padding: 18px;
  border-radius: 8px;
  background: #151b1a;
  border: 1px solid rgba(255, 255, 255, 0.16);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5);
}

.upgrade-box h2 {
  margin: 0 0 14px;
  font-size: 28px;
}

.upgrade-options {
  display: grid;
  gap: 10px;
}

.upgrade-options button {
  width: 100%;
  min-height: 58px;
  padding: 10px 12px;
  text-align: left;
}

.upgrade-options small {
  display: block;
  margin-top: 3px;
  color: #aebbb7;
  font-weight: 500;
}

@media (max-width: 840px) {
  body {
    overflow: hidden;
  }

  .app {
    min-height: 100svh;
    padding: 8px;
    display: block;
  }

  .game-card {
    height: calc(100svh - 16px);
    min-height: 0;
  }

  .hud > div {
    padding: 9px 8px;
  }

  .bottom-hud {
    padding: 9px;
    grid-template-columns: 1fr;
  }

  .controls {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .info {
    display: none;
  }
}
