:root {
    --ident-logo-size: 56px;
    --ident-font-size: 4.8rem;
    --ident-gap: 0.8rem;
    --color-product: rgb(var(--rgb-color-product));
    --color-product-light: rgb(6, 185, 204);
    --color-ident: var(--color-product);
    --color-ident-light: var(--color-product-light);
    --login-width: 50.4rem;
    --login-padding: 4.8rem;
    --login-radius: 1.6rem;
    --login-frame-gap: 4.8rem;
    --login-frame-gap-small: 3.2rem;
    --login-frame-minWidth: 60rem;
    --color-login-bg: rgb(255, 255, 255);

    /* Typography */
    --font-family: 'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-family-heading: 'TASA Orbiter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    --font-weight-light: 300;
    --font-weight-regular: 400;
    --font-weight-medium: 500;
    --font-weight-semibold: 600;
    --font-weight-bold: 700;

    /* Spacing Scale */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.25rem;
    --space-6: 1.5rem;
    --space-8: 2rem;

    /* Border Radius */
    --radius-sm: 0.375rem;
    --radius-md: 0.5rem;
    --radius-lg: 0.75rem;
    --radius-xl: 1rem;
    --radius-2xl: 1.5rem;
    --radius-3xl: 1.5rem;
    --radius-full: 9999px;

    /* Transitions */
    --transition-fast: 0.15s ease;
    --transition-normal: 0.3s ease;

    /* Shadows */
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --shadow-2xl: 0 25px 50px -12px rgba(0, 0, 0, 0.25);

    /* Font Sizes */
    --font-size-sm: 0.875rem;
    --font-size-base: 1rem;
    --font-size-lg: 1.125rem;
    --font-size-xl: 1.25rem;
    --font-size-2xl: 1.5rem;
    --font-size-3xl: 1.875rem;

    /* Unicom Theme Colors */
    --bg-app: #EDEFF5;
    --bg-primary: #ffffff;
    --bg-secondary: #f8fafc;
    --bg-tertiary: #f1f5f9;
    --bg-surface: rgba(255, 255, 255, 0.9);

    --text-primary: #1e293b;
    --text-secondary: #334155;
    --text-tertiary: #64748b;
    --text-muted: #94a3b8;
    --text-inverse: #ffffff;

    --border-primary: rgba(0, 0, 0, 0.1);
    --border-secondary: rgba(0, 0, 0, 0.05);

    --accent-primary: #3C454E;
    --accent-primary-hover: #33383F;
    --accent-primary-light: #f0f9ff;
    --accent-primary-alpha: rgba(8, 145, 178, 0.1);
}

/* Enhanced styling for app-card links */
.app-card {
    margin: 8px;
    transition: all 0.3s ease;
    cursor: pointer;
    border: 2px solid #9ca3af;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
    background: #ffffff;
}

.app-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-xl);
    border-color: #6b7280;
}

.app-card a {
    display: block;
    padding: 24px 16px;
    text-decoration: none;
    color: var(--color-ident, #333);
    font-weight: 500;
    font-size: 14px;
    text-align: center;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

.app-card-content {
    padding: 24px;
    text-align: center;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
}

.app-card-icon {
    display: flex;
    justify-content: center;
    margin-bottom: 16px;
}

.app-card-title {
    text-decoration: none;
    color: #374151;
    font-weight: 500;
    font-size: 14px;
}

.app-card a:hover {
    background-color: rgba(0, 0, 0, 0.02);
}

/* Reset and Base Styles */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font-family);
    font-weight: var(--font-weight-regular);
    min-height: 100vh;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: var(--text-primary);
    overflow-x: hidden;
}

/* Font styling for headings */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-family-heading);
    font-weight: var(--font-weight-semibold);
    line-height: 1.2;
    letter-spacing: -0.025em;
}

/* Font styling for buttons and inputs */
button, input, textarea, select {
    font-family: inherit;
}

/* Ensure all elements inherit font family */
* {
    font-family: inherit;
}

