/* ============================================
   REAL MAFIA — Premium Dark Theme
   ============================================ */

:root {
    /* Dark mafia colors */
    --bg-primary: #0a0a0f;
    --bg-secondary: #14141d;
    --bg-tertiary: #1c1c28;
    --bg-card: #18181f;
    --bg-card-hover: #20202a;

    /* Mafia accents */
    --accent-gold: #d4af37;
    --accent-gold-bright: #f5d142;
    --accent-blood: #d83030;
    --accent-blood-bright: #ff4040;
    --accent-emerald: #2dd4bf;
    --accent-purple: #a855f7;

    /* Text */
    --text-primary: #ffffff;
    --text-secondary: #a8a8b8;
    --text-tertiary: #6b6b7b;
    --text-muted: #4a4a55;

    /* Borders */
    --border-subtle: rgba(255, 255, 255, 0.06);
    --border-default: rgba(255, 255, 255, 0.1);
    --border-strong: rgba(255, 255, 255, 0.2);

    /* Effects */
    --shadow-card: 0 4px 24px rgba(0, 0, 0, 0.4);
    --shadow-glow-gold: 0 0 32px rgba(212, 175, 55, 0.3);
    --shadow-glow-red: 0 0 32px rgba(216, 48, 48, 0.3);

    /* Animation */
    --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-normal: 300ms cubic-bezier(0.4, 0, 0.2, 1);
    --transition-slow: 500ms cubic-bezier(0.4, 0, 0.2, 1);

    /* Spacing */
    --space-xs: 4px;
    --space-sm: 8px;
    --space-md: 16px;
    --space-lg: 24px;
    --space-xl: 32px;

    /* Border radius */
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 999px;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

html, body {
    height: 100%;
    overflow-x: hidden;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    user-select: none;
    -webkit-user-select: none;
}

/* Hide scrollbar but keep functionality */
::-webkit-scrollbar {
    width: 0;
    background: transparent;
}

/* ============================================
   MAFIA LOADER — Card Deal Animation
   ============================================ */
.loader {
    position: fixed;
    inset: 0;
    background: radial-gradient(ellipse at center, #1a0a14 0%, #0a0a0f 70%);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 600ms ease;
    overflow: hidden;
}

.loader.fade-out {
    opacity: 0;
    pointer-events: none;
}

/* Spotlight from above */
.loader-spotlight {
    position: absolute;
    top: -150px;
    left: 50%;
    transform: translateX(-50%);
    width: 400px;
    height: 600px;
    background: radial-gradient(ellipse at top, rgba(212, 175, 55, 0.25) 0%, transparent 60%);
    filter: blur(20px);
    pointer-events: none;
}

/* Smoke particles */
.loader-smoke {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}

.smoke-particle {
    position: absolute;
    bottom: -100px;
    width: 80px;
    height: 80px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.15) 0%, transparent 70%);
    border-radius: 50%;
    opacity: 0;
    animation: smokeRise 4s linear infinite;
}

.smoke-particle:nth-child(1) { left: 15%; animation-delay: 0s; }
.smoke-particle:nth-child(2) { left: 30%; animation-delay: 1s; }
.smoke-particle:nth-child(3) { left: 50%; animation-delay: 0.5s; width: 100px; height: 100px; }
.smoke-particle:nth-child(4) { left: 70%; animation-delay: 1.5s; }
.smoke-particle:nth-child(5) { left: 85%; animation-delay: 2s; }

/* Cards container */
.loader-cards {
    position: relative;
    width: 280px;
    height: 140px;
    margin-bottom: 40px;
    perspective: 1000px;
}

