/* =========================================================
   Państwa-Miasta — Mobile-first design system
   ---------------------------------------------------------
   Breakpoints (used as min-width, mobile-first):
     - sm:  480px   (large phones)
     - md:  768px   (tablets / small laptops)
     - lg: 1024px   (desktop)
     - xl: 1280px   (wide desktop)
   ========================================================= */

:root {
    /* Brand */
    --primary: #0ea5e9;
    --primary-dark: #0284c7;
    --accent: #22d3ee;
    --accent-2: #a855f7;

    /* Surface */
    --background: #0b1220;
    --surface-0: rgba(255, 255, 255, 0.02);
    --surface-1: rgba(255, 255, 255, 0.04);
    --surface-2: rgba(255, 255, 255, 0.06);
    --border: rgba(255, 255, 255, 0.08);
    --border-strong: rgba(255, 255, 255, 0.18);

    /* Text */
    --text: #f8fafc;
    --text-muted: #94a3b8;

    /* State */
    --success: #10b981;
    --danger: #ef4444;
    --warning: #f59e0b;

    /* Scoring */
    --pts-15: #a855f7;
    --pts-10: #22c55e;
    --pts-5:  #f97316;

    /* Spacing scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;
    --space-10: 2.5rem;
    --space-12: 3rem;

    /* Radius */
    --r-sm: 10px;
    --r-md: 14px;
    --r-lg: 20px;
    --r-xl: 28px;

    /* Layout */
    --nav-h: 56px;
    --container-w: 1200px;
    --content-w: 720px;
    --safe-pad-x: clamp(1rem, 4vw, 2rem);

    /* Typography (fluid) */
    --fs-1: clamp(1.75rem, 1.2rem + 2.6vw, 3rem);     /* h2 / hero subtitle areas */
    --fs-hero: clamp(1.9rem, 1.3rem + 3.4vw, 4.25rem); /* hero h1 */
    --fs-h2: clamp(1.5rem, 1.1rem + 1.6vw, 2.25rem);
    --fs-h3: clamp(1.1rem, 0.95rem + 0.7vw, 1.35rem);
    --fs-body: 1rem;
    --fs-sm: 0.875rem;
    --fs-xs: 0.75rem;

    /* Effects */
    --shadow-md: 0 10px 30px -10px rgba(0,0,0,0.5);
    --shadow-lg: 0 25px 50px -12px rgba(0,0,0,0.5);

    /* Touch */
    --tap: 44px;
}

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

* {
    margin: 0;
    padding: 0;
}

html, body {
    height: 100%;
}

body {
    font-family: 'Outfit', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--background);
    color: var(--text);
    line-height: 1.5;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

img, svg { display: block; max-width: 100%; }

/* Subtle ambient background */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    background: radial-gradient(circle at 50% 30%, #1e293b 0%, #0b1220 70%);
    z-index: -2;
}

body::after {
    content: '';
    position: fixed;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: conic-gradient(from 0deg, transparent, var(--primary), transparent 40%);
    animation: rotate 30s linear infinite;
    opacity: 0.04;
    z-index: -1;
}

@keyframes rotate {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes slideIn {
    from { opacity: 0; transform: translateX(8px); }
    to { opacity: 1; transform: translateX(0); }
}

/* ---------- Layout primitives ---------- */
.page-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    min-height: 100svh;
    padding-top: var(--nav-h);
}

.container {
    width: 100%;
    max-width: var(--container-w);
    margin: 0 auto;
    padding: var(--space-6) var(--safe-pad-x);
}

@media (min-width: 768px) {
    .container { padding: var(--space-8) var(--safe-pad-x); }
}

/* ---------- Typography ---------- */
h1, h2, h3, h4 {
    font-weight: 800;
    line-height: 1.15;
}

p { line-height: 1.55; }

