/* Mobile first : les styles de base visent le téléphone, @media (min-width) agrandit. */

:root {
    --feu-clair: #ffb000;
    --feu-orange: #ff8c42;
    --feu-rouge: #e63946;
    --bg: #0a0a0e;
    --bg-2: #0D1B2A;
    --text: #F2E9CF;
    --text-dim: rgba(242, 233, 207, 0.65);
    --line: rgba(255, 176, 0, 0.35);
    --surface: rgba(255, 255, 255, 0.04);
    --surface-hover: rgba(255, 255, 255, 0.09);
    --selected: rgba(255, 140, 66, 0.22);
    --radius: 12px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    background: var(--bg);
}

body {
    font-family: 'Poppins', system-ui, -apple-system, sans-serif;
    background: linear-gradient(160deg, var(--bg-2), var(--bg) 70%);
    background-attachment: fixed;
    color: var(--text);
    min-height: 100vh;
    min-height: 100dvh;
    font-weight: 500;
    line-height: 1.5;
    -webkit-tap-highlight-color: transparent;
}

.app {
    width: 100%;
    max-width: 36rem;
    min-height: 100vh;
    min-height: 100dvh;
    margin: 0 auto;
    padding: 1rem 1rem 0;
    display: flex;
    flex-direction: column;
}

/* ---------- En-tête : logos + nom de l'évènement ---------- */

.brand {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    padding: 0.25rem 0 1rem;
}

.brand img {
    height: 2.75rem;
    width: auto;
}

.brand .x {
    color: var(--text-dim);
    font-size: 0.9rem;
}

.brand.big {
    flex-direction: column;
    gap: 1rem;
    padding: 1.5rem 0 1.5rem;
}

.brand.big .logos {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.brand.big img {
    height: 5rem;
}

.brand h1 {
    font-size: 1.5rem;
    font-weight: 700;
    text-align: center;
    line-height: 1.25;
}

.brand h1 .accent {
    color: var(--feu-clair);
}

/* ---------- Progression ---------- */

.progress {
    height: 4px;
    background: var(--surface-hover);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 1.5rem;
}

.progress-bar {
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--feu-rouge), var(--feu-clair));
    transition: width 0.25s ease;
}

/* ---------- Écran ---------- */

