:root {
    --bg-primary: #0a0a1a;
    --bg-card: #12122a;
    --bg-card-hover: #1a1a3a;
    --bg-menu: #0d0d20;
    --accent: #00e5ff;
    --accent-glow: rgba(0, 229, 255, 0.25);
    --accent-secondary: #b388ff;
    --accent-warm: #ffd740;
    --text-primary: #e8e8f0;
    --text-secondary: #8888aa;
    --text-muted: #555577;
    --danger: #ff5252;
    --success: #69f0ae;
    --border: #1e1e3a;
    --border-glow: rgba(0, 229, 255, 0.1);
    --radius: 12px;
    --radius-sm: 8px;
    --radius-xs: 6px;
    --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ===== HUB LAYOUT ===== */
#app { position: relative; min-height: 100vh; }

/* ===== LOADER ===== */
.loader {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 60px 0;
}
.loader-spinner {
    width: 36px; height: 36px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== LEFT MENU ===== */
.menu-overlay {
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.6);
    z-index: 500;
    display: none;
}
.menu-overlay.open { display: block; }

.menu-panel {
    position: fixed; top: 0; left: -280px;
    width: 280px; height: 100vh;
    background: var(--bg-menu);
    border-right: 1px solid var(--border);
    z-index: 501;
    transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    overflow-y: auto;
    padding: 20px 0;
}
.menu-panel.open { left: 0; }

.menu-header {
    padding: 0 20px 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 8px;
}
.menu-header h2 {
    font-size: 18px;
    color: var(--accent);
    letter-spacing: 1px;
}
.menu-header p {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 4px;
}

.menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 20px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}
.menu-item:hover {
    background: rgba(0, 229, 255, 0.05);
    color: var(--text-primary);
}
.menu-item .menu-icon { font-size: 18px; width: 24px; text-align: center; }
.menu-item .menu-lock {
    margin-left: auto;
    font-size: 12px;
    color: var(--text-muted);
}

/* ===== STATUS BAR ===== */
.hub-container { max-width: 480px; margin: 0 auto; padding: 0; }

.status-bar {
    background: linear-gradient(180deg, var(--bg-card) 0%, var(--bg-primary) 100%);
    border-bottom: 1px solid var(--border);
    padding: 16px;
    position: sticky;
    top: 0;
    z-index: 100;
}

.status-top {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.menu-toggle {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 18px;
}
.menu-toggle:hover { border-color: var(--accent); }

.user-badge {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
}
.user-badge .avatar {
    width: 40px; height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #000;
    font-weight: 700;
    flex-shrink: 0;
}
.user-badge .info { flex: 1; min-width: 0; }
.user-badge .info .title {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.3px;
}
.user-badge .info .name {
    font-size: 15px;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.neon-balance {
    display: flex;
    align-items: center;
    gap: 6px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid var(--border-glow);
    border-radius: 20px;
    padding: 6px 14px;
    font-size: 16px;
    font-weight: 700;
    color: var(--accent);
    white-space: nowrap;
}
.neon-balance .icon { font-size: 14px; }

.status-details {
    display: flex;
    gap: 16px;
    padding-left: 48px;
}

.status-item {
    flex: 1;
}
.status-item .label {
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}
.status-item .value {
    font-size: 14px;
    font-weight: 600;
}

.xp-bar {
    height: 6px;
    background: var(--bg-primary);
    border-radius: 3px;
    overflow: hidden;
    margin-top: 4px;
    max-width: 120px;
}
.xp-bar .fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), var(--accent-secondary));
    border-radius: 3px;
    transition: width 0.5s ease;
}

.lvl-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 2px 10px;
    background: rgba(179, 136, 255, 0.15);
    border: 1px solid rgba(179, 136, 255, 0.3);
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
    color: var(--accent-secondary);
}

.cases-count {
    display: flex;
    align-items: center;
    gap: 6px;
}
.cases-count .num {
    font-weight: 700;
    color: var(--accent-warm);
}
.cases-count .sep { color: var(--text-muted); }

/* ===== CARD GRID ===== */
.card-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    padding: 16px;
}

.hub-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 18px 8px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: all 0.25s;
    text-decoration: none;
    color: var(--text-primary);
    min-height: 100px;
    position: relative;
}
.hub-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--border-glow);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 229, 255, 0.08);
}
.hub-card .card-icon {
    font-size: 28px;
    line-height: 1;
}
.hub-card .card-label {
    font-size: 11px;
    text-align: center;
    color: var(--text-secondary);
    font-weight: 500;
    line-height: 1.3;
}
.hub-card.locked {
    opacity: 0.5;
    cursor: default;
}
.hub-card.locked .card-lock {
    position: absolute;
    top: 8px; right: 8px;
    font-size: 12px;
    color: var(--text-muted);
}
.hub-card.locked:hover {
    transform: none;
    box-shadow: none;
}
.hub-card .card-badge {
    position: absolute;
    top: 6px; right: 6px;
    font-size: 10px;
    padding: 2px 6px;
    border-radius: 8px;
    background: var(--danger);
    color: #fff;
    font-weight: 600;
}
.hub-card.wide {
    grid-column: span 2;
}

/* ===== CONTENT PAGES ===== */
.page {
    max-width: 480px;
    margin: 0 auto;
    padding: 16px;
}

.page-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
}
.page-header .back-btn {
    width: 36px; height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    cursor: pointer;
    color: var(--text-primary);
    font-size: 16px;
}
.page-header h2 {
    font-size: 18px;
    font-weight: 600;
}

