:root {
  --bg-top: #f4d9a6;
  --bg-bottom: #d2843f;
  --panel: rgba(34, 37, 42, 0.88);
  --panel-border: rgba(255, 255, 255, 0.12);
  --text: #f7f3ea;
  --accent: #ffd166;
  --ground: #6f4e37;
  --mario: #2d7ff9;
  --item: #3ddc84;
  --enemy: #f94144;
  --wall: #8d99ae;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.35), transparent 30%),
    linear-gradient(180deg, var(--bg-top), var(--bg-bottom));
  display: grid;
  place-items: center;
  touch-action: manipulation;
}

.game-shell {
  width: min(92vw, 960px);
  padding: 24px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.22);
}

.hud {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.hud__group {
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.hud__label {
  color: var(--accent);
  margin-right: 8px;
  font-weight: 700;
}

.instructions {
  margin-bottom: 18px;
  color: rgba(247, 243, 234, 0.86);
}

kbd {
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.arena-wrap {
  position: relative;
}

.game {
  position: relative;
  overflow: hidden;
  width: 100%;
  aspect-ratio: 16 / 9;
  min-height: 420px;
  border-radius: 20px;
  border: 4px solid rgba(255, 255, 255, 0.15);
  background:
    linear-gradient(180deg, #8ecae6 0 70%, var(--ground) 70% 100%);
}

.entity {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.18);
}

.player {
  background: var(--mario);
}

.item {
  background: var(--item);
}

.enemy {
  background: var(--enemy);
}

.golden {
  background: linear-gradient(135deg, #fff0a8, #f4b400);
  box-shadow:
    inset 0 -3px rgba(0, 0, 0, 0.14),
    0 0 16px rgba(255, 208, 64, 0.65);
}

.platform {
  position: absolute;
  background: var(--wall);
  border-radius: 8px;
  box-shadow: inset 0 -4px rgba(0, 0, 0, 0.2);
}

.message {
  position: absolute;
  inset: 18px;
  display: grid;
  place-items: center;
  text-align: center;
  padding: 24px;
  border-radius: 18px;
  background: rgba(20, 22, 26, 0.78);
  font-size: clamp(1.4rem, 2vw, 2.1rem);
  font-weight: 700;
  letter-spacing: 0.03em;
}

.touch-controls {
  display: none;
  margin-top: 18px;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.touch-controls__cluster {
  display: flex;
  gap: 12px;
}

.touch-button {
  min-width: 84px;
  min-height: 56px;
  border: 0;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.02em;
  box-shadow: inset 0 -3px rgba(0, 0, 0, 0.16);
  touch-action: manipulation;
}

.touch-button:active,
.touch-button.is-pressed {
  transform: translateY(1px) scale(0.98);
  background: rgba(255, 209, 102, 0.28);
}

.touch-button--jump {
  background: rgba(45, 127, 249, 0.32);
}

.touch-button--restart {
  min-width: 110px;
}

.hidden {
  display: none;
}

@media (max-width: 720px) {
  .game-shell {
    padding: 16px;
  }

  .game {
    min-height: 340px;
  }

  .touch-controls {
    display: flex;
  }
}

@media (max-width: 560px) {
  body {
    place-items: start center;
  }

  .game-shell {
    width: 100vw;
    min-height: 100vh;
    border-radius: 0;
    padding: 14px;
  }

  .hud {
    gap: 10px;
  }

  .hud__group {
    padding: 8px 12px;
  }

  .instructions {
    font-size: 0.95rem;
  }

  .game {
    min-height: 280px;
    aspect-ratio: 16 / 11;
  }

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

  .touch-controls__cluster {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .touch-button,
  .touch-button--restart {
    min-width: 0;
    width: 100%;
  }
}