.hero-title {
    font-size: var(--fs-hero);
    font-weight: 900;
    overflow-wrap: break-word;
    hyphens: auto;
    margin-bottom: var(--space-5);
    color: white;
}
.section-header h2 {
    font-size: var(--fs-h2);
    margin-bottom: var(--space-3);
}
.section-header p { color: var(--text-muted); font-size: var(--fs-body); }

/* ---------- Buttons (default = primary) ---------- */
button {
    min-height: var(--tap);
    width: 100%;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    border: 0;
    border-radius: var(--r-md);
    padding: 0.85rem 1.1rem;
    font-weight: 700;
    font-size: var(--fs-body);
    letter-spacing: 0.5px;
    text-transform: uppercase;
    cursor: pointer;
    transition: transform 0.15s ease, filter 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

button:hover:not(:disabled) {
    transform: translateY(-1px);
    filter: brightness(1.06);
    box-shadow: 0 10px 24px -10px var(--primary);
}

button:active:not(:disabled) { transform: translateY(0); }
button:disabled { opacity: 0.5; cursor: not-allowed; }

button.danger {
    background: linear-gradient(135deg, var(--danger), #991b1b);
}

button.secondary, button.btn-secondary {
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
}

.btn-inline { width: auto; padding: 0.65rem 1.1rem; min-height: auto; font-size: var(--fs-sm); }

/* ---------- Inputs ---------- */
input, select, textarea {
    width: 100%;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 0.8rem 1rem;
    color: white;
    font-size: var(--fs-body);
    min-height: var(--tap);
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus, select:focus, textarea:focus {
    outline: 0;
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.15);
}

label {
    display: block;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: var(--space-2);
}

.form-group { margin-bottom: var(--space-5); }

.header-label {
    display: block;
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    margin-bottom: var(--space-2);
}

/* ---------- Navbar ---------- */
.navbar {
    position: fixed;
    inset: 0 0 auto 0;
    height: var(--nav-h);
    z-index: 1000;
    background: rgba(11, 18, 32, 0.8);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    padding-top: env(safe-area-inset-top, 0);
}

.nav-container {
    height: 100%;
    max-width: var(--container-w);
    margin: 0 auto;
    padding: 0 var(--safe-pad-x);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.logo {
    font-weight: 900;
    font-size: 1.15rem;
    color: white;
    letter-spacing: 0.3px;
}

.logo span { color: var(--accent); }

.nav-links {
    display: flex;
    align-items: center;
    gap: var(--space-4);
}

.nav-links a {
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 600;
    font-size: var(--fs-sm);
}

.nav-links a:hover { color: white; }

.nav-cta {
    width: auto;
    min-height: 36px;
    padding: 0.45rem 0.9rem;
    font-size: var(--fs-sm);
}

/* Hide secondary nav links on small screens to keep navbar clean */
.nav-links .nav-link-extra { display: none; }

@media (min-width: 768px) {
    :root { --nav-h: 64px; }
    .logo { font-size: 1.35rem; }
    .nav-links { gap: var(--space-6); }
    .nav-links .nav-link-extra { display: inline-block; }
}

/* ---------- Hero ---------- */
.hero {
    position: relative;
    width: 100%;
    min-height: 60svh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: var(--space-10) var(--safe-pad-x);
    overflow: hidden;
    background:
        radial-gradient(80% 60% at 50% 0%, rgba(14,165,233,0.18), transparent 60%),
        radial-gradient(50% 40% at 50% 100%, rgba(168,85,247,0.15), transparent 60%);
}

.hero-overlay { display: none; } /* old artifact, kept harmless */

.hero-content { position: relative; z-index: 2; max-width: 820px; }

.hero-title span {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

.hero-subtitle {
    font-size: clamp(1rem, 0.85rem + 0.5vw, 1.2rem);
    color: var(--text-muted);
    margin-bottom: var(--space-8);
}

.hero-btns {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
    max-width: 360px;
    margin: 0 auto;
}

@media (min-width: 480px) {
    .hero-btns {
        grid-template-columns: 1fr 1fr;
        max-width: 480px;
    }
}

@media (min-width: 768px) {
    .hero { min-height: 70svh; padding: var(--space-12) var(--safe-pad-x); }
}

.btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

.hero-trust-pills {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: var(--space-2);
    margin-top: var(--space-8);
    padding: 0;
    max-width: 36rem;
    margin-left: auto;
    margin-right: auto;
}

.hero-trust-pill {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    border-radius: 999px;
    border: 1px solid var(--border-strong);
    background: var(--surface-1);
    color: var(--text-muted);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(34, 197, 94, 0.1);
    color: var(--success);
    font-size: var(--fs-xs);
    font-weight: 700;
    letter-spacing: 1px;
    margin-bottom: var(--space-4);
}

.live-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 4px rgba(34,197,94,0.15);
}

/* ---------- Sections ---------- */
.section-header {
    text-align: center;
    margin-bottom: var(--space-8);
}

/* ---------- Lobby ---------- */
.lobby-section { scroll-margin-top: calc(var(--nav-h) + 16px); }

.join-card {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--r-xl);
    padding: var(--space-6);
}

@media (min-width: 768px) {
    .join-card { padding: var(--space-8); }
}

.choice-cards {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

@media (min-width: 768px) {
    .choice-cards { grid-template-columns: 1fr 1fr; gap: var(--space-4); }
}

button.choice-card {
    display: flex;
    gap: var(--space-4);
    align-items: flex-start;
    padding: var(--space-5);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    background: var(--surface-1);
    color: inherit;
    font: inherit;
    text-align: left;
    text-transform: none;
    letter-spacing: 0;
    cursor: pointer;
    width: 100%;
    min-height: auto;
    transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

button.choice-card:hover:not(:disabled) {
    transform: translateY(-2px);
    border-color: rgba(34, 211, 238, 0.55);
    background: rgba(34, 211, 238, 0.06);
    filter: none;
    box-shadow: none;
}

button.choice-card:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.choice-icon { font-size: 1.6rem; line-height: 1; flex-shrink: 0; }
.choice-content { flex: 1; display: flex; flex-direction: column; gap: var(--space-1); }
.choice-title { font-size: var(--fs-h3); font-weight: 800; line-height: 1.2; }
.choice-desc { color: var(--text-muted); font-size: var(--fs-sm); }

/* ---------- Features ---------- */
.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
    margin: var(--space-10) 0;
}

@media (min-width: 768px) {
    .features-grid { grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
}

.feature-item {
    background: var(--surface-0);
    border: 1px solid var(--border);
    padding: var(--space-8) var(--space-6);
    border-radius: var(--r-xl);
    text-align: center;
    transition: transform 0.2s ease, background 0.2s ease;
}

.feature-item:hover { transform: translateY(-4px); background: var(--surface-1); }
.feature-icon { font-size: 2.25rem; margin-bottom: var(--space-3); }
.feature-item h3 { font-size: var(--fs-h3); margin-bottom: var(--space-2); }
.feature-item p { color: var(--text-muted); font-size: var(--fs-sm); }

/* ---------- Rooms table ---------- */
.table-container {
    overflow-x: auto;
    background: var(--surface-0);
    border-radius: var(--r-lg);
    border: 1px solid var(--border);
    margin-top: var(--space-4);
}

.rooms-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-size: var(--fs-sm);
    min-width: 520px;
}

.rooms-table th {
    background: rgba(14, 165, 233, 0.08);
    color: var(--accent);
    padding: var(--space-4);
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    border-bottom: 1px solid var(--border);
}

.rooms-table td {
    padding: var(--space-4);
    border-bottom: 1px solid var(--border);
}

.rooms-table tr:last-child td { border-bottom: 0; }
.rooms-table tr:hover td { background: var(--surface-1); }

.badge {
    padding: 0.3rem 0.6rem;
    border-radius: 999px;
    font-size: var(--fs-xs);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.badge-mode { background: rgba(168,85,247,0.1); color: var(--accent-2); border: 1px solid rgba(168,85,247,0.25); }
.badge-rules { background: rgba(34,197,94,0.1); color: var(--pts-10); border: 1px solid rgba(34,197,94,0.25); }

.btn-join-small {
    width: auto;
    padding: 0.45rem 0.8rem;
    min-height: 34px;
    border-radius: var(--r-sm);
    font-size: var(--fs-xs);
}

@media (max-width: 767px) {
    .rooms-table th:nth-child(4),
    .rooms-table td:nth-child(4),
    .rooms-table th:nth-child(5),
    .rooms-table td:nth-child(5) { display: none; }
}

/* =========================================================
   Game (room) layout
   ---------------------------------------------------------
   Mobile: single column, sticky bottom actions, sidebars stack
   Desktop: 3 columns
   ========================================================= */

.layout-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-4);
}

@media (min-width: 1024px) {
    .layout-grid {
        grid-template-columns: 280px 1fr 320px;
        gap: var(--space-6);
        align-items: start;
    }
}

.layout-grid.game-over {
    grid-template-columns: 1fr;
    max-width: 600px;
    margin: 0 auto;
}

/* ---------- Faza 3: odliczanie przed rundą ---------- */
.round-countdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 2100;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(2, 6, 23, 0.82);
    backdrop-filter: blur(6px);
}

.round-countdown-overlay[hidden] {
    display: none !important;
}

.round-countdown-num {
    font-family: 'Outfit', system-ui, sans-serif;
    font-size: clamp(4rem, 18vw, 7rem);
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 32px rgba(34, 211, 238, 0.45);
    line-height: 1;
    min-height: 1.2em;
}

/* ---------- Faza 4: udostępnianie wyniku ---------- */
.game-over-share {
    margin-top: var(--space-5);
    padding-top: var(--space-5);
    border-top: 1px solid var(--border);
}

.game-over-share-title {
    font-weight: 800;
    font-size: var(--fs-sm);
    color: var(--accent);
    margin: 0 0 var(--space-2);
}

.game-over-share-hint {
    font-size: var(--fs-xs);
    color: var(--text-muted);
    margin: 0 0 var(--space-4);
    line-height: 1.4;
}

.game-over-share-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

@media (min-width: 480px) {
    .game-over-share-actions {
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
    }
}

.game-over-share-actions .btn-secondary {
    text-align: center;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: var(--tap);
}

.sidebar {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--space-5);
}

