/* ============================================================
   ROLEPLAY PROJECT ONLINE — Main Stylesheet
   Dark theme, Torn-style layout, fully animated & mobile-first
   ============================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #050508;
    --bg-panel: #0d1117;
    --bg-card: #111827;
    --bg-hover: #1a1f2e;
    --bg-elevated: #161b28;
    --border: #1a1f2e;
    --border-light: #2a2f3e;
    --text: #e5e7eb;
    --text-sub: #9ca3af;
    --text-dim: #6b7280;
    --accent: #3b82f6;
    --accent-hover: #60a5fa;
    --accent-glow: rgba(59,130,246,0.15);
    --accent-dim: rgba(59,130,246,0.08);
    --green: #22c55e;
    --green-glow: rgba(34,197,94,0.15);
    --red: #ef4444;
    --red-glow: rgba(239,68,68,0.15);
    --yellow: #eab308;
    --yellow-glow: rgba(234,179,8,0.15);
    --orange: #f97316;
    --orange-glow: rgba(249,115,22,0.15);
    --purple: #a855f7;
    --purple-glow: rgba(168,85,247,0.15);
    --cyan: #06b6d4;
    --cyan-glow: rgba(6,182,212,0.15);
    --radius: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;
    --topnav-h: 56px;
    --sidebar-w: 200px;
    --right-w: 240px;
    --font: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.4);
    --shadow-lg: 0 8px 32px rgba(0,0,0,0.5);
    --shadow-glow: 0 0 20px rgba(59,130,246,0.15);
    --transition: 0.2s cubic-bezier(0.4,0,0.2,1);
    --transition-spring: 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

html, body {
    height: 100%;
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    font-size: 13px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    scroll-behavior: smooth;
}

a { color: var(--accent); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--accent-hover); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-12px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideOutRight { from { opacity: 1; transform: translateX(0); } to { opacity: 0; transform: translateX(100%); } }
@keyframes scaleIn { from { opacity: 0; transform: scale(0.95); } to { opacity: 1; transform: scale(1); } }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes shimmer { 0% { background-position: -200% 0; } 100% { background-position: 200% 0; } }
@keyframes shake { 0%, 100% { transform: translateX(0); } 10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); } 20%, 40%, 60%, 80% { transform: translateX(4px); } }
@keyframes bounceIn { 0% { opacity: 0; transform: scale(0.3); } 50% { opacity: 1; transform: scale(1.05); } 70% { transform: scale(0.95); } 100% { transform: scale(1); } }
@keyframes spin { to { transform: rotate(360deg); } }

.content { animation: fadeInUp 0.3s ease-out; }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-light); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-dim); }

/* ===== ICONS ===== */
.icon { width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }
.icon-sm { width: 14px; height: 14px; }
.icon-lg { width: 20px; height: 20px; }

