/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

/* ── Personal stats panel ────────────────────────────── */
.puzzle-user-panel {
    max-width: 480px;
    margin: 1.5rem auto;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.puzzle-personal-card {
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 1rem;
}

.puzzle-personal-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 1rem;
}

.puzzle-avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: #dbeafe;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 600;
    color: #1d4ed8;
    flex-shrink: 0;
    text-transform: uppercase;
}

.puzzle-personal-name {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    margin: 0;
}

.puzzle-personal-sub {
    font-size: 12px;
    color: #888;
    margin: 2px 0 0;
}

.puzzle-stats-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.puzzle-stat-box {
    background: #f6f6f6;
    border-radius: 8px;
    padding: 10px 14px;
}

.puzzle-stat-label {
    font-size: 11px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin: 0;
}

.puzzle-stat-value {
    font-size: 22px;
    font-weight: 600;
    color: #111;
    margin: 4px 0 0;
}

/* ── Leaderboard table card ──────────────────────────── */
.leaderboard {
    max-width: 480px;
    margin: 0 auto 1.5rem;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.leaderboard h2 {
    font-size: 15px;
    font-weight: 600;
    color: #111;
    margin: 0;
    padding: 1.1rem 1.5rem 0.9rem;
    border-bottom: 1px solid #f0f0f0;
}

.leaderboard table {
    width: 100%;
    border-collapse: collapse;
}

.leaderboard th {
    font-size: 11px;
    font-weight: 600;
    color: #999;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    padding: 9px 1.5rem;
    text-align: left;
    background: #fafafa;
    border-bottom: 1px solid #f0f0f0;
}

.leaderboard th:nth-child(3),
.leaderboard th:nth-child(4) { text-align: right; }

.leaderboard td {
    padding: 12px 1.5rem;
    font-size: 14px;
    color: #222;
    border-bottom: 1px solid #f5f5f5;
    vertical-align: middle;
}

.leaderboard tr:last-child td { border-bottom: none; }
.leaderboard tbody tr:hover td { background: #fafafa; }

.leaderboard td:nth-child(3),
.leaderboard td:nth-child(4) {
    text-align: right;
    color: #555;
    font-size: 13px;
}

/* Rank badges */
.lb-rank {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    font-size: 12px;
    font-weight: 600;
}

.lb-rank-1 { background: #fde68a; color: #78350f; }
.lb-rank-2 { background: #f1f1f1; color: #555; border: 1px solid #e0e0e0; }
.lb-rank-3 { background: #fed7aa; color: #7c2d12; }
.lb-rank-n { background: #f5f5f5; color: #aaa; border: 1px solid #e8e8e8; }

/* "You" highlight badge */
.lb-you {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: 20px;
    background: #dbeafe;
    color: #1d4ed8;
    margin-left: 8px;
    vertical-align: middle;
}

/* No scores message */
.leaderboard p {
    padding: 1.5rem;
    font-size: 14px;
    color: #888;
    text-align: center;
    margin: 0;
}

/* ── Login form ──────────────────────────────────────── */
.puzzle-form {
    max-width: 360px;
    margin: 2rem auto;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-radius: 12px;
    padding: 1.75rem 1.5rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.puzzle-form input {
    width: 100%;
    padding: 10px 14px;
    margin: 8px 0;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 14px;
    color: #111;
    background: #fff;
    outline: none;
    transition: border-color 0.15s;
}

.puzzle-form input:focus { border-color: #93c5fd; }

.puzzle-form button {
    width: 100%;
    padding: 11px;
    margin-top: 12px;
    background: #2563eb;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}

.puzzle-form button:hover { background: #1d4ed8; }

.puzzle-error {
    font-size: 13px;
    color: #dc2626;
    margin: 6px 0 0;
}

/* ── Logout link ─────────────────────────────────────── */
.puzzle-logout {
    display: inline-block;
    margin-top: 1rem;
    padding: 8px 18px;
    background: #f5f5f5;
    color: #444;
    border-radius: 8px;
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    border: 1px solid #e0e0e0;
    transition: background 0.15s;
}

.puzzle-logout:hover { background: #eee; }
