/* ============================================================
   GeoFreak — Duels Stylesheet
   Lobby, play view, scoreboard, results — responsive.
   ============================================================ */

/* ─── Lobby ────────────────────────────────────────────────── */
.duel-lobby .container,
.duel-play .container {
    max-width: 800px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

.duel-lobby h1,
.duel-play h2 {
    font-family: var(--font-display);
    font-size: 2rem;
    color: var(--gray-900);
    margin-bottom: 8px;
}

.duel-lobby .section-desc {
    color: var(--gray-500);
    margin-bottom: 32px;
}

.duel-auth-notice {
    text-align: center;
    padding: 48px 24px;
    background: var(--white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
}
.duel-auth-notice p { margin-bottom: 16px; color: var(--gray-600); }

/* Create section */
.duel-create-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
    margin-bottom: 32px;
}
.duel-create-section h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.duel-create-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    align-items: end;
}

.duel-create-form .setting-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--gray-600);
    margin-bottom: 6px;
}

.duel-create-form select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.95rem;
    background: var(--white);
    color: var(--gray-800);
    cursor: pointer;
}

.duel-create-form select:focus {
    outline: none;
    border-color: var(--blue-500);
}

#btn-create-duel {
    align-self: end;
    white-space: nowrap;
}

/* Waiting duels list */
.duel-waiting-section {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}
.duel-waiting-section h2 {
    font-size: 1.25rem;
    margin-bottom: 20px;
}

.duel-list-loading,
.duel-list-empty {
    text-align: center;
    padding: 24px;
    color: var(--gray-500);
    font-size: 0.95rem;
}

.duel-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    background: var(--gray-50);
    border: 1px solid var(--gray-200);
    border-radius: var(--radius-sm);
    margin-bottom: 10px;
    transition: border-color 0.2s;
}
.duel-card:hover { border-color: var(--blue-500); }

.duel-card-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.duel-card-type {
    font-weight: 700;
    color: var(--gray-800);
    font-size: 1rem;
}

.duel-card-meta {
    font-size: 0.85rem;
    color: var(--gray-500);
}

.duel-card-creator {
    font-size: 0.82rem;
    color: var(--gray-400);
}

/* ─── Play View ────────────────────────────────────────────── */

/* Waiting for opponent */
.duel-waiting-opponent {
    text-align: center;
    padding: 60px 24px;
}

.waiting-spinner {
    width: 48px;
    height: 48px;
    border: 4px solid var(--gray-200);
    border-top-color: var(--blue-500);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 24px;
}

.duel-waiting-opponent h2 {
    font-size: 1.5rem;
    margin-bottom: 12px;
}

.duel-share-info {
    color: var(--gray-500);
    margin-bottom: 12px;
    font-size: 0.9rem;
}

.duel-share-box {
    display: flex;
    gap: 8px;
    justify-content: center;
    margin-bottom: 24px;
    flex-wrap: wrap;
}

.share-url-input {
    flex: 1;
    max-width: 400px;
    padding: 10px 14px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    font-size: 0.9rem;
    color: var(--gray-700);
    background: var(--gray-50);
}

