/* public/css/style.css */
/* Tema Dark-Fantasy Aether Realms - Responsif Mobile & Desktop */

:root {
  --bg-deep: #07111f;
  --panel-bg: rgba(15, 23, 42, 0.88);
  --panel-solid: #0f172a;
  --panel-border: rgba(148, 163, 184, 0.25);
  --gold: #facc15;
  --gold-dark: #ca8a04;
  --elixir: #38bdf8;
  --elixir-dark: #0284c7;
  --danger: #ef4444;
  --success: #22c55e;
  --purple: #a855f7;
  --text: #f8fafc;
  --text-dim: #94a3b8;
  --radius: 14px;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

html, body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--bg-deep);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

input, textarea {
  user-select: text;
}

.hidden {
  display: none !important;
}

.screen {
  position: fixed;
  inset: 0;
  display: none;
  overflow: hidden;
}
.screen.active {
  display: block;
}

/* ================= TOMBOL UMUM ================= */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  outline: none;
  transition: transform 0.12s ease, filter 0.15s ease, background 0.15s ease;
}
button:active {
  transform: scale(0.95);
}
button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn-primary {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #1c1917;
  font-weight: 800;
  padding: 12px 18px;
  border-radius: 12px;
  border: 1px solid #fef08a;
  box-shadow: 0 4px 16px rgba(245, 158, 11, 0.35);
}
.btn-gold {
  background: linear-gradient(135deg, #facc15, #ca8a04);
  color: #1c1917;
  font-weight: 800;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #fef08a;
}
.btn-accent {
  background: linear-gradient(135deg, #38bdf8, #0284c7);
  color: #082f49;
  font-weight: 800;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #bae6fd;
}
.btn-success {
  background: linear-gradient(135deg, #22c55e, #15803d);
  color: #fff;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #86efac;
}
.btn-danger {
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  color: #fff;
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid #fca5a5;
}
.btn-secondary {
  background: rgba(30, 41, 59, 0.92);
  color: var(--text);
  font-weight: 700;
  padding: 9px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}
.btn-sm {
  padding: 7px 12px;
  font-size: 12.5px;
}
.btn-xs {
  width: 30px !important;
  height: 30px !important;
  font-size: 14px !important;
}
.btn-full {
  width: 100%;
}

.pill-btn {
  background: rgba(15, 23, 42, 0.78);
  backdrop-filter: blur(8px);
  color: var(--text);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 7px 13px;
  font-size: 12.5px;
  font-weight: 700;
}
.android-btn {
  background: linear-gradient(135deg, #16a34a, #15803d);
  border-color: #86efac;
  box-shadow: 0 3px 12px rgba(22, 163, 74, 0.4);
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
}
.chip-gold { background: rgba(250, 204, 21, 0.2); color: #fde047; border: 1px solid rgba(250, 204, 21, 0.45); }
.chip-trophy { background: rgba(249, 115, 22, 0.2); color: #fdba74; border: 1px solid rgba(249, 115, 22, 0.45); }
.chip-red { background: rgba(239, 68, 68, 0.25); color: #fca5a5; border: 1px solid rgba(239, 68, 68, 0.5); }
.chip-blue { background: rgba(56, 189, 248, 0.22); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.45); }
.chip-purple { background: rgba(168, 85, 247, 0.22); color: #d8b4fe; border: 1px solid rgba(168, 85, 247, 0.45); }

/* ================= LAYAR LOGIN & BANNER DINAMIS ================= */
#banner-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.auth-topbar {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  flex-wrap: wrap;
}
.auth-topbar-right {
  display: flex;
  gap: 8px;
}

.auth-center {
  position: relative;
  z-index: 3;
  height: calc(100% - 115px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 12px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: rgba(10, 18, 34, 0.84);
  backdrop-filter: blur(12px);
  border: 1.5px solid rgba(250, 204, 21, 0.4);
  border-radius: 20px;
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.65);
}

.auth-logo-wrap {
  text-align: center;
  margin-bottom: 12px;
}
.auth-logo {
  width: 118px;
  height: 118px;
  object-fit: contain;
  border-radius: 20px;
  filter: drop-shadow(0 6px 18px rgba(56, 189, 248, 0.45));
}
.auth-tagline {
  margin-top: 6px;
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 1px;
  color: #fde047;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  background: rgba(15, 23, 42, 0.85);
  padding: 4px;
  border-radius: 12px;
  margin-bottom: 12px;
}
.auth-tab {
  background: transparent;
  color: var(--text-dim);
  padding: 8px;
  border-radius: 9px;
  font-weight: 700;
  font-size: 13px;
}
.auth-tab.active {
  background: linear-gradient(135deg, #1d4ed8, #0284c7);
  color: #fff;
}

.field-group {
  margin-bottom: 10px;
}
.field-group label {
  display: block;
  font-size: 11.5px;
  color: #cbd5e1;
  margin-bottom: 4px;
  font-weight: 600;
}
.field-group input {
  width: 100%;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(15, 23, 42, 0.9);
  color: #fff;
  font-size: 14px;
  outline: none;
}
.field-group input:focus {
  border-color: var(--elixir);
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.auth-error {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.6);
  color: #fecaca;
  padding: 8px 10px;
  border-radius: 10px;
  font-size: 12px;
  margin-bottom: 10px;
}

.auth-footer-hint {
  margin-top: 10px;
  text-align: center;
  font-size: 11.5px;
  color: #bae6fd;
}

.banner-caption {
  position: fixed;
  left: 14px;
  bottom: 12px;
  z-index: 3;
  max-width: 340px;
  pointer-events: none;
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9);
}
.banner-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250, 204, 21, 0.25);
  border: 1px solid rgba(250, 204, 21, 0.55);
  color: #fef08a;
  margin-bottom: 3px;
}
.banner-title {
  font-size: 14px;
  font-weight: 800;
  color: #fff;
}
.banner-subtitle {
  font-size: 11.5px;
  color: #cbd5e1;
}

/* ================= LAYAR LOADING ================= */
.loading-bg {
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  filter: blur(4px) brightness(0.45);
  transform: scale(1.06);
}
.loading-overlay {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  text-align: center;
}
.loading-logo {
  width: 165px;
  height: 165px;
  object-fit: contain;
  border-radius: 26px;
  margin-bottom: 14px;
  animation: floatLogo 2.4s ease-in-out infinite;
  filter: drop-shadow(0 8px 28px rgba(56, 189, 248, 0.55));
}
@keyframes floatLogo {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}
.loading-title {
  margin: 0 0 14px;
  font-size: 20px;
  color: #fef08a;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.8);
}
.loading-bar-wrap {
  width: min(360px, 86vw);
  height: 14px;
  background: rgba(15, 23, 42, 0.9);
  border: 1.5px solid rgba(250, 204, 21, 0.6);
  border-radius: 999px;
  overflow: hidden;
}
.loading-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0ea5e9, #38bdf8, #facc15);
  transition: width 0.16s ease;
}
.loading-meta {
  width: min(360px, 86vw);
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: #e2e8f0;
  font-weight: 600;
}
.loading-tip {
  margin-top: 18px;
  max-width: 400px;
  font-size: 12.5px;
  color: #bae6fd;
  background: rgba(15, 23, 42, 0.72);
  padding: 8px 14px;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.3);
}

/* ================= CANVAS & KONTROL ZOOM ================= */
#game-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
}

.zoom-controls {
  position: fixed;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 16;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.zoom-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.86);
  backdrop-filter: blur(8px);
  color: #f8fafc;
  font-size: 20px;
  font-weight: 800;
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
}
.zoom-reset {
  font-size: 17px;
  color: #fde047;
}

