/* =========================================
   TOKENS & THEME  –  Lighter, cleaner
========================================= */
:root {
    /* Colorhunt palette: #BF4646 #EDDCC6 #FFF4EA #7EACB5 */
    --bg:          #FFF4EA;
    --bg2:         #FFF4EA;
    --surface:     #EDDCC6;
    --surface2:    #E5D0B8;
    --surface3:    #DCC4A8;
    --border:      rgba(191,70,70,0.18);
    --border-hover:rgba(191,70,70,0.50);

    --gold:        #BF4646;
    --gold-light:  #d96868;
    --gold-dim:    rgba(191,70,70,0.12);

    --blue:        #7EACB5;
    --teal:        #7EACB5;
    --purple:      #a78bfa;
    --red:         #BF4646;

    --text:        #2a1a14;
    --text-dim:    rgba(42,26,20,0.60);
    --text-faint:  rgba(42,26,20,0.30);

    --radius:      14px;
    --radius-sm:   9px;
    --radius-xs:   6px;
    --font-head:   'Syne', sans-serif;
    --font-body:   'DM Sans', sans-serif;
    --shadow:      0 4px 24px rgba(0,0,0,0.35);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
    font-family: var(--font-body);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
}

/* ─── BG ORBS ──────────────────────────── */
.bg-orb {
    position: fixed;
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    filter: blur(120px);
    opacity: 0.22;
}
.orb1 { width:700px; height:700px; top:-200px; left:-200px;
        background: radial-gradient(circle, rgba(191,70,70,0.5), transparent 65%); }
.orb2 { width:500px; height:500px; bottom:0; right:-150px;
        background: radial-gradient(circle, rgba(78,142,247,0.4), transparent 65%); }

.container {
    position: relative; z-index: 1;
    max-width: 1320px;
    margin: 0 auto;
    padding: 40px 24px 80px;
}

/* ─── HEADER ────────────────────────────── */
.site-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 28px;
    gap: 16px;
}

.header-left { display: flex; align-items: center; gap: 14px; }

.logo-icon {
    width: 46px; height: 46px;
    background: linear-gradient(135deg, var(--gold), #8a2020);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 22px;
    box-shadow: 0 4px 16px rgba(191,70,70,0.3);
    flex-shrink: 0;
}

h1 {
    font-family: var(--font-head);
    font-size: 24px; font-weight: 800;
    color: var(--text); letter-spacing: -0.3px;
    line-height: 1.1;
}

.header-sub { font-size: 12px; color: var(--text-dim); margin-top: 2px; }

.header-right {
    display: flex; align-items: center; gap: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px 16px;
}

.profile-icon {
    width: 38px; height: 38px;
    border-radius: 50%;
    border: 2px solid var(--gold);
    object-fit: cover;
}

.profile-name { display: block; font-family: var(--font-head); font-weight: 700; font-size: 14px; }
.profile-meta { display: block; font-size: 11px; color: var(--text-dim); margin-top: 1px; }

/* ─── CARD BASE ─────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    transition: border-color 0.2s;
    box-shadow: var(--shadow);
}
.card:hover { border-color: rgba(191,70,70,0.2); }

/* ─── ACCOUNT CARD ──────────────────────── */
.account-card { margin-bottom: 16px; }

.account-bar {
    display: flex; gap: 10px;
    flex-wrap: wrap; align-items: flex-end;
}

.input-group { display: flex; flex-direction: column; gap: 5px; }
.input-group.flex1 { flex: 1; min-width: 160px; }

.input-group label {
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.9px; text-transform: uppercase;
    color: var(--text-faint);
}

.input-group input,
.input-group select {
    padding: 9px 13px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    font-family: var(--font-body); font-size: 13px;
    outline: none; transition: border-color 0.2s;
    height: 38px;
}

.input-group input:focus,
.input-group select:focus { border-color: var(--gold); }

.btn-group { display: flex; gap: 8px; align-items: flex-end; }

.btn {
    padding: 9px 16px; height: 38px;
    border-radius: var(--radius-sm); border: none;
    cursor: pointer;
    font-family: var(--font-body); font-size: 13px; font-weight: 600;
    transition: all 0.18s; white-space: nowrap;
}

.btn.primary {
    background: var(--gold); color: #FFF4EA;
    padding: 9px 22px;
    box-shadow: 0 0 18px rgba(191,70,70,0.3);
}
.btn.primary:hover { background: var(--gold-light); transform: translateY(-1px); }

.btn.secondary { background: var(--surface2); color: var(--text); border: 1px solid var(--border); }
.btn.secondary:hover { border-color: var(--gold); }
.btn.danger { background: rgba(248,113,113,0.1); color: var(--red); border: 1px solid rgba(248,113,113,0.2); }
.btn.danger:hover { background: rgba(248,113,113,0.2); }

.btn-loader { display: inline-block; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── GOAL SELECTOR ─────────────────────── */
.goal-section {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 20px;
    margin-bottom: 16px;
}

.goal-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 12px;
}

.goal-label { font-family: var(--font-head); font-size: 13px; font-weight: 700; }
.goal-info { font-size: 12px; color: var(--gold); }

.goal-buttons { display: flex; gap: 6px; flex-wrap: wrap; }

.goal-btn {
    padding: 5px 13px;
    border-radius: 30px;
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text-dim);
    font-size: 12px; font-weight: 600;
    cursor: pointer; transition: all 0.18s;
    font-family: var(--font-body);
}
.goal-btn:hover { border-color: var(--gold); color: var(--text); }
.goal-btn.active {
    background: var(--gold); border-color: var(--gold);
    color: #FFF4EA;
    box-shadow: 0 0 12px rgba(191,70,70,0.25);
}