.btn-danger {
    background: #ef5350;
    color: white;
    padding: 10px 24px;
    border: none;
    border-radius: var(--radius-sm);
    font-weight: 600;
    cursor: pointer;
    font-size: 0.9rem;
}
.btn-danger:hover { background: #d32f2f; }

/* Scoreboard */
.duel-scoreboard {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 24px;
    padding: 16px 20px;
    background: var(--white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
}

.sb-player {
    display: flex;
    align-items: center;
    gap: 12px;
}

.sb-name {
    font-weight: 600;
    color: var(--gray-700);
    font-size: 1rem;
}

.sb-score {
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 700;
    min-width: 36px;
    text-align: center;
}

.sb-you .sb-score { color: var(--blue-500); }
.sb-opponent .sb-score { color: #ef5350; }

/* Question area */
.duel-question-area {
    background: var(--white);
    border-radius: var(--radius-lg);
    padding: 28px;
    box-shadow: var(--shadow-sm);
}

.duel-question-counter {
    text-align: center;
    font-size: 0.85rem;
    color: var(--gray-400);
    margin-bottom: 8px;
}

.duel-question-prompt {
    text-align: center;
    font-size: 1.15rem;
    font-weight: 600;
    font-family: var(--font-display);
    color: var(--gray-800);
    margin-bottom: 24px;
}

/* Ordering items (reuse styles from games.css) */
.duel-ordering-items {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.duel-ordering-items .ordering-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 16px;
    background: var(--white);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-sm);
    cursor: grab;
    transition: border-color 0.2s, background 0.2s;
    user-select: none;
}
.duel-ordering-items .ordering-item:active { cursor: grabbing; }
.duel-ordering-items .ordering-item.dragging { opacity: 0.5; border-color: var(--blue-500); }

.duel-ordering-items .ordering-handle { color: var(--gray-400); font-size: 1.1rem; cursor: grab; }
.duel-ordering-items .ordering-flag { font-size: 1.5rem; }
.duel-ordering-items .ordering-name { flex: 1; font-weight: 500; color: var(--gray-800); }

#btn-duel-confirm-order {
    display: block;
    margin: 0 auto 16px;
}

/* Comparison cards */
.duel-comparison-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.cmp-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    padding: 32px 16px;
    background: var(--gray-50);
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.2s;
}
.cmp-card:hover {
    border-color: var(--blue-500);
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}

.cmp-flag { font-size: 2.5rem; }
.cmp-name { font-weight: 600; color: var(--gray-800); font-size: 1.05rem; text-align: center; }

/* Feedback */
.duel-feedback {
    text-align: center;
    font-weight: 700;
    font-size: 1.1rem;
    padding: 12px;
    border-radius: var(--radius-sm);
    margin-top: 12px;
}
.duel-feedback-correct { color: #2e7d32; background: rgba(76, 175, 80, 0.1); }
.duel-feedback-wrong { color: #c62828; background: rgba(239, 83, 80, 0.1); }
.duel-feedback-info { color: var(--blue-600); background: rgba(26, 115, 232, 0.08); }

/* ─── Results ──────────────────────────────────────────────── */
.duel-results-overlay {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 50vh;
}

.duel-results-card {
    text-align: center;
    background: var(--white);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    box-shadow: var(--shadow-lg);
    max-width: 480px;
    width: 100%;
}

.duel-results-card .results-icon { font-size: 3.5rem; margin-bottom: 12px; }
.duel-results-card h2 {
    font-family: var(--font-display);
    font-size: 1.8rem;
    color: var(--gray-900);
    margin-bottom: 24px;
}

.duel-final-scores { margin-bottom: 28px; }

.final-score-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 14px 20px;
    border-radius: var(--radius-sm);
    margin-bottom: 8px;
    background: var(--gray-50);
}
.final-score-row.is-you {
    background: rgba(26, 115, 232, 0.08);
    border: 2px solid rgba(26, 115, 232, 0.2);
}

.final-score-name { font-weight: 600; color: var(--gray-700); }
.final-score-value { font-family: var(--font-display); font-weight: 700; color: var(--gray-900); font-size: 1.1rem; }

.duel-results-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    flex-wrap: wrap;
}
.duel-results-actions .btn-outline {
    color: var(--gray-700);
    border-color: var(--gray-300);
}
.duel-results-actions .btn-outline:hover {
    border-color: var(--gray-500);
    background: var(--gray-100);
}