/* ================= HUD KERAJAAN SENDIRI ================= */
.hud-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 12;
}
.hud-layer button,
.hud-layer .hud-profile-card,
.hud-layer .hud-resources,
.hud-layer .inspector-card,
.hud-layer .placement-bar,
.hud-layer .home-dock,
.hud-layer .battle-tray,
.hud-layer .scout-controls {
  pointer-events: auto;
}

.hud-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  flex-wrap: wrap;
}

.hud-profile-card {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(250, 204, 21, 0.35);
  border-radius: 15px;
  padding: 7px 11px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
}

.profile-lv-badge {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1e3a8a);
  border: 2px solid #93c5fd;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1;
}
.profile-lv-badge .lv-label {
  font-size: 9px;
  font-weight: 800;
  color: #bae6fd;
}
.profile-lv-badge #hud-player-lv {
  font-size: 17px;
  font-weight: 900;
  color: #fff;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.profile-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13.5px;
  flex-wrap: wrap;
}
.exp-bar-wrap {
  position: relative;
  width: 175px;
  height: 12px;
  background: rgba(30, 41, 59, 0.95);
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid rgba(148, 163, 184, 0.3);
}
.exp-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #38bdf8, #a855f7);
}
.exp-bar-text {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
  font-weight: 800;
  color: #fff;
  text-shadow: 0 1px 2px #000;
}
.profile-subrow {
  display: flex;
  align-items: center;
  gap: 6px;
}
.code-chip {
  background: rgba(56, 189, 248, 0.16);
  color: #7dd3fc;
  border: 1px solid rgba(56, 189, 248, 0.4);
  border-radius: 8px;
  padding: 2px 7px;
  font-size: 10.5px;
  font-weight: 700;
}
.builder-chip {
  font-size: 11px;
  font-weight: 700;
  color: #fde047;
  background: rgba(234, 179, 8, 0.16);
  padding: 2px 7px;
  border-radius: 8px;
}

