﻿/* Extracted from views\layout.php */

/* ══════════════════════════════════════════════════
   GAME BOTTOM BAR  —  news + ws-chip + music + logout
   Never overlaps at any desktop resolution
   ══════════════════════════════════════════════════ */
#game-bottom-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 46px;
    z-index: 5200;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 14px;
    background: rgba(12, 9, 5, 0.88);
    border-top: 1px solid rgba(160, 110, 40, 0.30);
    backdrop-filter: blur(8px);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.55);
    box-sizing: border-box;
}

/* Ticker becomes a flex child — no fixed positioning inside the bar */
#game-bottom-bar .global-news-ticker {
    position: static !important;
    flex: 1;
    min-width: 0;
    width: auto !important;
    transform: none !important;
    bottom: auto !important;
    left: auto !important;
    border-color: transparent !important;
    box-shadow: none !important;
    background: transparent !important;
    border-radius: 0 !important;
    overflow: hidden;
    padding: 0 !important;
    pointer-events: none;
    height: 100%;
    display: flex;
    align-items: center;
}
#game-bottom-bar .global-news-viewport {
    padding: 3px 0 !important;
    width: 100%;
}
#game-bottom-bar .global-news-track {
    font-size: 13px !important;
    color: #ffffff !important;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85) !important;
}
#game-bottom-bar .global-news-title {
    color: #ffffff !important;
}
#game-bottom-bar .global-news-datetime {
    color: #ffffff !important;
    font-size: 12px !important;
}
#game-bottom-bar .global-news-text {
    color: #ffffff !important;
}

/* Compact chip and buttons inside the bar */
.bottom-chip {
    flex-shrink: 0;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.45);
    color: #ccc;
    border: 1px solid rgba(255, 215, 0, 0.28);
    padding: 4px 9px;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
    font-size: 10px;
    min-width: 0;
    text-align: center;
    line-height: 1.2;
}
.bottom-btn {
    flex-shrink: 0;
    white-space: nowrap;
    background: rgba(0, 0, 0, 0.50);
    color: #e8d8b8;
    border: 1px solid rgba(255, 215, 0, 0.28);
    padding: 4px 11px;
    border-radius: 4px;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    cursor: pointer;
    transition: background 0.2s, border-color 0.2s;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    line-height: 1.4;
}
.bottom-btn:hover {
    background: rgba(255, 215, 0, 0.14);
    border-color: rgba(255, 215, 0, 0.55);
    color: #fff;
}

.bottom-more-wrap {
    position: relative;
    flex-shrink: 0;
}

.bottom-more-menu {
    position: absolute;
    left: 0;
    bottom: calc(100% + 8px);
    min-width: 150px;
    max-width: 220px;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid rgba(255, 215, 0, 0.35);
    background: rgba(8, 10, 20, 0.96);
    border-radius: 8px;
    box-shadow: 0 14px 28px rgba(0, 0, 0, 0.45);
    padding: 6px;
    z-index: 5305;
}

.bottom-more-item {
    display: block;
    color: #e9ddb9;
    text-decoration: none;
    font-family: 'Cinzel', serif;
    font-size: 11px;
    border: 1px solid transparent;
    border-radius: 6px;
    padding: 6px 8px;
    margin-bottom: 4px;
    background: rgba(255, 255, 255, 0.02);
}

.bottom-more-item:last-child {
    margin-bottom: 0;
}

.bottom-more-item:hover {
    background: rgba(255, 215, 0, 0.13);
    border-color: rgba(255, 215, 0, 0.45);
    color: #fff;
}

.bottom-more-empty {
    color: #9a9a9a;
    font-size: 11px;
    font-family: 'Cinzel', serif;
    padding: 6px 8px;
}

@media (max-width: 760px) {
    .bottom-more-menu {
        left: 0;
        right: auto;
        min-width: 130px;
        max-width: min(68vw, 190px);
        max-height: 180px;
    }

    .bottom-btn {
        padding: 3px 8px;
        font-size: 10px;
        gap: 3px;
    }
}

.bottom-logout-btn {
    background: rgba(120, 0, 0, 0.55) !important;
    border-color: rgba(220, 80, 60, 0.4) !important;
    color: #ffb8b8 !important;
}
.bottom-logout-btn:hover {
    background: rgba(180, 0, 0, 0.70) !important;
    border-color: rgba(255, 100, 80, 0.6) !important;
    color: #fff !important;
}

/* Admin test-news button — sits just above the bottom bar */
.global-news-test-btn {
    bottom: 50px !important;
}

/* Standalone ticker (non-home/center pages) — keep legacy styles */
.global-news-ticker {
    position: fixed;
    left: 50%;
    bottom: 20px;
    transform: translateX(-50%);
    width: min(860px, calc(100vw - 40px));
    z-index: 5200;
    pointer-events: none;
    background: rgba(246, 229, 186, 0.95);
    border: 2px solid #9a5a22;
    border-radius: 4px;
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.42);
    overflow: hidden;
}

.global-news-viewport {
    width: 100%;
    overflow: hidden;
    white-space: nowrap;
    padding: 6px 0;
}

.global-news-track {
    display: inline-block;
    white-space: nowrap;
    transform: translateX(100%);
    will-change: transform;
    font-family: 'Cinzel', serif;
    font-size: 20px;
    line-height: 1.15;
    color: #2a1a0b;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.55);
}

