:root {
    --bg-base: #0f0f11; --bg-panel: #18181b; --bg-hover: #27272a;
    --accent: #81b64c; --accent-hover: #95c75e;
    --text-main: #e4e4e7; --text-mut: #a1a1aa; --border: #3f3f46;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background-color: var(--bg-base); font-family: system-ui, -apple-system, sans-serif; color: var(--text-main); user-select: none; display: flex; height: 100vh; width: 100vw; overflow: hidden; cursor: none; }

#custom-cursor { position: fixed; pointer-events: none; z-index: 999999; width: 26px; height: 26px; background-image: url('../img/w_p.svg'); background-size: contain; background-repeat: no-repeat; filter: drop-shadow(0 5px 10px rgba(0,0,0,0.5)); }
#custom-cursor.active { width: 32px; height: 32px; background-image: url('../img/w_q.svg'); filter: drop-shadow(0 0 10px rgba(129, 182, 76, 0.8)); }
body.in-game { cursor: default; }
body.in-game #custom-cursor { display: none !important; }
canvas#gameCanvas { cursor: grab !important; display: block; border-radius: 6px; filter: drop-shadow(0 15px 40px rgba(0,0,0,0.8)); transition: transform 1s ease;}
canvas#gameCanvas:active { cursor: grabbing !important; }
#bg-canvas { position: absolute; top: 0; left: 0; width: 100%; height: 100%; z-index: 0; pointer-events: none; opacity: 0.6; }

.btn { background: var(--bg-panel); color: var(--text-main); border: 1px solid var(--border); padding: 14px 24px; border-radius: 6px; font-size: 14px; font-weight: 800; transition: all 0.2s ease; text-transform: uppercase; letter-spacing: 1px; display: inline-flex; align-items: center; justify-content: center; z-index: 5; cursor: pointer; }
.btn:hover { background: var(--bg-hover); border-color: #52525b; transform: translateY(-2px); }
.btn:active { transform: translateY(1px); }
.btn-gold { background: var(--accent); color: #fff; border: none; text-shadow: 0 1px 2px rgba(0,0,0,0.3); }
.btn-gold:hover { background: var(--accent-hover); box-shadow: 0 0 15px rgba(129, 182, 76, 0.4); }

.screen { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: none; flex-direction: column; z-index: 10; align-items: center;}
.screen.active { display: flex; }
#screen-landing { justify-content: center; }

/* ШИРОКИЙ ПРОФИЛЬ И ПОЛОСА XP */
.top-profile-bar { position: absolute; top: 20px; left: 20px; right: 20px; display: flex; justify-content: space-between; align-items: center; z-index: 20; background: rgba(24, 24, 27, 0.9); padding: 15px 25px; border-radius: 12px; backdrop-filter: blur(10px); border: 1px solid var(--border); transition: 0.3s; gap: 20px; box-shadow: 0 10px 30px rgba(0,0,0,0.5); }
.p-avatar { width: 44px; height: 44px; border-radius: 8px; background: linear-gradient(45deg, var(--accent), #27272a); border: 2px solid var(--border); flex-shrink: 0; }
.profile-text { width: 100px; flex-shrink: 0; }
.xp-super-container { flex: 1; display: flex; flex-direction: column; justify-content: center; position: relative; transition: 0.3s; }
.xp-labels { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-mut); margin-bottom: 6px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.5px; }
.xp-bar-bg { width: 100%; height: 10px; background: #0f0f11; border-radius: 5px; position: relative; border: 1px solid #3f3f46; box-shadow: inset 0 2px 5px rgba(0,0,0,0.8); }
.xp-bar-fill { height: 100%; background: linear-gradient(90deg, #5c8a32, var(--accent)); border-radius: 4px; transition: width 0.5s ease; box-shadow: 0 0 10px rgba(129, 182, 76, 0.5); }
.xp-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #3f3f46; z-index: 2; border-radius: 2px; }
.xp-reward-icon { position: absolute; top: -25px; left: -10px; font-size: 20px; filter: drop-shadow(0 0 10px gold); animation: float 2s infinite ease-in-out; }
@keyframes float { 0% { transform: translateY(0); } 50% { transform: translateY(-5px); } 100% { transform: translateY(0); } }
.profile-wallet { flex-shrink: 0; padding-left: 10px; border-left: 1px solid var(--border); }

.landing-box { text-align: center; max-width: 800px; padding: 50px; background: radial-gradient(circle at top, rgba(39, 39, 42, 0.9), rgba(24, 24, 27, 0.95)); backdrop-filter: blur(10px); border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 12px; box-shadow: 0 30px 60px rgba(0,0,0,0.9); z-index: 5; display: flex; flex-direction: column; align-items: center; position: relative; }
.landing-desc { font-size: 16px; color: var(--text-mut); margin-bottom: 35px; font-weight: 500; line-height: 1.6; }

/* АРЕНЫ И РЕЙТИНГ */
.modes-layout { display: flex; width: 100%; max-width: 1600px; height: calc(100vh - 180px); margin-top: 110px; padding: 0 20px; gap: 40px; z-index: 5; }
.leaderboard-panel { width: 300px; background: rgba(24, 24, 27, 0.9); border: 1px solid var(--border); border-radius: 12px; display: flex; flex-direction: column; backdrop-filter: blur(5px); }
.lb-header { font-size: 18px; font-weight: 900; text-align: center; padding: 15px; border-bottom: 1px solid var(--border); color: gold; text-transform: uppercase;}
.lb-list { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.lb-item { display: flex; justify-content: space-between; padding: 10px; background: #0f0f11; border-radius: 6px; font-size: 14px; font-weight: bold; border: 1px solid #27272a; }

.modes-center-panel { flex: 1; display: flex; flex-direction: column; position: relative; }
.modes-header { font-size: 24px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 15px; text-align: center; text-shadow: 0 5px 15px rgba(0,0,0,0.8); display: flex; justify-content: center; align-items: center; gap: 20px;}
.mode-toggle-wrapper { display: flex; align-items: center; justify-content: center; gap: 15px; background: rgba(0,0,0,0.5); padding: 8px 16px; border-radius: 30px; border: 1px solid var(--border); }
.toggle-label { font-size: 14px; font-weight: 800; transition: 0.3s; text-transform: uppercase; letter-spacing: 0.5px;}

.switch { position: relative; display: inline-block; width: 50px; height: 26px; }
.switch input { display: none; }
.slider { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background-color: #3f3f46; transition: .4s; border-radius: 34px; }
.slider:before { position: absolute; content: ""; height: 18px; width: 18px; left: 4px; bottom: 4px; background-color: white; transition: .4s; border-radius: 50%; }
input:checked + .slider { background-color: var(--accent); box-shadow: 0 0 10px var(--accent); }
input:checked + .slider:before { transform: translateX(24px); }

.modes-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 15px; width: 100%; overflow-y: auto; padding-top: 15px; padding-right: 10px; padding-bottom: 120px; align-content: start; }
.mode-card { background: rgba(24, 24, 27, 0.9); border: 1px solid var(--border); border-radius: 8px; padding: 20px; transition: all 0.3s; text-align: center; cursor: pointer; }
.mode-card:hover { border-color: var(--accent); transform: translateY(-4px); box-shadow: 0 10px 25px rgba(0,0,0,0.6); }
.mc-icon { font-size: 36px; margin-bottom: 12px; }
.mc-title { font-size: 16px; font-weight: 800; text-transform: uppercase; margin-bottom: 8px; letter-spacing: 0.5px;}
.mc-desc { font-size: 12px; color: var(--text-mut); font-weight: 600;}

.bottom-menu-bar { position: absolute; bottom: 20px; display: flex; gap: 15px; justify-content: center; width: 100%; z-index: 20; padding-top: 20px; }

/* МАГАЗИН И ИНВЕНТАРЬ */
.shop-layout { display: flex; width: 100%; max-width: 1200px; height: 60vh; margin-top: 30px; gap: 20px; z-index: 5; }
.shop-sidebar { width: 220px; display: flex; flex-direction: column; gap: 10px; }
.shop-tab, .inv-tab { background: var(--bg-panel); border: 1px solid var(--border); padding: 15px; border-radius: 8px; font-weight: bold; text-align: center; cursor: pointer; transition: 0.2s; text-transform: uppercase; }
.shop-tab.active, .inv-tab.active { background: var(--accent); color: white; border-color: var(--accent); box-shadow: 0 0 15px rgba(129, 182, 76, 0.4); }
.shop-tab:hover:not(.active), .inv-tab:hover:not(.active) { background: var(--bg-hover); }
.shop-content { flex: 1; background: var(--bg-panel); border: 1px solid var(--border); border-radius: 12px; padding: 20px; overflow-y: auto; }
.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 15px; }
.shop-item { background: var(--bg-base); border: 1px solid var(--border); border-radius: 8px; padding: 15px; text-align: center; transition: 0.2s; position: relative; display: flex; flex-direction: column; justify-content: space-between; }
.shop-item:hover { border-color: var(--accent); }
.shop-item.locked { opacity: 0.5; filter: grayscale(1); }
.shop-item.equipped { border-color: gold; box-shadow: 0 0 15px rgba(255, 215, 0, 0.3); }
.lvl-req { font-size: 12px; color: #ef4444; font-weight: bold; margin-bottom: 10px; }

/* ЛОББИ */
.lobby-split { width: 850px !important; max-width: 95vw; display: grid !important; grid-template-columns: 1fr 300px; padding: 0 !important; border-radius: 12px; overflow: hidden; }
.lobby-left { padding: 35px; display: flex; flex-direction: column; }
.lobby-right { background: rgba(0,0,0,0.5); border-left: 1px solid var(--border); padding: 35px; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.lobby-modal { background: var(--bg-panel); border-radius: 12px; padding: 35px; border: 1px solid var(--border); margin: auto; box-shadow: 0 25px 50px rgba(0,0,0,0.9); z-index: 5; }
.modal-header { font-size: 24px; font-weight: 900; margin-bottom: 25px; text-align: center; text-transform: uppercase; letter-spacing: 1px; color: var(--text-main);}

.slot-row { display: flex; align-items: center; justify-content: space-between; background: #0f0f11; padding: 12px 16px; border-radius: 6px; margin-bottom: 8px; border: 1px solid #27272a;}
.slot-color { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 13px; width: 180px; text-transform: uppercase;}
.c-box { width: 16px; height: 16px; border-radius: 3px; }
.slot-controls { display: flex; gap: 10px; align-items: center;}
select, input.lobby-input { background: #18181b; color: white; border: 1px solid #3f3f46; padding: 10px 15px; border-radius: 6px; font-weight: 600; font-family: 'Inter', sans-serif; outline: none; }
.bot-stars { display: flex; gap: 4px; color: #3f3f46; font-size: 20px; transition: 0.3s; align-items: center;}
.bot-stars span.active { color: var(--accent); text-shadow: 0 0 10px rgba(129, 182, 76, 0.8);}
.time-setup-box { display: flex; align-items: center; justify-content: space-between; background: #0f0f11; padding: 15px 20px; border-radius: 8px; border: 1px solid var(--border); margin-bottom: 20px; }

/* ОНЛАЙН СЛОТЫ */
.online-slot { background: #0f0f11; border: 1px solid var(--border); border-radius: 6px; padding: 12px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; font-weight: bold; }
.online-slot.empty { border: 1px dashed var(--text-mut); color: var(--text-mut); }
.online-slot.filled { border: 1px solid var(--accent); color: white; }

/* ИГРА */
#screen-game { flex-direction: row; }
.board-super-container { flex: 1; display: flex; justify-content: center; align-items: center; padding: 20px; position: relative; z-index: 5; box-sizing: border-box; perspective: 1200px;}
.perspective-board canvas { transform: rotateX(35deg) scale(0.95); box-shadow: 0 50px 100px rgba(129, 182, 76, 0.3); }

.right-panel { width: 340px; background: var(--bg-panel); border-left: 1px solid var(--border); display: flex; flex-direction: column; padding: 25px; z-index: 10; box-shadow: -10px 0 30px rgba(0,0,0,0.5);}
.rp-header { font-size: 16px; font-weight: 900; text-align: center; margin-bottom: 20px; color: var(--accent); text-transform: uppercase; letter-spacing: 1px;}
.players-list { display: flex; flex-direction: column; gap: 10px; flex: 1; overflow-y: auto;}

.p-card { flex-direction: column; align-items: stretch; gap: 8px; position: relative; overflow: hidden; background: #0f0f11; border: 1px solid #27272a; padding: 12px; border-radius: 6px; display: flex; transition: 0.2s; }
.p-card.active { border-color: var(--accent); background: rgba(129, 182, 76, 0.05); }
.p-card.dead { opacity: 0.3; filter: grayscale(1); }
.p-card-top { display: flex; align-items: center; gap: 12px; width: 100%; }
.p-timer { margin-left: auto; background: #18181b; padding: 4px 8px; border-radius: 4px; font-family: monospace; font-size: 16px; font-weight: 900; color: var(--text-main); border: 1px solid var(--border); box-shadow: inset 0 2px 5px rgba(0,0,0,0.5); }
.p-timer.danger { color: #ef4444; border-color: #ef4444; animation: pulse 1s infinite; }
@keyframes pulse { 0% { opacity: 1; } 50% { opacity: 0.5; } 100% { opacity: 1; } }
.p-captured { display: flex; flex-wrap: wrap; gap: 2px; min-height: 16px; }
.p-cap-icon { width: 16px; height: 16px; opacity: 0.8; }
.btn-surrender-mini { background: transparent; color: #ef4444; border: 1px solid #ef4444; font-size: 10px; font-weight: 800; padding: 4px; border-radius: 4px; text-transform: uppercase; width: 100%; margin-top: 5px; transition: 0.2s; }
.btn-surrender-mini:hover { background: #ef4444; color: white; }

.top-left-btn { position: absolute; top: 20px; left: 20px; z-index: 50; background: rgba(24, 24, 27, 0.9); backdrop-filter: blur(5px); padding: 12px 20px; border-radius: 6px; font-weight: 900; font-size: 14px; color: var(--accent); border: 1px solid var(--border); transition: 0.2s; text-transform: uppercase; letter-spacing: 1px; }
.top-left-btn:hover { border-color: var(--accent); box-shadow: 0 0 15px rgba(129, 182, 76, 0.3); }
.p-avatar.ingame { width: 16px; height: 16px; border-radius: 3px; border: 1px solid rgba(255,255,255,0.1);}
.p-info { display: flex; flex-direction: column; }
.p-name { font-weight: 800; font-size: 12px; text-transform: uppercase;}
.p-status { font-size: 10px; color: var(--text-mut); font-weight: 700; margin-top: 4px; text-transform: uppercase;}
.p-card.active .p-status { color: var(--accent); }

.anarchy-machine { background: #0f0f11; border: 2px solid #3f3f46; border-radius: 8px; padding: 15px; margin-top: auto; text-align: center; box-shadow: inset 0 5px 15px rgba(0,0,0,0.8); }
.am-title { font-size: 12px; font-weight: 900; color: #ef4444; text-transform: uppercase; letter-spacing: 2px; margin-bottom: 10px;}
.am-window { background: #000; height: 40px; border-radius: 6px; border: 1px solid #ef4444; overflow: hidden; position: relative; box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }
.am-reels { position: absolute; top: 0; left: 0; width: 100%; display: flex; flex-direction: column; transition: top 2.5s cubic-bezier(0.1, 1.5, 0.5, 1); }
.am-item { height: 40px; line-height: 40px; font-size: 14px; font-weight: 800; color: white; text-transform: uppercase;}
.am-counter { font-size: 10px; color: var(--text-mut); margin-top: 10px; font-weight: bold;}

#loading-screen { position: absolute; top:0; left:0; width:100%; height:100%; background: var(--bg-base); z-index: 100; display: flex; justify-content: center; align-items: center; flex-direction: column; transition: opacity 0.5s;}
.loader-text { font-size: 14px; color: var(--text-mut); font-weight: 600; text-transform: uppercase; letter-spacing: 1px; }
.game-over-modal { position: absolute; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); display: none; justify-content: center; align-items: center; z-index: 100; backdrop-filter: blur(5px); }

::-webkit-scrollbar { width: 10px; }
::-webkit-scrollbar-track { background: #0f0f11; border-left: 1px solid var(--border); }
::-webkit-scrollbar-thumb { background: #3f3f46; border-radius: 5px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }

.swap-alert { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.5); font-size: 60px; font-weight: 900; color: white; text-shadow: 0 0 20px #ef4444, 0 0 40px #ef4444, 0 5px 10px rgba(0,0,0,1); text-transform: uppercase; text-align: center; opacity: 0; pointer-events: none; z-index: 1000; transition: 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275); width: 100%; }
.swap-alert.show { opacity: 1; transform: translate(-50%, -50%) scale(1); }

/* АДАПТАЦИЯ ДЛЯ ТЕЛЕФОНОВ */
@media (max-width: 900px) {
    .top-profile-bar { flex-direction: column; gap: 10px; padding: 10px; }
    .xp-super-container { width: 100%; }
    .modes-layout { flex-direction: column; height: auto; margin-top: 180px; padding: 0 10px; }
    .leaderboard-panel { width: 100%; height: 200px; }
    
    #screen-game { flex-direction: column; }
    .board-super-container { flex: 1; height: auto; padding: 5px; }
    .right-panel { width: 100%; height: auto; min-height: 120px; flex: 0 0 auto; flex-direction: column; border-left: none; border-top: 1px solid var(--border); padding: 10px;}
    .players-list { flex-direction: row; overflow-x: auto; margin-bottom: 0;}
    .p-card { min-width: 140px; flex-shrink: 0;}
    .rp-header { display: none; }
    
    .lobby-split { flex-direction: column; width: 95vw !important; display: flex !important; }
    .lobby-right { width: 100%; border-left: none; border-top: 1px solid var(--border); }
    
    .shop-layout { flex-direction: column; height: auto; }
    .shop-sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
    .shop-tab, .inv-tab { flex: 1; min-width: 100px; padding: 10px; font-size: 12px; }
    
    .bottom-menu-bar { flex-wrap: wrap; padding: 10px; bottom: 10px; }
    .bottom-menu-bar .btn { font-size: 12px; padding: 10px 15px; flex: 1; text-align: center; }
    .modes-grid { padding-bottom: 120px; }
    .landing-box svg { width: 100%; height: auto; }
}