.loader-card {
    position: absolute;
    top: 0;
    left: 50%;
    width: 60px;
    height: 90px;
    background: linear-gradient(135deg, #2a1a2a 0%, #1a0a1a 100%);
    border: 1.5px solid var(--accent-gold);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    box-shadow:
        0 8px 20px rgba(0, 0, 0, 0.8),
        inset 0 1px 0 rgba(255, 255, 255, 0.1);
    transform-origin: bottom center;
    opacity: 0;
    will-change: transform, opacity;
}

.loader-card[data-card="1"] {
    animation: cardDeal 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 0.2s forwards;
    --final-rotate: -28deg;
    --final-x: -110px;
}
.loader-card[data-card="2"] {
    animation: cardDeal 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 0.4s forwards;
    --final-rotate: -14deg;
    --final-x: -55px;
}
.loader-card[data-card="3"] {
    animation: cardDeal 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 0.6s forwards;
    --final-rotate: 0deg;
    --final-x: 0px;
    z-index: 5;
}
.loader-card[data-card="4"] {
    animation: cardDeal 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 0.8s forwards;
    --final-rotate: 14deg;
    --final-x: 55px;
}
.loader-card[data-card="5"] {
    animation: cardDeal 600ms cubic-bezier(0.34, 1.56, 0.64, 1) 1.0s forwards;
    --final-rotate: 28deg;
    --final-x: 110px;
}

.loader-card span {
    filter: drop-shadow(0 0 6px rgba(212, 175, 55, 0.6));
}

/* Brand text */
.loader-brand {
    opacity: 0;
    animation: fadeInUp 800ms ease-out 1.4s forwards;
    text-align: center;
}

.loader-title {
    font-family: 'Cinzel', serif;
    font-size: 32px;
    font-weight: 900;
    background: linear-gradient(180deg, #f5d142 0%, #d4af37 50%, #8a6f1a 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    letter-spacing: 8px;
    text-shadow: 0 0 40px rgba(212, 175, 55, 0.4);
    margin-bottom: 8px;
}

.loader-subtitle {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: var(--text-tertiary);
    letter-spacing: 2px;
    font-style: italic;
    font-weight: 400;
}

/* Cigar-style progress bar */
.loader-cigar {
    position: relative;
    width: 180px;
    height: 6px;
    margin-top: 32px;
    background: linear-gradient(180deg, #4a2818 0%, #2a1408 100%);
    border-radius: var(--radius-full);
    overflow: hidden;
    box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.5);
    opacity: 0;
    animation: fadeIn 400ms ease 1.6s forwards;
}

.loader-cigar-burn {
    position: absolute;
    inset: 0;
    width: 0%;
    background: linear-gradient(90deg,
        #2a1408 0%,
        #4a2818 70%,
        #d4af37 90%,
        #ff4040 100%);
    animation: cigarBurn 2s ease-out 1.8s forwards;
}

.loader-cigar-ember {
    position: absolute;
    top: -1px;
    left: 0%;
    width: 12px;
    height: 8px;
    background: radial-gradient(circle, #ff6030 0%, #d83030 50%, transparent 100%);
    border-radius: 50%;
    filter: blur(3px);
    box-shadow: 0 0 12px rgba(255, 96, 48, 0.8);
    opacity: 0;
    animation: emberMove 2s ease-out 1.8s forwards;
}

/* ============================================
   APP CONTAINER
   ============================================ */
.app {
    min-height: 100vh;
    background-color: var(--bg-primary);
    padding-bottom: 60px;
    position: relative;
}

.app.hidden {
    display: none;
}

.app-bg-glow {
    position: fixed;
    top: -200px;
    left: 50%;
    transform: translateX(-50%);
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, rgba(212, 175, 55, 0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 0;
}

/* ============================================
   HEADER
   ============================================ */
.header {
    position: relative;
    padding: 20px 16px 0;
    z-index: 1;
}

.header-content {
    background: linear-gradient(135deg,
        rgba(20, 20, 30, 0.9) 0%,
        rgba(28, 28, 40, 0.95) 100%);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-xl);
    padding: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    box-shadow: var(--shadow-card);
}

/* User Card */
.user-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 20px;
}

.user-avatar {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--accent-blood), #8a1c1c);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 16px rgba(216, 48, 48, 0.4);
    flex-shrink: 0;
    border: 2px solid rgba(255, 255, 255, 0.1);
}

.user-info {
    flex: 1;
    min-width: 0;
}

.user-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.user-rank {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    color: var(--text-secondary);
}

.user-vip {
    display: none;
    font-size: 28px;
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.6));
    animation: vipPulse 2s ease-in-out infinite;
}

.user-vip.active {
    display: block;
}

/* MMR Progress */
.mmr-progress {
    padding-top: 16px;
    border-top: 1px solid var(--border-subtle);
}

.mmr-progress-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.mmr-progress-label {
    font-size: 11px;
    color: var(--text-tertiary);
    font-weight: 600;
    letter-spacing: 1px;
}

.mmr-progress-value {
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-gold);
    font-family: 'Cinzel', serif;
}

.mmr-progress-bar {
    position: relative;
    height: 8px;
    background: rgba(255, 255, 255, 0.05);
    border-radius: var(--radius-full);
    overflow: hidden;
    margin-bottom: 8px;
}

.mmr-progress-fill {
    position: absolute;
    inset: 0;
    width: 0%;
    background: linear-gradient(90deg,
        var(--accent-blood) 0%,
        var(--accent-gold) 50%,
        var(--accent-gold-bright) 100%);
    border-radius: var(--radius-full);
    transition: width 1s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mmr-progress-glow {
    position: absolute;
    top: 0;
    left: 0;
    width: 30px;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
    animation: progressGlow 2s ease-in-out infinite;
}

.mmr-progress-footer {
    font-size: 11px;
    color: var(--text-tertiary);
    text-align: right;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    padding: 12px 16px;
    background: rgba(10, 10, 15, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid var(--border-subtle);
    margin-top: 20px;
}

.tab {
    flex: 1;
    background: transparent;
    border: none;
    padding: 10px 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    transition: all var(--transition-fast);
    color: var(--text-tertiary);
    position: relative;
    border-radius: var(--radius-md);
}

.tab:active {
    transform: scale(0.95);
}

.tab.active {
    color: var(--accent-gold);
}

.tab.active::before {
    content: '';
    position: absolute;
    bottom: -12px;
    left: 50%;
    transform: translateX(-50%);
    width: 24px;
    height: 3px;
    background: linear-gradient(90deg, var(--accent-gold), var(--accent-blood));
    border-radius: var(--radius-full);
    box-shadow: var(--shadow-glow-gold);
}

.tab-icon {
    font-size: 22px;
    transition: transform var(--transition-fast);
}

.tab.active .tab-icon {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(212, 175, 55, 0.5));
}

.tab-label {
    font-size: 11px;
    font-weight: 600;
}

/* ============================================
   MAIN CONTENT
   ============================================ */
.main {
    padding: 20px 16px;
    position: relative;
    z-index: 1;
}

.tab-content {
    display: none;
    animation: fadeInUp 400ms ease-out;
}

.tab-content.active {
    display: block;
}

.section-title {
    font-family: 'Cinzel', serif;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 16px;
    background: linear-gradient(90deg, var(--text-primary) 0%, var(--accent-gold) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ============================================
   FOOTER
   ============================================ */
.footer {
    padding: 20px 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 11px;
}

.footer-text {
    opacity: 0.6;
}
