:root {
  color-scheme: dark;
  --ink: #f7f2df;
  --muted: #b9c2b3;
  --panel: rgba(18, 30, 26, 0.86);
  --line: rgba(247, 242, 223, 0.16);
  --field: #21382d;
  --accent: #f4c95d;
  --accent-2: #65c7a3;
  --bad: #ef6f6c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  background:
    linear-gradient(180deg, rgba(24, 67, 83, 0.88), rgba(28, 47, 32, 0.96)),
    radial-gradient(circle at 22% 15%, rgba(244, 201, 93, 0.2), transparent 28%),
    #182b2e;
}

button {
  border: 1px solid rgba(247, 242, 223, 0.28);
  border-radius: 8px;
  color: var(--ink);
  background: rgba(247, 242, 223, 0.1);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 140ms ease,
    background 140ms ease,
    border-color 140ms ease;
}

button:hover {
  transform: translateY(-1px);
  background: rgba(247, 242, 223, 0.18);
  border-color: rgba(247, 242, 223, 0.5);
}

.game-shell {
  width: min(1120px, calc(100vw - 28px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 20px 0;
  display: grid;
  grid-template-rows: auto minmax(360px, 1fr) auto;
  gap: 14px;
}

.topbar,
.controls {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  backdrop-filter: blur(14px);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
}

.topbar {
  min-height: 94px;
  padding: 16px;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  gap: 16px;
  align-items: center;
}

.label,
.stat span {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1 {
  margin: 2px 0 0;
  font-size: clamp(2rem, 5vw, 4.6rem);
  line-height: 0.95;
  letter-spacing: 0;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(78px, 1fr));
  gap: 10px;
}

.stat {
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.stat strong {
  display: block;
  margin-top: 2px;
  color: var(--accent);
  font-size: 1.5rem;
  line-height: 1;
}

.play-area {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.04);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 360px;
  cursor: crosshair;
}

.message {
  position: absolute;
  inset: 0;
  display: none;
  place-content: center;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  text-align: center;
  background: rgba(9, 17, 15, 0.72);
}

.message.show {
  display: grid;
}

.shop {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  width: min(260px, calc(100% - 28px));
  display: none;
  grid-template-columns: 1fr;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(247, 242, 223, 0.24);
  border-radius: 8px;
  background: rgba(15, 25, 22, 0.88);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(14px);
}

.shop.open {
  display: grid;
}

.shop h2 {
  margin: 2px 0 4px;
  color: var(--accent);
  font-size: 2rem;
  line-height: 1;
  letter-spacing: 0;
}

.shop p:not(.label) {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 700;
  line-height: 1.35;
}

.shop button {
  min-height: 42px;
}

.shop button:disabled {
  cursor: not-allowed;
  color: rgba(247, 242, 223, 0.42);
  background: rgba(247, 242, 223, 0.05);
  border-color: rgba(247, 242, 223, 0.12);
  transform: none;
}

.message strong {
  font-size: clamp(2.2rem, 8vw, 6rem);
  line-height: 0.9;
}

.message span {
  color: var(--muted);
  font-size: clamp(1rem, 2.5vw, 1.25rem);
}

.message button {
  min-width: 132px;
  min-height: 48px;
  padding: 0 20px;
  color: #1a221e;
  background: var(--accent);
  border-color: transparent;
}

.controls {
  min-height: 62px;
  padding: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.controls button {
  min-width: 100px;
  min-height: 42px;
  padding: 0 14px;
}

.legend {
  margin-left: auto;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.legend i {
  width: 12px;
  height: 12px;
  border-radius: 999px;
}

.legend .hit {
  background: var(--accent-2);
}

.legend .miss {
  background: var(--bad);
}

@media (max-width: 720px) {
  .game-shell {
    width: min(100vw - 16px, 1120px);
    padding: 8px 0;
    grid-template-rows: auto minmax(430px, 1fr) auto;
  }

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

  .stat-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .stat {
    padding: 9px;
  }

  .stat strong {
    font-size: 1.2rem;
  }

  .controls {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .controls button {
    flex: 1 1 120px;
  }

  .legend {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
}