.screen {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.question-label {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.4rem;
}

.question-meta {
    color: var(--text-dim);
    font-size: 0.9rem;
    margin-bottom: 1.25rem;
    min-height: 0.5rem;
}

.optional-tag {
    color: var(--feu-clair);
}

.center {
    text-align: center;
    align-items: center;
    justify-content: center;
    padding-bottom: 4rem;
}

.center p {
    color: var(--text-dim);
    font-size: 1.05rem;
}

/* ---------- Boutons ---------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    min-height: 3.25rem;
    padding: 0.75rem 1.25rem;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-weight: 600;
    font-size: 1rem;
    cursor: pointer;
    transition: background-color 0.15s, border-color 0.15s;
}

.btn:hover:not(:disabled) {
    background: var(--surface-hover);
}

.btn[aria-pressed="true"] {
    background: var(--selected);
    border-color: var(--feu-orange);
}

.btn-primary {
    width: 100%;
    background: var(--feu-orange);
    border-color: var(--feu-orange);
    color: #1a1a1a;
    font-weight: 700;
}

.btn-primary:hover:not(:disabled) {
    background: var(--feu-clair);
    border-color: var(--feu-clair);
}

.btn-primary:disabled {
    background: transparent;
    border-color: rgba(242, 233, 207, 0.2);
    color: rgba(242, 233, 207, 0.4);
    cursor: not-allowed;
}

.btn-link {
    background: none;
    border: none;
    color: var(--text-dim);
    font: inherit;
    font-size: 0.95rem;
    cursor: pointer;
    padding: 0.75rem 0.5rem;
}

.btn-link:hover {
    color: var(--text);
}

/* Barre d'action collée en bas, à portée du pouce */
.actions {
    position: sticky;
    bottom: 0;
    margin-top: auto;
    padding: 1.25rem 0 calc(1rem + env(safe-area-inset-bottom));
    background: linear-gradient(to bottom, transparent, var(--bg) 35%);
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.actions-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.actions-row .btn-link {
    flex-shrink: 0;
}

/* ---------- Choix ---------- */

.choices {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.choice {
    width: 100%;
    justify-content: flex-start;
    text-align: left;
}

.choice .dot {
    width: 1.1rem;
    height: 1.1rem;
    border: 2px solid var(--text-dim);
    border-radius: 50%;
    flex-shrink: 0;
}

.choice[aria-pressed="true"] .dot {
    border-color: var(--feu-orange);
    background: radial-gradient(var(--feu-orange) 45%, transparent 50%);
}

/* ---------- Notes 1 à 5 ---------- */

.rating {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 0.4rem;
}

.rate-btn {
    padding: 0;
    font-size: 1.15rem;
}

.rating-scale {
    display: flex;
    justify-content: space-between;
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: 0.4rem;
}

.na-btn {
    width: 100%;
    min-height: 2.75rem;
    margin-top: 0.75rem;
    font-size: 0.9rem;
    color: var(--text-dim);
}

.na-btn[aria-pressed="true"] {
    color: var(--text);
}

/* ---------- Matrice (une note par activité) ---------- */

.matrix {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.matrix-row-label {
    font-weight: 600;
    margin-bottom: 0.5rem;
}

.matrix-row .rate-btn {
    min-height: 2.75rem;
}

.matrix-row .na-btn {
    margin-top: 0.4rem;
}

/* ---------- Champs texte ---------- */

.field {
    width: 100%;
    padding: 0.85rem 1rem;
    background: var(--surface);
    border: 2px solid var(--line);
    border-radius: var(--radius);
    color: var(--text);
    font: inherit;
    font-size: 1rem; /* 16px minimum : évite le zoom auto sur iPhone */
    resize: vertical;
}

.field::placeholder {
    color: rgba(242, 233, 207, 0.35);
}

.field:focus {
    outline: none;
    border-color: var(--feu-clair);
}

textarea.field {
    min-height: 8rem;
}

.char-count {
    color: var(--text-dim);
    font-size: 0.8rem;
    text-align: right;
    margin-top: 0.3rem;
}

/* ---------- Messages ---------- */

.error {
    color: #ff9a9a;
    background: rgba(230, 57, 70, 0.12);
    border: 1px solid rgba(230, 57, 70, 0.45);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    margin-top: 1rem;
    font-size: 0.9rem;
}

.error:empty {
    display: none;
}

:focus-visible {
    outline: 3px solid var(--feu-clair);
    outline-offset: 2px;
}

/* ---------- Admin ---------- */

.admin-login {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    width: 100%;
    max-width: 22rem;
    margin: 0 auto;
}

.admin-login label {
    font-size: 0.85rem;
    color: var(--text-dim);
    margin-bottom: -0.4rem;
}

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.admin-toolbar h2 {
    flex: 1 1 100%;
    font-size: 1.35rem;
}

.admin-card {
    background: var(--surface);
    border: 1px solid rgba(255, 176, 0, 0.2);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    margin-bottom: 0.75rem;
}

.admin-card h3 {
    font-size: 1rem;
    margin-bottom: 0.75rem;
    color: var(--feu-clair);
}

.stat-big {
    font-size: 2.5rem;
    font-weight: 800;
    line-height: 1;
}

.stat-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 0.25rem 1rem;
    padding: 0.45rem 0;
    font-size: 0.95rem;
}

.stat-row .value {
    font-variant-numeric: tabular-nums;
    color: var(--feu-clair);
    font-weight: 600;
}

.stat-bar {
    grid-column: 1 / -1;
    height: 6px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.stat-bar span {
    display: block;
    height: 100%;
    background: var(--feu-orange);
}

.stat-sub {
    color: var(--text-dim);
    font-size: 0.8rem;
    font-weight: 500;
}

.texts {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.texts li {
    background: rgba(255, 255, 255, 0.03);
    border-left: 3px solid var(--feu-orange);
    padding: 0.5rem 0.8rem;
    font-size: 0.95rem;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
}

.texts li .who {
    display: block;
    color: var(--text-dim);
    font-size: 0.8rem;
    margin-top: 0.2rem;
}

/* ---------- Écrans plus grands ---------- */

@media (min-width: 600px) {
    .app {
        padding-top: 2rem;
    }

    .brand.big img {
        height: 6.5rem;
    }

    .brand h1 {
        font-size: 2rem;
    }

    .question-label {
        font-size: 1.6rem;
    }

    .actions {
        position: static;
        background: none;
        padding-top: 2rem;
    }

    .admin-toolbar h2 {
        flex: 1 1 auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    * {
        transition: none !important;
    }
}
