/* ==========================================================================
   Star Ac' Challenge — thème « plateau de prime » (mobile d'abord)
   ========================================================================== */

:root {
    --bg: #0b0620;
    --bg-2: #160a36;
    --panel: rgba(255, 255, 255, 0.06);
    --panel-strong: rgba(255, 255, 255, 0.1);
    --border: rgba(255, 255, 255, 0.12);
    --text: #f6f2ff;
    --muted: #b3a6d9;
    --gold: #ffd35c;
    --gold-deep: #f2a01f;
    --pink: #ff3fa4;
    --violet: #8b5cf6;
    --cyan: #3fe0ff;
    --success: #3ddc97;
    --danger: #ff5c7a;
    --warning: #ffb547;
    --radius: 18px;
    --radius-sm: 12px;
    --tabbar-h: 68px;
    --font-display: 'Bebas Neue', 'Impact', 'Arial Narrow', sans-serif;
    --font-body: 'Outfit', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --gold-gradient: linear-gradient(135deg, #fff1b8 0%, var(--gold) 35%, var(--gold-deep) 100%);
}

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

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -webkit-tap-highlight-color: transparent;
}

body.with-tabbar {
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px);
}

/* Projecteurs + paillettes en fond (pseudo-élément fixe : fiable sur mobile) */
.stage-lights {
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(60% 45% at 0% 0%, rgba(255, 63, 164, 0.35), transparent 70%),
        radial-gradient(55% 40% at 100% 5%, rgba(139, 92, 246, 0.45), transparent 70%),
        radial-gradient(70% 50% at 50% 110%, rgba(63, 224, 255, 0.18), transparent 70%),
        linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 60%);
}

.stage-lights::after {
    content: '';
    position: absolute;
    inset: 0;
    opacity: 0.55;
    background-image:
        radial-gradient(1.5px 1.5px at 12% 18%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 78% 12%, #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 62% 38%, var(--gold) 50%, transparent 51%),
        radial-gradient(1px 1px at 30% 62%, #fff 50%, transparent 51%),
        radial-gradient(1.5px 1.5px at 88% 70%, #fff 50%, transparent 51%),
        radial-gradient(1px 1px at 8% 84%, var(--gold) 50%, transparent 51%),
        radial-gradient(1px 1px at 50% 92%, #fff 50%, transparent 51%);
    animation: twinkle 6s ease-in-out infinite alternate;
}

@keyframes twinkle {
    from { opacity: 0.25; }
    to { opacity: 0.7; }
}

@media (prefers-reduced-motion: reduce) {
    .stage-lights::after { animation: none; }
}

a {
    color: var(--gold);
    text-decoration: none;
}

h1, h2, h3, h4 {
    margin: 0 0 0.4em;
    line-height: 1.1;
}

h2 {
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 2.3rem;
    letter-spacing: 0.02em;
}

h3 {
    font-size: 1.1rem;
    font-weight: 700;
}

p {
    margin: 0 0 0.8em;
}

.muted {
    color: var(--muted);
}

small {
    color: var(--muted);
}

/* ---------- Barre du haut ---------- */

.topbar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: rgba(11, 6, 32, 0.72);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-bottom: 1px solid var(--border);
}

.brand {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--text);
}

.brand-star {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: var(--gold-gradient);
    color: #3a1d00;
    font-size: 1.25rem;
    box-shadow: 0 0 18px rgba(255, 211, 92, 0.55);
}

.brand-text {
    font-family: var(--font-display);
    font-size: 1.6rem;
    letter-spacing: 0.04em;
    line-height: 1;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.brand-text small {
    margin-left: 6px;
    font-size: 0.95rem;
    letter-spacing: 0.12em;
    color: var(--text);
    -webkit-text-fill-color: var(--text);
    opacity: 0.85;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
}

.avatar {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--pink), var(--violet));
    font-weight: 700;
}

.icon-btn {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    color: var(--muted);
    background: var(--panel);
    border: 1px solid var(--border);
}

.icon-btn svg,
.tabbar svg {
    width: 20px;
    height: 20px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* ---------- Sous-menu admin ---------- */

.subnav {
    display: flex;
    gap: 8px;
    padding: 12px 16px 0;
    overflow-x: auto;
    scrollbar-width: none;
}

.subnav::-webkit-scrollbar {
    display: none;
}

.subnav a {
    flex: none;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: var(--panel);
    color: var(--muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.subnav a.active {
    background: var(--gold-gradient);
    color: #2b1600;
    border-color: transparent;
}

/* ---------- Barre d'onglets du bas ---------- */

.tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    justify-content: space-around;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 6px 6px env(safe-area-inset-bottom);
    background: rgba(14, 7, 38, 0.9);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-top: 1px solid var(--border);
}

.tabbar a {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    border-radius: 14px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 600;
}

.tabbar svg {
    width: 24px;
    height: 24px;
}

.tabbar a.active {
    color: var(--gold);
}

.tabbar a.active svg {
    filter: drop-shadow(0 0 8px rgba(255, 211, 92, 0.7));
}

/* ---------- Mise en page ---------- */

.page {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 18px 16px 8px;
}

.stack > * + * {
    margin-top: 16px;
}

.section-title {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 26px 0 10px;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
}

.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: linear-gradient(90deg, var(--border), transparent);
}

/* ---------- Cartes ---------- */

.card {
    position: relative;
    padding: 18px;
    border-radius: var(--radius);
    background: var(--panel);
    border: 1px solid var(--border);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.card + .card {
    margin-top: 14px;
}

.card-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 12px;
}

.card-head h3 {
    margin: 0;
}

/* Carte « prime » mise en avant */
.hero {
    overflow: hidden;
    padding: 22px 20px;
    border: 1px solid rgba(255, 211, 92, 0.45);
    background:
        radial-gradient(120% 90% at 100% 0%, rgba(255, 63, 164, 0.35), transparent 60%),
        radial-gradient(90% 80% at 0% 100%, rgba(139, 92, 246, 0.45), transparent 60%),
        rgba(255, 255, 255, 0.05);
    box-shadow: 0 10px 40px rgba(139, 92, 246, 0.25);
}

.hero::before {
    /* faisceau de projecteur */
    content: '';
    position: absolute;
    top: -60%;
    right: -10%;
    width: 60%;
    height: 220%;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.18), transparent 70%);
    transform: rotate(25deg);
    pointer-events: none;
}

