:root {
  --sky-top: #1e6fd9;
  --sky-mid: #6ec6ff;
  --sky-low: #cdeeff;
  --ink: #0d2436;
  --panel: #10243f;
  --panel-2: #16345a;
  --gold: #ffc93c;
  --gold-2: #ff9d2e;
  --red: #ff5c5c;
  --red-2: #d63b3b;
  --blue: #46b6ff;
  --blue-2: #2d8de0;
  --green: #37d67a;
  --paper: #f4f7fb;
  --radius-lg: 18px;
  --radius-md: 12px;
  --shadow-hard: 0 6px 0 rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: 'Trebuchet MS', 'Segoe UI', Verdana, sans-serif;
  background: radial-gradient(circle at 50% -10%, #2a86ef 0%, #0c3e78 60%, #06213f 100%);
  color: var(--paper);
  min-height: 100vh;
}

.app {
  max-width: 1080px;
  margin: 0 auto;
  padding: 14px 14px 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Focus visibility */
a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

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

.brand-logo {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.brand-badge {
  font-size: 30px;
  filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.25));
}

.brand-text h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 3px;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
  color: var(--gold);
}

.brand-text p {
  margin: 0;
  font-size: 12px;
  color: #cfe8ff;
  opacity: 0.85;
}

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

/* ---------- Mode selector ---------- */
.mode-selector {
  display: flex;
  align-items: center;
  background: rgba(8, 20, 36, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius-md);
  padding: 3px;
  gap: 3px;
}

.mode-btn {
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 7px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: #cfe8ff;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

.mode-btn:hover:not(.is-selected) {
  background: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.mode-btn.is-selected {
  background: linear-gradient(180deg, #3d88e8, #1e5fc2);
  color: #ffffff;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

/* ---------- Buttons ---------- */
.btn {
  font-family: inherit;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-md);
  padding: 10px 16px;
  cursor: pointer;
  color: #14243a;
  box-shadow: var(--shadow-hard);
  transition: transform 0.08s ease, box-shadow 0.08s ease, filter 0.15s ease;
}

.btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.28);
}

.btn:disabled {
  cursor: not-allowed;
  filter: grayscale(0.6) brightness(0.75);
  transform: none;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.2);
}