.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px;
    margin-bottom: 12px;
}
.card:hover { background: var(--bg-card-hover); }

.card-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.card-text { font-size: 14px; color: var(--text-secondary); line-height: 1.5; }

/* ===== PROFILE PAGE ===== */
.profile-card { text-align: center; }
.profile-avatar {
    width: 72px; height: 72px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 12px;
    color: #000;
    font-weight: 700;
}
.profile-card h2 { font-size: 20px; margin-bottom: 4px; }
.profile-card .profile-title {
    font-size: 13px;
    color: var(--accent);
    margin-bottom: 16px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 14px;
}
.stat {
    background: var(--bg-primary);
    border-radius: var(--radius-sm);
    padding: 12px;
}
.stat-value {
    display: block;
    font-size: 22px;
    font-weight: 700;
    color: var(--accent);
}
.stat-label {
    display: block;
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.dept-badge {
    display: inline-block;
    padding: 6px 16px;
    background: rgba(179, 136, 255, 0.15);
    border: 1px solid var(--accent-secondary);
    border-radius: 20px;
    font-size: 13px;
    color: var(--accent-secondary);
}
.titles { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.badge {
    padding: 4px 10px;
    background: rgba(0, 229, 255, 0.1);
    border: 1px solid var(--accent);
    border-radius: 12px;
    font-size: 11px;
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* ===== PRIZES ===== */
.section-title { font-size: 18px; font-weight: 600; margin-bottom: 12px; }
.prize-card { display: flex; flex-direction: column; }
.prize-img { width: 100%; height: 140px; object-fit: cover; border-radius: var(--radius-sm); margin-bottom: 12px; }
.prize-placeholder { width: 100%; height: 80px; display: flex; align-items: center; justify-content: center; font-size: 36px; background: var(--bg-primary); border-radius: var(--radius-sm); margin-bottom: 12px; }
.prize-card h3 { font-size: 16px; margin-bottom: 6px; }
.prize-desc { font-size: 13px; color: var(--text-secondary); line-height: 1.4; flex: 1; }
.prize-footer { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.prize-cost { font-size: 16px; font-weight: 700; color: var(--accent); }

/* ===== BUTTONS ===== */
.btn {
    border: none; border-radius: var(--radius-sm);
    padding: 10px 20px; font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
}
.btn-primary {
    background: var(--accent); color: var(--bg-primary);
}
.btn-primary:hover { box-shadow: 0 0 20px var(--accent-glow); }
.btn-sm { padding: 8px 16px; font-size: 13px; }
.btn-block { width: 100%; }

/* ===== LEADERBOARD ===== */
.leaderboard-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.rank {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    border-radius: 50%;
    font-size: 14px; font-weight: 700;
    background: var(--bg-primary); color: var(--text-secondary);
    flex-shrink: 0;
}
.rank-1 { background: rgba(255, 215, 0, 0.2); color: #ffd700; }
.rank-2 { background: rgba(192, 192, 192, 0.2); color: #c0c0c0; }
.rank-3 { background: rgba(205, 127, 50, 0.2); color: #cd7f32; }
.dept-name { flex: 1; font-weight: 500; }
.dept-neons { color: var(--accent); font-weight: 600; }

/* ===== UGC FORM ===== */
.ugc-form .form-group { margin-bottom: 14px; }
.ugc-form label { display: block; font-size: 13px; color: var(--text-secondary); margin-bottom: 6px; }
.ugc-form input, .ugc-form textarea, .ugc-form select {
    width: 100%; padding: 10px 12px;
    background: var(--bg-primary); border: 1px solid var(--border);
    border-radius: var(--radius-sm); color: var(--text-primary);
    font-size: 14px; font-family: inherit;
}
.ugc-form input:focus, .ugc-form textarea:focus, .ugc-form select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-glow);
}
.ugc-form .btn { width: 100%; margin-top: 8px; }
.char-count { font-size: 12px; color: var(--text-secondary); margin-top: 4px; display: block; }
.char-count.red { color: var(--danger); }

/* ===== CASE DISPLAY ===== */
.case-card { padding: 20px; }
.case-card .case-text {
    font-size: 15px;
    line-height: 1.6;
    margin-bottom: 16px;
    color: var(--text-primary);
}
.option-btn {
    display: block;
    width: 100%;
    padding: 14px 16px;
    margin-bottom: 8px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: left;
}
.option-btn:hover {
    border-color: var(--accent);
    background: rgba(0, 229, 255, 0.05);
}

/* ===== ARCHIVE ===== */
.archive-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}
.archive-item:last-child { border-bottom: none; }
.archive-item .date { font-size: 11px; color: var(--text-muted); min-width: 60px; }
.archive-item .text { font-size: 13px; color: var(--text-secondary); flex: 1; }

/* ===== LEDGER ===== */
.ledger-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
}
.ledger-item:last-child { border-bottom: none; }
.ledger-item .reason { font-size: 13px; color: var(--text-secondary); }
.ledger-item .amount {
    font-weight: 700;
    font-size: 15px;
}
.ledger-item .amount.pos { color: var(--success); }
.ledger-item .amount.neg { color: var(--danger); }

/* ===== MISC ===== */
.error-msg {
    position: fixed;
    bottom: 20px; left: 50%; transform: translateX(-50%);
    background: var(--bg-card);
    border: 1px solid var(--danger);
    color: var(--danger);
    padding: 10px 20px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    z-index: 999;
    animation: fadeIn 0.3s;
}
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
    font-size: 15px;
}
@keyframes fadeIn {
    from { opacity: 0; transform: translateX(-50%) translateY(10px); }
    to { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