/* ===== TOP NAV ===== */
.topnav {
    position: fixed; top: 0; left: 0; right: 0;
    height: var(--topnav-h);
    background: rgba(13,17,23,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 100;
}
.topnav-inner {
    max-width: 1440px; margin: 0 auto; height: 100%;
    display: flex; align-items: center; padding: 0 16px; gap: 16px;
}
.topnav-brand {
    display: flex; align-items: center; gap: 10px;
    color: var(--text); font-weight: 700; flex-shrink: 0; text-decoration: none;
}
.topnav-logo {
    width: 34px; height: 34px;
    background: linear-gradient(135deg, var(--accent), #6366f1);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 13px; font-weight: 900; color: #fff;
    box-shadow: 0 2px 8px rgba(59,130,246,0.3);
    transition: transform var(--transition);
}
.topnav-brand:hover .topnav-logo { transform: scale(1.08) rotate(-3deg); }
.topnav-title { font-size: 15px; letter-spacing: -0.3px; }
.topnav-links {
    display: flex; align-items: center; gap: 2px;
    flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-left: auto;
}
.topnav-links::-webkit-scrollbar { display: none; }
.topnav-link {
    padding: 7px 12px; border-radius: 8px; font-size: 12.5px; font-weight: 500;
    color: var(--text-sub); white-space: nowrap; transition: all var(--transition);
    display: inline-flex; align-items: center; gap: 4px;
}
.topnav-link:hover { color: var(--text); background: var(--bg-hover); }
.topnav-link.active { color: var(--accent); background: var(--accent-dim); }
.topnav-link-dim { color: var(--text-dim); }

.badge {
    display: inline-flex; align-items: center; justify-content: center;
    min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--red); color: #fff; font-size: 10px; font-weight: 700;
    margin-left: 4px; animation: bounceIn 0.4s ease;
}
.badge-sm {
    display: inline-flex; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: 8px; background: var(--red); color: #fff; font-size: 9px;
    font-weight: 700; margin-left: 4px; align-items: center; justify-content: center;
}

/* Burger */
.topnav-burger {
    display: none; flex-direction: column; gap: 5px;
    background: none; border: none; cursor: pointer; padding: 6px;
    margin-left: auto; border-radius: 6px; transition: background var(--transition);
}
.topnav-burger:hover { background: var(--bg-hover); }
.topnav-burger span {
    display: block; width: 20px; height: 2px; background: var(--text-sub);
    border-radius: 1px; transition: all 0.3s ease; transform-origin: center;
}
.topnav-burger.active span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.topnav-burger.active span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.topnav-burger.active span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Mobile drawer - hidden on desktop, slide-in on mobile */
.mobile-drawer {
    display: none;
}
.mobile-drawer.open {
    position: fixed; top: var(--topnav-h); left: 0; right: 0; bottom: 0;
    background: rgba(5,5,8,0.97);
    backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
    z-index: 99; display: flex; flex-direction: column;
    padding: 12px 16px 24px; overflow-y: auto;
    animation: fadeIn 0.2s ease;
}
.mobile-drawer-section { margin-bottom: 8px; }
.mobile-drawer-heading {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--text-dim); padding: 8px 12px 4px;
}
.mobile-drawer a {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 14px; color: var(--text-sub); font-size: 14px; font-weight: 500;
    border-radius: var(--radius); transition: all var(--transition);
}
.mobile-drawer a:hover, .mobile-drawer a.active { background: var(--bg-hover); color: var(--text); }

/* Mobile resource strip */
.mobile-resources {
    display: none; position: fixed; top: var(--topnav-h); left: 0; right: 0;
    background: var(--bg-panel); border-bottom: 1px solid var(--border);
    padding: 8px 12px; z-index: 98; gap: 8px;
}
.mobile-resource { flex: 1; min-width: 0; }
.mobile-resource-label {
    font-size: 9px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 0.5px; color: var(--text-dim); margin-bottom: 2px;
    display: flex; justify-content: space-between;
}
.mobile-resource-bar { height: 4px; background: rgba(255,255,255,0.06); border-radius: 2px; overflow: hidden; }
.mobile-resource-fill { height: 100%; border-radius: 2px; transition: width 0.5s ease; }

/* ===== GAME CONTAINER ===== */
.game-container {
    display: flex; max-width: 1440px; margin: 0 auto;
    padding-top: var(--topnav-h); min-height: 100vh;
}

/* ===== LEFT SIDEBAR ===== */
.sidebar-left {
    width: var(--sidebar-w); flex-shrink: 0; padding: 16px 10px;
    border-right: 1px solid var(--border); position: sticky;
    top: var(--topnav-h); height: calc(100vh - var(--topnav-h));
    overflow-y: auto; scrollbar-width: thin;
}
.sidebar-section { margin-bottom: 16px; }
.sidebar-heading {
    font-size: 10px; font-weight: 700; text-transform: uppercase;
    letter-spacing: 1.5px; color: var(--text-dim); padding: 0 10px; margin-bottom: 4px;
}
.sidebar-link {
    display: flex; align-items: center; gap: 8px; padding: 8px 10px;
    border-radius: 8px; font-size: 12.5px; font-weight: 500;
    color: var(--text-sub); transition: all var(--transition); position: relative;
}
.sidebar-link:hover { background: var(--bg-hover); color: var(--text); }
.sidebar-link.active { background: var(--accent-glow); color: var(--accent); }
.sidebar-link.active::before {
    content: ''; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
    width: 3px; height: 16px; background: var(--accent); border-radius: 0 3px 3px 0;
}
.sidebar-icon { width: 16px; height: 16px; opacity: 0.5; transition: opacity var(--transition); flex-shrink: 0; }
.sidebar-link:hover .sidebar-icon, .sidebar-link.active .sidebar-icon { opacity: 1; }

