/* =====================================================================
   مظهر "استديو المليون" — مسرح أزرق، إضاءة، وأشكال سداسية بحدود ذهبية
   مستوحى من استديوهات برامج المسابقات في بداية الألفية. يعمل فقط عندما يكون <html data-theme="studio">
   ===================================================================== */
html[data-theme="studio"] {
    --stage-deep: #060f3a;
    --stage-mid: #0e2a8a;
    --stage-glow: #3f63e8;
    --gold-hi: #ffe9a8;
    --gold-mid: #f5c242;
    --gold-lo: #a8730f;
    --navy: #0a1647;
    --navy-2: #12236b;
    --cyan: #3fd4f7;
    --orange: #ff8a3d;
    --win: #3edc81;
    --lose: #ff4d6a;
    --hex: polygon(16px 0, calc(100% - 16px) 0, 100% 50%, calc(100% - 16px) 100%, 16px 100%, 0 50%);

    --bg: var(--stage-deep); --bg-alt: var(--navy); --card: var(--navy); --card-tint: var(--navy-2);
    --text: #f3f6ff; --text-dim: #a9b8ee; --ink: #f3f6ff; --ink-dim: #a9b8ee;
    --teal: var(--gold-mid); --sky: var(--gold-mid); --coral: var(--lose); --coral-soft: #ff8a9d;
    --violet: #b79bff; --sun: var(--gold-mid); --sun-deep: var(--gold-mid);
    --team-a: var(--cyan); --team-b: var(--orange);
    --amber-ink: var(--gold-hi); --gold: var(--gold-mid); --rose: var(--lose);
    --radius: 14px; --radius-sm: 10px;
}