.btn-profile {
  background: linear-gradient(180deg, #244670, #152d4d);
  color: #ebf5ff;
  border: 1px solid rgba(255, 201, 60, 0.35);
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  padding: 8px 12px;
}

.btn-profile:hover {
  border-color: var(--gold);
  background: linear-gradient(180deg, #2f568a, #1b385e);
}

.top-coin-badge {
  background: rgba(0, 0, 0, 0.35);
  color: var(--gold);
  border: 1px solid rgba(255, 201, 60, 0.3);
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.btn-restart {
  background: linear-gradient(180deg, #ffe08a, var(--gold));
}

.btn-daily {
  background: linear-gradient(180deg, #a78bfa, #7c3aed);
  color: #f3e8ff;
  font-size: 12px;
  padding: 8px 12px;
}

.btn-mute {
  background: linear-gradient(180deg, #1f3d63, #122842);
  color: #d8ecff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 9px 13px;
}

.btn-mute.is-muted {
  color: #ff9d9d;
  border-color: rgba(255, 120, 120, 0.35);
  background: linear-gradient(180deg, #3a1c22, #241014);
}

.btn-primary {
  background: linear-gradient(180deg, #8be59a, var(--green));
  color: #0a2a17;
  font-size: 16px;
  padding: 12px 22px;
}

.btn-shoot {
  background: linear-gradient(180deg, #ff9a6b, var(--red));
  color: #3a0d0d;
  font-size: 18px;
  padding: 14px;
  width: 100%;
  letter-spacing: 1px;
}

/* ---------- HUD row ---------- */
.hud-row {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 10px;
  align-items: center;
}

.hp-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-radius: var(--radius-md);
  padding: 8px 12px;
  box-shadow: var(--shadow-hard);
}

.hp-name {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 1px;
  opacity: 0.85;
}

.hp-bot {
  text-align: right;
}

.hp-bar {
  position: relative;
  height: 16px;
  border-radius: 10px;
  background: #0a1626;
  overflow: hidden;
  margin: 4px 0 2px;
  border: 2px solid rgba(255, 255, 255, 0.08);
}

.hp-fill {
  height: 100%;
  width: 100%;
  transition: width 0.4s ease;
}

.hp-fill-human {
  background: linear-gradient(90deg, var(--blue-2), var(--blue));
}

.hp-fill-bot {
  background: linear-gradient(90deg, var(--red), var(--red-2));
  margin-left: auto;
}

.hp-num {
  font-size: 12px;
  font-weight: 700;
  opacity: 0.9;
}

.turn-card {
  min-width: 160px;
  text-align: center;
}

.turn-card-top {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  margin-bottom: 4px;
}

.room-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1px;
  background: linear-gradient(135deg, #0284c7, #0369a1);
  color: #e0f2fe;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(186, 230, 253, 0.4);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.hp-bot-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.enemy-archetype-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.2);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.boss-phase-badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fee2e2;
  border: 1px solid #fca5a5;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.5);
  animation: pulseGlow 1.5s infinite alternate;
}

@keyframes pulseGlow {
  from { box-shadow: 0 0 4px rgba(239, 68, 68, 0.4); }
  to { box-shadow: 0 0 10px rgba(239, 68, 68, 0.8); }
}

.turn-label {
  font-weight: 800;
  letter-spacing: 1px;
  color: var(--gold);
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.3);
  margin-bottom: 4px;
  font-size: 14px;
}

.timer-track {
  height: 8px;
  border-radius: 6px;
  background: #0a1626;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.timer-fill {
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, var(--green), var(--gold));
  transition: width 0.2s linear;
}

/* ---------- Battlefield ---------- */
.field {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 10px 0 rgba(0, 0, 0, 0.32), 0 0 0 4px rgba(255, 255, 255, 0.06) inset;
  line-height: 0;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 960 / 540;
  background: linear-gradient(180deg, var(--sky-top), var(--sky-mid) 70%, var(--sky-low));
  touch-action: none;
  cursor: crosshair;
}

.field-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.field-top-badges {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

.wind-chip {
  background: rgba(8, 20, 36, 0.72);
  border: 2px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.vulnerability-chip {
  background: linear-gradient(135deg, #e11d48, #9f1239);
  color: #ffe4e6;
  border: 2px solid #fda4af;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(225, 29, 72, 0.6);
  animation: bannerPop 0.25s ease;
}

.modifier-badge {
  background: linear-gradient(135deg, #0d9488, #115e59);
  color: #ccfbf1;
  border: 2px solid #5eead4;
  border-radius: 999px;
  padding: 6px 14px;
  font-weight: 800;
  font-size: 12px;
  letter-spacing: 0.5px;
  box-shadow: 0 0 10px rgba(13, 148, 136, 0.55);
  animation: bannerPop 0.25s ease;
}

.wind-arrow {
  display: inline-block;
  font-size: 15px;
  transition: transform 0.3s ease;
}

.banner {
  margin-top: 14px;
  background: rgba(10, 12, 20, 0.78);
  border: 2px solid var(--gold);
  color: var(--gold);
  font-weight: 800;
  letter-spacing: 2px;
  padding: 8px 22px;
  border-radius: 10px;
  font-size: 15px;
  animation: bannerPop 0.25s ease;
}

.boss-telegraph {
  margin-top: 10px;
  background: rgba(26, 12, 40, 0.88);
  border: 2px solid #c084fc;
  color: #f3e8ff;
  font-weight: 800;
  letter-spacing: 0.5px;
  padding: 8px 18px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 4px 12px rgba(192, 132, 252, 0.35);
  animation: bannerPop 0.25s ease;
  max-width: 85%;
  text-align: center;
}

@keyframes bannerPop {
  from { transform: translateY(-10px) scale(0.92); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

.toast {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  background: rgba(8, 20, 36, 0.82);
  border: 2px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  max-width: 90%;
  text-align: center;
  min-height: 1em;
}

.gameover-overlay,
.handoff-overlay,
.roomclear-overlay {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 20, 0.76);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 10;
}

.handoff-overlay,
.roomclear-overlay {
  backdrop-filter: blur(2px);
}

.gameover-card,
.handoff-card,
.roomclear-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-radius: var(--radius-lg);
  padding: 26px 32px;
  text-align: center;
  box-shadow: var(--shadow-hard);
  border: 2px solid rgba(255, 255, 255, 0.12);
  animation: bannerPop 0.25s ease;
}

.roomclear-card {
  border-color: var(--green);
  max-width: 460px;
  width: 90%;
}

.handoff-card {
  border-color: var(--gold);
  max-width: 440px;
  width: 90%;
}

.handoff-icon,
.roomclear-icon {
  font-size: 34px;
  margin-bottom: 4px;
}

.gameover-card h2,
.handoff-card h2,
.roomclear-card h2 {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 26px;
  letter-spacing: 1px;
}

.roomclear-card h2 {
  color: var(--green);
}

.gameover-card p,
.handoff-card p,
.roomclear-card p {
  margin: 0 0 16px;
  font-size: 14px;
  color: #dcecff;
  line-height: 1.4;
}

.roomclear-rewards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 12px;
}

.reward-pill-item {
  font-size: 13px;
  font-weight: 800;
  padding: 6px 14px;
  border-radius: 999px;
  background: rgba(8, 20, 36, 0.8);
  border: 1px solid var(--gold);
  color: var(--gold);
}

.reward-pill-item.heal {
  border-color: var(--green);
  color: #86efac;
}

.roomclear-hp-status {
  font-size: 13px;
  font-weight: 700;
  color: #cfe8ff;
  margin-bottom: 16px;
}

.roomclear-btn {
  width: 100%;
  font-size: 16px;
  padding: 12px 24px;
}

.gameover-reward-badge {
  background: rgba(8, 20, 36, 0.8);
  border: 1px solid var(--gold);
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 16px;
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  display: inline-block;
}

.handoff-card .handoff-hint {
  margin: 12px 0 0;
  font-size: 11px;
  opacity: 0.75;
}

.handoff-btn {
  width: 100%;
  font-size: 16px;
  padding: 12px 24px;
}

/* ---------- Controls ---------- */
.controls {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow-hard);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 18px;
}

.control-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-block label {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

input[type='range'] {
  width: 100%;
  height: 10px;
  border-radius: 6px;
  background: #0a1626;
  appearance: none;
  -webkit-appearance: none;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

input[type='range']::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid #4a3300;
  cursor: pointer;
  box-shadow: 0 3px 0 rgba(0, 0, 0, 0.3);
}

input[type='range']::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  border: 3px solid #4a3300;
  cursor: pointer;
}

input[type='range']:disabled {
  opacity: 0.5;
}

.weapons {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.weapon-btn {
  font-family: inherit;
  text-align: left;
  background: #0e2038;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--paper);
  padding: 10px 12px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 3px;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.08s ease;
}

.weapon-btn:hover:not(:disabled) {
  border-color: var(--gold);
}

.weapon-btn:active:not(:disabled) {
  transform: translateY(2px);
}

.weapon-btn.is-selected {
  border-color: var(--gold);
  background: #1b3557;
  box-shadow: 0 0 0 2px rgba(255, 201, 60, 0.35) inset;
}

.weapon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.weapon-btn.is-locked {
  background: #0a1626;
  border-color: rgba(255, 255, 255, 0.08);
  opacity: 0.85;
  cursor: pointer;
}

.weapon-btn.is-locked:hover {
  border-color: #c084fc;
}

.weapon-lock-cost {
  align-self: flex-end;
  font-size: 12px;
  font-weight: 800;
  color: #c084fc;
  background: rgba(192, 132, 252, 0.15);
  border: 1px solid rgba(192, 132, 252, 0.4);
  padding: 1px 8px;
  border-radius: 999px;
}

.weapon-btn-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.weapon-name {
  font-weight: 800;
  font-size: 13px;
}

.weapon-lvl-tag {
  font-size: 10px;
  font-weight: 800;
  background: rgba(255, 201, 60, 0.2);
  color: var(--gold);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 201, 60, 0.4);
}

.weapon-desc {
  font-size: 11px;
  opacity: 0.8;
  line-height: 1.3;
}

.weapon-ammo {
  align-self: flex-end;
  font-size: 12px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(0, 0, 0, 0.25);
  padding: 1px 8px;
  border-radius: 999px;
}

/* ---------- Charge Area ---------- */
.charge-area {
  grid-column: 1 / -1;
  background: #0a182a;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.charge-area.is-charging {
  border-color: var(--gold);
  background: #112847;
  box-shadow: 0 0 12px rgba(255, 201, 60, 0.4), 0 0 0 1px rgba(255, 201, 60, 0.3) inset;
}

.charge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.charge-title {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: #79aee0;
  text-transform: uppercase;
}

.charge-area.is-charging .charge-title {
  color: var(--gold);
  text-shadow: 0 0 6px rgba(255, 201, 60, 0.6);
}

.charge-percentage {
  font-size: 14px;
  font-weight: 900;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}

.charge-meter-track {
  position: relative;
  height: 14px;
  border-radius: 8px;
  background: #06101c;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.charge-meter-fill {
  height: 100%;
  width: 70%;
  background: linear-gradient(90deg, #37d67a 0%, #ffc93c 65%, #ff5c5c 100%);
  border-radius: 6px;
  transition: width 0.05s linear;
}

.charge-area.is-charging .charge-meter-fill {
  box-shadow: 0 0 10px rgba(255, 201, 60, 0.85);
}

.charge-help-text {
  font-size: 11px;
  font-weight: 700;
  color: #cfe8ff;
  opacity: 0.85;
  text-align: center;
  letter-spacing: 0.5px;
}

.btn-shoot {
  grid-column: 1 / -1;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

.btn-shoot.is-charging {
  background: linear-gradient(180deg, #ffd15c, #ff4d4d);
  box-shadow: 0 0 16px rgba(255, 92, 92, 0.65), var(--shadow-hard);
  transform: translateY(2px);
}

.hint {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 11px;
  opacity: 0.75;
  text-align: center;
}

/* ---------- Event log card ---------- */
.event-log-card {
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border-radius: var(--radius-md);
  padding: 12px 16px;
  box-shadow: var(--shadow-hard);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.event-log-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.event-log-title {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--gold);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}

.event-log-count {
  font-size: 11px;
  opacity: 0.7;
  color: #cfe8ff;
}

.event-log-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-height: 80px;
}

.event-log-item {
  font-size: 12px;
  line-height: 1.35;
  padding: 6px 10px;
  border-radius: 6px;
  background: rgba(8, 20, 36, 0.55);
  display: flex;
  align-items: center;
  gap: 8px;
  border-left: 3px solid var(--blue);
  color: #e5f1ff;
  animation: logSlide 0.2s ease;
}

@keyframes logSlide {
  from { opacity: 0; transform: translateX(-6px); }
  to { opacity: 1; transform: translateX(0); }
}

.event-log-item.player-hit {
  border-left-color: var(--gold);
  background: rgba(45, 36, 12, 0.45);
  color: #fff6d6;
}

.event-log-item.bot-hit {
  border-left-color: var(--red);
  background: rgba(48, 16, 20, 0.45);
  color: #ffd8d8;
}

.event-log-item.miss {
  border-left-color: #728ca6;
  background: rgba(12, 22, 34, 0.45);
  color: #cbd8e6;
}

.event-log-item.system {
  border-left-color: var(--green);
  background: rgba(14, 40, 26, 0.45);
  color: #d6fce0;
}

/* ==================== Profile / Loadout Modal ==================== */
.profile-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
  animation: fadeIn 0.2s ease;
}

.profile-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(4, 10, 20, 0.82);
  backdrop-filter: blur(4px);
}

.profile-card {
  position: relative;
  z-index: 101;
  background: linear-gradient(180deg, #163254, #0d2138);
  border: 2px solid rgba(255, 201, 60, 0.35);
  border-radius: var(--radius-lg);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.6), var(--shadow-hard);
  max-width: 760px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: bannerPop 0.25s ease;
}

.profile-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: rgba(8, 20, 36, 0.7);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.profile-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.profile-badge-icon {
  font-size: 28px;
}

.profile-card-header h2 {
  margin: 0;
  font-size: 20px;
  color: var(--gold);
  letter-spacing: 1px;
}

.profile-subtitle {
  margin: 2px 0 0;
  font-size: 12px;
  color: #cfe8ff;
  opacity: 0.8;
}

.profile-close-btn {
  background: transparent;
  border: none;
  color: #cfe8ff;
  font-size: 22px;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 10px;
  border-radius: 8px;
  transition: background 0.15s ease, color 0.15s ease;
}

.profile-close-btn:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.profile-body {
  padding: 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.profile-section {
  background: rgba(8, 20, 36, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  flex-wrap: wrap;
  gap: 6px;
}

.section-title {
  margin: 0;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--gold);
}

.section-hint {
  font-size: 11px;
  color: #cfe8ff;
  opacity: 0.75;
}

/* Vault Card */
.coin-vault-card {
  background: linear-gradient(135deg, rgba(30, 60, 95, 0.65), rgba(12, 28, 48, 0.85));
  border-color: rgba(255, 201, 60, 0.4);
}

.coin-vault-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 10px;
}

.coin-icon {
  font-size: 32px;
}

.coin-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: #cfe8ff;
  opacity: 0.8;
}

.coin-amount {
  font-size: 26px;
  font-weight: 900;
  color: var(--gold);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.coin-rule-pills {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.rule-pill {
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #cfe8ff;
}

.rule-pill.win {
  border-color: rgba(255, 201, 60, 0.4);
  color: #ffe699;
}

.rule-pill.loss {
  border-color: rgba(70, 182, 255, 0.4);
  color: #cbe9ff;
}

.rule-pill.dual {
  border-color: rgba(55, 214, 122, 0.4);
  color: #c0f7d5;
}

.rule-pill.dungeon {
  border-color: rgba(192, 132, 252, 0.45);
  color: #f3e8ff;
}

.rule-pill.practice {
  border-color: rgba(255, 255, 255, 0.2);
  color: #a8c4de;
}

/* Cosmetics Wardrobe Grid */
.cosmetics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.cosmetic-card {
  background: #0a182a;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.15s ease;
}

.cosmetic-card.is-equipped {
  border-color: var(--gold);
  background: #112642;
  box-shadow: 0 0 0 1px rgba(255, 201, 60, 0.3) inset;
}

.cosmetic-icon-wrap {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
}

.cosmetic-icon {
  font-size: 24px;
}

.cosmetic-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.cosmetic-slot {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #79aee0;
  text-transform: uppercase;
}

.cosmetic-name {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

.cosmetic-desc {
  font-size: 11px;
  color: #cfe8ff;
  opacity: 0.75;
  line-height: 1.3;
}

.cosmetic-toggle-btn {
  font-size: 12px;
  padding: 7px 12px;
  background: linear-gradient(180deg, #2a5280, #173659);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.cosmetic-toggle-btn.is-equipped {
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  color: #14243a;
  border-color: var(--gold);
}

/* Upgrades Grid */
.upgrades-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.upgrade-card {
  background: #0a182a;
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.upgrade-card.is-max {
  border-color: rgba(55, 214, 122, 0.45);
}

.upgrade-card.is-locked {
  opacity: 0.65;
}

.upgrade-badge.is-locked {
  color: #c084fc;
  background: rgba(192, 132, 252, 0.15);
  border-color: rgba(192, 132, 252, 0.3);
}

/* Pilot Record */
.pilot-rank-badge {
  font-weight: 800;
  color: var(--gold);
  background: rgba(255, 201, 60, 0.15);
  border: 1px solid rgba(255, 201, 60, 0.35);
  padding: 2px 10px;
  border-radius: 999px;
}

.pilot-record-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.pilot-stat-card {
  background: #0a182a;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.pilot-stat-label {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #79aee0;
  text-transform: uppercase;
}

.pilot-stat-value {
  font-size: 17px;
  font-weight: 900;
  color: #ffffff;
}

/* Match Summary Panel (Game Over overlay) */
.match-summary-panel {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  background: rgba(8, 20, 36, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 10px 14px;
  margin-bottom: 12px;
  text-align: left;
}

.match-summary-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
}

.match-summary-label {
  color: #9eccff;
  font-weight: 700;
}

.match-summary-value {
  color: #ffffff;
  font-weight: 800;
}

.next-recommendation {
  font-size: 12px;
  color: #8be59a;
  background: rgba(14, 40, 26, 0.45);
  border-left: 2px solid var(--green);
  padding: 6px 10px;
  border-radius: 6px;
  margin: 0 0 16px;
  text-align: left;
  line-height: 1.35;
}

.upgrade-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 6px;
}

.upgrade-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upgrade-name {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

.upgrade-badge {
  font-size: 10px;
  font-weight: 800;
  color: var(--gold);
  background: rgba(255, 201, 60, 0.15);
  padding: 1px 6px;
  border-radius: 4px;
  border: 1px solid rgba(255, 201, 60, 0.3);
  display: inline-block;
  width: fit-content;
}

.upgrade-pips {
  display: flex;
  gap: 4px;
  margin-top: 2px;
}

.pip {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.pip.is-filled {
  background: var(--gold);
  border-color: #ffd875;
  box-shadow: 0 0 6px rgba(255, 201, 60, 0.5);
}

.upgrade-stats {
  font-size: 11px;
  font-weight: 700;
  color: #9eccff;
  line-height: 1.35;
}

.upgrade-next {
  font-size: 11px;
  color: #8be59a;
  background: rgba(14, 40, 26, 0.45);
  padding: 4px 6px;
  border-radius: 6px;
  border-left: 2px solid var(--green);
  line-height: 1.3;
}

.upgrade-next.is-max {
  color: #ffd875;
  background: rgba(45, 36, 12, 0.45);
  border-left-color: var(--gold);
}

.upgrade-buy-btn {
  font-size: 12px;
  padding: 8px 12px;
  background: linear-gradient(180deg, #ffe08a, var(--gold));
  color: #14243a;
  margin-top: auto;
}

.upgrade-buy-btn:disabled {
  background: #1e334d;
  color: #7997ba;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.upgrade-buy-btn.is-max {
  background: rgba(55, 214, 122, 0.2);
  color: #37d67a;
  border: 1px solid rgba(55, 214, 122, 0.4);
  cursor: default;
  filter: none;
}

/* Reset Section */
.reset-section {
  border-color: rgba(255, 92, 92, 0.25);
  background: rgba(40, 14, 18, 0.35);
}

.reset-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.reset-info {
  flex: 1;
  min-width: 200px;
}

.reset-title {
  font-size: 13px;
  font-weight: 800;
  color: #ff9d9d;
  margin-bottom: 2px;
}

.reset-desc {
  font-size: 11px;
  color: #cfe8ff;
  opacity: 0.75;
  line-height: 1.35;
}

.btn-danger {
  background: linear-gradient(180deg, #3d1b22, #260e13);
  color: #ff9d9d;
  border: 1px solid rgba(255, 92, 92, 0.4);
  font-size: 12px;
  padding: 8px 14px;
}

.btn-danger:hover {
  background: linear-gradient(180deg, #57202b, #331118);
  border-color: var(--red);
  color: #ffffff;
}

/* Reset Confirmation Modal */
.reset-confirm-modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 16px;
  animation: fadeIn 0.15s ease;
}

.reset-confirm-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 12, 0.88);
}

.reset-confirm-card {
  position: relative;
  z-index: 201;
  background: linear-gradient(180deg, #241419, #150a0e);
  border: 2px solid var(--red);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  text-align: center;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.7);
  animation: bannerPop 0.2s ease;
}

.reset-confirm-icon {
  font-size: 36px;
  margin-bottom: 6px;
}

.reset-confirm-card h3 {
  margin: 0 0 8px;
  color: #ff9d9d;
  font-size: 20px;
}

.reset-confirm-card p {
  margin: 0 0 18px;
  font-size: 13px;
  color: #dcecff;
  line-height: 1.4;
  opacity: 0.88;
}

.reset-confirm-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-cancel {
  background: #1f3d63;
  color: #d8ecff;
  border: 1px solid rgba(255, 255, 255, 0.16);
  flex: 1;
}

.btn-danger-confirm {
  background: linear-gradient(180deg, #ff7a7a, var(--red));
  color: #2b0808;
  flex: 1;
}

.foot {
  text-align: center;
  font-size: 11px;
  opacity: 0.6;
}

.foot p {
  margin: 0;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* ---------- Responsive: narrow / mobile ---------- */
@media (max-width: 640px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .brand {
    justify-content: center;
  }

  .brand-text h1 {
    font-size: 20px;
  }

  .top-actions {
    justify-content: space-between;
    width: 100%;
  }

  .mode-selector {
    flex: 1;
    justify-content: center;
  }

  .mode-btn {
    flex: 1;
    text-align: center;
    padding: 6px 8px;
  }

  .btn-profile {
    padding: 7px 10px;
    font-size: 12px;
  }

  .btn-mute {
    padding: 7px 10px;
    font-size: 12px;
  }

  .btn-restart {
    padding: 7px 12px;
    font-size: 12px;
  }

  .hud-row {
    grid-template-columns: 1fr;
    text-align: center;
  }

  .hp-bot {
    text-align: center;
  }

  .hp-fill-bot {
    margin-left: 0;
  }

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

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

  .gameover-card,
  .handoff-card {
    padding: 20px 18px;
    width: 88%;
  }

  .cosmetics-grid,
  .upgrades-grid,
  .pilot-record-grid {
    grid-template-columns: 1fr;
  }

  .match-summary-panel {
    grid-template-columns: 1fr;
  }

  .top-actions {
    flex-wrap: wrap;
  }
}

@media (max-width: 900px) and (min-width: 641px) {
  .weapons,
  .upgrades-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