/* ─── STATS GRID ────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px 18px;
    position: relative; overflow: hidden;
    transition: transform 0.2s;
}
.stat-card:hover { transform: translateY(-2px); }

.accent-gold { border-top: 2px solid var(--gold); }
.accent-blue { border-top: 2px solid var(--blue); }
.accent-teal { border-top: 2px solid var(--teal); }
.accent-purple { border-top: 2px solid var(--purple); }

.stat-top { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; }
.stat-icon { font-size: 18px; }

.ring-svg { width: 38px; height: 38px; }
#ringCircle { transition: stroke-dashoffset 1s ease; }

.stat-value {
    font-family: var(--font-head);
    font-size: 26px; font-weight: 800; line-height: 1;
    margin-bottom: 4px;
}

.accent-gold .stat-value { color: var(--gold); }
.accent-blue .stat-value { color: var(--blue); }
.accent-teal .stat-value { color: var(--teal); }
.accent-purple .stat-value { color: var(--purple); }

.stat-label { font-size: 11px; color: var(--text-dim); font-weight: 500; letter-spacing: 0.2px; }

/* ─── DASHBOARD ROW ─────────────────────── */
.dashboard-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
    gap: 12px;
    margin-bottom: 16px;
}

.panel { padding: 18px 20px; }

.panel-title {
    font-family: var(--font-head);
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.8px; color: var(--text-faint);
    text-transform: uppercase;
    margin-bottom: 14px;
}

/* TOP LIST */
.top-list { display: flex; flex-direction: column; gap: 8px; }

.top-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: var(--bg2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: border-color 0.18s;
}
.top-item:hover { border-color: rgba(191,70,70,0.3); }

