:root {
    --pw-bg: #071018;
    --pw-bg-deep: #03080d;
    --pw-panel: rgba(5, 17, 25, 0.92);
    --pw-panel-light: rgba(11, 29, 40, 0.92);
    --pw-line: rgba(113, 211, 255, 0.22);
    --pw-line-strong: rgba(120, 224, 255, 0.62);
    --pw-cyan: #79ddff;
    --pw-cyan-soft: #bcefff;
    --pw-green: #8fda50;
    --pw-text: #f4f8fb;
    --pw-muted: #8fa7b6;
    --pw-max: 1500px;

    /* -----------------------------------------------------
       DASHBOARD POSITION CONFIG
       ----------------------------------------------------- */

    --pw-status-left: 12.7%;
    --pw-status-top: 21.5%;
    --pw-status-width: 22.3%;
    --pw-status-height: 9.0%;

    --pw-players-left: 11.2%;
    --pw-players-top: 39.0%;
    --pw-players-width: 22.3%;
    --pw-players-height: 9.0%;

    --pw-joining-left: 11.2%;
    --pw-joining-top: 56.5%;
    --pw-joining-width: 22.3%;
    --pw-joining-height: 9.0%;

    --pw-join-left: 8.8%;
    --pw-join-top: 80.7%;
    --pw-join-width: 21.5%;
    --pw-join-height: 8.7%;

    --pw-avatar-left: 49.6%;
    --pw-avatar-top: 42.5%;
    --pw-avatar-width: 11.6%;

    --pw-top-name-left: 42.1%;
    --pw-top-name-top: 61.0%;
    --pw-top-name-width: 18.7%;
    --pw-top-name-height: 7.7%;

    --pw-top-level-left: 42.1%;
    --pw-top-level-top: 70.5%;
    --pw-top-level-width: 18.7%;
    --pw-top-level-height: 7.7%;

    --pw-countdown-left: 68.0%;
    --pw-countdown-top: 58.0%;
    --pw-countdown-width: 29.0%;
    --pw-countdown-height: 12.0%;

    --pw-monthly-left: 72.0%;
    --pw-monthly-top: 81.4%;
    --pw-monthly-width: 21.5%;
    --pw-monthly-height: 7.8%;

    --pw-status-font: clamp(13px, 1.45vw, 25px);
    --pw-player-font: clamp(13px, 1.55vw, 27px);
    --pw-join-font: clamp(12px, 1.35vw, 23px);
    --pw-top-font: clamp(12px, 1.35vw, 24px);
    --pw-countdown-font: clamp(15px, 1.8vw, 32px);
    --pw-monthly-font: clamp(11px, 1.25vw, 22px);
}

* {
    box-sizing: border-box;
}

html,
body {
    margin: 0;
    min-height: 100%;
}

body {
    font-family: Arial, Helvetica, sans-serif;
    color: var(--pw-text);
}

.palworld-body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background:
        radial-gradient(circle at 50% -10%, rgba(57, 177, 222, 0.15), transparent 34%),
        radial-gradient(circle at 10% 45%, rgba(83, 150, 80, 0.08), transparent 30%),
        linear-gradient(180deg, var(--pw-bg) 0%, var(--pw-bg-deep) 100%);
}

/* =========================================================
   PALWORLD NAV
   Clean on purpose: brand, Home, Join Discord only.
   No duplicated server/player/wipe information.
   ========================================================= */

.pw-site-header {
    position: relative;
    z-index: 100;
    width: 100%;
    background:
        linear-gradient(180deg, rgba(6, 21, 31, 0.98), rgba(3, 12, 18, 0.97));
    border-bottom: 1px solid rgba(110, 216, 255, 0.24);
    box-shadow:
        0 10px 30px rgba(0, 0, 0, 0.36),
        inset 0 -1px 0 rgba(143, 218, 80, 0.08);
}

.pw-site-header::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: -1px;
    height: 1px;
    background: linear-gradient(
        90deg,
        transparent,
        rgba(112, 219, 255, 0.75),
        rgba(143, 218, 80, 0.35),
        transparent
    );
    opacity: 0.75;
}

