:root {
    --bg: #0a0a0f;
    --surface: #12121a;
    --accent: #00f5ff;
    --accent2: #ff00aa;
    --text: #e0e0ff;
    --text-muted: #8899aa;
    
    /* Кольори стилів */
    --normal-color: #4a9eff;
    --gold-color: #ffd700;
    --gummy-color: #ff6bff;
    --galaxy-color: #8b00ff;
    --gem-color: #00ff9d;
    --holofoil-color: #00ffff;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'Segoe UI', system-ui, sans-serif;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 50% 20%, rgba(0, 245, 255, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(255, 0, 170, 0.06) 0%, transparent 50%);
}

.app {
    max-width: 1600px;
    margin: 0 auto;
    padding: 20px;
}

/* Auth Screen */
.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
}

.auth-card {
    background: var(--surface);
    padding: 3rem 2.5rem;
    border-radius: 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
    text-align: center;
    max-width: 420px;
    border: 1px solid rgba(0, 245, 255, 0.2);
}

.auth-card h1 {
    font-size: 2.8rem;
    background: linear-gradient(90deg, var(--accent), var(--accent2));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-bottom: 0.5rem;
}

.subtitle {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
}

input[type="text"] {
    width: 100%;
    padding: 16px 20px;
    background: #1a1a24;
    border: 2px solid #333;
    border-radius: 12px;
    color: white;
    font-size: 1.1rem;
    margin-bottom: 1rem;
    transition: all 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 4px rgba(0, 245, 255, 0.15);
}

button {
    background: linear-gradient(90deg, var(--accent), #00b8ff);
    color: #000;
    font-weight: 700;
    padding: 16px 32px;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    font-size: 1.1rem;
    transition: all 0.3s;
    width: 100%;
}

button:hover {
    transform: translateY(-3px);
    box-shadow: 0 15px 30px rgba(0, 245, 255, 0.3);
}

/* Header */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.logo {
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: -2px;
}

.logo span {
    color: var(--accent);
}

.user-panel {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--surface);
    padding: 10px 20px;
    border-radius: 9999px;
    border: 1px solid rgba(0,245,255,0.2);
}

.username {
    font-weight: 600;
    font-size: 1.1rem;
}

.collection-count {
    background: var(--accent);
    color: #000;
    padding: 4px 14px;
    border-radius: 9999px;
    font-weight: 700;
    font-size: 1.05rem;
}

/* Main Layout */
.main-content {
    display: flex;
    gap: 2rem;
}

.leaderboard-sidebar {
    width: 320px;
    background: var(--surface);
    border-radius: 20px;
    padding: 1.5rem;
    height: fit-content;
    position: sticky;
    top: 20px;
    border: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 10px 40px rgba(0,0,0,0.4);
}

.leaderboard-sidebar h2 {
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    display: flex;
    align-items: center;
    gap: 10px;
}

.leaderboard-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.leader-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #1a1a24;
    padding: 14px 18px;
    border-radius: 14px;
    transition: all 0.2s;
}

.leader-item:hover {
    transform: translateX(6px);
    background: #22222e;
}

.top1 {
    background: linear-gradient(90deg, #ffd700, #ffaa00) !important;
    color: #000;
    font-weight: 700;
}

.rank {
    font-weight: 700;
    color: var(--accent);
    min-width: 32px;
}

.lb-username {
    flex: 1;
    font-weight: 500;
}

.lb-count {
    font-weight: 700;
    color: var(--accent);
}

/* Matrix Grid */
.matrix-container {
    flex: 1;
}

.matrix-grid {
    display: grid;
    grid-template-columns: 180px repeat(6, 1fr);
    gap: 8px;
    background: var(--surface);
    padding: 20px;
    border-radius: 20px;
    border: 1px solid rgba(255,255,255,0.08);
}

.matrix-header-row {
    display: contents;
}

.header-cell {
    background: #1f1f2e;
    padding: 16px 12px;
    text-align: center;
    font-weight: 700;
    font-size: 0.95rem;
    border-radius: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.static-column {
    background: #181824;
    font-weight: 700;
    color: white;
    position: sticky;
    left: 0;
    z-index: 10;
}

.matrix-row {
    display: contents;
}

.character-label {
    background: #181824;
    padding: 20px 16px;
    display: flex;
    align-items: center;
    font-weight: 600;
    border-radius: 12px;
    box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

.grid-cell {
    aspect-ratio: 1 / 1;
}

.sprite-card {
    width: 100%;
    height: 100%;
    background: #1a1a24;
    border: 3px solid #333;
    border-radius: 16px;
    overflow: hidden;
    position: relative;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: flex;
    flex-direction: column;
}

.sprite-card:hover {
    border-color: var(--accent);
    transform: scale(1.04) translateY(-8px);
    box-shadow: 0 20px 40px rgba(0, 245, 255, 0.25);
}

.sprite-card.checked {
    border-color: #00ff9d;
    background: rgba(0, 255, 157, 0.08);
}

.image-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,0.4);
    position: relative;
}

.sprite-img {
    max-width: 85%;
    max-height: 85%;
    object-fit: contain;
    filter: drop-shadow(0 10px 20px rgba(0,0,0,0.6));
    transition: transform 0.4s;
}

.sprite-card:hover .sprite-img {
    transform: scale(1.1);
}

.checkbox-indicator {
    position: absolute;
    bottom: 12px;
    right: 12px;
    background: rgba(0,0,0,0.7);
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.3rem;
    border: 2px solid rgba(255,255,255,0.2);
    transition: all 0.3s;
}

.sprite-card.checked .checkbox-indicator {
    background: #00ff9d;
    color: #000;
    border-color: #00ff9d;
}

/* Responsive */
@media (max-width: 1100px) {
    .main-content {
        flex-direction: column;
    }
    .leaderboard-sidebar {
        width: 100%;
        position: static;
    }
    
    .matrix-grid {
        grid-template-columns: 140px repeat(6, 1fr);
    }
}