/* =================== RESPONSIVE DESIGN =================== */

/* HOME SCREEN STYLES */
.hero-wrap {
    max-width: 720px;
    margin: 0 auto;
    padding: 40px 24px 24px;
}

.hero-logo-img {
    max-width: 420px;
    width: 100%;
    height: auto;
    display: block;
    margin: 0 auto;
    filter: drop-shadow(0 8px 22px rgba(0,0,0,.45));
}

.logo-sub {
    color: #cfd3d8;
    text-align: center;
    margin-top: 10px;
    font-style: italic;
    font-size: clamp(16px, 3.5vw, 22px);
}

/* Player input */
.player-input {
    background: #1a1a22;
    color: #fff;
    border-radius: 18px;
    padding: 18px 20px;
    height: auto;
    font-size: 18px;
    padding-right: calc(var(--pill-h) + 16px);
}

.player-input::placeholder {
    color: rgba(255,255,255,.65) !important;
}

.input-shell {
    position: relative;
    border-radius: 24px;
}

.input-shell .add-btn {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: var(--pill-h);
    height: var(--pill-h);
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: var(--accent);
    color: #0b0b0c;
    font-weight: 900;
    font-size: clamp(18px, calc(var(--pill-h) * 0.36), 28px);
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Player list */
.player-list {
    display: grid;
    gap: 14px;
    margin-top: 16px;
    max-height: var(--player-list-max, calc(var(--pill-h) * 5 + var(--pill-gap) * 4));
    overflow-y: auto;
    padding-right: 4px;
    transition: max-height .15s ease;
}

.player-list::-webkit-scrollbar {
    width: 4px;
}

.player-list::-webkit-scrollbar-thumb {
    background: rgba(255,255,255,.25);
    border-radius: 6px;
}

.player-list::-webkit-scrollbar-track {
    background: rgba(255,255,255,.08);
    border-radius: 8px;
}

.player-pill {
    min-height: var(--pill-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(180deg, #f1f2f4, #dadddf);
    color: #0b0b0c;
    border-radius: 22px;
    padding: 10px 10px 10px 15px;
    box-shadow: 0 6px 20px rgba(0,0,0,.25), inset 0 0 0 1px rgba(255,255,255,.45);
    gap: 10px;
    margin: 0 0 var(--pill-gap) 0;
}

.player-pill:last-child {
    margin-bottom: 0;
}

.player-pill .remove {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    background: #0f1216;
    color: #66ea49;
    font-size: 22px;
    font-weight: 900;
}

/* CTA Play button */
.cta-play {
    width: 100%;
    border: none;
    border-radius: 28px;
    padding: 20px 28px;
    font-size: 28px;
    font-weight: 900;
    color: #061006;
    letter-spacing: .3px;
    background: linear-gradient(180deg, #7CFF51 0%, #39E11A 100%);
    box-shadow: 0 14px 40px rgba(102,234,73,.35), inset 0 -6px 12px rgba(0,0,0,.25);
}

.cta-play:disabled {
    opacity: .5;
    filter: grayscale(.2);
    cursor: not-allowed;
}

.home-bottom-pad {
    padding: 24px;
    padding-bottom: max(24px, env(safe-area-inset-bottom));
}

/* MODES SCREEN STYLES */
.mode-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 6px 16px;
    border-bottom: 2px solid #5b5b62;
}

.mode-header h2 {
    color: #fff;
    font-weight: 500;
    font-size: clamp(20px, 5.8vw, 34px);
    letter-spacing: .3px;
    margin: 0;
}

.mode-gear, .mode-back {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .18);
    color: #111116;
    cursor: pointer;
    backdrop-filter: blur(6px);
}

.mode-back svg, .mode-gear svg {
    width: 30px;
    height: 30px;
    opacity: .9;
}

.mode-tile {
    position: relative;
    overflow: hidden;
    color: #fff;
    cursor: pointer;
    transition: transform .15s ease;
}

.mode-tile:hover {
    transform: translateY(-2px);
}

.mode-tile .bg {
    position: absolute;
    inset: 0;
    background-size: cover;
    background-position: center;
    filter: blur(2px);
    transform: scale(1.06);
}

.mode-tile .scrim {
    position: absolute;
    inset: 0;
    background: radial-gradient(120% 100% at 20% 0%, rgba(0,0,0,.3) 0%, rgba(0,0,0,.75) 100%);
}

.mode-tile .inner {
    position: relative;
    display: flex;
    align-items: center;
    gap: 16px;
}

.mode-tile .icon-wrap {
    flex: 0 0 64px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: center;
    filter: drop-shadow(0 10px 22px rgba(0,0,0,.45));
}

.mode-tile .icon-wrap img {
    width: 56px;
    height: 56px;
    object-fit: contain;
}

.mode-tile .txt h3 {
    margin: 0 0 6px 0;
    font-weight: 900;
    font-size: clamp(20px, 4.6vw, 28px);
}

.mode-tile .txt p {
    margin: 0;
    opacity: .9;
    font-size: clamp(13px, 3.6vw, 16px);
    line-height: 1.35;
}

.mode-tile.selected {
    border-color: rgba(255,255,255,.85);
}

.mode-tile.locked {
    filter: grayscale(.1) opacity(.85);
}

.mode-chip {
    position: absolute;
    right: 10px;
    top: 10px;
    font-weight: 800;
    font-size: 13px;
    padding: 6px 10px;
    border-radius: 999px;
    background: rgba(0,0,0,.5);
    border: 1px solid rgba(255,255,255,.25);
    backdrop-filter: blur(6px);
}

.mode-ring {
    position: absolute;
    inset: 0;
    pointer-events: none;
    border-radius: 24px;
    box-shadow: 0 0 0 2px var(--mode-border, rgba(255,255,255,.2)) inset, 0 8px 30px rgba(0,0,0,.35);
}

/* MOBILE RESPONSIVE */
@media (max-width: 576px) {
    body { font-size: 16px; }
    
    .hero-wrap { padding: 24px 16px 12px; }
    .hero-logo-img { max-width: 260px; }
    .logo-sub { font-size: clamp(13px, 3.4vw, 15px); margin-top: 6px; }
    
    .input-shell { margin: 0 20px 18px !important; }
    .player-input {
        padding: 12px 14px;
        font-size: 16px;
        border-radius: 14px;
    }
    .input-shell .add-btn {
        width: 36px;
        height: 36px;
        font-size: 20px;
        right: 8px;
    }
    
    :root { --pill-h: 60px; --pill-gap: 5px; }
    .player-list { gap: 5px; padding-right: 2px; }
    .player-pill {
        padding: 8px 10px 8px 12px;
        border-radius: 18px;
        gap: 8px;
    }
    .player-pill .remove {
        width: 36px;
        height: 36px;
        font-size: 20px;
    }
    
    .home-bottom-pad { padding: 16px; padding-bottom: max(16px, env(safe-area-inset-bottom)); }
    .cta-play {
        padding: 14px 20px;
        font-size: 20px;
        border-radius: 22px;
        box-shadow: 0 10px 28px rgba(102,234,73,.28), inset 0 -5px 10px rgba(0,0,0,.22);
    }
    
    .home-bottom-pad .btn { font-size: 12px; padding: 6px 10px; }
    .hero-wrap + .flex-fill { display: none; }
    
    .theme-home .flex-grow-1 > .flex-fill {
        flex: 0 0 75px !important;
    }
    .hero-wrap { padding: 16px 12px 8px; }
    
    .btn { padding: 0.5rem 1rem; }
}

/* TABLET RESPONSIVE */
@media (min-width: 577px) and (max-width: 768px) {
    body { font-size: 17px; }
    .hero-logo-img { max-width: 320px; }
    .logo-sub { font-size: clamp(14px, 2.6vw, 18px); }
    
    :root { --pill-h: 38px; --pill-gap: 8px; }
    .player-input { padding: 14px 16px; font-size: 17px; }
    .input-shell .add-btn { width: 40px; height: 40px; font-size: 21px; }
    .cta-play { font-size: 22px; padding: 16px 22px; }
    
    .theme-home .flex-grow-1 > .flex-fill {
        flex: 0 0 48px !important;
    }
    .hero-wrap { padding: 20px 16px 10px; }
}

@media (min-width: 577px) and (max-width: 992px) {
    .theme-home .flex-grow-1 > .flex-fill {
        flex: 0 0 48px !important;
    }
    .hero-wrap { padding: 20px 16px 10px; }
    
    .theme-home .flex-grow-1 > .flex-fill:last-of-type {
        flex: 0 0 40px !important;
    }
}

/* DESKTOP RESPONSIVE */
@media (min-width: 993px) {
    .theme-home .flex-grow-1 > .flex-fill {
        flex: 0 0 64px !important;
    }
    
    .theme-home .flex-grow-1 > .flex-fill:last-of-type {
        flex: 0 0 56px !important;
    }
}

/* INPUT PLACEHOLDERS */
input::placeholder {
    color: rgba(255,255,255,0.7) !important;
}

@supports (padding: env(safe-area-inset-top)) {
    @media (display-mode: standalone) {
        /* par défaut */
        .safe-top-spacer { height: 0; }

        /* prend automatiquement la safe-area si dispo (iOS standalone) */
        .safe-top-spacer {
            height: env(safe-area-inset-top);
            height: constant(safe-area-inset-top); /* vieux iOS fallback */
        }

    }
}
