:root {
    --bg: #060d1c;
    --line: #1b3a66;
    --tx: #e6f1ff;
    --dim: #8fa9c9;
    --ac: #3b9cff;
    --ease-out-expo: cubic-bezier(0.16, 1, 0.3, 1);
    --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --transition-smooth: all 0.35s var(--ease-out-expo);
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent
}

[hidden] {
    display: none !important
}

body {
    min-height: 100dvh;
    font: 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--tx);
    background: radial-gradient(800px 420px at 50% -10%, #10305e, transparent 70%), var(--bg)
}

.home-button {
    position: absolute;
    top: 24px;
    left: 24px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--chalk);
    text-decoration: none;
    font-weight: 700;
    font-size: 13px;
    opacity: 0.6;
    transition: var(--transition-smooth);
    z-index: 2000;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.home-button:hover {
    opacity: 1;
    transform: translateX(-5px);
}

.home-button svg {
    transition: transform 0.3s var(--ease-spring);
}

.home-button:hover svg {
    transform: scale(1.1);
}

main {
    max-width: 640px;
    margin: 0 auto;
    padding: 76px 16px 32px;
    display: flex;
    flex-direction: column;
    gap: 22px
}

h1 {
    text-align: center;
    font-size: clamp(36px, 12vw, 56px);
    letter-spacing: 6px
}

h1 span {
    color: var(--ac)
}

.sub {
    text-align: center;
    color: var(--dim);
    margin-top: -14px
}

h2 {
    font-size: 13px;
    letter-spacing: 3px;
    text-transform: uppercase;
    color: var(--dim);
    text-align: center;
    margin-bottom: 10px
}

#maps {
    display: grid;
    grid-template-rows: repeat(2, auto);
    grid-auto-flow: column;
    grid-auto-columns: max(230px, calc(50% - 5px));
    gap: 10px;
    padding: 4px;
    margin: -4px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    scroll-padding: 4px;
    padding-bottom: 14px;
    scrollbar-width: thin;
    scrollbar-color: var(--line) transparent
}

#maps::-webkit-scrollbar {
    height: 6px
}

#maps::-webkit-scrollbar-track {
    margin: 0 8px;
    border-radius: 3px;
    background: rgba(27, 58, 102, .25)
}

#maps::-webkit-scrollbar-thumb {
    border-radius: 3px;
    background: var(--line)
}

#maps::-webkit-scrollbar-thumb:hover {
    background: var(--ac)
}

.card {
    display: flex;
    align-items: center;
    gap: 14px;
    min-height: 60px;
    padding: 12px 16px;
    border: 2px solid var(--line);
    border-radius: 14px;
    background: #0b1a33;
    color: var(--tx);
    font: inherit;
    text-align: left;
    cursor: pointer;
    position: relative;
    scroll-snap-align: start
}

.card em {
    position: absolute;
    top: 8px;
    right: 10px;
    padding: 2px 8px;
    border: 1px solid rgba(255, 216, 107, .35);
    border-radius: 10px;
    background: rgba(255, 216, 107, .12);
    color: #ffd86b;
    font: 700 12px system-ui;
    font-style: normal
}

.card canvas {
    flex: none;
    width: 84px;
    border-radius: 8px;
    background: #060d1c
}

.card i {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-style: normal
}

.card b {
    font-size: 20px;
    letter-spacing: 1px
}

.card span {
    font-size: 13px;
    color: var(--dim)
}

.card[aria-checked=true] {
    border-color: var(--ac);
    box-shadow: 0 0 0 3px rgba(59, 156, 255, .22)
}

.acts {
    display: flex;
    flex-direction: column;
    gap: 10px
}

.btn {
    min-height: 52px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #0b1a33;
    color: var(--tx);
    font: inherit;
    font-size: 17px;
    font-weight: 700;
    cursor: pointer;
    touch-action: manipulation;
    position: relative;
    overflow: hidden;
    transition: transform .2s var(--ease-spring), filter .2s, box-shadow .2s
}

.btn::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, .15);
    opacity: 0;
    pointer-events: none;
    transition: opacity .2s
}

.btn:hover:not(:disabled) {
    transform: translateY(-3px);
    filter: brightness(1.08)
}

.btn:hover:not(:disabled)::after {
    opacity: 1
}

.btn.pri {
    border: 0;
    background: linear-gradient(135deg, #2a8dff, #0a4fb8)
}

.btn:active {
    transform: translateY(0) scale(.97)
}

.note {
    text-align: center;
    font-size: 13px;
    color: var(--dim)
}

#shopOv {
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    background: rgba(11, 13, 18, .92);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px)
}

.modal {
    position: relative;
    width: 100%;
    max-width: 320px;
    padding: 32px 24px;
    text-align: center;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #0a1a33
}

.modal h3 {
    font-size: 22px;
    color: var(--ac);
    margin-bottom: 8px
}

