/* ── ALVIRAN TRACKER – CSS ─────────────────────────────────────────────── */
:root {
  --bg:       #0A0A0F;
  --card:     #111118;
  --card2:    #16161f;
  --border:   rgba(255,255,255,0.07);
  --gold:     #F9C86C;
  --gold-bg:  rgba(249,200,108,0.1);
  --gold-bdr: rgba(249,200,108,0.3);
  --violet:   #8B5CF6;
  --vi-bg:    rgba(139,92,246,0.12);
  --vi-bdr:   rgba(139,92,246,0.3);
  --green:    #22C55E;
  --red:      #EF4444;
  --text:     #E8E8F0;
  --muted:    rgba(232,232,240,0.45);
  --r:        12px;
  --r2:       18px;
  --font:     'Inter', sans-serif;
  --sh:       0 16px 48px rgba(0,0,0,0.6);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 15px; line-height: 1.6;
  min-height: 100vh;
}

::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-thumb { background: rgba(249,200,108,0.2); border-radius: 99px; }

/* ── HEADER ────────────────────────────────────────────────────────────── */
#hdr {
  position: sticky; top: 0; z-index: 100;
  background: rgba(10,10,15,0.9);
  backdrop-filter: blur(24px) saturate(1.5);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(249,200,108,0.15);
}
.hdr-inner {
  max-width: 1300px; margin: 0 auto; padding: 0 24px;
  height: 60px; display: flex; align-items: center; gap: 32px;
}

.logo { display: flex; align-items: center; gap: 7px; }
.logo-icon { color: var(--gold); font-size: 22px; }
.logo-name { font-size: 17px; font-weight: 900; letter-spacing: 0.04em; }
.logo-sub {
  font-size: 9px; font-weight: 700; letter-spacing: 0.16em;
  color: var(--gold); opacity: 0.6;
  align-self: flex-end; margin-bottom: 3px;
}

.nav { margin-left: auto; }
.nav-btn {
  background: var(--gold-bg); border: 1px solid var(--gold-bdr);
  color: var(--gold); font-family: var(--font); font-size: 13px; font-weight: 700;
  padding: 8px 18px; border-radius: 9px; cursor: pointer;
  transition: all .18s; letter-spacing: 0.02em;
}
.nav-btn:hover { background: rgba(249,200,108,0.2); }

/* ── MAIN ──────────────────────────────────────────────────────────────── */
#app {
  max-width: 1300px; margin: 0 auto;
  padding: 0 24px 80px;
}

/* ── EMPTY STATE ────────────────────────────────────────────────────────── */
.empty {
  min-height: 70vh;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center; gap: 20px;
}
.empty-icon { font-size: 56px; opacity: 0.4; }
.empty h1 { font-size: 28px; font-weight: 800; }
.empty p { color: var(--muted); font-size: 15px; max-width: 400px; }

/* ── ACCOUNTS GRID ──────────────────────────────────────────────────────── */
.grid-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 36px 0 20px;
}
.grid-title { font-size: 22px; font-weight: 800; }
.grid-count { font-size: 13px; color: var(--muted); }

.accounts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}

/* ── ACCOUNT CARD ────────────────────────────────────────────────────────── */
.acc-card {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 20px;
  cursor: pointer; transition: transform .18s, border-color .18s, box-shadow .18s;
}
.acc-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255,255,255,0.13);
  box-shadow: 0 12px 36px rgba(0,0,0,0.45);
}

