/* TTN - Feuille de styles globale (style.css) */
:root {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

*, *::before, *::after {
    box-sizing: inherit;
}

/* --- Thème 1 : Pelouse --- */
[data-theme="pelouse"] {
    --bg-page: #60a5fa;
    --bg-card: #16a34a;
    --text-card: #ffffff;
    --bg-header: #93c5fd;
    --text-header: #1e3a8a;
    --bg-button: #e5e7eb;
    --text-button: #111827;
    --btn-active: #2563eb;
    --btn-active-text: #ffffff;
}

/* --- Thème 2 : Stade (Soir de match, verre dépoli & néon) --- */
:root, [data-theme="stade"] {
    --bg-page: #080d0a;
    --bg-card: rgba(18, 26, 21, 0.7);
    --text-card: #f3fdf6;
    --bg-header: rgba(18, 26, 21, 0.85);
    --text-header: #00e676;
    --bg-button: rgba(30, 44, 35, 0.8);
    --text-button: #ffffff;
    --btn-active: #00e676;
    --btn-active-text: #041208;
}

/* Fond de stade nocturne avec halo de projecteurs */
[data-theme="stade"] body {
    background-color: #080d0a;
    background-image:
            radial-gradient(circle at 50% 0%, rgba(0, 230, 118, 0.15), transparent 60%),
            linear-gradient(to bottom, rgba(8, 13, 10, 0.85), rgba(8, 13, 10, 0.95)),
            url('https://images.unsplash.com/photo-1508098682722-e99c43a406b2?q=80&w=1200&auto=format&fit=crop');
    background-size: cover;
    background-position: center top;
    background-attachment: fixed;
}

/* Effet Glassmorphism */
[data-theme="stade"] .player-bar,
[data-theme="stade"] .toolbar-prefs,
[data-theme="stade"] .nav-journee,
[data-theme="stade"] .match-card,
[data-theme="stade"] .submit-container {
    background: var(--bg-card);
    backdrop-filter: blur(12px) saturate(140%);
    -webkit-backdrop-filter: blur(12px) saturate(140%);
    border: 1px solid rgba(0, 230, 118, 0.22);
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

/* Cartes de match : espacement et badge de score lumineux */
[data-theme="stade"] .match-card {
    padding: 14px 16px;
    margin-bottom: 12px;
}

[data-theme="stade"] .score-display {
    background: rgba(0, 0, 0, 0.55);
    border: 1px solid rgba(0, 230, 118, 0.35);
    box-shadow: 0 0 10px rgba(0, 230, 118, 0.15);
    border-radius: 6px;
    padding: 4px 12px;
    font-size: 18px;
    letter-spacing: 2px;
}

/* Boutons Stepper métallisés / néon */
[data-theme="stade"] .btn-step {
    border: 1px solid rgba(0, 230, 118, 0.2);
    border-radius: 6px;
    transition: all 0.15s ease;
}

[data-theme="stade"] .btn-step:hover {
    border-color: var(--btn-active);
    box-shadow: 0 0 8px rgba(0, 230, 118, 0.3);
}

/* Bouton d'envoi vert électrique */
[data-theme="stade"] .btn-send-preds {
    box-shadow: 0 4px 20px rgba(0, 230, 118, 0.35);
    letter-spacing: 1px;
}

/* --- Thème 3 : Sombre (Ardoise) --- */
[data-theme="sombre"] {
    --bg-page: #0f172a;
    --bg-card: #1e293b;
    --text-card: #f8fafc;
    --bg-header: #334155;
    --text-header: #f8fafc;
    --bg-button: #475569;
    --text-button: #ffffff;
    --btn-active: #38bdf8;
    --btn-active-text: #0f172a;
}

/* --- Thème 4 : Clair --- */
[data-theme="clair"] {
    --bg-page: #f1f5f9;
    --bg-card: #ffffff;
    --text-card: #1e293b;
    --bg-header: #e2e8f0;
    --text-header: #0f172a;
    --bg-button: #f1f5f9;
    --text-button: #0f172a;
    --btn-active: #2563eb;
    --btn-active-text: #ffffff;
}

body {
    margin: 0;
    padding: 12px;
    background-color: var(--bg-page);
    color: var(--text-card);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

#app {
    width: 100%;
    max-width: 480px;
}

/* Barre de préférences & Joueur */
.player-bar, .toolbar-prefs {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-header);
    color: var(--text-header);
    padding: 8px 12px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-size: 14px;
}

.player-bar select, .toolbar-prefs select {
    background: var(--bg-button);
    color: var(--text-button);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 4px;
    padding: 4px 8px;
    font-weight: 500;
}

/* Navigation des journées */
.nav-journee {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-card);
    color: var(--text-card);
    padding: 10px 14px;
    border-radius: 8px;
    margin-bottom: 12px;
    font-weight: bold;
}