#shopX {
    position: absolute;
    top: 4px;
    right: 4px;
    width: 44px;
    height: 44px;
    border: 0;
    background: none;
    color: var(--dim);
    font-size: 20px;
    cursor: pointer;
    border-radius: 8px
}

#shopX:hover {
    background: rgba(255, 255, 255, .1)
}

:is(button, a):focus-visible {
    outline: 2px solid var(--ac);
    outline-offset: 2px
}

.modal {
    max-height: 90dvh;
    overflow-y: auto;
    max-width: 380px
}

.modal p {
    color: var(--dim);
    margin-bottom: 12px
}

.modal p b {
    color: #ffd86b
}

#ups {
    display: flex;
    flex-direction: column;
    gap: 10px;
    text-align: left
}

.up {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #0b1a33
}

.up>div {
    flex: 1;
    display: flex;
    flex-direction: column
}

.up small {
    color: var(--dim);
    font-size: 12px
}

.up .btn {
    flex: none;
    min-height: 44px;
    padding: 0 14px;
    font-size: 15px
}

.btn:disabled {
    opacity: .4;
    cursor: default
}

.up .btn-boost-ad {
    flex: none;
    min-height: 44px
}

/* Pub récompense (copié de la référence) */
:root {
    --primary: #667eea;
    --secondary: #764ba2;
    --transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1)
}

.toast {
    position: fixed;
    top: max(20px, env(safe-area-inset-top));
    left: 50%;
    z-index: 10000;

    display: flex;
    align-items: center;
    gap: 12px;

    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 13px 20px;

    color: #fff;
    font-family: 'DM Sans', sans-serif;
    font-size: 14px;
    font-weight: 600;
    line-height: 1.4;
    text-align: left;

    background: linear-gradient(135deg,
            rgba(30, 33, 65, 0.94),
            rgba(72, 48, 112, 0.94));
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 18px;

    box-shadow:
        0 12px 36px rgba(20, 15, 50, 0.32),
        0 0 22px rgba(240, 147, 251, 0.14),
        inset 0 1px 0 rgba(255, 255, 255, 0.12);

    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);

    transform: translateX(-50%);
    animation: toastEnter 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

/* Petite icône de mise à jour */
.toast::before {
    content: '↻';
    display: grid;
    place-items: center;
    flex: 0 0 30px;
    width: 30px;
    height: 30px;

    color: #fff;
    font-size: 19px;
    font-weight: 700;

    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    box-shadow: 0 3px 12px rgba(102, 126, 234, 0.35);
}

.toast-success::before {
    content: '✓';
    background: linear-gradient(135deg, #51cf66, #20a85a);
    box-shadow: 0 3px 12px rgba(81, 207, 102, 0.35);
}

/* Animation de l’icône pendant la mise à jour */
.toast:has(+ .toast) {
    /* Aucun style particulier requis : garde-fou si plusieurs toasts apparaissent. */
}

@keyframes toastEnter {
    from {
        opacity: 0;
        transform: translate(-50%, -14px) scale(0.96);
    }

    to {
        opacity: 1;
        transform: translate(-50%, 0) scale(1);
    }
}

@media (max-width: 480px) {
    .toast {
        top: max(12px, env(safe-area-inset-top));
        max-width: calc(100vw - 24px);
        padding: 11px 16px;
        border-radius: 16px;
        font-size: 13px;
    }
}

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

/* Modale vidéo publicité à récompense (Google IMA VAST) */
.mg-ad-overlay {
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(5, 8, 18, 0.92);
    backdrop-filter: blur(10px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.mg-ad-video-dialog {
    width: 100%;
    max-width: 720px;
    background: linear-gradient(160deg, #161c33, #0d1122);
    border: 1px solid rgba(255, 209, 102, 0.35);
    border-radius: 20px;
    padding: 18px;
    color: #fff;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.75);
}

.mg-ad-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.mg-ad-title {
    margin: 0 0 4px;
    font-size: 1.08rem;
}

.mg-ad-desc {
    margin: 0;
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.78);
}

.mg-ad-close-btn {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.16);
    color: #fff;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    cursor: pointer;
    flex-shrink: 0;
}

.mg-ad-close-btn:hover {
    background: rgba(255, 255, 255, 0.18);
}

.mg-ad-player-wrap {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    background: #000;
    border-radius: 12px;
    overflow: hidden;
}

#ad-content-element,
#ad-container {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
}

.mg-ad-loading {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    color: rgba(255, 255, 255, 0.75);
    pointer-events: none;
}

.btn-boost-ad {
    padding: 9px 16px;
    border-radius: 50px;
    border: 1px solid rgba(255, 212, 59, 0.55);
    background: rgba(255, 212, 59, 0.12);
    color: #ffd43b;
    font-weight: 700;
    font-size: 12.5px;
    cursor: pointer;
    white-space: nowrap;
    transition: var(--transition);
}

.btn-boost-ad:hover {
    background: rgba(255, 212, 59, 0.24);
    transform: translateY(-1px);
}

.btn-boost-ad.hidden,
.boost-or.hidden {
    display: none;
}