* {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  background:
    radial-gradient(circle at top, #273b5f 0, #050608 55%, #000000 100%);
  font-family: 'Press Start 2P', system-ui, -apple-system, BlinkMacSystemFont,
    'Segoe UI', sans-serif;
  image-rendering: pixelated;
  color: #f8f8ff;
}

canvas {
  height: 100%;
  width: 100%;
  image-rendering: pixelated;
}

/* HUD PIXEL STYLE */
.hud-label {
  position: absolute;
  top: 16px;
  padding: 6px 12px;
  font-size: 10px;
  font-family: 'Press Start 2P', system-ui, sans-serif;
  color: #f8f8ff;
  background: rgba(6, 12, 24, 0.9);
  text-shadow: 0 0 4px #000000;
  border-radius: 950px;
  letter-spacing: 1px;
  z-index: 10;
}

.hud-left {
  left: 16px;
  text-align: left;
}

.hud-right {
  right: 16px;
  text-align: right;
}

.hud-danger {
  top: auto;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 9px;
  background: rgba(127, 29, 29, 0.95);
  border: 1px solid #fecaca;
  text-shadow: 0 0 4px #000000;
}

.hud-buff {
  top: auto;
  bottom: 46px;
  left: 50%;
  transform: translateX(-50%);
  padding: 6px 14px;
  font-size: 9px;
  background: rgba(15, 23, 42, 0.95);
  border: 1px solid #38bdf8;
  text-shadow: 0 0 4px #000000;
}

/* Sweetalert pixel customization */
.swal-overlay {
  background-color: rgba(0, 0, 0, 0.65);
}

.swal-modal {
  background: linear-gradient(145deg, #020617 0%, #020d20 50%, #050816 100%);
  border-radius: 20px;
  padding-top: 22px;
}

.swal-title {
  color: #f9fafb;
  font-size: 16px;
  margin: 0;
  padding: 0 8px 10px 8px;
  text-transform: uppercase;
  letter-spacing: 2px;
  font-family: 'Press Start 2P', system-ui, sans-serif;
}

.swal-text {
  padding: 0 8px 8px 8px;
  text-align: center;
  color: #e5e7eb;
  font-size: 11px;
  line-height: 1.6;
  font-family: 'Press Start 2P', system-ui, sans-serif;
}

.swal-footer {
  overflow: hidden;
  text-align: center;
  padding-top: 12px;
}

.swal-button {
  font-family: 'Press Start 2P', system-ui, sans-serif;
  font-size: 10px;
  padding: 9px 18px;
  border-radius: 300px;
  border-width: 2px;
  text-transform: uppercase;
  letter-spacing: 1px;
  box-shadow:
    0 0 0 2px #020617,
    0 0 10px rgba(0, 0, 0, 0.9);
  transition: transform 0.08s ease, box-shadow 0.08s ease,
    background 0.1s ease, color 0.1s ease;
}

.swal-button--confirm {
  background: #22c55e;
  color: #0b1120;
  border-color: #bbf7d0;
}
.swal-button--confirm:hover {
  background: #4ade80;
  color: #020617;
  transform: translateY(-1px);
  box-shadow:
    0 0 0 2px #bbf7d0,
    0 0 12px rgba(74, 222, 128, 0.9);
}

.swal-button--cancel {
  background: #ef4444;
  color: #fee2e2;
  border-color: #fecaca;
  margin-left: 8px;
}
.swal-button--cancel:hover {
  background: #f97373;
  color: #0b1120;
  transform: translateY(-1px);
  box-shadow:
    0 0 0 2px #fecaca,
    0 0 12px rgba(248, 113, 113, 0.9);
}
.swal-button--cancel:focus,
.swal-button--confirm:focus {
  box-shadow:
    0 0 0 2px #0b1120,
    0 0 5px rgba(148, 163, 184, 0.6) !important;
}

.swal-input {
  width: 100%;
  padding: 6px 8px;
  margin: 2px 0;
  font-size: 12px;
  border-radius: 6px;
  border: 1px solid #4b5563;
  background: #020617;
  color: #e5e7eb;
}

.lb-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}

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

/* PANEL */
.lb-panel {
  width: min(90vw, 420px);
  max-height: 80vh;
  background: radial-gradient(circle at top, #020617 0%, #020617 35%, #000 100%);
  border-radius: 16px;
  padding: 14px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* HEADER */
.lb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.lb-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #e5e7eb;
}

.lb-season {
  font-size: 9px;
  color: #94a3b8;
  opacity: 0.9;
}

.lb-close {
  border: none;
  outline: none;
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border-radius: 999px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, transform 0.1s ease;
}

.lb-close:hover {
  background: rgba(30, 64, 175, 0.9);
  transform: translateY(-1px);
}

/* TABS */
.lb-tabs {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.lb-tab {
  flex: 1;
  border: none;
  outline: none;
  padding: 6px 0;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  border-radius: 999px;
  cursor: pointer;
  background: rgba(15, 23, 42, 0.8);
  color: #9ca3af;
  transition:
    background 0.15s ease,
    color 0.15s ease,
    border-color 0.15s ease,
    transform 0.1s ease;
}

.lb-tab.active {
  background: #22c55e;
  color: #020617;
  border-color: transparent;
  transform: translateY(-1px);
}

.lb-tab:hover:not(.active) {
  border-color: rgba(148, 163, 184, 0.9);
}

/* LEGEND */
.lb-legend {
  display: grid;
  grid-template-columns: 46px 1fr 70px;
  padding: 4px 6px;
  margin-top: 4px;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #9ca3af;
  border-bottom: 1px solid rgba(30, 64, 175, 0.6);
}

/* BODY */
.lb-body {
  margin-top: 4px;
  flex: 1;
  min-height: 120px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}

.lb-empty {
  padding: 18px 8px;
  text-align: center;
  font-size: 9px;
  color: #9ca3af;
}

/* ROWS */
.lb-row {
  display: grid;
  grid-template-columns: 46px 1fr 70px;
  align-items: center;
  font-size: 10px;
  padding: 4px 6px;
  border-bottom: 1px dashed rgba(31, 41, 55, 0.8);
}

.lb-row:nth-child(2n) {
  background: rgba(15, 23, 42, 0.6);
}

.lb-row-me {
  background: linear-gradient(90deg, rgba(34, 197, 94, 0.16), rgba(56, 189, 248, 0.1));
  border-bottom-color: rgba(34, 197, 94, 0.6);
}

.lb-rank {
  color: #e5e7eb;
  opacity: 0.9;
}

.lb-name {
  color: #e5e7eb;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lb-score {
  text-align: right;
  color: #facc15;
}

/* FOOTER */
.lb-footer {
  margin-top: 6px;
  font-size: 8.5px;
  color: #9ca3af;
  display: flex;
  align-items: center;
  gap: 4px;
}

.lb-me-indicator {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: linear-gradient(135deg, #22c55e, #0ea5e9);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
}

/* scrollbar tipis dikit */
.lb-body::-webkit-scrollbar {
  width: 4px;
}

.lb-body::-webkit-scrollbar-thumb {
  background: rgba(148, 163, 184, 0.8);
  border-radius: 999px;
}

.lb-body::-webkit-scrollbar-track {
  background: transparent;
}

@media (max-width: 480px) {
  .lb-panel {
    width: 92vw;
    max-height: 82vh;
    padding: 12px 12px 10px;
  }
  .lb-legend,
  .lb-row {
    grid-template-columns: 40px 1fr 60px;
  }
}