:root {
  --bg: #07110f;
  --panel: rgba(10, 21, 18, 0.88);
  --panel-strong: rgba(15, 29, 24, 0.96);
  --line: rgba(159, 255, 214, 0.16);
  --text: #e5fff3;
  --muted: #91b6a5;
  --accent: #6bff9b;
  --accent-deep: #18b96a;
  --enemy: #ff7bc3;
  --enemy-deep: #db4d9c;
  --steel: #b8c7d2;
  --brick: #d47b4b;
  --shadow: rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(55, 120, 88, 0.25), transparent 35%),
    linear-gradient(180deg, #081412 0%, #050908 100%);
  color: var(--text);
  font-family: "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

body {
  overflow-x: hidden;
}

.shell {
  width: min(1280px, calc(100vw - 24px));
  margin: 0 auto;
  padding: 18px 0 20px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(16, 28, 24, 0.9), rgba(8, 16, 14, 0.82));
  box-shadow: 0 18px 60px var(--shadow);
  backdrop-filter: blur(12px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-badge {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background:
    radial-gradient(circle at 35% 35%, #a5ffd0, #2dbd68 55%, #0b6d38 100%);
  box-shadow: 0 0 0 4px rgba(107, 255, 155, 0.12);
}

.brand h1 {
  margin: 0;
  font-size: clamp(22px, 2.5vw, 34px);
  letter-spacing: 0.08em;
}

.brand p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

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

.stat,
.mini-btn,
.info-item,
.primary-btn,
.utility-btn,
.shoot-btn,
.dpad button {
  border: 1px solid rgba(159, 255, 214, 0.16);
  background: rgba(16, 24, 21, 0.9);
  color: var(--text);
  border-radius: 16px;
}

.stat {
  min-width: 88px;
  padding: 10px 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

.stat span,
.info-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 4px;
}

.stat strong,
.info-item strong {
  font-size: 20px;
}

.mini-btn,
.primary-btn,
.utility-btn,
.shoot-btn,
.dpad button {
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

.mini-btn:hover,
.primary-btn:hover,
.utility-btn:hover,
.shoot-btn:hover,
.dpad button:hover {
  transform: translateY(-1px);
  border-color: rgba(107, 255, 155, 0.4);
}

.mini-btn {
  padding: 10px 14px;
}

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(280px, 0.9fr);
  gap: 16px;
  align-items: start;
}

.stage-card,
.info-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(11, 20, 18, 0.92), rgba(7, 13, 11, 0.95));
  box-shadow: 0 20px 60px var(--shadow);
}

.stage-card {
  padding: 14px;
}

.stage-frame {
  position: relative;
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid rgba(107, 255, 155, 0.15);
  background:
    radial-gradient(circle at 20% 20%, rgba(107, 255, 155, 0.08), transparent 28%),
    linear-gradient(180deg, #091513, #06100d);
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 15 / 10;
  image-rendering: pixelated;
}

.overlay {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: rgba(3, 7, 6, 0.65);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

.overlay--visible {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  width: min(420px, calc(100% - 32px));
  padding: 24px;
  border-radius: 24px;
  background: var(--panel);
  border: 1px solid rgba(107, 255, 155, 0.16);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  text-align: center;
}

.panel--danger {
  border-color: rgba(255, 123, 195, 0.32);
}

.panel h2 {
  margin: 0 0 8px;
  font-size: 32px;
}

.panel p {
  margin: 0 0 12px;
  color: var(--muted);
  line-height: 1.6;
}

.panel ul {
  list-style: none;
  padding: 0;
  margin: 14px 0 22px;
  display: grid;
  gap: 8px;
  color: #d4f5e4;
}

.primary-btn {
  padding: 12px 22px;
  background: linear-gradient(180deg, #31d37a, #14884b);
  border-color: rgba(107, 255, 155, 0.35);
  font-weight: 700;
}

.info-card {
  padding: 18px;
}

.info-card h3 {
  margin: 0 0 16px;
  font-size: 20px;
}

.info-grid {
  display: grid;
  gap: 12px;
}

.info-item {
  padding: 14px 14px 12px;
}

.tip {
  margin: 16px 0;
  color: #b8d6c7;
  line-height: 1.7;
}

.legend {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  color: #dcefe7;
}

.legend span {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.04);
}

.swatch {
  width: 16px;
  height: 16px;
  border-radius: 5px;
  display: inline-block;
}

.swatch--player {
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
}

.swatch--enemy {
  background: linear-gradient(180deg, var(--enemy), var(--enemy-deep));
}

.swatch--brick {
  background: linear-gradient(180deg, #e09a67, #a45c2e);
}

.swatch--steel {
  background: linear-gradient(180deg, #dce7f0, #8ea5b7);
}

.pause-badge {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(7, 14, 12, 0.9);
  border: 1px solid rgba(107, 255, 155, 0.24);
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.08em;
}

.touch-controls {
  display: none;
  margin-top: 14px;
  gap: 10px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.dpad {
  display: grid;
  gap: 8px;
  justify-items: center;
}

.dpad-row {
  display: grid;
  grid-template-columns: repeat(3, 54px);
  gap: 8px;
}

.dpad button,
.shoot-btn,
.utility-btn {
  min-width: 54px;
  min-height: 54px;
  font-size: 18px;
}

.shoot-btn {
  padding: 0 20px;
  background: linear-gradient(180deg, #ff7bc3, #be3f88);
  border-color: rgba(255, 123, 195, 0.4);
  font-weight: 700;
}

.utility-btn {
  padding: 0 18px;
}

@media (max-width: 1080px) {
  .game-layout {
    grid-template-columns: 1fr;
  }

  .info-card {
    order: 2;
  }
}

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

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

  .stats {
    width: 100%;
  }

  .stat {
    flex: 1 1 0;
    min-width: 0;
  }

  .touch-controls {
    display: flex;
  }
}
