/* ── Mono Pizza – Main Stylesheet ───────────────────────── */

:root {
    --bg-dark:      #0a0000;
    --bg-card:      #190000;
    --primary:      #cf0000;
    --primary-dark: #a80000;
    --primary-light:#e63333;
    --yellow:       #FFD700;
    --text:         #f5e0e0;
    --text-muted:   #996666;
    --border:       rgba(207,0,0,0.3);
    --shadow:       0 4px 24px rgba(207,0,0,0.2);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
    background-color: var(--bg-dark);
    background-image:
        radial-gradient(circle at 15% 50%, rgba(207,0,0,0.07) 0%, transparent 55%),
        radial-gradient(circle at 85% 20%, rgba(255,215,0,0.03) 0%, transparent 50%);
    color: var(--text);
    font-family: 'Nunito', sans-serif;
    min-height: 100vh;
}

h1, h2, h3, .heading { font-family: 'Fredoka One', cursive; }

/* ── Brand logo ────────────────────────────────────────── */

.brand-logo {
    max-width: 200px;
    height: auto;
    display: block;
    margin: 0 auto;
    /* invert white bg to transparent on dark bg */
    filter: brightness(0) invert(1)
            drop-shadow(0 2px 12px rgba(207,0,0,0.5));
}
.brand-logo-sm { max-width: 110px; }

/* ── Layout ────────────────────────────────────────────── */

.page-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem 2rem;
}

.card-pizza {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: 20px;
    padding: 1.75rem;
    box-shadow: var(--shadow);
    width: 100%;
    max-width: 480px;
}

/* ── Buttons ───────────────────────────────────────────── */

.btn-pizza {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 0.85rem 2rem;
    font-family: 'Fredoka One', cursive;
    font-size: 1.15rem;
    letter-spacing: 0.02em;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
}
.btn-pizza:hover, .btn-pizza:focus {
    background: linear-gradient(135deg, var(--primary-light), var(--primary));
    color: #fff;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(207,0,0,0.45);
}
.btn-pizza:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.btn-outline-pizza {
    background: transparent;
    color: var(--primary-light);
    border: 2px solid var(--primary);
    border-radius: 50px;
    padding: 0.75rem 2rem;
    font-family: 'Fredoka One', cursive;
    font-size: 1.1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
    width: 100%;
}
.btn-outline-pizza:hover {
    background: var(--primary);
    color: #fff;
    transform: translateY(-2px);
}

.btn-sm-pizza {
    padding: 0.55rem 1.25rem;
    font-size: 0.95rem;
}

/* ── Form controls ─────────────────────────────────────── */

.form-pizza {
    background: rgba(207,0,0,0.08);
    border: 1.5px solid var(--border);
    border-radius: 12px;
    color: var(--text);
    padding: 0.75rem 1rem;
    width: 100%;
    font-size: 1rem;
    font-family: 'Nunito', sans-serif;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-pizza:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(207,0,0,0.12);
    box-shadow: 0 0 0 3px rgba(207,0,0,0.18);
}
.form-pizza::placeholder { color: var(--text-muted); }

.form-label-pizza {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.4rem;
    display: block;
}

/* ── Room code display ─────────────────────────────────── */

.room-code-wrap {
    background: rgba(255,215,0,0.07);
    border: 2px solid rgba(255,215,0,0.3);
    border-radius: 14px;
    padding: 0.9rem 1.25rem;
    text-align: center;
}
.room-code {
    font-family: 'Fredoka One', cursive;
    font-size: 3.2rem;
    color: var(--yellow);
    letter-spacing: 0.35em;
    text-shadow: 0 0 30px rgba(255,215,0,0.4);
    line-height: 1;
}
.room-code-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-top: 0.25rem;
}

/* ── Player grid (lobby) ───────────────────────────────── */

.players-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.75rem;
}
@media (max-width: 300px) {
    .players-grid { grid-template-columns: repeat(2, 1fr); }
}

