/* ============================================================
   LaSpecial — Loup-Garou multi-téléphones
   Thème lunaire/sombre avec accents rouge sang.
   ============================================================ */
:root {
    --bg-dark: #07030f;
    --card-bg: #1c1326;
    --line: rgba(255, 255, 255, 0.08);
    --muted: #907d9e;
    --gold: #FFD700;
    --blood: #ff003c;
    --moon: #cfe1ff;
    --gradient-blood: linear-gradient(135deg, #5a0014 0%, #b00021 50%, #ff3258 100%);
    --gradient-moon: linear-gradient(135deg, #1d0c3a 0%, #482e85 50%, #91b7ff 100%);
    --gradient-dawn: linear-gradient(135deg, #ff7a00 0%, #ffd700 50%, #74c0fc 100%);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }

body {
    margin: 0;
    font-family: 'Fredoka', sans-serif;
    background: var(--bg-dark);
    background-image:
        radial-gradient(circle at 50% 0%, rgba(120, 80, 200, 0.18), transparent 60%),
        radial-gradient(circle at 82% 96%, rgba(180, 0, 30, 0.18), transparent 55%),
        linear-gradient(180deg, #100823 0%, #07030f 100%);
    background-attachment: fixed;
    color: #fff;
    min-height: 100dvh;
}
#app {
    max-width: 520px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* ---------- HEADER ---------- */
.lg-header {
    display: flex; align-items: center;
    padding: 14px 16px 8px;
    gap: 12px;
}
.lg-back, .lg-mini-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--line);
    border-radius: 13px;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    transition: transform 0.1s, background 0.15s;
}
.lg-back { width: 42px; height: 42px; font-size: 0.95rem; flex-shrink: 0; }
.lg-back:active { transform: scale(0.92); }
.lg-title-wrap { flex: 1; min-width: 0; text-align: center; }
.lg-title-wrap h1 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: linear-gradient(135deg, #cfe1ff 0%, #ff3258 100%);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.lg-title-wrap p { margin: 2px 0 0; color: var(--muted); font-size: 0.8rem; }
.lg-spacer { width: 42px; flex-shrink: 0; }

/* ---------- MAIN ---------- */
.lg-main {
    flex: 1;
    padding: 8px 16px 24px;
    display: flex; flex-direction: column;
    gap: 14px;
}
.lg-main > section { display: flex; flex-direction: column; gap: 14px; }
.lg-main > section.hidden { display: none !important; }

/* ---------- CARDS GLOBALES ---------- */
.lg-card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 22px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
}
.lg-big-icon {
    display: block;
    text-align: center;
    font-size: 2.6rem;
    color: var(--gold);
    margin-bottom: 10px;
}
.lg-title {
    margin: 0 0 8px;
    text-align: center;
    font-size: 1.3rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.lg-subtitle {
    margin: 0 0 14px;
    text-align: center;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.45;
}

/* ---------- JOIN FORM ---------- */
.lg-form { display: flex; flex-direction: column; gap: 10px; }
.lg-input {
    padding: 14px 16px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 14px;
    background: rgba(0, 0, 0, 0.35);
    color: #fff;
    font-size: 1.4rem;
    text-align: center;
    letter-spacing: 6px;
    text-transform: uppercase;
    font-weight: 700;
    font-family: 'Fredoka', sans-serif;
}
.lg-input:focus { outline: 2px solid var(--blood); }
.lg-submit, .lg-start {
    padding: 14px 18px;
    border: none;
    border-radius: 14px;
    background: var(--gradient-blood);
    color: #fff;
    font-weight: 900;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    cursor: pointer;
    box-shadow: 0 6px 0 #2a0010;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    font-family: inherit;
}
.lg-submit:active, .lg-start:active { transform: translateY(4px); box-shadow: 0 2px 0 #2a0010; }
.lg-start:disabled { opacity: 0.5; cursor: not-allowed; }

.lg-leave {
    margin-top: 4px;
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: var(--muted);
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit;
}
.lg-leave:active { background: rgba(255, 255, 255, 0.06); }
.lg-error { margin: 8px 0 0; color: #ff6b6b; font-size: 0.88rem; text-align: center; }
.lg-error.lg-global-error {
    background: rgba(255, 0, 60, 0.15);
    border: 1px solid rgba(255, 0, 60, 0.4);
    padding: 10px 14px; border-radius: 12px;
}
.lg-hint { margin: 0; color: var(--muted); font-size: 0.82rem; text-align: center; }

/* ---------- LOBBY ---------- */
.lg-code-card { text-align: center; padding: 22px 18px 18px; }
.lg-code-label { margin: 0 0 6px; color: var(--muted); font-size: 0.74rem; letter-spacing: 1.6px; font-weight: 700; }
.lg-code-value {
    margin: 0 0 14px;
    font-size: 2.4rem;
    font-weight: 900;
    letter-spacing: 8px;
    background: var(--gradient-blood);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.lg-mini-btn {
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    display: inline-flex; gap: 6px;
}
.lg-mini-btn:active { transform: scale(0.95); }
.lg-qr-card { padding: 14px 18px; text-align: center; }
.lg-qr-card summary {
    cursor: pointer; list-style: none;
    color: var(--muted); font-weight: 700; font-size: 0.88rem;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.lg-qr-card summary::-webkit-details-marker { display: none; }
.lg-qr-img {
    width: 200px;
    background: #fff;
    padding: 10px;
    border-radius: 14px;
    display: block;
    margin: 14px auto 0;
}

.lg-players-title {
    margin: 0 0 12px;
    font-weight: 700;
    display: flex; align-items: center; gap: 8px;
    font-size: 0.95rem;
}
.lg-players-count {
    margin-left: auto;
    background: rgba(255, 0, 60, 0.18);
    color: var(--blood);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem; font-weight: 700;
}
.lg-players-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.lg-player-row {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}
.lg-player-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gradient-blood);
    color: #fff; font-weight: 800; font-size: 0.82rem;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.lg-player-avatar.has-image { background-size: cover; background-position: center; color: transparent; }
.lg-player-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-player-tag {
    background: rgba(255, 215, 0, 0.18); color: var(--gold);
    padding: 2px 8px; border-radius: 999px;
    font-size: 0.66rem; font-weight: 800;
}
.lg-players-empty { color: var(--muted); text-align: center; font-style: italic; padding: 10px; }

.lg-setup-card { padding: 16px; }
.lg-setup-title { margin: 0 0 8px; font-size: 0.88rem; color: var(--gold); letter-spacing: 1.2px; text-transform: uppercase; display: flex; align-items: center; gap: 8px; }
.lg-setup-info { margin: 0; color: var(--muted); font-size: 0.86rem; line-height: 1.5; }

/* ---------- ROLE CARD ---------- */
.lg-role-card { text-align: center; padding: 28px 22px; }
.lg-role-game { margin: 0 0 6px; color: var(--muted); font-size: 0.72rem; letter-spacing: 1.5px; font-weight: 700; text-transform: uppercase; }
.lg-role-label { margin: 0 0 14px; color: var(--gold); font-size: 0.74rem; letter-spacing: 1.5px; font-weight: 900; text-transform: uppercase; }
.lg-role-icon {
    font-size: 4rem;
    line-height: 1;
    margin: 10px 0 14px;
    filter: drop-shadow(0 0 24px rgba(255, 0, 60, 0.5));
    animation: lgPulse 2.4s ease-in-out infinite;
}
@keyframes lgPulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.06); }
}
.lg-role-name {
    margin: 0 0 16px;
    font-size: 2rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 2px;
    background: var(--gradient-blood);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.lg-role-card.is-villageois .lg-role-name { background: var(--gradient-dawn); -webkit-background-clip: text; background-clip: text; }
.lg-role-card.is-voyante .lg-role-name { background: var(--gradient-moon); -webkit-background-clip: text; background-clip: text; }
.lg-role-card.is-sorciere .lg-role-name { background: linear-gradient(135deg, #b62cff, #ff3258); -webkit-background-clip: text; background-clip: text; }
.lg-role-instruction {
    margin: 0 0 12px;
    color: #cab5e6;
    font-size: 0.95rem;
    line-height: 1.5;
}
.lg-role-extra {
    margin: 8px 0 16px;
    padding: 10px 14px;
    background: rgba(255, 215, 0, 0.08);
    border: 1px dashed rgba(255, 215, 0, 0.4);
    border-radius: 14px;
    color: var(--gold);
    font-weight: 700;
    font-size: 0.88rem;
}
.lg-role-seen-btn {
    margin-top: 14px;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 122, 0, 0.18));
    color: var(--gold);
    border: 1px solid rgba(255, 215, 0, 0.4);
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: 900; font-size: 0.9rem; letter-spacing: 0.6px;
    cursor: pointer; font-family: inherit;
    display: inline-flex; align-items: center; gap: 10px;
    width: 100%; justify-content: center;
}
.lg-role-seen-btn:active { transform: translateY(2px); }

/* ---------- NIGHT ---------- */
.lg-night-card {
    background: linear-gradient(180deg, #1d0c3a 0%, #100823 100%);
    border: 1px solid rgba(146, 183, 255, 0.18);
    box-shadow: 0 10px 40px rgba(60, 30, 180, 0.3);
}
.lg-night-bg {
    position: absolute; inset: 0; pointer-events: none;
    background:
        radial-gradient(circle at 80% 20%, rgba(207, 225, 255, 0.12), transparent 40%),
        radial-gradient(circle at 20% 70%, rgba(146, 183, 255, 0.08), transparent 30%);
    animation: lgNightDrift 18s linear infinite;
}
@keyframes lgNightDrift {
    0% { transform: translate(0, 0); }
    50% { transform: translate(2%, -2%); }
    100% { transform: translate(0, 0); }
}
.lg-phase-tag {
    margin: 0; color: var(--moon); font-size: 0.72rem; letter-spacing: 1.5px; font-weight: 900; text-transform: uppercase;
    text-align: center;
}
.lg-night-title {
    margin: 6px 0 8px;
    text-align: center;
    font-size: 1.4rem; font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: var(--gradient-moon);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.lg-night-text {
    margin: 0 0 16px;
    text-align: center; color: #cab5e6;
    font-size: 0.95rem; line-height: 1.45;
}
.lg-target-list {
    list-style: none; margin: 0 0 16px; padding: 0;
    display: flex; flex-direction: column; gap: 8px;
}
.lg-target {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex; align-items: center; gap: 10px;
    cursor: pointer;
    color: #fff;
    font-family: inherit; font-weight: 700;
    text-align: left; width: 100%;
    transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.lg-target:hover:not(:disabled) { border-color: var(--blood); background: rgba(255, 0, 60, 0.06); }
.lg-target:active:not(:disabled) { transform: scale(0.98); }
.lg-target.is-selected { border-color: var(--blood); background: rgba(255, 0, 60, 0.15); box-shadow: 0 0 0 2px rgba(255, 0, 60, 0.3); }
.lg-target:disabled { opacity: 0.5; cursor: not-allowed; }
.lg-target-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.lg-witch-actions { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; }
.lg-witch-victim {
    text-align: center;
    padding: 14px;
    background: rgba(255, 0, 60, 0.08);
    border: 1px dashed rgba(255, 0, 60, 0.35);
    border-radius: 14px;
}
.lg-witch-victim p { margin: 0; color: var(--muted); font-size: 0.82rem; }
.lg-witch-victim-name { font-size: 1.2rem !important; font-weight: 900 !important; color: var(--blood) !important; margin-top: 4px !important; }
.lg-witch-btns { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.lg-witch-btn {
    padding: 10px 6px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255, 255, 255, 0.05);
    color: #fff;
    font-family: inherit; font-weight: 800; font-size: 0.78rem;
    cursor: pointer;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    transition: transform 0.1s, background 0.15s;
}
.lg-witch-btn:active { transform: scale(0.95); }
.lg-witch-save { color: #22c55e; border-color: rgba(34, 197, 94, 0.4); }
.lg-witch-save:hover { background: rgba(34, 197, 94, 0.12); }
.lg-witch-kill { color: var(--blood); border-color: rgba(255, 0, 60, 0.5); }
.lg-witch-kill:hover { background: rgba(255, 0, 60, 0.12); }
.lg-witch-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.lg-witch-state { text-align: center; color: var(--muted); font-size: 0.78rem; margin: 0; }

.lg-reveal-box {
    text-align: center;
    padding: 18px;
    background: rgba(146, 183, 255, 0.08);
    border: 1px dashed rgba(146, 183, 255, 0.4);
    border-radius: 16px;
    margin-bottom: 14px;
}
.lg-reveal-box p { margin: 0; color: #cab5e6; }
.lg-reveal-role {
    margin-top: 6px !important;
    font-size: 1.4rem !important;
    font-weight: 900 !important;
    color: #fff !important;
    text-transform: uppercase; letter-spacing: 1px;
}

.lg-waiting {
    text-align: center;
    padding: 20px;
    color: var(--muted);
}
.lg-waiting-spinner {
    width: 36px; height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--moon);
    border-radius: 50%;
    animation: lgSpin 1s linear infinite;
    margin: 0 auto 10px;
}
@keyframes lgSpin { to { transform: rotate(360deg); } }
.lg-night-done {
    width: 100%;
    background: linear-gradient(135deg, rgba(146, 183, 255, 0.2), rgba(96, 64, 200, 0.2));
    color: #fff;
    border: 1px solid rgba(146, 183, 255, 0.4);
    border-radius: 14px;
    padding: 14px 20px;
    font-weight: 900; font-size: 0.9rem; letter-spacing: 0.6px;
    cursor: pointer; font-family: inherit;
}
.lg-night-done:active { transform: translateY(2px); }

/* ---------- DAWN ---------- */
.lg-dawn-card {
    text-align: center;
    background: linear-gradient(180deg, #ff7a00 0%, #b30033 100%);
    border: none;
    padding: 28px 22px;
}
.lg-dawn-card .lg-phase-tag { color: #fff8c0; }
.lg-dawn-title {
    margin: 6px 0 16px;
    font-size: 1.5rem; font-weight: 900;
    text-transform: uppercase;
    color: #fff;
}
.lg-dawn-victims {
    display: flex; flex-direction: column; gap: 10px;
    margin-bottom: 18px;
}
.lg-dawn-victim {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 14px;
    padding: 12px;
    color: #fff;
    font-weight: 700;
}
.lg-dawn-victim strong { font-size: 1.1rem; color: #fff8c0; }
.lg-dawn-empty {
    background: rgba(34, 197, 94, 0.18);
    border: 1px solid rgba(34, 197, 94, 0.4);
    border-radius: 14px; padding: 14px;
    color: #fff;
}

/* ---------- DAY (vote) ---------- */
.lg-day-card { padding: 20px; }
.lg-day-card .lg-phase-tag { color: var(--gold); }
.lg-day-title {
    margin: 6px 0 6px;
    text-align: center;
    font-size: 1.4rem; font-weight: 900;
    text-transform: uppercase;
    color: var(--gold);
}
.lg-day-sub { margin: 0 0 16px; text-align: center; color: var(--muted); font-size: 0.88rem; }
.lg-vote-list {
    list-style: none; margin: 0 0 14px; padding: 0;
    display: flex; flex-direction: column; gap: 8px;
}
.lg-vote-option {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex; align-items: center; gap: 10px;
    cursor: pointer; color: #fff;
    font-family: inherit; font-weight: 700;
    text-align: left; width: 100%;
}
.lg-vote-option:hover:not(:disabled) { border-color: var(--gold); background: rgba(255, 215, 0, 0.08); }
.lg-vote-option:active:not(:disabled) { transform: scale(0.98); }
.lg-vote-option.is-selected { border-color: var(--gold); background: rgba(255, 215, 0, 0.15); box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.4); }
.lg-vote-option:disabled { opacity: 0.5; cursor: not-allowed; }
.lg-vote-option-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lg-vote-option-count {
    background: rgba(255, 215, 0, 0.18);
    color: var(--gold);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.78rem; font-weight: 800;
}
.lg-vote-status { text-align: center; color: var(--muted); font-size: 0.82rem; margin: 0 0 4px; }
.lg-vote-hint { text-align: center; color: #86efac; font-size: 0.82rem; margin: 0; display: inline-flex; align-items: center; gap: 6px; justify-content: center; width: 100%; }
.lg-conclude-btn {
    background: linear-gradient(135deg, #FFD700, #FF8A00);
    color: #1a0e00;
    border: none;
    padding: 12px 18px;
    border-radius: 14px;
    font-weight: 900; font-size: 0.88rem;
    cursor: pointer; font-family: inherit;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    margin-top: 8px;
    box-shadow: 0 4px 0 #8a5600;
}
.lg-conclude-btn:active { transform: translateY(4px); box-shadow: 0 0 0 #8a5600; }

/* ---------- ELIM ---------- */
.lg-elim-card {
    text-align: center;
    background: linear-gradient(180deg, #2a0010 0%, #110024 100%);
    padding: 28px 22px;
}
.lg-elim-card .lg-phase-tag { color: var(--blood); }
.lg-elim-title {
    margin: 8px 0 14px;
    font-size: 1.4rem; font-weight: 900;
    color: #fff;
    text-transform: uppercase;
}
.lg-elim-icon {
    font-size: 5rem;
    line-height: 1;
    margin: 8px 0 12px;
    filter: drop-shadow(0 0 20px rgba(255, 0, 60, 0.6));
}
.lg-elim-role {
    margin: 0 0 18px;
    font-size: 1.4rem; font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    background: var(--gradient-blood);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}

/* ---------- END ---------- */
.lg-end-card { text-align: center; padding: 26px 22px; }
.lg-end-outcome {
    margin: 0 0 6px;
    font-size: 1.7rem;
    font-weight: 900;
    text-transform: uppercase;
    background: var(--gradient-blood);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.lg-end-outcome.is-villageois {
    background: var(--gradient-dawn);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.lg-end-winner { margin: 0 0 18px; color: #cab5e6; font-size: 0.95rem; }
.lg-end-roles {
    list-style: none; margin: 0 0 18px; padding: 0;
    display: flex; flex-direction: column; gap: 6px;
    text-align: left;
}
.lg-end-roles li {
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 10px 14px;
    display: flex; align-items: center; gap: 10px;
    font-size: 0.9rem;
}
.lg-end-roles li.dead { opacity: 0.55; text-decoration: line-through; }
.lg-end-role-icon { font-size: 1.4rem; flex-shrink: 0; }
.lg-end-role-name { flex: 1; font-weight: 700; }
.lg-end-role-tag {
    font-size: 0.7rem; font-weight: 800;
    text-transform: uppercase; letter-spacing: 0.6px;
    padding: 2px 8px; border-radius: 999px;
}
.lg-end-role-tag.loup { background: var(--gradient-blood); color: #fff; }
.lg-end-role-tag.voyante { background: linear-gradient(135deg, #1d0c3a, #91b7ff); color: #fff; }
.lg-end-role-tag.sorciere { background: linear-gradient(135deg, #b62cff, #ff3258); color: #fff; }
.lg-end-role-tag.villageois { background: rgba(255, 215, 0, 0.18); color: var(--gold); }

/* ---------- LOADING ---------- */
.lg-loading {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px;
    color: var(--muted);
    padding: 40px 20px;
}
.lg-spinner {
    width: 38px; height: 38px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--blood);
    border-radius: 50%;
    animation: lgSpin 0.9s linear infinite;
}

/* Bottom nav safe-area padding */
body.ls-has-bottom-nav .lg-main { padding-bottom: calc(24px + 96px + env(safe-area-inset-bottom)); }
