:root {
  --bg-top: #02040f;
  --bg-mid: #091229;
  --bg-bottom: #030711;
  --panel: rgba(7, 16, 34, 0.86);
  --panel-strong: rgba(9, 22, 44, 0.96);
  --line: rgba(124, 192, 255, 0.24);
  --text: #ecf7ff;
  --muted: #95afd3;
  --gold: #ffd166;
  --cyan: #53f7ff;
  --red: #ff5b6e;
  --green: #82ff9a;
  --shadow: 0 18px 45px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Rajdhani", sans-serif;
  color: var(--text);
  overscroll-behavior: none;
  background:
    radial-gradient(circle at top, rgba(45, 104, 255, 0.22), transparent 34%),
    radial-gradient(circle at 20% 20%, rgba(83, 247, 255, 0.12), transparent 18%),
    linear-gradient(180deg, var(--bg-top), var(--bg-mid) 40%, var(--bg-bottom));
}

button {
  font: inherit;
}

.game-shell {
  position: relative;
  width: min(1100px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 24px;
}

.frog-secret-button {
  position: fixed;
  left: 14px;
  bottom: 14px;
  z-index: 8;
  padding: 8px 12px;
  border: 1px solid rgba(140, 180, 210, 0.1);
  border-radius: 999px;
  background: rgba(8, 14, 24, 0.18);
  color: rgba(180, 205, 225, 0.32);
  font-family: "Orbitron", sans-serif;
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  cursor: pointer;
  backdrop-filter: blur(4px);
}

.frog-secret-button:hover,
.frog-secret-button:focus-visible {
  border-color: rgba(140, 180, 210, 0.22);
  background: rgba(8, 14, 24, 0.35);
  color: rgba(220, 238, 255, 0.62);
}

.frog-secret-button:disabled {
  opacity: 0.2;
  cursor: not-allowed;
}

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

.hud__group,
.boss-hud {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(5, 14, 30, 0.72);
  box-shadow: var(--shadow);
  backdrop-filter: blur(10px);
}

.hud__group--wide {
  min-width: 0;
}

.hud__label,
.boss-hud__title,
.shop__eyebrow {
  font-family: "Orbitron", sans-serif;
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.hud__value {
  margin-top: 6px;
  font-size: 1.6rem;
  font-weight: 700;
}

.heart-bars {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.heart-bar {
  width: 34px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.heart-bar__fill {
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b, #ffad66);
  box-shadow: 0 0 18px rgba(255, 90, 90, 0.5);
}

.heart-bar.empty .heart-bar__fill {
  width: 0;
}

.speed-controls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.speed-controls__button {
  min-width: 44px;
  padding: 7px 10px;
  border: 1px solid rgba(128, 205, 255, 0.24);
  border-radius: 999px;
  background: rgba(6, 15, 33, 0.72);
  color: var(--muted);
  font-family: "Orbitron", sans-serif;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.speed-controls__button:hover,
.speed-controls__button:focus-visible,
.speed-controls__button.is-active {
  border-color: rgba(128, 235, 255, 0.58);
  background: linear-gradient(135deg, rgba(83, 247, 255, 0.9), rgba(43, 143, 255, 0.9));
  color: #031222;
}

.boss-hud {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.boss-hud__bar {
  height: 16px;
  margin-top: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.boss-hud__fill {
  height: 100%;
  width: 100%;
  transform-origin: right center;
  background: linear-gradient(90deg, #ff866b, #ff335b);
  box-shadow: inset 0 0 18px rgba(255, 255, 255, 0.18);
}

.arena {
  position: relative;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid rgba(130, 184, 255, 0.25);
  box-shadow: var(--shadow);
  touch-action: none;
}

.player-side-hud {
  position: absolute;
  top: 18px;
  z-index: 3;
  width: 190px;
  pointer-events: none;
}

.player-side-hud--left {
  left: 18px;
}

.player-side-hud--right {
  right: 18px;
}

.player-side-hud__hull-label {
  margin-top: 12px;
}

.player-side-hud .heart-bars {
  gap: 6px;
}

.player-side-hud .heart-bar {
  width: 28px;
}

canvas {
  display: block;
  width: 100%;
  height: auto;
  background:
    radial-gradient(circle at 50% 20%, rgba(255, 255, 255, 0.1), transparent 15%),
    linear-gradient(180deg, rgba(9, 14, 30, 0.3), rgba(6, 10, 22, 0.84));
}

.message-banner {
  position: absolute;
  left: 50%;
  top: 56px;
  transform: translateX(-50%);
  padding: 12px 22px;
  border-radius: 999px;
  background: rgba(6, 15, 33, 0.92);
  border: 1px solid rgba(115, 202, 255, 0.3);
  box-shadow: var(--shadow);
  font-family: "Orbitron", sans-serif;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.title-screen,
.rules-modal,
.death-screen {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
  background:
    radial-gradient(circle at top, rgba(90, 175, 255, 0.22), transparent 30%),
    linear-gradient(180deg, rgba(3, 8, 18, 0.45), rgba(3, 8, 18, 0.88));
  z-index: 4;
}

.death-screen {
  background:
    radial-gradient(circle at top, rgba(255, 65, 92, 0.28), transparent 28%),
    linear-gradient(180deg, rgba(14, 3, 10, 0.52), rgba(3, 6, 15, 0.92));
  z-index: 6;
}

.title-screen__panel,
.rules-modal__card,
.death-screen__panel {
  width: min(100%, 680px);
  padding: 34px 30px;
  border-radius: 28px;
  border: 1px solid rgba(127, 204, 255, 0.28);
  background:
    linear-gradient(180deg, rgba(8, 18, 36, 0.96), rgba(5, 12, 24, 0.96)),
    radial-gradient(circle at top, rgba(83, 247, 255, 0.12), transparent 40%);
  box-shadow: 0 28px 60px rgba(0, 0, 0, 0.48);
  text-align: center;
}

.death-screen__panel {
  border-color: rgba(255, 91, 110, 0.42);
  background:
    linear-gradient(180deg, rgba(32, 8, 16, 0.96), rgba(8, 10, 20, 0.96)),
    radial-gradient(circle at top, rgba(255, 91, 110, 0.16), transparent 42%);
}

.title-screen__eyebrow {
  margin: 0 0 14px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.death-screen__eyebrow {
  margin: 0 0 14px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.82rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--red);
}

.title-screen__title,
.rules-modal__title,
.death-screen__title {
  margin: 0;
  font-family: "Orbitron", sans-serif;
  line-height: 1.05;
}

.title-screen__title {
  font-size: clamp(2.4rem, 7vw, 4.8rem);
  text-transform: uppercase;
  color: #ffe089;
  text-shadow: 0 0 22px rgba(255, 224, 137, 0.18);
}

.death-screen__title {
  font-size: clamp(3rem, 9vw, 6.2rem);
  color: var(--red);
  text-shadow: 0 0 26px rgba(255, 91, 110, 0.3);
}

.death-screen__level {
  margin: 14px 0 0;
  font-family: "Orbitron", sans-serif;
  color: var(--gold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.leaderboard-entry {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin: 22px auto 18px;
  width: min(100%, 520px);
}

.leaderboard-entry__input {
  min-width: 0;
  flex: 1;
  padding: 14px 16px;
  border: 1px solid rgba(255, 91, 110, 0.34);
  border-radius: 16px;
  background: rgba(6, 15, 33, 0.78);
  color: var(--text);
  font: inherit;
  font-size: 1.05rem;
}

.leaderboard-entry__input::placeholder {
  color: rgba(149, 175, 211, 0.72);
}

.leaderboard {
  width: min(100%, 520px);
  margin: 0 auto 22px;
  padding: 16px;
  border: 1px solid rgba(255, 91, 110, 0.26);
  border-radius: 18px;
  background: rgba(6, 15, 33, 0.58);
}

.leaderboard__title {
  margin: 0 0 12px;
  font-family: "Orbitron", sans-serif;
  font-size: 0.92rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

.leaderboard__list {
  display: grid;
  gap: 8px;
  max-height: 210px;
  margin: 0;
  padding-left: 24px;
  overflow: auto;
  text-align: left;
}

.leaderboard__row {
  color: var(--text);
  font-size: 1rem;
}

.leaderboard__row::marker {
  color: var(--gold);
  font-family: "Orbitron", sans-serif;
}

.leaderboard__score {
  float: right;
  margin-left: 16px;
  color: var(--gold);
  font-family: "Orbitron", sans-serif;
}

.title-screen__credits {
  margin: 18px 0 0;
  font-size: 1.08rem;
  color: var(--muted);
}

.title-screen__actions,
.death-screen__actions {
  display: flex;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 28px;
}

.title-screen__button {
  min-width: 160px;
  padding: 14px 22px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #ffd166, #ff9f43);
  color: #1c1100;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.title-screen__button--secondary {
  background: linear-gradient(135deg, #53f7ff, #2b8fff);
  color: #031222;
}

.title-screen__button--danger {
  background: linear-gradient(135deg, #ff5b6e, #ff9f43);
  color: #210408;
}

.rules-modal__title {
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  margin-bottom: 18px;
}

.rules-modal__text {
  margin: 10px 0;
  font-size: 1.05rem;
  color: var(--muted);
}

.shop {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 30px;
  background:
    linear-gradient(180deg, rgba(4, 10, 21, 0.58), rgba(4, 10, 21, 0.9)),
    radial-gradient(circle at top, rgba(98, 180, 255, 0.15), transparent 34%);
}

.shop__header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.shop__actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.shop h1 {
  margin: 4px 0 10px;
  font-family: "Orbitron", sans-serif;
  font-size: clamp(1.8rem, 2vw, 2.5rem);
}

.shop__subtitle,
.shop__tip,
.shop-card__desc,
.shop__status {
  color: var(--muted);
}

.launch-button {
  min-width: 140px;
  padding: 14px 22px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, #53f7ff, #2b8fff);
  color: #031222;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.skins-button {
  min-width: 110px;
  padding: 14px 18px;
  border: 1px solid rgba(128, 205, 255, 0.35);
  border-radius: 16px;
  background: rgba(6, 15, 33, 0.82);
  color: var(--cyan);
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  letter-spacing: 0.08em;
  cursor: pointer;
}

.skins-button:hover,
.skins-button:focus-visible {
  border-color: rgba(128, 235, 255, 0.68);
  background: var(--panel-strong);
}

.shop__status {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  padding: 14px 16px;
  border-radius: 16px;
  background: rgba(7, 16, 34, 0.78);
  border: 1px solid var(--line);
}

.shop__tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.shop__tab {
  padding: 8px 12px;
  border: 1px solid rgba(128, 205, 255, 0.24);
  border-radius: 999px;
  background: rgba(6, 15, 33, 0.72);
  color: var(--muted);
  font-family: "Orbitron", sans-serif;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  cursor: pointer;
}

.shop__tab:hover,
.shop__tab:focus-visible,
.shop__tab.is-active {
  border-color: rgba(128, 235, 255, 0.58);
  background: linear-gradient(135deg, rgba(83, 247, 255, 0.9), rgba(43, 143, 255, 0.9));
  color: #031222;
}

.shop__reward {
  color: var(--gold);
}

.skins-menu {
  position: absolute;
  top: 92px;
  right: 30px;
  z-index: 6;
  width: min(340px, calc(100% - 60px));
  padding: 18px;
  border: 1px solid rgba(128, 205, 255, 0.32);
  border-radius: 22px;
  background: rgba(7, 16, 34, 0.96);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.38);
}

.skins-menu__title {
  margin: 0 0 12px;
  font-family: "Orbitron", sans-serif;
  font-size: 1.2rem;
  color: var(--cyan);
}

.skins-menu__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.skins-menu__skin {
  padding: 12px 14px;
  border: 1px solid rgba(128, 205, 255, 0.2);
  border-radius: 14px;
  background: rgba(4, 10, 21, 0.82);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.skins-menu__skin.is-equipped {
  border-color: rgba(255, 214, 102, 0.68);
  color: var(--gold);
}

.skins-menu__skin:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.skins-menu__message {
  margin: 14px 0 12px;
  color: var(--muted);
}

.skins-menu__buy {
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-radius: 15px;
  background: linear-gradient(135deg, #ffd666, #ff9d2e);
  color: #271400;
  font-family: "Orbitron", sans-serif;
  font-weight: 800;
  cursor: pointer;
}

.skins-menu__buy:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

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

.shop-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  padding: 20px;
  border-radius: 22px;
  border: 1px solid rgba(128, 205, 255, 0.22);
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.shop-card:hover,
.shop-card:focus-visible {
  transform: translateY(-3px);
  border-color: rgba(128, 235, 255, 0.56);
  background: var(--panel-strong);
}

.shop-card:disabled {
  opacity: 0.52;
  cursor: not-allowed;
  transform: none;
}

.shop-card__title {
  font-family: "Orbitron", sans-serif;
  font-size: 1.08rem;
  color: var(--cyan);
}

.shop-card__cost {
  color: var(--gold);
  font-weight: 700;
}

.shop-card--heal .shop-card__title {
  color: var(--green);
}

.shop-card--revive .shop-card__title {
  color: var(--gold);
}

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

.touch-controls__pad {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.touch-controls__row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.touch-controls__button,
.touch-controls__action {
  border: 1px solid rgba(128, 205, 255, 0.28);
  background: rgba(7, 16, 34, 0.84);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(8px);
  touch-action: manipulation;
}

.touch-controls__button {
  width: 68px;
  height: 68px;
  border-radius: 22px;
  font-size: 1.5rem;
  line-height: 1;
}

.touch-controls__button--center {
  opacity: 0.28;
}

.touch-controls__action {
  min-width: 132px;
  min-height: 132px;
  padding: 18px;
  border-radius: 999px;
  font-family: "Orbitron", sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, rgba(255, 209, 102, 0.92), rgba(255, 114, 94, 0.92));
  color: #1a0d00;
}

.touch-controls__button:active,
.touch-controls__action:active,
.touch-controls__button.is-active,
.touch-controls__action.is-active {
  transform: scale(0.96);
  border-color: rgba(128, 235, 255, 0.58);
}

.hidden {
  display: none !important;
}

@media (pointer: coarse), (max-width: 900px) {
  .touch-controls {
    display: flex;
  }
}

@media (max-width: 900px) {
  .hud {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .game-shell {
    width: min(100vw - 12px, 1100px);
    padding-top: 10px;
  }

  .hud {
    gap: 10px;
    margin-bottom: 10px;
  }

  .hud__group,
  .boss-hud {
    padding: 12px;
    border-radius: 16px;
  }

  .shop {
    padding: 18px;
  }

  .touch-controls {
    gap: 12px;
  }

  .shop__header {
    flex-direction: column;
  }

  .shop__actions {
    width: 100%;
    flex-direction: column;
  }

  .launch-button,
  .skins-button,
  .title-screen__button {
    width: 100%;
  }

  .skins-menu {
    top: 145px;
    right: 18px;
    width: calc(100% - 36px);
  }

  .title-screen__panel,
  .rules-modal__card {
    padding: 26px 18px;
    border-radius: 22px;
  }

  .leaderboard-entry {
    flex-direction: column;
  }

  .touch-controls__button {
    width: 58px;
    height: 58px;
    border-radius: 18px;
  }

  .touch-controls__action {
    min-width: 108px;
    min-height: 108px;
    font-size: 0.9rem;
  }
}
