html {
    scrollbar-gutter: stable;
    overflow-y: scroll;
    overscroll-behavior-y: contain;
    touch-action: pan-x pan-y;
}

body {
    overscroll-behavior-x: none;
    background: radial-gradient(circle at 50% 30%, #2c4a68 0%, #182f47 45%, #0b1620 100%);
    background-attachment: fixed;
    display: flex;
    flex-direction: column;
    justify-content: safe center;
    align-items: center;
    min-height: 100vh;
    min-height: 100dvh;
    min-height: calc(var(--real-vh, 1vh) * 100);
    padding: clamp(8px, 2vh, 20px);
    margin: 0;
    font-family: 'Poppins', sans-serif;
    color: #dce6f0;
    box-sizing: border-box;
    overscroll-behavior-y: contain;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

input, textarea, select {
    -webkit-user-select: text;
    user-select: text;
    -webkit-touch-callout: default;
}

.site-theme-noel {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='60' height='60'%3E%3Cg stroke='%23bfe3f0' stroke-width='1' stroke-linecap='round' opacity='0.16'%3E%3Cline x1='30' y1='10' x2='30' y2='50'/%3E%3Cline x1='10' y1='30' x2='50' y2='30'/%3E%3Cline x1='16' y1='16' x2='44' y2='44'/%3E%3Cline x1='44' y1='16' x2='16' y2='44'/%3E%3C/g%3E%3C/svg%3E"),
        radial-gradient(circle at 50% 25%, #3f6f8f 0%, #1c3a52 50%, #08131e 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-ete {
    background:
        radial-gradient(circle at 50% 15%, rgba(255, 210, 140, 0.25) 0%, transparent 40%),
        radial-gradient(circle at 50% 25%, #8a5a3a 0%, #522f1c 50%, #150c06 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-printemps {
    background:
        radial-gradient(circle at 50% 25%, #4f7a4a 0%, #26402a 50%, #0a150e 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-automne {
    background:
        url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='70' height='70'%3E%3Cpath fill='%23c9793f' opacity='0.14' d='M35 12c-10 6-14 18-8 30 4 6 12 8 20 6-2-10-4-18-12-36z'/%3E%3C/svg%3E"),
        radial-gradient(circle at 50% 25%, #7a5236 0%, #3f2a1a 50%, #100a06 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-halloween {
    background:
        radial-gradient(circle at 30% 20%, rgba(255, 140, 26, 0.18) 0%, transparent 35%),
        radial-gradient(circle at 50% 25%, #4a2a6b 0%, #24123d 50%, #0a0512 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-valentin {
    background:
        radial-gradient(circle at 50% 20%, rgba(255, 107, 138, 0.2) 0%, transparent 40%),
        radial-gradient(circle at 50% 25%, #6b2f42 0%, #3a1622 50%, #100609 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-paques {
    background:
        radial-gradient(circle at 30% 20%, rgba(245, 184, 208, 0.2) 0%, transparent 35%),
        radial-gradient(circle at 70% 30%, rgba(240, 214, 102, 0.15) 0%, transparent 35%),
        radial-gradient(circle at 50% 25%, #4a5c40 0%, #263021 50%, #0a0d08 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-carnaval {
    background:
        radial-gradient(circle at 25% 20%, rgba(224, 64, 251, 0.18) 0%, transparent 35%),
        radial-gradient(circle at 75% 30%, rgba(255, 210, 61, 0.15) 0%, transparent 35%),
        radial-gradient(circle at 50% 25%, #3a1f4a 0%, #1e1027 50%, #080308 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-nuit {
    background:
        radial-gradient(2px 2px at 20% 15%, #ffd66b, transparent),
        radial-gradient(2px 2px at 60% 25%, #fff, transparent),
        radial-gradient(1.5px 1.5px at 80% 10%, #ffd66b, transparent),
        radial-gradient(1.5px 1.5px at 35% 40%, #fff, transparent),
        radial-gradient(2px 2px at 70% 55%, #ffd66b, transparent),
        radial-gradient(circle at 50% 25%, #23234a 0%, #14142c 50%, #06060f 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-eclipse {
    background:
        radial-gradient(circle at 50% 30%, rgba(240, 201, 94, 0.35) 0%, rgba(240, 201, 94, 0.08) 22%, transparent 30%),
        radial-gradient(circle at 50% 30%, #050505 0%, #050505 20%, #0f0f0f 45%, #000000 100%) !important;
    background-attachment: fixed !important;
}

.site-theme-noel button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-noel .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #a8dcec, #4a7f9e) !important;
    color: #08131e !important;
}
.site-theme-ete button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-ete .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #ffcf8c, #d97a3f) !important;
    color: #2a1608 !important;
}
.site-theme-printemps button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-printemps .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #c8ecac, #7ab85c) !important;
    color: #0f1a0c !important;
}
.site-theme-automne button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-automne .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #e6b482, #a85f30) !important;
    color: #1a0f06 !important;
}
.site-theme-halloween button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-halloween .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #ff8c1a, #6b3fa0) !important;
    color: #0a0512 !important;
}
.site-theme-valentin button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-valentin .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #ffb3c6, #ff6b8a) !important;
    color: #2a0a12 !important;
}
.site-theme-paques button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-paques .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #f5b8d0, #f0d666) !important;
    color: #1a1408 !important;
}
.site-theme-carnaval button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-carnaval .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #e040fb, #ffd23d) !important;
    color: #1e0a24 !important;
}
.site-theme-nuit button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-nuit .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #ffd66b, #a8792f) !important;
    color: #14142c !important;
}
.site-theme-eclipse button:not(.google-btn):not(.dock-btn):not(.close-btn),
.site-theme-eclipse .btn-small:not([style*="transparent"]) {
    background: linear-gradient(135deg, #f0c95e, #a8792f) !important;
    color: #050505 !important;
}

.site-theme-noel .google-btn { border-color: #4a7f9e !important; color: #a8dcec !important; }
.site-theme-noel .google-btn:hover { background: #4a7f9e !important; color: #08131e !important; }
.site-theme-ete .google-btn { border-color: #d97a3f !important; color: #ffcf8c !important; }
.site-theme-ete .google-btn:hover { background: #d97a3f !important; color: #2a1608 !important; }
.site-theme-printemps .google-btn { border-color: #7ab85c !important; color: #c8ecac !important; }
.site-theme-printemps .google-btn:hover { background: #7ab85c !important; color: #0f1a0c !important; }
.site-theme-automne .google-btn { border-color: #a85f30 !important; color: #e6b482 !important; }
.site-theme-automne .google-btn:hover { background: #a85f30 !important; color: #1a0f06 !important; }
.site-theme-halloween .google-btn { border-color: #6b3fa0 !important; color: #ff8c1a !important; }
.site-theme-halloween .google-btn:hover { background: #6b3fa0 !important; color: #0a0512 !important; }
.site-theme-valentin .google-btn { border-color: #ff6b8a !important; color: #ffb3c6 !important; }
.site-theme-valentin .google-btn:hover { background: #ff6b8a !important; color: #2a0a12 !important; }
.site-theme-paques .google-btn { border-color: #f0d666 !important; color: #f5b8d0 !important; }
.site-theme-paques .google-btn:hover { background: #f0d666 !important; color: #1a1408 !important; }
.site-theme-carnaval .google-btn { border-color: #ffd23d !important; color: #e040fb !important; }
.site-theme-carnaval .google-btn:hover { background: #ffd23d !important; color: #1e0a24 !important; }
.site-theme-nuit .google-btn { border-color: #ffd66b !important; color: #ffd66b !important; }
.site-theme-nuit .google-btn:hover { background: #ffd66b !important; color: #14142c !important; }
.site-theme-eclipse .google-btn { border-color: #f0c95e !important; color: #f0c95e !important; }
.site-theme-eclipse .google-btn:hover { background: #f0c95e !important; color: #050505 !important; }

img {
    pointer-events: none;
    -webkit-user-drag: none;
    -webkit-touch-callout: none;
    user-select: none;
}

/* Conteneur "incruste" dans le fond bleu : pas de carte visible, juste un centrage */
.pixel-card {
    background: transparent;
    padding: clamp(15px, 4vh, 40px) clamp(10px, 5vw, 30px);
    width: min(320px, 90vw);
    max-height: 85vh;
    max-height: 85dvh;
    max-height: calc(var(--real-vh, 1vh) * 85);
    overflow-y: auto;
    box-sizing: border-box;
    text-align: center;
    border: none;
    box-shadow: none;
    margin: 0;
}

h2 {
    font-family: 'Cinzel', serif;
    color: #d4af6a;
    font-size: 1.3rem;
    font-weight: 700;
    margin-bottom: clamp(14px, 3vh, 34px);
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

input {
    width: 100%;
    padding: clamp(10px, 1.8vh, 15px) 4px;
    margin: clamp(7px, 1.4vh, 12px) 0;
    border: none;
    border-bottom: 2px solid rgba(212, 175, 106, 0.45);
    background: transparent;
    color: #f0e6cf;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    box-sizing: border-box;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input::placeholder { color: #7f95ac; }

input:focus {
    border-bottom-color: #d4af6a;
    box-shadow: 0 4px 10px -6px #d4af6a;
}

button {
    width: 100%;
    background: linear-gradient(135deg, #e3c07f, #b8863b);
    color: #16283f;
    border: none;
    border-radius: 999px;
    padding: clamp(10px, 1.8vh, 15px);
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    margin-top: clamp(10px, 1.8vh, 16px);
    box-shadow: 0 6px 18px -6px rgba(212, 175, 106, 0.6);
    transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}

button:hover { filter: brightness(1.08); transform: translateY(-1px); }
button:active { transform: translateY(0); filter: brightness(0.95); }

.google-btn {
    background: transparent;
    color: #d4af6a;
    border: 2px solid rgba(212, 175, 106, 0.55);
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    box-shadow: none;
    width: 100%;
    display: block;
    box-sizing: border-box;
    text-decoration: none;
    padding: clamp(10px, 1.8vh, 15px);
    margin-top: clamp(10px, 1.8vh, 16px);
    text-align: center;
    font-family: 'Poppins', sans-serif;
    cursor: pointer;
}
button:hover, .google-btn:hover { color: #16283f; }
.google-btn:hover { background: #d4af6a; }
button:active, .google-btn:active { filter: brightness(0.92); }

.register-link {
    display: block;
    width: 100%;
    background: none;
    border: none;
    box-shadow: none;
    margin: 0;
    margin-top: clamp(10px, 1.8vh, 16px);
    padding: 4px 0;
    color: #a9bdd1;
    font-size: 13px;
    font-family: 'Poppins', sans-serif;
    text-decoration: none;
    text-align: center;
    cursor: pointer;
}
.register-link:hover { color: #d4af6a; }

.btn-primary {
    display: block;
    box-sizing: border-box;
    background: linear-gradient(135deg, #e3c07f, #b8863b);
    color: #16283f;
    border: none;
    border-radius: 999px;
    padding: 15px;
    font-family: 'Poppins', sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    text-align: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 10px;
    cursor: pointer;
    box-shadow: 0 6px 18px -6px rgba(212, 175, 106, 0.6);
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-primary:active { filter: brightness(0.92); }

.status-badge {
    display: inline-block;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    padding: 5px 12px;
    border-radius: 999px;
    border: none;
}

.badge-open { background: rgba(95, 158, 111, 0.2); color: #7fce93; }
.badge-closed { background: rgba(192, 82, 74, 0.2); color: #e08d85; }

.section-divider {
    border: none;
    border-top: 1px solid rgba(212, 175, 106, 0.25);
    margin: 20px 0 14px 0;
}

.subsection-title {
    color: #d4af6a;
    font-family: 'Cinzel', serif;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    text-align: left;
    margin: 0 0 10px 0;
}

.section-title {
    color: #d4af6a;
    font-family: 'Cinzel', serif;
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2.5px;
    margin: 10px 0 15px 0;
    text-align: center;
}

.avatar {
    width: 100px;
    height: 100px;
    object-fit: cover;
    border: 3px solid #d4af6a;
    border-radius: 50%;
    background: #1b3350;
    margin: 0 auto;
    display: block;
}

.avatar-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2rem;
    color: #d4af6a;
    font-family: 'Cinzel', serif;
}

input[type="file"] {
    background: rgba(255, 255, 255, 0.04);
    border: 2px dashed rgba(212, 175, 106, 0.45);
    border-radius: 12px;
    color: #a9bdd1;
    padding: 12px;
    width: 100%;
    box-sizing: border-box;
    font-size: 12px;
}

.switch-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 20px;
    justify-content: center;
    width: 90%;
    max-width: 900px;
    margin-bottom: 50px;
}

.switch-tile {
    position: relative;
    width: 160px;
    height: 160px;
    padding: 0;
    margin: 0;
    font-family: 'Poppins', sans-serif;
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(212, 175, 106, 0.3);
    border-radius: 20px;
    box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.6);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    color: #dce6f0;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.15s, border-color 0.15s, background 0.15s;
}

.switch-grid.admin-grid-2col {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    max-width: 360px;
}

.admin-grid-2col .switch-tile { width: 100%; height: 140px; }

.switch-tile:hover { transform: translateY(-3px); border-color: rgba(212, 175, 106, 0.7); background: rgba(255, 255, 255, 0.08); }
.switch-tile:active { transform: translateY(0); }

.tile-avatar { width: 60px; height: 60px; margin: 0; }
.avatar-placeholder.tile-avatar { font-size: 1.5rem; }

.switch-tile .tile-icon { font-size: 2.2rem; line-height: 1; color: #d4af6a; }
.switch-tile .tile-label { font-family: 'Cinzel', serif; font-size: 11px; text-transform: uppercase; text-align: center; padding: 0 8px; letter-spacing: 1px; }

.tile-server-name {
    font-size: 0.85rem;
    font-weight: 600;
    text-transform: uppercase;
    text-align: center;
    padding: 0 8px;
    line-height: 1.3;
    word-break: break-word;
    max-width: 100%;
}
.tile-server-count { font-size: 10px; text-transform: uppercase; text-align: center; opacity: 0.7; }

.tile-status-dot {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    border: none;
    box-shadow: 0 0 6px currentColor;
}

.dot-open { background: #5f9e6f; color: #5f9e6f; }
.dot-closed { background: #c0524a; color: #c0524a; }
.dot-full { background: #c99a3b; color: #c99a3b; }

.admin-panel {
    background: rgba(255, 255, 255, 0.04);
    backdrop-filter: blur(6px);
    border: 1px solid rgba(212, 175, 106, 0.3);
    border-radius: 20px;
    padding: 22px;
    width: 90%;
    max-width: 800px;
    margin-bottom: 16px;
    text-align: left;
}

.admin-place-row summary {
    list-style: none;
}

.admin-place-row summary::-webkit-details-marker {
    display: none;
}

.admin-place-row summary::after {
    content: '';
    width: 8px;
    height: 8px;
    border-right: 2px solid #d4af6a;
    border-bottom: 2px solid #d4af6a;
    transform: rotate(-45deg);
    flex: 0 0 auto;
    transition: transform 0.2s ease;
}

.admin-place-row[open] summary::after {
    transform: rotate(45deg);
}

.admin-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 15px;
    padding: 15px 0;
    border-bottom: 1px solid rgba(212, 175, 106, 0.2);
    font-size: 12px;
    color: #dce6f0;
    line-height: 1.6;
}

.admin-row:last-of-type { border-bottom: none; }

.admin-row-main { flex: 1 1 200px; }
.admin-row-castles { display: flex; flex-wrap: wrap; gap: 8px; flex: 2 1 250px; }

.inline-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }

.admin-server-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; width: 100%; }
.admin-server-form input[type="text"] { width: auto; flex: 1 1 120px; margin: 0; padding: 8px 4px; font-size: 12px; }
.admin-server-form select {
    width: auto;
    padding: 8px 12px;
    font-size: 12px;
    font-family: 'Poppins', sans-serif;
    background: rgba(255, 255, 255, 0.05);
    color: #dce6f0;
    border: 1px solid rgba(212, 175, 106, 0.4);
    border-radius: 8px;
}

.close-btn {
    position: fixed;
    top: 16px;
    right: 16px;
    width: 40px;
    height: 40px;
    padding: 0;
    margin: 0;
    border-radius: 50%;
    background: #1b3350;
    border: 2px solid #d4af6a;
    color: #d4af6a;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-family: inherit;
    text-decoration: none;
    z-index: 1500;
    box-shadow: 0 6px 16px -6px rgba(0, 0, 0, 0.6);
    cursor: pointer;
}

.btn-small {
    width: auto;
    padding: 7px 14px;
    font-size: 11px;
    margin-top: 0;
}

/* Style Popups */
.overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    height: 100dvh;
    height: calc(var(--real-vh, 1vh) * 100);
    background: rgba(5, 12, 20, 0.72);
    backdrop-filter: blur(3px);
    justify-content: center;
    align-items: center;
    z-index: 20000;
    padding: 5vmin;
    box-sizing: border-box;
}

.popup {
    background: rgba(24, 42, 63, 0.92);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(212, 175, 106, 0.45);
    border-radius: 20px;
    padding: 34px 30px;
    width: 100%;
    max-width: 480px;
    max-height: 100%;
    overflow-y: auto;
    overflow-x: auto;
    text-align: center;
    box-shadow: 0 20px 60px -15px rgba(0, 0, 0, 0.7);
    box-sizing: border-box;
    position: relative;
}

.popup h2 { font-size: 1.05rem; margin-bottom: 20px; }
.popup p { color: #c3d2e0; font-size: 13px; margin-bottom: 25px; line-height: 1.8; text-align: left; }

.popup-close-x {
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    background: rgba(212, 175, 106, 0.15);
    color: #d4af6a;
    border: 1px solid rgba(212, 175, 106, 0.4);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
}

.popup-close-x:hover { background: rgba(212, 175, 106, 0.3); }
