/* ============================================================
   LaSpecial — Pictionnaire (multi-téléphones)
   ============================================================ */
:root {
    --bg-dark: #0f0a14;
    --card-bg: #1c1326;
    --text-light: #FFFFFF;
    --gradient-fire: linear-gradient(135deg, #FF7A00 0%, #FF004D 50%, #7000FF 100%);
    --shadow-color: #4a00a8;
    --gold: #FFD700;
}

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

body {
    margin: 0;
    font-family: 'Fredoka', sans-serif;
    background-color: var(--bg-dark);
    color: var(--text-light);
    min-height: 100dvh;
    overflow-x: hidden;
}

#app {
    display: flex;
    flex-direction: column;
    min-height: 100dvh;
}

/* ---------- HEADER ---------- */
.pic-header {
    display: flex;
    align-items: center;
    padding: 14px 14px 10px;
    gap: 12px;
}
.btn-back {
    background: var(--card-bg);
    border: 2px solid #2d1c3d;
    color: #fff;
    width: 42px; height: 42px;
    border-radius: 13px;
    font-size: 1rem;
    box-shadow: 0 4px 0 #180f21;
    display: flex; align-items: center; justify-content: center;
    text-decoration: none;
    cursor: pointer;
    flex-shrink: 0;
}
.btn-back:active { transform: translateY(4px); box-shadow: 0 0 0 #180f21; }
.titles { flex: 1; min-width: 0; text-align: center; }
.titles h1 {
    margin: 0;
    font-size: 1.3rem;
    font-weight: 900;
    text-transform: uppercase;
    background: var(--gradient-fire);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
    letter-spacing: 0.5px;
}
.titles p { margin: 2px 0 0; color: #907d9e; font-size: 0.8rem; }
.pic-spacer { width: 42px; flex-shrink: 0; }

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

/* ---------- CARDS ---------- */
.pic-card {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 18px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}
.pic-big-icon {
    display: block;
    font-size: 2.4rem;
    text-align: center;
    color: var(--gold);
    margin-bottom: 10px;
}
.pic-title {
    margin: 0 0 6px;
    text-align: center;
    font-size: 1.2rem;
    text-transform: uppercase;
}
.pic-subtitle {
    margin: 0 0 14px;
    text-align: center;
    color: #cab5e6;
    font-size: 0.9rem;
}

/* ---------- JOIN ---------- */
.pic-form { display: flex; flex-direction: column; gap: 10px; }
.pic-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;
}
.pic-input:focus { outline: 2px solid var(--gold); }
.pic-submit, .pic-start {
    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;
}
.pic-submit:active, .pic-start:active { transform: translateY(4px); box-shadow: 0 2px 0 #3a0052; }
.pic-start:disabled { opacity: 0.5; cursor: not-allowed; box-shadow: 0 6px 0 #3a0052; }
.pic-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;
}
.pic-leave:active { background: rgba(255, 255, 255, 0.06); }
.pic-error {
    margin: 8px 0 0;
    color: #ff6b6b;
    font-size: 0.9rem;
    text-align: center;
}
.pic-error.global-error {
    background: rgba(255, 0, 77, 0.12);
    border: 1px solid rgba(255, 0, 77, 0.35);
    padding: 10px 14px;
    border-radius: 12px;
}
.pic-hint { margin: 0; color: #907d9e; font-size: 0.82rem; text-align: center; }

/* ---------- LOBBY ---------- */
.code-card { text-align: center; }
.code-label { margin: 0 0 6px; color: #cab5e6; font-size: 0.8rem; letter-spacing: 1.5px; }
.code-value {
    margin: 0;
    font-size: 2.2rem;
    font-weight: 900;
    letter-spacing: 6px;
    background: var(--gradient-fire);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.copy-code {
    margin-top: 10px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.14);
    color: #fff;
    padding: 8px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    cursor: pointer;
    font-family: inherit;
}
.qr-card { text-align: center; }
.qr-label { margin: 0 0 10px; color: #cab5e6; font-size: 0.9rem; }
.qr-img {
    width: 170px; height: 170px;
    background: #fff;
    padding: 10px;
    border-radius: 14px;
    display: block;
    margin: 0 auto;
}
.qr-hint { margin: 10px 0 0; color: #907d9e; font-size: 0.8rem; }

.players-title {
    margin: 0 0 10px;
    font-weight: 700;
    display: flex; align-items: center; gap: 8px;
}
.players-count {
    margin-left: auto;
    background: rgba(255, 215, 0, 0.15);
    color: var(--gold);
    padding: 2px 10px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}
.players-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.player-item {
    display: flex; align-items: center; gap: 10px;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 12px;
}
.player-avatar {
    width: 34px; height: 34px;
    border-radius: 50%;
    background: var(--gradient-fire);
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800;
    font-size: 0.8rem;
    flex-shrink: 0;
}
.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);
}
.player-avatar.is-admin {
    box-shadow: inset 0 0 0 2px rgba(0, 229, 255, 0.55), 0 0 12px rgba(0, 229, 255, 0.35);
}
.player-avatar.has-image.is-admin {
    box-shadow: inset 0 0 0 2px rgba(0, 229, 255, 0.65), 0 0 12px rgba(0, 229, 255, 0.4);
}
.player-admin-tag {
    background: linear-gradient(135deg, #00E5FF 0%, #7000FF 100%);
    color: #fff;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.4px;
    display: inline-flex; align-items: center; gap: 4px;
}
.player-admin-tag i { font-size: 0.62rem; }
.player-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.player-host-tag {
    background: rgba(255, 215, 0, 0.2);
    color: var(--gold);
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 700;
}
.players-empty { color: #907d9e; text-align: center; font-style: italic; padding: 8px; }

/* Setup (host) */
.setup-card { padding: 16px; }
.setup-title { margin: 0 0 12px; font-size: 0.85rem; text-transform: uppercase; color: var(--gold); letter-spacing: 1px; display: flex; align-items: center; gap: 8px; }
.setup-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.setup-row + .setup-row { border-top: 1px solid rgba(255, 255, 255, 0.06); }
.setup-label { flex: 1; font-weight: 700; font-size: 0.92rem; }
.setup-segmented {
    display: flex; gap: 4px;
    background: rgba(0, 0, 0, 0.3);
    border-radius: 999px;
    padding: 3px;
}
.setup-opt {
    padding: 6px 12px;
    background: transparent;
    border: none;
    color: #cab5e6;
    font-weight: 700;
    font-size: 0.8rem;
    border-radius: 999px;
    cursor: pointer;
    font-family: inherit;
}
.setup-opt.is-active {
    background: var(--gradient-fire);
    color: #fff;
}

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

/* ---------- GAME TOPBAR ---------- */
.pic-topbar {
    display: flex; align-items: center; justify-content: space-between;
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 14px;
    padding: 10px 14px;
}
.pic-round { font-weight: 800; font-size: 0.88rem; color: #cab5e6; }
.pic-timer {
    font-weight: 900; font-size: 1.05rem;
    color: var(--gold);
    display: inline-flex; align-items: center; gap: 6px;
}
.pic-timer.is-urgent { color: #FF004D; animation: pic-pulse 0.6s ease-in-out infinite alternate; }
@keyframes pic-pulse { from { transform: scale(1); } to { transform: scale(1.08); } }

/* ---------- WORD CARD (drawer voit le mot, guesser voit l'indice) ---------- */
.pic-word-card {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.1), rgba(255, 122, 0, 0.06));
    border: 1px dashed rgba(255, 215, 0, 0.4);
    border-radius: 16px;
    padding: 14px;
    text-align: center;
}
.word-label { margin: 0 0 4px; color: #cab5e6; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; }
.word-value {
    margin: 0;
    font-size: 1.6rem;
    font-weight: 900;
    letter-spacing: 4px;
    text-transform: uppercase;
    color: var(--gold);
}

/* ---------- CANVAS ---------- */
.canvas-wrap {
    position: relative;
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    aspect-ratio: 4 / 3;
    width: 100%;
    border: 2px solid rgba(255, 255, 255, 0.08);
    touch-action: none;
}
.pic-canvas {
    width: 100%;
    height: 100%;
    display: block;
    cursor: crosshair;
    background: #fff;
}
.canvas-overlay {
    position: absolute; inset: 0;
    background: rgba(15, 10, 20, 0.85);
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    color: #cab5e6;
    gap: 10px;
    font-weight: 700;
}
.canvas-overlay i { font-size: 1.8rem; color: var(--gold); }
.canvas-overlay p { margin: 0; font-size: 0.95rem; text-align: center; padding: 0 16px; }

/* ---------- TOOLS (drawer) ---------- */
.pic-tools {
    display: flex;
    align-items: center;
    gap: 6px;
    overflow-x: auto;
    padding: 8px 4px;
    scrollbar-width: none;
}
.pic-tools::-webkit-scrollbar { display: none; }
.tool-btn {
    width: 38px; height: 38px;
    border: 1px solid rgba(255, 255, 255, 0.14);
    background: var(--card-bg);
    border-radius: 12px;
    color: #fff;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: transform 0.1s, border-color 0.15s;
    padding: 0;
}
.tool-btn:active { transform: scale(0.92); }
.tool-btn.is-active { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(255, 215, 0, 0.35); }
.swatch {
    width: 22px; height: 22px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.25);
}
.dot { background: #fff; border-radius: 50%; }
.dot-s { width: 6px; height: 6px; }
.dot-l { width: 14px; height: 14px; }
.tool-action i { font-size: 0.95rem; color: #cab5e6; }

/* ---------- GUESS ZONE ---------- */
.pic-guess {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 16px;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.guess-log {
    list-style: none; margin: 0; padding: 0;
    display: flex; flex-direction: column;
    gap: 4px;
    max-height: 140px;
    overflow-y: auto;
}
.guess-log li {
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    font-size: 0.85rem;
    display: flex; gap: 8px; align-items: baseline;
}
.guess-log li strong { color: var(--gold); font-weight: 700; font-size: 0.78rem; }
.guess-log li.is-close { background: rgba(255, 215, 0, 0.12); border: 1px solid rgba(255, 215, 0, 0.3); }
.guess-log li.is-correct { background: rgba(34, 197, 94, 0.18); border: 1px solid rgba(34, 197, 94, 0.5); color: #86efac; font-weight: 700; }
.guess-form { display: flex; gap: 8px; }
.guess-input {
    flex: 1;
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 12px;
    padding: 10px 14px;
    color: #fff;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.95rem;
}
.guess-input:focus { outline: 2px solid var(--gold); }
.guess-submit {
    width: 42px;
    background: var(--gradient-fire);
    border: none;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    font-size: 1rem;
    box-shadow: 0 4px 0 #3a0052;
}
.guess-submit:active { transform: translateY(4px); box-shadow: 0 0 0 #3a0052; }

/* ---------- SCOREBOARD ---------- */
.pic-scoreboard {
    background: var(--card-bg);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 12px;
    padding: 10px 14px;
}
.pic-scoreboard summary {
    cursor: pointer;
    list-style: none;
    color: var(--gold);
    font-weight: 700;
    font-size: 0.88rem;
    display: flex; align-items: center; gap: 8px;
}
.pic-scoreboard summary::-webkit-details-marker { display: none; }
.score-list {
    list-style: none; margin: 8px 0 0; padding: 0;
    display: flex; flex-direction: column; gap: 4px;
}
.score-list li {
    display: flex; align-items: center; gap: 8px;
    padding: 6px 10px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 8px;
    font-size: 0.85rem;
}
.score-list .score-rank {
    width: 22px; height: 22px;
    background: rgba(255, 215, 0, 0.18);
    color: var(--gold);
    border-radius: 50%;
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 0.72rem;
}
.score-list .score-rank.gold { background: var(--gradient-fire); color: #fff; }
.score-list .score-name { flex: 1; }
.score-list .score-value { font-weight: 800; color: var(--gold); }

/* ---------- REVEAL ---------- */
.reveal-card { text-align: center; }
.reveal-outcome {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 900;
    text-transform: uppercase;
    background: var(--gradient-fire);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.reveal-outcome.is-timeout {
    background: linear-gradient(135deg, #6a6a6a, #444);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.reveal-winner { margin: 0 0 14px; color: #cab5e6; font-size: 0.95rem; }
.reveal-word-label { margin: 0; color: #907d9e; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 1px; }
.reveal-word {
    margin: 4px 0 14px;
    font-size: 1.8rem;
    font-weight: 900;
    text-transform: uppercase;
    color: var(--gold);
    letter-spacing: 4px;
}
.reveal-scores {
    list-style: none; margin: 0 0 14px; padding: 0;
    display: flex; flex-direction: column; gap: 6px;
    text-align: left;
}
.reveal-scores li {
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 10px;
    display: flex; gap: 10px; align-items: center;
    font-size: 0.92rem;
}
.reveal-scores li .delta { color: #86efac; font-weight: 800; margin-left: auto; }
.reveal-scores li .delta.is-zero { color: #5c456e; }
.reveal-hint { margin: 0; color: #907d9e; font-size: 0.85rem; }
.reveal-hint span { color: var(--gold); font-weight: 800; }

/* ---------- END ---------- */
.end-card { text-align: center; }
.end-outcome {
    margin: 0 0 6px;
    font-size: 1.6rem;
    font-weight: 900;
    text-transform: uppercase;
    background: var(--gradient-fire);
    -webkit-background-clip: text; background-clip: text;
    color: transparent;
}
.end-winner-line { margin: 0 0 18px; color: #cab5e6; font-size: 0.95rem; }
.end-leaderboard {
    list-style: none; margin: 0 0 18px; padding: 0;
    display: flex; flex-direction: column; gap: 8px;
    text-align: left;
}
.end-leaderboard li {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 14px;
}
.end-leaderboard li.is-first {
    background: linear-gradient(135deg, rgba(255, 215, 0, 0.18), rgba(255, 122, 0, 0.08));
    border: 1px solid rgba(255, 215, 0, 0.4);
}
.end-leaderboard .lb-rank {
    width: 28px; height: 28px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    color: #cab5e6;
    display: flex; align-items: center; justify-content: center;
    font-weight: 900; font-size: 0.85rem;
    flex-shrink: 0;
}
.end-leaderboard li.is-first .lb-rank { background: var(--gradient-fire); color: #fff; }
.end-leaderboard .lb-name { flex: 1; font-weight: 700; }
.end-leaderboard .lb-points { font-weight: 900; color: var(--gold); }
.end-hint { margin: 8px 0 0; color: #907d9e; font-size: 0.82rem; }

/* ---------- RESPONSIVE ---------- */
@media (max-width: 360px) {
    .tool-btn { width: 34px; height: 34px; }
    .swatch { width: 18px; height: 18px; }
    .code-value { font-size: 1.9rem; letter-spacing: 4px; }
    .word-value { font-size: 1.4rem; letter-spacing: 3px; }
}