.global-news-title {
    font-weight: 700;
    color: #8b3f0a;
    margin-right: 12px;
    letter-spacing: 0.4px;
}

.global-news-datetime {
    font-weight: 700;
    color: #5e3f1a;
    margin-right: 12px;
    letter-spacing: 0.3px;
}

.global-news-text {
    font-weight: 500;
    color: #22170d;
}

.global-news-track.is-scrolling {
    animation-name: silk-news-marquee;
    animation-timing-function: linear;
    animation-fill-mode: forwards;
}

.global-news-test-btn {
    position: fixed;
    left: 50%;
    bottom: 72px;
    transform: translateX(-50%);
    z-index: 5201;
    pointer-events: auto;
    background: linear-gradient(180deg, #7c4a1f, #5e3415);
    border: 1px solid #d7a050;
    border-radius: 4px;
    color: #f9e8c1;
    font-family: 'Cinzel', serif;
    font-size: 12px;
    font-weight: 700;
    padding: 4px 12px;
    cursor: pointer;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.35);
}

.global-news-test-btn:hover {
    background: linear-gradient(180deg, #92602f, #6f411d);
}

.global-news-test-btn:disabled {
    opacity: 0.55;
    cursor: wait;
}

@keyframes silk-news-marquee {
    from { transform: translateX(100%); }
    to { transform: translateX(-100%); }
}

@media (max-width: 980px) {
    .global-news-ticker {
        bottom: 12px;
        width: calc(100vw - 24px);
    }

    .global-news-track {
        font-size: 16px;
    }

    .global-news-test-btn {
        bottom: 58px;
        font-size: 11px;
        padding: 4px 10px;
    }
}

/* --- SAMURAI HUD (Reverted Image-Based Version) --- */
        #topBar {
            position: fixed;
            top: 0;
            left: 50%;
            transform: translateX(-50%) scale(var(--hud-scale, 1));
            transform-origin: top center;
            z-index: 2000;
            width: 1200px;
            height: 140px;
            background: url('./assets/img/hud_frame.png') no-repeat center center;
            background-size: cover;
            font-family: 'Cinzel', serif;
            filter: drop-shadow(0 15px 30px rgba(0,0,0,0.8));
            border-bottom: 2px solid #5d403766;
            transition: transform 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
        }

        #topBar.minimized {
            transform: translateX(-50%) translateY(calc(-115px * var(--hud-scale, 1))) scale(var(--hud-scale, 1));
        }

        #topBar[data-minimized='1'] {
            transform: translateX(-50%) translateY(calc(-115px * var(--hud-scale, 1))) scale(var(--hud-scale, 1));
        }

        .hud-toggle-btn {
            position: absolute;
            bottom: -22px;
            right: 45px;
            padding: 2px 15px;
            background: rgba(30, 20, 10, 0.95);
            border: 1px solid #ffd70066;
            border-top: none;
            border-radius: 0 0 8px 8px;
            color: #ffd700;
            cursor: pointer;
            font-family: 'Cinzel', serif;
            font-size: 10px;
            font-weight: bold;
            display: flex;
            align-items: center;
            gap: 5px;
            transition: all 0.2s;
            box-shadow: 0 4px 8px rgba(0,0,0,0.3);
            z-index: 3000;
            pointer-events: auto;
            letter-spacing: 1px;
            text-transform: uppercase;
        }

        .hud-toggle-btn:hover {
            background: #ffd700;
            color: #000;
            border-color: #ffd700;
        }

        #topBar.minimized .hud-toggle-btn {
            bottom: -22px;
        }

        #stockBar {
            position: absolute;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 5;
        }

        .stockBarButton {
            position: absolute;
            width: 210px;
            height: 36px;
            display: flex;
            align-items: center;
            pointer-events: auto;
            text-decoration: none;
            padding: 0 15px;
            cursor: pointer;
            transition: all 0.3s ease;
            background: transparent;
            border: none;
            box-shadow: none;
        }
        .stockBarButton:hover { 
            background: rgba(0,0,0,0.5);
            border-color: rgba(255,215,0,0.3);
            transform: translateY(-1px);
        }

        /* Left Slots (Wood/Clay) */
        .resource1 { left: 45px; top: 32px; }
        .resource2 { left: 45px; top: 78px; }
        /* Right Slots (Iron/Food) */
        .resource3 { right: 65px; top: 32px; }
        .resource4 { right: 65px; top: 78px; }

        .stockBarButton i {
            font-size: 22px;
            margin-right: 15px;
            z-index: 5;
        }

        .stockBarButton .value {
            font-size: 18px;
            color: #fff;
            font-weight: 700;
            text-shadow: 0 1px 2px #000;
            z-index: 5;
            flex: 1;
            text-align: right;
            padding-right: 10px;
            letter-spacing: 1px;
        }

        .barBox {
            position: absolute;
            bottom: -2px;
            left: 10%;
            width: 80%;
            height: 3px;
            background: rgba(0,0,0,0.8);
            border-radius: 2px;
            overflow: hidden;
            z-index: 10;
        }

        .bar {
            height: 100%;
            background: linear-gradient(to right, #43a047, #66bb6a);
            width: 0%;
            transition: width 1s linear;
        }

        #navigation {
            position: absolute;
            left: 50%;
            top: 42px;
            transform: translateX(-50%);
            display: flex;
            gap: 12px;
            align-items: center;
            pointer-events: auto;
            z-index: 10;
        }

        #navigation a {
            width: 52px;
            height: 52px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 50%;
            transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
            font-size: 26px;
            text-decoration: none;
            background: transparent;
            border: none;
            box-shadow: none;
        }

        #navigation a:hover {
            transform: translateY(-5px) scale(1.1);
            filter: drop-shadow(0 0 10px #ffd700);
        }

        #navigation a.active {
            filter: drop-shadow(0 0 15px #ffd700);
            transform: scale(1.1);
        }

        .currency {
            position: absolute;
            right: 25px;
            top: 25px;
            display: flex;
            flex-direction: column;
            gap: 6px;
            align-items: flex-end;
            pointer-events: auto;
            z-index: 10;
        }

        /* RPG INVENTORY STYLES - REFINED */
        .bs-inv-slot {
            width: 52px;
            height: 52px;
            background: rgba(80, 52, 22, 0.25);
            border: 2px solid rgba(139, 69, 19, 0.5);
            border-radius: 6px;
            display: flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            position: relative;
            overflow: hidden;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
            image-rendering: pixelated;
        }

        .bs-inv-slot:not(.bs-locked):not(.bs-empty):hover {
            background: rgba(255, 215, 0, 0.15);
            border-color: #ffd700;
            box-shadow: 0 0 10px rgba(255, 215, 0, 0.4), inset 0 2px 4px rgba(0, 0, 0, 0.3);
            transform: scale(1.05);
            z-index: 10;
        }

        .bs-inv-slot.bs-selected {
            background: rgba(255, 215, 0, 0.25) !important;
            border-color: #ffd700 !important;
            box-shadow: 0 0 15px rgba(255, 215, 0, 0.6), inset 0 2px 4px rgba(0, 0, 0, 0.3) !important;
        }

        .bs-inv-slot.bs-empty {
            cursor: default;
            background: rgba(0, 0, 0, 0.1);
            border-style: dashed;
            border-color: rgba(0, 0, 0, 0.2);
        }

        .bs-inv-slot.bs-locked {
            cursor: not-allowed;
            opacity: 0.8;
        }

        .bs-inv-lock-overlay {
            position: absolute;
            inset: 0;
            background: rgba(0, 0, 0, 0.4);
            display: flex;
            align-items: center;
            justify-content: center;
            transition: 0.2s;
        }

        /* ICON FALLBACK SYSTEM */
        .inv-icon-container {
            width: 120%; /* Slight overflow to ensure filling */
            height: 120%;
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .inv-img {
            width: 85%;
            height: 85%;
            object-fit: contain;
            position: relative;
            z-index: 2;
        }

        .inv-emoji-fallback {
            position: absolute;
            font-size: 24px;
            display: none;
            z-index: 1;
        }

        .inv-icon-container.img-failed .inv-img {
            display: none;
        }

        .inv-icon-container.img-failed .inv-emoji-fallback {
            display: block;
            width: 40px;
            height: 40px;
            background: rgba(0, 0, 0, 0.3);
            border-radius: 50%;
            line-height: 40px;
            text-align: center;
        }

        /* TIER / LEVEL BADGE */
        .bs-inv-badge {
            position: absolute;
            bottom: 0px;
            right: 0px;
            background: rgba(0,0,0,0.8);
            color: #fff;
            font-size: 10px;
            font-weight: bold;
            padding: 2px 4px;
            border-top-left-radius: 4px;
            z-index: 10;
            border-left: 1px solid rgba(255,215,0,0.3);
            border-top: 1px solid rgba(255,215,0,0.3);
            min-width: 18px;
            text-align: center;
            font-family: 'Cinzel', serif;
        }

        .bs-inv-badge.locked {
            background: rgba(0, 0, 0, 0.7);
        }

        .bs-inv-badge.tier {
            background: #2e7d32;
            border-color: #4caf50;
        }

        .bs-btn-premium {
            background: linear-gradient(135deg, #8b4513 0%, #6b3410 100%);
            color: #ffd700;
            font-weight: bold;
            border: 2px solid #5d2e0e;
            padding: 12px 20px;
            border-radius: 8px;
            cursor: pointer;
            box-shadow: 0 4px 8px rgba(0, 0, 0, 0.5);
            font-family: serif;
            transition: all 0.2s;
            text-transform: uppercase;
            letter-spacing: 1px;
            width: 100%;
            margin-top: 10px;
        }

        .bs-btn-premium:hover {
            background: linear-gradient(135deg, #a0522d 0%, #8b4513 100%);
            box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
            transform: translateY(-1px);
        }

        .bs-btn-premium:active {
            transform: translateY(1px);
            box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4);
        }

        body {
            font-family: 'Cinzel', serif;
            background: url('assets/img/bg.png') no-repeat center center fixed;
            background-size: cover;
            margin: 0;
            padding: 0;
            color: #ddd;
        }

        .overlay {
            background-color: rgba(0, 0, 0, 0.4);
            min-height: 100vh;
        }

        .container {
            width: 95%;
            max-width: 1400px;
            margin: 20px auto;
            background: rgba(15, 15, 25, 0.9);
            color: #eee;
            padding: 40px;
            border-radius: 12px;
            box-shadow: 0 0 50px rgba(0, 0, 0, 0.9);
            border: 2px solid #5d403733;
            backdrop-filter: blur(10px);
            transition: all 0.3s ease;
        }

        /* IMMERSIVE FULL-SCREEN OVERRIDE */
        .layout-immersive {
            width: 100% !important;
            max-width: none !important;
            margin: 0 !important;
            padding: 0 !important;
            background: transparent !important;
            box-shadow: none !important;
            border: none !important;
            border-radius: 0 !important;
            backdrop-filter: none !important;
        }

        .no-page-bg {
            background-image: none !important;
            background-color: #0b0b0e !important;
        }

        .no-page-bg .overlay {
            background-color: transparent !important;
        }

        .no-page-bg #topBar {
            margin-bottom: 0 !important;
            position: fixed !important;
            top: 0 !important;
            left: 50% !important;
            transform: translateX(-50%) scale(var(--hud-scale, 1));
            z-index: 10050 !important;
        }

        .no-page-bg #topBar.minimized,
        .no-page-bg #topBar[data-minimized='1'] {
            transform: translateX(-50%) translateY(calc(-115px * var(--hud-scale, 1))) scale(var(--hud-scale, 1));
        }

        .resource-bar span {
            display: flex;
            align-items: center;
        }

        button,
        .btn {
            padding: 10px 20px;
            background-color: #8b0000;
            color: white;
            border: 1px solid #ffd700;
            cursor: pointer;
            border-radius: 4px;
            font-weight: bold;
            text-decoration: none;
            display: inline-block;
        }

        button:hover,
        .btn:hover {
            background-color: #b71c1c;
        }

        .error {
            color: #d32f2f;
            margin-bottom: 15px;
            font-weight: bold;
        }

        .success {
            color: #388e3c;
            margin-bottom: 15px;
            font-weight: bold;
        }

        table {
            width: 100%;
            border-collapse: collapse;
            margin-top: 15px;
        }

        th,
        td {
            padding: 10px;
            border: 1px solid #ddd;
            text-align: left;
        }

        th {
            background-color: #f5f5f5;
        }

        /* Inventory Modal Styles - FULL PAGE OVERHAUL */
        #inventory-modal {
            display: none;
            position: fixed;
            z-index: 3000;
            left: 0;
            top: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(10, 10, 15, 0.98);
            backdrop-filter: blur(15px);
            overflow-y: auto;
        }

        .modal-container-full {
            min-height: 100vh;
            padding: 40px 20px;
            box-sizing: border-box;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .modal-content-full {
            width: 100%;
            max-width: 1200px;
            position: relative;
            animation: fadeInScale 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
        }

        @keyframes fadeInScale {
            from {
                transform: scale(0.9);
                opacity: 0;
            }

            to {
                transform: scale(1);
                opacity: 1;
            }
        }

        .inv-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            border-bottom: 2px solid #ffd700;
            padding-bottom: 20px;
            margin-bottom: 30px;
        }

        .inv-header h2 {
            font-family: 'Cinzel', serif;
            color: #ffd700;
            margin: 0;
            font-size: 2.5rem;
            text-shadow: 0 0 10px rgba(255, 215, 0, 0.3);
        }

        .close-inv {
            font-size: 40px;
            color: #fff;
            cursor: pointer;
            transition: 0.3s;
            line-height: 1;
        }

        .close-inv:hover {
            color: #f44336;
            transform: rotate(90deg);
        }

        .inv-grid-enhanced {
            display: grid;
            grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 25px;
            width: 100%;
        }

        .inv-card {
            background: rgba(255, 255, 255, 0.03);
            border: 1px solid rgba(255, 255, 255, 0.1);
            border-radius: 12px;
            padding: 20px;
            transition: 0.3s;
            position: relative;
            display: flex;
            flex-direction: column;
            align-items: center;
        }

        .inv-card:hover {
            background: rgba(255, 255, 255, 0.07);
            border-color: #ffd700;
            transform: translateY(-5px);
            box-shadow: 0 10px 20px rgba(0, 0, 0, 0.5);
        }

        .inv-card .item-img {
            width: 80px;
            height: 80px;
            image-rendering: pixelated;
            margin-bottom: 15px;
        }

        .inv-card .item-name {
            font-weight: bold;
            color: #fff;
            margin-bottom: 5px;
            text-align: center;
        }

        .inv-card .item-qty {
            color: #ffd700;
            font-size: 14px;
            margin-bottom: 15px;
        }

        /* Rarity Borders */
        .rarity-common {
            border: 2px solid #8e8e8e !important;
            box-shadow: 0 0 10px rgba(142, 142, 142, 0.2);
        }

        .rarity-uncommon {
            border: 2px solid #2ecc71 !important;
            box-shadow: 0 0 10px rgba(46, 204, 113, 0.2);
        }

        .rarity-rare {
            border: 2px solid #9b59b6 !important;
            box-shadow: 0 0 15px rgba(155, 89, 182, 0.3);
        }

        .rarity-legendary {
            border: 2px solid #f1c40f !important;
            box-shadow: 0 0 20px rgba(241, 196, 15, 0.4);
            animation: glowGold 2s infinite;
        }

        @keyframes glowGold {

            0%,
            100% {
                border-color: #f1c40f;
            }

            50% {
                border-color: #fff;
            }
        }

        /* GLOBAL PIXEL ART ENFORCEMENT */
        .crisp,
        img[src*="u_"],
        img[src*="bld_"],
        .item-img,
        .res-icon,
        .building-graphic,
        .villager-anim,
        .villager img,
        .anchor-bg {
            image-rendering: -moz-crisp-edges;
            image-rendering: -webkit-optimize-contrast;
            image-rendering: pixelated;
            image-rendering: optimize-speed;
        }

        .item-lifecycle {
            font-size: 11px;
            margin-top: 5px;
            color: #aaa;
            text-align: center;
        }

        .rarity-legendary {
            border: 2px solid #f1c40f !important;
            box-shadow: 0 0 20px rgba(241, 196, 15, 0.6);
            animation: glowGoldPremium 3s infinite alternate;
        }

        @keyframes glowGoldPremium {
            0% {
                box-shadow: 0 0 10px rgba(241, 196, 15, 0.4);
                border-color: #f1c40f;
            }

            100% {
                box-shadow: 0 0 30px rgba(255, 255, 255, 0.8), 0 0 50px rgba(241, 196, 15, 0.4);
                border-color: #fff;
            }
        }

        .nav a {
            color: #ffd700;
            text-decoration: none;
            margin-right: 15px;
            font-weight: 500;
            font-family: 'Georgia', serif;
            font-size: 14px;
            padding: 5px 10px;
            border-radius: 4px;
            transition: 0.2s;
            border: 1px solid transparent;
            display: inline-flex;
            align-items: center;
            gap: 5px;
        }

        .nav a:hover {
            background: rgba(255, 215, 0, 0.1);
            border-color: #ffd700;
            transform: translateY(-1px);
        }

        /* CHANGELOG MODAL */
        .ver-modal {
            position: fixed;
            inset: 0;
            background: rgba(0, 0, 0, 0.85);
            z-index: 10000;
            display: flex;
            align-items: center;
            justify-content: center;
            backdrop-filter: blur(8px);
        }

        .ver-content {
            width: 90%;
            max-width: 800px;
            height: 80vh;
            background: #1a1a2e;
            border: 2px solid #ffd700;
            border-radius: 12px;
            display: flex;
            flex-direction: column;
            overflow: hidden;
            box-shadow: 0 0 50px rgba(0, 0, 0, 1);
        }

        .ver-header {
            padding: 20px;
            background: rgba(255, 215, 0, 0.1);
            border-bottom: 3px solid #ffd700;
            display: flex;
            justify-content: space-between;
            align-items: center;
        }

        .ver-header h2 {
            margin: 0;
            color: #ffd700;
            font-family: serif;
        }

        .ver-body {
            flex: 1;
            overflow-y: auto;
            padding: 20px;
            background: url('assets/img/paper_bg.png');
            color: #333;
        }

        .ver-card {
            background: rgba(255, 255, 255, 0.9);
            border-left: 5px solid #8b4513;
            margin-bottom: 25px;
            padding: 15px;
            border-radius: 4px;
            box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        }

        .ver-tag-pill {
            background: #ffd700;
            color: #000;
            font-weight: bold;
            padding: 2px 8px;
            border-radius: 12px;
            font-size: 11px;
            margin-right: 10px;
        }

        .ver-date {
            float: right;
            font-size: 11px;
            color: #666;
        }

        .ver-title {
            display: block;
            font-size: 18px;
            font-weight: bold;
            margin: 5px 0;
            color: #8b0000;
            font-family: serif;
        }

        .ver-short {
            font-style: italic;
            color: #555;
            border-bottom: 1px solid #ddd;
            padding-bottom: 10px;
            margin-bottom: 10px;
        }

        .ver-long {
            font-size: 14px;
            line-height: 1.6;
            white-space: pre-wrap;
        }

        .ver-img {
            width: 100%;
            border-radius: 8px;
            margin-top: 15px;
            border: 1px solid #ccc;
            max-height: 300px;
            object-fit: cover;
        }

        .ver-cat {
            display: inline-block;
            padding: 1px 6px;
            border-radius: 4px;
            font-size: 10px;
            text-transform: uppercase;
            color: #fff;
            margin-left: 10px;
        }

        .ver-cat.add {
            background: #27ae60;
        }

        .ver-cat.modify {
            background: #2980b9;
        }

        .ver-cat.fix {
            background: #e67e22;
        }

        .ver-cat.event {
            background: #8e44ad;
        }

        .btn-ver-close {
            background: none;
            border: 2px solid #ffd700;
            color: #ffd700;
            border-radius: 50%;
            width: 30px;
            height: 30px;
            cursor: pointer;
            font-weight: bold;
            font-size: 16px;
        }

        .btn-ver-close:hover {
            background: #ffd700;
            color: #000;
        }