.top-rank {
    font-family: var(--font-head); font-size: 16px; font-weight: 800;
    color: var(--text-faint); width: 18px; flex-shrink: 0;
}
.top-item:nth-child(1) .top-rank { color: var(--gold); }
.top-item:nth-child(2) .top-rank { color: #9ca3af; }
.top-item:nth-child(3) .top-rank { color: #b87333; }

.top-img { width: 36px; height: 36px; border-radius: 7px; object-fit: cover; flex-shrink: 0; }

.top-info { flex: 1; min-width: 0; }
.top-name { font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-xp { font-size: 11px; color: var(--text-dim); margin-top: 1px; }

.top-level {
    font-family: var(--font-head); font-weight: 700; font-size: 11px;
    padding: 2px 8px; border-radius: 20px; flex-shrink: 0;
}

/* LEVEL DISTRIBUTION */
.level-dist { display: flex; flex-direction: column; gap: 6px; }

.dist-row {
    display: grid;
    grid-template-columns: 48px 1fr 32px;
    align-items: center; gap: 8px;
}

.dist-label { font-weight: 600; color: var(--text-dim); text-align: right; font-size: 11px; }
.dist-bar-track { height: 6px; background: var(--bg2); border-radius: 5px; overflow: hidden; }
.dist-bar-fill { height: 100%; border-radius: 5px; transition: width 0.8s ease; }
.dist-count { font-size: 11px; color: var(--text-dim); text-align: right; }

/* HISTORY PANEL */
.history-panel { font-size: 13px; }

.history-entry {
    display: flex; justify-content: space-between; align-items: center;
    padding: 7px 0; border-bottom: 1px solid var(--border);
}
.history-entry:last-child { border-bottom: none; }
.history-date { color: var(--text-dim); font-size: 11px; }
.history-delta { font-weight: 600; color: var(--teal); font-size: 12px; }
.history-delta.negative { color: var(--red); }
.history-empty { color: var(--text-faint); font-size: 12px; padding: 16px 0; text-align: center; }

/* ─── PROGRESS BAR ──────────────────────── */
.progress-card { margin-bottom: 16px; padding: 16px 20px; }

.progress-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
    font-size: 12px; font-weight: 600; color: var(--text-dim);
}

.progress-count { font-family: var(--font-head); font-size: 14px; color: var(--text); }

.progress-track {
    height: 12px; background: var(--bg2);
    border-radius: 20px; overflow: hidden;
    border: 1px solid var(--border);
}

#levelBar {
    height: 100%; width: 0%;
    display: flex; align-items: center; justify-content: flex-end;
    padding-right: 8px;
    font-size: 10px; font-weight: 700; color: #FFF4EA;
    background: linear-gradient(90deg, var(--gold), var(--gold-light));
    border-radius: 20px;
    transition: width 0.8s cubic-bezier(.4,0,.2,1);
}

/* ─── TODO LIST ─────────────────────────── */
.todo-section { margin-bottom: 16px; }

.todo-section .card { padding: 18px 20px; }

.todo-title {
    font-family: var(--font-head);
    font-size: 11px; font-weight: 700;
    letter-spacing: 0.8px; color: var(--text-faint);
    text-transform: uppercase;
    margin-bottom: 14px;
    display: flex; align-items: center; justify-content: space-between;
}

.todo-count-badge {
    background: var(--gold); color: #FFF4EA;
    font-size: 11px; font-weight: 700;
    padding: 2px 8px; border-radius: 20px;
    font-family: var(--font-body);
}

.todo-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 8px;
}

.todo-item {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 10px;
    background: var(--bg2);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    transition: border-color 0.18s;
}
.todo-item:hover { border-color: rgba(191,70,70,0.3); }

.todo-img { width: 32px; height: 32px; border-radius: 6px; object-fit: cover; flex-shrink: 0; }

.todo-info { flex: 1; min-width: 0; }
.todo-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.todo-sub  { font-size: 10px; color: var(--text-dim); margin-top: 1px; }

.todo-games {
    font-family: var(--font-head);
    font-size: 11px; font-weight: 700;
    color: var(--gold); white-space: nowrap;
    flex-shrink: 0;
}

.todo-toggle {
    background: none; border: none; cursor: pointer;
    color: var(--gold); font-size: 12px;
    font-family: var(--font-body);
    padding: 2px 8px;
    border-radius: 6px;
    border: 1px solid var(--border);
    transition: all 0.15s;
}
.todo-toggle:hover { background: var(--gold-dim); }

/* ─── FILTERS ───────────────────────────── */
.filter-row {
    display: flex; gap: 10px;
    flex-wrap: wrap; align-items: flex-end;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 20px;
    margin-bottom: 20px;
}

.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group.flex1 { flex: 1; min-width: 140px; }

.filter-group label {
    font-size: 10px; font-weight: 700;
    letter-spacing: 0.9px; text-transform: uppercase;
    color: var(--text-faint);
}

.filter-group select,
.filter-group input {
    padding: 8px 12px; height: 34px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--bg2);
    color: var(--text);
    font-family: var(--font-body); font-size: 12px;
    outline: none; transition: border-color 0.2s;
}
.filter-group select:focus, .filter-group input:focus { border-color: var(--gold); }

.filter-results {
    display: flex; align-items: flex-end;
    padding-bottom: 1px;
    font-size: 12px; color: var(--text-dim);
    margin-left: auto;
}

/* ─── CHAMPION GRID ─────────────────────── */
.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(155px, 1fr));
    gap: 12px;
}

/* CHAMPION CARD */
.card-champion {
    padding: 0; overflow: hidden;
    position: relative;
    transition: transform 0.2s, border-color 0.2s, box-shadow 0.2s;
    animation: fadeUp 0.35s ease both;
    cursor: default;
}

