:root {
  color-scheme: dark;
  --leaf: #86efac;
  --fern: #22c55e;
  --mud: #594025;
  --stone: #40545b;
  --sky: #c4f1e1;
  --panel: rgba(22, 34, 24, 0.88);
  --text: #fff7ed;
  --muted: #d6e4c8;
  --amber: #fbbf24;
}

* {
  box-sizing: border-box;
}

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

body {
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 15% 14%, rgba(134, 239, 172, 0.28), transparent 23rem),
    radial-gradient(circle at 80% 20%, rgba(251, 191, 36, 0.25), transparent 18rem),
    linear-gradient(140deg, #17351f 0%, #28462e 40%, #4d3a25 100%);
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 18px;
}

.game-panel {
  width: min(100%, 820px);
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255, 247, 237, 0.16);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.34);
  backdrop-filter: blur(16px);
}

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

.game-link {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 247, 237, 0.16);
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  background: rgba(255, 247, 237, 0.08);
}

.game-link:hover,
.game-link:focus-visible {
  color: #17200f;
  background: linear-gradient(135deg, #bef264, #5eead4);
}

.game-link strong,
.game-link small {
  display: block;
}

.game-link strong {
  font-size: 1.05rem;
  line-height: 1.1;
}

.game-link small {
  margin-top: 2px;
  color: currentColor;
  opacity: 0.78;
  font-weight: 800;
}

.game-link-icon {
  width: 46px;
  height: 38px;
  position: relative;
  flex: 0 0 auto;
}

.snake-icon::before {
  content: "";
  position: absolute;
  inset: 7px 5px;
  border: 7px solid #22c55e;
  border-right-color: transparent;
  border-radius: 999px;
  transform: rotate(-16deg);
}

.snake-icon::after {
  content: "";
  width: 16px;
  height: 16px;
  position: absolute;
  right: 0;
  top: 2px;
  border-radius: 50%;
  background: #a3e635;
  box-shadow: 5px 5px 0 -3px #07111f;
}

.dino-launch-icon::before {
  content: "";
  width: 31px;
  height: 20px;
  position: absolute;
  left: 4px;
  bottom: 5px;
  border-radius: 14px 10px 12px 12px;
  background: #fbbf24;
}

.dino-launch-icon::after {
  content: "";
  width: 17px;
  height: 17px;
  position: absolute;
  right: 2px;
  top: 3px;
  border-radius: 7px;
  background: #f97316;
  box-shadow: -25px 15px 0 -6px #fbbf24;
}

.topbar,
.controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

h1,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 7vw, 4.25rem);
  line-height: 0.95;
}

.topbar p,
.controls p,
.credit {
  color: var(--muted);
}

.credit {
  font-size: 0.75rem;
}

.scoreboard {
  min-width: 110px;
  display: grid;
  justify-items: end;
  gap: 2px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 247, 237, 0.18);
  border-radius: 8px;
  background: rgba(255, 247, 237, 0.08);
}

.scoreboard span {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.scoreboard strong {
  font-size: 2rem;
  line-height: 1;
}

.dino-picker {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.dino-option {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid rgba(255, 247, 237, 0.14);
  border-radius: 8px;
  color: var(--text);
  font: inherit;
  font-weight: 800;
  background: rgba(255, 247, 237, 0.08);
  cursor: pointer;
}

.dino-option.active {
  color: #17200f;
  background: linear-gradient(135deg, #bef264, #5eead4, #fbbf24);
}

.dino-icon {
  width: 34px;
  height: 26px;
  display: inline-block;
  border-radius: 50% 45% 45% 40%;
  background: #22c55e;
  position: relative;
  flex: 0 0 auto;
}

.dino-icon::before {
  content: "";
  position: absolute;
}

.dino-icon::after {
  content: "";
  position: absolute;
}

.dino-icon.trex {
  width: 34px;
  height: 20px;
  border-radius: 13px 9px 11px 12px;
  background: #ef4444;
}

.dino-icon.trex::before {
  width: 16px;
  height: 16px;
  position: absolute;
  right: -6px;
  top: -7px;
  border-radius: 7px 8px 5px 5px;
  background: inherit;
}

.dino-icon.trex::after {
  width: 12px;
  height: 12px;
  left: -8px;
  top: 4px;
  clip-path: polygon(100% 0, 0 45%, 100% 100%);
  background: inherit;
}

.dino-icon.triceratops {
  width: 34px;
  height: 20px;
  border-radius: 13px 10px 11px 12px;
  background: #38bdf8;
}

.dino-icon.triceratops::before {
  width: 17px;
  height: 21px;
  right: 0;
  top: -7px;
  border-radius: 50%;
  background: #0ea5e9;
}

.dino-icon.triceratops::after {
  width: 18px;
  height: 12px;
  right: -10px;
  top: -8px;
  background: #fef3c7;
  clip-path: polygon(0 100%, 18% 0, 34% 100%, 62% 8%, 75% 100%, 100% 52%, 100% 72%);
}

.dino-icon.stegosaurus {
  width: 36px;
  height: 20px;
  border-radius: 14px 10px 12px 12px;
  background: #fbbf24;
}

.dino-icon.stegosaurus::before {
  width: 28px;
  height: 13px;
  left: 3px;
  top: -10px;
  background: #f97316;
  clip-path: polygon(0 100%, 10% 8%, 22% 100%, 35% 8%, 48% 100%, 62% 8%, 76% 100%, 90% 8%, 100% 100%);
}

.dino-icon.stegosaurus::after {
  width: 11px;
  height: 11px;
  right: -5px;
  top: 2px;
  border-radius: 50%;
  background: inherit;
}

.dino-icon.bronto {
  width: 34px;
  height: 19px;
  border-radius: 15px 13px 12px 12px;
  background: #a78bfa;
}

.dino-icon.bronto::before {
  width: 7px;
  height: 25px;
  right: 1px;
  top: -17px;
  border-radius: 8px;
  background: inherit;
  transform: rotate(24deg);
  transform-origin: bottom center;
}

.dino-icon.bronto::after {
  width: 14px;
  height: 10px;
  right: -8px;
  top: -19px;
  border-radius: 8px;
  background: inherit;
}

canvas {
  width: 100%;
  aspect-ratio: 1;
  display: block;
  border: 2px solid rgba(255, 247, 237, 0.18);
  border-radius: 8px;
  background: #264a2f;
  touch-action: none;
  user-select: none;
  box-shadow: inset 0 0 50px rgba(12, 24, 14, 0.38);
}

button {
  min-height: 42px;
  padding: 0 18px;
  border: 0;
  border-radius: 8px;
  color: #17200f;
  font-weight: 900;
  cursor: pointer;
  background: linear-gradient(135deg, #bef264, #fbbf24);
}

button:focus-visible {
  outline: 3px solid rgba(94, 234, 212, 0.85);
  outline-offset: 3px;
}

@media (max-width: 620px) {
  .shell {
    padding: 10px;
  }

  .game-panel {
    padding: 12px;
  }

  .topbar,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .scoreboard {
    justify-items: start;
  }

  .dino-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .game-nav {
    grid-template-columns: 1fr;
  }
}
