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

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 50% -12%, rgba(127, 73, 164, 0.35), transparent 34%),
    linear-gradient(180deg, #25133a 0%, #1b102c 100%);
}

button {
  border: 0;
  font: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid #fbbd2d;
  outline-offset: 4px;
}

.game-shell {
  width: min(100vw, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 18px max(16px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  gap: 12px;
}

.game-header,
.action-bar,
.stats {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.game-header {
  min-height: 58px;
}

.level-title {
  display: grid;
  justify-items: center;
  line-height: 1;
}

.level-title span {
  min-width: 84px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff9ef;
  font-size: 11px;
  font-weight: 950;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

.level-title strong {
  margin-top: 5px;
  color: #ffffff;
  font-size: 24px;
  font-weight: 950;
  letter-spacing: 0;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.28);
}

.icon-button {
  width: 48px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: #fffaf2;
  color: #c85a86;
  font-size: 31px;
  font-weight: 950;
  line-height: 1;
  box-shadow:
    inset 0 -4px 0 rgba(67, 44, 80, 0.12),
    0 5px 0 rgba(0, 0, 0, 0.18);
}

#gameCanvas {
  width: 100%;
  height: clamp(360px, 58vh, 620px);
  border-radius: 8px;
  display: block;
  touch-action: manipulation;
}

.action-bar {
  min-height: 76px;
  padding-top: 2px;
}

.action-button {
  min-width: 78px;
  display: grid;
  justify-items: center;
  gap: 4px;
  position: relative;
  background: transparent;
  color: #ffd65a;
  font-weight: 950;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.26);
}

.action-button span {
  width: 58px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #f9ad24;
  color: #ffffff;
  font-size: 35px;
  line-height: 1;
  box-shadow:
    inset 0 -5px 0 rgba(152, 85, 0, 0.24),
    0 5px 0 rgba(0, 0, 0, 0.18);
}

.action-button strong {
  font-size: 13px;
}

.action-button em {
  width: 22px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: absolute;
  top: -4px;
  right: 10px;
  background: #fffaf2;
  color: #39264f;
  font-size: 13px;
  font-style: normal;
  font-weight: 950;
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.22);
}

#message {
  min-height: 22px;
  margin: 0;
  color: rgba(255, 249, 239, 0.86);
  font-size: 14px;
  font-weight: 850;
  text-align: center;
}

.stats {
  margin: 0;
  padding: 0 5px;
  color: rgba(255, 249, 239, 0.72);
}

.stats div {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.stats dt,
.stats dd {
  margin: 0;
}

.stats dt {
  font-size: 11px;
  font-weight: 950;
  text-transform: uppercase;
}

.stats dd {
  max-width: 160px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (min-width: 760px) {
  body {
    display: grid;
    place-items: center;
  }

  .game-shell {
    min-height: min(100vh, 900px);
  }
}

@media (max-width: 380px) {
  .game-shell {
    padding-left: 12px;
    padding-right: 12px;
  }

  .action-button {
    min-width: 66px;
  }

  .action-button span {
    width: 52px;
    font-size: 31px;
  }
}