.sidebar.hidden { display: none; }

.sidebar-header {
    font-size: var(--fs-sm);
    font-weight: 800;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
    margin-bottom: var(--space-4);
}

.main-game {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--space-4);
}

.game-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    background: var(--surface-1);
    padding: var(--space-4);
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    margin-bottom: var(--space-5);
}

.letter-display {
    font-size: clamp(2.5rem, 2rem + 3vw, 4rem);
    font-weight: 900;
    color: var(--accent);
    text-shadow: 0 0 20px rgba(34, 211, 238, 0.5);
    line-height: 1;
}

.categories-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-3);
}

@media (min-width: 480px) {
    .categories-grid { grid-template-columns: 1fr 1fr; gap: var(--space-3); }
}

/* Action buttons row */
.game-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

/* Sticky on mobile */
@media (max-width: 767px) {
    .game-actions {
        position: sticky;
        bottom: 0;
        padding: var(--space-3) 0;
        background: linear-gradient(180deg, transparent, rgba(11,18,32,0.95) 35%);
        margin-top: var(--space-4);
        z-index: 5;
    }
}

/* ---------- Scoreboard ---------- */
.scoreboard {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.score-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--surface-1);
    padding: 0.7rem 0.9rem;
    border-radius: var(--r-md);
    border: 1px solid var(--border);
    font-size: var(--fs-sm);
}

