/* "Puncture" screen: no network, or the game server out of reach (see js/offline.js) */
.lgb-offline {
    --lgb-offline-yellow: #ffd23f;
    --lgb-offline-ink: #1d1240;
    display: none;
    position: fixed;
    inset: 0;
    /* Under the "get out of the saddle" screen: a phone lying sideways gets back up first */
    z-index: 9999;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 20px;
    padding: max(24px, env(safe-area-inset-top)) max(20px, env(safe-area-inset-right)) max(24px, env(safe-area-inset-bottom)) max(20px, env(safe-area-inset-left));
    background:
        radial-gradient(circle at 18% 22%, rgba(255, 255, 255, .18), transparent 45%),
        repeating-linear-gradient(115deg, rgba(255, 255, 255, .045) 0 22px, transparent 22px 44px),
        #6b42fe;
    color: #fff;
    text-align: center;
    overflow-y: auto;
    overscroll-behavior: contain;
    user-select: none;
}

.lgb-offline-on .lgb-offline {
    display: flex;
}

.lgb-offline__art {
    flex: none;
    width: min(180px, 30vh);
    height: auto;
    overflow: visible;
}

.lgb-offline__art * {
    transform-box: view-box;
}

.lgb-offline__shadow {
    fill: rgba(16, 6, 60, .28);
}

.lgb-offline__wheel {
    transform-origin: 80px 122px;
    animation: lgb-offline-wobble 2.8s ease-in-out infinite;
}

.lgb-offline__tire {
    fill: none;
    stroke: var(--lgb-offline-ink);
    stroke-width: 10;
    stroke-linejoin: round;
}

.lgb-offline__rim {
    fill: none;
    stroke: #fff;
    stroke-width: 4;
}

.lgb-offline__spokes path {
    fill: none;
    stroke: rgba(255, 255, 255, .8);
    stroke-width: 2.5;
    stroke-linecap: round;
}

.lgb-offline__hub {
    fill: #fff;
}

.lgb-offline__patch {
    fill: var(--lgb-offline-yellow);
    stroke: var(--lgb-offline-ink);
    stroke-width: 1.5;
    stroke-linejoin: round;
}

.lgb-offline__puffs path {
    fill: none;
    stroke: #fff;
    stroke-width: 3;
    stroke-linecap: round;
    opacity: 0;
    animation: lgb-offline-puff 1.8s ease-out infinite;
}

.lgb-offline__puffs path:nth-child(2) {
    animation-delay: .6s;
}

.lgb-offline__puffs path:nth-child(3) {
    animation-delay: 1.2s;
}

.lgb-offline__signal rect {
    fill: rgba(255, 255, 255, .35);
}

.lgb-offline__cross {
    fill: none;
    stroke: #ff4d5e;
    stroke-width: 4;
    stroke-linecap: round;
    animation: lgb-offline-blink 1.4s ease-in-out infinite;
}

/* The network is there, the server isn't: full bars, no cross */
.lgb-offline[data-cause="server"] .lgb-offline__signal rect {
    fill: #fff;
}

.lgb-offline[data-cause="server"] .lgb-offline__cross {
    display: none;
}

.lgb-offline__text {
    max-width: 380px;
}

.lgb-offline__kicker {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0 0 12px;
    padding: 4px 12px 4px 10px;
    border-radius: 999px;
    background: rgba(16, 6, 60, .3);
    font-family: 'LGB-Equip', sans-serif;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.lgb-offline__live {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #ff4d5e;
    animation: lgb-offline-blink 1.2s ease-in-out infinite;
}

.lgb-offline__title {
    margin: 0 0 10px;
    font-family: 'LGB-Garaje', sans-serif;
    font-size: clamp(26px, 7.5vw, 34px);
    font-weight: 900;
    line-height: 1.05;
}

.lgb-offline__title em {
    font-style: normal;
    color: var(--lgb-offline-yellow);
}

.lgb-offline__body,
.lgb-offline__foot {
    margin: 0;
    font-family: 'LGB-Equip', sans-serif;
    line-height: 1.35;
}

.lgb-offline__body {
    font-size: 16px;
}

.lgb-offline__retry {
    min-height: 44px;
    margin-top: 22px;
    padding: 0 28px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #6b42fe;
    font-family: 'LGB-Equip', sans-serif;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 0 rgba(16, 6, 60, .3);
}

.lgb-offline__retry:active:not(:disabled) {
    transform: translateY(2px);
    box-shadow: 0 2px 0 rgba(16, 6, 60, .3);
}

.lgb-offline__retry:disabled {
    cursor: default;
    opacity: .75;
}

.lgb-offline__retry:focus-visible {
    outline: 3px solid var(--lgb-offline-yellow);
    outline-offset: 3px;
}

.lgb-offline__foot {
    margin-top: 12px;
    font-size: 13px;
    opacity: .78;
}

/* Computer: a bit more room for the drawing */
@media (min-width: 768px) and (min-height: 600px) {
    .lgb-offline {
        gap: 28px;
    }

    .lgb-offline__art {
        width: 220px;
    }

    .lgb-offline__title {
        font-size: 40px;
    }

    .lgb-offline__body {
        font-size: 17px;
    }
}

/* Short screen (keyboard open, small window): just the essentials */
@media (max-height: 420px) {
    .lgb-offline__art,
    .lgb-offline__foot {
        display: none;
    }
}

/* The flat tyre rocks on the ground, the air keeps leaking */
@keyframes lgb-offline-wobble {
    0%, 100% { transform: rotate(-3deg); }
    50% { transform: rotate(3deg); }
}

@keyframes lgb-offline-puff {
    0% { opacity: 0; transform: translate(-4px, 0); }
    20% { opacity: .9; }
    100% { opacity: 0; transform: translate(10px, -4px); }
}

@keyframes lgb-offline-blink {
    0%, 100% { opacity: 1; }
    50% { opacity: .35; }
}

@media (prefers-reduced-motion: reduce) {
    .lgb-offline * {
        animation: none !important;
    }

    .lgb-offline__puffs path {
        opacity: .7;
    }
}
