/* ==========================================================================
   Daily Race — pages de l'application (menu, inscription, parties).
   Reprend l'identité du jeu (public/game/style.css) : piste de nuit, accent
   citron, titres en Barlow Condensed.
   ========================================================================== */

:root {
    --bg: #090e20;
    --ink: #f5f7ff;
    --ink-soft: #a5b1c9;
    --ink-mute: #8594b0;
    --accent: #d9ff43;
    --accent-ink: #172018;
    --accent-shadow: #8dad29;
    --panel-a: #18243d;
    --panel-b: #111a30;
    --field: #0d172c;
    --line: #ffffff17;
    --line-strong: #ffffff26;
    --danger: #ff7a6b;
    --green: #3ee07a;
    --display: 'Barlow Condensed', Impact, sans-serif;

    font-family: 'DM Sans', system-ui, sans-serif;
    color: var(--ink);
    background: var(--bg);
    font-size: 15px;
    color-scheme: dark;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(ellipse at 75% -10%, #23365e 0, transparent 45%),
        radial-gradient(ellipse at 0% 65%, #182646 0, transparent 40%),
        var(--bg);
}

a {
    color: var(--accent);
}

button {
    font: inherit;
    cursor: pointer;
}

:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    border: 0;
}

/* ---------- Mise en page : une carte centrée ---------- */

.stage {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 32px 16px;
}

.stage--top {
    place-items: start center;
}

.card {
    position: relative;
    width: 100%;
    max-width: 420px;
    padding: 34px 30px 28px;
    background:
        repeating-conic-gradient(from 7deg at 50% 60px, #d9ff4306 0 12deg, transparent 12deg 26deg),
        linear-gradient(145deg, var(--panel-a), var(--panel-b) 70%);
    border: 1px solid #d9ff4344;
    border-radius: 26px;
    box-shadow: 0 0 0 8px #d9ff4308, 0 30px 80px #03071299;
    animation: card-in .45s cubic-bezier(.34, 1.56, .64, 1);
}

.card--wide {
    max-width: 760px;
}

@keyframes card-in {
    from { transform: translateY(16px) scale(.97); opacity: 0; }
}

/* ---------- Marque ---------- */

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-bottom: 26px;
}

.brand--row {
    flex-direction: row;
    gap: 14px;
    text-align: left;
    margin-bottom: 0;
}

.brandmark {
    display: grid;
    place-items: center;
    width: 60px;
    height: 60px;
    border-radius: 18px;
    background: var(--accent);
    color: #111c21;
    font-size: 32px;
    text-decoration: none;
    box-shadow: 0 0 34px #d9ff4340;
    margin-bottom: 14px;
}

.brand--row .brandmark {
    width: 44px;
    height: 44px;
    border-radius: 13px;
    font-size: 24px;
    margin: 0;
}

.brand__title {
    margin: 0;
    font: 900 52px/.9 var(--display);
    letter-spacing: .02em;
}

.brand--row .brand__title {
    font-size: 30px;
}

.brand__title span {
    color: var(--accent);
}

.brand__subtitle {
    margin: 10px 0 0;
    color: var(--ink-soft);
    font-size: 13px;
    line-height: 1.5;
}

.eyebrow {
    display: block;
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .19em;
    text-transform: uppercase;
}

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

.form {
    display: grid;
    gap: 14px;
}

.field {
    display: grid;
    gap: 6px;
}

.field label,
.form label {
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .04em;
}

.field input,
.form input[type="text"],
.form input[type="email"],
.form input[type="password"] {
    width: 100%;
    padding: 12px 14px;
    border: 1px solid var(--line-strong);
    border-radius: 12px;
    background: var(--field);
    color: var(--ink);
    font: inherit;
    font-size: 14px;
    transition: border-color .2s, box-shadow .2s;
}

.field input:focus,
.form input:focus {
    outline: none;
    border-color: #d9ff4399;
    box-shadow: 0 0 0 3px #d9ff4322;
}

.form ul {
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    color: var(--danger);
    font-size: 12px;
    font-weight: 700;
}

.form .help,
.form-help {
    color: var(--ink-mute);
    font-size: 11px;
}

.alert {
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 700;
    line-height: 1.4;
}

.alert--error {
    background: #ff7a6b1f;
    border: 1px solid #ff7a6b66;
    color: #ffd0ca;
}

.alert--success {
    background: #3ee07a1a;
    border: 1px solid #3ee07a66;
    color: #c7f7d8;
}

.import-demo {
    padding: 12px 14px;
    border-radius: 12px;
    background: #d9ff430d;
    border: 1px solid #d9ff4344;
}

.import-demo[hidden] {
    display: none;
}

.check {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    cursor: pointer;
}

.check input {
    accent-color: var(--accent);
    width: 18px;
    height: 18px;
    margin: 2px 0 0;
    flex: none;
}

.form .check strong {
    display: block;
    color: var(--ink);
    font-size: 13px;
    letter-spacing: 0;
}

.form .check small {
    display: block;
    margin-top: 3px;
    color: var(--ink-mute);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0;
}

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

.btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    width: 100%;
    padding: 14px 18px;
    border: 0;
    border-radius: 12px;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
    text-decoration: none;
    transition: transform .18s, box-shadow .18s, background .2s, border-color .2s;
}