/* ===== MAIN CONTENT ===== */
.content { flex: 1; min-width: 0; padding: 24px 28px; }

/* ===== RIGHT SIDEBAR ===== */
.sidebar-right {
    width: var(--right-w); flex-shrink: 0; padding: 16px 14px;
    border-left: 1px solid var(--border); position: sticky;
    top: var(--topnav-h); height: calc(100vh - var(--topnav-h));
    overflow-y: auto; display: flex; flex-direction: column;
    gap: 10px; scrollbar-width: thin;
}

/* ===== RESOURCE BARS ===== */
.resource-panel { display: flex; flex-direction: column; gap: 8px; }
.resource-bar-group { padding: 6px 0; transition: all var(--transition); }
.resource-bar-group:hover { transform: translateX(-2px); }
.resource-label {
    display: flex; justify-content: space-between; font-size: 11px;
    font-weight: 600; color: var(--text-sub); margin-bottom: 4px;
}
.resource-bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.resource-fill {
    height: 100%; border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1); position: relative;
}
.resource-fill::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.15) 50%, transparent 100%);
    background-size: 200% 100%; animation: shimmer 3s infinite; opacity: 0.5;
}
.resource-fill.energy { background: linear-gradient(90deg, #22c55e, #4ade80); }
.resource-fill.nerve { background: linear-gradient(90deg, #f97316, #fb923c); }
.resource-fill.happy { background: linear-gradient(90deg, #eab308, #fbbf24); }
.resource-fill.life { background: linear-gradient(90deg, #ef4444, #f87171); }
.resource-timer { font-size: 10px; color: var(--text-dim); margin-top: 2px; font-family: var(--mono); font-weight: 500; }

/* ===== INFO PANELS ===== */
.info-panel {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 12px 14px;
    transition: border-color var(--transition);
}
.info-panel:hover { border-color: var(--border-light); }
.info-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; }
.info-row.small { font-size: 10px; color: var(--text-dim); justify-content: center; }
.info-label { font-size: 11px; color: var(--text-dim); font-weight: 500; display: flex; align-items: center; gap: 4px; }
.info-value { font-size: 12px; font-weight: 700; color: var(--text); }
.info-value.cash { color: var(--green); }
.xp-bar-wrap { height: 5px; background: rgba(255,255,255,0.06); border-radius: 3px; margin: 6px 0 2px; overflow: hidden; }
.xp-bar {
    height: 100%; background: linear-gradient(90deg, var(--accent), #818cf8);
    border-radius: 3px; transition: width 0.6s ease; position: relative;
}
.xp-bar::after {
    content: ''; position: absolute; inset: 0;
    background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,0.2) 50%, transparent 100%);
    background-size: 200% 100%; animation: shimmer 3s infinite;
}

.status-alert {
    text-align: center; padding: 8px 12px; border-radius: var(--radius);
    font-size: 12px; font-weight: 700; margin-top: 6px;
    display: flex; align-items: center; justify-content: center; gap: 6px;
    animation: pulse 2s infinite;
}
.status-alert.hospital { background: var(--red-glow); color: var(--red); }
.status-alert.jail { background: var(--orange-glow); color: var(--orange); }
.status-alert.traveling { background: var(--accent-glow); color: var(--accent); }

/* ===== PAGE COMPONENTS ===== */
.page-header { margin-bottom: 24px; animation: fadeInDown 0.3s ease-out; }
.page-title {
    font-size: 24px; font-weight: 800; letter-spacing: -0.5px; margin-bottom: 4px;
    display: flex; align-items: center; gap: 10px;
}
.page-subtitle { font-size: 13px; color: var(--text-sub); }

/* Cards */
.card {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 20px; margin-bottom: 16px;
    transition: border-color var(--transition), box-shadow var(--transition);
    animation: fadeInUp 0.35s ease-out both;
}
.card:hover { border-color: var(--border-light); }
.card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.card-title { font-size: 15px; font-weight: 700; letter-spacing: -0.3px; display: flex; align-items: center; gap: 8px; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.card-glow { box-shadow: var(--shadow-glow); border-color: rgba(59,130,246,0.3); }
.card:nth-child(2) { animation-delay: 0.05s; }
.card:nth-child(3) { animation-delay: 0.1s; }
.card:nth-child(4) { animation-delay: 0.15s; }
.card:nth-child(5) { animation-delay: 0.2s; }

/* Stat boxes */
.stat-box {
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); padding: 16px; text-align: center;
    transition: all var(--transition); position: relative; overflow: hidden;
}
.stat-box:hover { border-color: var(--border-light); transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-box-icon { font-size: 20px; margin-bottom: 4px; opacity: 0.8; }
.stat-box-label { font-size: 10px; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); font-weight: 700; }
.stat-box-value { font-size: 22px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }

/* Buttons */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    padding: 10px 20px; border-radius: var(--radius); font-size: 12.5px; font-weight: 600;
    font-family: var(--font); cursor: pointer; border: none; outline: none;
    transition: all var(--transition); white-space: nowrap; position: relative;
    overflow: hidden; -webkit-tap-highlight-color: transparent; touch-action: manipulation;
    min-height: 38px;
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; transform: none !important; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 2px 8px rgba(59,130,246,0.25); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(59,130,246,0.35); }
.btn-success { background: var(--green); color: #fff; box-shadow: 0 2px 8px rgba(34,197,94,0.25); }
.btn-success:hover:not(:disabled) { background: #16a34a; transform: translateY(-1px); }
.btn-danger { background: var(--red); color: #fff; box-shadow: 0 2px 8px rgba(239,68,68,0.25); }
.btn-danger:hover:not(:disabled) { background: #dc2626; transform: translateY(-1px); }
.btn-warning { background: var(--orange); color: #fff; }
.btn-warning:hover:not(:disabled) { background: #ea580c; transform: translateY(-1px); }
.btn-ghost { background: transparent; color: var(--text-sub); border: 1px solid var(--border); }
.btn-ghost:hover:not(:disabled) { background: var(--bg-hover); color: var(--text); border-color: var(--border-light); }
.btn-sm { padding: 7px 14px; font-size: 11px; min-height: 32px; }
.btn-xs { padding: 4px 10px; font-size: 10px; min-height: 26px; border-radius: 6px; }
.btn-block { width: 100%; }
.btn-loading { pointer-events: none; }
.btn-loading .btn-text { visibility: hidden; }
.btn-loading::before {
    content: ''; position: absolute; width: 16px; height: 16px;
    border: 2px solid rgba(255,255,255,0.3); border-top-color: #fff;
    border-radius: 50%; animation: spin 0.6s linear infinite;
}

/* Forms */
.form-group { margin-bottom: 14px; }
.form-label {
    display: block; font-size: 11px; font-weight: 600; color: var(--text-sub);
    margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.5px;
}
.form-input, .form-select, .form-textarea {
    width: 100%; padding: 10px 14px; background: var(--bg-card);
    border: 1px solid var(--border); border-radius: var(--radius);
    color: var(--text); font-size: 13px; font-family: var(--font);
    outline: none; transition: all var(--transition); min-height: 40px;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
    border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-dim); }
.form-textarea { resize: vertical; min-height: 80px; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); font-size: 12.5px; white-space: nowrap; }
th { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); background: var(--bg-card); position: sticky; top: 0; }
tr { transition: background var(--transition); }
tr:hover td { background: rgba(255,255,255,0.02); }
tr:last-child td { border-bottom: none; }

/* Action cards */
.action-card {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: 8px; transition: all var(--transition);
}
.action-card:hover { border-color: var(--border-light); background: var(--bg-elevated); }
.action-card-info { flex: 1; min-width: 0; }
.action-card-name { font-weight: 700; font-size: 13px; margin-bottom: 2px; display: flex; align-items: center; gap: 6px; }
.action-card-desc { font-size: 11px; color: var(--text-sub); }
.action-card-meta { display: flex; gap: 12px; margin-top: 4px; font-size: 10px; color: var(--text-dim); flex-wrap: wrap; }
.action-card-meta span { display: flex; align-items: center; gap: 3px; }
.action-card-locked { opacity: 0.45; pointer-events: none; }

/* Tags */
.tag {
    display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px;
    border-radius: 6px; font-size: 10px; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.5px;
}
.tag-green { background: var(--green-glow); color: var(--green); }
.tag-red { background: var(--red-glow); color: var(--red); }
.tag-blue { background: var(--accent-glow); color: var(--accent); }
.tag-yellow { background: var(--yellow-glow); color: var(--yellow); }
.tag-orange { background: var(--orange-glow); color: var(--orange); }
.tag-purple { background: var(--purple-glow); color: var(--purple); }
.tag-cyan { background: var(--cyan-glow); color: var(--cyan); }

.rarity-common { color: var(--text-sub); }
.rarity-uncommon { color: var(--green); }
.rarity-rare { color: var(--accent); }
.rarity-epic { color: var(--purple); }
.rarity-legendary { color: var(--yellow); text-shadow: 0 0 8px rgba(234,179,8,0.4); }

.tier { font-weight: 700; }
.tier-1 { color: var(--text-sub); }
.tier-2 { color: var(--green); }
.tier-3 { color: var(--accent); }
.tier-4 { color: var(--purple); }
.tier-5 { color: var(--yellow); }

/* Progress bars */
.progress-wrap { height: 6px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; background: var(--accent); transition: width 0.6s ease; }

/* Toasts */
.toast-container {
    position: fixed; bottom: 20px; right: 20px; z-index: 1000;
    display: flex; flex-direction: column-reverse; gap: 8px;
    max-width: 380px; pointer-events: none;
}
.toast {
    padding: 12px 16px; border-radius: var(--radius-lg); font-size: 12.5px; font-weight: 500;
    color: #fff; animation: slideInRight 0.35s cubic-bezier(0.34,1.56,0.64,1);
    cursor: pointer; pointer-events: auto; box-shadow: var(--shadow-lg);
    display: flex; align-items: center; gap: 10px; backdrop-filter: blur(8px);
}
.toast-exit { animation: slideOutRight 0.3s ease forwards; }
.toast-success { background: rgba(34,197,94,0.92); }
.toast-error { background: rgba(239,68,68,0.92); }
.toast-info { background: rgba(59,130,246,0.92); }
.toast-warning { background: rgba(249,115,22,0.92); }
.toast-icon { font-size: 16px; flex-shrink: 0; }

/* Modal */
.modal-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.6);
    backdrop-filter: blur(4px); z-index: 200;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    opacity: 0; visibility: hidden; transition: all 0.25s ease;
}
.modal-overlay.active { opacity: 1; visibility: visible; }
.modal {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius-xl); width: 100%; max-width: 480px;
    max-height: 90vh; overflow-y: auto; box-shadow: var(--shadow-lg);
    transform: scale(0.95) translateY(10px);
    transition: transform 0.3s cubic-bezier(0.34,1.56,0.64,1);
}
.modal-overlay.active .modal { transform: scale(1) translateY(0); }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
}
.modal-title { font-size: 16px; font-weight: 700; }
.modal-close {
    width: 32px; height: 32px; border-radius: 8px; border: none;
    background: var(--bg-card); color: var(--text-sub); cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: all var(--transition); font-size: 18px;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text); }
.modal-body { padding: 20px 24px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px 20px; border-top: 1px solid var(--border); }

/* Tooltip */
.tooltip-wrap { position: relative; display: inline-flex; }
.tooltip-content {
    position: absolute; bottom: calc(100% + 8px); left: 50%;
    transform: translateX(-50%) scale(0.95);
    background: var(--bg-elevated); border: 1px solid var(--border-light);
    border-radius: var(--radius); padding: 8px 12px; font-size: 11px;
    color: var(--text-sub); white-space: nowrap; pointer-events: none;
    opacity: 0; transition: all 0.15s ease; z-index: 50; box-shadow: var(--shadow-md);
}
.tooltip-wrap:hover .tooltip-content { opacity: 1; transform: translateX(-50%) scale(1); }

/* Empty state */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-dim); }
.empty-state-icon { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state-text { font-size: 14px; font-weight: 500; }

/* Countdown */
.countdown { font-family: var(--mono); font-size: 28px; font-weight: 700; color: var(--text); text-align: center; padding: 20px; letter-spacing: 2px; }

/* Tabs */
.tabs {
    display: flex; gap: 2px; margin-bottom: 20px; border-bottom: 1px solid var(--border);
    padding-bottom: 0; overflow-x: auto; scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tab {
    padding: 10px 16px; font-size: 12.5px; font-weight: 600; color: var(--text-sub);
    cursor: pointer; border-bottom: 2px solid transparent; transition: all var(--transition);
    background: none; border-top: none; border-left: none; border-right: none;
    font-family: var(--font); white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-content { display: none; animation: fadeIn 0.2s ease; }
.tab-content.active { display: block; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* ===== CASINO ===== */
.slot-reels { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 24px; }
.slot-reel {
    width: 80px; height: 80px; background: var(--bg-card); border: 2px solid var(--border);
    border-radius: var(--radius-lg); display: flex; align-items: center; justify-content: center;
    font-size: 40px; overflow: hidden; transition: all 0.3s ease;
}
.slot-reel.spinning { animation: pulse 0.15s infinite; border-color: var(--accent); }
.slot-reel.winner { border-color: var(--green); box-shadow: 0 0 16px rgba(34,197,94,0.4); }
.slot-separator { font-size: 24px; color: var(--text-dim); font-weight: 300; }
.blackjack-cards { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; margin: 12px 0; }
.playing-card {
    width: 60px; height: 84px; background: #fff; border-radius: 6px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    font-size: 20px; font-weight: 700; box-shadow: var(--shadow-sm);
    animation: scaleIn 0.3s ease; transition: transform var(--transition);
}
.playing-card:hover { transform: translateY(-4px); }
.playing-card.red { color: #dc2626; }
.playing-card.black { color: #111; }
.playing-card-value { font-size: 16px; }
.playing-card-suit { font-size: 22px; }

/* Combat */
.combat-log { max-height: 300px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-card); }
.combat-round { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 12px; animation: fadeInUp 0.2s ease; }
.combat-round:last-child { border-bottom: none; }
.combat-round-num { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--text-dim); margin-bottom: 2px; }
.combat-hit { color: var(--red); font-weight: 600; }
.combat-miss { color: var(--text-dim); font-style: italic; }
.combat-result { text-align: center; padding: 20px; font-size: 18px; font-weight: 800; animation: bounceIn 0.5s ease; }

/* ===== TUTORIAL ===== */
.tutorial-overlay {
    position: fixed; inset: 0; background: rgba(0,0,0,0.75);
    backdrop-filter: blur(4px); z-index: 300;
    display: flex; align-items: center; justify-content: center; padding: 20px;
    animation: fadeIn 0.4s ease;
}
.tutorial-card {
    background: var(--bg-panel); border: 1px solid var(--accent);
    border-radius: var(--radius-xl); max-width: 520px; width: 100%;
    box-shadow: 0 0 40px rgba(59,130,246,0.2); overflow: hidden;
    animation: scaleIn 0.4s ease;
}
.tutorial-header {
    background: linear-gradient(135deg, var(--accent), #6366f1);
    padding: 24px; text-align: center;
}
.tutorial-header-icon { font-size: 48px; margin-bottom: 8px; }
.tutorial-header-title { font-size: 20px; font-weight: 800; color: #fff; }
.tutorial-header-sub { font-size: 13px; color: rgba(255,255,255,0.8); margin-top: 4px; }
.tutorial-body { padding: 24px; }
.tutorial-step { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tutorial-step:last-child { border-bottom: none; }
.tutorial-step-num {
    width: 28px; height: 28px; background: var(--accent-glow); color: var(--accent);
    border-radius: 50%; display: flex; align-items: center; justify-content: center;
    font-size: 12px; font-weight: 800; flex-shrink: 0;
}
.tutorial-step-text { font-size: 13px; color: var(--text-sub); line-height: 1.5; }
.tutorial-step-text strong { color: var(--text); }
.tutorial-footer { padding: 16px 24px 24px; text-align: center; }
.tutorial-progress { display: flex; gap: 6px; justify-content: center; margin-bottom: 16px; }
.tutorial-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border); transition: all var(--transition); }
.tutorial-dot.active { background: var(--accent); width: 24px; border-radius: 4px; }

/* Achievements */
.achievement-card {
    display: flex; align-items: center; gap: 14px; padding: 14px 16px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-radius: var(--radius-lg); margin-bottom: 8px; transition: all var(--transition);
}
.achievement-card:hover { border-color: var(--border-light); }
.achievement-card.unlocked { border-color: rgba(234,179,8,0.3); }
.achievement-card.locked { opacity: 0.5; }
.achievement-icon {
    width: 44px; height: 44px; background: var(--bg-panel); border: 2px solid var(--border);
    border-radius: 12px; display: flex; align-items: center; justify-content: center;
    font-size: 22px; flex-shrink: 0;
}
.achievement-card.unlocked .achievement-icon { border-color: var(--yellow); background: var(--yellow-glow); }
.achievement-info { flex: 1; min-width: 0; }
.achievement-name { font-weight: 700; font-size: 13px; margin-bottom: 1px; }
.achievement-desc { font-size: 11px; color: var(--text-sub); }
.achievement-reward { font-size: 11px; font-weight: 700; color: var(--accent); margin-top: 2px; }

/* Daily challenges */
.challenge-card {
    background: linear-gradient(135deg, var(--bg-card), rgba(59,130,246,0.05));
    border: 1px solid rgba(59,130,246,0.2); border-radius: var(--radius-xl);
    padding: 20px; margin-bottom: 12px;
}
.challenge-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.challenge-name { font-weight: 700; font-size: 14px; }
.challenge-reward { font-size: 12px; font-weight: 700; color: var(--accent); }
.challenge-progress-bar { height: 8px; background: rgba(255,255,255,0.06); border-radius: 4px; overflow: hidden; }
.challenge-progress-fill { height: 100%; background: linear-gradient(90deg, var(--accent), #818cf8); border-radius: 4px; transition: width 0.6s ease; }
.challenge-progress-text { display: flex; justify-content: space-between; font-size: 11px; color: var(--text-dim); margin-top: 4px; }

/* Settings */
.setting-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--border); }
.setting-row:last-child { border-bottom: none; }
.setting-info { flex: 1; }
.setting-label { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.setting-desc { font-size: 11px; color: var(--text-sub); }
.toggle { width: 44px; height: 24px; background: var(--border); border-radius: 12px; cursor: pointer; position: relative; transition: background var(--transition); border: none; flex-shrink: 0; }
.toggle.active { background: var(--accent); }
.toggle::after { content: ''; position: absolute; width: 18px; height: 18px; background: #fff; border-radius: 50%; top: 3px; left: 3px; transition: transform var(--transition); box-shadow: var(--shadow-sm); }
.toggle.active::after { transform: translateX(20px); }

/* Level up celebration */
.level-up-overlay {
    position: fixed; inset: 0; z-index: 250;
    display: flex; align-items: center; justify-content: center;
    background: rgba(0,0,0,0.7); animation: fadeIn 0.3s ease;
}
.level-up-card { text-align: center; padding: 40px; animation: bounceIn 0.6s ease; }
.level-up-number {
    font-size: 72px; font-weight: 900;
    background: linear-gradient(135deg, var(--yellow), #f97316, var(--yellow));
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; line-height: 1;
}
.level-up-label { font-size: 14px; font-weight: 700; color: var(--yellow); text-transform: uppercase; letter-spacing: 4px; margin-top: 4px; }

/* ===== LOGIN PAGE ===== */
.login-page {
    min-height: 100vh; display: flex; align-items: center; justify-content: center;
    background: var(--bg); padding: 24px; position: relative; overflow: hidden;
}
.login-page::before {
    content: ''; position: absolute; top: -50%; left: -50%; width: 200%; height: 200%;
    background: radial-gradient(circle at 30% 50%, rgba(59,130,246,0.06) 0%, transparent 50%),
                radial-gradient(circle at 70% 50%, rgba(99,102,241,0.04) 0%, transparent 50%);
    animation: pulse 8s infinite;
}
.login-card {
    background: var(--bg-panel); border: 1px solid var(--border);
    border-radius: var(--radius-xl); padding: 44px 36px; width: 100%; max-width: 400px;
    position: relative; box-shadow: var(--shadow-lg); animation: scaleIn 0.4s ease;
}
.login-logo {
    width: 56px; height: 56px; background: linear-gradient(135deg, var(--accent), #6366f1);
    border-radius: 16px; display: flex; align-items: center; justify-content: center;
    font-size: 22px; font-weight: 900; color: #fff; margin: 0 auto 20px;
    box-shadow: 0 4px 20px rgba(59,130,246,0.3);
}
.login-title { font-size: 22px; font-weight: 800; text-align: center; margin-bottom: 4px; }
.login-subtitle { font-size: 13px; color: var(--text-sub); text-align: center; margin-bottom: 28px; }
.login-error {
    background: var(--red-glow); border: 1px solid rgba(239,68,68,0.2); color: var(--red);
    padding: 10px 14px; border-radius: var(--radius); font-size: 12px; font-weight: 500;
    margin-bottom: 16px; text-align: center; animation: shake 0.4s ease;
}

/* Skeleton loading */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, var(--bg-hover) 50%, var(--bg-card) 75%);
    background-size: 200% 100%; animation: shimmer 1.5s infinite; border-radius: var(--radius);
}
.skeleton-text { height: 14px; margin-bottom: 8px; }
.skeleton-box { height: 60px; margin-bottom: 12px; }

/* ===== UTILITY ===== */
.text-green { color: var(--green) !important; }
.text-red { color: var(--red) !important; }
.text-blue { color: var(--accent) !important; }
.text-yellow { color: var(--yellow) !important; }
.text-orange { color: var(--orange) !important; }
.text-purple { color: var(--purple) !important; }
.text-dim { color: var(--text-dim) !important; }
.text-sub { color: var(--text-sub) !important; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-mono { font-family: var(--mono); }
.mt-4 { margin-top: 4px; }
.mt-8 { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-4 { margin-bottom: 4px; }
.mb-8 { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-24 { margin-bottom: 24px; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.flex { display: flex; }
.flex-col { display: flex; flex-direction: column; }
.flex-center { display: flex; align-items: center; justify-content: center; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.gap-4 { gap: 4px; }
.gap-6 { gap: 6px; }
.gap-8 { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ===== RESPONSIVE ===== */
@media (max-width: 1100px) {
    .sidebar-right { display: none; }
    .mobile-resources { display: flex; }
    .game-container { padding-top: calc(var(--topnav-h) + 42px); }
}

@media (max-width: 768px) {
    .sidebar-left { display: none; }
    .topnav-links { display: none; }
    .topnav-burger { display: flex; }
    .content { padding: 16px 14px; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .grid-2-mobile { grid-template-columns: repeat(2, 1fr); }
    .card { padding: 16px; border-radius: var(--radius-lg); }
    .page-title { font-size: 20px; }
    .stat-box-value { font-size: 18px; }
    .btn { min-height: 44px; padding: 12px 20px; }
    .btn-sm { min-height: 38px; padding: 8px 14px; }
    .action-card { flex-direction: column; align-items: flex-start; gap: 10px; }
    .action-card .btn { align-self: stretch; }
    .toast-container { left: 12px; right: 12px; bottom: 12px; max-width: unset; }
    .modal { max-width: 100%; border-radius: var(--radius-lg); }
    .slot-reels { gap: 4px; }
    .slot-reel { width: 60px; height: 60px; font-size: 28px; }
    .playing-card { width: 48px; height: 67px; font-size: 16px; }
    .countdown { font-size: 22px; }
    table { font-size: 12px; }
    th, td { padding: 8px 10px; }
    .stat-box { padding: 12px; }
}

@media (max-width: 480px) {
    .grid-2 { grid-template-columns: 1fr; }
    .topnav-title { display: none; }
    .login-card { padding: 32px 24px; }
}
