:root {
    --bg-main: #0f172a;
    --bg-card: rgba(30, 41, 59, 0.7);
    --bg-card-hover: rgba(30, 41, 59, 0.9);
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --accent-primary: #8b5cf6;
    /* premium purple */
    --accent-primary-hover: #7c3aed;
    --accent-success: #10b981;
    --accent-success-hover: #059669;
    --border: rgba(255, 255, 255, 0.1);
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);

    font-family: 'Outfit', sans-serif;
}

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

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

#app {
    width: 100%;
    max-width: 600px;
    /* Mobile first but looking good on desktop */
    margin: 0 auto;
    padding: 20px;
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Utilities */
.fullscreen-center {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
}

.hidden {
    display: none !important;
}

/* Typography */
h1,
h2,
h3 {
    font-weight: 800;
    margin-bottom: 15px;
}

h2 {
    font-size: 1.8rem;
    text-align: center;
}

h3 {
    font-size: 1.4rem;
    color: var(--text-muted);
}

/* Components */
.card {
    background: var(--bg-card);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 25px;
    box-shadow: var(--shadow);
    transition: transform 0.3s ease, background 0.3s ease;
}

/* Auth Specific */
.auth-container {
    max-width: 320px;
    width: 100%;
    margin: 15vh auto 0 auto;
}

.auth-container .btn-group {
    flex-direction: column;
    gap: 15px;
}

/* Forms */
.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

input[type="text"],
input[type="password"],
input[type="number"],
input[type="email"] {
    width: 100%;
    padding: 12px 15px;
    border-radius: 10px;
    background: rgba(0, 0, 0, 0.2);
    border: 1px solid var(--border);
    color: var(--text-main);
    font-family: 'Outfit', sans-serif;
    font-size: 1rem;
    transition: border-color 0.3s;
}

input:focus {
    outline: none;
    border-color: var(--accent-primary);
}

/* Buttons */
.btn {
    padding: 14px 20px;
    border-radius: 12px;
    border: none;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    width: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
}

.btn:active {
    transform: translateY(0);
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.btn-primary {
    background: var(--accent-primary);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-primary-hover);
}

.btn-success {
    background: var(--accent-success);
    color: white;
}

.btn-success:hover {
    background: var(--accent-success-hover);
}

.btn-secondary {
    background: transparent;
    color: var(--text-main);
    border: 1px solid var(--border);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
}

.btn-secondary.active-tab {
    background: var(--accent-primary);
    color: white;
    border-color: var(--accent-primary);
}

.btn-text {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    padding: 5px;
    font-family: inherit;
    transition: color 0.3s;
}

.btn-text:hover {
    color: var(--text-main);
}

.btn-group {
    display: flex;
    gap: 10px;
    margin-top: 25px;
}

/* Header */
.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 30px;
}

.user-info {
    font-weight: 600;
    font-size: 1.2rem;
}

.user-info span {
    color: var(--accent-primary);
}

/* Dashboard */
.dashboard {
    display: flex;
    flex-direction: column;
    gap: 30px;
    flex: 1;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
}

.stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    text-align: center;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--accent-primary);
    margin-bottom: 5px;
}

.stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Ticket Area */
.ticket-area {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 250px;
}

/* The Ticket itself */
.ticket-container {
    perspective: 1000px;
    width: 100%;
}

.ticket {
    background: linear-gradient(135deg, rgba(255, 255, 255, 0.1), rgba(255, 255, 255, 0));
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 40px 20px;
    text-align: center;
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.4);
    position: relative;
    overflow: hidden;
    transform-style: preserve-3d;
}

/* Shimmer effect for ticket */
.ticket::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 50%;
    height: 100%;
    background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
    transform: skewX(-20deg);
    animation: shimmer 3s infinite;
}

@keyframes shimmer {
    100% {
        left: 200%;
    }
}

.ticket-type {
    font-size: 0.9rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    font-weight: 800;
    letter-spacing: 1px;
    margin-bottom: 10px;
}

.ticket-value {
    font-size: 3rem;
    font-weight: 800;
    margin-bottom: 20px;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.5);
}

.ticket-special .ticket-type {
    color: var(--accent-success);
}

.ticket-special .ticket-value {
    font-size: 1.8rem;
    line-height: 1.3;
}

/* Drum animation shell */
.drum-container {
    width: 150px;
    height: 150px;
    position: relative;
    margin: 0 auto 30px;
}

.drum {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    border: 4px solid var(--accent-primary);
    border-top-color: transparent;
    animation: spin 1s linear infinite;
    display: none;
}

.drum-inner {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 2rem;
    display: none;
}

/* Animations */
@keyframes spin {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes bounceIn {
    0% {
        transform: scale(0.3);
        opacity: 0;
    }

    50% {
        transform: scale(1.05);
    }

    70% {
        transform: scale(0.9);
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.animate-appear {
    animation: bounceIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
}

.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.error-msg {
    color: #ef4444;
    font-size: 0.9rem;
    margin-top: 15px;
    text-align: center;
    min-height: 20px;
}

/* Leaderboard */
.lb-list {
    list-style: none;
    margin-top: 15px;
}

.lb-item {
    display: flex;
    justify-content: space-between;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
}

.lb-item:last-child {
    border-bottom: none;
}

.lb-rank {
    color: var(--accent-primary);
    font-weight: 800;
    width: 30px;
}

.lb-name {
    flex: 1;
    font-weight: 600;
}

.lb-score {
    color: var(--text-muted);
}

/* Spinner */
.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255, 255, 255, 0.1);
    border-left-color: var(--accent-primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}