:root {
    --bg: #F5F6F2;
    --ink: #1B1D1E;
    --muted: #6B7280;
    --go: #1B8A5A;
    --stop: #D62828;
    --wait: #E8A93D;
    --paper: #FFFFFF;
    --state: var(--muted);
}

* {
    box-sizing: border-box;
}

html, body {
    height: 100%;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: 'Work Sans', sans-serif;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    overflow-x: hidden;
    padding: clamp(16px, 5vw, 24px);
    padding-bottom: max(clamp(16px, 5vw, 24px), env(safe-area-inset-bottom));
    background-image: repeating-linear-gradient(
            90deg,
            rgba(27, 29, 30, 0.035) 0 2px,
            transparent 2px 42px
    );
}

/* Écrans courts (mobile en paysage, petites fenêtres) : on évite de
   couper le haut du contenu quand tout ne tient pas en hauteur. */
@media (max-height: 680px) {
    body {
        align-items: flex-start;
    }
}

.track-line {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: 10px;
    background: repeating-linear-gradient(
            90deg,
            var(--stop) 0 34px,
            transparent 34px 68px
    );
    opacity: 0.85;
}

main {
    width: 100%;
    max-width: 460px;
    margin: 0 auto;
}

.kicker {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.72rem;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--muted);
    text-align: center;
    margin: 0 0 18px;
}

/* Le dossard : élément signature de la page */
.bib {
    position: relative;
    background: var(--paper);
    border: 3px solid var(--state);
    border-radius: 14px;
    padding: clamp(32px, 8vw, 46px) clamp(18px, 5vw, 28px) 30px;
    text-align: center;
    box-shadow: 0 18px 40px -22px rgba(27, 29, 30, 0.35);
    transition: border-color 0.4s ease;
}

.bib::after {
    content: "";
    position: absolute;
    left: 14px;
    right: 14px;
    bottom: -1px;
    height: 0;
    border-bottom: 2px dashed rgba(27, 29, 30, 0.25);
}

.grommet {
    position: absolute;
    top: 14px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--bg);
    border: 2px solid var(--state);
    transition: border-color 0.4s ease;
}

.grommet::before {
    content: "";
    position: absolute;
    inset: 6px;
    border-radius: 50%;
    background: var(--muted);
    opacity: 0.5;
}

.grommet.left {
    left: 14px;
}

.grommet.right {
    right: 14px;
}

.bib-number {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.68rem;
    color: var(--muted);
    letter-spacing: 0.05em;
    margin-bottom: 22px;
}

.answer {
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(3.2rem, 16vw, 5.5rem);
    line-height: 0.95;
    letter-spacing: 0.02em;
    color: var(--state);
    margin: 0 0 14px;
    transition: color 0.4s ease;
}

.phrase {
    font-size: 1.05rem;
    line-height: 1.5;
    margin: 0 0 6px;
    max-width: 34ch;
    margin-left: auto;
    margin-right: auto;
    min-height: 3.1em;
}

.countdown {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.8rem;
    color: var(--muted);
    margin-top: 14px;
    padding-top: 14px;
    border-top: 1px solid rgba(27, 29, 30, 0.1);
}

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

.countdown[hidden] {
    display: none;
}

.meteo-toggle {
    margin-top: 20px;
    padding-top: 18px;
    border-top: 1px solid rgba(27, 29, 30, 0.1);
}

.locate-btn {
    font-family: 'Work Sans', sans-serif;
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--paper);
    background: var(--ink);
    border: none;
    border-radius: 8px;
    padding: 12px 20px;
    min-height: 44px;
    width: 100%;
    max-width: 280px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.locate-btn:hover {
    background: var(--stop);
}

.locate-btn:disabled {
    opacity: 0.55;
    cursor: progress;
}

.status {
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.74rem;
    color: var(--muted);
    margin-top: 12px;
    min-height: 1.1em;
}

.specs {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid rgba(27, 29, 30, 0.1);
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.78rem;
    color: var(--muted);
    text-align: left;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px 12px;
}

.specs[hidden] {
    display: none;
}

@media (max-width: 360px) {
    .specs {
        grid-template-columns: 1fr;
    }
    .specs dd {
        text-align: left;
    }
}

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

.specs dd {
    margin: 0;
    color: var(--ink);
    font-weight: 600;
    text-align: right;
}

footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    margin-top: 22px;
    font-size: 0.72rem;
    color: var(--muted);
    line-height: 1.6;
}

.logo {
    display: block;
    width: 40px;
    height: 40px;
    margin: 0 auto 12px;
}

@media (prefers-reduced-motion: reduce) {
    .bib, .grommet, .answer {
        transition: none;
    }
}

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