* { margin: 0; padding: 0; box-sizing: border-box; }
body {
    background: #0f0f1a;
    color: #e8e8e8;
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
    min-height: 100vh;
}
.topnav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 24px;
    border-bottom: 1px solid #1a1a2e;
}
.brand {
    font-size: 18px;
    font-weight: 300;
    letter-spacing: 2px;
    color: #fff;
    text-decoration: none;
}
.nav-right {
    display: flex;
    align-items: center;
    gap: 16px;
}
.nav-link {
    color: #888;
    text-decoration: none;
    font-size: 14px;
}
.nav-link:hover { color: #ccc; }
.auth-btn {
    background: #1a1a2e;
    border: 1px solid #333;
    color: #ccc;
    padding: 6px 14px;
    border-radius: 4px;
    cursor: pointer;
    text-decoration: none;
    font-size: 13px;
}
.auth-btn:hover { background: #252540; }
.user-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    vertical-align: middle;
    margin-right: 6px;
}
.main {
    display: flex;
    gap: 28px;
    align-items: flex-start;
    justify-content: center;
    padding: 24px 20px;
}
.panel { width: 200px; padding-top: 8px; }
.user-card, .puzzle-card {
    background: #1a1a2e;
    border-radius: 8px;
    padding: 16px;
    text-align: center;
}
.rating-display { margin-bottom: 12px; }
.rating-label, .puzzle-rating-label {
    display: block;
    font-size: 12px;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 4px;
}
.rating-value, .puzzle-rating-value {
    font-size: 32px;
    font-weight: 700;
    color: #4ecdc4;
}
.puzzle-rating-value { color: #f7b731; }
.user-stats {
    display: flex;
    justify-content: space-around;
    font-size: 12px;
    color: #888;
}
.stat-num { color: #ccc; font-weight: 600; }
.puzzle-meta {
    margin-top: 10px;
    font-size: 12px;
    color: #666;
}
.rating-change {
    text-align: center;
    font-size: 20px;
    font-weight: 700;
    padding: 8px;
    border-radius: 6px;
    margin-top: 12px;
    animation: fadeIn 0.3s ease;
}
.rating-change.positive { color: #4ecdc4; }
.rating-change.negative { color: #fc5c65; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(-5px); } to { opacity: 1; } }
.board-area {
    display: flex;
    flex-direction: column;
    align-items: center;
}
.gravity-label {
    font-size: 12px;
    color: #555;
    letter-spacing: 4px;
    margin-bottom: 6px;
}
.board-container { position: relative; }
.board {
    display: grid;
    grid-template-columns: repeat(8, 1fr);
    grid-template-rows: repeat(8, 1fr);
    width: min(576px, calc(100vw - 24px));
    height: min(576px, calc(100vw - 24px));
    border: 2px solid #333;
    border-radius: 4px;
}
.cell {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: min(44px, calc((100vw - 24px) / 13));
    cursor: pointer;
    user-select: none;
    position: relative;
}
.cell.light { background: #b7c0d8; }
.cell.dark { background: #5d7a9e; }
.cell.selected { box-shadow: inset 0 0 0 3px #f7b731; }
.cell.hint { background: rgba(247, 183, 49, 0.35); }
.cell.correct { background: rgba(78, 205, 196, 0.5) !important; }
.cell.wrong { background: rgba(252, 92, 101, 0.5) !important; }
.move-dot {
    width: 18px; height: 18px;
    background: rgba(0,0,0,0.25);
    border-radius: 50%;
    pointer-events: none;
}
.capture-dot {
    position: absolute; inset: 3px;
    border-radius: 50%;
    border: 3px solid rgba(0,0,0,0.25);
    pointer-events: none;
}
.piece-w { color: #fff; text-shadow: 0 1px 3px rgba(0,0,0,0.7); }
.piece-b { color: #111; text-shadow: 0 0 2px rgba(255,255,255,0.3); }
.turn-indicator {
    margin-top: 10px;
    font-size: 14px;
    color: #aaa;
    text-align: center;
    min-height: 20px;
}
.hint-text {
    font-size: 14px;
    color: #f7b731;
    text-align: center;
    min-height: 20px;
    margin-top: 6px;
}
.feedback {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 64px;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 100;
}
.feedback.show { opacity: 1; }
.btn {
    display: inline-block;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: 12px;
    transition: background 0.2s;
}
.btn-next {
    background: #4ecdc4;
    color: #111;
}
.btn-next:hover { background: #3dbdb5; }
.hidden { display: none !important; }
.promo-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 150;
    border-radius: 4px;
}
.promo-choices {
    display: flex;
    gap: 8px;
    background: #1a1a2e;
    padding: 16px;
    border-radius: 8px;
}
.promo-choices span {
    font-size: 48px;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
}
.promo-choices span:hover { background: #333; }

/* Leaderboard */
.page-content {
    max-width: 700px;
    margin: 40px auto;
    padding: 0 20px;
}
.page-content h1 {
    font-weight: 300;
    letter-spacing: 2px;
    margin-bottom: 24px;
}
.lb-table {
    width: 100%;
    border-collapse: collapse;
}
.lb-table th {
    text-align: left;
    padding: 8px 12px;
    border-bottom: 1px solid #333;
    color: #888;
    font-size: 12px;
    text-transform: uppercase;
}
.lb-table td {
    padding: 10px 12px;
    border-bottom: 1px solid #1a1a2e;
    font-size: 14px;
}
.lb-table tr:hover td { background: #1a1a2e; }
.lb-rank { color: #888; width: 40px; }
.lb-rating { color: #4ecdc4; font-weight: 700; }
.lb-name { display: flex; align-items: center; gap: 8px; }
.lb-avatar { width: 24px; height: 24px; border-radius: 50%; }

/* Mobile */
@media (max-width: 700px) {
    body { overflow-x: hidden; }
    .topnav { padding: 10px 12px; }
    .brand { font-size: 15px; letter-spacing: 1px; }
    .main {
        flex-direction: column;
        align-items: center;
        gap: 16px;
        padding: 12px 8px;
    }
    .panel { width: auto; padding-top: 0; }
    .left-panel { order: 2; }
    .right-panel { order: 3; }
    .board-area { order: 1; }
    .user-card, .puzzle-card { padding: 10px 16px; }
    .left-panel, .right-panel {
        display: flex;
        gap: 12px;
        align-items: center;
    }
    .rating-display { margin-bottom: 0; }
    .rating-value, .puzzle-rating-value { font-size: 24px; }
    .user-stats { font-size: 11px; }
    .gravity-label { margin-bottom: 4px; }
    .move-dot { width: 14px; height: 14px; }
    .feedback { font-size: 48px; }
}