.hero.is-idle {
    border-color: var(--border);
    box-shadow: none;
}

.hero-kicker {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.live-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--pink);
    box-shadow: 0 0 0 0 rgba(255, 63, 164, 0.7);
    animation: pulse 1.6s infinite;
}

@keyframes pulse {
    70% { box-shadow: 0 0 0 10px rgba(255, 63, 164, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 63, 164, 0); }
}

.hero-title {
    margin: 12px 0 4px;
    font-family: var(--font-display);
    font-size: 3.4rem;
    font-weight: 400;
    line-height: 0.95;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.hero p {
    position: relative;
}

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

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 48px;
    padding: 0 20px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: var(--panel-strong);
    color: var(--text);
    font: 600 1rem var(--font-body);
    cursor: pointer;
    transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:active {
    transform: scale(0.97);
}

.btn.primary {
    border-color: transparent;
    background: var(--gold-gradient);
    color: #2b1600;
    box-shadow: 0 6px 22px rgba(242, 160, 31, 0.35);
}

.btn.pink {
    border-color: transparent;
    background: linear-gradient(135deg, var(--pink), var(--violet));
    color: #fff;
}

.btn.danger {
    border-color: rgba(255, 92, 122, 0.5);
    background: rgba(255, 92, 122, 0.12);
    color: var(--danger);
}

.btn.small {
    min-height: 36px;
    padding: 0 14px;
    font-size: 0.85rem;
}

.btn.block {
    width: 100%;
}

.btn-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 16px;
}

.btn-row .btn {
    flex: 1;
}

.inline-form {
    display: inline;
    margin: 0;
}

/* ---------- Formulaires ---------- */

.field {
    margin-bottom: 16px;
}

.field > label,
.label {
    display: block;
    margin-bottom: 6px;
    font-weight: 600;
    font-size: 0.92rem;
}