/* Background fallback for when WebGL/Unicorn Studio doesn't load */
#page-background {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

#page-background > div {
    width: 100%;
    height: 100%;
}

/* Header logout section */
.header-logout {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 20;
}

#logout-section {
    display: none;
    padding: 16px;
}

#logout-btn {
    color: white;
    background: transparent;
    border: 1px solid white;
    padding: 8px 16px;
    border-radius: 6px;
    cursor: pointer;
}

/* Realm error styling */
#realm-error {
    display: none;
    color: #ef4444;
    font-size: 12px;
    margin-top: 4px;
}

/* Landing section layout */
#landing-section {
    display: none;
}

.landing-content {
    position: relative;
    z-index: 10;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 32px;
    margin-top: 50px;
}

/* Card container adjustments */
.card-container {
    max-width: 800px;
    margin: 0 auto;
}

/* Container styling for card grids */
.cards-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 24px;
}

/* Loading Section Styles */
#loading-section {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    z-index: 10000;
}

.loading-container {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}

.loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(255,255,255,0.3);
    border-top: 4px solid white;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

.loading-text {
    color: white;
    font-size: 18px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Login System Styles */
.login-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    justify-content: flex-end;
    z-index: 10000;
    padding: var(--space-4);
    padding-right: 100px;
}

.login-container {
    background: var(--bg-surface);
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-2xl);
    width: 100%;
    max-width: 480px;
    padding: var(--space-8);
    animation: loginSlideUp 0.4s ease-out;
    position: relative;
    z-index: 2;
}

@keyframes loginSlideUp {
    from {
        opacity: 0;
        transform: translateY(20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.login-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-6);
}

.login-field {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.login-label {
    font-weight: var(--font-weight-medium);
    color: var(--text-primary);
    font-size: var(--font-size-sm);
}

.login-input {
    padding: var(--space-3) var(--space-4);
    border: 2px solid var(--border-primary);
    border-radius: var(--radius-lg);
    font-size: var(--font-size-base);
    color: var(--text-primary);
    background: var(--bg-primary);
    transition: all var(--transition-fast);
    font-family: inherit;
}

.login-input:focus {
    outline: none;
    border-color: var(--accent-primary);
    box-shadow: 0 0 0 3px var(--accent-primary-alpha);
}

.login-input::placeholder {
    color: var(--text-tertiary);
}

.login-actions {
    display: flex;
    gap: var(--space-3);
}

.login-btn {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    padding: var(--space-3) var(--space-6);
    border-radius: var(--radius-lg);
    font-weight: var(--font-weight-medium);
    font-size: var(--font-size-base);
    cursor: pointer;
    transition: all var(--transition-fast);
    border: none;
    flex: 1;
    justify-content: center;
}

.login-btn--primary {
    background: #1742F6;
    color: white;
}

.login-btn--primary:hover:not(:disabled) {
    background: #0e34d1;
    transform: translateY(-1px);
    box-shadow: var(--shadow-lg);
}

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

/* Card styling for application cards */
.card-container {
    background: var(--bg-surface);
    border-radius: var(--radius-3xl);
    box-shadow: var(--shadow-2xl);
    padding: var(--space-8);
    animation: loginSlideUp 0.4s ease-out;
    position: relative;
    z-index: 2;
}

.card-section {
    margin-bottom: var(--space-6);
}

.card-section:last-child {
    margin-bottom: 0;
}

.card-section h2 {
    color: var(--text-primary);
    font-size: var(--font-size-xl);
    font-weight: var(--font-weight-semibold);
    margin-bottom: var(--space-4);
    text-align: left;
}

/* Responsive Design */
@media (max-width: 768px) {
    .login-overlay {
        justify-content: center;
        padding: var(--space-4);
        padding-right: var(--space-4);
    }

    .login-container {
        max-width: 100%;
    }
}

/* Hide Unicorn Studio watermark */
a[href*="unicorn.studio"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

div[class*="branding"],
div[class*="watermark"],
.unicorn-branding {
    display: none !important;
}