.card-champion:hover {
    transform: translateY(-4px);
    border-color: rgba(191,70,70,0.45);
    box-shadow: 0 10px 30px rgba(0,0,0,0.45);
}

/* IMAGE WRAPPER — taller image */
.champ-img-wrap {
    position: relative;
    height: 120px;
    overflow: hidden;
}

.champ-img-wrap img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.35s ease;
}

.card-champion:hover .champ-img-wrap img { transform: scale(1.06); }

.champ-img-wrap::after {
    content: '';
    position: absolute; inset: 0;
    background: linear-gradient(to bottom, transparent 45%, rgba(15,22,33,0.88) 100%);
    pointer-events: none;
}

/* Name on image (bottom of image) */
.champ-name-overlay {
    position: absolute;
    bottom: 6px; left: 10px; right: 36px;
    z-index: 1;
    font-family: var(--font-head);
    font-size: 12px; font-weight: 700;
    color: #fff;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
    text-shadow: 0 1px 4px rgba(0,0,0,0.8);
}

/* LEVEL BADGE — small, top-right */
.level-badge {
    position: absolute;
    top: 7px; right: 7px; z-index: 1;
    padding: 2px 7px;
    font-family: 'DM Sans', sans-serif;
    font-size: 10px; font-weight: 700;
    border-radius: 5px;
    color: #fff;
    letter-spacing: 0.3px;
    border: 1px solid rgba(255,255,255,0.15);
    backdrop-filter: blur(4px);
}

.goal-reached-badge {
    position: absolute;
    top: 7px; left: 7px; z-index: 1;
    font-size: 13px;
    filter: drop-shadow(0 0 5px rgba(191,70,70,0.7));
}

/* CARD CONTENT — compact */
.card-content { padding: 10px 12px 12px; }

/* XP Row: number + percent */
.xp-row {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 5px;
}

.xp-number { font-size: 10px; color: var(--text-dim); }

.xp-percent {
    font-family: var(--font-head);
    font-size: 11px; font-weight: 700;
    color: var(--text);
}

.games-hint {
    font-size: 10px; color: var(--gold);
    margin-bottom: 5px;
    font-weight: 500;
}

.progress-bar { height: 3px; background: var(--bg2); border-radius: 5px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 5px; transition: width 0.6s ease; }

/* GOAL REACHED tint */
.card-champion.goal-reached {
    border-color: rgba(191,70,70,0.3);
    box-shadow: 0 0 18px rgba(191,70,70,0.08);
}

/* ─── LEVEL COLORS ──────────────────────── */
.level-1  { background: #374151; }
.level-2  { background: #15803d; }
.level-3  { background: #1d4ed8; }
.level-4  { background: #7e22ce; }
.level-5  { background: #c2410c; }
.level-6  { background: #a16207; }
.level-7  { background: #b91c1c; }
.level-elite { background: linear-gradient(135deg,#0d9488,#0369a1); }

.fill-1 { background: #4b5563; }
.fill-2 { background: #16a34a; }
.fill-3 { background: #2563eb; }
.fill-4 { background: #9333ea; }
.fill-5 { background: #ea580c; }
.fill-6 { background: #ca8a04; }
.fill-7 { background: #dc2626; }
.fill-elite { background: linear-gradient(90deg,#0BC4B0,#0d9488); }

/* ─── EMPTY STATE ───────────────────────── */
.empty-state {
    text-align: center; padding: 70px 20px;
    color: var(--text-dim);
}
.empty-icon { font-size: 48px; margin-bottom: 18px; opacity: 0.2; }
.empty-state h2 { font-family: var(--font-head); font-size: 18px; font-weight: 700; margin-bottom: 8px; color: var(--text); }
.empty-state p { font-size: 13px; color: var(--text-dim); }

/* ─── ANIMATIONS ────────────────────────── */
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ─── MOBILE ────────────────────────────── */
@media (max-width: 900px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .dashboard-row { grid-template-columns: 1fr; }
}
@media (max-width: 600px) {
    .site-header { flex-direction: column; align-items: flex-start; }
    .account-bar { flex-direction: column; }
    .btn-group { flex-wrap: wrap; }
    .grid { grid-template-columns: repeat(2, 1fr); }
    .filter-row { flex-direction: column; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