@keyframes hudSlideDown {
                from { transform: translateY(-30px); opacity: 0; }
                to { transform: translateY(0); opacity: 1; }
            }
            .hud-modal-animate {
                animation: hudSlideDown 0.4s cubic-bezier(0.165, 0.84, 0.44, 1) forwards;
            }

@keyframes spin { to { transform: rotate(360deg); } }

#mv-tracker {
    position: fixed;
    z-index: 8000;
    min-width: 220px;
    min-height: 80px;
    font-family: 'Cinzel', serif;
    border-radius: 8px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.7);
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
#mv-tracker,
#bf-tracker,
#nt-tracker,
#pg-tracker,
#rs-tracker {
    transform: scale(var(--widget-ui-scale, 1));
    transform-origin: top left;
}
#mv-tracker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: grab;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
#mv-tracker-header:active { cursor: grabbing; }
#mv-tracker-body {
    overflow-y: auto;
    max-height: 300px;
    padding: 6px 4px;
    font-family: monospace;
    font-size: 12px;
}
#mv-tracker-body::-webkit-scrollbar { width: 4px; }
#mv-tracker-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
.mv-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    padding: 5px 8px;
    border-radius: 5px;
    margin-bottom: 3px;
    background: rgba(255,255,255,0.05);
    border-left: 3px solid transparent;
    line-height: 1.35;
}
.mv-row:hover { background: rgba(255,255,255,0.1); }
.mv-icon { font-size: 16px; flex-shrink: 0; margin-top: 1px; }
.mv-details { flex: 1; min-width: 0; }
.mv-type-label { font-size: 10px; font-weight: bold; opacity: 0.75; text-transform: uppercase; letter-spacing: 0.5px; }
.mv-coords { font-size: 11px; opacity: 0.9; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mv-countdown { font-size: 13px; font-weight: bold; color: #ffd700; text-align: right; flex-shrink: 0; min-width: 52px; font-family: 'Courier New', monospace; }
.mv-countdown.urgent { color: #ff5252; animation: mvBlink 0.8s step-end infinite; }
@keyframes mvBlink { 0%,100% { opacity:1; } 50% { opacity:0.3; } }
.mv-empty { text-align: center; padding: 18px 10px; opacity: 0.45; font-size: 12px; font-family: sans-serif; }
#mv-tracker-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.3);
    flex-wrap: wrap;
}
#mv-tracker-toolbar label { font-size: 10px; opacity: 0.7; }
#mv-resize-handle {
    position: absolute;
    bottom: 0; right: 0;
    width: 14px; height: 14px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.25) 60%);
    border-bottom-right-radius: 8px;
}
.mv-tracker-editing-ring { outline: 2px dashed #ffd700 !important; }

#bf-tracker {
    position: fixed;
    z-index: 7997;
    min-width: 220px;
    min-height: 70px;
    font-family: 'Cinzel', serif;
    border-radius: 8px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.7);
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
#bf-tracker-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 10px; font-size: 11px; font-weight: bold;
    letter-spacing: 1px; text-transform: uppercase;
    cursor: grab; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0;
}
#bf-tracker-header:active { cursor: grabbing; }
#bf-tracker-body {
    max-height: 220px; overflow-y: auto;
    padding: 5px 6px; font-family: monospace; font-size: 12px;
}
#bf-tracker-body::-webkit-scrollbar { width: 4px; }
#bf-tracker-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
#bf-tracker-toolbar {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 8px; border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.3); flex-wrap: wrap;
}
#bf-tracker-toolbar label { font-size: 10px; opacity: 0.7; }
#bf-resize-handle {
    position: absolute; bottom: 0; right: 0;
    width: 14px; height: 14px; cursor: se-resize;
    background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.25) 60%);
    border-bottom-right-radius: 8px;
}
.bf-row {
    display: flex; gap: 6px; align-items: center;
    padding: 5px 7px; border-radius: 5px; margin-bottom: 3px;
    background: rgba(255,255,255,0.05); border-left: 3px solid transparent;
}
.bf-row:hover { background: rgba(255,255,255,0.1); }
.bf-icon { font-size: 14px; flex-shrink: 0; }
.bf-details { flex: 1; min-width: 0; }
.bf-label { font-size: 10px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-value { font-size: 11px; opacity: 0.85; }
.bf-duration { font-size: 11px; font-weight: bold; color: #ffd54f; min-width: 60px; text-align: right; font-family: 'Courier New', monospace; }
.bf-duration.permanent { color: #81c784; }
.bf-duration.urgent { color: #ef5350; }
.bf-empty { text-align: center; padding: 14px 8px; opacity: 0.5; font-size: 12px; font-family: sans-serif; }

#nt-tracker {
    position: fixed;
    z-index: 7996;
    min-width: 200px;
    min-height: 60px;
    font-family: 'Cinzel', serif;
    border-radius: 8px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.7);
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
#nt-tracker-header {
    display: flex; align-items: center; justify-content: space-between;
    padding: 6px 10px; font-size: 11px; font-weight: bold;
    letter-spacing: 1px; text-transform: uppercase;
    cursor: grab; border-bottom: 1px solid rgba(255,255,255,0.1); flex-shrink: 0;
}
#nt-tracker-header:active { cursor: grabbing; }
#nt-tracker-body { padding: 8px 10px; font-family: monospace; font-size: 12px; }
#nt-tracker-toolbar {
    display: flex; align-items: center; gap: 6px;
    padding: 5px 8px; border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.3); flex-wrap: wrap;
}
#nt-tracker-toolbar label { font-size: 10px; opacity: 0.7; }
#nt-resize-handle {
    position: absolute; bottom: 0; right: 0;
    width: 14px; height: 14px; cursor: se-resize;
    background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.25) 60%);
    border-bottom-right-radius: 8px;
}
.nt-row {
    display: flex; align-items: center; justify-content: space-between;
    padding: 5px 4px; border-radius: 4px; margin-bottom: 4px;
    background: rgba(255,255,255,0.05);
}
.nt-row:hover { background: rgba(255,255,255,0.1); cursor: pointer; }
.nt-icon { font-size: 14px; margin-right: 7px; }
.nt-label { flex: 1; font-size: 11px; opacity: 0.9; }
.nt-badge {
    font-size: 11px; font-weight: bold; padding: 1px 7px;
    border-radius: 10px; min-width: 22px; text-align: center;
}
.nt-badge.zero { background: rgba(255,255,255,0.1); color: #666; }
.nt-badge.has-new { background: #ef5350; color: #fff; animation: nt-pulse 1.5s ease-in-out infinite; }
@keyframes nt-pulse { 0%,100%{opacity:1;} 50%{opacity:0.6;} }

#pg-tracker {
    position: fixed;
    z-index: 7999;
    min-width: 220px;
    min-height: 85px;
    font-family: 'Cinzel', serif;
    border-radius: 8px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.7);
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
#pg-tracker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: grab;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
#pg-tracker-header:active { cursor: grabbing; }
#pg-tracker-body {
    max-height: 240px;
    overflow-y: auto;
    padding: 6px 4px;
    font-family: monospace;
    font-size: 12px;
}
#pg-tracker-body::-webkit-scrollbar { width: 4px; }
#pg-tracker-body::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.2); border-radius: 2px; }
#pg-tracker-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.3);
    flex-wrap: wrap;
}
#pg-tracker-toolbar label { font-size: 10px; opacity: 0.7; }
#pg-resize-handle {
    position: absolute;
    bottom: 0; right: 0;
    width: 14px; height: 14px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.25) 60%);
    border-bottom-right-radius: 8px;
}

