* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #05070a;
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  color: #e8f0f5;
  user-select: none;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
}

.hidden {
  display: none !important;
}

/* ---------- Crosshair ---------- */

.crosshair {
  position: fixed;
  top: 50%;
  left: 50%;
  width: 22px;
  height: 22px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  z-index: 5;
}

.crosshair-line {
  position: absolute;
  background: rgba(232, 240, 245, 0.85);
  box-shadow: 0 0 2px rgba(0, 0, 0, 0.8);
}

/* two short segments per axis, leaving a gap around the center dot */
.crosshair-line.horizontal {
  top: 50%;
  left: 0;
  width: 7px;
  height: 2px;
  transform: translateY(-50%);
  box-shadow: 15px 0 0 rgba(232, 240, 245, 0.85);
}

.crosshair-line.vertical {
  left: 50%;
  top: 0;
  width: 2px;
  height: 7px;
  transform: translateX(-50%);
  box-shadow: 0 15px 0 rgba(232, 240, 245, 0.85);
}

.crosshair-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #ffd76a;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 3px rgba(255, 215, 106, 0.8);
}

/* ---------- HUD ---------- */

.hud {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  padding: 16px 20px;
  pointer-events: none;
  z-index: 5;
}

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

.hud-pill {
  background: rgba(10, 14, 20, 0.72);
  border: 1px solid rgba(120, 200, 255, 0.25);
  border-radius: 999px;
  padding: 7px 16px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: 0.3px;
  backdrop-filter: blur(4px);
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
}

.money-pill {
  color: #ffd76a;
  border-color: rgba(255, 215, 106, 0.35);
}

.bars {
  max-width: 340px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(10, 14, 20, 0.72);
  border: 1px solid rgba(120, 200, 255, 0.2);
  border-radius: 10px;
  padding: 7px 12px;
  backdrop-filter: blur(4px);
}

.bar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #9db3c2;
  width: 40px;
}

.bar-track {
  flex: 1;
  height: 10px;
  background: rgba(255,255,255,0.08);
  border-radius: 6px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  width: 100%;
  border-radius: 6px;
  transition: width 0.15s ease-out, background-color 0.3s ease;
}

