:root { --bg:#0e0f14; --fg:#e8e9f0; --muted:#a2a7b5; --card:#171925; --accent:#4f46e5; --accent-2:#6366f1; --boost-color: #22c55e; }
[data-theme="midnight"] { --bg: #111827; --fg: #f3f4f6; --muted: #9ca3af; --card: #1f2937; --accent: #818cf8; --accent-2: #a5b4fc; }
[data-theme="deepblue"] { --bg: #0c142c; --fg: #dbeafe; --muted: #93c5fd; --card: #152248; --accent: #2563eb; --accent-2: #3b82f6; }
[data-theme="slate"] { --bg: #1e293b; --fg: #f1f5f9; --muted: #94a3b8; --card: #334155; --accent: #f43f5e; --accent-2: #fb7185; }
[data-theme="forest"] { --bg: #1a2e29; --fg: #e6f7f3; --muted: #84a199; --card: #25403a; --accent: #34d399; --accent-2: #6ee7b7; }
[data-theme="sunset"] { --bg: #2d1a22; --fg: #fee2e2; --muted: #fca5a5; --card: #452833; --accent: #f97316; --accent-2: #fb923c; }
[data-theme="cherry"] { --bg: #301014; --fg: #fecdd3; --muted: #f9a8d4; --card: #4e1a22; --accent: #ec4899; --accent-2: #f472b6; }
[data-theme="retro"] { --bg: #2a2135; --fg: #f5d0fe; --muted: #d8b4fe; --card: #3b2d4a; --accent: #a855f7; --accent-2: #c084fc; }
/* XP Ladder Themes */
[data-theme="hacker"] { --bg: #0d110d; --fg: #00ff41; --muted: #00b32d; --card: #131a13; --accent: #00ff41; --accent-2: #33ff66; }
[data-theme="ocean"] { --bg: #0f172a; --fg: #e0f2fe; --muted: #7dd3fc; --card: #1e293b; --accent: #38bdf8; --accent-2: #7dd3fc; }
[data-theme="desert"] { --bg: #4d2d1d; --fg: #ffedd5; --muted: #fbbf24; --card: #653b26; --accent: #f59e0b; --accent-2: #fbbf24; }
[data-theme="lavender"] { --bg: #2b223a; --fg: #e9d5ff; --muted: #c084fc; --card: #3d3151; --accent: #a855f7; --accent-2: #c084fc; }
[data-theme="rose"] { --bg: #4c1d25; --fg: #ffe4e6; --muted: #fda4af; --card: #6b2a36; --accent: #f43f5e; --accent-2: #fb7185; }
[data-theme="jungle"] { --bg: #14211a; --fg: #d1fae5; --muted: #6ee7b7; --card: #1a3226; --accent: #10b981; --accent-2: #34d399; }
[data-theme="sky"] { --bg: #1e2b4f; --fg: #dbeafe; --muted: #93c5fd; --card: #2b3a69; --accent: #60a5fa; --accent-2: #93c5fd; }
[data-theme="crimson"] { --bg: #2a0f12; --fg: #fee2e2; --muted: #fca5a5; --card: #3f161b; --accent: #ef4444; --accent-2: #f87171; }
[data-theme="space"] { --bg: #0c0a1a; --fg: #e9d5ff; --muted: #d8b4fe; --card: #1a1533; --accent: #c084fc; --accent-2: #d8b4fe; }
[data-theme="solar"] { --bg: #2d1607; --fg: #fff7ed; --muted: #fdba74; --card: #45220c; --accent: #f97316; --accent-2: #fb923c; }

* { box-sizing: border-box; }
html,body { margin:0; padding:0; background:var(--bg); color:var(--fg); font-family:"Noto Sans", system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif; }
img { max-width:100%; display:block; }
a { color:inherit; text-decoration:none; }
.site-header { position:sticky; top:0; z-index:10; display:flex; align-items:center; justify-content:space-between; gap:16px; padding:14px 20px; border-bottom:1px solid #1f2330; background:rgba(14,15,20,.85); backdrop-filter:saturate(1.2) blur(8px); }
.brand { display:flex; align-items:center; gap:10px; }
.brand img { width: 32px; height: 32px; }
.brand h1 { font-size:20px; font-weight:800; letter-spacing:.2px; margin:0; }
.top-nav { display:flex; gap:16px; align-items: center; }
.top-nav a { padding:6px 10px; border-radius:8px; transition:background .2s; color: var(--fg); }
.top-nav a:hover { background:var(--card); }
.dropdown { position: relative; }
.dropdown-toggle::after { content: ' ▼'; font-size: 0.7em; }
.dropdown-menu { display: none; position: absolute; top: 100%; left: 0; background: var(--card); border-radius: 8px; border: 1px solid #2d303d; z-index: 11; min-width: 150px; padding: 0; margin-top: 4px; overflow: hidden; }
.dropdown:hover .dropdown-menu { display: block; }
.dropdown-menu a { display: block; padding: 8px 12px; border-radius: 0; width: 100%; }
.dropdown-menu a:hover { background: var(--accent); }

.user-display { color: var(--muted); font-size: 14px; }
.wallet { display:flex; align-items: center; gap:10px; font-weight:600; }
.wallet-item { background:var(--card); padding: 4px 10px 4px 4px; border-radius:20px; color:var(--fg); border: 1px solid #2d303d; display: flex; align-items: center; gap: 8px; }
.coins-display { padding-right: 10px; padding-left: 10px; gap: 6px; }
.coin-icon { width: 18px; height: 18px; }
.level-badge { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: white; display: grid; place-items: center; font-size: 14px; font-weight: 800; flex-shrink: 0; }
.xp-bar-container { position: relative; height: 16px; width: 120px; background-color: #0e0f14; border-radius: 10px; overflow: hidden; }
.xp-bar { height: 100%; background: var(--accent-2); border-radius: 10px; transition: width .3s ease; }
.xp-text { position: absolute; inset: 0; text-align: center; font-size: 11px; line-height: 16px; color: white; text-shadow: 0 0 2px rgba(0,0,0,0.7); }
.xp-boost-indicator { font-size: 11px; font-weight: 800; color: white; background-color: var(--boost-color); padding: 2px 6px; border-radius: 6px; margin-left: -4px; display: none; }
.xp-boost-indicator.active { display: block; }

main { max-width:1120px; margin:0 auto; padding:20px; }

.hero { display:grid; grid-template-columns: 1.2fr 1fr; gap:20px; align-items:stretch; margin:18px 0 30px; padding:16px; border:1px solid #1f2330; border-radius:16px; background:linear-gradient(180deg, #111425, #0e0f14); }
.hero-media { position:relative; overflow:hidden; border-radius:12px; background:#000; }
.hero-media img { width:100%; height:100%; object-fit:cover; aspect-ratio:16/9; }
.btn { border:1px solid var(--accent); background:var(--accent); color:#fff; padding:10px 14px; border-radius:10px; font-weight:700; cursor:pointer; transition:transform .06s ease, opacity .2s, background-color .2s; }
.btn:hover { background-color: var(--accent-2); transform:translateY(-1px); }
.btn:disabled { background: #3730a3; cursor: not-allowed; opacity: 0.7; }
.btn.primary { position:absolute; right:12px; bottom:12px; }
.hero-info h2 { margin:0 0 8px; font-size:28px; }
.hero-meta { display:flex; gap:8px; }
.tag { font-size:12px; color:#e0e7ff; background:var(--accent); padding:4px 8px; border-radius:999px; }

.xp-ladder-section {
    border: 1px solid #1f2330;
    border-radius: 14px;
    padding: 12px;
    margin: 24px 0;
    background: var(--card);
}
.xp-ladder-section h3 { margin: 0 0 12px; font-size: 20px; }
.xp-ladder-container {
    overflow-x: auto;
    padding-bottom: 10px; /* For scrollbar */
    scrollbar-width: thin;
    scrollbar-color: var(--accent) var(--bg);
}
.xp-ladder-rail {
    display: flex;
    gap: 8px;
    width: max-content;
}
.ladder-item {
    display: flex;
    align-items: center;
    gap: 8px;
}
.ladder-reward {
    width: 120px;
    height: 120px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px;
    border-radius: 12px;
    background: var(--bg);
    border: 1px solid #2d303d;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.ladder-reward[data-unlocked="true"] {
    border-color: var(--accent);
}
.ladder-reward[data-active="true"] {
    outline: 2px solid var(--accent-2);
    box-shadow: 0 0 10px var(--accent-2);
}
.ladder-reward .icon {
    width: 32px;
    height: 32px;
}
.ladder-reward .name {
    font-size: 12px;
    font-weight: 600;
}
.ladder-reward .level-req {
    position: absolute;
    top: 4px;
    right: 6px;
    font-size: 11px;
    font-weight: 800;
    color: var(--muted);
}
.ladder-reward[data-unlocked="true"] .level-req {
    color: var(--accent);
}
.ladder-reward::after {
    content: '🔒';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    font-size: 24px;
    background: rgba(14, 15, 20, 0.7);
    backdrop-filter: blur(2px);
    transition: opacity 0.3s;
}
.ladder-reward[data-unlocked="true"]::after {
    opacity: 0;
    pointer-events: none;
}
.ladder-progress {
    width: 40px;
    height: 8px;
    background: #2d303d;
    border-radius: 4px;
    overflow: hidden;
}
.ladder-progress .bar {
    height: 100%;
    width: 0%;
    background: var(--accent);
}

.categories h3, .missions h3, .daily-reward-section h3 { margin:10px 0 12px; font-size:20px; }
.category-sections { display:flex; flex-direction:column; gap:24px; }
.category { border:1px solid #1f2330; border-radius:14px; padding:12px; background: var(--card); }
.category-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.grid { display:grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap:12px; }
.card { background:var(--bg); border-color:#22283a; overflow:hidden; border:1px solid #2d303d; border-radius: 12px; display:flex; flex-direction:column; transition: transform .2s, box-shadow .2s; }
.card:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.card img { aspect-ratio: 16 / 10; object-fit:cover; }
.card .meta { padding:10px; display:flex; align-items:center; justify-content:space-between; gap:8px; }
.card .title { font-weight:700; font-size:14px; line-height:1.2; }
.small { font-size:12px; color:var(--muted); }

.missions { border:1px solid #1f2330; border-radius:14px; padding:12px; margin:24px 0; background: var(--card); }
.missions-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:8px; }
.mission-list { list-style:none; margin:0; padding:0; display:flex; flex-direction:column; gap:10px; }
.mission { display:flex; align-items:center; justify-content:space-between; gap:12px; border:1px solid #2d303d; border-radius:12px; padding:10px; background:var(--bg); color:var(--fg); }
.progress { height:6px; background:#2d303d; border-radius:6px; overflow:hidden; flex:1; margin:0 8px; }
.progress > span { display:block; height:100%; width:0; background:var(--accent); transition:width .3s ease; }
.mission-note { margin-top:8px; color:var(--muted); font-size:12px; }
.daily-reward-section { border:1px solid #1f2330; border-radius:14px; padding:12px; margin:24px 0; background: var(--card); }

.site-footer { max-width:1120px; margin:0 auto; padding:20px; display:flex; align-items:center; justify-content:space-between; color:var(--muted); border-top:1px solid #1f2330; }
.footer-nav { display: flex; gap: 16px; }
.footer-nav a { color: var(--muted); }
.footer-nav a:hover { color: var(--fg); }

.modal.hidden { display:none; }
.modal .modal-backdrop { position:fixed; inset:0; background:rgba(0,0,0,.5); backdrop-filter: blur(4px); }
.modal .modal-content { position:fixed; inset:auto 0 0 0; margin:auto; top:8vh; max-width:900px; width:90vw; background:var(--card); border:1px solid #2d303d; border-radius:16px; padding:12px; z-index:20; display:flex; flex-direction:column; gap:10px; color: var(--fg); }
.modal-header { display:flex; align-items:center; justify-content:space-between; }
.icon-btn { background:var(--bg); border:1px solid #2d303d; color: var(--fg); border-radius:10px; padding:6px 8px; cursor:pointer; }
.tabs { display:flex; gap:8px; }
.tab { padding:8px 12px; border:1px solid #2d303d; border-radius:20px; background:var(--bg); color: var(--fg); cursor:pointer; }
.tab.active { background:var(--accent); border-color:var(--accent); color:#fff; }
.boards { min-height:320px; max-height: 60vh; overflow-y: auto; }
.board { display:none; }
.board.active { display:block; }
.table { width:100%; border-collapse:collapse; }
.table th, .table td { text-align:left; padding:8px; border-bottom:1px solid #2d303d; }
.table .medal { font-size: 16px; vertical-align: middle; margin-left: 4px; }
.table tr.player-row { background-color: var(--accent); color: white; }
.table tr.player-row .uname { font-weight: bold; }
.rank { width:48px; text-align:right; color:var(--muted); }
.uname { font-weight:700; }
.score { font-variant-numeric: tabular-nums; }

@media (max-width: 900px) {
  .hero { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* See all tile */
.card.see-all { display:grid; place-items:center; color:#fff; background:var(--accent); border-color:var(--accent); }
.card.see-all .title { color:#dbeafe; }

/* Shop */
.shop-modal .modal-content { max-height: 80vh; overflow-y: auto; }
.shop-grid { display:grid; grid-template-columns: repeat(auto-fill,minmax(200px,1fr)); gap:10px; }
.shop-section-header { grid-column: 1 / -1; margin: 12px 0 4px; font-size: 16px; color: var(--muted); border-bottom: 1px solid #2d303d; padding-bottom: 4px; }
.shop-section-header:first-child { margin-top: 0; }
.shop-item { display:flex; flex-direction:column; align-items:center; gap:10px; padding:16px; border-radius:12px; background:var(--bg); color:#e5e7eb; border:1px solid #2d303d; cursor:pointer; text-align:center; transition: transform .2s, box-shadow .2s; }
.shop-item:hover { transform: translateY(-4px); box-shadow: 0 10px 20px rgba(0,0,0,0.2); }
.shop-item .icon { width:48px; height:48px; flex:0 0 48px; filter: drop-shadow(0 1px 0 rgba(0,0,0,.2)); margin-bottom: 8px; }
.shop-item[data-owned="true"] { border-color: var(--accent); }
.shop-item[data-owned="true"] .shop-item-cost::before { content: ''; }
.shop-item[data-owned="true"] .shop-item-cost { content: '(Owned)'; }
.shop-item[data-active="true"] { background-color: var(--accent); }
.shop-item-name { font-weight: 600; }
.shop-item-cost { font-size: 14px; color: var(--muted); }
.shop-item-cost::before { content: '◎ '; }
.shop-item[data-type="reward"] .shop-item-cost::before, .shop-item[data-type="vanity"] .shop-item-cost::before { content: ''; }
.shop-item[data-cost="0"] .shop-item-cost::before { content: ''; }
.shop-item[data-cost="0"] .shop-item-cost { color: #4ade80; }

/* Username changer */
.username-dresser { max-width: 900px !important; }
.dresser-preview { text-align: center; font-size: 20px; padding: 12px; background: var(--bg); border-radius: 12px; margin-bottom: 12px; }
.dresser-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 16px; }
.dresser-section h4 { margin: 0 0 8px; }
.word-list { display: flex; flex-direction: column; gap: 6px; max-height: 40vh; overflow-y: auto; background: var(--bg); padding: 8px; border-radius: 8px; }
.word-item { padding: 8px 12px; border-radius: 8px; border: 1px solid #2d303d; background: var(--card); cursor: pointer; transition: background .2s; }
.word-item:hover { background: var(--accent-2); }
.word-item.active { background: var(--accent); border-color: var(--accent); }
.word-item.locked { opacity: 0.6; }
.cost-note { font-size: 12px; color: var(--muted); margin-top: 8px; }
.number-roll { display: flex; align-items: center; gap: 8px; }
.number-roll span { font-size: 20px; font-weight: bold; padding: 8px; background: var(--bg); border-radius: 8px; }
.username-dresser .btn.primary { width: 100%; padding: 12px; font-size: 16px; }

.name-glitch { position: relative; text-shadow: 1px 0 #f00, -1px 0 #0ff; animation: glitch 1s infinite steps(2,end); }
@keyframes glitch { 0%{transform:translate(0)} 20%{transform:translate(1px,-1px)} 40%{transform:translate(-1px,1px)} 60%{transform:translate(1px,1px)} 80%{transform:translate(-1px,-1px)} 100%{transform:translate(0)} }
.name-wavy { display:inline-block; animation: wave 1.8s infinite ease-in-out; }
@keyframes wave { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-2px)} }
.name-colorful { background: linear-gradient(90deg,#f59e0b,#ef4444,#8b5cf6,#10b981); -webkit-background-clip:text; background-clip:text; color: transparent; }
.name-outline { text-shadow: 0 1px 0 #000, 1px 0 0 #000, 0 -1px 0 #000, -1px 0 0 #000; }

/* XP Ladder Name FX */
.name-fire { text-shadow: 0 0 4px #ff4500, 0 0 8px #ff6347, 0 0 12px #ff7f50; animation: flicker 1.5s infinite alternate; }
@keyframes flicker { from { text-shadow: 0 0 4px #ff4500, 0 0 8px #ff6347; } to { text-shadow: 0 0 6px #ff4500, 0 0 12px #ff6347, 0 0 2px white; } }
.name-ice { text-shadow: 0 0 4px #00bfff, 0 0 8px #87ceeb, 1px 1px 2px white; color: #e0ffff; }
.name-electric { text-shadow: 0 0 5px #ffd700, 0 0 10px #ffff00; animation: electric-crackle 0.1s infinite; }
@keyframes electric-crackle { 0%, 100% { transform: skewX(0); } 50% { transform: skewX(0.5deg); } }
.name-shadow { text-shadow: 2px 2px 3px #111, 0 0 5px #555; }
.name-shiny { background: linear-gradient(135deg, #ffffff 30%, #f0f0f0 50%, #ffffff 70%); -webkit-background-clip: text; background-clip: text; color: transparent; animation: shiny-anim 3s infinite; }
@keyframes shiny-anim { 0%, 100% { background-position: -200% 0; } 50% { background-position: 200% 0; } }
.name-toxic { color: #90ee90; text-shadow: 0 0 5px #32cd32, 0 0 10px #00ff00; }
.name-rainbow { background: linear-gradient(to right, red, orange, yellow, green, blue, indigo, violet); -webkit-background-clip: text; background-clip: text; color: transparent; animation: rainbow-flow 4s linear infinite; background-size: 200% 200%; }
@keyframes rainbow-flow { 0% { background-position: 0% 50%; } 100% { background-position: 200% 50%; } }
.name-gold { color: #ffd700; text-shadow: 0 1px 0 #b8860b, 0 0 5px #ffec8b; }
.name-plasma { background: linear-gradient(90deg, #ec4899, #8b5cf6); -webkit-background-clip: text; background-clip: text; color: transparent; animation: plasma-anim 2s infinite alternate; }
@keyframes plasma-anim { from { filter: hue-rotate(0deg); } to { filter: hue-rotate(60deg); } }
.name-void { color: #d8b4fe; text-shadow: 0 0 5px #a855f7, 0 0 10px #4c1d95; animation: void-pulse 2s infinite; }
@keyframes void-pulse { 0%, 100% { opacity: 0.8; } 50% { opacity: 1; } }

.progress-label {
    font-size: 12px;
    color: var(--muted);
    text-align: right;
}

.leaderboard-achievements {
    margin-top: 24px;
    background: var(--card);
    border: 1px solid #2d303d;
    border-radius: 12px;
    padding: 16px;
}
.leaderboard-achievements h3 {
    margin-top: 0;
}
.achievements-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 16px;
}

/* PFP Wheel Styles */
.pfp-wheel-container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 200px;
    margin: 20px 0;
}

.pfp-spin-item {
    width: 120px;
    height: 120px;
    animation: pfp-spin 0.1s linear infinite;
}

@keyframes pfp-spin {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.1); }
    100% { transform: rotate(360deg) scale(1); }
}

.pfp-result {
    text-align: center;
    animation: pfp-reveal 0.5s ease-out;
}

.pfp-result-name {
    margin-top: 10px;
    font-weight: 600;
    color: var(--accent);
}

@keyframes pfp-reveal {
    0% { transform: scale(0.5); opacity: 0; }
    100% { transform: scale(1); opacity: 1; }
}

.pfp-thumb {
    display: inline-block;
    width: 24px;
    height: 24px;
    margin-right: 6px;
    vertical-align: middle;
    border-radius: 50%;
    overflow: hidden;
}

.pfp-thumb svg {
    width: 100%;
    height: 100%;
}

/* Rarity glow effects */
.pfp-thumb[data-rarity="rare"] { box-shadow: 0 0 8px #ff6600; }
.pfp-thumb[data-rarity="epic"] { box-shadow: 0 0 12px #9966ff; }
.pfp-thumb[data-rarity="legendary"] { box-shadow: 0 0 16px #00ffff, 0 0 20px #ff00ff; }
.pfp-thumb[data-rarity="mythic"] { box-shadow: 0 0 20px #ff0000, 0 0 25px #000000; }