/* ============================================================
   BASE — CSS custom properties, reset, scrollbar, utilities
   ============================================================ */

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  /* Backgrounds */
  --bg:        #0d1117;
  --panel:     #161b22;
  --card:      #1c2333;
  --card-hover:#212d42;
  --border:    #30363d;
  --border-2:  #444c56;

  /* Brand / Accent */
  --accent:    #58a6ff;
  --accent-dim:#1f4068;
  --success:   #3fb950;
  --success-dim:#1a3a22;
  --danger:    #f85149;
  --danger-dim:#3d1515;
  --warn:      #d29922;
  --warn-dim:  #3a2a00;
  --gold:      #ffd700;
  --purple:    #bc8cff;

  /* Text */
  --text:      #e6edf3;
  --text-muted:#8b949e;
  --text-dim:  #484f58;

  /* Semantic */
  --xp-bar:    #3fb950;
  --hp-bar:    #f85149;
  --progress:  #58a6ff;

  /* Radius */
  --r-sm:  6px;
  --r-md:  10px;
  --r-lg:  14px;
  --r-xl:  20px;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0,0,0,.4);
  --shadow-md: 0 4px 20px rgba(0,0,0,.5);
  --shadow-lg: 0 8px 40px rgba(0,0,0,.6);
}

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: var(--panel); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-2); }

/* Utilities */
.hidden { display: none !important; }
.flex   { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: 8px; }
.gap-3 { gap: 12px; }
.gap-4 { gap: 16px; }
.mt-1 { margin-top: 4px; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-3 { margin-bottom: 12px; }
.mb-4 { margin-bottom: 16px; }
.text-muted  { color: var(--text-muted); }
.text-accent { color: var(--accent); }
.text-success{ color: var(--success); }
.text-danger { color: var(--danger); }
.text-gold   { color: var(--gold); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.font-bold   { font-weight: 700; }
.font-semibold { font-weight: 600; }
.truncate    { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Divider */
.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

/* Section header */
.section-h {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .8px;
  padding-bottom: 8px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  font-weight: 600;
}

/* Generic button base */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: none;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  transition: opacity .15s, transform .1s;
  line-height: 1;
  white-space: nowrap;
}
.btn:hover  { opacity: .85; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .35; cursor: not-allowed; pointer-events: none; }

.btn-primary { background: var(--accent);   color: #000; }
.btn-success { background: var(--success);  color: #000; }
.btn-danger  { background: var(--danger);   color: #fff; }
.btn-warn    { background: var(--warn);     color: #000; }
.btn-ghost   { background: var(--card);     color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); opacity:1; }

.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-lg { padding: 11px 22px; font-size: 15px; }
.btn-block { width: 100%; }

/* Badge */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-gold    { background: rgba(255,215,0,.15); color: var(--gold); }
.badge-accent  { background: rgba(88,166,255,.15); color: var(--accent); }
.badge-danger  { background: rgba(248,81,73,.15);  color: var(--danger); }
.badge-success { background: rgba(63,185,80,.15);  color: var(--success); }
.badge-warn    { background: rgba(210,153,34,.15); color: var(--warn); }
.badge-muted   { background: var(--border); color: var(--text-muted); }

/* Input */
.input {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  padding: 9px 12px;
  font-size: 14px;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}
.input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(88,166,255,.15);
}
.input::placeholder { color: var(--text-dim); }

/* Form group */
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.form-error { font-size: 12px; color: var(--danger); margin-top: 2px; }

/* Card */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 16px;
}
.card:hover { border-color: var(--border-2); }

/* Tabs */
.tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 3px;
  gap: 3px;
}
.tab-btn {
  flex: 1;
  padding: 7px 12px;
  background: none;
  border: none;
  border-radius: 5px;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: .15s;
}
.tab-btn:hover  { color: var(--text); background: var(--card); }
.tab-btn.active { background: var(--card); color: var(--accent); }

/* Overlay / modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 500;
  backdrop-filter: blur(3px);
}
.modal-box {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 28px;
  width: min(480px, 94vw);
  box-shadow: var(--shadow-lg);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title { font-size: 18px; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
  line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--card); }
