/* ============================================================
   LaSpecial — Salon persistant (room)
   ============================================================ */
:root {
    --bg-dark: #07030f;
    --card-bg: #1c1326;
    --gold: #FFD700;
    --gradient-fire: linear-gradient(135deg, #FF7A00 0%, #FF004D 50%, #7000FF 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 18% 6%, rgba(178, 0, 255, 0.22), transparent 55%),
        radial-gradient(circle at 82% 96%, rgba(255, 0, 77, 0.18), transparent 55%),
        linear-gradient(180deg, #14082a 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 ---------- */
.rm-header {
    display: flex;
    align-items: center;
    padding: 14px 16px 8px;
    gap: 12px;
}
.rm-back {
    width: 42px; height: 42px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 13px;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    font-size: 0.95rem;
    flex-shrink: 0;
    transition: transform 0.1s, background 0.15s;
}
.rm-back:active { transform: scale(0.92); }
.rm-title-wrap { flex: 1; min-width: 0; text-align: center; }
.rm-title-wrap h1 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    background: var(--gradient-fire);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.rm-title-wrap p { margin: 2px 0 0; color: #907d9e; font-size: 0.8rem; }
.rm-spacer { width: 42px; flex-shrink: 0; }

/* ---------- MAIN ---------- */
.rm-main {
    flex: 1;
    padding: 8px 16px 24px;
    display: flex;
    flex-direction: column;
    gap: 22px;
}
body.ls-has-bottom-nav .rm-main {
    padding-bottom: calc(24px + 76px + env(safe-area-inset-bottom));
}
.rm-main > section { display: flex; flex-direction: column; gap: 22px; }
.rm-main > section.hidden { display: none !important; }

/* ---------- CARDS ---------- */
.rm-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 22px 20px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.rm-big-icon {
    display: block;
    font-size: 2.5rem;
    text-align: center;
    color: var(--gold);
    margin-bottom: 10px;
    background: linear-gradient(135deg, #FFD700, #FF8A00);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    width: fit-content;
    margin-left: auto; margin-right: auto;
}
.rm-title {
    margin: 0 0 6px;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 900;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}
.rm-subtitle {
    margin: 0 0 14px;
    text-align: center;
    color: #cab5e6;
    font-size: 0.9rem;
    line-height: 1.45;
}

/* ---------- WELCOME : actions principales ---------- */
.rm-action {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px 16px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 18px;
    color: #fff;
    text-decoration: none;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: transform 0.1s, background 0.15s, border-color 0.15s;
    box-sizing: border-box;
    width: 100%;
}
.rm-action:active { transform: scale(0.985); }
.rm-action:hover { background: rgba(255, 255, 255, 0.08); }
.rm-action > i {
    width: 44px; height: 44px;
    border-radius: 14px;
    background: rgba(255, 215, 0, 0.14);
    color: #FFD700;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.15rem;
    flex-shrink: 0;
}
.rm-action > span { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.rm-action-title { font-weight: 800; font-size: 1rem; }
.rm-action-sub { font-size: 0.78rem; color: #cab5e6; }
.rm-action-primary {
    background: linear-gradient(135deg, rgba(255, 122, 0, 0.18), rgba(255, 0, 77, 0.10));
    border-color: rgba(255, 0, 77, 0.45);
}
.rm-action-primary > i {
    background: linear-gradient(135deg, rgba(255, 122, 0, 0.3), rgba(255, 0, 77, 0.2));
    color: #FFD700;
}

/* ---------- JOIN FORM ---------- */
.rm-form { display: flex; flex-direction: column; gap: 10px; }
.rm-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;
}
.rm-input:focus { outline: 2px solid var(--gold); }
.rm-submit {
    padding: 14px 18px;
    border: none;
    border-radius: 14px;
    background: var(--gradient-fire);
    color: #fff;
    font-weight: 900;
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 6px 0 #3a0052;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    font-family: inherit;
}
.rm-submit:active { transform: translateY(4px); box-shadow: 0 2px 0 #3a0052; }
.rm-error {
    margin: 8px 0 0;
    color: #ff6b6b;
    font-size: 0.88rem;
    text-align: center;
}
.rm-error.rm-global-error {
    background: rgba(255, 0, 77, 0.12);
    border: 1px solid rgba(255, 0, 77, 0.35);
    padding: 10px 14px;
    border-radius: 12px;
    margin: 10px 0 0;
}

/* ---------- LOBBY VIEW ---------- */
.rm-code-card { text-align: center; padding: 22px 18px 16px; }
.rm-code-label {
    margin: 0 0 6px;
    color: #cab5e6;
    font-size: 0.74rem;
    letter-spacing: 1.6px;
    font-weight: 700;
}
.rm-code-value {
    margin: 0 0 14px;
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 8px;
    background: var(--gradient-fire);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.rm-code-actions { display: flex; gap: 8px; justify-content: center; }
.rm-mini-btn {
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex; align-items: center; gap: 6px;
    transition: transform 0.1s, background 0.15s;
}
.rm-mini-btn:active { transform: scale(0.95); }
.rm-mini-btn:hover { background: rgba(255, 255, 255, 0.12); }
.rm-mini-btn i { font-size: 0.76rem; }

/* QR (collapsible) */
.rm-qr-details {
    padding: 14px 18px;
    text-align: center;
}
.rm-qr-details summary {
    cursor: pointer;
    list-style: none;
    color: #cab5e6;
    font-weight: 700;
    font-size: 0.88rem;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.rm-qr-details summary::-webkit-details-marker { display: none; }
.rm-qr-img {
    width: 200px;
    background: #fff;
    padding: 10px;
    border-radius: 14px;
    display: block;
    margin: 14px auto 0;
}

/* Players list */
.rm-players-title {
    margin: 0 0 12px;
    font-weight: 700;
    display: flex; align-items: center; gap: 8px;
    font-size: 0.95rem;
}
.rm-players-count {
    margin-left: auto;
    background: rgba(255, 215, 0, 0.15);
    color: var(--gold);
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
}
.rm-players-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rm-players-list li {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}
.rm-player-avatar {
    width: 36px; height: 36px;
    border-radius: 50%;
    background: var(--gradient-fire);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 0.82rem;
    flex-shrink: 0;
}
.rm-player-avatar.has-image { background-size: cover; background-position: center; color: transparent; box-shadow: inset 0 0 0 2px rgba(255, 215, 0, 0.45); }
.rm-player-avatar.is-admin { box-shadow: inset 0 0 0 2px rgba(0, 229, 255, 0.6), 0 0 12px rgba(0, 229, 255, 0.35); }
.rm-player-name { flex: 1; min-width: 0; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rm-tag {
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.65rem;
    font-weight: 900;
    letter-spacing: 0.4px;
    display: inline-flex; align-items: center; gap: 4px;
}
.rm-tag.host { background: rgba(255, 215, 0, 0.2); color: var(--gold); }
.rm-tag.admin { background: linear-gradient(135deg, #00E5FF, #7000FF); color: #fff; }
.rm-players-empty { color: #907d9e; text-align: center; font-style: italic; padding: 10px; }

/* Launcher (game grid) */
.rm-launcher-card { padding: 18px; }
.rm-launcher-head { margin-bottom: 14px; }
.rm-launcher-title {
    margin: 0 0 4px;
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--gold);
    display: flex; align-items: center; gap: 8px;
}
.rm-launcher-sub { margin: 0; color: #cab5e6; font-size: 0.82rem; }
.rm-game-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
}
.rm-game-tile {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    padding: 14px 8px;
    color: #fff;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
    display: flex; flex-direction: column; align-items: center; gap: 4px;
    transition: transform 0.1s, border-color 0.15s, background 0.15s;
}
.rm-game-tile:active { transform: scale(0.95); }
.rm-game-tile:hover { border-color: rgba(255, 215, 0, 0.45); background: rgba(255, 215, 0, 0.04); }
.rm-game-tile:disabled { opacity: 0.4; cursor: not-allowed; }
/* Tuile "suggérée" : le groupe a pré-choisi ce jeu. Pulsation + halo gold. */
.rm-game-tile.is-suggested {
    border-color: #FFD700;
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 122, 0, 0.10));
    box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.25), 0 8px 22px rgba(255, 215, 0, 0.2);
    animation: rmSuggestPulse 1.8s ease-in-out infinite;
}
.rm-game-tile.is-suggested::after {
    content: '✨ Suggéré';
    position: absolute; top: 6px; right: 6px;
    background: linear-gradient(135deg, #FFD700, #FF7A00);
    color: #1a0a00; padding: 2px 8px; border-radius: 999px;
    font-size: 0.62rem; font-weight: 900; letter-spacing: 0.5px;
    text-transform: uppercase;
}
.rm-game-tile { position: relative; }
@keyframes rmSuggestPulse {
    0%, 100% { box-shadow: 0 0 0 3px rgba(255, 215, 0, 0.25), 0 8px 22px rgba(255, 215, 0, 0.2); }
    50% { box-shadow: 0 0 0 6px rgba(255, 215, 0, 0.35), 0 10px 28px rgba(255, 215, 0, 0.4); }
}

/* Bandeau "Salon du groupe X" */
.rm-group-banner {
    display: flex; align-items: center; gap: 14px;
    background: linear-gradient(135deg, rgba(112, 0, 255, 0.14), rgba(0, 212, 255, 0.10));
    border: 1px solid rgba(112, 0, 255, 0.35);
    border-radius: 18px;
    padding: 14px 16px;
}
.rm-group-icon {
    width: 44px; height: 44px; flex-shrink: 0;
    background: linear-gradient(135deg, #7000FF, #00D4FF);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 1.2rem;
}
.rm-group-info { flex: 1; min-width: 0; }
.rm-group-eyebrow {
    font-size: 0.7rem; color: #cab5e6; text-transform: uppercase;
    letter-spacing: 1.5px; font-weight: 700;
}
.rm-group-name { font-size: 1rem; font-weight: 900; color: #fff; }
.rm-group-banner .rm-mini-btn { padding: 6px 10px; }
.rm-game-emoji { font-size: 1.8rem; line-height: 1; margin-bottom: 4px; }
.rm-game-name { font-weight: 800; font-size: 0.85rem; line-height: 1.1; }
.rm-game-tag {
    font-size: 0.66rem;
    color: #907d9e;
    margin-top: 2px;
}

.rm-host-hint {
    margin: 0;
    text-align: center;
    color: #907d9e;
    font-size: 0.88rem;
    padding: 14px;
    background: rgba(255, 215, 0, 0.06);
    border: 1px dashed rgba(255, 215, 0, 0.3);
    border-radius: 14px;
    display: flex; align-items: center; justify-content: center; gap: 8px;
}
.rm-host-hint i { color: var(--gold); }

.rm-leave {
    margin-top: 4px;
    padding: 12px;
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    color: #cab5e6;
    font-size: 0.9rem;
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    font-family: inherit;
}
.rm-leave:active { background: rgba(255, 255, 255, 0.06); }

/* ============================================================
   SECTION GROUPES (dans la vue welcome)
   ============================================================ */
.rm-groups-section {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 16px 16px 14px;
    margin-top: 4px;
}
.rm-section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 10px;
}
.rm-section-head h3 {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 800;
    display: flex; align-items: center; gap: 8px;
}
.rm-section-head h3 i { color: var(--gold); font-size: 0.9rem; }

.rm-mini-primary {
    background: var(--gradient-fire);
    color: #fff;
    border: none;
}

.rm-feedback {
    margin: 8px 0 0;
    font-size: 0.84rem;
    text-align: center;
    color: #cab5e6;
}
.rm-feedback.err { color: #ff6b6b; }
.rm-feedback.ok { color: #86efac; }

/* Form inline création */
.rm-new-group-form {
    background: rgba(255, 122, 0, 0.06);
    border: 1px dashed rgba(255, 122, 0, 0.4);
    border-radius: 14px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 12px;
    animation: rm-slidedown 0.22s ease;
}
@keyframes rm-slidedown {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: translateY(0); }
}
.rm-input-text {
    font-size: 1rem;
    letter-spacing: 0;
    text-align: left;
    text-transform: none;
    padding: 10px 14px;
    border-radius: 12px;
}
.rm-color-picker {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.rm-color-swatch {
    width: 32px; height: 32px;
    border-radius: 50%;
    border: 3px solid transparent;
    cursor: pointer;
    padding: 0;
    transition: transform 0.1s;
}
.rm-color-swatch:active { transform: scale(0.92); }
.rm-color-swatch.is-active {
    border-color: #fff;
    box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.4);
}
.rm-form-actions {
    display: flex; gap: 8px;
    justify-content: flex-end;
}

/* Liste groupes */
.rm-groups-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}
.rm-group-row {
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 12px 14px;
    display: flex;
    align-items: center;
    gap: 12px;
    position: relative;
    overflow: hidden;
}
.rm-group-row::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--g-color, var(--gold));
}
.rm-group-info {
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; gap: 4px;
}
.rm-group-name {
    font-weight: 800;
    font-size: 0.92rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.rm-group-meta {
    font-size: 0.72rem;
    color: #907d9e;
    display: flex; align-items: center; gap: 8px;
}
.rm-group-avatars {
    display: flex; align-items: center;
}
.rm-group-avatars .rm-mini-avatar + .rm-mini-avatar { margin-left: -6px; }
.rm-mini-avatar {
    width: 20px; height: 20px;
    border-radius: 50%;
    border: 2px solid var(--card-bg);
    background: var(--gradient-fire);
    color: #fff;
    font-size: 0.55rem;
    font-weight: 900;
    display: inline-flex; align-items: center; justify-content: center;
}
.rm-mini-avatar.has-image { background-size: cover; background-position: center; color: transparent; }
.rm-group-actions {
    display: flex; gap: 6px;
    flex-shrink: 0;
}
.rm-group-launch {
    background: var(--gradient-fire);
    color: #fff;
    border: none;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    display: inline-flex; align-items: center; gap: 5px;
    box-shadow: 0 3px 8px rgba(255, 0, 77, 0.3);
}
.rm-group-launch:active { transform: scale(0.95); }
.rm-group-edit {
    background: rgba(0, 229, 255, 0.12);
    color: #00E5FF;
    border: none;
    width: 32px; height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 0.75rem;
    display: inline-flex; align-items: center; justify-content: center;
}
.rm-group-edit:active { transform: scale(0.92); }
.rm-groups-empty {
    color: #907d9e;
    font-style: italic;
    font-size: 0.85rem;
    text-align: center;
    padding: 14px 10px;
}

/* ---------- LOADING ---------- */
.rm-loading {
    flex: 1;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    gap: 14px;
    color: #cab5e6;
    padding: 40px 20px;
}
.rm-spinner {
    width: 38px; height: 38px;
    border: 3px solid rgba(255, 255, 255, 0.15);
    border-top-color: var(--gold);
    border-radius: 50%;
    animation: rm-spin 0.9s linear infinite;
}
@keyframes rm-spin { to { transform: rotate(360deg); } }
.rm-loading-text { font-size: 0.92rem; }