.player-thumb {
    background: rgba(207,0,0,0.07);
    border: 1.5px solid var(--border);
    border-radius: 14px;
    padding: 0.75rem 0.4rem;
    text-align: center;
}
.player-thumb.is-host {
    border-color: rgba(255,215,0,0.5);
    background: rgba(255,215,0,0.06);
}
.player-thumb img {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    border: 2.5px solid var(--primary);
    display: block;
    margin: 0 auto 0.45rem;
}
.player-thumb.is-host img { border-color: var(--yellow); }
.player-thumb .pname {
    font-size: 0.8rem;
    font-weight: 700;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Vote cards (game) ─────────────────────────────────── */

.vote-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.9rem;
}

.vote-card {
    background: rgba(207,0,0,0.07);
    border: 2px solid var(--border);
    border-radius: 16px;
    padding: 1.2rem 0.6rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.18s ease;
    -webkit-tap-highlight-color: transparent;
    user-select: none;
}
.vote-card:hover, .vote-card:active {
    background: rgba(207,0,0,0.2);
    border-color: var(--primary);
    transform: scale(1.04);
}
.vote-card.selected {
    background: rgba(207,0,0,0.28);
    border-color: var(--primary);
    box-shadow: 0 0 22px rgba(207,0,0,0.35);
    transform: scale(1.04);
}
.vote-card img {
    width: 76px;
    height: 76px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    display: block;
    margin: 0 auto 0.65rem;
}
.vote-card .vname {
    font-weight: 700;
    font-size: 0.9rem;
}

/* ── Progress bar ──────────────────────────────────────── */

.progress-wrap {
    background: rgba(207,0,0,0.12);
    border-radius: 50px;
    height: 7px;
    overflow: hidden;
}
.progress-fill {
    background: linear-gradient(90deg, var(--primary), var(--yellow));
    height: 100%;
    border-radius: 50px;
    transition: width 0.35s ease;
}

/* ── Selfie uploader ───────────────────────────────────── */

.selfie-area {
    border: 2px dashed var(--border);
    border-radius: 16px;
    padding: 1.5rem;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}
.selfie-area:hover {
    border-color: var(--primary);
    background: rgba(207,0,0,0.05);
}
.selfie-preview {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--primary);
    margin: 0 auto 0.75rem;
    display: none;
}
.selfie-preview.show { display: block; }

/* ── Result cards ──────────────────────────────────────── */

.title-card {
    background: rgba(207,0,0,0.08);
    border: 1.5px solid var(--border);
    border-radius: 16px;
    padding: 1rem 1.1rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.title-card img {
    width: 58px;
    height: 58px;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--yellow);
    flex-shrink: 0;
}
.title-card .title-label {
    font-family: 'Fredoka One', cursive;
    font-size: 1rem;
    color: var(--yellow);
    line-height: 1.2;
}
.title-card .winner-name { font-weight: 700; font-size: 0.95rem; }

.result-img {
    width: 100%;
    border-radius: 16px;
    border: 2px solid var(--border);
    box-shadow: var(--shadow);
}

/* ── Spinner ───────────────────────────────────────────── */

.pizza-spin {
    font-size: 3.5rem;
    display: inline-block;
    animation: spin 2s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Misc helpers ──────────────────────────────────────── */

.logo {
    font-family: 'Fredoka One', cursive;
    font-size: 1.6rem;
    color: var(--text);
}
.text-primary-p { color: var(--primary-light); }
.text-yellow     { color: var(--yellow); }
.text-muted-p    { color: var(--text-muted); }
.divider         { border: none; border-top: 1px solid var(--border); margin: 1.25rem 0; }
.gap-3s          { display: flex; flex-direction: column; gap: 0.75rem; }

.alert-err {
    background: rgba(207,0,0,0.15);
    border: 1px solid rgba(207,0,0,0.4);
    border-radius: 10px;
    padding: 0.65rem 0.9rem;
    color: #ff9999;
    font-size: 0.9rem;
}

[x-cloak] { display: none !important; }

@keyframes pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.45; }
}
.pulse { animation: pulse 1.6s ease-in-out infinite; }
