:root {
  --bg: #15120f;
  --panel: rgba(34, 28, 22, 0.9);
  --panel-soft: rgba(49, 40, 31, 0.82);
  --line: rgba(255, 220, 168, 0.18);
  --text: #f7f2e9;
  --muted: #d8c7ab;
  --gold: #ffd071;
  --amber: #ffb24c;
  --olive: #5d7750;
  --steel: #94c7d6;
  --danger: #ff8458;
  --shadow: rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top, rgba(117, 89, 47, 0.22), transparent 36%),
    radial-gradient(circle at bottom right, rgba(77, 96, 61, 0.2), transparent 32%),
    linear-gradient(180deg, #2d2217 0%, #18120f 60%, #110e0c 100%);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
}

body {
  min-height: 100vh;
}

.shell {
  min-height: 100vh;
  padding: 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 380px;
  gap: 18px;
}

#game {
  width: 100%;
  height: calc(100vh - 36px);
  display: block;
  border-radius: 28px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(42, 33, 22, 0.98), rgba(24, 19, 15, 0.99)),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04), transparent 35%);
  box-shadow:
    inset 0 0 0 1px rgba(255, 236, 204, 0.04),
    0 28px 90px var(--shadow);
}

.hud {
  display: grid;
  gap: 14px;
  align-content: start;
}

.panel,
.card {
  border-radius: 24px;
  border: 1px solid var(--line);
  background:
    linear-gradient(180deg, rgba(42, 34, 25, 0.96), rgba(27, 22, 17, 0.94));
  box-shadow:
    inset 0 0 0 1px rgba(255, 246, 228, 0.04),
    0 18px 50px rgba(0, 0, 0, 0.24);
}

.panel {
  padding: 18px 18px 16px;
}

.hero h1,
.card h2 {
  margin: 6px 0 8px;
  font-size: clamp(28px, 4vw, 36px);
  letter-spacing: 0.04em;
}

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

.subtitle,
.legend,
.small {
  margin: 0;
  color: var(--muted);
}

.subtitle {
  margin-bottom: 14px;
}

.legend {
  font-size: 13px;
  line-height: 1.5;
}

.eyebrow {
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--gold);
}

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

.stat-card {
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(66, 53, 39, 0.72), rgba(44, 36, 28, 0.9));
  border: 1px solid rgba(255, 222, 175, 0.12);
}

.stat-label {
  display: block;
  font-size: 12px;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.chip {
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 212, 128, 0.2);
  background: rgba(255, 201, 103, 0.08);
  color: var(--gold);
  font-size: 12px;
}

.ammo-grid,
.ranking,
.summary {
  display: grid;
  gap: 10px;
}

.ammo-card,
.rank-row {
  padding: 12px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(57, 46, 35, 0.78), rgba(42, 34, 27, 0.92));
  border: 1px solid rgba(255, 221, 177, 0.1);
}

.ammo-card.selected {
  border-color: rgba(255, 208, 113, 0.46);
  box-shadow: inset 0 0 0 1px rgba(255, 208, 113, 0.18);
}

.ammo-headline,
.rank-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.ammo-name,
.rank-name {
  font-size: 16px;
  font-weight: 700;
}

.ammo-stock,
.rank-score {
  color: var(--gold);
  font-weight: 700;
}

.ammo-meta,
.rank-meta {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.ammo-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

button {
  font: inherit;
}

.ammo-btn,
.primary {
  appearance: none;
  border: 1px solid rgba(255, 223, 176, 0.18);
  border-radius: 14px;
  padding: 10px 14px;
  cursor: pointer;
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

.ammo-btn {
  background: rgba(255, 246, 228, 0.06);
  color: var(--text);
}

.ammo-btn:hover,
.primary:hover {
  transform: translateY(-1px);
}

.ammo-btn.active {
  border-color: rgba(255, 208, 113, 0.46);
  background: rgba(255, 208, 113, 0.12);
}

.ammo-btn.buy {
  background: rgba(93, 119, 80, 0.18);
  border-color: rgba(93, 119, 80, 0.42);
}

.ammo-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.primary {
  width: 100%;
  background: linear-gradient(180deg, #ffd67e 0%, #ffbb56 100%);
  color: #261a11;
  font-weight: 800;
  border-color: rgba(255, 201, 98, 0.72);
}

.overlay {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(10, 8, 7, 0.62);
  backdrop-filter: blur(7px);
}

.overlay.visible {
  display: flex;
}

.card {
  width: min(560px, calc(100vw - 32px));
  padding: 28px;
  text-align: center;
}

.rules {
  margin: 18px 0;
  border-radius: 18px;
  border: 1px solid rgba(255, 220, 168, 0.1);
  background: rgba(255, 247, 231, 0.04);
  overflow: hidden;
}

.rule-row {
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.rule-row + .rule-row {
  border-top: 1px solid rgba(255, 220, 168, 0.08);
}

.rule-row strong {
  color: var(--text);
}

.summary {
  margin: 18px 0;
  text-align: left;
}

.summary-row {
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(255, 246, 228, 0.05);
  border: 1px solid rgba(255, 220, 168, 0.08);
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.summary-row strong {
  color: var(--gold);
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%) translateY(24px);
  min-width: 220px;
  max-width: calc(100vw - 36px);
  padding: 12px 16px;
  border-radius: 14px;
  border: 1px solid rgba(255, 221, 177, 0.16);
  background: rgba(29, 24, 18, 0.92);
  color: var(--text);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
}

.toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1100px) {
  .shell {
    grid-template-columns: 1fr;
  }

  #game {
    height: min(68vh, 720px);
  }
}

@media (max-width: 720px) {
  .shell {
    padding: 10px;
    gap: 10px;
  }

  #game {
    height: 54vh;
    border-radius: 20px;
  }

  .panel,
  .card {
    border-radius: 18px;
  }

  .panel {
    padding: 14px;
  }

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

  .ammo-actions {
    flex-direction: column;
  }
}