/* ─── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
    .duel-create-form {
        grid-template-columns: 1fr 1fr;
    }
    .duel-scoreboard { gap: 20px; }
}

@media (max-width: 640px) {
    .duel-lobby .container,
    .duel-play .container {
        padding: 24px 16px 40px;
    }

    .duel-lobby h1 { font-size: 1.5rem; }

    .duel-create-form {
        grid-template-columns: 1fr;
    }

    #btn-create-duel { width: 100%; justify-content: center; }

    .duel-card {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }
    .duel-card .btn-join { width: 100%; justify-content: center; }

    .duel-scoreboard {
        gap: 16px;
        padding: 12px 16px;
    }
    .sb-score { font-size: 1.3rem; }

    .duel-question-area { padding: 20px 16px; }

    .duel-comparison-cards {
        grid-template-columns: 1fr;
    }

    .duel-results-card {
        padding: 32px 20px;
        margin: 0 8px;
    }
    .duel-results-card h2 { font-size: 1.4rem; }

    .duel-share-box { flex-direction: column; align-items: center; }
    .share-url-input { max-width: 100%; }
}

@media (max-width: 400px) {
    .duel-lobby h1 { font-size: 1.3rem; }
    .cmp-flag { font-size: 2rem; }
    .cmp-name { font-size: 0.9rem; }
}

/* ═══════════════════════════════════════════════════════════════
   ROOM SYSTEM — Lobby + Play + Results
   ═══════════════════════════════════════════════════════════════ */

