* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
}

body {
  margin: 0;
  font-family: "Segoe UI", Tahoma, sans-serif;
  background:
    radial-gradient(circle at 20% 20%, #1f2c46 0%, transparent 32%),
    radial-gradient(circle at 80% 10%, #3b2150 0%, transparent 28%),
    radial-gradient(circle at 60% 80%, #1b4a43 0%, transparent 24%),
    #0a1018;
  color: #eef4ff;
  overflow: hidden;
}

.layout {
  width: 100vw;
  height: 100vh;
  margin: 0;
  padding: 14px;
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 14px;
}

.game-panel {
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: rgba(16, 26, 42, 0.45);
  border: 1px solid rgba(176, 204, 255, 0.14);
  backdrop-filter: blur(8px);
  border-radius: 14px;
  padding: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.game-panel h1 {
  margin: 0 0 6px;
  font-size: 28px;
  letter-spacing: 0.4px;
}

.game-panel p {
  margin: 0;
  color: #b2c2dd;
}

.arena {
  flex: 1;
  min-height: 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid rgba(185, 210, 255, 0.18);
  box-shadow:
    inset 0 0 40px rgba(52, 121, 255, 0.18),
    0 18px 40px rgba(0, 0, 0, 0.45);
  background: #0f1824;
}

canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.hud {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-weight: 700;
  color: #d9e8ff;
  background: rgba(14, 24, 40, 0.65);
  border: 1px solid rgba(170, 198, 248, 0.18);
  border-radius: 10px;
  padding: 10px 14px;
}

.leaderboard {
  background: rgba(14, 24, 40, 0.65);
  border: 1px solid rgba(170, 198, 248, 0.18);
  border-radius: 14px;
  padding: 14px;
  overflow: auto;
}

.leaderboard h2 {
  margin: 4px 0 12px;
}

.leaderboard ol {
  margin: 0;
  padding-left: 20px;
}

.leaderboard li {
  margin-bottom: 10px;
  color: #d9e6fb;
}

.shop {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(170, 198, 248, 0.2);
}

.shop h2 {
  margin: 0 0 8px;
}

.shop-hint {
  margin: 0 0 12px;
  color: #b3c5e2;
  font-size: 14px;
}

.shop-subtitle {
  margin: 10px 0 8px;
  font-size: 14px;
  color: #9fbdf1;
  letter-spacing: 0.4px;
  text-transform: uppercase;
}

.shop-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.shop-item {
  border: 1px solid rgba(170, 198, 248, 0.26);
  border-radius: 10px;
  padding: 10px;
  background: rgba(15, 28, 48, 0.72);
}

.shop-item.active {
  border-color: rgba(91, 160, 255, 0.9);
  box-shadow: inset 0 0 20px rgba(81, 153, 255, 0.16);
}

.shop-item h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.shop-stats {
  margin: 0 0 10px;
  color: #c9dcff;
  font-size: 13px;
}

.shop-price {
  margin: 0 0 10px;
  color: #95f6c5;
  font-size: 13px;
}

.shop-item button {
  width: 100%;
}

.shop-item .meta-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 12px;
  color: #b8cff4;
}

.game-over {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100vw - 32px));
  background: rgba(8, 14, 24, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 45px rgba(0, 0, 0, 0.52);
  z-index: 10;
}

.hidden {
  display: none;
}

input {
  margin-top: 8px;
  width: 100%;
  background: #0b1523;
  color: #eef4ff;
  border: 1px solid #2f4468;
  border-radius: 8px;
  padding: 9px 10px;
}

.buttons {
  margin-top: 12px;
  display: flex;
  gap: 10px;
}

.level-buttons {
  flex-direction: column;
}

.level-btn-meta {
  font-size: 12px;
  opacity: 0.88;
}

button {
  border: none;
  border-radius: 8px;
  padding: 9px 14px;
  cursor: pointer;
  background: linear-gradient(135deg, #3f7aff, #2f5ce2);
  color: #fff;
  font-weight: 600;
  transition: transform 0.12s ease, box-shadow 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 20px rgba(47, 92, 226, 0.35);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.6;
  transform: none;
  box-shadow: none;
}

.ghost-btn {
  background: transparent;
  border: 1px solid rgba(179, 205, 255, 0.42);
  color: #d7e5ff;
}

.ghost-btn:hover {
  box-shadow: 0 8px 20px rgba(179, 205, 255, 0.2);
}

.level-select p {
  margin: 0 0 8px;
  color: #b8c8e2;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    grid-template-rows: 1fr auto;
  }

  .leaderboard {
    max-height: 34vh;
  }
}
