:root {
  color-scheme: dark;
  --bg: #071216;
  --ink: #fff2c7;
  --muted: #c8a978;
  --gold: #e7b84a;
  --green: #123929;
  --blue: #0a5574;
  --wood: #6d3518;
  --edge: rgba(248, 190, 83, 0.52);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 145, 56, 0.18), transparent 36rem),
    linear-gradient(135deg, #061115, #0e201f 48%, #070b0e);
  color: var(--ink);
}

button {
  border: 1px solid rgba(255, 216, 129, 0.55);
  border-radius: 8px;
  background: linear-gradient(#15506a, #072b3a);
  color: var(--ink);
  cursor: pointer;
  font: 700 0.88rem/1.1 system-ui, sans-serif;
  min-height: 42px;
  padding: 0.72rem 1rem;
  text-transform: uppercase;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 3px 0 rgba(0, 0, 0, 0.34);
}

button:hover,
button:focus-visible {
  background: linear-gradient(#1d6f92, #0a3850);
  outline: 2px solid rgba(251, 214, 112, 0.65);
  outline-offset: 2px;
}

.game-shell {
  width: min(1120px, calc(100vw - 28px), calc((100vh - 172px) * 16 / 9));
  margin: 0 auto;
  padding: 18px 0 22px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 18px;
  padding: 0 2px 14px;
}

h1 {
  margin: 0;
  color: var(--gold);
  font-size: clamp(2rem, 5vw, 4.2rem);
  line-height: 0.9;
  letter-spacing: 0;
  text-shadow: 0 4px 0 #4d1f0d, 0 0 22px rgba(247, 176, 63, 0.45);
}

p {
  margin: 0.55rem 0 0;
  color: var(--muted);
  font: 600 0.98rem/1.4 system-ui, sans-serif;
}

.action-row,
.touch-pad {
  display: flex;
  gap: 10px;
}

.stage-wrap {
  position: relative;
  overflow: hidden;
  border: 2px solid var(--edge);
  border-radius: 8px;
  background: #071216;
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.46), inset 0 0 0 1px rgba(0, 0, 0, 0.65);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

canvas {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  image-rendering: auto;
}

.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) minmax(280px, 0.9fr);
  gap: 10px;
  margin-top: 12px;
}

.control-card {
  min-height: 58px;
  padding: 0.72rem 0.82rem;
  border: 1px solid rgba(232, 182, 82, 0.42);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(19, 57, 41, 0.88), rgba(9, 28, 28, 0.92));
}

.control-card span {
  display: block;
  color: var(--muted);
  font: 700 0.72rem/1.1 system-ui, sans-serif;
  text-transform: uppercase;
}

.control-card strong {
  display: block;
  margin-top: 0.26rem;
  color: var(--ink);
  font: 800 0.94rem/1.2 system-ui, sans-serif;
}

.touch-pad button {
  flex: 1 1 0;
}

@media (max-width: 760px) {
  .game-shell {
    width: min(100vw - 16px, 1180px);
    padding-top: 10px;
  }

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

  .action-row button {
    flex: 1;
  }

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

  .control-card {
    display: none;
  }
}
