:root {
    --bg: #0d1117;
    --card: rgba(255, 255, 255, 0.04);
    --border: rgba(255, 255, 255, 0.08);
    --text: #e6edf3;
    --muted: #8b949e;
    --accent: #4ade80;
    --accent-glow: rgba(74, 222, 128, 0.25);
    --red: #f87171;
    --orange: #fb923c;
    --blue: #60a5fa;
    --purple: #c084fc;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    padding: 3rem 1.25rem;
    font-family: "Inter", system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(
            circle at 15% 0%,
            rgba(74, 222, 128, 0.12),
            transparent 45%
        ),
        radial-gradient(
            circle at 90% 20%,
            rgba(96, 165, 250, 0.1),
            transparent 40%
        ),
        var(--bg);
    background-attachment: fixed;

    &:has(.modal[open]:not(.drawer)) {
        overflow: hidden;
    }

    main {
        max-width: 880px;
        margin: 0 auto;
        display: flex;
        flex-direction: column;
        gap: 1.5rem;
    }

    header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 1rem;
        flex-wrap: wrap;

        .title {
            display: flex;
            align-items: center;
            gap: 1rem;
        }

        .logo {
            width: 48px;
            height: 48px;
            border-radius: 12px;
            background: linear-gradient(#5fbf4a 0 35%, #8b5a2b 35% 100%);
            box-shadow:
                0 0 0 1px var(--border),
                0 8px 24px var(--accent-glow);
            image-rendering: pixelated;
        }

        h1 {
            margin: 0;
            font-size: 1.6rem;
            font-weight: 700;
            letter-spacing: -0.02em;
        }

        .subtitle {
            margin: 0.15rem 0 0;
            color: var(--muted);
            font-size: 0.9rem;
        }
    }

    .live {
        display: inline-flex;
        align-items: center;
        gap: 0.6rem;
        padding: 0.5rem 1rem;
        border-radius: 999px;
        background: var(--card);
        border: 1px solid var(--border);
        font-size: 0.9rem;
        font-weight: 500;

        .dot {
            width: 9px;
            height: 9px;
            border-radius: 50%;
            background: var(--accent);
            box-shadow: 0 0 0 0 var(--accent-glow);
            animation: pulse 2s infinite;
        }

        &.offline .dot {
            background: var(--red);
            animation: none;
        }
    }

    .card {
        background: var(--card);
        border: 1px solid var(--border);
        border-radius: 20px;
        padding: 1.5rem;
        backdrop-filter: blur(12px);

        .card-head {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 1.25rem;
        }

        h2 {
            margin: 0;
            font-size: 0.8rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--muted);
        }
    }

    .grid {
        display: flex;
        flex-wrap: wrap;
        gap: 1.5rem;
        width: max(75vw, 100%);
        align-self: center;

        .card {
            flex: 1 1 250px;
            min-width: 0;
        }

        .card.map {
            display: flex;
            padding: 0;
            overflow: hidden;
            min-height: 420px;

            iframe {
                flex: 1;
                align-self: stretch;
                width: 100%;
                border: 0;
            }
        }
    }

    .pill {
        padding: 0.25rem 0.75rem;
        border-radius: 999px;
        background: var(--accent-glow);
        color: var(--accent);
        font-size: 0.85rem;
        font-weight: 600;
    }

    .muted {
        margin: 0;
        color: var(--muted);
    }

    #stats {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 1rem;

        .stat {
            display: flex;
            flex-direction: column;
            gap: 0.25rem;
            padding: 1.25rem;
            border-radius: 14px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--border);

            .icon {
                font-size: 1.5rem;
                margin-bottom: 0.4rem;
            }

            strong {
                font-size: 1.6rem;
                font-weight: 700;
                letter-spacing: -0.02em;
            }

            small {
                color: var(--muted);
                font-size: 0.85rem;
            }
        }
    }

    #offline-wrap {
        margin-top: 1.5rem;

        .group-label {
            margin: 0 0 0.75rem;
            font-size: 0.75rem;
            font-weight: 600;
            text-transform: uppercase;
            letter-spacing: 0.1em;
            color: var(--muted);
        }
    }

    #players,
    #offline {
        display: grid;
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;

        .muted {
            grid-column: 1 / -1;
        }

        .player {
            display: flex;
            flex-direction: column;
            align-items: center;
            gap: 0.75rem;
            padding: 1.1rem 0.75rem;
            border-radius: 14px;
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid var(--border);
            cursor: pointer;
            transition:
                transform 0.15s,
                border-color 0.15s,
                background 0.15s;

            @media (hover: hover) {
                &:hover {
                    transform: translateY(-3px);
                    background: rgba(255, 255, 255, 0.06);
                }
            }

            &.selected {
                border-color: var(--accent);
                background: var(--accent-glow);
            }

            &.offline img {
                filter: grayscale(1);
                opacity: 0.6;
            }

            &.offline span {
                color: var(--muted);
            }

            img {
                width: 64px;
                height: 64px;
                border-radius: 10px;
                image-rendering: pixelated;
                box-shadow: 0 6px 16px rgba(0, 0, 0, 0.4);
            }

            span {
                max-width: 100%;
                font-size: 0.9rem;
                font-weight: 500;
                overflow: hidden;
                text-overflow: ellipsis;
                white-space: nowrap;
            }

            small {
                margin-top: -0.4rem;
                color: var(--muted);
                font-size: 0.75rem;
            }
        }
    }

    #detail {
        display: flex;
        align-items: flex-start;
        gap: 1.5rem;

        &:not(:empty) {
            margin-top: 1.5rem;
            padding-top: 1.5rem;
            border-top: 1px solid var(--border);
        }

        .head {
            width: 96px;
            height: 96px;
            border-radius: 14px;
            image-rendering: pixelated;
            box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
        }

        .info {
            flex: 1;
            display: flex;
            flex-direction: column;
            gap: 0.75rem;

            h3 {
                margin: 0;
                font-size: 1.3rem;
                font-weight: 700;
            }
        }

        .badges {
            display: flex;
            gap: 0.5rem;
            flex-wrap: wrap;
        }

        .badge {
            padding: 0.2rem 0.7rem;
            border-radius: 999px;
            font-size: 0.8rem;
            font-weight: 600;
            text-transform: capitalize;

            &.xp {
                background: rgba(74, 222, 128, 0.15);
                color: var(--accent);
            }

            &.dim {
                background: rgba(192, 132, 252, 0.15);
                color: var(--purple);
            }

            &.time {
                background: rgba(96, 165, 250, 0.15);
                color: var(--blue);
            }

            &.off {
                background: rgba(139, 148, 158, 0.15);
                color: var(--muted);
            }
        }

        .bar {
            .bar-top {
                display: flex;
                justify-content: space-between;
                margin-bottom: 0.3rem;
                font-size: 0.8rem;
                color: var(--muted);
            }

            .track {
                height: 8px;
                border-radius: 999px;
                background: rgba(255, 255, 255, 0.08);
                overflow: hidden;
            }

            .fill {
                height: 100%;
                border-radius: 999px;
                transition: width 0.4s;

                &.health {
                    background: linear-gradient(90deg, #ef4444, var(--red));
                }

                &.food {
                    background: linear-gradient(90deg, #ea580c, var(--orange));
                }
            }
        }

        .pstats {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
            gap: 0.6rem;

            div {
                display: flex;
                flex-direction: column;
                gap: 0.1rem;
                padding: 0.6rem 0.8rem;
                border-radius: 10px;
                background: rgba(255, 255, 255, 0.03);
                border: 1px solid var(--border);
            }

            strong {
                font-size: 1rem;
                font-weight: 700;
            }

            small {
                color: var(--muted);
                font-size: 0.75rem;
            }
        }
    }

    .modal {
        width: 100%;
        height: 100%;
        max-width: 100%;
        max-height: 100%;
        margin: 0;
        padding: 0;
        border: 0;
        overflow-y: auto;
        color: var(--text);
        background:
            radial-gradient(
                circle at 15% 0%,
                rgba(74, 222, 128, 0.12),
                transparent 45%
            ),
            radial-gradient(
                circle at 90% 20%,
                rgba(96, 165, 250, 0.1),
                transparent 40%
            ),
            var(--bg);

        &::backdrop {
            background: rgba(0, 0, 0, 0.6);
        }

        .modal-inner {
            max-width: 880px;
            margin: 0 auto;
            padding: 4rem 1.25rem 3rem;
        }

        .modal-close {
            position: fixed;
            top: 1rem;
            right: 1rem;
            width: 44px;
            height: 44px;
            border-radius: 50%;
            border: 1px solid var(--border);
            background: var(--card);
            color: var(--text);
            font-size: 1.6rem;
            line-height: 1;
            cursor: pointer;
            backdrop-filter: blur(12px);

            &:hover {
                background: rgba(255, 255, 255, 0.1);
            }
        }

        #detail {
            h3 {
                font-size: 1.8rem;
            }

            &:not(:empty) {
                margin-top: 0;
                padding-top: 0;
                border-top: 0;
            }
        }

        /* desktop: zijpaneel rechts, pagina blijft scrollbaar en klikbaar */
        &.drawer {
            position: fixed;
            inset: 1rem 1rem 1rem auto;
            width: 440px;
            height: auto;
            max-width: calc(100vw - 2rem);
            max-height: none;
            overflow: hidden;
            border: 1px solid var(--border);
            border-radius: 20px;
            background: rgba(13, 17, 23, 0.92);
            backdrop-filter: blur(16px);
            box-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
            animation: drawer-in 0.2s ease-out;

            .modal-inner {
                max-width: none;
                height: 100%;
                margin: 0;
                padding: 3.5rem 1.5rem 1.5rem;
                overflow-y: auto;
            }

            .modal-close {
                position: absolute;
                top: 0.9rem;
                right: 0.9rem;
                width: 36px;
                height: 36px;
                font-size: 1.3rem;
            }

            #detail {
                flex-direction: column;
                align-items: stretch;
                gap: 1.25rem;

                h3 {
                    font-size: 1.5rem;
                }
            }
        }
    }

    @media (max-width: 640px) {
        padding: 1.5rem 0.9rem;
        background-attachment: scroll;

        main {
            gap: 1rem;
        }

        header h1 {
            font-size: 1.3rem;
        }

        .card {
            padding: 1.1rem;
            border-radius: 16px;

            .card-head {
                margin-bottom: 1rem;
            }
        }

        .grid {
            gap: 1rem;

            .card.map {
                min-height: 320px;
            }
        }

        #stats {
            grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
            gap: 0.6rem;

            .stat {
                padding: 0.75rem;

                .icon {
                    font-size: 1.2rem;
                }

                strong {
                    font-size: 1.15rem;
                }
            }
        }

        #players,
        #offline {
            grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
            gap: 0.6rem;
        }

        #detail {
            flex-direction: column;
            align-items: stretch;
            gap: 1rem;

            .head {
                width: 72px;
                height: 72px;
            }
        }
    }
}