.score-item.is-host { border-color: var(--warning); }
.crown { margin-right: 6px; }

.score-item-left {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem 0.55rem;
    flex: 1;
    min-width: 0;
}

button.btn-kick {
    font-size: var(--fs-xs);
    padding: 0.2rem 0.45rem;
    border-radius: var(--r-sm);
    border: 1px solid var(--danger);
    background: transparent;
    color: var(--danger);
    font-weight: 600;
    cursor: pointer;
}

button.btn-kick:hover,
button.btn-kick:focus-visible {
    background: color-mix(in srgb, var(--danger) 18%, transparent);
    outline: none;
}

/* ---------- Logs / chat ---------- */
#logs {
    height: 280px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding-right: 4px;
    scroll-behavior: smooth;
}

@media (min-width: 1024px) {
    #logs { height: 380px; }
}

#logs::-webkit-scrollbar { width: 6px; }
#logs::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 10px; }

.log-entry {
    background: var(--surface-1);
    padding: 0.55rem 0.8rem;
    border-radius: var(--r-md);
    border-left: 3px solid var(--primary);
    font-size: var(--fs-sm);
    line-height: 1.4;
    word-break: break-word;
    animation: slideIn 0.25s ease;
}

.log-entry.system,
.log-entry.system-msg {
    background: rgba(14, 165, 233, 0.1);
    border-left-color: var(--accent);
    font-style: italic;
    color: var(--accent);
}