.pg-row {
    display: flex;
    gap: 6px;
    align-items: flex-start;
    padding: 6px 8px;
    border-radius: 5px;
    margin-bottom: 4px;
    background: rgba(255,255,255,0.05);
    border-left: 3px solid transparent;
}
.pg-row:hover { background: rgba(255,255,255,0.1); }
.pg-icon { font-size: 15px; margin-top: 1px; flex-shrink: 0; }
.pg-details { flex: 1; min-width: 0; }
.pg-title { font-size: 10px; font-weight: bold; text-transform: uppercase; letter-spacing: 0.4px; }
.pg-meta { font-size: 11px; opacity: 0.92; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-village { font-size: 10px; opacity: 0.7; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pg-countdown {
    font-size: 12px;
    font-weight: bold;
    color: #9fe2ff;
    min-width: 56px;
    text-align: right;
    font-family: 'Courier New', monospace;
}
.pg-countdown.urgent { color: #ffb74d; }
.pg-empty { text-align: center; padding: 16px 8px; opacity: 0.5; font-size: 12px; font-family: sans-serif; }

#rs-tracker {
    position: fixed;
    z-index: 7998;
    min-width: 220px;
    min-height: 90px;
    font-family: 'Cinzel', serif;
    border-radius: 8px;
    box-shadow: 0 6px 30px rgba(0,0,0,0.7);
    overflow: hidden;
    touch-action: none;
    user-select: none;
}
#rs-tracker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 10px;
    font-size: 11px;
    font-weight: bold;
    letter-spacing: 1px;
    text-transform: uppercase;
    cursor: grab;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    flex-shrink: 0;
}
#rs-tracker-header:active { cursor: grabbing; }
#rs-tracker-body {
    max-height: 255px;
    overflow-y: auto;
    padding: 6px 8px 8px 8px;
    font-family: monospace;
    font-size: 12px;
}
#rs-tracker-toolbar {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 5px 8px;
    border-top: 1px solid rgba(255,255,255,0.1);
    background: rgba(0,0,0,0.3);
    flex-wrap: wrap;
}
#rs-tracker-toolbar label { font-size: 10px; opacity: 0.7; }
#rs-resize-handle {
    position: absolute;
    bottom: 0; right: 0;
    width: 14px; height: 14px;
    cursor: se-resize;
    background: linear-gradient(135deg, transparent 60%, rgba(255,255,255,0.25) 60%);
    border-bottom-right-radius: 8px;
}