/* ---------- المسرح: بقعة ضوء علوية + أشعة + حلقات أرضية ---------- */
html[data-theme="studio"], html[data-theme="studio"] body {
    background-color: var(--stage-deep);
    background-image:
        radial-gradient(ellipse 70% 38% at 50% -6%, rgba(120, 156, 255, .75), rgba(120, 156, 255, 0) 70%),
        conic-gradient(from 180deg at 50% -8%, transparent 0 4%, rgba(160, 190, 255, .10) 5% 8%, transparent 9% 15%, rgba(160, 190, 255, .07) 16% 18%, transparent 19% 31%, rgba(160, 190, 255, .07) 32% 34%, transparent 35% 41%, rgba(160, 190, 255, .10) 42% 45%, transparent 46% 100%),
        radial-gradient(ellipse 62% 15% at 50% 100%, rgba(245, 194, 66, 0) 0 92%, rgba(245, 194, 66, .5) 93% 95%, rgba(245, 194, 66, 0) 96%),
        radial-gradient(ellipse 88% 24% at 50% 106%, rgba(245, 194, 66, 0) 0 93%, rgba(245, 194, 66, .3) 94% 95.5%, rgba(245, 194, 66, 0) 96.5%),
        radial-gradient(ellipse 80% 22% at 50% 104%, rgba(245, 194, 66, .22), rgba(245, 194, 66, 0) 72%),
        linear-gradient(180deg, #0c2284 0%, #091a66 45%, #050c33 100%);
    background-attachment: fixed;
    background-size: auto;
    background-position: 0 0;
    color: var(--text);
}
html[data-theme="studio"] .stage, html[data-theme="studio"] .site-footer { color: var(--text); }

/* ---------- الخطوط ---------- */
html[data-theme="studio"] { font-family: 'Readex Pro', 'Tajawal', sans-serif; }
html[data-theme="studio"] body { font-family: 'Readex Pro', 'Tajawal', sans-serif; }
html[data-theme="studio"] h1, html[data-theme="studio"] h2, html[data-theme="studio"] h3, html[data-theme="studio"] .display, html[data-theme="studio"] .q-tile, html[data-theme="studio"] .team-score .points, html[data-theme="studio"] .team-score .name,
html[data-theme="studio"] .timer-num, html[data-theme="studio"] .room-code, html[data-theme="studio"] .results-row .results-score { font-family: 'Reem Kufi', 'Readex Pro', 'Tajawal', sans-serif; }
/* النصوص الصغيرة (أزرار، حقول، تصنيفات) بخط Readex Pro لأن الخط الكوفي يصعب قراءته بحجم صغير */
html[data-theme="studio"] .btn, html[data-theme="studio"] .cat-tab, html[data-theme="studio"] .eyebrow, html[data-theme="studio"] .q-turn, html[data-theme="studio"] .field label, html[data-theme="studio"] .turn-indicator { font-family: 'Readex Pro', 'Tajawal', sans-serif; font-weight: 600; }
html[data-theme="studio"] .q-text, html[data-theme="studio"] .subtitle, html[data-theme="studio"] .field input, html[data-theme="studio"] .field select, html[data-theme="studio"] .answer-text { font-family: 'Readex Pro', 'Tajawal', sans-serif; }

/* Reem Kufi يتوقف عند 700: نثبّت الوزن حتى لا يُسمَّك الخط صناعيًا ويتشوّه */
html[data-theme="studio"] h1, html[data-theme="studio"] h2, html[data-theme="studio"] h3,
html[data-theme="studio"] .display, html[data-theme="studio"] .q-tile, html[data-theme="studio"] .team-score .points,
html[data-theme="studio"] .team-score .name, html[data-theme="studio"] .timer-num, html[data-theme="studio"] .results-row .results-score { font-weight: 700; }

/* ---------- العناوين ---------- */
html[data-theme="studio"] .brand-logo { filter: drop-shadow(0 6px 22px rgba(63, 99, 232, .75)); }
html[data-theme="studio"] .title-xl {
    background: none; -webkit-background-clip: border-box; background-clip: border-box;
    -webkit-text-fill-color: var(--gold-hi); color: var(--gold-hi);
    font-weight: 700; text-shadow: 0 2px 22px rgba(245, 194, 66, .4);
}
html[data-theme="studio"] .eyebrow { background: transparent; color: var(--gold-hi); border: 0; border-top: 1.5px solid var(--gold-mid); border-bottom: 1.5px solid var(--gold-mid); border-radius: 0; padding: 4px 22px; letter-spacing: .04em; }
html[data-theme="studio"] .subtitle { color: #c6d2ff; }

/* ---------- اللوحات: كحلي بحدّ ذهبي ---------- */
html[data-theme="studio"] .panel, html[data-theme="studio"] .mode-card, html[data-theme="studio"] .role-card, html[data-theme="studio"] .q-modal {
    background: linear-gradient(170deg, rgba(23, 45, 130, .96), rgba(8, 18, 70, .97));
    border: 2px solid var(--gold-mid);
    border-radius: 16px;
    color: var(--text);
    box-shadow: 0 0 0 1px rgba(255, 233, 168, .25) inset, 0 0 40px rgba(63, 99, 232, .35), 0 24px 50px rgba(0, 0, 0, .55);
}
html[data-theme="studio"] .role-card:hover, html[data-theme="studio"] .mode-card:hover { border-color: var(--gold-hi); box-shadow: 0 0 0 1px rgba(255, 233, 168, .35) inset, 0 0 50px rgba(245, 194, 66, .35), 0 24px 50px rgba(0, 0, 0, .55); }
html[data-theme="studio"] .role-card.selected { border-color: var(--gold-hi); background: linear-gradient(170deg, rgba(60, 80, 170, .98), rgba(14, 30, 100, .98)); }
html[data-theme="studio"] .role-card p, html[data-theme="studio"] .mode-card p { color: #b8c5f5; }

/* ---------- الأزرار: معيّنات ذهبية ---------- */
html[data-theme="studio"] .btn {
    position: relative; isolation: isolate; border: 0; color: #1a1200;
    background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold-mid) 48%, #d89a1f 100%);
    clip-path: var(--hex); border-radius: 0; padding-left: 38px; padding-right: 38px; font-weight: 700;
    box-shadow: none; text-shadow: 0 1px 0 rgba(255, 255, 255, .45);
    transition: filter .15s ease, transform .15s ease;
}
html[data-theme="studio"] .btn:hover { transform: none; filter: brightness(1.1) saturate(1.05); box-shadow: none; }
html[data-theme="studio"] .btn:active { transform: scale(.98); }
html[data-theme="studio"] .btn:disabled { opacity: .4; filter: grayscale(.5); }
html[data-theme="studio"] .btn.ghost { background: linear-gradient(180deg, var(--gold-hi), var(--gold-mid)); color: var(--gold-hi); text-shadow: none; }
html[data-theme="studio"] .btn.ghost::before { content: ''; position: absolute; inset: 2px; z-index: -1; clip-path: var(--hex); background: linear-gradient(180deg, #1a2f8c, #0a1647); }
html[data-theme="studio"] .btn.ghost:hover { filter: brightness(1.2); border: 0; }
html[data-theme="studio"] .btn.danger { background: linear-gradient(180deg, #ff9aa9, var(--lose) 50%, #c92a48); color: #fff; text-shadow: 0 1px 2px rgba(0, 0, 0, .35); border: 0; }
html[data-theme="studio"] .btn.sm { padding-left: 28px; padding-right: 28px; }

/* ---------- زر الانضمام: تذكرة ذهبية عريضة ---------- */
html[data-theme="studio"] .join-cta {
    background: linear-gradient(180deg, var(--gold-hi), var(--gold-mid) 50%, #d89a1f);
    clip-path: polygon(26px 0, calc(100% - 26px) 0, 100% 50%, calc(100% - 26px) 100%, 26px 100%, 0 50%);
    border-radius: 0; box-shadow: none; padding-left: 52px; padding-right: 52px; color: #1a1200;
}
html[data-theme="studio"] .join-cta:hover, html[data-theme="studio"] .join-cta:focus-visible { transform: none; filter: brightness(1.08); box-shadow: none; }
html[data-theme="studio"] .join-cta-text, html[data-theme="studio"] .join-cta-arrow { color: #1a1200; }
html[data-theme="studio"] .join-cta-text p { opacity: .8; }

/* ---------- الحقول ---------- */
html[data-theme="studio"] .field label { color: var(--gold-hi); }
html[data-theme="studio"] .field input, html[data-theme="studio"] .field select {
    background: rgba(5, 12, 51, .7); color: #fff; border: 1.5px solid rgba(245, 194, 66, .45); border-radius: 10px;
}
html[data-theme="studio"] .field input::placeholder { color: #7f90d6; }
html[data-theme="studio"] .field input:focus, html[data-theme="studio"] .field select:focus { border-color: var(--gold-mid); box-shadow: 0 0 0 4px rgba(245, 194, 66, .22); }
html[data-theme="studio"] .field select option { color: #111; }
html[data-theme="studio"] .cat-chip, html[data-theme="studio"] .avatar-chip { background: rgba(5, 12, 51, .6); border: 2px solid rgba(245, 194, 66, .3); color: #fff; }
html[data-theme="studio"] .cat-chip.selected, html[data-theme="studio"] .avatar-chip.selected { border-color: var(--gold-mid); background: rgba(245, 194, 66, .2); color: var(--gold-hi); }
html[data-theme="studio"] .hint-text, html[data-theme="studio"] .waiting-note, html[data-theme="studio"] .mod-label { color: #a9b8ee; }

/* ---------- كود الغرفة ---------- */
html[data-theme="studio"] .room-code {
    background: linear-gradient(180deg, #1a2f8c, #0a1647); color: #fff; border: 0; border-radius: 0;
    clip-path: var(--hex); padding: 8px 34px; box-shadow: none; position: relative; isolation: isolate;
}
html[data-theme="studio"] .room-code::before { content: ''; position: absolute; inset: 2px; z-index: -1; clip-path: var(--hex); background: linear-gradient(180deg, #1c3399, #0a1647); }
html[data-theme="studio"] .room-code { background: linear-gradient(180deg, var(--gold-hi), var(--gold-mid)); }
html[data-theme="studio"] .room-code b { color: var(--gold-hi); }
html[data-theme="studio"] .role-badge { background: rgba(245, 194, 66, .18); color: var(--gold-hi); border: 1px solid rgba(245, 194, 66, .5); }

/* ---------- لوحات الفرق: معيّنان على جانبي الشاشة ---------- */
html[data-theme="studio"] .team-score {
    position: relative; isolation: isolate; border: 0; border-radius: 0; background: transparent;
    clip-path: polygon(34px 0, calc(100% - 34px) 0, 100% 50%, calc(100% - 34px) 100%, 34px 100%, 0 50%);
    padding: 10px 52px; box-shadow: none; --edge: var(--cyan);
}
html[data-theme="studio"] .team-score.b { --edge: var(--orange); }
html[data-theme="studio"] .team-score::before { content: ''; position: absolute; inset: 0; z-index: -2; background: var(--edge); }
html[data-theme="studio"] .team-score::after {
    content: ''; position: absolute; inset: 3px; z-index: -1;
    clip-path: polygon(32px 0, calc(100% - 32px) 0, 100% 50%, calc(100% - 32px) 100%, 32px 100%, 0 50%);
    background: linear-gradient(180deg, #16298a, #08134f);
}
html[data-theme="studio"] .team-score .name { color: #d4defe; }
html[data-theme="studio"] .team-score.a .points { color: var(--cyan); text-shadow: 0 0 18px rgba(63, 212, 247, .6); }
html[data-theme="studio"] .team-score.b .points { color: var(--orange); text-shadow: 0 0 18px rgba(255, 138, 61, .6); }
html[data-theme="studio"] .turn-indicator { color: var(--gold-hi); }
html[data-theme="studio"] .team-score.active { transform: none; box-shadow: none; --edge: var(--gold-mid); filter: drop-shadow(0 0 14px rgba(245, 194, 66, .7)); }
html[data-theme="studio"] .team-score.leading { box-shadow: none; }
html[data-theme="studio"] .scoreboard > .display { color: var(--gold-hi) !important; }

/* ---------- التصنيفات ---------- */
html[data-theme="studio"] .cat-tab {
    background: rgba(5, 12, 51, .65); border: 1.5px solid rgba(245, 194, 66, .5); color: #e5ecff; border-radius: 999px;
}
html[data-theme="studio"] .cat-tab:hover { background: rgba(30, 55, 150, .8); }
html[data-theme="studio"] .cat-tab.active { background: linear-gradient(180deg, var(--gold-hi), var(--gold-mid)); color: #1a1200; border-color: var(--gold-hi); }

/* ---------- أرقام الأسئلة: سداسيات ---------- */
html[data-theme="studio"] .question-grid { grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); }
html[data-theme="studio"] .q-tile {
    aspect-ratio: 1.3; position: relative; isolation: isolate; background: var(--gold-mid); border: 0; border-radius: 0;
    clip-path: var(--hex); color: #fff; box-shadow: none; text-shadow: 0 2px 8px rgba(0, 0, 0, .6);
}
html[data-theme="studio"] .q-tile::before {
    content: ''; position: absolute; inset: 2.5px; z-index: -1; clip-path: var(--hex);
    background: linear-gradient(180deg, #1c3399 0%, #0a1647 100%); transition: background .15s ease;
}
html[data-theme="studio"] .q-tile:not(.taken):not(.readonly):hover { transform: scale(1.06); border: 0; box-shadow: none; filter: drop-shadow(0 0 10px rgba(245, 194, 66, .8)); color: #1a1200; text-shadow: none; }
html[data-theme="studio"] .q-tile:not(.taken):not(.readonly):hover::before { background: linear-gradient(180deg, var(--gold-hi), var(--gold-mid)); }
html[data-theme="studio"] .q-tile.readonly:hover { transform: none; border: 0; box-shadow: none; }
html[data-theme="studio"] .q-tile.taken { opacity: 1; background: #38457e; color: #6672a8; text-shadow: none; }
html[data-theme="studio"] .q-tile.taken::before { background: linear-gradient(180deg, #121b4d, #0b1236); }

/* ---------- نافذة السؤال ---------- */
html[data-theme="studio"] .overlay { background: radial-gradient(ellipse at 50% 30%, rgba(14, 36, 120, .86), rgba(2, 6, 28, .93)); backdrop-filter: blur(3px); }
html[data-theme="studio"] .q-modal { border-radius: 20px; border-width: 2.5px; }
html[data-theme="studio"] .timer-ring-bg { stroke: rgba(255, 255, 255, .12); }
html[data-theme="studio"] .timer-ring-fg { filter: drop-shadow(0 0 6px rgba(245, 194, 66, .7)); }
html[data-theme="studio"] .timer-num { color: var(--gold-hi); }
html[data-theme="studio"] .q-turn { color: var(--gold-hi); font-size: 17px; }
html[data-theme="studio"] .q-text {
    position: relative; isolation: isolate; color: #fff; font-weight: 600; line-height: 1.85;
    background: var(--gold-mid); clip-path: polygon(30px 0, calc(100% - 30px) 0, 100% 50%, calc(100% - 30px) 100%, 30px 100%, 0 50%);
    padding: 22px 56px; margin: 10px -8px 22px;
}
html[data-theme="studio"] .q-text::before {
    content: ''; position: absolute; inset: 2.5px; z-index: -1;
    clip-path: polygon(28px 0, calc(100% - 28px) 0, 100% 50%, calc(100% - 28px) 100%, 28px 100%, 0 50%);
    background: linear-gradient(180deg, #1c3399, #0a1647);
}
html[data-theme="studio"] .q-media-gallery img { border: 2px solid var(--gold-mid); border-radius: 6px; box-shadow: 0 0 22px rgba(63, 99, 232, .5); }
html[data-theme="studio"] .q-media-video { border: 2px solid var(--gold-mid); border-radius: 6px; box-shadow: 0 0 22px rgba(63, 99, 232, .5); }
html[data-theme="studio"] .q-media-note { color: #b8c5f5; }
html[data-theme="studio"] .mod-controls { border-top: 1.5px dashed rgba(245, 194, 66, .45); }
html[data-theme="studio"] .time-up-banner { background: linear-gradient(180deg, #ff8a9d, var(--lose)); border-radius: 8px; }
html[data-theme="studio"] .feedback-toast { border-radius: 8px; }
html[data-theme="studio"] .q-modal.time-up { animation: none; box-shadow: 0 0 0 3px var(--lose), 0 0 60px rgba(255, 77, 106, .6); }

/* ---------- النتائج وبطاقة الإجابة ---------- */
html[data-theme="studio"] .results-row { background: rgba(5, 12, 51, .6); border: 1.5px solid rgba(245, 194, 66, .35); border-radius: 12px; }
html[data-theme="studio"] .results-row.first { background: linear-gradient(to left, rgba(245, 194, 66, .3), rgba(245, 194, 66, .06)); border-color: var(--gold-mid); }
html[data-theme="studio"] .results-row .results-name { color: #fff; }
html[data-theme="studio"] .results-row .results-score { color: var(--gold-hi); }
html[data-theme="studio"] .answer-card.good { border-color: var(--win); box-shadow: 0 0 0 1px rgba(255, 255, 255, .15) inset, 0 0 60px rgba(62, 220, 129, .45), 0 24px 50px rgba(0, 0, 0, .55); }
html[data-theme="studio"] .answer-card.bad { border-color: var(--lose); box-shadow: 0 0 0 1px rgba(255, 255, 255, .15) inset, 0 0 60px rgba(255, 77, 106, .45), 0 24px 50px rgba(0, 0, 0, .55); }
html[data-theme="studio"] .answer-card.good h2 { color: var(--win); }
html[data-theme="studio"] .answer-card.bad h2 { color: var(--lose); }
html[data-theme="studio"] .answer-sub, html[data-theme="studio"] .answer-label { color: #b8c5f5; }
html[data-theme="studio"] .answer-text { background: rgba(245, 194, 66, .14); border: 1.5px solid rgba(245, 194, 66, .5); color: var(--gold-hi); border-radius: 12px; }
html[data-theme="studio"] .pending-item { background: rgba(5, 12, 51, .6); border: 1px solid rgba(245, 194, 66, .3); }
html[data-theme="studio"] .pending-item .who { color: #fff; }
html[data-theme="studio"] .pending-item .actions .accept { background: linear-gradient(180deg, var(--gold-hi), var(--gold-mid)); color: #1a1200; }
html[data-theme="studio"] .waiting-spinner { border-color: rgba(255, 255, 255, .15); border-top-color: var(--gold-mid); }
html[data-theme="studio"] .footer-link, html[data-theme="studio"] .footer-label { color: #c6d2ff; }
html[data-theme="studio"] .call-badge { background: rgba(255, 77, 106, .15); color: #ff9aa9; border-color: rgba(255, 77, 106, .5); }
html[data-theme="studio"] .error-text { color: #ff9aa9; }

/* ---------- زر تبديل المظهر ---------- */
html[data-theme="studio"] .theme-switcher { --sw-bg: #0a1647; --sw-ink: #fff; --sw-dim: #a9b8ee; --sw-line: rgba(245, 194, 66, .6); --sw-accent: var(--gold-mid); font-family: 'Readex Pro', 'Tajawal', sans-serif; }
html[data-theme="studio"] .theme-toggle { color: var(--gold-hi); }

@media (max-width: 700px) {
    html[data-theme="studio"] .team-score { padding: 12px 30px; clip-path: polygon(20px 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 20px 100%, 0 50%); }
    html[data-theme="studio"] .team-score::after { clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 18px 100%, 0 50%); }
    html[data-theme="studio"] .question-grid { grid-template-columns: repeat(auto-fill, minmax(78px, 1fr)); gap: 10px; }
    html[data-theme="studio"] .q-text { padding: 18px 40px; margin-left: -4px; margin-right: -4px; clip-path: polygon(20px 0, calc(100% - 20px) 0, 100% 50%, calc(100% - 20px) 100%, 20px 100%, 0 50%); }
    html[data-theme="studio"] .q-text::before { clip-path: polygon(18px 0, calc(100% - 18px) 0, 100% 50%, calc(100% - 18px) 100%, 18px 100%, 0 50%); }
}
@media (min-width: 1280px) { html[data-theme="studio"] .question-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); } }
@media (min-width: 1800px) { html[data-theme="studio"] .question-grid { grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); } }