.hud-resources {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.res-pill {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  padding: 6px 10px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 800;
  border: 1px solid var(--panel-border);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
.res-coin { border-color: rgba(250, 204, 21, 0.45); color: #fef08a; }
.res-elixir { border-color: rgba(56, 189, 248, 0.45); color: #7dd3fc; }
.res-army { border-color: rgba(248, 113, 113, 0.45); color: #fecaca; }
.res-spell { border-color: rgba(192, 132, 252, 0.45); color: #e9d5ff; }

.icon-circle-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--panel-bg);
  color: #fff;
  font-size: 17px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Tombol Samping Kiri */
.hud-left-stack {
  position: fixed;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.side-btn {
  position: relative;
  width: 50px;
  height: 50px;
  border-radius: 14px;
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1.05;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}
.side-btn small {
  font-size: 9.5px;
  font-weight: 700;
  color: #cbd5e1;
  margin-top: 2px;
}
.side-btn-dim {
  opacity: 0.78;
}
.notif-dot {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #ef4444;
  color: #fff;
  font-size: 11px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0f172a;
}

/* Bar Penempatan / Pindah Bangunan */
.placement-bar {
  position: fixed;
  top: 86px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(15, 23, 42, 0.95);
  border: 1.5px solid #4ade80;
  border-radius: 14px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.55);
  max-width: 92vw;
  flex-wrap: wrap;
  justify-content: center;
}
.placement-bar span {
  font-size: 12.5px;
  font-weight: 700;
  color: #bbf7d0;
}
.placement-actions {
  display: flex;
  gap: 8px;
}

/* Panel Inspektor Bangunan */
.inspector-card {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translateX(-50%);
  width: min(390px, 92vw);
  background: rgba(15, 23, 42, 0.94);
  backdrop-filter: blur(12px);
  border: 1.5px solid rgba(250, 204, 21, 0.5);
  border-radius: 16px;
  padding: 11px 13px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.6);
}
.inspector-head {
  display: flex;
  align-items: center;
  gap: 10px;
}
.insp-thumb {
  width: 54px;
  height: 54px;
  object-fit: contain;
  background: rgba(30, 41, 59, 0.9);
  border-radius: 12px;
  padding: 4px;
  border: 1px solid rgba(148, 163, 184, 0.3);
}
.insp-meta {
  flex: 1;
  min-width: 0;
}
.insp-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}
.insp-skin {
  font-size: 11px;
  color: #fde047;
  margin-top: 2px;
}
.insp-stats {
  font-size: 11.5px;
  color: #cbd5e1;
  margin-top: 2px;
}
.insp-close {
  background: rgba(51, 65, 85, 0.8);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  font-weight: 800;
}
.insp-req-note {
  margin-top: 8px;
  font-size: 11.5px;
  padding: 6px 9px;
  border-radius: 9px;
  background: rgba(239, 68, 68, 0.18);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
}
.inspector-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.inspector-actions button {
  flex: 1;
}

/* Dock Bawah Kerajaan */
.home-dock {
  position: fixed;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 20px;
  padding: 7px 10px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.55);
}
.dock-btn {
  width: 64px;
  height: 58px;
  border-radius: 14px;
  background: rgba(30, 41, 59, 0.9);
  border: 1px solid rgba(148, 163, 184, 0.25);
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
}
.dock-ico {
  font-size: 22px;
  line-height: 1;
}
.dock-lbl {
  font-size: 10.5px;
  font-weight: 800;
}
.dock-attack {
  width: 82px;
  height: 64px;
  background: linear-gradient(135deg, #ef4444, #b91c1c);
  border: 1.5px solid #fde047;
  box-shadow: 0 4px 18px rgba(239, 68, 68, 0.45);
}
.dock-collect {
  background: linear-gradient(135deg, #ca8a04, #854d0e);
  border-color: #fde047;
}

/* ================= HUD PERTEMPURAN ================= */
.battle-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  padding: 10px 12px;
  flex-wrap: wrap;
}
.bat-enemy-card,
.bat-score-card {
  background: var(--panel-bg);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(148, 163, 184, 0.3);
  border-radius: 14px;
  padding: 8px 11px;
}
.bat-enemy-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  margin-bottom: 5px;
}
.bat-loot-grid {
  display: flex;
  gap: 8px;
  font-size: 11.5px;
  font-weight: 700;
}
.bat-loot-box {
  background: rgba(30, 41, 59, 0.85);
  padding: 4px 8px;
  border-radius: 8px;
}
.bat-loot-box small {
  display: block;
  font-size: 9.5px;
  color: var(--text-dim);
}
.bat-loot-box.stolen {
  border: 1px solid rgba(250, 204, 21, 0.4);
  color: #fef08a;
}

.bat-center-box {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}
.phase-pill {
  font-size: 10.5px;
  font-weight: 900;
  letter-spacing: 0.8px;
  padding: 3px 10px;
  border-radius: 999px;
}
.phase-pill.scout {
  background: rgba(250, 204, 21, 0.25);
  border: 1px solid #facc15;
  color: #fef08a;
}
.phase-pill.battle {
  background: rgba(239, 68, 68, 0.3);
  border: 1px solid #f87171;
  color: #fecaca;
}
.bat-timer {
  font-size: 22px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px #000;
}
.bat-hint {
  font-size: 11px;
  color: #e2e8f0;
  background: rgba(15, 23, 42, 0.78);
  padding: 3px 10px;
  border-radius: 999px;
}

.bat-score-card {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 4px;
}
.stars-row {
  display: flex;
  gap: 3px;
  font-size: 22px;
  line-height: 1;
}
.star {
  color: #334155;
  transition: color 0.2s, transform 0.25s;
}
.star.earned {
  color: #facc15;
  text-shadow: 0 0 12px rgba(250, 204, 21, 0.8);
  transform: scale(1.15);
}
.bat-pct-row {
  font-size: 12px;
  color: #cbd5e1;
}

.scout-controls {
  position: fixed;
  left: 50%;
  bottom: 106px;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
  z-index: 15;
}

.battle-tray {
  position: fixed;
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
  width: min(760px, 96vw);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(10px);
  border: 1.5px solid rgba(148, 163, 184, 0.35);
  border-radius: 16px;
  padding: 7px 9px;
}
.battle-cards {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding-bottom: 2px;
}
.battle-card {
  position: relative;
  flex: 0 0 68px;
  height: 76px;
  border-radius: 12px;
  background: rgba(30, 41, 59, 0.95);
  border: 2px solid rgba(148, 163, 184, 0.3);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4px;
  color: #fff;
}
.battle-card.is-spell {
  background: rgba(59, 7, 100, 0.72);
  border-color: rgba(192, 132, 252, 0.45);
}
.battle-card.selected {
  border-color: #facc15;
  box-shadow: 0 0 0 2px rgba(250, 204, 21, 0.4), 0 0 14px rgba(250, 204, 21, 0.5);
  transform: translateY(-3px);
}
.battle-card.empty {
  opacity: 0.38;
  filter: grayscale(0.8);
}
.battle-card img {
  width: 44px;
  height: 44px;
  object-fit: contain;
}
.battle-card .bc-name {
  font-size: 9.5px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 60px;
  margin-top: 2px;
}
.battle-card .bc-count {
  position: absolute;
  top: 2px;
  right: 4px;
  background: #0f172a;
  color: #fef08a;
  border: 1px solid rgba(250, 204, 21, 0.55);
  border-radius: 7px;
  padding: 1px 5px;
  font-size: 10.5px;
  font-weight: 900;
}
.battle-divider {
  width: 2px;
  background: rgba(192, 132, 252, 0.45);
  margin: 4px 2px;
  flex-shrink: 0;
}

/* ================= MODAL SERBAGUNA ================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(2, 6, 23, 0.76);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 14px;
}
.modal-box {
  width: min(640px, 96vw);
  max-height: 86vh;
  background: #0f172a;
  border: 1.5px solid rgba(250, 204, 21, 0.45);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  background: linear-gradient(90deg, #1e293b, #0f172a);
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
}
.modal-header h3 {
  margin: 0;
  font-size: 17px;
  color: #fef08a;
}
.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.2);
  color: #fecaca;
  font-size: 15px;
  font-weight: 900;
}
.modal-body {
  padding: 14px 16px 18px;
  overflow-y: auto;
}

/* Tab & Grid Kartu di Dalam Modal */
.sub-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  overflow-x: auto;
}
.sub-tab {
  background: #1e293b;
  color: #94a3b8;
  padding: 7px 12px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.sub-tab.active {
  background: linear-gradient(135deg, #2563eb, #0284c7);
  color: #fff;
}

.item-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 10px;
}
.item-card {
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 14px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.item-card.locked {
  opacity: 0.62;
  border-style: dashed;
}
.item-card-top {
  display: flex;
  align-items: center;
  gap: 10px;
}
.item-card img {
  width: 56px;
  height: 56px;
  object-fit: contain;
  background: rgba(15, 23, 42, 0.85);
  border-radius: 12px;
  padding: 4px;
  flex-shrink: 0;
}
.item-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
}
.item-sub {
  font-size: 11px;
  color: #94a3b8;
}
.item-desc {
  font-size: 11px;
  color: #cbd5e1;
  line-height: 1.35;
  flex: 1;
}
.item-meta-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: #fef08a;
}

.queue-box {
  background: rgba(30, 41, 59, 0.7);
  border: 1px solid rgba(56, 189, 248, 0.35);
  border-radius: 12px;
  padding: 10px 12px;
  margin-bottom: 12px;
}
.queue-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}
.queue-pill {
  background: #0f172a;
  border: 1px solid rgba(250, 204, 21, 0.45);
  border-radius: 10px;
  padding: 5px 9px;
  font-size: 11.5px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.list-stack {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.list-row {
  background: #1e293b;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.quest-prog-bar {
  height: 7px;
  width: 140px;
  background: #0f172a;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}
.quest-prog-fill {
  height: 100%;
  background: linear-gradient(90deg, #22c55e, #facc15);
}

/* Slider Pengaturan Suara */
.audio-row {
  background: #1e293b;
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
}
.audio-row-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 13.5px;
}
.audio-slider {
  width: 100%;
  accent-color: #38bdf8;
  cursor: pointer;
}

/* ================= OVERLAY HASIL PERTEMPURAN ================= */
.result-card {
  width: min(400px, 92vw);
  background: #0f172a;
  border: 2px solid #facc15;
  border-radius: 22px;
  padding: 20px;
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}
.res-banner {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 1.5px;
}
.res-banner.victory { color: #facc15; text-shadow: 0 0 18px rgba(250, 204, 21, 0.6); }
.res-banner.defeat { color: #f87171; }
.res-stars {
  font-size: 46px;
  margin: 8px 0 4px;
}
.res-star { color: #334155; }
.res-star.earned { color: #facc15; text-shadow: 0 0 18px rgba(250, 204, 21, 0.85); }
.res-subtitle {
  color: #cbd5e1;
  font-size: 13.5px;
  margin-bottom: 14px;
}
.res-rewards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}
.res-reward-item {
  background: #1e293b;
  border-radius: 12px;
  padding: 10px;
}
.res-reward-item small {
  display: block;
  font-size: 11px;
  color: #94a3b8;
}
.res-reward-item strong {
  font-size: 16px;
}
.txt-gold { color: #facc15; }
.txt-blue { color: #38bdf8; }
.txt-green { color: #4ade80; }

/* ================= TOAST ================= */
.toast-container {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
}
.toast {
  background: rgba(15, 23, 42, 0.94);
  color: #fff;
  border: 1px solid rgba(56, 189, 248, 0.55);
  padding: 9px 15px;
  border-radius: 12px;
  font-size: 13px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.55);
  animation: toastIn 0.2s ease;
}
.toast.error { border-color: #f87171; color: #fecaca; }
.toast.success { border-color: #4ade80; color: #bbf7d0; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================= RESPONSIF MOBILE ================= */
@media (max-width: 640px) {
  .hud-top { padding: 7px 8px; gap: 6px; }
  .hud-profile-card { padding: 5px 8px; gap: 7px; }
  .exp-bar-wrap { width: 128px; }
  .res-pill { padding: 5px 8px; font-size: 11.5px; }
  .side-btn { width: 44px; height: 44px; font-size: 16px; }
  .dock-btn { width: 56px; height: 52px; }
  .dock-attack { width: 72px; height: 58px; }
  .zoom-btn { width: 36px; height: 36px; font-size: 18px; }
  .banner-caption { display: none; }
  .item-grid { grid-template-columns: 1fr; }
}