﻿/* تفعيل خط جلكسي المحلي */
        @font-face {
            font-family: 'AAGalaxy';
            src: url('../fonts/AA-GALAXY.otf') format('opentype');
            font-weight: normal;
            font-style: normal;
            font-display: swap;
        }

        ::-webkit-scrollbar { width: 6px; }
        ::-webkit-scrollbar-track { background: rgba(255,255,255,0.05); border-radius: 10px; }
        ::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.15); border-radius: 10px; }
        ::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.25); }

        :root {
            --accent: #22d3ee;
            --accent-glow: rgba(34, 211, 238, 0.3);
            --success: #34d399;
            --danger: #f87171;
            --warning: #fbbf24;
            --bg-deep: #0a0a1a;
            --bg-card: rgba(255,255,255,0.04);
            --border-subtle: rgba(255,255,255,0.08);
            --glass: rgba(255,255,255,0.06);
        }

        * { box-sizing: border-box; }

        /* جعل خط جلكسي هو الخط الافتراضي للتطبيق */
        body {
            font-family: 'AAGalaxy', 'Tajawal', 'Noto Kufi Arabic', sans-serif;
            background: var(--bg-deep);
            min-height: 100vh;
            overflow-x: hidden;
        }

        .font-display { font-family: 'AAGalaxy', 'Noto Kufi Arabic', 'Tajawal', sans-serif; }
        .font-title { font-family: 'AAGalaxy', 'Tajawal', 'Noto Kufi Arabic', sans-serif; }

        /* Animated background */
        .bg-animated {
            position: fixed; inset: 0; z-index: 0; pointer-events: none;
            background: 
                radial-gradient(ellipse 80% 60% at 20% 10%, rgba(34,211,238,0.08) 0%, transparent 60%),
                radial-gradient(ellipse 60% 50% at 80% 90%, rgba(139,92,246,0.08) 0%, transparent 60%),
                radial-gradient(ellipse 50% 50% at 50% 50%, rgba(16,185,129,0.04) 0%, transparent 70%);
        }

        /* Glass morphism */
        .glass-panel {
            background: var(--glass);
            backdrop-filter: blur(20px);
            -webkit-backdrop-filter: blur(20px);
            border: 1px solid var(--border-subtle);
        }

        .glass-card {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.06);
            backdrop-filter: blur(10px);
        }

        /* Glow effects */
        .glow-accent { box-shadow: 0 0 30px var(--accent-glow), inset 0 0 30px rgba(34,211,238,0.05); }
        .glow-success { box-shadow: 0 0 25px rgba(52,211,153,0.3); }

        /* Buttons */
        .btn-primary {
            background: linear-gradient(135deg, #22d3ee, #06b6d4);
            color: #0a0a1a;
            font-weight: 800;
            border: none;
            position: relative;
            overflow: hidden;
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        }
        .btn-primary::before {
            content: '';
            position: absolute; inset: 0;
            background: linear-gradient(135deg, rgba(255,255,255,0.2), transparent);
            opacity: 0;
            transition: opacity 0.3s;
        }
        .btn-primary:hover::before { opacity: 1; }
        .btn-primary:hover { transform: translateY(-2px); box-shadow: 0 10px 40px rgba(34,211,238,0.3); }
        .btn-primary:active { transform: translateY(0); }

        .btn-success {
            background: linear-gradient(135deg, #34d399, #10b981);
            color: #0a0a1a;
            font-weight: 800;
        }
        .btn-success:hover { transform: translateY(-2px); box-shadow: 0 10px 40px rgba(52,211,153,0.3); }

        .btn-ghost {
            background: rgba(255,255,255,0.06);
            border: 1px solid rgba(255,255,255,0.12);
            color: white;
            transition: all 0.3s;
        }
        .btn-ghost:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.2); }

        .btn-danger {
            background: rgba(239,68,68,0.15);
            border: 1px solid rgba(239,68,68,0.3);
            color: #f87171;
        }
        .btn-danger:hover { background: rgba(239,68,68,0.25); }

        /* Animations */
        @keyframes fadeInUp {
            from { opacity: 0; transform: translateY(30px); }
            to { opacity: 1; transform: translateY(0); }
        }
        @keyframes fadeIn {
            from { opacity: 0; }
            to { opacity: 1; }
        }
        @keyframes scaleIn {
            from { opacity: 0; transform: scale(0.9); }
            to { opacity: 1; transform: scale(1); }
        }
        @keyframes float {
            0%, 100% { transform: translateY(0); }
            50% { transform: translateY(-8px); }
        }
        @keyframes gradientShift {
            0%, 100% { background-position: 0% 50%; }
            50% { background-position: 100% 50%; }
        }

        .animate-fadeInUp { animation: fadeInUp 0.6s cubic-bezier(0.16, 1, 0.3, 1) forwards; }
        .animate-fadeIn { animation: fadeIn 0.5s ease forwards; }
        .animate-scaleIn { animation: scaleIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards; }

        .stagger-1 { animation-delay: 0.1s; opacity: 0; }
        .stagger-2 { animation-delay: 0.2s; opacity: 0; }
        .stagger-3 { animation-delay: 0.3s; opacity: 0; }
        .stagger-4 { animation-delay: 0.4s; opacity: 0; }

        /* تم إصلاح كود العنوان هنا ليظهر بشكل سليم في جميع المتصفحات */
        .title-container {
            filter: drop-shadow(0 0 15px rgba(34, 211, 238, 0.4)); /* تم نقل الظل للحاوية لتجنب اختفاء النص */
        }
        .title-gradient {
            background: linear-gradient(135deg, #22d3ee, #34d399, #a78bfa, #22d3ee);
            background-size: 300% 300%;
            -webkit-background-clip: text;
            -webkit-text-fill-color: transparent;
            background-clip: text;
            color: transparent;
            animation: gradientShift 6s ease infinite;
        }

        /* Answer card states */
        @keyframes reveal-pop {
            0% { transform: scale(1); }
            30% { transform: scale(1.05); }
            60% { transform: scale(0.98); }
            100% { transform: scale(1); }
        }
        .animate-reveal { animation: reveal-pop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1); }

        .answer-found {
            background: linear-gradient(135deg, rgba(16,185,129,0.15), rgba(52,211,153,0.08));
            border-color: rgba(52,211,153,0.4);
        }
        .answer-hidden {
            background: rgba(255,255,255,0.02);
            border-color: rgba(255,255,255,0.06);
        }
        .answer-reveal-mode {
            cursor: pointer;
            border-style: dashed;
            border-color: rgba(34,211,238,0.4);
        }
        .answer-reveal-mode:hover {
            background: rgba(34,211,238,0.08);
            transform: scale(1.02);
        }

        /* Timer */
        @keyframes warning-blink {
            0%, 100% { color: #f87171; stroke: #f87171; }
            50% { color: #fecaca; stroke: #fecaca; }
        }
        .timer-warning-text { animation: warning-blink 0.7s infinite; }
        .timer-warning-circle { animation: warning-blink 0.7s infinite; }
        .timer-progress-ring { transition: stroke-dashoffset 0.3s linear; }

        /* Wrong answer effect */
        @keyframes wrong-shake {
            0%, 100% { transform: translateX(0); }
            20% { transform: translateX(-8px); }
            40% { transform: translateX(8px); }
            60% { transform: translateX(-5px); }
            80% { transform: translateX(5px); }
        }
        @keyframes wrong-x-pop {
            0% { transform: scale(0.3) rotate(-15deg); opacity: 0; }
            40% { transform: scale(1.1) rotate(5deg); opacity: 1; }
            70% { transform: scale(1) rotate(0deg); opacity: 1; }
            100% { transform: scale(1.3); opacity: 0; }
        }
        .animate-wrong-shake { animation: wrong-shake 0.4s ease; }
        .animate-wrong-x-pop { animation: wrong-x-pop 0.7s ease-out; }

        /* Team card active */
        .team-active {
            border-color: var(--accent) !important;
            box-shadow: 0 0 20px var(--accent-glow), inset 0 0 20px rgba(34,211,238,0.05);
        }
        .team-active::before {
            content: '';
            position: absolute;
            inset: -2px;
            border-radius: inherit;
            background: linear-gradient(135deg, rgba(34,211,238,0.3), transparent, rgba(34,211,238,0.1));
            z-index: -1;
            filter: blur(8px);
        }

        /* Game selection cards */
        .game-card {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.08);
            transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
            position: relative;
            overflow: hidden;
        }
        .game-card::before {
            content: '';
            position: absolute;
            inset: 0;
            background: linear-gradient(135deg, rgba(34,211,238,0.1), transparent);
            opacity: 0;
            transition: opacity 0.3s;
        }
        .game-card:hover {
            border-color: rgba(34,211,238,0.3);
            transform: translateY(-4px);
            box-shadow: 0 15px 40px rgba(0,0,0,0.3);
        }
        .game-card:hover::before { opacity: 1; }

        /* Input styling */
        .input-styled {
            background: rgba(255,255,255,0.05);
            border: 2px solid rgba(255,255,255,0.1);
            color: white;
            transition: all 0.3s;
        }
        .input-styled:focus {
            border-color: var(--accent);
            box-shadow: 0 0 0 3px rgba(34,211,238,0.1);
            outline: none;
            background: rgba(255,255,255,0.08);
        }
        .input-styled::placeholder { color: rgba(255,255,255,0.25); }

        .settings-modal-body { max-height: 70vh; overflow-y: auto; }
        .settings-section {
            background: rgba(255,255,255,0.03);
            border: 1px solid rgba(255,255,255,0.08);
            border-radius: 14px;
            padding: 14px;
        }
        .settings-section-title {
            color: rgba(255,255,255,0.72);
            font-size: 0.78rem;
            font-weight: 800;
            letter-spacing: 0.06em;
            text-transform: uppercase;
            margin-bottom: 10px;
        }
        /* تكبير اسم الفريق في الوضع الكلاسيكي فقط */
        #main-game-container:not(.focus-layout) #teams-cards-container h3 {
            font-size: 1.15rem !important;
            line-height: 1.2;
        }
        /* Layout mode: focus on answers */
        .focus-layout #question-container {
            padding: 14px;
        }
        .focus-layout #question-container > p {
            font-size: 0.76rem !important;
            opacity: 0.9;
            margin-bottom: 6px;
        }
        .focus-layout #question-text {
            font-size: 1.35rem !important;
            line-height: 1.45;
            min-height: 26px;
        }
        .focus-layout #teams-cards-container {
            gap: 0.55rem !important;
        }
        .focus-layout #teams-cards-container > div {
            display: flex !important;
            align-items: center !important;
            justify-content: space-between !important;
            padding: 0.72rem 0.85rem !important;
            border-radius: 0.85rem !important;
        }
        .focus-layout #teams-cards-container h3 {
            font-size: 1.15rem !important;
            margin-bottom: 0 !important;
            text-align: right !important;
            line-height: 1.2 !important;
            padding-right: 0.35rem !important;
        }
        .focus-layout #teams-cards-container p {
            font-size: 1.7rem !important;
            line-height: 1 !important;
        }
        .focus-layout #answers-section {
            padding: 1.65rem !important;
        }
        .focus-layout #answer-panel {
            padding: 1rem !important;
        }
        .focus-layout #answer-panel #answer-input {
            min-height: 58px;
            font-size: 1.08rem;
            padding-top: 0.95rem;
            padding-bottom: 0.95rem;
        }
        .focus-layout #timer-column .glass-panel {
            padding: 0.8rem !important;
        }
        .focus-layout #timer-column .timer-visual-wrap {
            width: 118px !important;
            height: 118px !important;
            margin-bottom: 0.45rem !important;
        }
        .focus-layout #timer-column #timer-display {
            font-size: 1.8rem !important;
        }
        .focus-layout #timer-column #timer-controls-buttons,
        .focus-layout #timer-column #timer-controls-extra {
            display: none !important;
        }
        .focus-layout #timer-column #timer-compact-controls {
            display: flex !important;
        }
        .focus-layout #timer-column .timer-compact-label {
            margin-bottom: 0.45rem !important;
            font-size: 0.78rem !important;
        }
        .focus-layout #answers-list {
            grid-template-columns: repeat(1, minmax(0, 1fr)) !important;
            gap: 0.95rem !important;
        }
        @media (min-width: 1024px) {
            .focus-layout #answers-list {
                grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
            }
            .focus-layout #answers-list > div {
                min-height: 96px;
            }
        }

        /* Custom themed dropdowns */
        .native-select-hidden {
            position: absolute !important;
            opacity: 0 !important;
            pointer-events: none !important;
            width: 0 !important;
            height: 0 !important;
        }
        .custom-select-wrap { position: relative; width: 100%; z-index: 1; }
        .custom-select-wrap.open { z-index: 120; }
        .custom-select-trigger {
            width: 100%;
            padding: 0.72rem 0.9rem;
            border-radius: 0.75rem;
            border: 2px solid rgba(255,255,255,0.1);
            background: rgba(255,255,255,0.05);
            color: #e2e8f0;
            font-weight: 800;
            display: flex;
            align-items: center;
            justify-content: space-between;
            gap: 10px;
            transition: all .2s ease;
        }
        .custom-select-trigger:hover {
            border-color: rgba(34,211,238,0.45);
            background: rgba(255,255,255,0.08);
        }
        .custom-select-arrow {
            width: 18px;
            height: 18px;
            color: rgba(34,211,238,0.95);
            transition: transform .2s ease;
            flex-shrink: 0;
        }
        .custom-select-wrap.open .custom-select-arrow { transform: rotate(180deg); }
        .custom-select-menu {
            position: absolute;
            top: calc(100% + 8px);
            left: 0;
            right: 0;
            border-radius: 0.75rem;
            border: 1px solid rgba(34,211,238,0.25);
            background: rgba(7,12,26,0.96);
            backdrop-filter: blur(10px);
            box-shadow: 0 18px 40px rgba(0,0,0,0.45);
            padding: 6px;
            z-index: 130;
            max-height: 220px;
            overflow-y: auto;
            overscroll-behavior: contain;
            scrollbar-width: thin;
            scrollbar-color: rgba(34,211,238,0.55) rgba(255,255,255,0.06);
        }
        .custom-select-option {
            width: 100%;
            text-align: center;
            border: none;
            border-radius: 0.6rem;
            padding: 0.58rem 0.55rem;
            background: transparent;
            color: rgba(226,232,240,0.9);
            font-weight: 700;
            transition: all .15s ease;
        }
        .custom-select-option:hover {
            background: rgba(34,211,238,0.12);
            color: #67e8f9;
        }
        .custom-select-option.active {
            background: rgba(34,211,238,0.18);
            color: #22d3ee;
            border: 1px solid rgba(34,211,238,0.35);
        }
        /* نسخة أصغر لقائمة المؤقت فقط */
        .custom-select-wrap.compact .custom-select-trigger {
            padding: 0.55rem 0.75rem;
            font-size: 0.86rem;
        }
        .custom-select-wrap.compact .custom-select-arrow {
            width: 15px;
            height: 15px;
        }
        .custom-select-wrap.compact .custom-select-menu {
            top: calc(100% + 6px);
        }
        .custom-select-wrap.compact .custom-select-option {
            padding: 0.5rem 0.5rem;
            font-size: 0.85rem;
        }
        .timer-compact-controls {
            display: none;
            align-items: center;
            justify-content: center;
            gap: 10px;
            margin-bottom: 6px;
        }
        .timer-mini-btn {
            width: 38px;
            height: 38px;
            border-radius: 999px;
            border: 1px solid rgba(255,255,255,0.18);
            display: inline-flex;
            align-items: center;
            justify-content: center;
            color: #fff;
            transition: all .2s ease;
            box-shadow: 0 0 0 0 rgba(0,0,0,0);
        }
        .timer-mini-btn:hover {
            transform: translateY(-1px);
            box-shadow: 0 6px 16px rgba(0,0,0,0.25);
        }
        .timer-mini-btn.play {
            background: rgba(52,211,153,0.18);
            border-color: rgba(52,211,153,0.45);
            color: #6ee7b7;
        }
        .timer-mini-btn.pause {
            background: rgba(248,113,113,0.18);
            border-color: rgba(248,113,113,0.45);
            color: #fca5a5;
        }
        .timer-mini-btn.reset {
            background: rgba(96,165,250,0.16);
            border-color: rgba(96,165,250,0.45);
            color: #93c5fd;
        }
        .timer-mini-btn.auto {
            background: rgba(251,191,36,0.14);
            border-color: rgba(251,191,36,0.35);
            color: #fcd34d;
        }
        .timer-mini-btn.auto.active {
            background: rgba(52,211,153,0.2);
            border-color: rgba(52,211,153,0.45);
            color: #6ee7b7;
        }
        .timer-mini-btn.duration {
            width: auto;
            min-width: 56px;
            padding: 0 12px;
            background: rgba(167,139,250,0.16);
            border-color: rgba(167,139,250,0.4);
            color: #ddd6fe;
            font-weight: 900;
            font-size: 0.88rem;
            letter-spacing: 0.02em;
        }
        .timer-duration-main-btn {
            min-width: 72px;
            height: 42px;
            border-radius: 0.75rem;
            border: 1px solid rgba(167,139,250,0.4);
            background: rgba(167,139,250,0.14);
            color: #ddd6fe;
            font-weight: 900;
            font-size: 0.92rem;
            letter-spacing: 0.02em;
            transition: all .2s ease;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            padding: 0 12px;
        }
        .timer-duration-main-btn:hover {
            background: rgba(167,139,250,0.22);
            transform: translateY(-1px);
        }

        /* Modal overlay */
        .modal-overlay {
            background: rgba(0,0,0,0.8);
            backdrop-filter: blur(8px);
        }

        /* Floating particles */
        .particle {
            position: absolute;
            border-radius: 50%;
            pointer-events: none;
            animation: float 6s ease-in-out infinite;
        }

        /* Badges */
        .number-badge {
            width: 36px;
            height: 36px;
            display: flex;
            align-items: center;
            justify-content: center;
            border-radius: 10px;
            font-weight: 800;
            font-size: 0.9rem;
            flex-shrink: 0;
        }

        .points-badge {
            padding: 4px 14px;
            border-radius: 20px;
            font-weight: 700;
            font-size: 0.8rem;
            letter-spacing: 0.02em;
        }

        #confetti-canvas {
            position: fixed;
            inset: 0;
            z-index: 100;
            pointer-events: none;
        }

/* --- Host Mode Styles --- */
body.host-mode #btn-host-mode { display: none !important; }
body.host-mode #settings-button { display: none !important; }
body.host-mode #layout-toggle-button { display: none !important; }
body.host-mode .btn-close-iframe { display: none !important; }
body.host-mode .answer-hidden { opacity: 1 !important; cursor: pointer; }
body.host-mode .host-answer-btn { margin-top: 10px; width: 100%; padding: 10px; border-radius: 8px; font-weight: bold; background: rgba(52,211,153,0.2); color: #34d399; border: 1px solid rgba(52,211,153,0.4); }
body.host-mode #answer-input, body.host-mode #submit-button { display: none !important; }