input[type="text"],
input[type="password"],
input[type="datetime-local"],
select {
    width: 100%;
    min-height: 50px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(0, 0, 0, 0.25);
    color: var(--text);
    font: 500 16px var(--font-body); /* 16px : évite le zoom auto sur iPhone */
    color-scheme: dark;
    appearance: none;
    -webkit-appearance: none;
}

select {
    padding-right: 40px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23b3a6d9' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 18px;
}

select option {
    background: var(--bg-2);
    color: var(--text);
}

input:focus,
select:focus {
    outline: none;
    border-color: var(--gold);
    box-shadow: 0 0 0 3px rgba(255, 211, 92, 0.25);
}

.switch {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    padding: 14px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(0, 0, 0, 0.2);
    font-weight: 600;
    cursor: pointer;
}

.switch input {
    position: relative;
    flex: none;
    width: 52px;
    height: 30px;
    margin: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.18);
    appearance: none;
    -webkit-appearance: none;
    cursor: pointer;
    transition: background 0.2s;
}

.switch input::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s;
}

.switch input:checked {
    background: var(--success);
}

.switch input:checked::after {
    transform: translateX(22px);
}

/* ---------- Puces de candidats (radio / case à cocher stylées) ---------- */

.chips {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
    gap: 10px;
}

.chip {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 12px 6px 10px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.04);
    text-align: center;
    font-weight: 600;
    font-size: 0.92rem;
    cursor: pointer;
    transition: transform 0.12s, border-color 0.12s, background 0.12s;
}

.chip input {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.chip .initial {
    display: grid;
    place-items: center;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(139, 92, 246, 0.6), rgba(255, 63, 164, 0.6));
    font-family: var(--font-display);
    font-size: 1.5rem;
    line-height: 1;
}

.chip:active {
    transform: scale(0.96);
}

.chip:has(input:checked) {
    border-color: var(--gold);
    background: rgba(255, 211, 92, 0.14);
    box-shadow: 0 0 0 2px rgba(255, 211, 92, 0.35), 0 6px 20px rgba(255, 211, 92, 0.18);
}

.chip:has(input:checked) .initial {
    background: var(--gold-gradient);
    color: #2b1600;
}

.chip:has(input:checked)::after {
    content: '✓';
    position: absolute;
    top: 6px;
    right: 8px;
    color: var(--gold);
    font-weight: 700;
}

.chip:has(input:focus-visible) {
    outline: 2px solid var(--cyan);
    outline-offset: 2px;
}

.chip.is-out {
    opacity: 0.45;
}

.chip.chip-none .initial {
    background: rgba(255, 255, 255, 0.1);
}

/* Puces d'affichage (non cliquables) */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.05);
    font-size: 0.9rem;
    font-weight: 500;
}

.tag.is-out {
    opacity: 0.45;
    text-decoration: line-through;
}

.tag.is-final {
    border-color: rgba(255, 211, 92, 0.6);
    color: var(--gold);
}

.tag.is-winner {
    border-color: transparent;
    background: var(--gold-gradient);
    color: #2b1600;
    font-weight: 700;
}

.tag.is-nominated {
    border-color: rgba(255, 63, 164, 0.6);
    color: #ffc2e2;
}

.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.1);
    color: var(--muted);
}

.badge.ok {
    background: rgba(61, 220, 151, 0.16);
    color: var(--success);
}

.badge.gold {
    background: rgba(255, 211, 92, 0.16);
    color: var(--gold);
}

.badge.off {
    background: rgba(255, 92, 122, 0.14);
    color: var(--danger);
}

/* ---------- Classement ---------- */

.ranking {
    list-style: none;
    margin: 0;
    padding: 0;
}

.ranking li {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 4px;
    border-bottom: 1px solid var(--border);
}

.ranking li:last-child {
    border-bottom: 0;
}

.rank {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.08);
    font-family: var(--font-display);
    font-size: 1.4rem;
}

.ranking li:first-child .rank {
    background: var(--gold-gradient);
    color: #2b1600;
    box-shadow: 0 0 18px rgba(255, 211, 92, 0.5);
}

.ranking .name {
    flex: 1;
    font-weight: 600;
    font-size: 1.05rem;
}

.ranking .pts {
    font-family: var(--font-display);
    font-size: 2rem;
    line-height: 1;
    color: var(--gold);
}