.nav-journee button {
    background: var(--bg-button);
    color: var(--text-button);
    border: 1px solid rgba(0, 0, 0, 0.15);
    padding: 6px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 16px;
    font-weight: bold;
}

.nav-journee button:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.journee-title {
    text-align: center;
}

.journee-date {
    display: block;
    font-size: 12px;
    font-weight: normal;
    opacity: 0.8;
    margin-top: 2px;
}

/* Cartes de Match & Affichage des équipes */
.match-card {
    background: var(--bg-card);
    color: var(--text-card);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 8px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.match-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: bold;
    font-size: 15px;
    gap: 8px;
}

.team-col {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.team-col.home {
    justify-content: flex-start;
}

.team-col.away {
    justify-content: flex-end;
    text-align: right;
}

.team-col span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.team-logo {
    width: 24px !important;
    height: 24px !important;
    max-width: 24px !important;
    max-height: 24px !important;
    object-fit: contain;
    flex-shrink: 0;
    image-rendering: -webkit-optimize-contrast;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.score-display {
    background: rgba(0, 0, 0, 0.25);
    padding: 3px 10px;
    border-radius: 4px;
    font-size: 18px;
    font-weight: bold;
    color: var(--btn-active);
    flex-shrink: 0;
}

/* Widget Stepper (+ / -) */
.widget-stepper {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 10px;
}

.stepper-team {
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-step {
    width: 32px;
    height: 32px;
    background: var(--bg-button);
    color: var(--text-button);
    border: none;
    border-radius: 4px;
    font-weight: bold;
    font-size: 18px;
    cursor: pointer;
}

.btn-step:active {
    background: var(--btn-active);
    color: var(--btn-active-text);
}

/* Direct Tap */
.widget-direct {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.tap-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
}

.tap-row span {
    width: 70px;
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.btn-tap {
    flex: 1;
    padding: 6px 0;
    background: var(--bg-button);
    color: var(--text-button);
    border: none;
    border-radius: 4px;
    font-weight: 600;
    font-size: 14px;
    cursor: pointer;
}

.btn-tap.active {
    background: var(--btn-active);
    color: var(--btn-active-text);
}

/* Pavé contextuel */
.widget-keypad {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
}

.keypad-trigger {
    padding: 6px 14px;
    border-radius: 6px;
    background: var(--bg-button);
    color: var(--text-button);
    border: 1px solid rgba(0,0,0,0.1);
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
}

.keypad-popover {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    background: var(--bg-card);
    border: 2px solid var(--btn-active);
    padding: 8px;
    border-radius: 8px;
    margin-top: 8px;
}

.btn-num {
    padding: 8px 0;
    background: var(--bg-button);
    color: var(--text-button);
    border: none;
    border-radius: 4px;
    font-weight: bold;
    font-size: 16px;
    cursor: pointer;
}

/* Sélecteur de couleur custom */
.custom-color-picker {
    display: flex;
    justify-content: space-around;
    align-items: center;
    background: rgba(0, 0, 0, 0.08);
    padding: 8px;
    border-radius: 8px;
    margin-bottom: 12px;
    gap: 8px;
}

.color-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    font-size: 12px;
    font-weight: 600;
    gap: 4px;
}

.color-item input[type="color"] {
    -webkit-appearance: none;
    border: 1px solid rgba(0, 0, 0, 0.2);
    border-radius: 50%;
    width: 28px;
    height: 28px;
    cursor: pointer;
    padding: 0;
    background: none;
}

.color-item input[type="color"]::-webkit-color-swatch-wrapper { padding: 0; }
.color-item input[type="color"]::-webkit-color-swatch { border: none; border-radius: 50%; }

/* Zone de transmission */
.submit-container {
    background: var(--bg-card);
    color: var(--text-card);
    border-radius: 8px;
    padding: 14px;
    margin-top: 16px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.15);
}

.submit-container textarea {
    width: 100%;
    background-color: var(--bg-page);
    color: var(--text-card);
    border: 1px solid var(--bg-header);
    border-radius: 6px;
    padding: 8px;
    font-family: inherit;
    font-size: 14px;
    resize: vertical;
    box-sizing: border-box;
}

.submit-container textarea:focus {
    outline: none;
    border-color: var(--btn-active);
}

.btn-send-preds {
    background-color: var(--btn-active);
    color: var(--btn-active-text);
    font-weight: bold;
    border: none;
    border-radius: 6px;
    width: 100%;
    padding: 12px;
    font-size: 16px;
    cursor: pointer;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    transition: opacity 0.2s, transform 0.1s;
}

.btn-send-preds:active {
    transform: scale(0.98);
}

/* ========================================================
   Mode Saisie : Gamble (Rouleaux & Manivelle)
   ======================================================== */

.widget-gamble {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 16px;
    margin-top: 10px;
}

/* Fenêtre de cadrage du rouleau avec relief mécanique */
.reel-box {
    width: 48px;
    height: 40px;
    overflow: hidden;
    background: radial-gradient(circle at center, #1e293b 0%, #0f172a 100%);
    border: 2px solid #475569;
    border-top-color: #64748b;
    border-bottom-color: #334155;
    border-radius: 8px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.6), inset 0 0 8px rgba(0, 0, 0, 0.8);
    cursor: pointer;
    user-select: none;
    position: relative;
}

/* Masque 3D trompe-l'œil : crée la courbure du tambour rotatif */
.reel-box::after {
    content: '';
    position: absolute;
    inset: 0;
    pointer-events: none;
    background: linear-gradient(
            to bottom,
            rgba(0, 0, 0, 0.85) 0%,
            rgba(0, 0, 0, 0.15) 25%,
            rgba(255, 255, 255, 0.15) 50%,
            rgba(0, 0, 0, 0.15) 75%,
            rgba(0, 0, 0, 0.85) 100%
    );
    border-radius: 6px;
}

/* Bande défilante verticale */
.reel-strip {
    display: flex;
    flex-direction: column;
    will-change: transform;
}

.reel-num {
    height: 40px;
    line-height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    font-weight: 900;
    font-family: "Courier New", Courier, monospace;
    color: #facc15; /* Jaune doré casino */
    text-shadow: 0 0 10px rgba(250, 204, 21, 0.5);
}

.gamble-sep {
    font-size: 20px;
    font-weight: bold;
    opacity: 0.5;
}

/* Flou de rotation rapide */
.reel-strip.spinning {
    filter: blur(1.5px);
}

/* --- Manivelle rouge flottante (affichée uniquement en mode Gamble) --- */
.slot-lever-container {
    position: fixed;
    right: 18px;
    bottom: 84px;
    display: flex;
    flex-direction: column;
    align-items: center;
    cursor: pointer;
    z-index: 1000;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
}

.slot-lever-base {
    width: 30px;
    height: 52px;
    background: #1e293b;
    border: 2px solid #475569;
    border-radius: 15px;
    position: relative;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
}

.slot-lever-arm {
    position: absolute;
    top: 6px;
    left: 50%;
    width: 6px;
    height: 56px;
    background: linear-gradient(to right, #94a3b8, #e2e8f0, #64748b);
    border-radius: 3px;
    transform-origin: bottom center;
    transform: translateX(-50%) rotate(0deg);
    transition: transform 0.25s cubic-bezier(0.18, 0.89, 0.32, 1.28);
}

.slot-lever-knob {
    position: absolute;
    top: -16px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 24px;
    background: radial-gradient(circle at 35% 35%, #ef4444, #991b1b);
    border-radius: 50%;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.6);
}

/* Bascule visuelle de la manette au tirage */
.slot-lever-arm.pulled {
    transform: translateX(-50%) rotate(72deg) scaleY(0.75);
}

.slot-lever-label {
    margin-top: 18px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 1px;
    color: #ef4444;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}
/* --- VUE LIVE SCORE --- */
.livescore-wrapper {
    max-width: 580px;
    margin: 0 auto;
}

.livescore-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 8px;
    padding: 10px 16px;
    margin-bottom: 12px;
}

.livescore-chrono-box {
    display: flex;
    flex-direction: column;
}

.chrono-label {
    font-size: 0.7rem;
    letter-spacing: 1px;
    opacity: 0.7;
}

.chrono-digits {
    font-size: 1.8rem;
    font-weight: 900;
    color: #ffcc00;
    font-variant-numeric: tabular-nums;
}

.btn-start-live {
    background: #ff0055;
    color: #fff;
    border: none;
    font-size: 0.95rem;
    font-weight: bold;
    padding: 10px 18px;
    border-radius: 6px;
    cursor: pointer;
    transition: transform 0.1s, background 0.2s;
}

.btn-start-live:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.livescore-board {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.livescore-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 6px;
    padding: 8px 12px;
}

.live-col {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.live-col.home {
    justify-content: flex-start;
}

.live-col.away {
    justify-content: flex-end;
}

.live-team-name {
    font-size: 0.88rem;
    font-weight: 600;
}

.live-score-pill {
    font-size: 1.25rem;
    font-weight: 800;
    padding: 4px 12px;
    border-radius: 4px;
    background: rgba(0, 0, 0, 0.35);
    min-width: 55px;
    text-align: center;
    font-variant-numeric: tabular-nums;
    transition: background 0.2s, color 0.2s;
}

/* L'illumination rouge vif à chaque but */
.goal-flash-red {
    background: #ff1744 !important;
    color: #ffffff !important;
    box-shadow: 0 0 14px rgba(255, 23, 68, 0.9);
    animation: pulse-red 0.7s ease-out;
}

@keyframes pulse-red {
    0% { transform: scale(1.18); }
    100% { transform: scale(1); }
}