@keyframes drawer-in {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: none;
    }
}

@keyframes pulse {
    70% {
        box-shadow: 0 0 0 8px transparent;
    }
    100% {
        box-shadow: 0 0 0 0 transparent;
    }
}

.account-trigger,
.small-button,
.danger-button,
.primary,
.console button,
.inline button {
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.6rem 0.85rem;
    font: inherit;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
    background: rgba(255, 255, 255, 0.07);
    cursor: pointer;
}

.account-trigger:hover, .small-button:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: #092112; border-color: var(--accent); }
.danger-button, .danger { color: var(--red); border-color: rgba(248, 113, 113, 0.4); }
.admin-panel { border-color: rgba(96, 165, 250, 0.25); }
.panel-copy { margin: .35rem 0 0; color: var(--muted); font-size: .85rem; }
.role-badge { display: inline-block; color: var(--blue); background: rgba(96, 165, 250, .12); border-radius: 999px; padding: .25rem .65rem; font-size: .76rem; font-weight: 700; }
.admin-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 1.5rem; }
.admin-grid label, .setting strong { display: block; color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; margin-bottom: .65rem; }
.console > div { display: flex; align-items: center; padding: .25rem .3rem .25rem .8rem; border: 1px solid var(--border); border-radius: 10px; background: #090d12; color: var(--accent); }
.console input { flex: 1; border: 0; outline: 0; background: transparent; padding: .65rem; color: var(--text); font: 0.85rem ui-monospace, monospace; }
.console button { border: 0; background: rgba(74, 222, 128, .16); color: var(--accent); }
.console pre { min-height: 80px; white-space: pre-wrap; overflow-wrap: anywhere; padding: .8rem; border-radius: 10px; background: #090d12; color: #b8c4cc; font-size: .78rem; }
.accounts-list { display: grid; gap: .45rem; max-height: 190px; overflow: auto; }
.accounts-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: .65rem; }.accounts-heading label { margin: 0; }.compact-stack { margin: 1rem 0 0; }.compact-stack label { color: var(--muted); font-size: .75rem; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.account-row { display: flex; justify-content: space-between; align-items: center; gap: .5rem; padding: .6rem .7rem; border: 1px solid var(--border); border-radius: 9px; font-size: .8rem; }.account-details { min-width: 0; display: grid; gap: .2rem; }.account-details small { color: var(--muted); }.account-actions { display: flex; align-items: center; gap: .35rem; flex-shrink: 0; }
.account-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.account-row select { background: #161d26; color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: .3rem; }
.account-modal { position: relative; width: min(440px, calc(100vw - 2rem)); padding: 2rem; color: var(--text); background: #10161e; border: 1px solid var(--border); border-radius: 18px; box-shadow: 0 24px 60px #000a; }.account-modal::backdrop { background: rgba(0,0,0,.6); }.account-modal h2 { margin: .2rem 0 .7rem; }.account-modal .modal-close { position: absolute; top: .7rem; right: .7rem; background: transparent; border: 0; color: var(--text); font-size: 1.5rem; cursor: pointer; }.eyebrow { margin: 0; color: var(--accent); font-size: .7rem; font-weight: 700; letter-spacing: .12em; }.stack { display: grid; gap: .7rem; margin: 1.3rem 0; }.stack input, .inline input { width: 100%; padding: .7rem .8rem; background: rgba(255,255,255,.04); color: var(--text); border: 1px solid var(--border); border-radius: 9px; font: inherit; }.link-button { padding: 0; color: var(--blue); border: 0; background: transparent; cursor: pointer; font: inherit; }.setting { display: flex; align-items: center; gap: .75rem; padding: 1rem 0; margin-top: 1.25rem; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }.setting strong { margin: 0; }.setting span { flex: 1; font-size: .85rem; color: var(--muted); }.inline { display: flex; gap: .5rem; }.inline input { min-width: 0; }.admin-player-info { display: grid; gap: .35rem; padding: .75rem; border: 1px solid var(--border); border-radius: 9px; background: rgba(96,165,250,.06); }.admin-player-info small { overflow-wrap: anywhere; }.player-actions { display: flex; gap: .5rem; }
.twofactor-qr { display: block; width: 220px; height: 220px; margin: 1.25rem auto; padding: .6rem; border-radius: 12px; background: #fff; }
.admin-player-info { gap: .85rem; padding: 1rem; border-color: rgba(96,165,250,.2); background: rgba(96,165,250,.05); }.admin-info-title { margin: 0; color: var(--blue); font-size: .72rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }.admin-overview { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }.admin-info-card { display: grid; gap: .4rem; min-width: 0; padding: .7rem; border-radius: 9px; background: rgba(13,17,23,.55); border: 1px solid var(--border); }.admin-info-card small, .inventory-summary > small { color: var(--muted); font-size: .72rem; }.admin-info-card strong { font-size: .82rem; }.admin-info-card > span { color: var(--purple); font-size: .74rem; }.coordinates { display: flex; flex-wrap: wrap; gap: .25rem .5rem; }.coordinates span { color: var(--text); font-size: .78rem; font-weight: 700; white-space: nowrap; }.inventory-summary { display: grid; gap: .55rem; }.inventory-list { display: flex; flex-wrap: wrap; gap: .4rem; }.inventory-item, .inventory-more, .inventory-empty { display: inline-flex; align-items: center; gap: .3rem; max-width: 100%; padding: .35rem .5rem; border-radius: 6px; color: #c8d7e7; background: rgba(255,255,255,.06); font-size: .73rem; }.inventory-icon { width: 18px; height: 18px; flex: 0 0 auto; object-fit: contain; image-rendering: pixelated; }.inventory-item b { color: var(--accent); }.inventory-more, .inventory-empty { color: var(--muted); }.player-actions { padding-top: .1rem; }
@media (max-width: 430px) { .admin-overview { grid-template-columns: 1fr; } }
@media (max-width: 640px) { .admin-grid { grid-template-columns: 1fr; }.account-trigger { margin-left: auto; }.inline { flex-direction: column; } }
