:root { --bg-main: #0a0a0f; --bg-sidebar: #111118; --bg-card: rgba(26, 26, 36, 0.7); --accent: #a78bfa; --text-main: #ffffff; --text-muted: #9ca3af; }

html, body { overflow-x: hidden; width: 100%; box-sizing: border-box; margin: 0; padding: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; touch-action: manipulation; }
body { background-color: var(--bg-main); color: var(--text-main); display: flex; height: 100vh; }

* { box-sizing: inherit; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #374151; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: var(--accent); }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(30px) scale(0.95); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes pulseSkeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Global Announcement Banner */
.global-announcement { position: fixed; top: 0; left: 0; width: 100vw; background: linear-gradient(90deg, #6366f1, #a78bfa); color: white; padding: 10px 40px; text-align: center; z-index: 2000; box-sizing: border-box; font-weight: bold; font-size: 0.9rem; display: flex; align-items: center; justify-content: center; box-shadow: 0 4px 15px rgba(167, 139, 250, 0.4); animation: slideDown 0.4s ease-out; }
.close-announcement { position: absolute; right: 15px; background: transparent; border: none; color: white; font-size: 1.2rem; cursor: pointer; padding: 0; opacity: 0.8; transition: 0.2s; }
.close-announcement:hover { opacity: 1; transform: scale(1.1); }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

body.view-roulette #main-topbar, body.view-account #main-topbar, body.view-stats #main-topbar, body.view-quests #main-topbar, body.view-shop #main-topbar { display: none !important; }
body.view-roulette .content-area { overflow: hidden; padding: 0; display: flex; justify-content: center; align-items: center; }

body.public-mode .sidebar { display: none !important; }
body.public-mode .mobile-header { display: flex !important; }

/* Hamburger Menu Icon */
.hamburger-menu { display: none; background: transparent; border: none; color: var(--text-main); font-size: 1.8rem; cursor: pointer; padding: 5px; z-index: 1001; }
.sidebar-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(0,0,0,0.6); z-index: 999; backdrop-filter: blur(3px); opacity: 0; pointer-events: none; transition: opacity 0.3s ease; }
.sidebar-overlay.show { opacity: 1; pointer-events: auto; }

.sidebar { width: 260px; background-color: var(--bg-sidebar); display: flex; flex-direction: column; justify-content: space-between; padding: 30px 20px; border-right: 1px solid rgba(255,255,255,0.05); z-index: 1000; overflow-y: auto; transition: transform 0.3s ease; }
.sidebar::-webkit-scrollbar { display: none; } 

.logo { font-size: 2.2rem; font-weight: 800; background: linear-gradient(90deg, var(--accent), #f472b6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 40px; text-align: center; text-shadow: 0 0 20px rgba(167,139,250,0.3); letter-spacing: -1px; }
.nav-section-title { font-size: 0.8rem; color: #6b7280; text-transform: uppercase; font-weight: 800; margin-bottom: 15px; padding-left: 10px; letter-spacing: 1px;}
.nav-menu { display: flex; flex-direction: column; gap: 8px; width: 100%; }

.nav-item { padding: 12px 15px; border-radius: 12px; color: var(--text-muted); cursor: pointer; transition: all 0.3s; display: flex; align-items: center; gap: 10px; }
.nav-icon { font-size: 1.2rem; display: flex; align-items: center; justify-content: center; width: 24px;}
.nav-text { font-weight: 600; font-size: 1rem; }
.nav-item:hover { background-color: rgba(167, 139, 250, 0.1); color: var(--text-main); transform: translateX(5px); }
.nav-item.active { background-color: var(--accent); color: #0d0d12; box-shadow: 0 0 15px rgba(167, 139, 250, 0.4); transform: translateX(5px); }

.account-container { display: flex; flex-direction: column; align-items: center; padding: 40px 20px; width: 100%; max-width: 600px; margin: 0 auto;}

.profile-main-card { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 24px; padding: 40px 20px 30px 20px; width: 100%; display: flex; flex-direction: column; align-items: center; margin-bottom: 30px; animation: fadeInUp 0.4s ease; position: relative; overflow: hidden; box-shadow: 0 15px 40px rgba(0,0,0,0.5); }
.profile-avatar-wrapper { position: relative; width: 120px; height: 120px; margin-bottom: 20px; cursor: pointer; border-radius: 50%; box-shadow: 0 10px 30px rgba(167, 139, 250, 0.3); border: 3px solid transparent; background: linear-gradient(135deg, var(--accent), #f472b6); padding: 3px; transition: transform 0.3s; z-index: 2;}
.profile-avatar-wrapper:hover { transform: scale(1.05); }
.profile-avatar { width: 100%; height: 100%; border-radius: 50%; background-color: #0d0d12; background-size: cover; background-position: center; display: flex; align-items: center; justify-content: center; font-size: 3.5rem; font-weight: 800; color: white; text-transform: uppercase; }
.profile-avatar-overlay { position: absolute; bottom: -5px; right: -5px; background: var(--accent); color: #0d0d12; border: 3px solid rgba(0,0,0,0.5); width: 38px; height: 38px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 1.1rem; box-shadow: 0 5px 15px rgba(0,0,0,0.5); z-index: 10; }

.profile-rpg-badges { display: flex; justify-content: center; gap: 10px; margin-bottom: 15px; z-index: 2;}
.badge-level { background: linear-gradient(90deg, #facc15, #f59e0b); color: #000; padding: 6px 18px; border-radius: 20px; font-weight: 900; font-size: 0.85rem; box-shadow: 0 4px 15px rgba(250, 204, 21, 0.4); text-transform: uppercase; letter-spacing: 0.5px;}
.badge-class { background: rgba(10, 10, 15, 0.85); backdrop-filter: blur(8px); border: 1px solid var(--accent); color: #fff; padding: 6px 18px; border-radius: 20px; font-weight: 800; font-size: 0.85rem; letter-spacing: 0.5px; cursor: pointer; transition: 0.2s; box-shadow: 0 5px 15px rgba(0,0,0,0.4); text-shadow: 0 1px 3px rgba(0,0,0,0.8); }
.badge-class:hover { transform: scale(1.05); box-shadow: 0 0 15px rgba(167, 139, 250, 0.6); background: rgba(167, 139, 250, 0.3); }
.profile-name { font-size: 2.2rem; font-weight: 900; color: white; letter-spacing: -1px; margin: 0; text-align: center; z-index: 2; text-shadow: 0 2px 10px rgba(0,0,0,0.8);}

.exp-container { width: 100%; text-align: left; margin-top: 25px; z-index: 2;}
.exp-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.exp-title { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px; text-shadow: 0 1px 3px rgba(0,0,0,0.8);}
.exp-val { font-size: 0.85rem; font-weight: 800; color: white; text-shadow: 0 1px 3px rgba(0,0,0,0.8);}
.exp-bar { width: 100%; height: 8px; background: rgba(0,0,0,0.5); border-radius: 4px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); backdrop-filter: blur(5px);}
.exp-fill { height: 100%; background: linear-gradient(90deg, #facc15, #f59e0b); width: 0%; transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 0 10px rgba(250, 204, 21, 0.5);}

.profile-stats-card { display: flex; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 20px; padding: 25px 20px; margin-bottom: 30px; justify-content: space-around; align-items: center; width: 100%; animation: fadeInUp 0.6s ease; backdrop-filter: blur(5px);}
.p-stat { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.p-stat-val { font-size: 2.5rem; font-weight: 900; background: linear-gradient(135deg, var(--accent), #f472b6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; line-height: 1;}
.p-stat-label { font-size: 0.75rem; color: var(--text-muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1px;}
.p-divider { width: 1px; height: 50px; background: rgba(255,255,255,0.1); }

.achievements-section { margin-bottom: 30px; width: 100%; text-align: left; animation: fadeInUp 0.7s ease; background: rgba(255,255,255,0.02); padding: 20px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05);} 
.achievements-title { font-size: 0.9rem; color: white; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; margin-bottom: 15px; } 

.achievements-grid-wrapper { max-height: 250px; overflow: hidden; position: relative; transition: max-height 0.4s ease; border-radius: 16px; }
.achievements-grid-wrapper.expanded { max-height: 3000px; }
.achievements-grid-wrapper::after { content: ''; position: absolute; bottom: 0; left: 0; right: 0; height: 60px; background: linear-gradient(transparent, var(--bg-main)); transition: opacity 0.3s; pointer-events: none; }
.achievements-grid-wrapper.expanded::after { opacity: 0; }
.expand-btn { display: block; width: 100%; text-align: center; background: rgba(255,255,255,0.05); color: var(--text-muted); border: 1px solid rgba(255,255,255,0.1); padding: 10px; border-radius: 12px; margin-top: 10px; cursor: pointer; transition: 0.2s; font-weight: bold; }
.expand-btn:hover { background: rgba(255,255,255,0.1); color: white; }

.achievements-grid { display: flex; flex-direction: column; gap: 10px; padding-bottom: 20px;} 
.ach-badge { display: flex; align-items: center; gap: 15px; padding: 12px 15px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); border-radius: 12px; transition: 0.3s; filter: grayscale(100%) opacity(0.4); width: 100%; box-sizing: border-box;} 
.ach-badge.unlocked { filter: grayscale(0%) opacity(1); background: rgba(167, 139, 250, 0.1); border-color: var(--accent); box-shadow: 0 0 15px rgba(167, 139, 250, 0.2); }
.ach-icon { font-size: 2rem; width: 40px; text-align: center; flex-shrink: 0;} 
.ach-text { display: flex; flex-direction: column; justify-content: center; }
.ach-name { font-size: 1rem; font-weight: 800; color: white; line-height: 1.2; margin-bottom: 4px;} 
.ach-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.2; }

.combo-badge { background: linear-gradient(135deg, rgba(236, 72, 153, 0.1), rgba(167, 139, 250, 0.1)); border: 1px solid rgba(236, 72, 153, 0.3); padding: 12px 15px; border-radius: 12px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; width: 100%;}

.shop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 15px; width: 100%; }
.shop-item { background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.05); padding: 15px; border-radius: 16px; text-align: center; display: flex; flex-direction: column; justify-content: space-between;}
.shop-item-preview { height: 80px; border-radius: 12px; margin-bottom: 10px; background-size: cover; background-position: center; border: 2px solid transparent;}
.shop-btn { background: var(--accent); color: #000; border: none; padding: 8px; border-radius: 8px; font-weight: bold; cursor: pointer; width: 100%; margin-top: 10px; transition: 0.2s;}
.shop-btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(167,139,250,0.3); }
.shop-btn:disabled { background: #374151; color: #9ca3af; cursor: not-allowed; transform: none; box-shadow: none;}
.shop-btn.equip { background: transparent; border: 1px solid var(--accent); color: var(--accent); }
.shop-btn.equipped { background: rgba(16, 185, 129, 0.1); border: 1px solid #34d399; color: #34d399; pointer-events: none;}

.profile-actions { display: flex; flex-direction: column; gap: 15px; width: 100%; animation: fadeInUp 0.8s ease;}
.profile-btn { padding: 16px; border-radius: 16px; font-size: 1.1rem; font-weight: 800; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; gap: 10px; border: none; width: 100%;}
.profile-btn.share { background: linear-gradient(135deg, var(--accent), #f472b6); color: #000; box-shadow: 0 10px 20px rgba(167, 139, 250, 0.3);}
.profile-btn.share:hover { transform: translateY(-2px); box-shadow: 0 15px 30px rgba(167, 139, 250, 0.5);}
.profile-btn.logout { background: rgba(239, 68, 68, 0.1); border: 1px solid #ef4444; color: #ef4444; }
.profile-btn.logout:hover { background: #ef4444; color: white; box-shadow: 0 10px 20px rgba(239, 68, 68, 0.3); transform: translateY(-2px); }

.profile-btn.admin { background: rgba(56, 189, 248, 0.1); border: 1px solid #38bdf8; color: #38bdf8; }
.profile-btn.admin:hover { background: #38bdf8; color: #0d0d12; box-shadow: 0 10px 20px rgba(56, 189, 248, 0.3); transform: translateY(-2px); }
.profile-btn.admin.unlocked { background: #facc15; border-color: #facc15; color: #000; }

.auth-btn { background: var(--accent); color: #000; border: none; padding: 12px 15px; border-radius: 8px; width: 100%; cursor: pointer; font-weight: bold; transition: 0.3s; }
.auth-btn:hover { transform: translateY(-2px); box-shadow: 0 0 15px rgba(167,139,250,0.4); }

.install-btn { display: none; background: rgba(16, 185, 129, 0.1); color: #34d399; border: 1px solid #34d399; padding: 12px 15px; border-radius: 12px; font-weight: bold; cursor: pointer; transition: 0.3s; width: 100%; margin-bottom: 10px; }
.install-btn:hover { background: #34d399; color: #0d0d12; box-shadow: 0 8px 20px rgba(16, 185, 129, 0.4); transform: translateY(-2px);}

.main-wrapper { flex: 1; display: flex; flex-direction: column; height: 100vh; overflow: hidden; position: relative; }
.mobile-header { display: none; padding: 15px 20px; justify-content: flex-start; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05); background: var(--bg-sidebar); width: 100%; gap: 15px;}
.mobile-header .logo { margin: 0; font-size: 1.5rem; text-align: left; }

.topbar { display: flex; justify-content: space-between; align-items: center; padding: 20px 40px; background-color: rgba(10, 10, 15, 0.8); backdrop-filter: blur(20px); border-bottom: 1px solid rgba(255,255,255,0.05); z-index: 10; width: 100%;}
.category-tabs { display: flex; gap: 10px; max-width: 100%; overflow-x: auto; padding-bottom: 5px; -webkit-overflow-scrolling: touch;}
.cat-tab { background: transparent; color: var(--text-muted); border: 2px solid transparent; padding: 8px 18px; border-radius: 20px; font-weight: 600; cursor: pointer; transition: all 0.3s; white-space: nowrap; }
.cat-tab:hover { color: var(--text-main); text-shadow: 0 0 8px rgba(255,255,255,0.5); }
.cat-tab.active { border-color: var(--accent); color: var(--text-main); background: rgba(167, 139, 250, 0.15); box-shadow: 0 0 20px rgba(167, 139, 250, 0.2); }

.search-wrapper { position: relative; display: flex; align-items: center; background: transparent; border-radius: 20px; transition: 0.4s; width: 44px; height: 44px; overflow: hidden; border: 1px solid transparent; flex-shrink: 0;}
.search-wrapper.active { width: 350px; background: rgba(26,26,36,0.8); border-color: var(--accent); box-shadow: 0 0 15px rgba(167,139,250,0.3); backdrop-filter: blur(10px); }
.search-btn { position: absolute; left: 0; top: 0; background: transparent; border: none; color: var(--text-main); font-size: 1.2rem; cursor: pointer; width: 44px; height: 100%; display: flex; align-items: center; justify-content: center; z-index: 2; transition: 0.3s; }
.search-wrapper.active .search-btn { color: var(--accent); }
.search-input { width: 100%; height: 100%; background: transparent; border: none; color: white; padding: 0 15px 0 45px; outline: none; font-size: 1rem; opacity: 0; pointer-events: none; transition: 0.3s;}
.search-wrapper.active .search-input { opacity: 1; pointer-events: all; }

.content-area { flex: 1; padding: 30px 40px; overflow-y: auto; overflow-x: hidden; scroll-behavior: smooth; width: 100%;}
.page-title { font-size: 2.2rem; margin-bottom: 25px; font-weight: 800; letter-spacing: -0.5px; }
.collection-filters { display: none; gap: 10px; margin-bottom: 20px; flex-wrap: wrap;}
.col-filter { background: var(--bg-card); border: 1px solid rgba(255,255,255,0.05); color: var(--text-muted); padding: 8px 16px; border-radius: 12px; font-weight: 600; cursor: pointer; transition: 0.3s; }
.col-filter:hover { background: rgba(255,255,255,0.1); color: white; }
.col-filter.active { background: #374151; color: white; box-shadow: 0 4px 12px rgba(0,0,0,0.3); border-color: transparent;}

.tools-panel { display: flex; align-items: center; justify-content: space-between; background: var(--bg-card); padding: 10px 15px; border-radius: 16px; margin-bottom: 20px; border: 1px solid rgba(255,255,255,0.05); backdrop-filter: blur(10px); gap: 15px;}
.local-search-group { display: flex; align-items: center; gap: 10px; flex: 1; background: rgba(0,0,0,0.2); padding: 8px 15px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05);}
.local-search { background: transparent; border: none; color: white; font-size: 1rem; outline: none; width: 100%; padding: 0; }
.local-search::placeholder { color: var(--text-muted); }
.tools-controls { display: flex; gap: 10px; align-items: center; flex-wrap: nowrap;}
select { color-scheme: dark; } 
.sort-select { background: #2a2a35; color: white; border: 1px solid rgba(255,255,255,0.1); padding: 0 15px; border-radius: 12px; font-size: 0.95rem; cursor: pointer; outline: none; font-weight: 600; transition: 0.2s; height: 40px;}
.sort-select:hover, .status-select:focus { border-color: var(--accent); }
.filter-toggle-btn { background: rgba(167, 139, 250, 0.1); border: 1px solid var(--accent); color: var(--text-main); padding: 0 15px; border-radius: 12px; font-weight: 600; cursor: pointer; transition: 0.3s; display: flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; height: 40px;}
.filter-toggle-btn:hover { background: var(--accent); color: #0d0d12; box-shadow: 0 0 15px rgba(167,139,250,0.4); }
.filter-toggle-btn.active { background: var(--accent); color: #0d0d12; }

.smart-filters-panel { display: none; background: var(--bg-card); padding: 20px; border-radius: 12px; border: 1px solid rgba(255,255,255,0.05); margin-bottom: 25px; animation: fadeInUp 0.3s forwards; backdrop-filter: blur(10px); }
.smart-filters-panel.show { display: block; }
.genre-chips-container { display: flex; flex-wrap: wrap; gap: 10px; }
.genre-chip { background: rgba(0,0,0,0.3); border: 1px solid rgba(255,255,255,0.1); color: var(--text-muted); padding: 6px 14px; border-radius: 20px; font-size: 0.85rem; cursor: pointer; transition: 0.2s; }
.genre-chip:hover { border-color: var(--accent); color: white; }
.genre-chip.active { background: var(--accent); color: #000; border-color: var(--accent); box-shadow: 0 0 10px rgba(167,139,250,0.4); font-weight: bold; }

.media-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 25px; padding-bottom: 20px; width: 100%;}
.search-result-item { display: flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; width: 100%; opacity: 0; }
.poster-container { position: relative; width: 100%; border-radius: 16px; overflow: hidden; box-shadow: 0 10px 20px rgba(0,0,0,0.4); transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1); background: #1a1a24; aspect-ratio: 2 / 3; }
.grid-item { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform 0.5s ease;}
.poster-container:hover { transform: translateY(-8px); box-shadow: 0 20px 40px rgba(167, 139, 250, 0.3); }
.poster-container:hover .grid-item { transform: scale(1.05); filter: brightness(1.1); }
.type-badge { position: absolute; top: 10px; left: 10px; color: #0d0d12; padding: 4px 8px; border-radius: 8px; font-size: 0.7rem; font-weight: 800; text-transform: uppercase; box-shadow: 0 4px 15px rgba(0,0,0,0.5); backdrop-filter: blur(4px); z-index: 2; }
.score-badge-corner { position: absolute; top: 10px; right: 10px; background: rgba(15, 15, 20, 0.85); color: #f59e0b; border: 1px solid rgba(245, 158, 11, 0.5); box-shadow: 0 4px 15px rgba(245, 158, 11, 0.3); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 4px; padding: 4px 8px; font-weight: 900; border-radius: 8px; font-size: 0.8rem; z-index: 2;}
.fire-icon { filter: drop-shadow(0 0 4px rgba(239, 68, 68, 0.8)); font-size: 0.9rem; }
.episodes-badge-corner { position: absolute; bottom: 10px; right: 10px; background: rgba(0,0,0,0.85); color: white; padding: 4px 8px; border-radius: 8px; font-size: 0.8rem; font-weight: 800; backdrop-filter: blur(8px); border: 1px solid rgba(255,255,255,0.1); z-index: 2;}
.search-result-title { font-size: 0.9rem; text-align: center; color: #d1d5db; font-weight: 600; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; width: 100%; transition: 0.3s; line-height: 1.3;}
.search-result-item:hover .search-result-title { color: white; }
.skeleton-card { width: 100%; height: 100%; background: linear-gradient(90deg, #1a1a24 25%, #2a2a35 50%, #1a1a24 75%); background-size: 200% 100%; border-radius: 16px; animation: pulseSkeleton 1.5s infinite linear; }
.skeleton-text { width: 70%; height: 14px; background: linear-gradient(90deg, #1a1a24 25%, #2a2a35 50%, #1a1a24 75%); background-size: 200% 100%; border-radius: 4px; margin-top: 5px; animation: pulseSkeleton 1.5s infinite linear; }
#status-message { font-size: 1.1rem; color: var(--text-muted); text-align: center; margin-top: 20px; padding: 20px; border-radius: 12px;}
.error-box { background: rgba(239, 68, 68, 0.1); border: 1px solid #ef4444; color: #ef4444; box-shadow: 0 0 20px rgba(239, 68, 68, 0.2); }
.load-more-btn { margin: 20px auto 40px auto; padding: 14px 35px; background: rgba(167,139,250,0.1); border: 1px solid var(--accent); color: var(--accent); border-radius: 14px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: all 0.3s; backdrop-filter: blur(5px); opacity: 1; pointer-events: all; display: none; text-align: center; }
.load-more-btn:hover { background: var(--accent); color: #0d0d12; box-shadow: 0 0 15px rgba(167,139,250,0.4); }

.auth-container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 80vh; height: 100%; padding: 20px; text-align: center;}
.auth-card { background: var(--bg-card); padding: 30px; border-radius: 20px; border: 1px solid rgba(255,255,255,0.05); width: 100%; max-width: 400px; box-shadow: 0 20px 50px rgba(0,0,0,0.5); text-align: center; animation: fadeInUp 0.5s ease; }
.auth-title { font-size: 1.8rem; font-weight: 800; margin-bottom: 25px; color: white; }
.auth-input { width: 100%; background: #1a1a24; border: 1px solid rgba(255,255,255,0.1); color: white; padding: 15px; border-radius: 12px; margin-bottom: 15px; font-size: 1rem; outline: none; transition: 0.3s;}
.auth-input:focus { border-color: var(--accent); box-shadow: 0 0 15px rgba(167,139,250,0.2); }
.auth-btn-main { background: linear-gradient(135deg, var(--accent), #f472b6); color: #000; border: none; padding: 15px; width: 100%; border-radius: 12px; font-size: 1.1rem; font-weight: 800; cursor: pointer; transition: 0.3s; margin-top: 10px; }

.roulette-container { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; width: 100%; padding: 15px; box-sizing: border-box; overflow: hidden; text-align: center;}
.tabs { display: flex; justify-content: center; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.tab-btn { background-color: transparent; color: #9ca3af; border: 2px solid #374151; padding: 8px 16px; border-radius: 20px; font-size: 0.9rem; font-weight: bold; cursor: pointer; transition: 0.2s; }
.tab-btn.active { background-color: var(--accent); border-color: var(--accent); color: #0d0d12; }
.roulette-btn { background: linear-gradient(135deg, var(--accent), #f472b6); border: none; padding: 15px 35px; border-radius: 20px; font-size: 1.3rem; font-weight: 800; color: #000; cursor: pointer; box-shadow: 0 10px 30px rgba(167, 139, 250, 0.4); transition: 0.3s; }

#swipe-area { display: flex; flex-direction: column; align-items: center; justify-content: center; width: 100%; height: 100%; max-width: 400px; margin: 0 auto; animation: fadeInUp 0.4s ease;}
#swipe-container { position: relative; width: 100%; height: 60vh; min-height: 380px; max-height: 520px; margin-bottom: 20px; perspective: 1000px; }
.swipe-card { position: absolute; width: 100%; height: 100%; top: 0; left: 0; background: var(--bg-card); border: 1px solid rgba(255,255,255,0.1); border-radius: 24px; overflow: hidden; box-shadow: 0 20px 40px rgba(0,0,0,0.6); display: flex; flex-direction: column; cursor: grab; user-select: none; transform-origin: 50% 50%; will-change: transform; backdrop-filter: blur(10px); justify-content: flex-start;}
.swipe-card:active { cursor: grabbing; }

.swipe-poster { width: 100%; height: 50%; object-fit: contain; background: #0a0a0f; padding: 15px; box-sizing: border-box; pointer-events: none; border-bottom: 1px solid rgba(255,255,255,0.05); }
.swipe-info { padding: 15px 20px; text-align: center; flex: 1; display: flex; flex-direction: column; justify-content: center; align-items: center; pointer-events: none; overflow: hidden;}
.swipe-title { font-size: 1.3rem; font-weight: 800; margin-bottom: 5px; color: white; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.2;}
.swipe-meta-row { display: flex; justify-content: center; align-items: center; gap: 8px; margin-bottom: 10px;}
.swipe-genres { font-size: 0.8rem; color: var(--accent); font-weight: 800; text-transform: uppercase; letter-spacing: 1px;}
.swipe-desc { font-size: 0.85rem; color: var(--text-muted); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }

.swipe-stamp { position: absolute; top: 30px; padding: 8px 16px; border-radius: 12px; font-size: 2rem; font-weight: 900; text-transform: uppercase; border: 4px solid; z-index: 10; opacity: 0; pointer-events: none; }
.stamp-nope { right: 20px; color: #ef4444; border-color: #ef4444; transform: rotate(15deg); }
.stamp-like { left: 20px; color: #34d399; border-color: #34d399; transform: rotate(-15deg); background: rgba(0,0,0,0.5); backdrop-filter: blur(5px);}
.swipe-action-btn { position: relative; z-index: 30; width: 60px; height: 60px; border-radius: 50%; font-size: 1.5rem; display: flex; align-items: center; justify-content: center; cursor: pointer; border: none; transition: 0.2s; box-shadow: 0 10px 20px rgba(0,0,0,0.3); }
.swipe-action-btn.nope { background: rgba(239, 68, 68, 0.1); border: 2px solid #ef4444; color: #ef4444; }
.swipe-action-btn.like { background: rgba(52, 211, 153, 0.1); border: 2px solid #34d399; color: #34d399; }
.swipe-action-btn:hover { transform: scale(1.1); }

#export-stats-target { padding: 20px; background-color: var(--bg-main); border-radius: 16px; width: 100%; box-sizing: border-box; } 
.stats-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 25px; flex-wrap: wrap; gap: 15px;}
.share-btn { background: rgba(56, 189, 248, 0.1); border: 1px solid #38bdf8; color: #38bdf8; padding: 10px 20px; border-radius: 12px; font-weight: bold; cursor: pointer; transition: 0.3s; display: flex; align-items: center; gap: 8px;}
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; margin-bottom: 30px; width: 100%; box-sizing: border-box; }
.stat-card { background: var(--bg-card); padding: 20px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); text-align: center; box-shadow: 0 10px 30px rgba(0,0,0,0.3); box-sizing: border-box; }
.stat-value { font-size: 2rem; font-weight: 800; background: linear-gradient(135deg, var(--accent), #f472b6); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 5px; line-height: 1.2;}
.stat-label { color: var(--text-muted); font-size: 0.8rem; font-weight: 600; text-transform: uppercase; }
.charts-wrapper { display: flex; flex-wrap: wrap; gap: 20px; margin-bottom: 30px; width: 100%; box-sizing: border-box; }
.chart-container { flex: 1; min-width: 250px; max-width: 100%; background: var(--bg-card); padding: 20px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.05); box-sizing: border-box; }
.canvas-wrapper { position: relative; width: 100%; height: 220px; max-width: 100%; overflow: hidden; }

.modal-overlay { position: fixed; top: 0; left: 0; width: 100vw; height: 100%; display: none; justify-content: center; align-items: center; z-index: 1000; overflow: hidden; }
.modal-overlay.show { display: flex; }
.modal-bg { position: absolute; top: -5%; left: -5%; width: 110%; height: 110%; background-size: cover; background-position: center; filter: blur(40px) brightness(0.3); opacity: 0; transition: opacity 0.4s ease; z-index: 1; pointer-events: none; }

.title-option { padding: 12px 15px; border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; margin-bottom: 10px; cursor: pointer; display: flex; justify-content: space-between; align-items: center; transition: 0.2s; background: rgba(0,0,0,0.2); }
.title-option.locked { filter: grayscale(100%) opacity(0.5); cursor: not-allowed; }
.title-option.unlocked:hover { border-color: var(--accent); background: rgba(167,139,250,0.1); transform: translateY(-2px); }
.title-option.equipped { border-color: #facc15; background: rgba(250,204,21,0.1); pointer-events: none; }

.card { z-index: 10; background-color: var(--bg-card); backdrop-filter: blur(20px); border: 1px solid rgba(255,255,255,0.08); border-radius: 24px; display: flex; flex-direction: column; max-width: 900px; width: 95vw; box-shadow: 0 30px 60px rgba(0,0,0,0.8); position: relative; max-height: 90vh; overflow-y: auto; overflow-x: hidden; opacity: 0; transform: scale(0.95); transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1); -webkit-overflow-scrolling: touch; }
.modal-overlay.show .card { opacity: 1; transform: scale(1); }
.card-top { display: flex; flex-direction: row; flex-wrap: wrap; width: 100%;}
.close-btn { position: absolute; top: 15px; right: 15px; background: rgba(0,0,0,0.5); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,0.1); color: white; border-radius: 50%; width: 35px; height: 35px; font-size: 1rem; cursor: pointer; z-index: 20; transition: 0.2s; display: flex; align-items: center; justify-content: center;}
.close-btn:hover { background: #ef4444; border-color: #ef4444; transform: rotate(90deg); }
.poster { width: 300px; height: 450px; object-fit: cover; border-radius: 24px 0 0 0; background-color: #1a1a24; }
.info { padding: 30px; display: flex; flex-direction: column; flex: 1; }
.title { margin: 0 0 15px 0; font-size: 2rem; font-weight: 800; letter-spacing: -1px; text-shadow: 0 2px 10px rgba(0,0,0,0.5); word-wrap: break-word; overflow-wrap: break-word;}
.badges { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 20px; }
.badge { background-color: rgba(255,255,255,0.1); border: 1px solid rgba(255,255,255,0.05); color: #fff; padding: 5px 12px; border-radius: 8px; font-size: 0.8rem; font-weight: 600; backdrop-filter: blur(5px); }
.badge.fire-score-modal { background: rgba(15, 15, 20, 0.9); border: 1px solid #f59e0b; color: #f59e0b; box-shadow: 0 0 10px rgba(245, 158, 11, 0.4); text-shadow: 0 0 5px rgba(239, 68, 68, 0.8); }
.synopsis { color: #d1d5db; line-height: 1.6; margin-bottom: 25px; font-size: 1rem; word-break: break-word;}
.add-btn { background: linear-gradient(135deg, #6366f1, var(--accent)); box-shadow: 0 5px 20px rgba(167,139,250,0.4); color: white; border: none; padding: 12px 24px; border-radius: 12px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: 0.3s; width: 100%;}
.tg-btn { display: none; margin-top: 10px; background: rgba(56, 189, 248, 0.1); border: 1px solid #38bdf8; color: #38bdf8; padding: 10px 24px; border-radius: 12px; font-size: 1rem; font-weight: bold; cursor: pointer; transition: 0.3s; width: 100%;}
.status-panel { display: none; position: absolute; bottom: 110%; left: 0; margin-bottom: 5px; background-color: rgba(26,26,36,0.95); backdrop-filter: blur(15px); border: 1px solid rgba(255,255,255,0.1); border-radius: 12px; padding: 8px; flex-direction: column; gap: 5px; z-index: 10; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,0.5);}
.status-panel.show { display: flex; animation: fadeInUp 0.2s; }
.status-option { background: transparent; color: white; border: none; padding: 8px 12px; text-align: left; border-radius: 6px; cursor: pointer; font-weight: 600; transition: 0.2s;}
.status-option:hover { background-color: rgba(167,139,250,0.2); color: var(--accent); }

.manage-panel { display: flex; flex-direction: column; gap: 12px; background-color: #1a1a24; border: 1px solid rgba(255,255,255,0.05); padding: 15px; border-radius: 16px; width: 100%;}
.manage-row { display: flex; width: 100%; gap: 12px; align-items: center; }
.inner-row-box { display: flex; align-items: center; justify-content: space-between; background-color: #0d0d12; padding: 10px 15px; border-radius: 10px; flex-wrap: wrap; gap: 10px;}
.delete-btn { background: transparent; border: 1px solid #ef4444; color: #ef4444; padding: 10px 15px; border-radius: 10px; cursor: pointer; font-weight: bold; transition: 0.2s; font-size: 0.95rem; height: 100%; display: flex; align-items: center;}

.ep-btn { background-color: rgba(255,255,255,0.05); color: white; border: 1px solid rgba(255,255,255,0.1); width: 34px; height: 34px; border-radius: 8px; cursor: pointer; font-size: 1.2rem; display: flex; align-items: center; justify-content: center; transition: 0.2s;}
.ep-btn:hover { background-color: var(--accent); color: #0d0d12; }
.ep-input { background: transparent; border: none; color: white; width: 50px; text-align: right; font-size: 1.1rem; font-weight: bold; outline: none; padding: 0;}
.ep-input::-webkit-outer-spin-button, .ep-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.ep-total-text { color: var(--text-muted); font-size: 1.1rem; font-weight: bold; margin-left: 5px; margin-right: 10px;}

.rating-icons { display: flex; gap: 4px; font-size: 1.4rem; justify-content: space-between; width: 100%; margin-top: 8px;}
.rating-icon { color: #374151; cursor: pointer; transition: 0.2s; filter: grayscale(100%); }
.rating-icon.active { color: #f59e0b; filter: grayscale(0%); text-shadow: 0 0 10px rgba(245,158,11,0.5); transform: scale(1.1); }
.rating-icon:hover { transform: scale(1.2); }

.similar-section { padding: 0 30px 30px 30px; width: 100%; box-sizing: border-box; }
.similar-grid { display: flex; overflow-x: auto; gap: 15px; width: 100%; padding-bottom: 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
.similar-grid::-webkit-scrollbar { height: 6px; }
.similar-grid::-webkit-scrollbar-track { background: transparent; }
.similar-grid::-webkit-scrollbar-thumb { background: #374151; border-radius: 10px; }
.similar-grid > div { flex: 0 0 130px; scroll-snap-align: start; display: flex; flex-direction: column; gap: 8px; }
.similar-grid .poster-container { width: 130px; aspect-ratio: 2 / 3; flex-shrink: 0; }

@media (max-width: 768px) {
    body { flex-direction: column; padding-bottom: 0; }
    
    .mobile-header { display: flex; padding: 15px 20px; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255,255,255,0.05); background: var(--bg-sidebar); width: 100vw; gap: 15px; position: sticky; top: 0; z-index: 50; }
    .mobile-header .logo { margin: 0; font-size: 1.5rem; text-align: left; }
    
    .hamburger-menu { display: block; }

    .sidebar { position: fixed; top: 0; left: 0; width: 250px; height: 100vh; padding: 20px; flex-direction: column; justify-content: flex-start; align-items: flex-start; border-right: 1px solid rgba(255,255,255,0.1); border-top: none; background: rgba(17, 17, 24, 0.98); backdrop-filter: blur(15px); z-index: 1000; transform: translateX(-100%); box-sizing: border-box; }
    .sidebar.open { transform: translateX(0); }
    
    .sidebar > div:first-child { width: 100%; display: block; overflow: visible; }
    .logo, .nav-section-title, .sidebar-bottom { display: block !important; }

    .nav-menu { display: flex; flex-direction: column; width: 100%; margin: 0; gap: 8px; overflow-x: hidden; padding: 0; -webkit-overflow-scrolling: auto; }
    .nav-item { flex: 0 0 auto; width: 100%; padding: 12px 15px; flex-direction: row; gap: 10px; text-align: left; justify-content: flex-start; border-radius: 12px;}
    .nav-icon { font-size: 1.2rem; width: 24px; }
    .nav-text { font-size: 1rem; white-space: normal; font-weight: 600;}

    .topbar { padding: 15px; flex-direction: column; gap: 15px; width: 100vw; box-sizing: border-box; }
    .category-tabs { width: 100%; overflow-x: auto; padding-bottom: 5px; -webkit-overflow-scrolling: touch; justify-content: flex-start;}
    .search-wrapper { width: 100%; height: 46px; border-radius: 12px; background: rgba(26,26,36,0.8); border: 1px solid rgba(255,255,255,0.1); display: flex; position: relative;}
    .search-wrapper.active { width: 100%; }
    .search-input { opacity: 1; pointer-events: all; width: 100%; padding-left: 45px; height: 100%; box-sizing: border-box; }
    .search-btn { position: absolute; left: 0; top: 0; width: 46px; height: 46px; display: flex; align-items: center; justify-content: center;}

    .tools-panel { flex-direction: column; align-items: stretch; padding: 12px; gap: 12px; border-radius: 16px; margin-bottom: 15px;}
    .local-search-group { width: 100%; box-sizing: border-box; padding: 8px 12px;}
    .tools-controls { display: flex; flex-direction: row; width: 100%; gap: 10px; }
    
    /* FIX: Allow sort-select to take available width on mobile */
    .sort-select { flex: 1; width: auto; padding: 0 10px; font-size: 0.85rem; height: 44px; display: flex; align-items: center; justify-content: center;}
    .filter-toggle-btn { width: auto; padding: 0 10px; font-size: 0.85rem; height: 44px; display: flex; align-items: center; justify-content: center;}

    .content-area { padding: 15px; height: 100%; overflow-y: auto; overflow-x: hidden; width: 100%; box-sizing: border-box; }
    .page-title { font-size: 1.6rem; text-align: center; margin-bottom: 15px;}
    .media-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; padding-bottom: 10px; width: 100%;}
    .search-result-title { font-size: 0.8rem; }
    .poster-container { border-radius: 12px; }
    .modal-overlay { align-items: flex-end; }

    .card { width: 100vw; max-width: 100vw; max-height: 85vh; margin: 0; border-radius: 24px 24px 0 0; border: none; padding-bottom: calc(20px + env(safe-area-inset-bottom, 20px)); overflow-y: auto; }
    .card-top { flex-direction: column; width: 100%; }
    .poster { width: 100%; height: 380px; object-fit: contain; border-radius: 24px 24px 0 0; background-color: #0a0a0f; padding: 20px; box-sizing: border-box; }
    .info { padding: 20px; width: 100%; overflow: visible; box-sizing: border-box;}
    .title { font-size: 1.5rem; text-align: center; }
    .badges { justify-content: center; }

    .similar-section { padding: 0 20px 20px 20px; width: 100%; box-sizing: border-box;}
    .similar-grid > div { flex: 0 0 110px; }
    .similar-grid .poster-container { width: 110px; }

    .manage-row { flex-direction: column; align-items: stretch; gap: 12px; }
    .manage-row select { height: 46px; }
    .delete-btn { height: 46px; justify-content: center; }

    #export-stats-target { padding: 10px; width: 100%; max-width: 100%; box-sizing: border-box; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 20px; width: 100%;}
    .stat-card { padding: 12px 10px; border-radius: 12px; width: 100%; box-sizing: border-box;}
    .stat-value { font-size: 1.5rem !important; }
    .stat-label { font-size: 0.7rem; }
    .charts-wrapper { flex-direction: column; gap: 15px; width: 100%; box-sizing: border-box; }
    .chart-container { min-width: 100%; width: 100%; padding: 15px; box-sizing: border-box; }
    .canvas-wrapper { height: 260px; width: 100%; max-width: 100%; } 

    .tabs { gap: 8px; }
    .tab-btn { flex: 1 1 30%; max-width: 48%; padding: 10px; font-size: 0.85rem; text-align: center; }
    .roulette-btn { width: 100%; font-size: 1.1rem; padding: 15px; box-sizing: border-box; }
    #swipe-container { height: 50vh; min-height: 380px; max-height: 480px; width: 100%; max-width: 340px; margin: 0 auto 30px auto; }
    
    /* Companions mobile override */
    #companion-container { bottom: 90px; right: 10px; }
    .comp-img { width: 50px; height: 50px; }
    .comp-speech { font-size: 0.75rem; padding: 6px 10px; right: -10px; }
    
    .shop-grid { grid-template-columns: repeat(2, 1fr); }
    .profile-btn { font-size: 0.95rem; padding: 14px; }
    
    /* Profile font tweaks */
    .profile-name { font-size: 2rem; }
    .badge-level, .badge-class { font-size: 0.75rem; }
    .exp-val { font-size: 0.75rem; }
    
    /* FIX: Rating icons mobile width */
    .rating-icons { font-size: 1.1rem; gap: 2px; justify-content: space-between; }
}

.graveyard-box { background: var(--bg-card); border: 1px solid rgba(255,255,255,0.05); padding: 20px; border-radius: 16px; margin-bottom: 20px; box-sizing: border-box; width: 100%; box-shadow: 0 10px 30px rgba(0,0,0,0.3); text-align: center; }
.progress-bar-bg { width: 100%; height: 12px; background: rgba(0,0,0,0.5); border-radius: 6px; overflow: hidden; border: 1px solid rgba(255,255,255,0.1); margin: 10px 0; }
.progress-bar-fill { height: 100%; background: linear-gradient(90deg, #34d399, #10b981); width: 0%; transition: width 1.5s cubic-bezier(0.4, 0, 0.2, 1); box-shadow: 0 0 10px rgba(52, 211, 153, 0.5); }
.graveyard-text { font-size: 0.85rem; color: var(--text-muted); font-weight: bold; }

/* Auras (Now animated borders) */
.aura-wrapper { position: absolute; top: -3px; left: -3px; right: -3px; bottom: -3px; border-radius: 50%; pointer-events: none; z-index: 3; box-sizing: border-box; }
.aura-sakura { border: 3px dashed #f472b6; animation: spin-aura 8s linear infinite; box-shadow: 0 0 15px rgba(244, 114, 182, 0.5), inset 0 0 15px rgba(244, 114, 182, 0.5); }
.aura-title { border: 4px dotted var(--accent); animation: spin-aura 4s linear infinite reverse; box-shadow: 0 0 20px rgba(167, 139, 250, 0.8); }
.aura-bunker { border: 5px double #38bdf8; animation: spin-aura 6s ease-in-out infinite alternate; box-shadow: 0 0 25px rgba(56, 189, 248, 0.6), inset 0 0 20px rgba(56, 189, 248, 0.4); }
@keyframes spin-aura { 100% { transform: rotate(360deg); } }

/* Companions */
#companion-container { position: fixed; bottom: 20px; right: 20px; z-index: 1000; display: none; flex-direction: column; align-items: center; cursor: pointer; pointer-events: none; }
.comp-img { width: 70px; height: 70px; object-fit: contain; filter: drop-shadow(0 10px 15px rgba(0,0,0,0.5)); animation: float-comp 4s ease-in-out infinite; transform-origin: bottom center; pointer-events: auto; }
.comp-speech { position: absolute; bottom: 110%; right: 10%; background: white; color: black; padding: 10px 15px; border-radius: 16px 16px 0 16px; font-weight: bold; font-size: 0.9rem; white-space: nowrap; opacity: 0; transform: translateY(10px) scale(0.9); transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); pointer-events: none; box-shadow: 0 10px 20px rgba(0,0,0,0.4); z-index: 1001; }
.comp-speech::after { content: ''; position: absolute; bottom: -8px; right: 15px; border-width: 8px 8px 0 0; border-style: solid; border-color: white transparent transparent transparent; }
.comp-speech.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
@keyframes float-comp { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-15px); } }

/* --- Floating Particles (New Auras) --- */
.profile-particle-container {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    pointer-events: none;
    z-index: 1; /* Чтобы летать ПОЗАДИ аватарки и текста */
    overflow: hidden;
    border-radius: inherit;
}
.floating-particle {
    position: absolute;
    opacity: 0;
    user-select: none;
    pointer-events: none;
    animation: floatParticle linear infinite;
    filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5));
}

@keyframes floatParticle {
    0% { transform: translateY(50px) scale(0.5) rotate(0deg); opacity: 0; }
    10% { opacity: 0.8; }
    80% { opacity: 0.8; }
    100% { transform: translateY(-150px) scale(1.2) rotate(360deg); opacity: 0; }
}