/* Grande Tournée GR - Styles mobile-first */
:root {
    --primary: #1e40af;
    --primary-dark: #1e3a8a;
    --accent: #f59e0b;
    --success: #10b981;
    --danger: #ef4444;
    --bg: #f8fafc;
    --surface: #ffffff;
    --text: #1e293b;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --radius: 12px;
    --shadow: 0 2px 8px rgba(0,0,0,.06);
    --shadow-lg: 0 10px 30px rgba(0,0,0,.12);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

.app {
    max-width: 540px;
    margin: 0 auto;
    min-height: 100vh;
    background: var(--bg);
}

.header {
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: white;
    padding: 24px 20px 28px;
    text-align: center;
    box-shadow: var(--shadow);
}

.header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.header .subtitle {
    margin-top: 4px;
    opacity: 0.85;
    font-size: 0.9rem;
}

.content {
    padding: 20px 16px 40px;
}

.card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}

.card h2 {
    margin: 0 0 12px;
    font-size: 1.15rem;
    color: var(--primary);
}

.card p {
    margin: 0 0 12px;
    color: var(--text);
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 14px 22px;
    border-radius: var(--radius);
    border: 0;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: all .15s ease;
    width: 100%;
    min-height: 48px; /* tap target */
}

.btn-primary {
    background: var(--primary);
    color: white;
}
.btn-primary:active { background: var(--primary-dark); transform: scale(.98); }

.btn-success {
    background: var(--success);
    color: white;
}
.btn-success:active { transform: scale(.98); }

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    width: auto;
    padding: 8px 14px;
    font-size: 0.875rem;
}

.btn:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Formulaires */
.form-group {
    margin-bottom: 14px;
}

.form-group label {
    display: block;
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 6px;
}

.form-control {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 1rem;
    background: var(--surface);
    color: var(--text);
    transition: border-color .15s;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(30, 64, 175, .15);
}

/* Badge / chip */
.entries-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: linear-gradient(135deg, var(--accent), #f97316);
    color: white;
    padding: 8px 14px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.95rem;
    box-shadow: var(--shadow);
}

/* Question card */
.question-card {
    background: var(--surface);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: var(--shadow);
    border-left: 4px solid var(--primary);
    transition: opacity .2s;
}

.question-card.completed {
    opacity: 0.6;
    border-left-color: var(--success);
    background: #f0fdf4;
}

.question-card .cat-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.question-card .icon {
    font-size: 1.6rem;
    line-height: 1;
}

.question-card .cat-name {
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 600;
}

.question-card .question-text {
    font-size: 1rem;
    margin: 8px 0 14px;
    color: var(--text);
}

.question-card .check-icon {
    color: var(--success);
    font-size: 1.4rem;
    margin-left: auto;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%) translateY(100px);
    background: var(--text);
    color: white;
    padding: 12px 22px;
    border-radius: 999px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    opacity: 0;
    transition: all .3s ease;
    z-index: 100;
    max-width: 90%;
    text-align: center;
}

.toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

.toast.success { background: var(--success); }
.toast.error { background: var(--danger); }

/* Loading */
.loader {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgba(255,255,255,.3);
    border-top-color: white;
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.text-center { text-align: center; }
.text-muted { color: var(--text-muted); font-size: 0.875rem; }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }

/* Section masquage */
.hidden { display: none !important; }

/* Footer info */
.footer {
    text-align: center;
    padding: 24px 16px;
    color: var(--text-muted);
    font-size: 0.8rem;
}

/* Stats summary */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-top: 12px;
}

.stat-box {
    background: var(--surface);
    padding: 14px;
    border-radius: var(--radius);
    text-align: center;
    box-shadow: var(--shadow);
}

.stat-box .num {
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--primary);
}

.stat-box .lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 2px;
}

/* Admin */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.admin-table th, .admin-table td {
    padding: 10px 12px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    font-size: 0.875rem;
}