.tracker-editing-ring { outline: 2px dashed #ffd700 !important; }
.rs-row { margin-bottom: 7px; }
.rs-row-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 11px;
    margin-bottom: 3px;
}
.rs-label { opacity: 0.9; }
.rs-value { color: #f6f7f2; font-weight: bold; }
.rs-ph { font-size: 9px; opacity: 0.65; color: #8bc34a; text-align: right; margin-top: 1px; min-height: 11px; }
.rs-bar-wrap {
    width: 100%;
    height: 5px;
    border-radius: 3px;
    overflow: hidden;
    background: rgba(255,255,255,0.12);
}
.rs-bar {
    width: 0%;
    height: 100%;
    transition: width 0.5s linear;
    background: linear-gradient(to right, #4caf50, #8bc34a);
}

/* ══ Event Calendar Widget ══════════════════════════════════════════════ */
.event-cal-btn {
    position: relative;
    font-size: 1rem;
    letter-spacing: .03em;
}
.ec-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    background: #e53935;
    color: #fff;
    font-size: .62rem;
    font-weight: 700;
    border-radius: 50%;
    min-width: 14px;
    height: 14px;
    line-height: 14px;
    text-align: center;
    padding: 0 3px;
    pointer-events: none;
}
.ec-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 9800;
    display: flex;
    align-items: flex-end;
    justify-content: flex-end;
    padding: 0 12px 64px 0;
}
.ec-modal-inner {
    background: #111009;
    border: 1px solid #5a4a1e;
    border-radius: 12px 12px 4px 12px;
    width: 360px;
    max-height: 72vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 32px rgba(0,0,0,.8);
}
.ec-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1a1508;
    border-bottom: 1px solid #3a2e10;
    flex-shrink: 0;
}
.ec-modal-header h3 {
    color: #ffd700;
    font-size: 1rem;
    margin: 0;
}
.ec-close-btn {
    background: none;
    border: none;
    color: #888;
    font-size: 1.1rem;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
}
.ec-close-btn:hover { color: #ffd700; background: rgba(255,215,0,.08); }
#ec-modal-body {
    overflow-y: auto;
    padding: 12px;
    flex: 1;
    color: #bbb;
    font-size: .85rem;
}
.ec-event-card {
    background: #1a1810;
    border: 1px solid #3a3020;
    border-radius: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
}
.ec-event-card:last-child { margin-bottom: 0; }
.ec-event-card-title {
    color: #ffd700;
    font-weight: 700;
    font-size: .9rem;
    margin-bottom: 4px;
    display: flex;
    align-items: center;
    gap: 6px;
}
.ec-event-type-badge {
    font-size: .7rem;
    font-weight: 600;
    background: #2a2010;
    color: #ffd700;
    border: 1px solid #5a4a1e;
    border-radius: 4px;
    padding: 1px 5px;
    text-transform: uppercase;
}
.ec-countdown {
    color: #aaa;
    font-size: .78rem;
    margin-bottom: 4px;
}
.ec-countdown span { color: #e09a10; font-weight: 600; }
.ec-reward-preview {
    color: #888;
    font-size: .76rem;
    margin-bottom: 8px;
}
.ec-join-btn {
    display: inline-block;
    padding: 5px 14px;
    background: #c8860a;
    color: #000;
    border: none;
    border-radius: 5px;
    font-size: .8rem;
    font-weight: 700;
    cursor: pointer;
    text-decoration: none;
}
.ec-preview-modal {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.72);
    z-index: 9850;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.ec-preview-inner {
    width: min(680px, 96vw);
    max-height: 86vh;
    height: min(86vh, 860px);
    background: #111009;
    border: 1px solid #5a4a1e;
    border-radius: 12px;
    box-shadow: 0 10px 36px rgba(0,0,0,.84);
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.ec-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    background: #1a1508;
    border-bottom: 1px solid #3a2e10;
}
.ec-preview-header h3 {
    margin: 0;
    color: #ffd700;
    font-size: 1rem;
}
.ec-preview-tabs {
    display: flex;
    gap: 8px;
    padding: 10px 12px;
    border-bottom: 1px solid #2f2612;
    background: #151109;
}
.ec-preview-tab {
    padding: 6px 12px;
    border-radius: 6px;
    border: 1px solid #4d3e17;
    background: #1e170a;
    color: #c8a548;
    cursor: pointer;
    font-size: .82rem;
    font-weight: 700;
}
.ec-preview-tab.active {
    background: #c8860a;
    color: #111;
    border-color: #e6a01a;
}
.ec-preview-meta {
    color: #9d8a56;
    font-size: .78rem;
    padding: 8px 14px;
    border-bottom: 1px solid #2b220f;
}
.ec-preview-content {
    padding: 12px 14px;
    overflow-y: auto;
    color: #bbb;
    font-size: .85rem;
    line-height: 1.45;
    max-height: 48vh;
}
.ec-preview-inner.oasis-preview .ec-preview-meta,
.ec-preview-inner.oasis-preview .ec-preview-footer {
    display: none;
}
.ec-preview-inner.oasis-preview .ec-preview-content {
    flex: 1;
    max-height: none;
    overflow: hidden;
    padding: 10px;
}
.ec-preview-inner.oasis-preview #ec-preview-content-details,
.ec-preview-inner.oasis-preview #ec-preview-content-overview {
    display: flex;
}
.ec-preview-inner.oasis-preview .ec-preview-embed-wrap {
    height: 100%;
}
.ec-preview-embed-wrap {
    width: 100%;
    border: 1px solid #2f2615;
    border-radius: 8px;
    overflow: hidden;
    background: #0e0b06;
}
.ec-preview-iframe {
    width: 100%;
    min-height: 42vh;
    border: none;
    background: #0e0b06;
    display: block;
}
.ec-preview-inner.oasis-preview .ec-preview-iframe {
    height: 100%;
    min-height: 100%;
}
.ec-preview-section-title {
    color: #ffd700;
    font-size: .86rem;
    margin: 0 0 4px;
    font-weight: 700;
}
.ec-preview-section {
    background: #1a1810;
    border: 1px solid #3a3020;
    border-radius: 8px;
    padding: 10px;
    margin-bottom: 10px;
}
.ec-preview-lb-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .82rem;
}
.ec-preview-lb-table th,
.ec-preview-lb-table td {
    padding: 6px 8px;
    border-bottom: 1px solid #2f2615;
}
.ec-preview-lb-table th {
    color: #d4a843;
    text-align: left;
}
.ec-preview-footer {
    border-top: 1px solid #2b220f;
    padding: 10px 14px;
    display: flex;
    justify-content: flex-end;
    background: #151109;
}
.ec-join-btn:hover { background: #e09a10; }
.ec-empty { text-align: center; color: #555; padding: 24px 0; font-size: .9rem; }