.log-entry.chat { border-left-color: var(--primary); }
.log-entry .sender { font-weight: 700; margin-bottom: 2px; color: var(--accent); }

.log-entry.results-msg {
    border-left-color: var(--pts-15);
    background: rgba(168, 85, 247, 0.07);
}

/* ---------- Wyniki rundy (odpowiedzi graczy) — mobile: akordeon ---------- */
.round-results-block {
    width: 100%;
}

.round-results-head {
    font-weight: 800;
    font-size: var(--fs-sm);
    color: var(--accent);
    margin-bottom: var(--space-3);
    letter-spacing: 0.02em;
}

.round-results-player {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    margin-bottom: var(--space-2);
    background: var(--surface-0);
    overflow: hidden;
}

.round-results-player--me {
    border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}

.round-results-player-summary {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: var(--space-3) var(--space-4);
    padding-right: 2rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    font-size: var(--fs-sm);
    position: relative;
}

.round-results-player-summary::-webkit-details-marker {
    display: none;
}

.round-results-player-summary::after {
    content: "";
    position: absolute;
    right: 0.85rem;
    top: 50%;
    width: 0.45rem;
    height: 0.45rem;
    border-right: 2px solid var(--text-muted);
    border-bottom: 2px solid var(--text-muted);
    transform: translateY(-70%) rotate(-45deg);
    transition: transform 0.18s ease;
}

.round-results-player[open] > .round-results-player-summary::after {
    transform: translateY(-30%) rotate(45deg);
}