.pw-nav-shell {
    width: min(calc(100% - 48px), var(--pw-max));
    min-height: 76px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 32px;
}

.pw-brand {
    display: inline-flex;
    align-items: center;
    gap: 13px;
    color: var(--pw-text);
    text-decoration: none;
}

.pw-brand-mark {
    position: relative;
    width: 52px;
    height: 52px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: -1px;
    color: white;
    background:
        linear-gradient(145deg, #123f59, #071b28 62%, #0b354a);
    border: 1px solid rgba(137, 227, 255, 0.65);
    clip-path: polygon(25% 4%, 75% 4%, 98% 50%, 75% 96%, 25% 96%, 2% 50%);
    filter: drop-shadow(0 0 12px rgba(72, 190, 235, 0.2));
}

.pw-brand-mark::before {
    content: "";
    position: absolute;
    inset: 4px;
    clip-path: inherit;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.pw-brand-name {
    font-size: 25px;
    line-height: 1;
    font-weight: 900;
    letter-spacing: 0.5px;
    text-shadow: none;
}

.pw-main-nav {
    display: flex;
    align-items: center;
    gap: 14px;
}

.pw-nav-link,
.pw-discord-button {
    position: relative;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    font-size: 13px;
    font-weight: 900;
    letter-spacing: 1.15px;
    transition:
        transform 160ms ease,
        border-color 160ms ease,
        background 160ms ease;
}

.pw-nav-link {
    padding: 0 20px;
    color: #d6edf7;
    border: 1px solid rgba(114, 208, 244, 0.16);
    background: rgba(13, 34, 46, 0.38);
    clip-path: polygon(10px 0, 100% 0, 100% calc(100% - 10px), calc(100% - 10px) 100%, 0 100%, 0 10px);
}

.pw-nav-link:hover {
    color: white;
    border-color: rgba(124, 220, 255, 0.5);
    background: rgba(19, 55, 75, 0.66);
    transform: translateY(-1px);
}

.pw-discord-button {
    gap: 9px;
    padding: 0 22px;
    color: white;
    border: 1px solid rgba(112, 213, 255, 0.65);
    background:
        linear-gradient(180deg, rgba(19, 110, 164, 0.94), rgba(9, 64, 102, 0.96));
    box-shadow:
        inset 0 0 18px rgba(99, 210, 255, 0.12),
        0 0 18px rgba(0, 151, 220, 0.08);
    clip-path: polygon(12px 0, 100% 0, 100% calc(100% - 12px), calc(100% - 12px) 100%, 0 100%, 0 12px);
}

.pw-discord-button:hover {
    transform: translateY(-1px);
    background:
        linear-gradient(180deg, rgba(28, 131, 191, 0.98), rgba(12, 78, 121, 0.98));
}

.pw-discord-icon {
    color: #c8f1ff;
    font-size: 17px;
}

/* =========================================================
   EMPTY PALWORLD PAGE AREA
   ========================================================= */

.palworld-page {
    position: relative;
    flex: 1 0 auto;
    width: min(calc(100% - 48px), var(--pw-max));
    min-height: calc(100vh - 170px);
    margin: 0 auto;
}

/* =========================================================
   PALWORLD FOOTER
   Minimal on purpose. No repeated buttons or page information.
   ========================================================= */

.pw-site-footer {
    position: relative;
    flex: 0 0 auto;
    width: 100%;
    background:
        linear-gradient(180deg, rgba(3, 11, 16, 0.82), rgba(2, 7, 10, 0.98));
    border-top: 1px solid rgba(108, 203, 239, 0.15);
}

.pw-site-footer::before {
    content: "";
    position: absolute;
    top: -1px;
    left: 50%;
    width: min(720px, 70vw);
    height: 1px;
    transform: translateX(-50%);
    background: linear-gradient(
        90deg,
        transparent,
        rgba(113, 217, 255, 0.48),
        transparent
    );
}

.pw-footer-shell {
    width: min(calc(100% - 48px), var(--pw-max));
    min-height: 92px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    text-align: center;
}

.pw-footer-domain {
    color: #dcecf2;
    font-size: 16px;
    letter-spacing: 1.6px;
}

.pw-footer-copy {
    color: var(--pw-muted);
    font-size: 12px;
    letter-spacing: 0.3px;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {

    .pw-nav-shell {
        width: min(calc(100% - 24px), var(--pw-max));
        min-height: 68px;
        gap: 14px;
    }

    .pw-brand {
        gap: 9px;
    }

    .pw-brand-mark {
        width: 43px;
        height: 43px;
        font-size: 15px;
    }

    .pw-brand-name {
        font-size: 18px;
    }

    .pw-main-nav {
        gap: 7px;
    }

    .pw-nav-link,
    .pw-discord-button {
        min-height: 40px;
        font-size: 11px;
        letter-spacing: 0.65px;
    }

    .pw-nav-link {
        padding: 0 13px;
    }

    .pw-discord-button {
        padding: 0 14px;
    }

    .pw-discord-button span:last-child {
        display: none;
    }

    .pw-discord-icon {
        font-size: 18px;
    }

    .palworld-page {
        width: min(calc(100% - 24px), var(--pw-max));
        min-height: calc(100vh - 160px);
    }

    .pw-footer-shell {
        width: min(calc(100% - 24px), var(--pw-max));
        min-height: 82px;
    }
}

/* =========================================================
   PALWORLD DASHBOARD
   ========================================================= */

.pw-dashboard {
    position: relative;
    width: 100%;
    margin: 24px auto 34px;
    line-height: 1;
    isolation: isolate;
}

.pw-dashboard-image {
    position: relative;
    z-index: 2;
    display: block;
    width: 100%;
    height: auto;
    margin: 0 auto;
    object-fit: contain;
    user-select: none;
    pointer-events: none;
}

/* =========================================================
   COMMON LIVE TEXT
   ========================================================= */

.pw-overlay {
    position: absolute;
    z-index: 4;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    color: #f7fbff;
    font-weight: 900;
    text-align: center;
    white-space: nowrap;
    text-overflow: ellipsis;
    text-shadow:
        0 2px 2px rgba(0, 0, 0, 0.95),
        0 0 10px rgba(57, 191, 255, 0.32);
}

/* =========================================================
   SERVER STATUS
   ========================================================= */

.pw-server-status {
    left: var(--pw-status-left);
    top: var(--pw-status-top);
    width: var(--pw-status-width);
    height: var(--pw-status-height);
    font-size: var(--pw-status-font);
    letter-spacing: 0.08em;
}

.pw-server-status.is-online {
    color: #8df16d;
}

.pw-server-status.is-offline {
    color: #ff6d6d;
}

.pw-server-players {
    position: absolute;
    left: var(--pw-players-left);
    top: var(--pw-players-top);
    width: var(--pw-players-width);
    height: var(--pw-players-height);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.28em;
    font-size: var(--pw-player-font);
}

/* Keep the two player values inside the Players Online overlay,
   even if another site stylesheet targets data-game-players. */
.pw-server-players [data-game-players],
.pw-server-players [data-pw-current-players],
.pw-server-players [data-pw-max-players],
.pw-server-players .pw-player-divider {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    display: inline-block !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    line-height: 1 !important;
    font: inherit;
}

.pw-player-divider {
    opacity: 0.55;
}

.pw-server-joining {
    left: var(--pw-joining-left);
    top: var(--pw-joining-top);
    width: var(--pw-joining-width);
    height: var(--pw-joining-height);
    font-size: var(--pw-player-font);
}

.pw-dashboard.is-joining .pw-server-joining {
    color: #7fe5ff;
}

.pw-join-server {
    left: var(--pw-join-left);
    top: var(--pw-join-top);
    width: var(--pw-join-width);
    height: var(--pw-join-height);
    font-size: var(--pw-join-font);
    letter-spacing: 0.09em;
    text-decoration: none;
    cursor: pointer;
    pointer-events: auto;
}

.pw-join-server:hover {
    color: #9deaff;
    filter: brightness(1.18);
}

/* The current panel artwork already contains JOIN SERVER text.
   Keep the HTML link clickable without drawing a second label over it. */
.pw-join-server {
    color: transparent;
    text-shadow: none;
}

.pw-join-server:hover {
    color: transparent;
}

/* =========================================================
   TOP PLAYER
   ========================================================= */

.pw-top-avatar {
    position: absolute;
    z-index: 1;
    left: var(--pw-avatar-left);
    top: var(--pw-avatar-top);
    width: var(--pw-avatar-width);
    aspect-ratio: 1 / 1;
    transform: translate(-50%, -50%);
    overflow: hidden;
    border-radius: 50%;
    background: #07111a;
}

.pw-top-avatar img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: inherit;
}

.pw-top-name {
    left: var(--pw-top-name-left);
    top: var(--pw-top-name-top);
    width: var(--pw-top-name-width);
    height: var(--pw-top-name-height);
    padding: 0 4%;
    font-size: var(--pw-top-font);
}

.pw-top-level {
    left: var(--pw-top-level-left);
    top: var(--pw-top-level-top);
    width: var(--pw-top-level-width);
    height: var(--pw-top-level-height);
    font-size: var(--pw-top-font);
}

/* =========================================================
   WIPE COUNTDOWN
   ========================================================= */

.pw-countdown {
    position: absolute;
    z-index: 4;
    left: var(--pw-countdown-left);
    top: var(--pw-countdown-top);
    width: var(--pw-countdown-width);
    height: var(--pw-countdown-height);
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    align-items: center;
    justify-items: center;
    pointer-events: none;
}

.pw-countdown strong {
    position: static !important;
    inset: auto !important;
    transform: none !important;
    display: block !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #f7fbff;
    font-size: var(--pw-countdown-font);
    font-weight: 900;
    line-height: 1;
    font-variant-numeric: tabular-nums;
    text-shadow:
        0 2px 2px rgba(0, 0, 0, 0.95),
        0 0 12px rgba(67, 199, 255, 0.38);
}

.pw-wipe-monthly {
    left: var(--pw-monthly-left);
    top: var(--pw-monthly-top);
    width: var(--pw-monthly-width);
    height: var(--pw-monthly-height);
    font-size: var(--pw-monthly-font);
    letter-spacing: 0.12em;
}

/* =========================================================
   MOBILE
   ========================================================= */

@media (max-width: 768px) {
    .pw-dashboard {
        margin: 16px auto 24px;
    }

    .pw-overlay {
        text-shadow:
            0 1px 1px rgba(0, 0, 0, 0.95),
            0 0 5px rgba(57, 191, 255, 0.25);
    }
}


/* =========================================================
   NAV LOGO SIZE GUARD
   Keeps the real NoobTube image logo inside the nav bar.
   ========================================================= */

.pw-site-header .pw-brand {
    flex: 0 0 auto;
    min-width: 0;
    max-width: 230px;
}

.pw-site-header .pw-brand img,
.pw-site-header .pw-brand-logo,
.pw-site-header .pw-nav-logo,
.pw-site-header .pw-logo {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 220px !important;
    max-height: 58px !important;
    object-fit: contain !important;
}

.pw-site-header .pw-nav-shell {
    min-height: 76px;
}

@media (max-width: 768px) {
    .pw-site-header .pw-brand {
        max-width: 170px;
    }

    .pw-site-header .pw-brand img,
    .pw-site-header .pw-brand-logo,
    .pw-site-header .pw-nav-logo,
    .pw-site-header .pw-logo {
        max-width: 165px !important;
        max-height: 48px !important;
    }
}


/* =========================================================
   DESKTOP NAV POSITION FIX
   Keep:
   - NoobTube logo on the left
   - HOME dead-centre
   - JOIN DISCORD on the right

   This only changes nav positioning.
   Dashboard rules are untouched.
   ========================================================= */

@media (min-width: 769px) {

    .pw-site-header .pw-nav-shell {
        position: relative;
    }

    .pw-site-header .pw-main-nav {
        margin-left: auto;
    }

    .pw-site-header .pw-nav-link {
        position: absolute;
        left: 50%;
        top: 50%;
        transform: translate(-50%, -50%);
    }

    .pw-site-header .pw-nav-link:hover {
        transform: translate(-50%, calc(-50% - 1px));
    }
}