.hull-fill {
  background: linear-gradient(90deg, #4ee08a, #7dff9e);
}

.bar-value {
  font-size: 12px;
  font-weight: 600;
  color: #cfe0ea;
  width: 68px;
  text-align: right;
}

.hud-hint {
  margin-top: 10px;
  font-size: 12px;
  color: rgba(220, 232, 240, 0.65);
  background: rgba(10, 14, 20, 0.55);
  display: inline-block;
  padding: 5px 10px;
  border-radius: 6px;
}

/* ---------- Abilities ---------- */

.ability-bar {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 16px;
  z-index: 5;
  pointer-events: none;
}

.ability-slot {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: rgba(10, 14, 20, 0.78);
  border: 2px solid rgba(120, 200, 255, 0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ability-slot .ability-icon {
  font-size: 24px;
  z-index: 2;
  filter: drop-shadow(0 1px 3px rgba(0, 0, 0, 0.85));
  opacity: 0.5;
  transition: opacity 0.2s ease;
}

.ability-slot.ready .ability-icon,
.ability-slot.active .ability-icon {
  opacity: 1;
}

.ability-slot .ability-key {
  position: absolute;
  bottom: 2px;
  right: 4px;
  font-size: 9px;
  font-weight: 800;
  color: #cfe0ea;
  z-index: 2;
  background: rgba(0, 0, 0, 0.45);
  padding: 1px 4px;
  border-radius: 4px;
  letter-spacing: 0.5px;
}

.ability-cooldown-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(5, 7, 10, 0.8);
  height: 0%;
  z-index: 1;
  transition: height 0.1s linear;
}

.ability-slot.ready {
  border-color: rgba(255, 215, 106, 0.6);
  box-shadow: 0 0 10px rgba(255, 215, 106, 0.25);
}

.ability-slot.active {
  border-color: #ffd76a;
  box-shadow: 0 0 18px rgba(255, 215, 106, 0.65);
  animation: abilityPulse 0.6s ease-in-out infinite alternate;
}

@keyframes abilityPulse {
  from { box-shadow: 0 0 10px rgba(255, 215, 106, 0.4); }
  to { box-shadow: 0 0 22px rgba(255, 215, 106, 0.85); }
}

/* ---------- Buttons ---------- */

.top-left-buttons {
  position: fixed;
  top: 16px;
  right: 20px;
  display: flex;
  gap: 8px;
  z-index: 6;
}

.ui-button {
  pointer-events: all;
  background: rgba(15, 20, 28, 0.8);
  border: 1px solid rgba(120, 200, 255, 0.3);
  color: #e8f0f5;
  font-size: 14px;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.1s ease;
}

.ui-button:hover {
  background: rgba(40, 60, 80, 0.9);
  transform: translateY(-1px);
}

.admin-button {
  border-color: rgba(216, 166, 255, 0.4);
  color: #d8a6ff;
}

.admin-button:hover {
  background: rgba(120, 60, 160, 0.35);
}

.admin-toast {
  position: fixed;
  top: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(20, 12, 28, 0.92);
  border: 1px solid rgba(216, 166, 255, 0.5);
  color: #d8a6ff;
  font-weight: 700;
  font-size: 14px;
  padding: 12px 22px;
  border-radius: 10px;
  box-shadow: 0 0 24px rgba(216, 166, 255, 0.3);
  z-index: 8;
  pointer-events: none;
  animation: adminToastFade 2.6s ease forwards;
}

@keyframes adminToastFade {
  0% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
  12% { opacity: 1; transform: translateX(-50%) translateY(0); }
  82% { opacity: 1; }
  100% { opacity: 0; transform: translateX(-50%) translateY(-8px); }
}

/* ---------- Floating combat text ---------- */

.float-text-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 4;
  overflow: hidden;
}

.float-text {
  position: absolute;
  font-weight: 800;
  font-size: 15px;
  text-shadow: 0 1px 3px rgba(0,0,0,0.8);
  transform: translate(-50%, -50%);
  animation: floatUp 0.85s ease-out forwards;
  white-space: nowrap;
}

.float-text.dmg { color: #ff6b6b; }
.float-text.money { color: #ffd76a; }

@keyframes floatUp {
  0% { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
  100% { opacity: 0; transform: translate(-50%, -50%) translateY(-46px); }
}

/* ---------- Overlays ---------- */

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(3, 5, 8, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  backdrop-filter: blur(3px);
}

.overlay-panel {
  background: linear-gradient(160deg, #131a22, #0b0f14);
  border: 1px solid rgba(120, 200, 255, 0.22);
  border-radius: 16px;
  padding: 34px 38px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}

.overlay-panel h1 {
  margin: 0 0 4px;
  font-size: 30px;
  letter-spacing: 1px;
  color: #ffd76a;
  text-shadow: 0 0 18px rgba(255, 215, 106, 0.35);
}

.subtitle {
  margin: 0 0 16px;
  color: #7dc4ff;
  font-weight: 600;
  letter-spacing: 2px;
  font-size: 13px;
  text-transform: uppercase;
}

.desc {
  color: #b9c8d3;
  font-size: 14px;
  line-height: 1.5;
  margin-bottom: 18px;
}

.controls-list {
  text-align: left;
  list-style: none;
  padding: 0;
  margin: 0 0 22px;
  color: #cfe0ea;
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 10px;
  padding: 12px 16px;
}

.play-button {
  background: linear-gradient(160deg, #ffb84a, #ff7a3d);
  border: none;
  color: #2a1400;
  font-weight: 800;
  font-size: 16px;
  padding: 13px 30px;
  border-radius: 10px;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(255, 130, 60, 0.35);
  transition: transform 0.12s ease;
}

.play-button:hover {
  transform: translateY(-2px);
}

.play-button.secondary {
  background: rgba(255,255,255,0.08);
  color: #e8f0f5;
  box-shadow: none;
  border: 1px solid rgba(255,255,255,0.18);
}

.win-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 8px;
  flex-wrap: wrap;
}

#deathStats {
  color: #cfe0ea;
  font-size: 15px;
  margin-bottom: 6px;
}

/* ---------- Depot ---------- */

.depot-panel {
  max-width: 640px;
}

.shop-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.shop-header h2 {
  margin: 0;
  color: #ffd76a;
}

.shop-close {
  background: rgba(255,255,255,0.08);
  border: none;
  color: #e8f0f5;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 15px;
}

.shop-intro {
  color: #b9c8d3;
  font-size: 13px;
  margin-bottom: 16px;
}

.shop-intro span {
  color: #ffd76a;
  font-weight: 700;
}

.depot-stats-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(120, 200, 255, 0.12);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 12px;
  color: #9db3c2;
}

.depot-stats-summary b {
  color: #e8f0f5;
}

.depot-mode-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.depot-mode-tab {
  flex: 1;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(120, 200, 255, 0.18);
  color: #b9c8d3;
  font-size: 14px;
  font-weight: 700;
  padding: 10px 14px;
  border-radius: 10px;
  cursor: pointer;
}

.depot-mode-tab.active {
  background: rgba(255, 215, 106, 0.14);
  border-color: rgba(255, 215, 106, 0.5);
  color: #ffd76a;
}

.depot-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.depot-tab {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(120, 200, 255, 0.15);
  color: #b9c8d3;
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  border-radius: 8px;
  cursor: pointer;
}

.depot-tab.active {
  background: rgba(255, 215, 106, 0.16);
  border-color: rgba(255, 215, 106, 0.45);
  color: #ffd76a;
}

.depot-items {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 12px;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 4px;
}

.depot-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(120, 200, 255, 0.18);
  border-radius: 12px;
  padding: 14px;
  text-align: left;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.depot-card.owned {
  border-color: rgba(120, 255, 160, 0.35);
}

.depot-card.active {
  border-color: #ffd76a;
  box-shadow: 0 0 0 1px #ffd76a inset;
}

.depot-swatch {
  width: 100%;
  height: 46px;
  border-radius: 8px;
  margin-bottom: 4px;
}

.depot-card h3 {
  margin: 0;
  font-size: 15px;
  color: #e8f0f5;
}

.depot-stats {
  font-size: 12px;
  color: #9db3c2;
  line-height: 1.5;
}

.depot-buy {
  margin-top: 6px;
  border: none;
  border-radius: 7px;
  padding: 8px 10px;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  background: linear-gradient(160deg, #ffb84a, #ff7a3d);
  color: #2a1400;
}

.depot-buy:disabled {
  background: rgba(255,255,255,0.08);
  color: rgba(255,255,255,0.35);
  cursor: not-allowed;
}

.depot-buy.equip {
  background: rgba(120, 255, 160, 0.18);
  color: #7dffa0;
  border: 1px solid rgba(120, 255, 160, 0.4);
}

.depot-buy.equipped {
  background: rgba(255, 215, 106, 0.18);
  color: #ffd76a;
  border: 1px solid rgba(255, 215, 106, 0.4);
  cursor: default;
}

/* ---------- Rarity ---------- */

.rarity-common { color: #9db3c2; }
.rarity-uncommon { color: #7dffa0; }
.rarity-rare { color: #7dc4ff; }
.rarity-epic { color: #d8a6ff; }
.rarity-legendary { color: #ffd76a; }

.rarity-border-common { border-color: rgba(157, 179, 194, 0.35) !important; }
.rarity-border-uncommon { border-color: rgba(125, 255, 160, 0.4) !important; }
.rarity-border-rare { border-color: rgba(125, 196, 255, 0.4) !important; }
.rarity-border-epic { border-color: rgba(216, 166, 255, 0.45) !important; }
.rarity-border-legendary { border-color: rgba(255, 215, 106, 0.55) !important; }

/* ---------- Crates ---------- */

.crate-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(120, 200, 255, 0.18);
  border-radius: 14px;
  padding: 18px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
  grid-column: span 1;
}

.crate-icon {
  font-size: 40px;
  margin-bottom: 2px;
}

.crate-card h3 {
  margin: 0;
  font-size: 16px;
  color: #e8f0f5;
}

.crate-odds {
  font-size: 11px;
  color: #9db3c2;
  line-height: 1.6;
  text-align: left;
  background: rgba(255,255,255,0.03);
  border-radius: 8px;
  padding: 8px 10px;
}

.crate-odds-row {
  display: flex;
  justify-content: space-between;
}

/* ---------- Locked inventory parts ---------- */

.depot-card.locked {
  opacity: 0.55;
  filter: grayscale(0.6);
}

.depot-card.locked .depot-swatch {
  background: repeating-linear-gradient(135deg, #1c2128, #1c2128 8px, #23282f 8px, #23282f 16px) !important;
}

.rarity-tag {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ---------- Ability inventory ---------- */

.ability-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  background: rgba(255, 255, 255, 0.05);
}

.depot-card.locked .ability-swatch {
  background: rgba(255, 255, 255, 0.05) !important;
}

.ability-equip-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}

.ability-slot-btn {
  flex: 1;
  margin-top: 0;
  font-size: 12px;
  padding: 7px 6px;
}

/* ---------- Crate reveal ---------- */

.crate-reveal-panel {
  max-width: 380px;
  text-align: center;
}

.crate-reveal-eyebrow {
  margin: 0 0 10px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 2px;
  color: #9db3c2;
}

.crate-reveal-swatch {
  width: 100%;
  height: 90px;
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow: 0 0 40px -8px currentColor;
}

.crate-reveal-swatch.ability-swatch {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 48px;
  background: rgba(255, 255, 255, 0.06);
}

.crate-reveal-rarity {
  margin: 0 0 4px;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.crate-reveal-panel h2 {
  margin: 0 0 8px;
  color: #e8f0f5;
  font-size: 22px;
}

.crate-reveal-stat {
  margin: 0 0 12px;
  color: #b9c8d3;
  font-size: 13px;
}

.crate-reveal-message {
  margin: 0 0 18px;
  font-size: 13px;
  color: #ffd76a;
  font-weight: 600;
}

@media (max-width: 560px) {
  .overlay-panel {
    padding: 24px 20px;
  }
}