.admin-table th {
    background: var(--primary);
    color: white;
    font-weight: 600;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.admin-table tr:last-child td { border-bottom: 0; }
.admin-table tr:hover td { background: #f8fafc; }

@media (min-width: 768px) {
    .app { max-width: 720px; }
    .admin-only { max-width: 1100px; }
}

/* ============================================================
   INTRO CINÉMA — Fade in + zoom doux + fond adaptatif par scène
   ============================================================ */

.cinema {
    position: fixed;
    inset: 0;
    z-index: 9999;
    overflow: hidden;
    background: #0a0a0f; /* Fallback pendant le chargement */
    transition: opacity .8s ease-out, visibility .8s;
}

.cinema.cinema-done {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

/* Couche de fond qui transite entre scènes (sous les scènes) */
.cinema-bg {
    position: absolute;
    inset: 0;
    background: #0a0a0f;
    transition: background-color .6s ease;
    z-index: 1;
}

.cinema-scene {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    z-index: 2;
}

.cinema-scene.cinema-active {
    /* 2 secondes par scène : fade in (.4s) -> hold (1.2s) -> fade out (.4s) */
    animation: cinemaSceneFade 2s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes cinemaSceneFade {
    0%   { opacity: 0; transform: scale(0.92); }
    20%  { opacity: 1; transform: scale(1); }
    80%  { opacity: 1; transform: scale(1.02); }
    100% { opacity: 0; transform: scale(1.08); }
}

/* === Thème SOMBRE (fond noir, texte clair) === */
.cinema-theme-light .cinema-label {
    color: rgba(255, 255, 255, 0.55);
}
.cinema-theme-light .cinema-sub {
    color: rgba(255, 255, 255, 0.65);
}
.cinema-theme-light .cinema-logo {
    filter: drop-shadow(0 4px 24px rgba(255, 255, 255, 0.08));
}
.cinema-theme-light .cinema-logo-fallback {
    color: white;
}

/* === Thème CLAIR (fond blanc, texte sombre) === */
.cinema-theme-dark .cinema-label {
    color: rgba(0, 0, 0, 0.5);
}
.cinema-theme-dark .cinema-sub {
    color: rgba(0, 0, 0, 0.65);
}
.cinema-theme-dark .cinema-logo {
    filter: drop-shadow(0 4px 16px rgba(0, 0, 0, 0.12));
}
.cinema-theme-dark .cinema-logo-fallback {
    color: #1a1a1a;
}

/* Styles communs */
.cinema-label {
    font-size: 0.75rem;
    letter-spacing: 0.35em;
    margin-bottom: 24px;
    text-transform: uppercase;
    font-weight: 500;
}

.cinema-logo {
    max-width: 75%;
    max-height: 45vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.cinema-logo-title {
    max-width: 85%;
    max-height: 50vh;
}

.cinema-logo-fallback {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    padding: 0 20px;
}

.cinema-logo-title-fallback {
    font-size: 2.8rem;
    background: linear-gradient(135deg, #f59e0b, #ef4444);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 0.02em;
    text-transform: uppercase;
}

.cinema-sub {
    font-size: 0.9rem;
    margin-top: 16px;
    font-weight: 400;
    letter-spacing: 0.08em;
}

.cinema-skip {
    position: absolute;
    bottom: 24px;
    right: 20px;
    background: rgba(127, 127, 127, 0.18);
    color: rgba(127, 127, 127, 0.95);
    border: 1px solid rgba(127, 127, 127, 0.25);
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    letter-spacing: 0.05em;
    opacity: 0;
    z-index: 3;
    /* Apparaît après 1.5s pour ne pas distraire trop tôt */
    animation: cinemaSkipShow .4s ease 1.5s forwards;
    -webkit-tap-highlight-color: transparent;
    backdrop-filter: blur(8px);
}

@keyframes cinemaSkipShow {
    to { opacity: 1; }
}

.cinema-skip:active {
    background: rgba(127, 127, 127, 0.35);
}

/* Sur mobile : adapter la taille des logos textuels */
@media (max-width: 380px) {
    .cinema-logo-fallback { font-size: 2rem; }
    .cinema-logo-title-fallback { font-size: 2.3rem; }
    .cinema-label { font-size: 0.7rem; letter-spacing: 0.25em; }
}

/* Pour les utilisateurs qui préfèrent moins d'animation */
@media (prefers-reduced-motion: reduce) {
    .cinema-scene.cinema-active {
        animation: cinemaSceneFadeReduced 1.5s ease forwards;
    }
    @keyframes cinemaSceneFadeReduced {
        0%, 100% { opacity: 0; }
        20%, 80% { opacity: 1; }
    }
}