.btn--primary {
    background: var(--accent);
    color: var(--accent-ink);
    box-shadow: 0 6px 0 var(--accent-shadow), 0 14px 28px #d9ff4322;
    margin-bottom: 6px;
}

.btn--primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 0 var(--accent-shadow), 0 16px 32px #d9ff4340;
}

.btn--primary:active {
    transform: translateY(4px);
    box-shadow: 0 2px 0 var(--accent-shadow);
}

.btn--ghost {
    background: #ffffff0c;
    color: var(--ink);
    border: 1px solid var(--line-strong);
}

.btn--ghost:hover {
    background: #d9ff4318;
    border-color: #d9ff4366;
}

.btn--small {
    width: auto;
    padding: 9px 14px;
    font-size: 11px;
}

.stack {
    display: grid;
    gap: 10px;
}

.stack .btn--primary {
    margin-bottom: 4px;
}

.divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 18px 0;
    color: var(--ink-mute);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .14em;
    text-transform: uppercase;
}

.divider::before,
.divider::after {
    content: "";
    flex: 1;
    height: 1px;
    background: var(--line);
}

.card__footer {
    margin: 22px 0 0;
    text-align: center;
    color: var(--ink-mute);
    font-size: 13px;
}

.card__footer a {
    font-weight: 800;
    text-decoration: none;
}

.card__footer a:hover {
    text-decoration: underline;
}

.hint {
    margin: 8px 0 0;
    text-align: center;
    color: var(--ink-mute);
    font-size: 11px;
}

.whoami {
    margin: 0 0 18px;
    padding: 12px 14px;
    border-radius: 12px;
    background: var(--field);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    font-size: 13px;
    text-align: center;
}

.whoami strong {
    color: var(--ink);
}

/* ---------- Page « Mes parties » ---------- */

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 14px;
    padding-bottom: 22px;
    margin-bottom: 24px;
    border-bottom: 1px solid #ffffff1b;
}

.topbar__actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.topbar__user {
    color: var(--ink-mute);
    font-size: 12px;
    font-weight: 700;
}

.section + .section {
    margin-top: 28px;
}

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

.section__head h2 {
    margin: 0;
    font: 800 24px var(--display);
    letter-spacing: .04em;
    text-transform: uppercase;
}

.section__head h2 {
    margin-right: auto;
}

.section__action {
    margin: 0 0 0 6px;
    box-shadow: 0 4px 0 var(--accent-shadow);
}

.section__action:hover {
    box-shadow: 0 6px 0 var(--accent-shadow);
}

.section__head span {
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .1em;
}

.empty p {
    margin: 0;
}

.card > .alert {
    margin: 0 0 18px;
}

.form input::placeholder {
    color: #6f7f9c;
}

.session-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.session {
    display: grid;
    gap: 6px;
    padding: 14px 16px;
    border-radius: 14px;
    background: var(--field);
    border: 1px solid var(--line);
    box-shadow: inset 3px 0 var(--accent);
}

a.session {
    color: inherit;
    text-decoration: none;
    transition: transform .18s, border-color .2s, background .2s;
}

a.session:hover {
    transform: translateY(-2px);
    border-color: #d9ff4366;
    background: #111e36;
}

