@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
  color-scheme: dark;
  font-family: 'Outfit', Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #090f0b;
  color: #f3f7f4;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  place-items: start center;
  padding: 24px;
  background:
    radial-gradient(circle at 15% 15%, rgba(39, 110, 75, 0.25), transparent 45%),
    radial-gradient(circle at 85% 85%, rgba(244, 185, 66, 0.08), transparent 45%),
    linear-gradient(135deg, #090f0b 0%, #121e16 100%);
  overflow: hidden;
}

.game-shell {
  width: min(100%, 1200px);
  min-width: min(100%, 320px);
  display: grid;
  gap: 16px;
}

.brand {
  display: grid;
  place-items: center;
  gap: 8px;
  min-height: 64px;
  padding: 12px 20px;
  background: rgba(18, 30, 22, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
}

.brand img {
  display: block;
  width: min(100%, 720px);
  max-height: 82px;
  object-fit: contain;
  filter: drop-shadow(0 4px 12px rgba(0,0,0,0.4));
}

.brand p {
  margin: 0;
  color: #a3b899;
  font-size: 14px;
  font-weight: 500;
  text-align: center;
  letter-spacing: 0.5px;
}

.hud,
.controls {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr)) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
}

.hud div,
.controls {
  background: rgba(18, 30, 22, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

.hud div {
  min-height: 64px;
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.hud span {
  display: block;
  color: #70927e;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.hud strong {
  display: block;
  margin-top: 2px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1;
  color: #ffd166;
}

button {
  width: 52px;
  height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  background: linear-gradient(135deg, #1f442f 0%, #153021 100%);
  color: #ffd166;
  font-size: 28px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  display: grid;
  place-items: center;
}

button:hover {
  background: linear-gradient(135deg, #2a583e 0%, #1a3c29 100%);
  transform: translateY(-2px);
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: 0 10px 25px rgba(39, 110, 75, 0.35);
}

button:active {
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

canvas {
  width: 100%;
  max-width: calc((100vh - 400px) * 12 / 7);
  aspect-ratio: 12 / 7;
  display: block;
  border-radius: 16px;
  background: #122116;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
  touch-action: none;
}

.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 12px;
}

.controls p {
  margin: 0;
  text-align: center;
  color: #a3b899;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.2px;
}

.controls-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
}

.control-modes {
  display: flex;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: 20px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.mode-btn {
  background: transparent;
  border: none;
  border-radius: 16px;
  color: #a3b899;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 14px;
  height: auto;
  width: auto;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.2s;
  display: grid;
  place-items: center;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: #ffd166;
  transform: none;
  box-shadow: none;
  border-color: transparent;
}

.mode-btn.active {
  background: linear-gradient(135deg, #1f442f 0%, #153021 100%);
  color: #ffd166;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.shoot-btn {
  width: 100%;
  max-width: 240px;
  height: 42px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.5px;
  border-radius: 10px;
  background: linear-gradient(135deg, #ff2a6d 0%, #c20043 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 6px 20px rgba(255, 42, 109, 0.3);
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
  display: grid;
  place-items: center;
}

.shoot-btn:hover {
  background: linear-gradient(135deg, #ff4c85 0%, #d6004b 100%);
  box-shadow: 0 8px 25px rgba(255, 42, 109, 0.45);
  transform: translateY(-1px);
  border-color: rgba(255, 255, 255, 0.25);
}

.shoot-btn:active {
  background: linear-gradient(135deg, #d6004b 0%, #a30034 100%);
  transform: translateY(1px);
  box-shadow: 0 3px 10px rgba(255, 42, 109, 0.2);
}

.score-panel {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(6, 12, 8, 0.85);
  backdrop-filter: blur(8px);
}

.score-panel[hidden] {
  display: none;
}

.score-card {
  width: min(100%, 520px);
  display: grid;
  gap: 20px;
  padding: 36px;
  background: rgba(18, 30, 22, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  box-shadow: 0 32px 80px rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(20px);
}

.score-card h2,
.score-card h3,
.score-card p {
  margin: 0;
}

.score-card h2 {
  font-size: 32px;
  font-weight: 800;
  background: linear-gradient(135deg, #ffd166 0%, #f4b942 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.score-card h3 {
  font-size: 20px;
  font-weight: 600;
  color: #ffd166;
}

.score-card label {
  color: #70927e;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.score-entry {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  margin-top: 8px;
}

.score-entry input {
  width: 100%;
  min-height: 52px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0 16px;
  color: #f3f7f4;
  font: inherit;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.05);
  transition: all 0.2s;
}

.score-entry input:focus {
  outline: none;
  border-color: #ffd166;
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 3px rgba(255, 209, 102, 0.15);
}

#startButton,
#newRoundButton {
  width: auto;
  padding: 0 28px;
  font-size: 16px;
  font-weight: 600;
  background: linear-gradient(135deg, #ffd166 0%, #f4b942 100%);
  color: #0c150e;
  border: none;
  box-shadow: 0 8px 20px rgba(244, 185, 66, 0.25);
}

#startButton:hover,
#newRoundButton:hover {
  background: linear-gradient(135deg, #ffe099 0%, #ffd166 100%);
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(244, 185, 66, 0.35);
}

#startButton:active,
#newRoundButton:active {
  transform: translateY(1px);
}

#newRoundButton {
  justify-self: start;
}

.leaderboard {
  display: grid;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  padding: 16px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.leaderboard ol {
  margin: 0;
  padding-left: 20px;
}

.leaderboard li {
  padding: 6px 0;
  font-weight: 500;
  color: #a3b899;
}

.leaderboard-note {
  margin: 0 0 4px 0;
  font-size: 13px;
  color: #fca5a5;
  font-weight: 600;
  line-height: 1.4;
}

@media (max-width: 680px) {
  body {
    padding: 12px;
  }

  .game-shell {
    width: 100%;
    gap: 12px;
  }

  .brand {
    min-height: 54px;
    padding: 8px 12px;
  }

  .brand img {
    max-height: 58px;
  }

  .brand p {
    font-size: 12px;
  }

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

  .hud button {
    grid-column: 1 / -1;
    justify-self: center;
    width: 100%;
    height: 48px;
  }

  .hud div {
    padding: 8px 12px;
    min-height: 54px;
  }

  .hud strong {
    font-size: 20px;
  }

  .controls p {
    font-size: 13px;
  }

  .score-card {
    padding: 24px;
  }

  .score-entry {
    grid-template-columns: 1fr;
  }

  #startButton,
  #newRoundButton {
    width: 100%;
    height: 48px;
  }
}

@media (orientation: landscape) and (max-width: 1024px) {
  body {
    padding: 8px;
    place-items: center center;
  }

  .brand {
    display: none;
  }

  .game-shell {
    width: 100%;
    max-width: 100%;
    grid-template-columns: 1fr 240px;
    grid-template-rows: auto auto;
    grid-template-areas:
      "canvas hud"
      "canvas controls";
    gap: 8px;
    align-items: stretch;
  }

  #game {
    grid-area: canvas;
    width: 100%;
    max-width: calc((100vh - 16px) * 12 / 7);
    height: auto;
    aspect-ratio: 12 / 7;
    justify-self: center;
    align-self: center;
  }

  .hud {
    grid-area: hud;
    grid-template-columns: repeat(2, 1fr);
    grid-template-rows: auto auto auto;
    gap: 6px;
    align-content: center;
    min-height: 0;
  }

  .hud div {
    min-height: 0;
    padding: 6px 10px;
    border-radius: 8px;
  }

  .hud span {
    font-size: 9px;
  }

  .hud strong {
    font-size: 16px;
    margin-top: 1px;
  }

  .hud button {
    grid-column: span 2;
    width: 100%;
    height: 36px;
    font-size: 18px;
    border-radius: 8px;
  }

  .controls {
    grid-area: controls;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 6px;
    min-height: 0;
  }

  .controls p {
    font-size: 11px;
    line-height: 1.2;
  }

  .controls-center {
    gap: 4px;
  }

  .mode-btn {
    padding: 4px 10px;
    font-size: 10px;
  }

  .shoot-btn {
    height: 34px;
    font-size: 12px;
    max-width: 180px;
  }

  .score-panel {
    padding: 10px;
  }

  .score-card {
    padding: 16px 24px;
    gap: 8px;
    border-radius: 12px;
    max-height: 95vh;
    overflow-y: auto;
  }

  .score-card h2 {
    font-size: 22px;
  }

  .score-card p {
    font-size: 12px;
  }

  .score-entry {
    margin-top: 4px;
    gap: 8px;
  }

  .score-entry input {
    min-height: 40px;
    height: 40px;
    font-size: 14px;
    padding: 0 12px;
  }

  #startButton,
  #newRoundButton {
    width: 100%;
    height: 40px;
    font-size: 14px;
    padding: 0 16px;
  }

  .leaderboard {
    padding: 10px;
    gap: 6px;
  }

  .leaderboard h3 {
    font-size: 14px;
  }

  .leaderboard li {
    padding: 2px 0;
    font-size: 12px;
  }
}
