:root {
    --bg-color: #0A0A10;
    --bg-gradient: radial-gradient(circle at 50% 0%, #17153B 0%, #0A0A10 70%);
    --card-bg: rgba(255, 255, 255, 0.04);
    --card-border: rgba(255, 255, 255, 0.08);
    --primary: #6366f1;
    --primary-hover: #4f46e5;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --error: #ef4444;
    --success: #22c55e;
    --font-family: 'Inter', system-ui, -apple-system, sans-serif;
    --border-radius: 16px;
    --glass-blur: blur(12px);
}

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

body {
    background-color: var(--bg-color);
    background-image: var(--bg-gradient);
    background-attachment: fixed;
    color: var(--text-main);
    font-family: var(--font-family);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    -webkit-font-smoothing: antialiased;
}

#app-container {
    width: 100%;
    max-width: 480px; /* Mobile first, optimized limits */
    padding: 24px;
    padding-top: 40px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Typography */
h1, h2 {
    font-weight: 700;
    letter-spacing: -0.02em;
    margin-bottom: 16px;
}
h1 { font-size: 28px; }
h2 { font-size: 20px; }
p {
    color: var(--text-muted);
    font-size: 15px;
    line-height: 1.5;
    margin-bottom: 24px;
}

.brand-text {
    background: linear-gradient(135deg, #a5b4fc 0%, #6366f1 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* Glassmorphism Cards */
.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 24px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    margin-bottom: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
    animation: fadeIn 0.4s ease-out;
}

/* Buttons */
.btn {
    display: block;
    width: 100%;
    padding: 16px;
    border-radius: 12px;
    font-family: var(--font-family);
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    text-decoration: none;
}
.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}
.btn-primary:hover, .btn-primary:active {
    background: var(--primary-hover);
    transform: translateY(-1px);
}
.btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-main);
    border: 1px solid var(--card-border);
}
.btn-secondary:hover, .btn-secondary:active {
    background: rgba(255, 255, 255, 0.12);
}

.btn:disabled {
    opacity: 0.6;
    pointer-events: none;
}

/* Loaders */
.loader-container {
    display: flex;
    justify-content: center;
    align-items: center;
    flex: 1;
}
.spinner {
    width: 36px;
    height: 36px;
    border: 3px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    border-top-color: var(--primary);
    animation: spin 1s ease-in-out infinite;
}

/* Icons via emoji or SVG */
.icon {
    font-size: 20px;
    margin-right: 8px;
    vertical-align: middle;
}

/* Utilities */
.text-center { text-align: center; }
.mt-2 { margin-top: 16px; }
.mb-2 { margin-bottom: 16px; }

/* Status Badges */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.badge-active { background: rgba(34, 197, 94, 0.2); color: var(--success); }
.badge-expired { background: rgba(239, 68, 68, 0.2); color: var(--error); }

/* QR Code Container */
.qr-container {
    background: white;
    padding: 16px;
    border-radius: 12px;
    display: flex;
    justify-content: center;
    margin-bottom: 20px;
}
.qr-container svg { width: 100%; height: auto; max-width: 250px; }

/* Invite Items */
.invite-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: rgba(0,0,0,0.2);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 12px;
    border: 1px dashed var(--card-border);
}
.invite-code {
    font-family: monospace;
    font-size: 16px;
    color: var(--text-main);
}
.invite-used {
    text-decoration: line-through;
    color: var(--text-muted);
}

/* Toast */
#toast-container {
    position: fixed;
    bottom: 24px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 48px);
    max-width: 400px;
    z-index: 1000;
}
.toast {
    background: var(--text-main);
    color: var(--bg-color);
    padding: 14px 20px;
    border-radius: 10px;
    font-weight: 600;
    text-align: center;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    margin-top: 10px;
    animation: slideUp 0.3s ease-out;
}

/* Animations */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes slideUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ===== Landing Page ===== */
.landing { width: 100%; }

.landing-header {
    padding: 28px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.landing-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    text-decoration: none;
}
.landing-logo-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
}
.landing-logo-text {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-main);
    letter-spacing: -0.02em;
}
.landing-badge {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    color: #a5b4fc;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.2);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.landing-hero {
    padding: 60px 0 40px;
    text-align: center;
    animation: fadeIn 0.7s ease-out;
}
.landing-title {
    font-size: clamp(36px, 7vw, 56px);
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -0.03em;
    margin-bottom: 24px;
}
.landing-subtitle {
    font-size: 17px;
    line-height: 1.65;
    color: var(--text-muted);
    max-width: 500px;
    margin: 0 auto 40px;
}
.landing-cta {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 18px 36px;
    background: var(--primary);
    color: white;
    font-family: var(--font-family);
    font-size: 17px;
    font-weight: 600;
    border: none;
    border-radius: 14px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.25s ease;
    box-shadow: 0 4px 24px rgba(99, 102, 241, 0.3), 0 0 0 1px rgba(99, 102, 241, 0.4);
}
.landing-cta:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(99, 102, 241, 0.4), 0 0 0 1px rgba(99, 102, 241, 0.5);
}
.landing-hint {
    margin-top: 16px;
    font-size: 14px;
    color: var(--text-muted);
}

.landing-features {
    padding: 30px 0 60px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    animation: fadeIn 0.7s ease-out 0.15s both;
}
.landing-feature-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--border-radius);
    padding: 28px 24px;
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    transition: border-color 0.3s ease, transform 0.3s ease;
}
.landing-feature-card:hover {
    border-color: rgba(99, 102, 241, 0.2);
    transform: translateY(-2px);
}
.landing-feature-icon {
    font-size: 28px;
    margin-bottom: 14px;
    display: block;
}
.landing-feature-card h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-main);
}
.landing-feature-card p {
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 0;
}

.landing-invite-section {
    padding: 0 0 60px;
    animation: fadeIn 0.7s ease-out 0.3s both;
}
.landing-invite-card {
    background: linear-gradient(135deg, rgba(99, 102, 241, 0.06), rgba(139, 92, 246, 0.04));
    border: 1px solid rgba(99, 102, 241, 0.12);
    border-radius: 20px;
    padding: 40px 28px;
    text-align: center;
}
.landing-invite-card h2 {
    font-size: 22px;
    margin-bottom: 12px;
}
.landing-invite-card p {
    font-size: 14px;
    line-height: 1.6;
    max-width: 420px;
    margin: 0 auto 28px;
}
.landing-steps {
    display: flex;
    justify-content: center;
    gap: 28px;
    flex-wrap: wrap;
}
.landing-step {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: var(--text-muted);
}
.landing-step-num {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #a5b4fc;
    flex-shrink: 0;
}

.landing-footer {
    padding: 32px 0;
    text-align: center;
    border-top: 1px solid var(--card-border);
}
.landing-footer p {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 0;
}
.landing-footer a {
    color: #a5b4fc;
    text-decoration: none;
}
.landing-footer a:hover {
    text-decoration: underline;
}

@media (max-width: 520px) {
    .landing-hero { padding: 40px 0 30px; }
    .landing-subtitle { font-size: 15px; }
    .landing-features { grid-template-columns: 1fr; }
    .landing-steps { flex-direction: column; align-items: center; gap: 12px; }
    .landing-badge { display: none; }
}