.round-results-player-name {
    font-weight: 700;
    color: var(--text);
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.round-results-player-total {
    margin-left: auto;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    color: var(--accent);
    flex-shrink: 0;
}

.round-results-rows {
    padding: 0 var(--space-3) var(--space-3);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.round-results-row {
    display: grid;
    grid-template-columns: minmax(4.5rem, 28%) minmax(0, 1fr) auto;
    gap: var(--space-2) var(--space-3);
    align-items: start;
    font-size: var(--fs-xs);
    line-height: 1.35;
    padding: var(--space-2);
    border-radius: var(--r-sm);
    background: var(--surface-1);
}

.round-results-cat {
    color: var(--text-muted);
    font-weight: 600;
}

.round-results-val {
    color: var(--text);
    word-break: break-word;
    min-width: 0;
}

.round-results-pts {
    font-weight: 800;
    font-variant-numeric: tabular-nums;
    padding: 0.1rem 0.35rem;
    border-radius: 6px;
    justify-self: end;
}

.round-results-pts--15 { color: var(--pts-15); background: rgba(168, 85, 247, 0.12); }
.round-results-pts--10 { color: var(--pts-10); background: rgba(34, 197, 94, 0.12); }
.round-results-pts--5  { color: var(--pts-5);  background: rgba(249, 115, 22, 0.12); }
.round-results-pts--0  { color: var(--danger); background: rgba(239, 68, 68, 0.1); }

@media (max-width: 420px) {
    .round-results-row {
        grid-template-columns: 1fr;
        gap: var(--space-1);
    }

    .round-results-pts {
        justify-self: start;
    }
}

@media (min-width: 768px) {
    .round-results-player > .round-results-player-summary::after {
        display: none;
    }

    .round-results-player-summary {
        cursor: default;
        padding-right: var(--space-4);
    }
}

.chat-input-group {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
    margin-top: var(--space-3);
}

@media (min-width: 480px) {
    .chat-input-group { grid-template-columns: 1fr auto; }
    .chat-input-group button { width: auto; padding: 0 1.1rem; }
}

/* ---------- Scoring colors on inputs ---------- */
input.pts-15 { border-color: var(--pts-15); box-shadow: 0 0 10px rgba(168, 85, 247, 0.3); }
input.pts-10 { border-color: var(--pts-10); box-shadow: 0 0 10px rgba(34, 197, 94, 0.3); }
input.pts-5  { border-color: var(--pts-5);  box-shadow: 0 0 10px rgba(249, 115, 22, 0.3); }
input.pts-0  { border-color: var(--danger); }

/* ---------- Restart / settings cards ---------- */
.settings-card, .restart-card {
    background: var(--surface-0);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--space-6);
    margin-bottom: var(--space-5);
    animation: fadeIn 0.4s ease;
}

.restart-card {
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--accent);
    margin-top: var(--space-5);
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.restart-buttons {
    display: grid;
    grid-template-columns: 1fr;
    gap: var(--space-2);
}

@media (min-width: 480px) {
    .restart-buttons { grid-template-columns: 1fr 1fr; }
}

/* ---------- Modals ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    z-index: 2000;
    background: rgba(2, 6, 23, 0.78);
    backdrop-filter: blur(6px);
    align-items: center;
    justify-content: center;
    padding: var(--space-4);
}

.modal-content {
    width: min(560px, 100%);
    background: #0b1220;
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    padding: var(--space-6);
    box-shadow: var(--shadow-lg);
    animation: fadeIn 0.25s ease;
}

.modal-content h3 {
    font-size: var(--fs-h3);
    margin-bottom: var(--space-4);
}

.modal-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-3);
    margin-top: var(--space-5);
}

/* ---------- Navbar leave button ---------- */
.nav-cta--leave {
    background: rgba(239, 68, 68, 0.12);
    color: #fecaca;
    border: 1px solid rgba(239, 68, 68, 0.4);
    text-transform: none;
    letter-spacing: 0.2px;
    font-weight: 700;
    box-shadow: none;
}

.nav-cta--leave:hover:not(:disabled) {
    background: rgba(239, 68, 68, 0.2);
    color: white;
    border-color: rgba(239, 68, 68, 0.7);
    filter: none;
    box-shadow: none;
    transform: none;
}

.nav-cta--leave::before {
    content: "🚪 ";
}

.nav-room-info {
    color: var(--text-muted);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.3px;
}

.nav-room-info strong {
    color: var(--accent);
    font-weight: 800;
    margin-left: 4px;
    letter-spacing: 1px;
}

/* Pokaż info o pokoju tylko od md w górę, na mobile zostaje sam button. */
@media (max-width: 767px) {
    .nav-room-info { display: none !important; }
    .nav-cta--leave {
        padding: 0.4rem 0.7rem;
        font-size: 0.8rem;
    }
}

/* ---------- Utility ---------- */
.text-center { text-align: center; }
.mt-4 { margin-top: var(--space-4); }
.mt-8 { margin-top: var(--space-8); }
.mb-4 { margin-bottom: var(--space-4); }

/* Hide scrollbars on touch where it adds noise */
@media (pointer: coarse) {
    button:hover:not(:disabled) { transform: none; }
}