/* ── Shared room primitives ─────────────────────────────────── */
.room-primary-btn {
    display: block;
    width: 100%;
    padding: 14px;
    background: var(--blue-600, #2563eb);
    color: #fff;
    font-size: 1rem;
    font-weight: 700;
    border: none;
    border-radius: var(--radius-md, 10px);
    cursor: pointer;
    transition: background 0.15s;
    text-align: center;
    text-decoration: none;
}
.room-primary-btn:hover:not(:disabled) { background: var(--blue-700, #1d4ed8); }
.room-primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.room-secondary-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: var(--white, #fff);
    color: var(--blue-600, #2563eb);
    font-size: 0.95rem;
    font-weight: 600;
    border: 2px solid var(--blue-200, #bfdbfe);
    border-radius: var(--radius-md, 10px);
    cursor: pointer;
    transition: border-color 0.15s;
    text-align: center;
    text-decoration: none;
    margin-top: 10px;
}
.room-secondary-btn:hover:not(:disabled) { border-color: var(--blue-500, #3b82f6); }

.room-text-btn {
    display: block;
    text-align: center;
    color: var(--gray-500, #6b7280);
    font-size: 0.9rem;
    text-decoration: none;
    margin-top: 8px;
}
.room-text-btn:hover { color: var(--gray-700, #374151); }

.room-input {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
    font-size: 0.95rem;
    background: var(--white, #fff);
    color: var(--gray-800, #1f2937);
    box-sizing: border-box;
}
.room-input:focus { outline: none; border-color: var(--blue-400, #60a5fa); }
.room-code-input { font-family: monospace; font-size: 1.4rem; letter-spacing: 0.2em; text-align: center; }

.room-select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-sm, 8px);
    font-size: 0.95rem;
    background: var(--white, #fff);
    color: var(--gray-800, #1f2937);
    cursor: pointer;
}

.room-error {
    color: #dc2626;
    font-size: 0.88rem;
    margin-top: 8px;
    padding: 8px 12px;
    background: #fef2f2;
    border-radius: var(--radius-sm, 8px);
}

.room-setting-group { margin-bottom: 16px; }
.room-setting-label {
    display: block;
    font-size: 0.84rem;
    font-weight: 600;
    color: var(--gray-600, #4b5563);
    margin-bottom: 6px;
}

.room-n-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.room-n-btn {
    padding: 6px 14px;
    border: 2px solid var(--gray-200, #e5e7eb);
    border-radius: 20px;
    background: var(--white, #fff);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.room-n-btn.active {
    border-color: var(--blue-500, #3b82f6);
    background: var(--blue-50, #eff6ff);
    color: var(--blue-700, #1d4ed8);
}

/* Room code display */
.room-code-box {
    background: var(--gray-50, #f9fafb);
    border: 2px solid var(--gray-200, #e5e7eb);
    border-radius: var(--radius-lg, 14px);
    padding: 20px 24px;
    text-align: center;
    margin: 20px 0;
}
.room-code-label {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--gray-500, #6b7280);
    margin-bottom: 8px;
}
.room-code-value {
    font-family: monospace;
    font-size: 2.4rem;
    font-weight: 800;
    letter-spacing: 0.22em;
    color: var(--gray-900, #111827);
    margin-bottom: 10px;
}
.room-copy-btn {
    padding: 6px 16px;
    background: var(--gray-200, #e5e7eb);
    border: none;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
}
.room-copy-btn:hover { background: var(--gray-300, #d1d5db); }

/* ── Room Lobby page ─────────────────────────────────────────── */
.room-lobby-page {
    min-height: calc(100vh - 64px);
    background: var(--gray-50, #f9fafb);
    padding: 32px 16px 64px;
}
.room-lobby-container { max-width: 860px; margin: 0 auto; }
.room-back { color: var(--gray-500, #6b7280); font-size: 0.9rem; text-decoration: none; display: block; margin-bottom: 20px; }
.room-back:hover { color: var(--gray-700, #374151); }

.room-lobby-header { margin-bottom: 32px; }
.room-lobby-title-row { display: flex; align-items: center; gap: 16px; }
.room-lobby-title-row h1 { font-size: 1.75rem; font-weight: 800; color: var(--gray-900, #111827); margin: 0 0 4px; }
.room-lobby-subtitle { color: var(--gray-500, #6b7280); margin: 0; font-size: 0.95rem; }

.room-tab-selector {
    display: flex;
    gap: 8px;
    background: var(--gray-100, #f3f4f6);
    border-radius: 999px;
    padding: 6px;
    margin-bottom: 24px;
    width: fit-content;
}

.room-tab {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 24px;
    border-radius: 999px;
    border: none;
    background: transparent;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--gray-500, #6b7280);
    cursor: pointer;
    transition: background 0.18s, color 0.18s, box-shadow 0.18s;
}
.room-tab:hover { color: var(--gray-700, #374151); }
.room-tab.active {
    background: var(--white, #fff);
    color: var(--gray-900, #111827);
    box-shadow: 0 2px 8px rgba(0,0,0,0.10);
}
.room-tab-icon { font-size: 1.1rem; }

@media (max-width: 480px) {
    .room-tab-selector { width: 100%; }
    .room-tab { flex: 1; justify-content: center; padding: 10px 12px; font-size: 0.88rem; }
}

.room-panel {
    background: var(--white, #fff);
    border-radius: var(--radius-lg, 14px);
    box-shadow: 0 2px 12px rgba(0,0,0,0.07);
    padding: 28px;
}
.room-panel-desc { color: var(--gray-500, #6b7280); font-size: 0.9rem; margin-bottom: 24px; }

.room-go-btn { margin-top: 12px; }

.room-logged-as {
    font-size: 0.9rem;
    color: var(--gray-600, #4b5563);
    background: var(--gray-50, #f9fafb);
    border-radius: var(--radius-sm, 8px);
    padding: 10px 14px;
    margin-bottom: 16px;
}
.room-auth-hint {
    font-size: 0.82rem;
    color: var(--gray-500, #6b7280);
    margin-bottom: 12px;
}
.room-auth-hint a { color: var(--blue-600, #2563eb); }

/* ── Room Play page ──────────────────────────────────────────── */
.room-play-page {
    min-height: 100vh;
    background: var(--gray-50, #f9fafb);
    padding-bottom: 64px;
}
/* Each scrollable section clears the fixed 64px navbar + 16px breathing room */
.rp-section {
    max-width: 700px;
    margin: 0 auto;
    padding: 80px 16px 0;
}

/* Lobby */
.rp-lobby-header { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.rp-lobby-header h2 { font-size: 1.5rem; font-weight: 800; margin: 0 0 4px; color: var(--gray-900, #111827); }
.rp-lobby-subtitle { color: var(--gray-500, #6b7280); margin: 0; font-size: 0.9rem; }
.rp-code-box { margin: 0 0 24px; }

.rp-players-title { font-size: 1rem; font-weight: 700; color: var(--gray-700, #374151); margin: 0 0 12px; }
.rp-players-list { list-style: none; padding: 0; margin: 0 0 24px; display: flex; flex-direction: column; gap: 8px; }
.rp-player-item {
    display: flex; align-items: center; gap: 10px;
    background: var(--white, #fff);
    border-radius: var(--radius-sm, 8px);
    padding: 12px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.rp-player-name { flex: 1; font-weight: 600; color: var(--gray-800, #1f2937); }
.rp-player-badge {
    font-size: 0.72rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.rp-badge-host { background: #fef3c7; color: #92400e; }
.rp-badge-you  { background: #dbeafe; color: #1e40af; }
.rp-badge-guest { font-size: 1rem; }

.rp-config-summary {
    display: flex; gap: 16px; flex-wrap: wrap;
    font-size: 0.85rem;
    color: var(--gray-600, #4b5563);
    background: var(--white, #fff);
    border-radius: var(--radius-sm, 8px);
    padding: 12px 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}
.rp-config-summary span { display: flex; align-items: center; gap: 4px; }

.rp-start-area { text-align: center; }
.rp-start-hint { font-size: 0.82rem; color: var(--gray-500, #6b7280); margin-top: 8px; }
.rp-wait-text {
    text-align: center;
    color: var(--gray-500, #6b7280);
    font-size: 0.95rem;
    padding: 20px;
    background: var(--white, #fff);
    border-radius: var(--radius-md, 10px);
    box-shadow: 0 1px 4px rgba(0,0,0,0.05);
}

/* Game area override: quiz games don't need overflow:hidden like map games */
.rp-game-area {
    overflow-y: auto;
    padding-left: 16px;
    padding-right: 16px;
    max-width: 700px;
    margin: 0 auto;
    box-sizing: border-box;
}

/* HUD — legacy styles kept for .rp-hud-progress; color inherits white from .game-hud */
.rp-hud {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--white, #fff);
    border-radius: var(--radius-md, 10px);
    padding: 12px 20px;
    margin-bottom: 20px;
    box-shadow: 0 1px 6px rgba(0,0,0,0.07);
}
/* Inside .game-hud all text is white; progress is left-aligned */
.rp-hud-progress { flex: 1; font-size: 0.9rem; }

/* ── Geostats (duel-specific bar mechanic — prompt/feedback use games.css classes) ── */
.rp-geo-target {
    font-size: 1.5rem;
    text-align: center;
    margin-bottom: 20px;
}
.rp-geo-flag  { font-size: 2rem; }
.rp-geo-cname { font-size: 1.1rem; font-weight: 700; color: var(--gray-900, #111827); margin-left: 8px; }

.rp-geo-curve-wrap { margin-bottom: 16px; }
.rp-geo-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.78rem;
    color: var(--gray-500);
    margin-bottom: 6px;
}
.rp-geo-curve {
    position: relative;
    height: 56px;
    cursor: crosshair;
    display: flex;
    align-items: center;
}
.rp-geo-bar {
    position: absolute;
    left: 0; right: 0;
    height: 12px;
    background: linear-gradient(to right, #93c5fd, #2563eb);
    border-radius: 6px;
}
.rp-geo-marker {
    position: absolute;
    width: 20px;
    height: 40px;
    border-radius: 4px;
    transform: translateX(-50%);
    top: 50%;
    transform: translate(-50%, -50%);
    border: 3px solid;
}
.rp-geo-guess   { background: #fbbf24; border-color: #d97706; }
.rp-geo-correct { background: #4ade80; border-color: #16a34a; }
.rp-geo-hint { font-size: 0.78rem; color: var(--gray-500); text-align: center; margin-top: 6px; }

/* Geostats-header in duel panel context (games.css .geostats-header has margin-bottom for standalone) */
#rp-geo .geostats-header { margin-bottom: 12px; }
#rp-geo .geostats-prompt { margin-bottom: 0; }

/* btn spacing inside duel ordering/geostats panels */
#rp-geo .btn { margin-top: 16px; }

/* ── Waiting results ─────────────────────────────────────────── */
.rp-wr-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 24px;
}
.rp-wr-header h3 { font-size: 1.25rem; font-weight: 700; color: var(--gray-900, #111827); margin: 0 0 4px; }
.rp-wr-count { color: var(--gray-500, #6b7280); font-size: 0.9rem; margin: 0; }

.rp-wr-table-wrap {
    background: var(--white, #fff);
    border-radius: var(--radius-lg, 14px);
    box-shadow: var(--shadow-sm, 0 1px 6px rgba(0,0,0,0.07));
    overflow: hidden;
}
.rp-wr-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}
.rp-wr-table thead tr {
    background: var(--gray-50, #f9fafb);
    border-bottom: 2px solid var(--gray-100, #f3f4f6);
}
.rp-wr-table th {
    padding: 10px 14px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--gray-500, #6b7280);
    text-align: left;
}
.rp-wr-table th:nth-child(3),
.rp-wr-table th:nth-child(4),
.rp-wr-table th:nth-child(5) { text-align: right; }

.rp-wr-row { border-bottom: 1px solid var(--gray-100, #f3f4f6); transition: background 0.15s; }
.rp-wr-row:last-child { border-bottom: none; }
.rp-wr-row td { padding: 12px 14px; vertical-align: middle; }

.rp-wr-you { background: #eff6ff; }
.rp-wr-playing { opacity: 0.65; }

.rp-wr-rank { font-size: 1.2rem; min-width: 32px; width: 40px; }
.rp-wr-name { font-weight: 600; color: var(--gray-900, #111827); }
.rp-wr-name .rp-badge-you {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: 10px;
    background: #dbeafe;
    color: #1e40af;
    margin-left: 6px;
    vertical-align: middle;
}
.rp-wr-score,
.rp-wr-time,
.rp-wr-status { text-align: right; }
.rp-wr-score { font-weight: 700; color: var(--gray-800, #1f2937); }
.rp-wr-time { color: var(--gray-500, #6b7280); font-size: 0.85rem; }
.rp-wr-done { color: #16a34a; font-size: 1.1rem; }
.rp-wr-still-playing {
    font-size: 0.78rem;
    color: var(--gray-500, #6b7280);
    font-style: italic;
}

.rp-spinner {
    width: 44px; height: 44px;
    flex-shrink: 0;
    border: 4px solid var(--gray-200, #e5e7eb);
    border-top-color: var(--blue-500, #3b82f6);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    margin: 0 auto 20px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Results ─────────────────────────────────────────────────── */
.rp-results-header { text-align: center; margin-bottom: 28px; }
.rp-results-icon { font-size: 3rem; margin-bottom: 8px; }
.rp-results-header h2 { font-size: 1.8rem; font-weight: 800; color: var(--gray-900); margin: 0 0 6px; }
.rp-results-subtitle { color: var(--gray-500); font-size: 0.9rem; margin: 0; }

.rp-leaderboard { list-style: none; padding: 0; margin: 0 0 28px; display: flex; flex-direction: column; gap: 10px; }
.rp-lb-item {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--white, #fff);
    border-radius: var(--radius-md, 10px);
    padding: 16px 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.06);
    border: 2px solid transparent;
}
.rp-lb-winner { border-color: #fbbf24; background: linear-gradient(135deg, #fffbeb, #fff); }
.rp-lb-you    { border-color: var(--blue-300, #93c5fd); }
.rp-lb-rank   { font-size: 1.4rem; min-width: 36px; }
.rp-lb-name   { flex: 1; font-weight: 700; color: var(--gray-900); font-size: 1rem; }
.rp-lb-name em { color: var(--blue-600); font-style: normal; font-weight: 500; font-size: 0.85rem; }
.rp-lb-score  { font-size: 1rem; font-weight: 700; color: var(--gray-700); }
.rp-lb-pct    { font-size: 0.85rem; color: var(--gray-500); min-width: 40px; text-align: right; }

.rp-results-actions { display: flex; flex-direction: column; gap: 8px; }

/* ── Games Dashboard duel button ─────────────────────────────── */
.game-card-actions { display: flex; gap: 8px; margin-top: 10px; }
.game-card-play-solo,
.game-card-play-duel {
    flex: 1;
    padding: 8px 10px;
    border-radius: var(--radius-sm, 8px);
    font-size: 0.82rem;
    font-weight: 700;
    text-align: center;
    text-decoration: none;
    border: none;
    cursor: pointer;
    transition: opacity 0.15s;
}
.game-card-play-solo {
    background: color-mix(in srgb, var(--card-color, #2563eb) 90%, #000);
    color: #fff;
}
.game-card-play-duel {
    background: rgba(255,255,255,0.18);
    color: #fff;
    border: 2px solid rgba(255,255,255,0.55);
}
.game-card-play-solo:hover,
.game-card-play-duel:hover { opacity: 0.88; }

/* ─── Lobby customization panel (shared with games.css mcfg-*) ── */
.room-panel { position: relative; }
.gear-btn {
    position: absolute;
    top: 14px;
    right: 14px;
    background: none;
    border: 1.5px solid var(--gray-200, #e5e7eb);
    font-size: 1.1rem;
    cursor: pointer;
    padding: 5px 8px;
    border-radius: 8px;
    color: var(--gray-400, #9ca3af);
    line-height: 1;
    transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.gear-btn:hover {
    color: var(--blue-600, #2563eb);
    border-color: var(--blue-300, #93c5fd);
    background: var(--blue-50, #eff6ff);
}
.gear-btn.active {
    color: var(--blue-600, #2563eb);
    border-color: var(--blue-400, #60a5fa);
    background: var(--blue-50, #eff6ff);
}
.gcust-hr {
    border: none;
    border-top: 1.5px solid var(--gray-100, #f3f4f6);
    margin: 12px 0;
}
.gcust-type-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
}
.gcust-tab {
    flex: 1;
    padding: 7px 10px;
    border: 1.5px solid var(--gray-200, #e5e7eb);
    border-radius: 8px;
    background: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-500, #6b7280);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.gcust-tab.active {
    border-color: var(--blue-400, #60a5fa);
    background: var(--blue-50, #eff6ff);
    color: var(--blue-700, #1d4ed8);
}
.gcust-group { margin-bottom: 10px; }
.gcust-group-label {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-400, #9ca3af);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 6px;
}
.mcfg-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.mcfg-pill {
    display: inline-flex;
    align-items: center;
    padding: 5px 12px;
    border: 1.5px solid var(--gray-200, #e5e7eb);
    border-radius: 20px;
    background: #fff;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--gray-600, #4b5563);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}
.mcfg-pill:hover {
    border-color: var(--blue-500, #3b82f6);
    color: var(--blue-500, #3b82f6);
    background: rgba(59,130,246,0.06);
}
.mcfg-pill.active {
    background: var(--blue-500, #3b82f6);
    border-color: var(--blue-500, #3b82f6);
    color: #fff;
}
.mcfg-region-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.gcust-region-cards { grid-template-columns: repeat(3, 1fr); gap: 6px; }
.mcfg-region-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    padding: 10px 6px 8px;
    border: 1.5px solid var(--gray-200, #e5e7eb);
    border-radius: 10px;
    background: #fff;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
    text-align: center;
}
.mcfg-region-card:hover {
    border-color: #a855f7;
    background: rgba(168,85,247,0.05);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0,0,0,0.08);
}
.mcfg-region-card.active {
    border-color: #a855f7;
    background: rgba(168,85,247,0.07);
    box-shadow: 0 0 0 3px rgba(168,85,247,0.2);
}
.mcfg-region-card-icon {
    width: 32px; height: 32px;
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}
.mcfg-region-card-label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--gray-700, #374151);
    line-height: 1.2;
}