.card-avatar {
  width: 44px; height: 44px; border-radius: 10px;
  background: linear-gradient(135deg, var(--violet), #6d28d9);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 900; color: white;
  margin-bottom: 14px; flex-shrink: 0;
}

.card-name { font-size: 17px; font-weight: 800; margin-bottom: 4px; }
.card-pid  { font-size: 11px; color: var(--muted); font-family: monospace; margin-bottom: 14px; }

.card-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  font-size: 11px; font-weight: 700; letter-spacing: 0.06em;
  padding: 3px 9px; border-radius: 6px;
}
.chip-rank  { background: var(--gold-bg);  color: var(--gold);   border: 1px solid var(--gold-bdr); }
.chip-lv    { background: var(--vi-bg);    color: #c4b5fd;       border: 1px solid var(--vi-bdr); }
.chip-items { background: rgba(34,197,94,0.1); color: #86efac;   border: 1px solid rgba(34,197,94,0.25); }

.card-synced { font-size: 11px; color: var(--muted); }

.card-actions {
  display: flex; gap: 6px; margin-top: 14px; padding-top: 14px;
  border-top: 1px solid var(--border);
}
.btn-sm {
  font-family: var(--font); font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 7px; border: none; cursor: pointer;
  transition: all .15s;
}
.btn-sync { background: var(--vi-bg); color: #c4b5fd; border: 1px solid var(--vi-bdr); }
.btn-sync:hover { background: rgba(139,92,246,0.22); }
.btn-del  { background: rgba(239,68,68,0.1); color: #fca5a5; border: 1px solid rgba(239,68,68,0.2); }
.btn-del:hover  { background: rgba(239,68,68,0.2); }

/* ── DETAIL PANEL ────────────────────────────────────────────────────────── */
.det-header { padding: 28px 28px 0; margin-bottom: 24px; }
.det-name   { font-size: 28px; font-weight: 900; margin-bottom: 6px; }
.det-pid    { font-size: 12px; color: var(--muted); font-family: monospace; }

.det-section { padding: 0 28px 24px; }
.det-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--muted);
  margin-bottom: 12px; padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}

/* Stats grid */
.stat-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}
.stat-box {
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; padding: 14px 16px;
}
.stat-lbl { font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.stat-val { font-size: 22px; font-weight: 800; color: var(--text); margin-top: 4px; }
.stat-val.gold { color: var(--gold); }

/* Rank display */
.rank-hero {
  display: flex; align-items: center; gap: 20px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: var(--r2); padding: 20px 24px; margin-bottom: 16px;
}
.rank-badge {
  font-size: 40px; font-weight: 900;
  width: 72px; height: 72px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  background: var(--gold-bg); border: 2px solid var(--gold-bdr);
  flex-shrink: 0;
}
.rank-name { font-size: 24px; font-weight: 900; }
.rank-mmr  { font-size: 13px; color: var(--muted); margin-top: 2px; }
.rank-wins { font-size: 13px; color: var(--muted); }

/* Items / skins */
.items-scroll {
  display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px;
}
.items-scroll::-webkit-scrollbar { height: 4px; }
.item-card {
  flex-shrink: 0; width: 110px;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; padding: 12px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
}
.item-img {
  width: 64px; height: 64px; object-fit: contain;
  border-radius: 8px; background: rgba(255,255,255,0.04);
}
.item-img-placeholder {
  width: 64px; height: 64px; border-radius: 8px;
  background: linear-gradient(135deg, rgba(139,92,246,0.2), rgba(249,200,108,0.1));
  display: flex; align-items: center; justify-content: center;
  font-size: 22px;
}
.item-name {
  font-size: 10px; color: var(--muted); text-align: center;
  line-height: 1.3; max-height: 28px; overflow: hidden;
}
.item-type {
  font-size: 9px; font-weight: 700; letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 6px; border-radius: 4px;
}
.type-skin    { background: var(--gold-bg); color: var(--gold); }
.type-charm   { background: var(--vi-bg); color: #c4b5fd; }
.type-headgear { background: rgba(34,197,94,0.1); color: #86efac; }
.type-other   { background: rgba(255,255,255,0.06); color: var(--muted); }

.items-count { font-size: 12px; color: var(--muted); margin-bottom: 10px; }

/* Note field */
.note-area {
  width: 100%; min-height: 80px;
  background: var(--card2); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font); font-size: 14px;
  border-radius: 10px; padding: 12px; resize: vertical; outline: none;
  transition: border-color .18s;
}
.note-area:focus { border-color: var(--gold); }
.btn-save-note {
  margin-top: 8px;
  background: var(--gold-bg); border: 1px solid var(--gold-bdr);
  color: var(--gold); font-family: var(--font); font-size: 13px; font-weight: 700;
  padding: 7px 18px; border-radius: 8px; cursor: pointer;
  transition: all .18s;
}
.btn-save-note:hover { background: rgba(249,200,108,0.2); }

/* ── OVERLAY / MODAL ─────────────────────────────────────────────────────── */
.overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.overlay.hidden { display: none !important; }

.modal {
  background: var(--card); border: 1px solid var(--border);
  border-radius: var(--r2); width: 100%; max-width: 480px;
  max-height: 90vh; overflow-y: auto; position: relative;
  box-shadow: var(--sh);
  animation: pop .2s ease;
}
.modal-wide { max-width: 780px; }
@keyframes pop {
  from { opacity: 0; transform: scale(.94) translateY(16px); }
  to   { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-x {
  position: sticky; top: 16px; float: right; margin: 16px 16px 0 0;
  background: rgba(255,255,255,0.08); border: none;
  color: var(--muted); font-size: 16px; cursor: pointer;
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
}
.modal-x:hover { background: rgba(255,255,255,0.14); color: var(--text); }

.modal-title { font-size: 20px; font-weight: 800; padding: 20px 24px 4px; }
.modal-sub   { font-size: 13px; color: var(--muted); padding: 0 24px 20px; line-height: 1.5; }

/* Auth tabs */
.tabs {
  display: flex; gap: 0; margin: 0 24px 20px;
  background: rgba(255,255,255,0.04);
  border-radius: 9px; padding: 3px;
}
.tab {
  flex: 1; font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 7px; border-radius: 7px; border: none; cursor: pointer;
  color: var(--muted); background: transparent; transition: all .18s;
}
.tab.active { background: var(--card2); color: var(--text); }

.tab-panel { padding: 0 24px; }
.tab-panel.hidden { display: none; }

/* Form */
.field { margin-bottom: 16px; }
.field label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted); margin-bottom: 7px;
}
.inp {
  width: 100%; background: rgba(255,255,255,0.05); border: 1px solid var(--border);
  color: var(--text); font-family: var(--font); font-size: 14px;
  padding: 10px 14px; border-radius: 9px; outline: none;
  transition: border-color .18s;
}
.inp:focus { border-color: var(--gold); }
.inp-mono { font-family: monospace; font-size: 13px; resize: vertical; }

.err {
  margin: 0 24px 16px;
  background: rgba(239,68,68,0.1); border: 1px solid rgba(239,68,68,0.25);
  color: #fca5a5; font-size: 13px; padding: 10px 14px; border-radius: 8px;
}

.btn-gold {
  display: block; background: var(--gold); color: #0a0a0f;
  font-family: var(--font); font-size: 15px; font-weight: 800;
  padding: 13px; border-radius: 10px; border: none; cursor: pointer;
  transition: all .18s; text-align: center;
}
.btn-gold:hover { background: #ffd98a; }
.btn-gold:active { transform: scale(.98); }
.btn-gold:disabled { opacity: 0.5; cursor: not-allowed; }
.w100 { width: calc(100% - 48px); margin: 0 24px 24px; }

/* ── MISC ────────────────────────────────────────────────────────────────── */
.spinner {
  width: 32px; height: 32px;
  border: 3px solid rgba(249,200,108,0.2);
  border-top-color: var(--gold);
  border-radius: 50%; animation: spin .7s linear infinite;
  margin: 40px auto;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  background: var(--card); border: 1px solid var(--border);
  border-left: 3px solid var(--green);
  padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600; box-shadow: var(--sh);
  animation: slide-in .2s ease;
}
.toast.err { border-left-color: var(--red); }
@keyframes slide-in { from { transform: translateX(110px); opacity: 0; } }

.hidden { display: none !important; }

@media (max-width: 680px) {
  .hdr-inner { padding: 0 16px; }
  #app { padding: 0 16px 60px; }
  .det-header, .det-section { padding-left: 20px; padding-right: 20px; }
  .modal-wide { max-width: 100%; }
}

/* ── Hint box ────────────────────────────────────────────────────────────── */
.hint-box {
  background: rgba(139,92,246,0.08); border: 1px solid var(--vi-bdr);
  border-radius: 9px; padding: 12px 14px; margin: 0 0 4px;
  font-size: 13px; color: var(--text); line-height: 1.7;
}
.hint-box code, .hint-box kbd {
  background: rgba(255,255,255,0.1); padding: 1px 6px; border-radius: 4px;
  font-family: monospace; font-size: 12px;
}

/* ── Bookmarklet button ──────────────────────────────────────────────────── */
.bm-drag-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--gold); color: #0a0a0f;
  font-family: var(--font); font-size: 14px; font-weight: 800;
  padding: 11px 24px; border-radius: 10px;
  cursor: grab; text-decoration: none;
  box-shadow: 0 4px 20px rgba(249,200,108,0.3);
  transition: all .18s;
}
.bm-drag-btn:hover { background: #ffd98a; transform: translateY(-2px); }
.bm-drag-btn:active { cursor: grabbing; }

/* ── Ubisoft Login Button ─────────────────────────────────────────────────── */
.btn-ubi-login {
  display: flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; background: var(--gold); color: #0a0a0f;
  font-family: var(--font); font-size: 16px; font-weight: 800;
  padding: 15px; border-radius: 12px; border: none; cursor: pointer;
  transition: all .18s; letter-spacing: 0.01em;
  box-shadow: 0 4px 24px rgba(249,200,108,0.3);
}
.btn-ubi-login:hover { background: #ffd98a; transform: translateY(-2px); box-shadow: 0 8px 32px rgba(249,200,108,0.4); }
.btn-ubi-login:active { transform: translateY(0); }
.btn-ubi-login:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Login Status */
.login-status {
  display: flex; align-items: center; gap: 10px;
  background: var(--vi-bg); border: 1px solid var(--vi-bdr);
  border-radius: 9px; padding: 12px 14px; margin-top: 12px;
  font-size: 14px;
}
.spinner-sm {
  width: 18px; height: 18px; flex-shrink: 0;
  border: 2px solid rgba(139,92,246,0.3);
  border-top-color: #c4b5fd;
  border-radius: 50%; animation: spin .6s linear infinite;
}

/* Divider */
.divider {
  display: flex; align-items: center; gap: 12px;
  margin: 20px 0;
  color: var(--muted); font-size: 12px;
}
.divider::before, .divider::after {
  content: ''; flex: 1;
  height: 1px; background: var(--border);
}

/* Ticket details */
.ticket-details {
  border: 1px solid var(--border); border-radius: 9px;
}
.ticket-details summary {
  padding: 10px 14px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; list-style: none;
  transition: color .18s;
}
.ticket-details summary:hover { color: var(--text); }
.ticket-details[open] summary { border-bottom: 1px solid var(--border); }
.ticket-details > div { padding: 0 14px 14px; }