.session__play {
    margin-top: 4px;
    color: var(--accent);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.session--shared {
    box-shadow: inset 3px 0 #80d7ff;
}

.session__name {
    margin: 0;
    font: 900 21px var(--display);
    text-transform: uppercase;
    overflow-wrap: anywhere;
}

.session__meta {
    color: var(--ink-mute);
    font-size: 12px;
}

.empty {
    display: grid;
    justify-items: center;
    gap: 12px;
    padding: 22px;
    border: 1px dashed var(--line-strong);
    border-radius: 14px;
    color: var(--ink-mute);
    font-size: 13px;
    text-align: center;
}

/* ---------- Partage d'une partie ---------- */

.session-item {
    position: relative;
}

.session-item .session {
    height: 100%;
}

.session__share {
    position: absolute;
    right: 10px;
    bottom: 10px;
    padding: 5px 10px;
    border: 1px solid var(--line-strong);
    border-radius: 999px;
    background: #ffffff0c;
    color: var(--ink-soft);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .08em;
    text-transform: uppercase;
    transition: background .2s, border-color .2s, color .2s;
}

.session__share:hover {
    background: #d9ff4318;
    border-color: #d9ff4366;
    color: var(--ink);
}

.modal {
    width: min(460px, calc(100% - 32px));
    padding: 28px 26px 22px;
    border: 1px solid #d9ff4344;
    border-radius: 22px;
    background: linear-gradient(145deg, var(--panel-a), var(--panel-b) 70%);
    color: var(--ink);
    box-shadow: 0 0 0 8px #d9ff4308, 0 30px 80px #03071299;
}

.modal::backdrop {
    background: #03071299;
    backdrop-filter: blur(3px);
}

.modal__head {
    display: grid;
    gap: 6px;
}

.modal__title {
    margin: 0;
    font: 900 26px/1.05 var(--display);
    text-transform: uppercase;
}

.modal__actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-top: 6px;
}

.share-list {
    display: grid;
    gap: 10px;
}

.form .share-list {
    color: inherit;
    font-size: inherit;
    font-weight: inherit;
}

.share-row {
    display: grid;
    gap: 4px;
}

.share-row__line {
    display: flex;
    align-items: center;
    gap: 8px;
}

.form .share-row input {
    flex: 1;
    min-width: 0;
}

.share-row[data-state="ok"] input {
    border-color: #3ee07a88;
}

.share-row[data-state="error"] input {
    border-color: #ff7a6b88;
}

.share-row__status {
    width: 18px;
    font-size: 18px;
    font-weight: 900;
    text-align: center;
}

.share-row[data-state="ok"] .share-row__status,
.share-row[data-state="ok"] .share-row__reason {
    color: var(--green);
}

.share-row[data-state="error"] .share-row__status,
.share-row[data-state="error"] .share-row__reason {
    color: var(--danger);
}

.share-row__remove {
    width: 30px;
    height: 30px;
    flex: none;
    border: 1px solid var(--line-strong);
    border-radius: 50%;
    background: transparent;
    color: var(--ink-mute);
    font-size: 16px;
    line-height: 1;
}

.share-row__remove:hover {
    color: var(--ink);
    border-color: var(--ink-mute);
}

.share-row__reason {
    font-size: 12px;
    font-weight: 700;
}

.share-row__reason:empty {
    display: none;
}

.share-add {
    justify-self: start;
}

/* ---------- Page 404 « Hors piste » ---------- */

.lost {
    text-align: center;
}

.lost__code {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 18px;
    color: var(--ink);
    font: 900 112px/1 var(--display);
    text-shadow: 0 8px 30px #03071299;
}

/* Le « 0 » est une piste ovale : le coureur en fait le tour, puis dérape et
   sort de la piste avant de revenir. */
.lost__track {
    position: relative;
    width: 70px;
    height: 94px;
    border: 9px solid var(--accent);
    border-radius: 50%;
    box-shadow: 0 0 34px #d9ff4340, inset 0 0 0 2px #172018;
    outline: 2px dashed #d9ff4355;
    outline-offset: 5px;
}

.lost__runner {
    position: absolute;
    inset: -9px;
    animation: lost-lap 3.2s cubic-bezier(.5, 0, .5, 1) infinite;
}

.lost__runner::before {
    content: '';
    position: absolute;
    top: -6px;
    left: 50%;
    width: 16px;
    height: 16px;
    margin-left: -8px;
    border-radius: 50%;
    background: #ff7a6b;
    box-shadow: 0 0 0 3px var(--bg), 0 0 18px #ff7a6b;
    animation: lost-skid 3.2s ease-in infinite;
}

@keyframes lost-lap {
    0% { transform: rotate(0); }
    70%, 100% { transform: rotate(720deg); }
}

@keyframes lost-skid {
    0%, 68% { transform: translate(0, 0); opacity: 1; }
    /* Deux tours complets : le coureur est de nouveau en haut, lancé vers la
       droite. Il file tout droit dans la tangente, hors de la piste. */
    88% { transform: translate(44px, -12px); opacity: 1; }
    100% { transform: translate(54px, -14px); opacity: 0; }
}

.lost .brand {
    margin-bottom: 22px;
}

@media (max-width: 480px) {
    .lost__code {
        font-size: 88px;
    }

    .lost__track {
        width: 56px;
        height: 76px;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 28px 20px 24px;
    }

    .brand__title {
        font-size: 44px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
