:root {
    /* Base Colors - WARM DARK + FRIENDLY GOLD */
    --bg-main: #0F172A;
    /* main background (soft dark navy) */
    --bg-card: #1E293B;
    /* cards, modals, panels */
    --bg-overlay: rgba(15, 23, 42, 0.85);

    /* Text Colors */
    --text-main: #F8FAFC;
    /* primary text */
    --text-muted: #94A3B8;
    /* secondary text */

    /* Accent Colors */
    --accent-gold: #F7C948;
    /* primary accent, buttons, winners */
    --accent-green: #22C55E;
    /* success, correct, win */
    --accent-red: #EF4444;
    /* elimination, error */
    --accent-blue: #60A5FA;
    /* waiting, turn indicator, info */
    --accent-gray: #64748B;
    /* disabled, locked */

    /* Glass Effects */
    --glass: rgba(255, 255, 255, 0.03);
    --glass-border: rgba(255, 255, 255, 0.08);
    --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);

    /* Transitions */
    --transition-fast: 0.2s ease;
    --transition-normal: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Global Reset & Base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    -webkit-tap-highlight-color: transparent;
}

body {
    background-color: var(--bg-main);
    color: var(--text-main);
    font-family: 'Tajawal', 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    overflow-x: hidden;
    min-height: 100vh;
}

/* Typography */
h1,
h2,
h3,
h4,
h5,
h6 {
    font-weight: 800;
    line-height: 1.2;
    color: var(--text-main);
}

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

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

.text-danger {
    color: var(--accent-red);
}

.text-success {
    color: var(--accent-green);
}

/* Layout & Containers */
.container {
    width: 100%;
    max-width: 640px;
    margin: 0 auto;
    padding: 1.5rem;
}

/* Cinematic Card Base */
.card {
    background: var(--bg-card);
    border: 1px solid var(--glass-border);
    border-radius: 1.25rem;
    padding: 1.5rem;
    box-shadow: var(--shadow-lg);
    transition: var(--transition-normal);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 1.5rem;
    border-radius: 0.875rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition-normal);
    border: 2px solid transparent;
    font-size: 1rem;
    text-decoration: none;
    gap: 0.5rem;
    outline: none;
}

.btn:active {
    transform: scale(0.96);
}

/* Primary Button - Gold Theme */
.btn-primary {
    background: var(--accent-gold);
    color: #0F172A;
    /* dark navy */
}

.btn-primary:hover:not(:disabled) {
    transform: translateY(-2px);
    box-shadow: 0 0 20px rgba(247, 201, 72, 0.3);
    background: #FFD666;
}

/* Secondary Button - Outlined Gold */
.btn-secondary {
    background: transparent;
    border-color: var(--accent-gold);
    color: var(--accent-gold);
}

.btn-secondary:hover:not(:disabled) {
    background: rgba(247, 201, 72, 0.1);
    transform: translateY(-2px);
}

.btn-danger {
    background: rgba(239, 68, 68, 0.1);
    border-color: rgba(239, 68, 68, 0.2);
    color: var(--accent-red);
}

.btn-danger:hover:not(:disabled) {
    background: var(--accent-red);
    color: white;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: var(--accent-gray);
    border-color: transparent;
    color: var(--bg-main);
}

/* Forms & Inputs */
.input-group {
    margin-bottom: 1.25rem;
}

.input-label {
    display: block;
    margin-bottom: 0.5rem;
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.875rem;
}

input[type="text"],
input[type="number"],
input[type="password"] {
    width: 100%;
    padding: 0.875rem 1rem;
    border-radius: 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: rgba(15, 23, 42, 0.5);
    color: var(--text-main);
    font-size: 1rem;
    transition: var(--transition-fast);
}

input:focus {
    outline: none;
    border-color: var(--accent-gold);
    box-shadow: 0 0 0 3px rgba(247, 201, 72, 0.1);
    background: rgba(15, 23, 42, 0.8);
}

/* Input Error State */
input.input-error {
    border-color: var(--accent-red) !important;
    box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.15);
}

.input-error-msg {
    color: var(--accent-red);
    font-size: 0.8rem;
    margin-top: 0.35rem;
    display: none;
}

.input-error-msg.visible {
    display: block;
    animation: fadeIn 0.2s ease;
}

/* Header */
.header {
    background: var(--bg-card);
    border-bottom: 1px solid var(--glass-border);
    padding: 1rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: blur(12px);
}

.header-title {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-gold);
    text-decoration: none;
}

/* RTL Styles */
[dir="rtl"] {
    text-align: right;
}

[dir="ltr"] {
    text-align: left;
}

/* Utilities */
.screen {
    display: none;
    animation: fadeIn var(--transition-normal);
    min-height: 100vh;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.flex-col {
    flex-direction: column;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-1 {
    flex: 1;
}

.items-center {
    align-items: center;
}

.justify-center {
    justify-content: center;
}

.justify-between {
    justify-content: space-between;
}

.text-center {
    text-align: center;
}

.w-full {
    width: 100%;
}

.mt-sm {
    margin-top: 0.75rem;
}

.mt-md {
    margin-top: 1.5rem;
}

.mt-lg {
    margin-top: 2rem;
}

.mt-xl {
    margin-top: 3rem;
}

.mb-sm {
    margin-bottom: 0.75rem;
}

.mb-md {
    margin-bottom: 1.5rem;
}

.mb-lg {
    margin-bottom: 2rem;
}

.mb-xl {
    margin-bottom: 3rem;
}

.gap-sm {
    gap: 0.75rem;
}

.gap-md {
    gap: 1.5rem;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}