.ranking .pts small {
    margin-left: 2px;
    font-family: var(--font-body);
    font-size: 0.75rem;
}

/* ---------- Lignes de score / listes ---------- */

.rows {
    list-style: none;
    margin: 0;
    padding: 0;
}

.rows > li {
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.rows > li:last-child {
    border-bottom: 0;
}

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

.row-main strong {
    font-size: 1rem;
}

.points {
    font-family: var(--font-display);
    font-size: 1.6rem;
    line-height: 1;
    color: var(--gold);
}

.details {
    margin-top: 6px;
    font-size: 0.82rem;
    color: var(--muted);
}

.details span {
    display: block;
}

.kv {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 8px 14px;
    margin: 0;
}

.kv dt {
    color: var(--muted);
    font-size: 0.9rem;
}

.kv dd {
    margin: 0;
    font-weight: 600;
    text-align: right;
}

.numbered {
    margin: 10px 0 0;
    padding: 0;
    list-style: none;
    counter-reset: none;
}

.numbered li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 0;
}

.numbered .num {
    display: grid;
    place-items: center;
    width: 26px;
    height: 26px;
    flex: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--muted);
}

.empty {
    padding: 18px;
    text-align: center;
    color: var(--muted);
}

/* ---------- Liste numérotée (saison) ---------- */

.slot {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.slot label {
    flex: none;
    width: 74px;
    font-family: var(--font-display);
    font-size: 1.25rem;
    letter-spacing: 0.04em;
    color: var(--gold);
}

/* ---------- Résultats (timeline) ---------- */

.prime-card .prime-num {
    font-family: var(--font-display);
    font-size: 1.9rem;
    line-height: 1;
}

.out-name {
    display: flex;
    align-items: center;
    gap: 10px;
    margin: 10px 0;
    font-size: 1.15rem;
    font-weight: 700;
}

.out-name::before {
    content: '✖';
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(255, 92, 122, 0.18);
    color: var(--danger);
    font-size: 0.85rem;
}

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

.admin-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-list li {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.admin-list li:last-child {
    border-bottom: 0;
}

.admin-list .who {
    flex: 1;
    min-width: 0;
}

.admin-list .who strong {
    display: block;
}

.admin-list .actions {
    display: flex;
    gap: 6px;
}

.steps {
    margin: 0;
    padding-left: 20px;
    color: var(--muted);
    font-size: 0.9rem;
}

.steps li + li {
    margin-top: 4px;
}

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

.toasts {
    margin-bottom: 14px;
}

.toast {
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--panel-strong);
    font-weight: 600;
    animation: slide-in 0.3s ease;
}

.toast + .toast {
    margin-top: 8px;
}

.toast-success {
    border-color: rgba(61, 220, 151, 0.5);
    background: rgba(61, 220, 151, 0.14);
    color: #b7f7da;
}

.toast-danger {
    border-color: rgba(255, 92, 122, 0.5);
    background: rgba(255, 92, 122, 0.14);
    color: #ffc6d1;
}

.toast-warning {
    border-color: rgba(255, 181, 71, 0.5);
    background: rgba(255, 181, 71, 0.14);
    color: #ffe0b0;
}

@keyframes slide-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

/* ---------- Connexion ---------- */

.login {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: calc(100dvh - 160px);
    text-align: center;
}

.login-logo {
    margin: 0 auto 6px;
    width: 92px;
    height: 92px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: var(--gold-gradient);
    color: #3a1d00;
    font-size: 3rem;
    box-shadow: 0 0 50px rgba(255, 211, 92, 0.55);
}

.login h1 {
    margin: 14px 0 0;
    font-family: var(--font-display);
    font-weight: 400;
    font-size: 3.6rem;
    line-height: 0.9;
    background: var(--gold-gradient);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.login .tagline {
    margin-bottom: 26px;
    color: var(--muted);
    letter-spacing: 0.24em;
    text-transform: uppercase;
    font-size: 0.85rem;
}

.login form {
    text-align: left;
}

/* Écrans plus larges : un peu plus d'air */
@media (min-width: 700px) {
    .page {
        padding-top: 28px;
    }

    .hero-title {
        font-size: 4.2rem;
    }
}
