        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: Georgia, 'Courier New', monospace;
            background: linear-gradient(180deg, #2b2218 0%, #1a1410 100%);
            color: #eadfc2;
            display: flex;
            flex-direction: column;
            min-height: 100vh;
            margin: 0;
        }

        header {
            background: linear-gradient(180deg, #3e3827 0%, #2f2a1c 100%);
            border-bottom: 2px solid #d4af37;
            padding: 15px 30px;
            display: flex;
            justify-content: space-between;
            align-items: center;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
        }

        .logo {
            font-family: 'Press Start 2P', cursive;
            color: #d4af37;
            font-size: 18px;
            text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
            margin: 0;
        }

        nav a {
            color: #f2d17b;
            text-decoration: none;
            margin: 0 20px;
            font-size: 13px;
            font-weight: bold;
            transition: color 0.3s;
            border-bottom: 2px solid transparent;
            padding-bottom: 2px;
        }

        nav a:hover {
            color: #d4af37;
            border-bottom-color: #d4af37;
        }

        main {
            display: flex;
            flex: 1;
            gap: 0;
            padding: 0;
            width: 100%;
            flex-wrap: nowrap;
            align-items: stretch;
            justify-content: flex-start;
        }

        #main-content {
            display: flex;
            flex-direction: column;
            gap: 15px;
            flex: 1;
            padding: 20px 30px;
            width: 100%;
        }

        #game-content-wrapper {
            display: flex;
            gap: 20px;
            align-items: flex-start;
            flex: 1;
        }

        #game-and-sidebar {
            display: flex;
            gap: 20px;
            align-items: flex-start;
        }

        #sidebar {
            width: 350px;
            display: flex;
            flex-direction: column;
            gap: 20px;
            flex-shrink: 0;
        }

        .sidebar-panel {
            background: linear-gradient(135deg, rgba(78, 70, 48, 0.95) 0%, rgba(62, 56, 39, 0.95) 100%);
            border: 2px solid #5f533d;
            border-radius: 4px;
            padding: 15px;
            color: #eadfc2;
            box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.5), 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        .sidebar-panel h3 {
            color: #d4af37;
            margin: 0 0 12px 0;
            font-size: 14px;
            text-transform: uppercase;
            letter-spacing: 1px;
            border-bottom: 1px solid #5f533d;
            padding-bottom: 8px;
            font-family: Georgia, serif;
        }

        .news-item {
            padding: 10px 0;
            border-bottom: 1px solid rgba(95, 83, 61, 0.5);
            font-size: 12px;
            line-height: 1.4;
        }

        .news-item:last-child {
            border-bottom: none;
        }

        .news-date {
            color: #f2d17b;
            font-size: 11px;
            font-weight: bold;
        }

        .info-row {
            display: flex;
            justify-content: space-between;
            padding: 6px 0;
            font-size: 13px;
        }

        .info-label {
            color: #c7b487;
        }

        .info-value {
            color: #f2d17b;
            font-weight: bold;
        }

        .server-status {
            display: inline-block;
            width: 8px;
            height: 8px;
            border-radius: 50%;
            background-color: #2ecc71;
            margin-right: 6px;
        }

        footer {
            background: linear-gradient(180deg, #2f2a1c 0%, #1a1410 100%);
            border-top: 2px solid #d4af37;
            padding: 20px 30px;
            text-align: center;
            color: #c7b487;
            font-size: 12px;
            margin-top: auto;
        }

        footer a {
            color: #f2d17b;
            text-decoration: none;
            margin: 0 15px;
            transition: color 0.3s;
        }

        footer a:hover {
            color: #d4af37;
        }

        h1 {
            font-family: 'Press Start 2P', cursive;
            margin-bottom: 20px;
            color: #f39c12;
            font-size: 24px;
            text-shadow: 3px 3px 0px #c0392b, 6px 6px 10px rgba(0,0,0,0.5);
            animation: pulse 2s ease-in-out infinite;
        }

        @keyframes pulse {
            0%, 100% { transform: scale(1); }
            50% { transform: scale(1.02); }
        }

        #game-container {
            display: flex;
            gap: 0;
            margin-bottom: 0;
            animation: slideIn 0.5s ease-out;
            position: relative;
            flex-shrink: 0;
        }

        #game-area {
            display: flex;
            gap: 15px;
            align-items: flex-start;
            flex-shrink: 0;
        }

        #game-controls-panel {
            display: flex;
            flex-direction: column;
            gap: 10px;
            padding: 12px;
            background: linear-gradient(135deg, rgba(78, 70, 48, 0.9) 0%, rgba(62, 56, 39, 0.9) 100%);
            border: 1px solid #5f533d;
            border-radius: 4px;
            box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.3);
            width: 80px;
            flex-shrink: 0;
        }

        .game-control-btn {
            width: 100%;
            padding: 12px;
            background: linear-gradient(135deg, #5f533d 0%, #4b4438 100%);
            color: #f2d17b;
            border: 1px solid #d4af37;
            border-radius: 3px;
            cursor: pointer;
            font-weight: bold;
            font-size: 20px;
            transition: all 0.3s;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .game-control-btn:hover {
            background: linear-gradient(135deg, #6b5f47 0%, #574f3f 100%);
            box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
            color: #d4af37;
        }

        @keyframes slideIn {
            from { opacity: 0; transform: translateY(20px); }
            to { opacity: 1; transform: translateY(0); }
        }

        #game-canvas {
            border: 4px solid #34495e;
            box-shadow: 0 8px 32px rgba(0,0,0,0.5),
                        inset 0 0 20px rgba(52, 152, 219, 0.1);
            background-color: #27ae60;
            image-rendering: pixelated;
            image-rendering: crisp-edges;
            cursor: crosshair;
            transition: box-shadow 0.3s;
        }

        #game-canvas:hover {
            box-shadow: 0 8px 32px rgba(52, 152, 219, 0.6),
                        inset 0 0 30px rgba(52, 152, 219, 0.2);
        }

        #canvas-wrap {
            position: relative;
            width: 1024px;
            height: 768px;
        }

        #ui-panel {
            background: linear-gradient(135deg, rgba(52, 73, 94, 0.9) 0%, rgba(44, 62, 80, 0.9) 100%);
            backdrop-filter: blur(10px);
            padding: 20px;
            border-radius: 12px;
            width: 320px;
            max-height: 600px;
            overflow-y: auto;
            border: 2px solid rgba(52, 152, 219, 0.3);
            box-shadow: 0 8px 32px rgba(0,0,0,0.5);
        }

        #ui-panel::-webkit-scrollbar {
            width: 8px;
        }

        #ui-panel::-webkit-scrollbar-track {
            background: rgba(0,0,0,0.2);
            border-radius: 4px;
        }

        #ui-panel::-webkit-scrollbar-thumb {
            background: rgba(52, 152, 219, 0.5);
            border-radius: 4px;
        }

        #ui-panel::-webkit-scrollbar-thumb:hover {
            background: rgba(52, 152, 219, 0.8);
        }

        .stat-section {
            margin-bottom: 18px;
            padding: 14px;
            background: linear-gradient(135deg, rgba(44, 62, 80, 0.8) 0%, rgba(26, 42, 60, 0.8) 100%);
            border-radius: 8px;
            border: 1px solid rgba(52, 152, 219, 0.2);
            transition: all 0.3s;
        }

        .stat-section:hover {
            border-color: rgba(52, 152, 219, 0.5);
            transform: translateY(-2px);
            box-shadow: 0 4px 12px rgba(52, 152, 219, 0.2);
        }

        .stat-section h3 {
            color: #3498db;
            margin-bottom: 10px;
            font-size: 14px;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 1px;
            border-bottom: 2px solid rgba(52, 152, 219, 0.3);
            padding-bottom: 6px;
        }

        .stat-item {
            display: flex;
            justify-content: space-between;
            margin: 8px 0;
            font-size: 13px;
            padding: 4px 0;
        }

        .stat-item span:first-child {
            color: #bdc3c7;
        }

        .stat-item span:last-child {
            color: #f39c12;
            font-weight: bold;
        }

        .skill-icon {
            width: 16px;
            height: 16px;
            vertical-align: middle;
            image-rendering: pixelated;
            margin-right: 2px;
        }

        .skills-drilldown {
            display: grid;
            grid-template-columns: repeat(3, minmax(0, 1fr));
            gap: 8px;
            align-items: start;
        }

        .skills-panel {
            border: 1px solid rgba(95, 83, 61, 0.55);
            border-radius: 6px;
            background: rgba(26, 20, 12, 0.38);
            padding: 6px;
            min-width: 0;
        }

        .skills-panel-title {
            color: #f2d17b;
            font-size: 11px;
            font-weight: bold;
            text-transform: uppercase;
            letter-spacing: 0.5px;
            margin-bottom: 6px;
        }

        .skills-node {
            width: 100%;
            display: flex;
            justify-content: space-between;
            align-items: center;
            gap: 8px;
            border: 1px solid rgba(95, 83, 61, 0.45);
            border-radius: 4px;
            background: rgba(0, 0, 0, 0.22);
            color: #eadfc2;
            padding: 6px 8px;
            margin-bottom: 4px;
            font-size: 12px;
            text-align: left;
            cursor: pointer;
        }

        .skills-node:last-child {
            margin-bottom: 0;
        }

        .skills-node:hover {
            background: rgba(242, 209, 123, 0.12);
            border-color: rgba(242, 209, 123, 0.45);
        }

        .skills-node.active {
            background: rgba(242, 209, 123, 0.18);
            border-color: rgba(242, 209, 123, 0.75);
        }

        .skills-node.static {
            cursor: default;
        }

        .skills-node.static:hover {
            background: rgba(0, 0, 0, 0.22);
            border-color: rgba(95, 83, 61, 0.45);
        }

        .skills-node-name {
            color: #d8c7a1;
            min-width: 0;
        }

        .skills-node-value {
            color: #f2d17b;
            font-weight: bold;
            font-size: 11px;
            white-space: normal;
            text-align: right;
        }

        .skills-empty {
            color: #ab9a79;
            font-size: 11px;
            line-height: 1.35;
            padding: 8px;
            border: 1px dashed rgba(95, 83, 61, 0.45);
            border-radius: 4px;
        }

        @media (max-width: 1200px) {
            .skills-drilldown {
                grid-template-columns: 1fr;
            }
        }

        .skill-bar-container {
            background-color: rgba(0,0,0,0.3);
            height: 16px;
            border-radius: 8px;
            overflow: hidden;
            margin-top: 4px;
            border: 1px solid rgba(255,255,255,0.1);
        }

        .skill-bar {
            height: 100%;
            background: linear-gradient(90deg, #3498db 0%, #2ecc71 100%);
            transition: width 0.5s ease;
            box-shadow: 0 0 10px rgba(46, 204, 113, 0.5);
        }

        #chat-box {
            background-color: rgba(0,0,0,0.3);
            padding: 10px;
            border-radius: 6px;
            height: 150px;
            overflow-y: auto;
            font-size: 11px;
            border: 1px solid rgba(52, 152, 219, 0.2);
        }

        #chat-box::-webkit-scrollbar {
            width: 6px;
        }

        #chat-box::-webkit-scrollbar-track {
            background: rgba(0,0,0,0.2);
        }

        #chat-box::-webkit-scrollbar-thumb {
            background: rgba(52, 152, 219, 0.5);
            border-radius: 3px;
        }

        .chat-message {
            margin: 4px 0;
            padding: 3px 6px;
            border-radius: 3px;
            background-color: rgba(255,255,255,0.05);
        }

        .system-message {
            color: #f39c12;
            font-style: italic;
            background-color: rgba(243, 156, 18, 0.1);
        }

        #status {
            margin-bottom: 20px;
            padding: 12px 24px;
            background: linear-gradient(135deg, #2ecc71 0%, #27ae60 100%);
            border-radius: 4px;
            text-align: center;
            font-weight: bold;
            box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
            animation: statusPulse 2s ease-in-out infinite;
            border: 1px solid #2ecc71;
            color: #fff;
            font-size: 13px;
        }

        @keyframes statusPulse {
            0%, 100% { box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4); }
            50% { box-shadow: 0 4px 20px rgba(46, 204, 113, 0.6); }
        }

        #status.disconnected {
            background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
            box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
            animation: none;
            border-color: #e74c3c;
        }

        #login-screen {
            position: absolute;
            inset: 0;
            display: flex;
            align-items: center;
            justify-content: center;
            z-index: 100;
            animation: fadeIn 0.5s;
        }

        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }

        #login-screen.hidden {
            display: none;
        }

        #login-form {
            background: linear-gradient(135deg, rgba(52, 73, 94, 0.95) 0%, rgba(44, 62, 80, 0.95) 100%);
            padding: 40px;
            border-radius: 20px;
            text-align: center;
            border: 3px solid rgba(52, 152, 219, 0.5);
            box-shadow: 0 20px 60px rgba(0,0,0,0.7);
            animation: popIn 0.6s ease-out;
        }

        @keyframes popIn {
            from { transform: scale(0.8); opacity: 0; }
            to { transform: scale(1); opacity: 1; }
        }

        #login-form h2 {
            margin-bottom: 30px;
            color: #3498db;
            font-family: 'Press Start 2P', cursive;
            font-size: 20px;
            text-shadow: 2px 2px 4px rgba(0,0,0,0.5);
        }

        #login-form input {
            width: 300px;
            padding: 14px;
            margin-bottom: 20px;
            border: 2px solid rgba(52, 152, 219, 0.5);
            border-radius: 8px;
            font-size: 16px;
            font-family: 'Courier New', monospace;
            background-color: rgba(0,0,0,0.3);
            color: #ecf0f1;
            transition: all 0.3s;
        }

        #login-form input:focus {
            outline: none;
            border-color: #3498db;
            box-shadow: 0 0 20px rgba(52, 152, 219, 0.5);
            background-color: rgba(0,0,0,0.5);
        }

        #login-form input::placeholder {
            color: rgba(236, 240, 241, 0.5);
        }

        #login-form button {
            width: 300px;
            padding: 14px;
            background: linear-gradient(135deg, #3498db 0%, #2980b9 100%);
            color: white;
            border: none;
            border-radius: 8px;
            font-size: 16px;
            font-weight: bold;
            cursor: pointer;
            font-family: 'Courier New', monospace;
            transition: all 0.3s;
            box-shadow: 0 4px 15px rgba(52, 152, 219, 0.4);
        }

        #login-form button:hover {
            background: linear-gradient(135deg, #2980b9 0%, #1c5a85 100%);
            transform: translateY(-2px);
            box-shadow: 0 6px 20px rgba(52, 152, 219, 0.6);
        }

        #login-form button:active {
            transform: translateY(0);
        }

        #controls {
            margin-top: 15px;
            padding: 16px 24px;
            background: linear-gradient(135deg, rgba(78, 70, 48, 0.9) 0%, rgba(62, 56, 39, 0.9) 100%);
            border-radius: 4px;
            text-align: center;
            border: 2px solid #5f533d;
            box-shadow: inset 0 0 10px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(0, 0, 0, 0.3);
        }

        #controls p {
            margin: 6px 0;
            font-size: 13px;
            color: #eadfc2;
        }

        #controls strong {
            color: #f2d17b;
        }

        #controls button {
            background: linear-gradient(135deg, #5f533d 0%, #4b4438 100%);
            color: #f2d17b;
            border: 1px solid #d4af37;
            padding: 8px 16px;
            margin: 5px;
            border-radius: 3px;
            cursor: pointer;
            font-weight: bold;
            font-size: 12px;
            transition: all 0.3s;
        }

        #controls button:hover {
            background: linear-gradient(135deg, #6b5f47 0%, #574f3f 100%);
            box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
            color: #d4af37;
        }

        .player-list-item {
            padding: 6px 10px;
            margin: 4px 0;
            background-color: rgba(52, 152, 219, 0.1);
            border-radius: 6px;
            border-left: 3px solid #3498db;
            transition: all 0.3s;
        }

        .player-list-item:hover {
            background-color: rgba(52, 152, 219, 0.2);
            transform: translateX(4px);
        }

        #click-indicator {
            position: absolute;
            pointer-events: none;
            width: 20px;
            height: 20px;
            border: 2px solid #f39c12;
            border-radius: 50%;
            animation: clickPing 0.6s ease-out;
            opacity: 0;
        }

        @keyframes clickPing {
            0% {
                transform: scale(0.5);
                opacity: 1;
            }
            100% {
                transform: scale(2);
                opacity: 0;
            }
        }

        #map-toggle-btn {
            margin-top: 12px;
            padding: 10px 18px;
            border: none;
            border-radius: 8px;
            color: #ffffff;
            font-weight: bold;
            cursor: pointer;
            font-family: 'Courier New', monospace;
            background: linear-gradient(135deg, #16a085 0%, #117864 100%);
            box-shadow: 0 4px 12px rgba(22, 160, 133, 0.4);
        }

        #map-toggle-btn:hover {
            background: linear-gradient(135deg, #149174 0%, #0f6a58 100%);
        }

        #map-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.65);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 2000;
            backdrop-filter: blur(4px);
        }

        #map-modal.visible {
            display: flex;
        }

        #map-panel {
            background: linear-gradient(135deg, rgba(44, 62, 80, 0.96) 0%, rgba(26, 42, 60, 0.96) 100%);
            border: 2px solid rgba(52, 152, 219, 0.5);
            border-radius: 12px;
            padding: 14px;
            box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6);
        }

        #map-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
        }

        #map-header h3 {
            color: #ecf0f1;
            font-size: 14px;
            margin: 0;
        }

        #map-close-btn {
            border: none;
            border-radius: 6px;
            padding: 6px 10px;
            cursor: pointer;
            color: #fff;
            font-weight: bold;
            background: #c0392b;
        }

        #map-canvas {
            border: 2px solid rgba(52, 152, 219, 0.4);
            border-radius: 8px;
            background: #2f4f2f;
            image-rendering: pixelated;
            image-rendering: crisp-edges;
        }

        #trade-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.65);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 2100;
            backdrop-filter: blur(4px);
        }

        #trade-modal.visible {
            display: flex;
        }

        #trade-panel {
            width: 780px;
            max-width: 96vw;
            max-height: 90vh;
            display: flex;
            flex-direction: column;
            background: linear-gradient(160deg, rgba(44, 38, 28, 0.98) 0%, rgba(30, 25, 18, 0.98) 100%);
            border: 2px solid rgba(180, 150, 80, 0.5);
            border-radius: 10px;
            box-shadow: 0 24px 70px rgba(0, 0, 0, 0.75), inset 0 1px 0 rgba(255, 220, 120, 0.1);
            overflow: hidden;
        }

        #trade-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 12px 16px 10px;
            background: linear-gradient(180deg, rgba(90, 72, 35, 0.6) 0%, rgba(50, 40, 20, 0.4) 100%);
            border-bottom: 1px solid rgba(180, 150, 80, 0.3);
            flex-shrink: 0;
        }

        #trade-header h3 {
            margin: 0;
            font-size: 15px;
            color: #f0d070;
            font-family: Georgia, serif;
            letter-spacing: 0.03em;
        }

        #trade-close-btn {
            border: 1px solid rgba(180, 150, 80, 0.4);
            border-radius: 5px;
            padding: 4px 10px;
            cursor: pointer;
            color: #e8d4a0;
            font-weight: bold;
            font-size: 13px;
            background: rgba(100, 40, 30, 0.7);
            flex-shrink: 0;
        }
        #trade-close-btn:hover { background: rgba(150, 50, 35, 0.8); }

        #trade-gold {
            padding: 6px 16px;
            font-size: 12px;
            color: #c8b870;
            background: rgba(0,0,0,0.2);
            border-bottom: 1px solid rgba(180, 150, 80, 0.15);
            flex-shrink: 0;
            display: flex;
            gap: 16px;
        }

        #trade-gold span { color: #f0d070; font-weight: bold; }

        #trade-items {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 8px;
            padding: 12px;
            overflow-y: auto;
            flex: 1;
        }

        #trade-items::-webkit-scrollbar { width: 6px; }
        #trade-items::-webkit-scrollbar-track { background: rgba(0,0,0,0.2); }
        #trade-items::-webkit-scrollbar-thumb { background: rgba(180,150,80,0.4); border-radius: 3px; }

        .shop-card {
            display: flex;
            flex-direction: column;
            align-items: center;
            background: linear-gradient(180deg, rgba(60, 52, 35, 0.7) 0%, rgba(40, 34, 22, 0.7) 100%);
            border: 1px solid rgba(140, 115, 55, 0.35);
            border-radius: 7px;
            padding: 8px 6px 7px;
            cursor: default;
            transition: border-color 0.15s, background 0.15s;
            gap: 4px;
        }
        .shop-card:hover {
            border-color: rgba(200, 170, 80, 0.65);
            background: linear-gradient(180deg, rgba(75, 65, 40, 0.8) 0%, rgba(55, 45, 28, 0.8) 100%);
        }

        .shop-card-icon {
            width: 44px;
            height: 44px;
            display: flex;
            align-items: center;
            justify-content: center;
            background: rgba(0,0,0,0.25);
            border: 1px solid rgba(140,115,55,0.25);
            border-radius: 5px;
            overflow: hidden;
            flex-shrink: 0;
        }
        .shop-card-icon img {
            width: 38px;
            height: 38px;
            object-fit: contain;
            image-rendering: pixelated;
        }
        .shop-card-icon .icon-emoji {
            font-size: 24px;
            line-height: 1;
        }

        .shop-card-name {
            font-size: 10px;
            font-weight: bold;
            color: #e8d4a0;
            text-align: center;
            line-height: 1.2;
            min-height: 24px;
            display: flex;
            align-items: center;
            justify-content: center;
        }

        .shop-card-owned {
            font-size: 9px;
            color: #8aaa6a;
            text-align: center;
        }
        .shop-card-owned.none { color: #776655; }

        .shop-card-prices {
            display: flex;
            gap: 5px;
            font-size: 9px;
            color: #a09070;
            width: 100%;
            justify-content: center;
        }
        .shop-card-prices .buy-p { color: #7abf6a; }
        .shop-card-prices .sell-p { color: #6a9abf; }

        .shop-card-btns {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 3px;
            width: 100%;
            margin-top: 2px;
        }
        .shop-card-btns button {
            border: 1px solid rgba(100,80,40,0.6);
            border-radius: 4px;
            padding: 3px 0;
            cursor: pointer;
            font-size: 9px;
            font-weight: bold;
            color: #e8d4a0;
            line-height: 1.2;
            white-space: nowrap;
        }
        .trade-buy  { background: linear-gradient(180deg, #3a6e2a 0%, #2a5020 100%); }
        .trade-buy:hover  { filter: brightness(1.2); }
        .trade-sell { background: linear-gradient(180deg, #2a4e6e 0%, #1e3a54 100%); }
        .trade-sell:hover { filter: brightness(1.2); }

        #trade-message {
            padding: 6px 16px;
            font-size: 11px;
            color: #bdc3c7;
            min-height: 22px;
            text-align: center;
            background: rgba(0,0,0,0.2);
            border-top: 1px solid rgba(180,150,80,0.15);
            flex-shrink: 0;
        }

        #leaderboard-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.65);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 2200;
            backdrop-filter: blur(4px);
        }

        #leaderboard-modal.visible {
            display: flex;
        }

        #leaderboard-panel {
            width: 520px;
            max-width: 94vw;
            max-height: 82vh;
            display: flex;
            flex-direction: column;
            background: linear-gradient(135deg, rgba(52, 73, 94, 0.97) 0%, rgba(30, 45, 60, 0.97) 100%);
            border: 2px solid rgba(241, 196, 15, 0.45);
            border-radius: 12px;
            padding: 14px;
            box-shadow: 0 20px 60px rgba(0, 0, 0, 0.65);
        }

        #leaderboard-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }

        #leaderboard-header h3 {
            margin: 0;
            font-size: 15px;
            color: #f1c40f;
        }

        #leaderboard-close-btn {
            border: none;
            border-radius: 6px;
            padding: 6px 10px;
            cursor: pointer;
            color: #fff;
            font-weight: bold;
            background: #c0392b;
        }

        #leaderboard-tabs {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 4px;
            margin-bottom: 8px;
        }

        .leaderboard-tab {
            border: 1px solid #2f2a1c;
            border-radius: 5px;
            font-size: 11px;
            padding: 6px 0;
            cursor: pointer;
            color: #f6e9c9;
            background: linear-gradient(180deg, #867957 0%, #65583a 100%);
        }

        .leaderboard-tab.active {
            background: linear-gradient(180deg, #a08f64 0%, #7a6947 100%);
            color: #fff2cf;
            box-shadow: inset 0 0 0 1px #d8c796;
        }

        #leaderboard-meta {
            font-size: 11px;
            color: #f2ddab;
            margin-bottom: 6px;
        }

        #leaderboard-table-wrap {
            overflow: auto;
            background: rgba(0, 0, 0, 0.22);
            border: 1px solid rgba(255, 255, 255, 0.12);
            border-radius: 8px;
        }

        #leaderboard-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 12px;
            color: #ecf0f1;
        }

        #leaderboard-table thead th {
            position: sticky;
            top: 0;
            background: rgba(48, 37, 18, 0.92);
            color: #f6e7be;
            text-align: left;
            padding: 8px 10px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.12);
        }

        #leaderboard-table tbody td {
            padding: 6px 10px;
            border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        }

        #leaderboard-table tbody tr:nth-child(even) {
            background: rgba(255, 255, 255, 0.04);
        }

        #economy-modal {
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background: rgba(0, 0, 0, 0.65);
            display: none;
            align-items: center;
            justify-content: center;
            z-index: 2150;
            backdrop-filter: blur(4px);
        }

        #economy-modal.visible {
            display: flex;
        }

        #economy-panel {
            width: 640px;
            max-width: 95vw;
            max-height: 85vh;
            overflow: auto;
            border: 2px solid rgba(241, 196, 15, 0.45);
            border-radius: 12px;
            padding: 12px;
            background: linear-gradient(180deg, #3f3826 0%, #2b261a 100%);
            color: #f6e9c9;
        }

        #economy-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 8px;
        }

        #economy-header h3 {
            margin: 0;
            color: #f1c40f;
            font-size: 16px;
        }

        #economy-close-btn {
            width: auto;
            padding: 6px 10px;
        }

        #economy-actions {
            display: flex;
            gap: 8px;
            margin-bottom: 10px;
        }

        #economy-meta {
            margin-bottom: 10px;
            font-size: 12px;
            color: #f5e7bf;
        }

        .economy-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 10px;
        }

        .economy-card {
            border: 1px solid rgba(255, 255, 255, 0.16);
            border-radius: 8px;
            padding: 8px;
            background: rgba(255,255,255,0.05);
        }

        .economy-card h4 {
            margin: 0 0 6px 0;
            font-size: 13px;
            color: #ffeeb8;
        }

        .economy-table {
            width: 100%;
            border-collapse: collapse;
            font-size: 12px;
        }

        .economy-table th,
        .economy-table td {
            text-align: left;
            padding: 4px 6px;
            border-bottom: 1px solid rgba(255,255,255,0.08);
        }

        .contract-list {
            display: flex;
            flex-direction: column;
            gap: 6px;
            max-height: 240px;
            overflow: auto;
        }

        .contract-item {
            border: 1px solid rgba(255,255,255,0.15);
            border-radius: 6px;
            padding: 6px;
            background: rgba(0,0,0,0.22);
            font-size: 12px;
        }

        .contract-item button {
            margin-top: 5px;
            width: auto;
            padding: 4px 8px;
        }

        #perf-counter {
            position: absolute;
            bottom: 8px;
            left: 8px;
            font-family: 'Courier New', monospace;
            font-size: 11px;
            color: rgba(255, 255, 255, 0.75);
            background: rgba(0, 0, 0, 0.45);
            padding: 2px 6px;
            border-radius: 3px;
            pointer-events: none;
            z-index: 30;
            line-height: 1.6;
            white-space: pre;
        }

        #minimap-container {
            position: absolute;
            top: 10px;
            right: 10px;
            width: 208px;
            height: 220px;
            background: linear-gradient(180deg, #7b7260 0%, #5f5746 100%);
            border: 2px solid #2f2a1c;
            box-shadow: inset 0 0 0 2px #9a8d74, 0 8px 18px rgba(0, 0, 0, 0.35);
            border-radius: 10px;
            padding: 8px 10px;
            z-index: 20;
        }

        #minimap-toggle-btn {
            position: absolute;
            top: 6px;
            left: 8px;
            z-index: 30;
            width: 24px;
            height: 22px;
            padding: 0;
            font-size: 13px;
            line-height: 1;
            border-radius: 6px;
            border: 1px solid #2f2a1c;
            background: linear-gradient(180deg, #7f7255 0%, #5f553f 100%);
            color: #f6e9c9;
            cursor: pointer;
        }

        #minimap-container.collapsed {
            width: 118px;
            height: 40px;
            padding: 6px 8px;
        }

        #minimap-container.collapsed #minimap-canvas,
        #minimap-container.collapsed #minimap-compass,
        #minimap-container.collapsed #minimap-orbs {
            display: none;
        }

        #minimap-canvas {
            width: 170px;
            height: 170px;
            border: 2px solid #2f2a1c;
            background: #4f7335;
            border-radius: 50%;
            display: block;
            margin: 0 auto;
            image-rendering: pixelated;
            image-rendering: crisp-edges;
            box-shadow: inset 0 0 0 2px #8f7f59;
        }

        #minimap-compass {
            margin-top: 8px;
            text-align: center;
            color: #f3e7c4;
            font-weight: bold;
            letter-spacing: 1px;
            font-size: 12px;
            text-shadow: 1px 1px #2f2a1c;
        }

        #minimap-orbs {
            position: absolute;
            right: -20px;
            top: 28px;
            display: flex;
            flex-direction: column;
            gap: 8px;
        }

        #subzone-label {
            position: absolute;
            top: 190px;
            right: 10px;
            background: rgba(0, 0, 0, 0.75);
            color: #f5eacb;
            padding: 6px 12px;
            border-radius: 4px;
            font-size: 13px;
            font-family: 'Georgia', serif;
            text-align: center;
            border: 1px solid rgba(255, 255, 255, 0.2);
            pointer-events: none;
            z-index: 100;
            box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
            transition: opacity 0.2s ease-in-out;
            white-space: nowrap;
            max-width: 200px;
            overflow: hidden;
            text-overflow: ellipsis;
        }

        #left-rail {
            position: absolute;
            left: 10px;
            top: 70px;
            display: flex;
            flex-direction: column;
            gap: 8px;
            z-index: 25;
        }

        .rail-btn {
            width: 42px;
            height: 42px;
            border-radius: 8px;
            border: 2px solid #2f2a1c;
            background: linear-gradient(180deg, #867957 0%, #65583a 100%);
            color: #f6e9c9;
            font-size: 18px;
            cursor: pointer;
        }

        .rail-btn:hover {
            background: linear-gradient(180deg, #938562 0%, #6f6041 100%);
        }

        #context-menu {
            position: fixed;
            display: none;
            min-width: 140px;
            background: linear-gradient(180deg, #3f3826 0%, #2b261a 100%);
            border: 1px solid #bfa574;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45);
            z-index: 3000;
            padding: 4px 0;
            border-radius: 4px;
            font-family: Georgia, "Times New Roman", serif;
        }

        .context-item {
            display: block;
            width: 100%;
            border: none;
            background: transparent;
            color: #f8e8be;
            text-align: left;
            padding: 6px 10px;
            cursor: pointer;
            font-size: 12px;
        }

        .context-item:hover {
            background: rgba(255, 215, 120, 0.22);
            color: #fff1cc;
        }

        /* OSRS-style visual override layer */
        body {
            font-family: Georgia, "Times New Roman", serif;
            background: linear-gradient(180deg, #5d543a 0%, #3e3827 100%);
            color: #1e1c14;
        }

        h1 {
            font-family: Georgia, "Times New Roman", serif;
            color: #f2d17b;
            text-shadow: 2px 2px 0 #3b2f14;
            letter-spacing: 1px;
        }

        #status {
            background: #6a603e;
            border: 2px solid #2f2a1c;
            color: #f0e6c8;
            box-shadow: inset 0 0 0 2px #8a7c52, 0 4px 12px rgba(0, 0, 0, 0.35);
            border-radius: 6px;
            animation: none;
        }

        #status.disconnected {
            background: #7a3f33;
        }

        #game-canvas {
            border: 4px solid #2f2a1c;
            box-shadow: inset 0 0 0 2px #8a7c52, 0 8px 28px rgba(0, 0, 0, 0.5);
            background-color: #4e6830;
            cursor: default;
            touch-action: none;
        }

        #ui-panel,
        #controls,
        #map-panel,
        #trade-panel,
        #login-form {
            background: linear-gradient(180deg, #c7b487 0%, #ad976a 100%);
            border: 2px solid #2f2a1c;
            box-shadow: inset 0 0 0 2px #e3d4ad, 0 10px 24px rgba(0, 0, 0, 0.35);
            color: #1f1b12;
            backdrop-filter: none;
        }

        .stat-section {
            background: linear-gradient(180deg, #d6c49a 0%, #baa274 100%);
            border: 1px solid #5b4f31;
            box-shadow: inset 0 0 0 1px #e9ddb9;
        }

        .stat-section h3 {
            color: #3c321e;
            border-bottom: 1px solid #6d5e3a;
        }

        .stat-item span:first-child {
            color: #3a311f;
        }

        .stat-item span:last-child {
            color: #2a2418;
        }

        #chat-box {
            background: #efe2bf;
            border: 1px solid #6d5e3a;
            color: #1f1b12;
        }

        #chat-input-row {
            margin-top: 8px;
            display: flex;
            gap: 6px;
        }

        #chat-input {
            flex: 1;
            padding: 7px 8px;
            border: 1px solid #6d5e3a;
            border-radius: 4px;
            background: #f6ebcd;
            color: #201a10;
            font-size: 12px;
            font-family: Georgia, "Times New Roman", serif;
        }

        #chat-send-btn {
            padding: 7px 10px;
            border: 1px solid #2f2a1c;
            border-radius: 4px;
            cursor: pointer;
            color: #f5eacb;
            background: linear-gradient(180deg, #786945 0%, #5b4f31 100%);
            font-family: Georgia, "Times New Roman", serif;
            font-size: 12px;
        }

        .chat-message {
            background-color: rgba(90, 70, 35, 0.11);
        }

        .system-message {
            color: #4a3b21;
            background-color: rgba(90, 70, 35, 0.16);
        }

        /* Chat Window (overlay in bottom left of canvas) */
        #chat-window {
            position: absolute;
            bottom: 10px;
            left: 10px;
            width: 320px;
            max-height: 350px;
            background: #efe2bf;
            border: 2px solid #6d5e3a;
            border-radius: 6px;
            display: flex;
            flex-direction: column;
            box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
            z-index: 50;
            transition: opacity 0.2s;
        }

        #chat-window.closed {
            display: none;
        }

        #chat-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 8px 10px;
            border-bottom: 1px solid #6d5e3a;
            background: linear-gradient(180deg, #a89968 0%, #9a8a5a 100%);
        }

        #chat-header h3 {
            margin: 0;
            font-size: 13px;
            color: #f5eacb;
            font-weight: bold;
        }

        #chat-toggle-btn {
            background: transparent;
            border: none;
            color: #f5eacb;
            cursor: pointer;
            font-size: 16px;
            padding: 0 4px;
            display: flex;
            align-items: center;
            justify-content: center;
            min-width: 24px;
            min-height: 24px;
        }

        #chat-toggle-btn:hover {
            color: #fff;
        }

        #chat-box {
            flex: 1;
            overflow-y: auto;
            padding: 8px;
            font-size: 11px;
            min-height: 200px;
            max-height: 250px;
        }

        #chat-input-row {
            padding: 6px;
            border-top: 1px solid #6d5e3a;
            display: flex;
            gap: 4px;
            background: #f6ebcd;
        }

        #chat-input {
            flex: 1;
            padding: 6px;
            border: 1px solid #8b7d5f;
            border-radius: 3px;
            background: #fff;
            color: #201a10;
            font-size: 11px;
            font-family: Georgia, serif;
        }

        #chat-send-btn {
            padding: 6px 8px;
            border: 1px solid #2f2a1c;
            border-radius: 3px;
            cursor: pointer;
            color: #f5eacb;
            background: linear-gradient(180deg, #786945 0%, #5b4f31 100%);
            font-family: Georgia, serif;
            font-size: 11px;
            min-width: 50px;
        }

        #chat-send-btn:hover {
            background: linear-gradient(180deg, #8b7856 0%, #6b5f3d 100%);
        }

        /* Chat tabs */
        #chat-tabs {
            display: flex;
            gap: 0;
            border-bottom: 1px solid #6d5e3a;
            background: #f6ebcd;
            padding: 0;
            margin: 0;
        }

        .chat-tab-btn {
            flex: 1;
            padding: 8px;
            border: none;
            background: #e8dbb8;
            color: #4a3f2a;
            cursor: pointer;
            font-size: 11px;
            font-family: Georgia, serif;
            font-weight: bold;
            border-bottom: 3px solid transparent;
            transition: all 0.2s;
        }

        .chat-tab-btn:hover {
            background: #dfd1a8;
        }

        .chat-tab-btn.active {
            background: #efe2bf;
            border-bottom-color: #a89968;
            color: #201a10;
        }

        /* Tab content */
        .chat-tab-content {
            display: none;
            flex: 1;
            overflow-y: auto;
            padding: 8px;
            font-size: 11px;
            min-height: 200px;
            max-height: 250px;
        }

        .chat-tab-content.active {
            display: flex;
            flex-direction: column;
        }

        #chat-tab {
            display: none;
            flex-direction: column;
        }

        #chat-tab.active {
            display: flex;
        }

        #chat-box {
            flex: 1;
            overflow-y: auto;
            margin-bottom: 0;
        }

        #social-tab {
            display: none;
            flex-direction: column;
        }

        #social-tab.active {
            display: flex;
        }

        #social-players-list {
            flex: 1;
            overflow-y: auto;
            padding: 8px 0;
        }

        .player-list-item {
            background-color: rgba(90, 70, 35, 0.13);
            border-left: 3px solid #6d5e3a;
            color: #2d2518;
        }

        .inventory-header-row {
            display: flex;
            justify-content: space-between;
            align-items: center;
            margin-bottom: 10px;
            font-size: 12px;
            color: #e6dbc1;
            letter-spacing: 0.2px;
        }

        .inventory-shell {
            position: relative;
            border: 2px solid #262117;
            border-radius: 12px;
            background:
                linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 35%),
                linear-gradient(180deg, #494338 0%, #343026 100%);
            box-shadow:
                inset 0 0 0 1px rgba(225, 207, 164, 0.3),
                inset 0 16px 24px rgba(0, 0, 0, 0.2),
                0 8px 18px rgba(0, 0, 0, 0.25);
            padding: 10px 14px 12px;
            overflow: hidden;
        }

        .inventory-side {
            position: absolute;
            top: 16px;
            bottom: 42px;
            width: 7px;
            border-radius: 6px;
            opacity: 0.8;
        }

        .inventory-side.inv-side-left {
            left: 5px;
            background: linear-gradient(180deg, #e17567 0%, #9a312a 100%);
            box-shadow: 0 0 0 1px rgba(40, 12, 8, 0.5);
        }

        .inventory-side.inv-side-right {
            right: 5px;
            background: linear-gradient(180deg, #8de9ed 0%, #2e9ca3 100%);
            box-shadow: 0 0 0 1px rgba(11, 40, 43, 0.5);
        }

        .inventory-grid {
            display: grid;
            grid-template-columns: repeat(4, 1fr);
            gap: 6px;
            padding: 0 10px;
        }

        .inventory-slot {
            height: 46px;
            border: 1px solid #2d281d;
            border-radius: 6px;
            background:
                linear-gradient(180deg, rgba(124, 111, 83, 0.14) 0%, rgba(46, 42, 33, 0.04) 100%),
                radial-gradient(circle at 35% 28%, #5a5346 0%, #3f3a32 65%, #2f2b25 100%);
            position: relative;
            display: flex;
            align-items: center;
            justify-content: center;
            user-select: none;
            box-shadow: inset 0 1px 0 rgba(221, 210, 180, 0.15);
        }

        .inventory-slot.empty {
            opacity: 0.25;
        }

        .inventory-slot.drag-over {
            outline: 2px solid #d9c38f;
            outline-offset: -2px;
        }

        .inventory-slot.equipped {
            border-color: #d5b66d;
            box-shadow:
                inset 0 0 0 1px rgba(250, 227, 165, 0.35),
                0 0 0 1px rgba(70, 54, 23, 0.7),
                0 0 10px rgba(237, 201, 114, 0.22);
        }

        .inventory-sprite {
            width: 30px;
            height: 30px;
            image-rendering: pixelated;
            filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.4));
        }

        .inventory-icon-fallback {
            display: none;
            font-size: 18px;
            line-height: 1;
        }

        .inventory-qty {
            position: absolute;
            right: 4px;
            bottom: 2px;
            font-size: 10px;
            font-weight: bold;
            color: #f4df9f;
            text-shadow: 0 1px 0 #000;
        }

        .inventory-equipped-badge {
            position: absolute;
            left: 3px;
            top: 2px;
            min-width: 11px;
            height: 11px;
            border-radius: 6px;
            padding: 0 3px;
            font-size: 8px;
            line-height: 11px;
            font-weight: bold;
            color: #2f2208;
            background: linear-gradient(180deg, #f6dc9b 0%, #d3ad58 100%);
            border: 1px solid rgba(52, 38, 13, 0.72);
            text-align: center;
            pointer-events: none;
            box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
        }

        .inventory-footer {
            display: grid;
            grid-template-columns: repeat(6, 1fr);
            gap: 6px;
            margin-top: 10px;
            padding: 0 10px;
        }

        .inv-chip {
            height: 20px;
            border-radius: 10px;
            border: 1px solid #2d281d;
            background: linear-gradient(180deg, #7f7255 0%, #5f553f 100%);
            box-shadow: inset 0 0 0 1px rgba(224, 206, 165, 0.25);
            opacity: 0.95;
        }

        #inventory-context-menu {
            position: fixed;
            display: none;
            min-width: 150px;
            background: linear-gradient(180deg, #3f3826 0%, #2b261a 100%);
            border: 1px solid #bfa574;
            box-shadow: 0 8px 16px rgba(0, 0, 0, 0.45);
            z-index: 3500;
            padding: 4px 0;
            border-radius: 4px;
            font-family: Georgia, "Times New Roman", serif;
        }

        #map-toggle-btn,
        #login-form button,
        #map-close-btn,
        #trade-close-btn,
        #leaderboard-close-btn,
        #economy-close-btn,
        #economy-refresh-btn,
        #economy-complete-btn {
            background: linear-gradient(180deg, #786945 0%, #5b4f31 100%);
            border: 1px solid #2f2a1c;
            box-shadow: inset 0 0 0 1px #9a8a5e;
            color: #f5eacb;
            font-family: Georgia, "Times New Roman", serif;
        }

        #map-toggle-btn:hover,
        #login-form button:hover,
        #map-close-btn:hover,
        #trade-close-btn:hover,
        #leaderboard-close-btn:hover,
        #economy-close-btn:hover,
        #economy-refresh-btn:hover,
        #economy-complete-btn:hover {
            background: linear-gradient(180deg, #86764e 0%, #675739 100%);
        }

        #ui-panel {
            position: absolute;
            right: 10px;
            bottom: 10px;
            width: 300px;
            max-height: 560px;
            z-index: 25;
            overflow: hidden;
        }

        #osrs-tabs {
            display: grid;
            grid-template-columns: repeat(5, 1fr);
            gap: 4px;
            margin-bottom: 8px;
        }

        .hud-tab {
            border: 1px solid #2f2a1c;
            background: linear-gradient(180deg, #867957 0%, #65583a 100%);
            color: #f6e9c9;
            border-radius: 5px;
            padding: 5px 0;
            font-size: 11px;
            cursor: pointer;
            text-align: center;
        }

        .hud-tab.active {
            background: linear-gradient(180deg, #a08f64 0%, #7a6947 100%);
            color: #fff2cf;
            box-shadow: inset 0 0 0 1px #d8c796;
        }

        .hud-section {
            display: none;
            max-height: 250px;
            overflow-y: auto;
            margin-bottom: 0;
        }

        .hud-section.active {
            display: block;
        }

        .hud-section[data-section="character"] {
            overflow: visible;
            max-height: none;
        }

        .hud-section[data-section="inventory"] {
            max-height: none;
            overflow: visible;
        }

        #mobile-dpad {
            display: none;
            position: fixed;
            bottom: 12px;
            left: 12px;
            z-index: 4000;
            grid-template-columns: 46px 46px 46px;
            grid-template-rows: 46px 46px 46px;
            gap: 6px;
            touch-action: manipulation;
        }

        .dpad-btn {
            border: 1px solid #2f2a1c;
            border-radius: 6px;
            background: linear-gradient(180deg, #867957 0%, #65583a 100%);
            color: #f6e9c9;
            font-size: 18px;
            line-height: 1;
            cursor: pointer;
        }

        .dpad-empty {
            visibility: hidden;
        }

        @media (max-width: 1200px) {
            #game-container {
                flex-direction: column;
                align-items: center;
            }

            #canvas-wrap {
                width: min(100vw - 20px, 1024px);
                height: auto;
            }

            #game-canvas {
                width: 100%;
                height: auto;
            }

            #ui-panel {
                position: static;
                width: min(96vw, 640px);
                max-height: 560px;
            }

            #left-hud-panel {
                left: 12px;
                top: 54px;
                width: min(94vw, 680px);
                max-height: 62vh;
            }
        }

        @media (max-width: 768px) {
            body {
                padding: 8px;
            }

            h1 {
                font-size: 16px;
                margin-bottom: 10px;
            }

            #status {
                margin-bottom: 10px;
                padding: 8px 10px;
            }

            #controls {
                width: 96vw;
                padding: 10px;
            }

            #controls p {
                font-size: 11px;
            }

            #minimap-container {
                width: 150px;
                height: 170px;
                right: 6px;
                top: 6px;
                padding: 6px;
            }

            #minimap-canvas {
                width: 130px;
                height: 130px;
            }

            #minimap-compass {
                margin-top: 4px;
                font-size: 11px;
            }

            #minimap-orbs {
                right: -14px;
                top: 22px;
            }

            .orb {
                width: 22px;
                height: 22px;
                font-size: 8px;
            }

            #left-rail {
                left: 6px;
                top: 52px;
            }

            .rail-btn {
                width: 34px;
                height: 34px;
                font-size: 14px;
            }

            #mobile-dpad {
                display: grid;
            }

            #leaderboard-panel {
                width: 96vw;
                max-height: 72vh;
                padding: 10px;
            }

            #leaderboard-tabs {
                grid-template-columns: repeat(3, 1fr);
            }

            .economy-grid {
                grid-template-columns: 1fr;
            }

            #left-hud-panel {
                left: 8px;
                top: 46px;
                width: calc(100vw - 16px);
                max-height: 60vh;
            }
        }

        /* Unified Adventure Realms UI skin */
        :root {
            --ui-frame-dark: #262117;
            --ui-frame-mid: #5f533d;
            --ui-surface-1: #4b4438;
            --ui-surface-2: #343026;
            --ui-text-main: #eadfc2;
            --ui-text-soft: #c5b792;
            --ui-shadow: rgba(0, 0, 0, 0.35);
        }

        #ui-panel,
        #controls,
        #map-panel,
        #trade-panel,
        #leaderboard-panel,
        #economy-panel,
        #login-form {
            border: 2px solid var(--ui-frame-dark);
            border-radius: 12px;
            background:
                linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 35%),
                linear-gradient(180deg, var(--ui-surface-1) 0%, var(--ui-surface-2) 100%);
            box-shadow:
                inset 0 0 0 1px rgba(215, 195, 144, 0.3),
                inset 0 12px 20px rgba(0, 0, 0, 0.18),
                0 10px 22px var(--ui-shadow);
            color: var(--ui-text-main);
        }

        #ui-panel {
            width: 320px;
            padding: 8px;
        }

        #inventory-panel-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
            padding: 4px 6px;
            border: 1px solid #6a5d42;
            border-radius: 8px;
            background: linear-gradient(180deg, #3e372d 0%, #2f2a22 100%);
        }

        #inventory-panel-header h3 {
            margin: 0;
            font-size: 14px;
            color: #f3e5bf;
        }

        #inventory-collapse-btn {
            width: 24px;
            height: 22px;
            padding: 0;
            font-size: 14px;
            line-height: 1;
            cursor: pointer;
        }

        #ui-panel.collapsed {
            width: 120px;
        }

        #ui-panel.collapsed #inventory-panel-body {
            display: none;
        }

        #left-hud-panel {
            position: absolute;
            left: 62px;
            top: 62px;
            width: 560px;
            max-width: min(86vw, 560px);
            max-height: 420px;
            z-index: 2600;
            display: none;
            padding: 8px;
            border: 2px solid var(--ui-frame-dark);
            border-radius: 12px;
            background:
                linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 35%),
                linear-gradient(180deg, var(--ui-surface-1) 0%, var(--ui-surface-2) 100%);
            box-shadow:
                inset 0 0 0 1px rgba(215, 195, 144, 0.3),
                inset 0 12px 20px rgba(0, 0, 0, 0.18),
                0 10px 22px var(--ui-shadow);
        }

        #left-hud-panel.visible {
            display: block;
        }

        #left-hud-header {
            display: flex;
            align-items: center;
            justify-content: space-between;
            margin-bottom: 8px;
            padding: 4px 6px;
            border: 1px solid #6a5d42;
            border-radius: 8px;
            background: linear-gradient(180deg, #3e372d 0%, #2f2a22 100%);
        }

        #left-hud-header h3 {
            margin: 0;
            font-size: 14px;
            color: #f3e5bf;
        }

        #left-hud-close-btn {
            width: 24px;
            height: 22px;
            padding: 0;
            font-size: 14px;
            line-height: 1;
            cursor: pointer;
        }

        .left-hud-open-btn.active {
            filter: brightness(1.2);
            outline: 1px solid #d9c38f;
        }

        .stat-section {
            border: 1px solid var(--ui-frame-mid);
            border-radius: 9px;
            background: linear-gradient(180deg, #3f392f 0%, #312d24 100%);
            box-shadow: inset 0 0 0 1px rgba(215, 195, 144, 0.16);
            padding: 10px;
        }

        .stat-section h3 {
            color: #f3e5bf;
            border-bottom: 1px solid #756646;
            text-shadow: 0 1px 0 rgba(0, 0, 0, 0.25);
        }

        .stat-item span:first-child {
            color: var(--ui-text-soft);
        }

        .stat-item span:last-child {
            color: #f2e8cc;
        }

        .combat-stance-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 6px;
            margin-top: 8px;
        }

        .combat-stance-btn {
            border: 1px solid var(--ui-frame-dark);
            border-radius: 7px;
            color: #f7ebc9;
            background: linear-gradient(180deg, #776a50 0%, #5a503c 100%);
            padding: 6px 8px;
            font-size: 11px;
            cursor: pointer;
            box-shadow: inset 0 0 0 1px rgba(224, 206, 165, 0.22);
        }

        .combat-stance-btn:hover {
            filter: brightness(1.08);
        }

        .combat-stance-btn.active {
            background: linear-gradient(180deg, #b08a44 0%, #8c6a2f 100%);
            box-shadow: inset 0 0 0 1px rgba(255, 225, 164, 0.55);
            color: #fff7df;
        }

        #osrs-tabs {
            gap: 5px;
        }

        .hud-tab {
            border: 1px solid var(--ui-frame-dark);
            border-radius: 7px;
            color: var(--ui-text-main);
            background: linear-gradient(180deg, #7f7255 0%, #5f553f 100%);
            box-shadow: inset 0 0 0 1px rgba(224, 206, 165, 0.22);
            transition: filter 0.14s ease, transform 0.14s ease;
        }

        .hud-tab:hover {
            filter: brightness(1.08);
            transform: translateY(-1px);
        }

        .hud-tab.active {
            background: linear-gradient(180deg, #a08f64 0%, #776947 100%);
            box-shadow: inset 0 0 0 1px rgba(242, 224, 181, 0.58);
            color: #fff4d6;
        }

        #left-rail .rail-btn {
            border: 1px solid var(--ui-frame-dark);
            border-radius: 9px;
            background: linear-gradient(180deg, #7f7255 0%, #5f553f 100%);
            box-shadow:
                inset 0 0 0 1px rgba(224, 206, 165, 0.24),
                0 4px 8px rgba(0, 0, 0, 0.25);
        }

        #left-rail .rail-btn:hover {
            filter: brightness(1.1);
        }

        .rail-btn-icon {
            display: inline-flex;
            width: 100%;
            height: 100%;
            align-items: center;
            justify-content: center;
            user-select: none;
        }

        .rail-btn-icon img {
            width: 22px;
            height: 22px;
            display: block;
            image-rendering: -webkit-optimize-contrast;
            image-rendering: crisp-edges;
            filter: drop-shadow(0 1px 0 rgba(0, 0, 0, 0.45));
            pointer-events: none;
        }

        .header-icon {
            display: inline-block;
            width: 16px;
            height: 16px;
            background-image: url('/static/assets/sprites/ui/ui_buttons.png');
            background-size: 64px 48px;
            background-repeat: no-repeat;
            margin-right: 6px;
            vertical-align: middle;
        }

        #minimap-container {
            border: 2px solid var(--ui-frame-dark);
            border-radius: 14px;
            background:
                linear-gradient(150deg, rgba(255, 255, 255, 0.07), transparent 45%),
                linear-gradient(180deg, #4a4337 0%, #332f27 100%);
            box-shadow:
                inset 0 0 0 1px rgba(215, 195, 144, 0.22),
                0 8px 18px rgba(0, 0, 0, 0.35);
        }

        #chat-box {
            border: 1px solid var(--ui-frame-mid);
            border-radius: 8px;
            background: linear-gradient(180deg, #2f2b24 0%, #26231d 100%);
            color: #f2e8cf;
        }

        .chat-message {
            color: #e9dcc0;
            border-radius: 5px;
            background: rgba(255, 255, 255, 0.035);
        }

        .system-message {
            color: #f3c978;
            background: rgba(179, 120, 30, 0.14);
        }

        #chat-input {
            border: 1px solid #65573c;
            border-radius: 6px;
            background: #f2e8cd;
            color: #221d14;
        }

        #chat-send-btn,
        #map-toggle-btn,
        #login-form button,
        #map-close-btn,
        #trade-close-btn,
        #leaderboard-close-btn,
        #economy-close-btn,
        #economy-refresh-btn,
        #economy-complete-btn,
        #controls button,
        .contract-item button {
            border: 1px solid var(--ui-frame-dark);
            border-radius: 7px;
            color: #f7eac7;
            background: linear-gradient(180deg, #7f7255 0%, #5f553f 100%);
            box-shadow: inset 0 0 0 1px rgba(224, 206, 165, 0.22);
        }

        #chat-send-btn:hover,
        #map-toggle-btn:hover,
        #login-form button:hover,
        #map-close-btn:hover,
        #trade-close-btn:hover,
        #leaderboard-close-btn:hover,
        #economy-close-btn:hover,
        #economy-refresh-btn:hover,
        #economy-complete-btn:hover,
        #controls button:hover,
        .contract-item button:hover {
            filter: brightness(1.08);
        }

        .contract-item,
        .economy-card,
        #leaderboard-meta {
            border: 1px solid #6a5d42;
            border-radius: 7px;
            background: linear-gradient(180deg, #3e372d 0%, #2f2a22 100%);
            color: var(--ui-text-main);
        }

        #trade-gold,
        #economy-meta,
        #economy-active-contract {
            color: #f0e2bd;
        }

        #leaderboard-table,
        .economy-table {
            border-collapse: collapse;
            overflow: hidden;
            border-radius: 8px;
        }

        #leaderboard-table th,
        .economy-table th {
            background: linear-gradient(180deg, #6f644a 0%, #5b513d 100%);
            color: #f5e8c5;
            border-bottom: 1px solid #2a2418;
        }

        #leaderboard-table td,
        .economy-table td {
            color: #eadfc3;
            border-bottom: 1px solid rgba(255, 255, 255, 0.07);
            background: rgba(255, 255, 255, 0.02);
        }

        .leaderboard-tab {
            border: 1px solid var(--ui-frame-dark);
            background: linear-gradient(180deg, #7f7255 0%, #5f553f 100%);
            color: var(--ui-text-main);
            box-shadow: inset 0 0 0 1px rgba(224, 206, 165, 0.22);
        }

        .leaderboard-tab.active {
            background: linear-gradient(180deg, #a08f64 0%, #776947 100%);
            color: #fff4d6;
        }

        #context-menu,
        #inventory-context-menu {
            border: 1px solid #bfa574;
            border-radius: 6px;
            background:
                linear-gradient(160deg, rgba(255, 255, 255, 0.06), transparent 40%),
                linear-gradient(180deg, #3f392f 0%, #2f2a22 100%);
            box-shadow: 0 10px 18px rgba(0, 0, 0, 0.45);
        }

        .context-item {
            color: #f3e5bf;
        }

        .context-item:hover {
            background: rgba(217, 195, 143, 0.22);
            color: #fff4d9;
        }

        #status {
            border-radius: 9px;
            border: 2px solid #2d271c;
            background:
                linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 35%),
                linear-gradient(180deg, #5d6e43 0%, #445333 100%);
            color: #f0e7ce;
        }

        #status.disconnected {
            background:
                linear-gradient(160deg, rgba(255, 255, 255, 0.08), transparent 35%),
                linear-gradient(180deg, #7a4c45 0%, #5b312d 100%);
        }

        #action-progress {
            display: none;
            width: min(360px, 86vw);
            margin: -8px auto 10px;
            padding: 6px 10px;
            border: 1px solid #2f2a1c;
            border-radius: 8px;
            background: linear-gradient(180deg, rgba(79, 68, 44, 0.95) 0%, rgba(58, 50, 32, 0.95) 100%);
            box-shadow: inset 0 0 0 1px rgba(222, 204, 160, 0.25), 0 4px 10px rgba(0, 0, 0, 0.25);
        }

        #action-progress.visible {
            display: block;
        }

        #action-progress-label {
            font-size: 12px;
            color: #f1e5c4;
            margin-bottom: 4px;
            text-align: center;
        }

        #action-progress-track {
            height: 9px;
            border-radius: 999px;
            border: 1px solid #2a2518;
            background: #302a1f;
            overflow: hidden;
        }

        #action-progress-fill {
            height: 100%;
            width: 0%;
            border-radius: 999px;
            background: linear-gradient(90deg, #e59443 0%, #f3c56f 100%);
            transition: width 0.2s linear;
        }

        /* Equipment Panel Styles */
        .equipment-layout {
            display: flex;
            flex-direction: column;
            gap: 8px;
            padding: 10px;
            background: rgba(20, 18, 15, 0.4);
            border-radius: 8px;
            margin-bottom: 10px;
        }

        .equipment-row {
            display: flex;
            gap: 8px;
            justify-content: space-around;
        }

        .equipment-slot {
            position: relative;
            width: 70px;
            height: 70px;
            background: linear-gradient(135deg, rgba(48, 42, 31, 0.9) 0%, rgba(35, 30, 22, 0.9) 100%);
            border: 2px solid rgba(229, 148, 67, 0.3);
            border-radius: 8px;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.2s ease;
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 2px 8px rgba(0, 0, 0, 0.2);
        }

        .equipment-slot.equipment-slot-large {
            width: 80px;
            height: 80px;
        }

        .equipment-slot:hover {
            border-color: rgba(229, 148, 67, 0.7);
            transform: translateY(-2px);
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 4px 12px rgba(229, 148, 67, 0.3);
        }

        .equipment-slot.equipped {
            border-color: rgba(229, 148, 67, 0.9);
            background: linear-gradient(135deg, rgba(58, 52, 41, 0.9) 0%, rgba(45, 40, 32, 0.9) 100%);
            box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3), 0 0 12px rgba(229, 148, 67, 0.5);
        }

        .equipment-slot.drag-over {
            border-color: rgba(229, 200, 111, 0.9);
            background: rgba(229, 200, 111, 0.2);
            transform: scale(1.05);
        }

        .equipment-slot-icon {
            font-size: 24px;
            margin-bottom: 2px;
            filter: grayscale(0.5) opacity(0.6);
            transition: all 0.2s ease;
        }

        .equipment-slot.equipped .equipment-slot-icon {
            filter: grayscale(0) opacity(1);
        }

        .equipment-slot-name {
            font-size: 9px;
            color: rgba(229, 148, 67, 0.8);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 600;
        }

        .equipment-item-sprite {
            position: absolute;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 40px;
            height: 40px;
            object-fit: contain;
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
        }

        .equipment-slot.equipment-slot-large .equipment-item-sprite {
            width: 48px;
            height: 48px;
        }

        .equipment-stats-summary {
            padding: 10px;
            background: rgba(20, 18, 15, 0.4);
            border-radius: 8px;
            border: 1px solid rgba(229, 148, 67, 0.2);
        }

        .equipment-stats-summary h4 {
            margin: 0 0 8px 0;
            font-size: 12px;
            color: rgba(229, 148, 67, 0.9);
            text-transform: uppercase;
            letter-spacing: 1px;
        }

        .equipment-stat-grid {
            display: grid;
            grid-template-columns: 1fr 1fr;
            gap: 4px;
            font-size: 11px;
        }

        .equipment-stat-item {
            display: flex;
            justify-content: space-between;
            padding: 3px 6px;
            background: rgba(48, 42, 31, 0.5);
            border-radius: 4px;
            border: 1px solid rgba(229, 148, 67, 0.15);
        }

        .equipment-stat-label {
            color: rgba(243, 197, 111, 0.8);
            font-size: 10px;
            text-transform: capitalize;
        }

        .equipment-stat-value {
            color: rgba(120, 240, 120, 0.9);
            font-weight: 600;
        }

        .equipment-stat-value.negative {
            color: rgba(240, 120, 120, 0.9);
        }

        /* Equipment Selection Modal */
        .equipment-modal-backdrop {
            display: none;
            position: fixed;
            top: 0;
            left: 0;
            width: 100vw;
            height: 100vh;
            background: rgba(0, 0, 0, 0.7);
            z-index: 9998;
            backdrop-filter: blur(4px);
        }

        .equipment-modal-backdrop.active {
            display: block;
        }

        .equipment-select-modal {
            display: none;
            position: fixed;
            top: 50%;
            left: 50%;
            transform: translate(-50%, -50%);
            width: 90%;
            max-width: 500px;
            max-height: 80vh;
            background: linear-gradient(135deg, rgba(28, 24, 18, 0.98) 0%, rgba(20, 16, 12, 0.98) 100%);
            border: 3px solid rgba(229, 148, 67, 0.6);
            border-radius: 12px;
            box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8), inset 0 2px 8px rgba(229, 148, 67, 0.1);
            z-index: 9999;
            overflow: hidden;
        }

        .equipment-select-modal.active {
            display: flex;
            flex-direction: column;
        }

        .equipment-select-header {
            display: flex;
            justify-content: space-between;
            align-items: center;
            padding: 16px 20px;
            background: linear-gradient(90deg, rgba(48, 42, 31, 0.9) 0%, rgba(35, 30, 22, 0.9) 100%);
            border-bottom: 2px solid rgba(229, 148, 67, 0.3);
        }

        .equipment-select-header h3 {
            margin: 0;
            font-size: 18px;
            color: rgba(243, 197, 111, 0.95);
            text-transform: uppercase;
            letter-spacing: 1.5px;
            text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
        }

        .equipment-select-close {
            background: rgba(240, 80, 80, 0.2);
            border: 1px solid rgba(240, 80, 80, 0.5);
            color: rgba(240, 120, 120, 0.9);
            font-size: 20px;
            width: 32px;
            height: 32px;
            border-radius: 6px;
            cursor: pointer;
            transition: all 0.2s ease;
            display: flex;
            align-items: center;
            justify-content: center;
            font-weight: 700;
        }

        .equipment-select-close:hover {
            background: rgba(240, 80, 80, 0.4);
            border-color: rgba(240, 80, 80, 0.8);
            transform: scale(1.1);
        }

        .equipment-select-items {
            padding: 16px;
            overflow-y: auto;
            flex: 1;
        }

        .equipment-select-item {
            display: flex;
            align-items: center;
            gap: 12px;
            padding: 12px;
            margin-bottom: 8px;
            background: linear-gradient(90deg, rgba(48, 42, 31, 0.6) 0%, rgba(35, 30, 22, 0.6) 100%);
            border: 2px solid rgba(229, 148, 67, 0.2);
            border-radius: 8px;
            cursor: pointer;
            transition: all 0.2s ease;
        }

        .equipment-select-item:hover {
            border-color: rgba(229, 148, 67, 0.6);
            background: linear-gradient(90deg, rgba(58, 52, 41, 0.7) 0%, rgba(45, 40, 32, 0.7) 100%);
            transform: translateX(4px);
        }

        .equipment-select-item.equipped {
            border-color: rgba(229, 148, 67, 0.9);
            background: linear-gradient(90deg, rgba(58, 52, 41, 0.8) 0%, rgba(45, 40, 32, 0.8) 100%);
            box-shadow: 0 0 12px rgba(229, 148, 67, 0.3);
        }

        .equipment-select-item.cannot-equip {
            opacity: 0.5;
            cursor: not-allowed;
            border-color: rgba(240, 80, 80, 0.3);
        }

        .equipment-select-item.cannot-equip:hover {
            transform: none;
            border-color: rgba(240, 80, 80, 0.5);
        }

        .equipment-select-item-sprite {
            width: 48px;
            height: 48px;
            object-fit: contain;
            filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.5));
        }

        .equipment-select-item-info {
            flex: 1;
        }

        .equipment-select-item-name {
            font-size: 14px;
            font-weight: 600;
            color: rgba(243, 197, 111, 0.95);
            margin-bottom: 4px;
            text-transform: capitalize;
        }

        .equipment-select-item-stats {
            display: flex;
            flex-wrap: wrap;
            gap: 6px;
            font-size: 11px;
        }

        .equipment-select-item-stat {
            padding: 2px 6px;
            background: rgba(20, 18, 15, 0.6);
            border-radius: 4px;
            border: 1px solid rgba(229, 148, 67, 0.2);
        }

        .equipment-select-item-stat.positive {
            color: rgba(120, 240, 120, 0.9);
        }

        .equipment-select-item-stat.negative {
            color: rgba(240, 120, 120, 0.9);
        }

        .equipment-select-item-badge {
            padding: 4px 8px;
            background: rgba(229, 148, 67, 0.3);
            border: 1px solid rgba(229, 148, 67, 0.6);
            border-radius: 6px;
            font-size: 10px;
            color: rgba(243, 197, 111, 0.95);
            text-transform: uppercase;
            letter-spacing: 0.5px;
            font-weight: 700;
        }

        .equipment-select-item-requirements {
            margin-top: 4px;
            font-size: 10px;
            color: rgba(240, 120, 120, 0.9);
        }

        .equipment-select-empty {
            text-align: center;
            padding: 40px 20px;
            color: rgba(229, 148, 67, 0.6);
            font-size: 14px;
        }

        /* Responsive Design */
        @media (max-width: 1400px) {
            main {
                flex-direction: column;
                gap: 20px;
            }

            aside {
                width: 100%;
                flex-direction: row;
                gap: 20px;
            }

            .sidebar-panel {
                flex: 1;
            }
        }

        @media (max-width: 1100px) {
            aside {
                flex-direction: column;
                width: 100%;
            }

            .sidebar-panel {
                width: 100%;
            }

            header {
                flex-direction: column;
                gap: 15px;
                text-align: center;
            }

            nav a {
                margin: 0 10px;
                font-size: 12px;
            }
        }

        @media (max-width: 768px) {
            main {
                padding: 15px;
            }

            header {
                padding: 10px 15px;
            }

            nav a {
                margin: 0 5px;
                font-size: 11px;
            }

            .logo {
                font-size: 14px;
            }

            aside {
                gap: 15px;
            }

            .sidebar-panel {
                padding: 12px;
            }

            .sidebar-panel h3 {
                font-size: 12px;
            }

            footer {
                padding: 15px;
                font-size: 11px;
            }

            footer a {
                margin: 0 8px;
            }
        }

/* ── Panel message (loading / empty state text in sidebar panels) ── */
.panel-message {
    color: #c7b487;
    font-size: 12px;
    padding: 10px 0;
}
