/* ==========================================================================
   Nizal 30 — نِزال الثلاثين
   الهوية البصرية «شعاع المعرفة»
   ثيم ليلي كحلي عميق + بنفسجي إيريس وسماوي أكوا؛ خط Rubik؛
   ورمز السداسية والحرف N. الهندسة مربّعة ناعمة بدل الدوائر،
   وكل بطاقة يعلوها «شعاع» متدرّج هو توقيع الهوية.
   (بعض الأسماء القديمة --coral/--amber/--teal بقيت كمرادفات فقط
    حتى لا ينكسر أي مرجع خارجي، وقيمها الآن من اللوحة الجديدة)
   ========================================================================== */
:root {
    /* ---- أحبار الخلفية ---- */
    --ink-0: #060b14;
    --ink-1: #0b1424;
    --ink-2: #111d33;
    --ink-3: #1b2c4a;
    --line: rgba(125, 170, 255, .15);
    --line-2: rgba(125, 170, 255, .30);
    --txt: #e9eff9;
    --muted: #8ea3c4;

    /* ---- ألوان الهوية ---- */
    --iris: #7c6cff;          /* اللون الأساسي: بنفسجي إيريس */
    --iris-2: #a78bfa;        /* بنفسجي فاتح */
    --aqua: #2ee0d0;          /* اللون الثانوي: سماوي أكوا */
    --aqua-2: #7ff3e8;

    /* ---- اللاعبان ---- */
    --p0: #38bdf8;            /* سماوي سماء */
    --p1: #f77fc4;            /* وردي */

    /* ---- حالات ---- */
    --good: #34d399;
    --bad: #fb3b5c;

    /* ---- لوح السؤال الفاتح ---- */
    --paper: #eef3fc;
    --paper-ink: #0a1322;
    --paper-muted: #5c6f8e;
    --paper-line: rgba(10, 19, 34, .12);

    /* ---- هندسة ---- */
    --radius: 16px;
    --radius-sm: 12px;
    --radius-xs: 10px;
    --shadow: 0 14px 34px rgba(3, 8, 18, .5);
    --shadow-sm: 0 6px 16px rgba(3, 8, 18, .38);
    --beam: linear-gradient(90deg, var(--iris), var(--aqua));
    --beam-135: linear-gradient(135deg, var(--iris), var(--iris-2) 55%, var(--aqua));
    --font: "Rubik", "Segoe UI", Tahoma, Arial, sans-serif;

    /* ---- مرادفات قديمة (لا تُستعمل في التصميم الجديد) ---- */
    --coral: var(--iris);
    --coral-2: var(--iris-2);
    --amber: var(--aqua);
    --teal: var(--aqua);
    --mint: var(--good);
    --rose: var(--bad);
    --accent: var(--iris);
    --accent2: var(--aqua);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--txt);
    line-height: 1.65;
    min-height: 100vh;
    font-variant-numeric: tabular-nums;
    background:
        /* شبكة «مخطط» دقيقة بدل الحلقات المتّحدة المركز */
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='64' height='64'><g fill='none' stroke='%237da8ff' stroke-opacity='0.055' stroke-width='1'><path d='M0 .5H64M.5 0V64'/></g></svg>") 0 0 / 64px 64px repeat,
        /* شعاعان مائلان */
        linear-gradient(200deg, rgba(124, 108, 255, .20) 0%, transparent 42%),
        linear-gradient(340deg, rgba(46, 224, 208, .14) 0%, transparent 46%),
        radial-gradient(900px 520px at 88% -10%, rgba(167, 139, 250, .16), transparent 64%),
        var(--ink-0);
    background-attachment: fixed;
}

a { color: var(--aqua); text-underline-offset: 3px; }
.wrap { max-width: 960px; margin: 0 auto; padding: 24px 16px 80px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.big { font-size: 1.4rem; }
.big-mult { font-size: 1.6rem; color: var(--aqua); }
.good-text { color: var(--good); }
.bad-text { color: var(--bad); }
.c-p0 { color: var(--p0); }
.c-p1 { color: var(--p1); }
.inline-form { display: inline; margin: 0; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; }
.actions-row { display: flex; gap: 12px; justify-content: center; margin-top: 14px; flex-wrap: wrap; }
.actions-col, .actions-col form { white-space: nowrap; }

/* ====== الشريط العلوي ====== */
.topbar {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 20px; position: sticky; top: 0; z-index: 20;
    background: rgba(6, 11, 20, .78); border-bottom: 1px solid var(--line); backdrop-filter: blur(10px);
}
.topbar::after {
    content: ""; position: absolute; inset-inline: 0; bottom: -1px; height: 2px;
    background: var(--beam); opacity: .55;
}
.topbar a { color: var(--txt); text-decoration: none; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; line-height: 1.1; }
.brand-logo { width: 34px; height: 34px; display: block; flex: 0 0 auto; }
.brand-text { display: flex; flex-direction: column; }
.brand-word {
    font-size: 1.08rem; font-weight: 800; letter-spacing: .02em; direction: ltr;
    background: var(--beam-135); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-sub { font-size: .68rem; font-weight: 500; color: var(--muted); letter-spacing: .04em; }
.topbar-links { display: flex; gap: 8px; flex-wrap: wrap; }
.topbar-links a {
    padding: 6px 14px; border-radius: var(--radius-xs); background: rgba(125, 170, 255, .07);
    border: 1px solid var(--line); font-size: .9rem; font-weight: 500;
    transition: border-color .15s ease, background .15s ease;
}
.topbar-links a:hover { border-color: var(--line-2); background: rgba(125, 170, 255, .13); }

/* ====== بطاقات وأزرار ====== */
.card {
    position: relative; overflow: hidden;
    background: linear-gradient(180deg, var(--ink-2), var(--ink-1));
    border: 1px solid var(--line); border-radius: var(--radius);
    padding: 22px; margin: 16px 0; box-shadow: var(--shadow);
}
/* «الشعاع» — توقيع الهوية أعلى كل بطاقة */
.card::before {
    content: ""; position: absolute; inset-inline: 0; top: 0; height: 3px;
    background: var(--beam); opacity: .8;
}
.card h1 { font-size: 1.9rem; margin: 8px 0; font-weight: 800; letter-spacing: -.01em; }
.card h2 { margin-top: 0; font-weight: 700; }
.card h3 { margin: 8px 0; font-weight: 700; }
.card.wide { max-width: 900px; margin-inline: auto; }

.btn {
    display: inline-block; cursor: pointer; text-align: center; font-family: inherit; font-weight: 600;
    border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 18px; font-size: 1rem;
    color: var(--txt); background: var(--ink-3); text-decoration: none;
    transition: transform .06s ease, filter .15s ease, border-color .15s ease;
}
.btn:hover { filter: brightness(1.14); border-color: var(--line-2); }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn-primary {
    background: var(--beam-135); border-color: transparent; color: #0a0620; font-weight: 700;
    box-shadow: 0 8px 22px rgba(124, 108, 255, .34);
}
.btn-danger { background: linear-gradient(135deg, #fb3b5c, #c01238); border-color: transparent; color: #fff; }
.btn-ghost { background: transparent; }
.btn-lg { font-size: 1.15rem; padding: 14px 26px; border-radius: 14px; }
.btn-sm { font-size: .85rem; padding: 5px 12px; border-radius: 9px; }
.btn-block { width: 100%; }
.btn-pass { background: rgba(46, 224, 208, .12); border-color: var(--aqua); color: var(--aqua); }
.btn-pass:disabled { opacity: .35; }
.btn-strike { background: rgba(251, 59, 92, .15); border-color: var(--bad); color: #ffb0be; }
.btn-finish { background: linear-gradient(135deg, #3ee0a6, #16a37a); border-color: transparent; color: #03261b; font-weight: 700; }

/* العناوين الصغيرة والوسوم: أشكال مربّعة ناعمة بنقطة قائدة بدل الحبّات الدائرية */
.kicker { color: var(--aqua); font-weight: 700; letter-spacing: .4px; font-size: .85rem; }
.pill {
    display: inline-flex; align-items: center; gap: 6px; background: rgba(124, 108, 255, .14);
    border: 1px solid rgba(124, 108, 255, .45); color: #cdc4ff; padding: 3px 11px;
    border-radius: 8px; font-size: .8rem; margin: 2px; font-weight: 500;
}
.pill::before { content: ""; width: 5px; height: 5px; border-radius: 1.5px; background: currentColor; opacity: .85; }
.pill-soft { background: rgba(142, 163, 196, .12); border-color: var(--line); color: var(--muted); }
.pill-good { background: rgba(52, 211, 153, .14); border-color: var(--good); color: #a9f0d1; }
.pill-bad { background: rgba(251, 59, 92, .14); border-color: var(--bad); color: #ffb6c3; }

/* ====== الصفحة الرئيسية ====== */
.hero { text-align: center; padding: 42px 22px 34px; position: relative; overflow: hidden; }
/* سداسية شبحية بدل الحلقة القديمة */
.hero::after {
    content: ""; position: absolute; inset-inline-end: -70px; top: -70px; width: 240px; height: 240px;
    background: conic-gradient(from 200deg, rgba(124, 108, 255, .22), rgba(46, 224, 208, .16), transparent 62%);
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    pointer-events: none;
}
.hero-logo { width: 104px; height: 104px; margin: 0 auto 10px; display: block; position: relative; }
.hero-badge {
    display: inline-block; margin-bottom: 10px; color: var(--aqua); font-weight: 600; letter-spacing: .3px;
    border: 1px solid rgba(46, 224, 208, .35); background: rgba(46, 224, 208, .08);
    padding: 4px 14px; border-radius: 9px; font-size: .88rem;
}
.hero h1 { font-size: 2.7rem; line-height: 1.15; margin: 6px 0 2px; font-weight: 800; letter-spacing: -.015em; }
.hero-word {
    background: var(--beam-135); -webkit-background-clip: text; background-clip: text; color: transparent;
    display: inline-block; direction: ltr;
}
.hero-sub { font-size: 1.3rem; font-weight: 600; color: var(--txt); margin: 2px 0 8px; opacity: .92; }
.hero-num { color: var(--aqua); font-size: 1.15em; font-weight: 800; }
.hero-actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; margin-top: 18px; position: relative; z-index: 1; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-top: 18px; }
.grid-cards .card { margin: 0; position: relative; }
.grid-cards .card .kicker { display: inline-flex; align-items: center; gap: 8px; }
/* رقم الجولة داخل «خلية» سداسية */
.grid-cards .card .kicker::before {
    content: attr(data-n); width: 28px; height: 28px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--beam-135); color: #0a0620; font-size: .88rem; font-weight: 800;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.link-card { text-decoration: none; display: block; color: inherit; }
.link-card:hover { border-color: var(--line-2); }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; margin: 16px 0; }
.stat { background: var(--ink-3); border-radius: var(--radius-sm); padding: 14px; text-align: center; border: 1px solid var(--line); }
.stat b { display: block; font-size: 1.8rem; color: var(--aqua); font-weight: 800; }
.stat span { color: var(--muted); font-size: .9rem; }

/* ====== إعداد المباراة ====== */
.players-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 10px; }
.p-card {
    border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 12px 12px 12px; background: var(--ink-3);
    position: relative; overflow: hidden;
}
.p-card::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--line); }
.p-card.p0::before { background: var(--p0); }
.p-card.p1::before { background: var(--p1); }
.p-card label { display: block; margin-bottom: 6px; font-weight: 700; }
.p-card.p0 label { color: var(--p0); }
.p-card.p1 label { color: var(--p1); }
.p-card input { width: 100%; }
.cats-field { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 16px 0; }
.cats-field legend { color: var(--aqua); padding: 0 8px; font-weight: 700; }
.cat-group, .cat-block { margin-bottom: 12px; }
.cat-root { font-size: 1.05rem; margin-bottom: 4px; }
.cat-children { display: flex; flex-wrap: wrap; gap: 6px 18px; padding-inline-start: 6px; }
.check-item, .check-all { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.check-item { font-size: .95rem; color: #c6d5ec; }
.check-line { display: flex; align-items: center; gap: 8px; }

/* ====== نماذج ====== */
label { display: block; margin-bottom: 12px; font-weight: 600; }
input, select, textarea {
    width: 100%; padding: 10px 12px; border-radius: var(--radius-sm); border: 1px solid var(--line);
    background: rgba(125, 170, 255, .07); color: var(--txt); font: inherit; margin-top: 4px;
}
select option { color: #0a1322; }
input::placeholder, textarea::placeholder { color: rgba(233, 239, 249, .45); }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--aqua); outline-offset: 1px; border-color: transparent; }
input[type="checkbox"] { width: auto; accent-color: var(--iris); margin: 0; }
textarea { resize: vertical; min-height: 60px; }
.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.section-box { border: 1px dashed var(--line-2); border-radius: var(--radius-sm); padding: 14px; margin: 12px 0; background: rgba(125, 170, 255, .03); }
.flash-err { background: rgba(251, 59, 92, .13); border: 1px solid var(--bad); border-radius: var(--radius-sm); padding: 10px 14px; margin-bottom: 14px; color: #ffcfd8; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin: 14px 0; }
.filters select, .filters input { width: auto; flex: 1 1 180px; }

/* ====== جداول ====== */
.table { width: 100%; border-collapse: collapse; margin-top: 12px; }
.table th, .table td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: start; vertical-align: middle; }
.table th { color: var(--muted); font-size: .85rem; font-weight: 600; letter-spacing: .02em; }
.table td .btn { margin: 2px; }
td form { display: inline; }
.score-table .total { font-weight: 800; font-size: 1.15rem; color: var(--aqua); }
.pname { font-weight: 700; }
tr.p0 td.pname { color: var(--p0); }
tr.p1 td.pname { color: var(--p1); }
.pager { display: flex; gap: 12px; justify-content: center; align-items: center; margin-top: 16px; }

/* ====== رسائل ====== */
.flash {
    background: rgba(46, 224, 208, .12); border: 1px solid var(--aqua); color: #bdf6ef;
    border-radius: var(--radius-sm); padding: 12px 18px; margin: 10px 0; text-align: center; font-weight: 600;
    animation: fadein .25s ease;
}
.flash-ok { background: rgba(52, 211, 153, .13); border-color: var(--good); color: #bcf3da; }
@keyframes fadein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; } }

/* ====== شريط النتيجة ====== */
.scorebar { display: flex; justify-content: space-between; gap: 14px; margin: 6px 0 4px; direction: rtl; }
.sb-player {
    flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 12px;
    background: linear-gradient(180deg, var(--ink-2), var(--ink-1)); border: 1px solid var(--line);
    border-radius: var(--radius-sm); box-shadow: var(--shadow-sm);
    position: relative; overflow: hidden;
}
/* شريط لون اللاعب صار جانبياً بدل الحد العلوي */
.sb-player::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--pc); }
.sb-p0 { --pc: var(--p0); }
.sb-p1 { --pc: var(--p1); flex-direction: row-reverse; }
.sb-p1::before { inset-inline-start: auto; inset-inline-end: 0; }
.sb-name { flex: 1; text-align: center; font-weight: 700; font-size: 1.15rem; color: var(--pc); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
/* درجة اللاعب في «خلية» مربّعة ناعمة بدل الحلقة */
.sb-ring {
    width: 48px; height: 48px; flex: 0 0 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center;
    border: 2px solid var(--pc); background: color-mix(in srgb, var(--pc) 18%, transparent);
    font-weight: 800; font-size: 1.3rem; color: #fff;
    box-shadow: inset 0 0 18px color-mix(in srgb, var(--pc) 22%, transparent);
}
.round-title { text-align: center; font-size: 1.15rem; font-weight: 700; margin: 6px 0 12px; color: var(--muted); }
.round-title b { color: var(--txt); }

/* ====== العدّاد ====== */
.countdown { display: flex; justify-content: center; margin: 14px 0 6px; }
.cd-box { position: relative; width: 150px; height: 150px; }
.small-cd .cd-box { width: 110px; height: 110px; }
.cd-svg { transform: rotate(-90deg); width: 100%; height: 100%; display: block; }
.cd-ring { fill: none; stroke: rgba(125, 170, 255, .12); stroke-width: 7; }
/* حافة مستقيمة + توهّج: توقيع بصري جديد للمؤقّت */
.cd-bar {
    fill: none; stroke: var(--aqua); stroke-width: 7; stroke-linecap: butt;
    transition: stroke-dashoffset .95s linear;
    filter: drop-shadow(0 0 6px rgba(46, 224, 208, .55));
}
.cd-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.cd-num { font-size: 2.6rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.cd-tick { font-size: .78rem; color: var(--muted); letter-spacing: .08em; }
.countdown.danger .cd-bar { stroke: var(--bad); filter: drop-shadow(0 0 8px rgba(251, 59, 92, .6)); }
.countdown.danger .cd-num { color: var(--bad); }
.countdown.paused .cd-bar { stroke: var(--muted); filter: none; }
.play-hud { display: flex; align-items: center; justify-content: center; gap: 22px; flex-wrap: wrap; }
.counter-grid { text-align: center; margin: 8px 0; }
.counter-now { font-size: 4.4rem; font-weight: 800; color: var(--good); line-height: 1; letter-spacing: -.03em; }
.counter-of { color: var(--muted); font-size: 1.1rem; margin-top: 6px; }
.pts-badge {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-width: 96px; padding: 12px 16px;
    border-radius: var(--radius); background: rgba(46, 224, 208, .1); border: 1px solid var(--aqua);
}
.pts-badge small { color: var(--muted); }
.pts-badge b { font-size: 2rem; color: var(--aqua); line-height: 1; font-weight: 800; }

/* ====== لوح السؤال ====== */
/* لوح فاتح بارد بشبكة نقطية ورافدة متدرّجة على الحافة — بديل «الورقة» القديمة */
.q-card {
    background:
        url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='22' height='22'><circle cx='1' cy='1' r='1' fill='%230a1322' fill-opacity='0.07'/></svg>") 0 0 / 22px 22px repeat,
        var(--paper);
    border: 1px solid rgba(10, 19, 34, .08); color: var(--paper-ink); text-align: right;
    position: relative; overflow: hidden;
}
.q-card::before {
    content: ""; position: absolute; top: 0; bottom: 0; inset-inline-start: 0; inset-inline-end: auto;
    width: 5px; height: auto; background: var(--beam-135); opacity: 1;
}
.q-text { font-size: 1.45rem; line-height: 1.7; color: var(--paper-ink); font-weight: 700; letter-spacing: -.005em; }
.q-card .hint, .q-card .muted { color: var(--paper-muted); }
.q-card .pill { background: rgba(124, 108, 255, .12); border-color: rgba(124, 108, 255, .4); color: #4a3bbf; }

/* ====== أزرار الحكم ====== */
.judge {
    font-family: inherit; font-size: 1.15rem; font-weight: 700; cursor: pointer; padding: 14px 24px; border-radius: 14px;
    border: 1px solid var(--line); color: var(--txt); background: var(--ink-3); touch-action: manipulation;
}
.judge:active { transform: scale(.97); }
.judge.good { background: linear-gradient(135deg, #3ee0a6, #16a37a); border-color: transparent; color: #03261b; }
.judge.bad { background: rgba(251, 59, 92, .15); border-color: var(--bad); color: #ffb6c3; }
.judge b { font-size: 1.2em; }

/* ====== ماذا تعرف؟ + إجابات المزاد ====== */
.tc-top { margin: 6px 0 10px; }
.tc-header { display: flex; justify-content: space-between; align-items: center; margin: 6px 0 10px; gap: 10px; flex-wrap: wrap; }
.tc-title { font-size: 1.2rem; font-weight: 700; }
.tc-found {
    background: rgba(46, 224, 208, .1); border: 1px solid var(--aqua); border-radius: 9px;
    padding: 4px 14px; font-weight: 700; color: var(--aqua);
}
.tc-players { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin: 6px 0 10px; }
.tc-players-single { grid-template-columns: 1fr; }
.tc-player {
    display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--radius-sm); min-width: 0;
    background: var(--ink-2); border: 1px solid var(--line); position: relative; overflow: hidden;
}
.tc-player::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--line); }
.tc-player.p0::before { background: var(--p0); }
.tc-player.p1::before { background: var(--p1); }
.tc-player-head { display: flex; gap: 10px; align-items: center; }
.tc-player-info { display: flex; flex-direction: column; gap: 4px; }
.tc-player-info strong { font-size: 1.1rem; font-weight: 700; }
.tc-strikes, .mini-strikes { direction: ltr; display: inline-flex; gap: 3px; }
/* مؤشرات السترايك بلون اللاعب: المربع الممتلئ = محاولة متبقية، والأحمر المشطوب = سترايك */
.tc-player.p0 { --pc: var(--p0); }
.tc-player.p1 { --pc: var(--p1); }
.st {
    width: 20px; height: 20px; border-radius: 6px; font-size: 0; display: inline-flex; align-items: center; justify-content: center;
    background: var(--pc, var(--aqua)); box-shadow: 0 0 8px color-mix(in srgb, var(--pc, var(--aqua)) 45%, transparent);
    transition: background .15s ease, transform .15s ease;
}
.st.dead { background: transparent; border: 2px solid var(--bad); box-shadow: none; transform: scale(.92); }
.st.dead::after { content: "✕"; font-size: .8rem; font-weight: 800; color: var(--bad); line-height: 1; }
.tc-btn-row { display: flex; gap: 8px; justify-content: center; }
.tc-btn-row form { margin: 0; }
.tc-mini { font-size: .85rem; padding: 6px 10px; border-radius: 9px; }
.tc-answers { margin-top: 14px; }
.tc-search { margin-bottom: 10px; }
.warmup-answers { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.ans-form { margin: 0; }
/* أزرار الإجابات: ألواح مربّعة ناعمة بدل الحبّات الدائرية */
.ans-btn {
    font-family: inherit; font-size: 1rem; font-weight: 600; cursor: pointer; min-width: 90px; padding: 9px 16px;
    border-radius: var(--radius-xs); border: 1px solid var(--line-2); background: var(--ink-2); color: var(--txt);
    transition: background .12s ease, border-color .12s ease, color .12s ease; touch-action: manipulation;
}
.ans-btn:hover:not(:disabled) { border-color: var(--aqua); background: rgba(46, 224, 208, .08); }
.ans-btn.is-given {
    background: linear-gradient(135deg, #3ee0a6, #16a37a); border-color: transparent; color: #03261b; font-weight: 700;
}
.ans-btn:disabled { cursor: default; }
.tc-finish-row { margin-top: 14px; }
.timeup-box {
    display: flex; align-items: center; justify-content: center; min-width: 130px; padding: 14px 18px;
    border-radius: var(--radius); border: 1px solid var(--bad); background: rgba(251, 59, 92, .12);
}
.timeup-title { font-size: 1.4rem; font-weight: 800; color: var(--bad); text-align: center; }
.timeup-note { margin: 10px 0 4px; }
.timeup-decide { display: flex; gap: 12px; justify-content: center; margin: 8px 0 14px; }
.timeup-decide form { margin: 0; flex: 1; max-width: 240px; }
.timeup-decide .btn { width: 100%; font-size: 1.05rem; padding: 16px 8px; }
.auction-finish { display: flex; gap: 14px; justify-content: center; flex-wrap: wrap; }
.auction-finish form { margin: 0; }
.ref-answers, .done-answers { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 12px 0; }
.done-answers { flex-direction: column; align-items: center; gap: 6px; }
.ans-chip { background: var(--ink-3); border: 1px solid var(--line); padding: 4px 12px; border-radius: 8px; font-size: .9rem; }
.ans-chip.is-given { background: rgba(52, 211, 153, .14); border-color: var(--good); color: #a9f0d1; }
.count-note { color: var(--muted); font-size: .85rem; margin-top: 8px; }
/* الحرف الأول للاعب داخل «خلية» سداسية */
.avatar {
    width: 42px; height: 42px; display: inline-flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 1.15rem; color: #051020;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.p0 .avatar { background: var(--p0); }
.p1 .avatar { background: var(--p1); }

/* ====== المزاد: الإعداد ====== */
.auction-setup { display: flex; flex-direction: column; align-items: center; gap: 18px; margin: 30px 0 10px; }
.who-title { font-size: 1.7rem; font-weight: 700; margin: 6px 0; text-align: center; }
.who-row { display: flex; gap: 20px; justify-content: center; width: 100%; direction: rtl; }
.who-btn {
    flex: 1; max-width: 220px; padding: 20px 10px; font-family: inherit; font-size: 1.5rem; font-weight: 700; cursor: pointer;
    background: var(--ink-2); color: var(--pc); border: 2px solid color-mix(in srgb, var(--pc) 65%, transparent);
    border-radius: var(--radius); transition: transform .08s, background .12s, box-shadow .12s;
}
.who-row .who-btn:nth-child(1) { --pc: var(--p0); }
.who-row .who-btn:nth-child(2) { --pc: var(--p1); }
.who-btn:active { transform: translateY(2px); }
.who-btn.is-selected {
    background: var(--pc); color: #051020; border-color: var(--pc);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--pc) 28%, transparent);
}
.count-row { display: flex; align-items: center; gap: 20px; margin-top: 12px; direction: rtl; }
.count-label { font-size: 1.6rem; font-weight: 700; }
.count-num { font-size: 3.2rem; font-weight: 800; color: var(--aqua); min-width: 70px; text-align: center; line-height: 1; letter-spacing: -.02em; }
/* أزرار +/− صارت مربّعات ناعمة بدل الدوائر */
.step-btn {
    width: 64px; height: 64px; border-radius: 18px; border: 1px solid var(--aqua); cursor: pointer;
    background: rgba(46, 224, 208, .08); color: var(--aqua); font-family: inherit; font-size: 2.2rem; font-weight: 700; line-height: 1;
    display: flex; align-items: center; justify-content: center; user-select: none; touch-action: manipulation;
    transition: background .1s ease, color .1s ease;
}
.step-btn:active { background: var(--aqua); color: #051020; }
.count-pts { margin-top: -8px; }
.start-btn {
    margin-top: 34px; padding: 16px 30px; font-family: inherit; font-size: 1.25rem; font-weight: 700; cursor: pointer;
    background: var(--beam-135); color: #0a0620; border: 0; border-radius: var(--radius);
    box-shadow: 0 8px 22px rgba(124, 108, 255, .34);
}
.start-btn:disabled { opacity: .4; cursor: not-allowed; box-shadow: none; }
.start-btn:not(:disabled):active { transform: translateY(2px); }
.start-ico { margin-inline-end: 6px; }
.start-ico svg { width: 1.1em; height: 1.1em; vertical-align: -.15em; }

/* ====== جولة السرعة (الجرسان) ====== */
.buzz-screen, .reveal-screen { display: flex; flex-direction: column; }
.buzz-pads { display: flex; gap: 14px; margin: 14px 0 10px; direction: rtl; flex: 1 1 auto; }
.buzz-pads .buzz-form { flex: 1; margin: 0; display: flex; }
.buzz-pad, .answer-pad {
    font-family: inherit; cursor: pointer; border-radius: 22px; touch-action: manipulation;
    -webkit-tap-highlight-color: transparent; position: relative; overflow: hidden;
    transition: transform .08s ease, box-shadow .12s ease, background .12s ease;
}
/* bp0/bp1 تحدّد لون اللاعب فقط، وكل عنصر يبني مظهره منه */
.bp0 { --pc: var(--p0); }
.bp1 { --pc: var(--p1); }
/* الجرس: لوح ليلي بهالة لون اللاعب وحلقة «صدى» بدل اللوح الممتلئ القديم */
.buzz-pad {
    flex: 1; width: 100%; min-height: 220px; height: 100%; display: flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 12px; font-size: 1.55rem; font-weight: 700;
    color: var(--pc);
    border: 2px solid color-mix(in srgb, var(--pc) 55%, transparent);
    background:
        radial-gradient(115% 80% at 50% 8%, color-mix(in srgb, var(--pc) 30%, transparent), transparent 68%),
        linear-gradient(180deg, var(--ink-2), var(--ink-1));
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 12px 28px rgba(3, 8, 18, .5);
}
.buzz-pad .tap-name { color: var(--txt); font-weight: 700; }
.buzz-pad:not(:disabled):active { transform: translateY(3px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 6px 16px rgba(3, 8, 18, .5); }
/* أيقونة الجرس داخل حلقة صدى */
.tap-ico {
    width: 92px; height: 92px; display: flex; align-items: center; justify-content: center;
    border-radius: 28px; color: var(--pc);
    border: 2px solid color-mix(in srgb, var(--pc) 45%, transparent);
    background: color-mix(in srgb, var(--pc) 14%, transparent);
}
.tap-ico svg { width: 52px; height: 52px; display: block; }
.buzz-pad.is-pressed {
    background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 92%, #000), color-mix(in srgb, var(--pc) 66%, #000));
    border-color: #fff; color: #051020;
    box-shadow: 0 0 0 5px color-mix(in srgb, var(--pc) 30%, transparent), 0 12px 28px rgba(3, 8, 18, .5);
}
.buzz-pad.is-pressed .tap-name { color: #051020; }
.buzz-pad.is-pressed .tap-ico { color: #051020; background: rgba(255, 255, 255, .28); border-color: rgba(255, 255, 255, .6); }
.buzz-pad.is-pressed .bell-ico { animation: bell-ring .5s ease; }
@keyframes bell-ring {
    0%, 100% { transform: rotate(0); }
    20% { transform: rotate(-13deg); }
    45% { transform: rotate(10deg); }
    70% { transform: rotate(-6deg); }
}
.buzz-pad.is-locked {
    background: var(--ink-1); border-color: var(--line); color: var(--muted); box-shadow: none; opacity: .55;
}
.buzz-pad.is-locked .tap-name { color: var(--muted); }
.buzz-pad.is-locked .tap-ico { color: var(--muted); border-color: var(--line); background: transparent; }
.buzz-pad:disabled { cursor: default; }
.buzz-hint { text-align: center; font-size: 1.35rem; font-weight: 600; line-height: 1.8; margin: 16px 8px; }
.reveal-btn {
    font-family: inherit; font-size: 1.15rem; font-weight: 700; cursor: pointer; color: #0a0620;
    background: var(--beam-135); border: 0; border-radius: 14px; padding: 14px 26px;
    box-shadow: 0 8px 22px rgba(124, 108, 255, .34); touch-action: manipulation;
}
.reveal-btn:active { transform: translateY(2px); }
.buzz-screen .center .inline-form { display: block; }
.suggest-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 6px; }
/* الإجابة المقترحة: وسم مربّع ناعم بعلامة صح مربّعة */
.suggest-pill {
    display: inline-flex; align-items: center; gap: 8px;
    background: linear-gradient(135deg, #16a37a, #0e7f63); color: #fff;
    font-weight: 700; font-size: 1.05rem; padding: 7px 14px; border-radius: var(--radius-xs);
}
.suggest-tick {
    display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px;
    border-radius: 6px; background: rgba(255, 255, 255, .92); color: #0e7f63; font-size: .85rem; font-weight: 800;
}
.answered-title { font-size: 1.55rem; font-weight: 700; margin: 40px 4px 14px; }
.answer-pads { display: flex; gap: 14px; direction: rtl; }
.answer-pads form { flex: 1; margin: 0; }
/* ألواح «من أجاب»: ممتلئة بلون اللاعب لوضوح القرار */
.answer-pad {
    width: 100%; padding: 30px 8px; font-size: 1.5rem; font-weight: 800; border-radius: 20px; border: 0;
    color: #051020;
    background: linear-gradient(180deg, color-mix(in srgb, var(--pc) 95%, #fff), color-mix(in srgb, var(--pc) 72%, #000));
    box-shadow: 0 10px 24px rgba(3, 8, 18, .45);
}
.answer-pad:active { transform: translateY(3px); box-shadow: 0 5px 14px rgba(3, 8, 18, .45); }
.nobody-row { margin-top: 40px; }
.reveal-screen .nobody-row { margin-top: auto; padding-top: 30px; }
/* زر «لم يجب أحد»: مربّع ناعم بدل الدائرة */
.nobody-btn {
    width: 74px; height: 74px; border-radius: 22px; border: 1px solid var(--bad); cursor: pointer;
    background: rgba(251, 59, 92, .14); color: #ff9dae;
    font-size: 2.1rem; line-height: 1; font-weight: 400; touch-action: manipulation;
    transition: background .1s ease, color .1s ease;
}
.nobody-btn:active { background: var(--bad); color: #fff; }

/* ====== التعويض ====== */
.turn-card {
    background: linear-gradient(180deg, var(--ink-2), var(--ink-1)); border: 1px solid var(--line);
    border-radius: var(--radius); padding: 26px 18px; margin: 16px 0; box-shadow: var(--shadow);
}
.turn-badge {
    width: 92px; height: 92px; margin: 6px auto 10px; display: flex; align-items: center; justify-content: center;
    font-size: 2.5rem; font-weight: 800; color: #051020;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.tb0 { background: var(--p0); }
.tb1 { background: var(--p1); }
.turn-text { max-width: 560px; margin: 8px auto; }
.turn-strip {
    display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 16px; border-radius: var(--radius-sm);
    background: var(--ink-2); border: 1px solid var(--line); border-inline-start: 4px solid var(--pc, var(--aqua));
}
.turn-strip.p0 { --pc: var(--p0); }
.turn-strip.p1 { --pc: var(--p1); }
.turn-name b { color: var(--pc); }
.turn-count { color: var(--muted); font-size: .9rem; }
.hint-timeline { list-style: none; margin: 14px 0; padding: 0; position: relative; }
.tl-item { display: flex; align-items: center; gap: 12px; padding: 8px 0; position: relative; }
.tl-item:not(:last-child)::after {
    content: ""; position: absolute; inset-inline-start: 15px; top: 40px; bottom: -8px; width: 2px; background: rgba(10, 19, 34, .16);
}
/* نقاط التلميحات صارت «خلايا» سداسية */
.tl-dot {
    width: 32px; height: 32px; flex: 0 0 32px; display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: .9rem; background: var(--iris); color: #fff; z-index: 1;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.tl-text { font-weight: 600; font-size: 1.1rem; }
.tl-item.hidden-hint { opacity: .45; }
.tl-item.hidden-hint .tl-dot { background: #a8b6c9; }
.tl-item.hidden-hint .tl-text { letter-spacing: 4px; }
.career-path .tl-dot { font-size: 1rem; }
.career-path .tl-text { display: flex; flex-direction: column; line-height: 1.35; }
.career-path .tl-step { font-size: .72rem; font-weight: 600; color: var(--paper-muted); }
.career-path .tl-item.shown .tl-text { font-size: 1.15rem; }
.reveal-hint { color: var(--paper-ink); border-color: rgba(10, 19, 34, .25); background: rgba(10, 19, 34, .04); }
.reveal-hint small { color: var(--paper-muted); }
.answer-ref {
    margin: 12px 0; padding: 10px 16px; border-radius: var(--radius-sm); border: 1px dashed var(--aqua);
    background: rgba(46, 224, 208, .07);
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.answer-ref small { color: var(--muted); }
.answer-ref b { color: var(--aqua); font-size: 1.15rem; font-weight: 700; }
.clutch-actions { display: flex; gap: 12px; margin-top: 8px; }
.clutch-actions form { flex: 1; margin: 0; }
.clutch-actions .judge { width: 100%; }

/* ====== نظرة عامة على الجولات ====== */
.round-progress { display: flex; justify-content: space-between; gap: 6px; margin-bottom: 18px; position: relative; }
.round-progress::before { content: ""; position: absolute; top: 18px; inset-inline: 8%; height: 2px; background: var(--line); }
.rstep { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; position: relative; }
/* خطوات الجولات: خلايا سداسية بدل الدوائر */
.rstep span {
    width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; font-weight: 800;
    background: var(--ink-3); color: var(--muted); font-size: .95rem;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
}
.rstep small { color: var(--muted); font-size: .75rem; }
.rstep.done span { background: var(--good); color: #03261b; }
.rstep.now span { background: var(--iris); color: #fff; box-shadow: 0 0 0 4px rgba(124, 108, 255, .22); }
.rstep.now small { color: var(--txt); font-weight: 700; }
.rules-box { background: rgba(125, 170, 255, .05); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 18px; margin: 16px 0; }
.rules-box h3 { margin-top: 4px; color: var(--aqua); }
.rules-box ul { padding-inline-start: 20px; margin: 6px 0; }
.rules-box li { margin: 4px 0; }
.count-picker { display: flex; align-items: center; justify-content: center; gap: 14px; margin: 14px 0 4px; direction: rtl; flex-wrap: wrap; }
.count-picker .cp-label { font-weight: 700; font-size: 1.15rem; }
.count-picker .count-num { font-size: 2.4rem; min-width: 56px; }
.count-picker .step-btn { width: 48px; height: 48px; font-size: 1.8rem; border-radius: 14px; }
.start-actions { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-top: 10px; }
.finished-card h1 { font-size: 2.2rem; }

/* ====== المباراة الحية: تحسينات اللمس ====== */
.live-match { overscroll-behavior-y: contain; }
.live-match .buzz-pad, .live-match .answer-pad, .live-match .who-btn, .live-match .step-btn {
    -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
/* رسالة عابرة تطفو فوق المحتوى فلا يتحرك التخطيط عند التحديث */
.live-match .flash {
    position: fixed; top: 58px; inset-inline: 12px; z-index: 40; margin: 0; pointer-events: none;
    background: rgba(6, 11, 20, .94); border-color: var(--aqua); color: #bdf6ef; animation: toast 2.4s ease forwards;
}
@keyframes toast { 0% { opacity: 0; transform: translateY(-8px); } 8% { opacity: 1; transform: none; } 80% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }

/* ====== شاشات صغيرة ====== */
@media (max-width: 640px) {
    .players-row, .form-grid-2 { grid-template-columns: 1fr; }
    .hero h1 { font-size: 2.1rem; }
    .hero-sub { font-size: 1.1rem; }
    .topbar { padding: 8px 12px; }
}

@media (max-width: 560px) {
    .live-match .wrap { padding: 10px 12px max(16px, env(safe-area-inset-bottom)); }
    .topbar { padding: 6px 10px; gap: 6px; flex-wrap: nowrap; }
    .brand { gap: 7px; white-space: nowrap; }
    .brand-logo { width: 26px; height: 26px; }
    .brand-word { font-size: .92rem; }
    .brand-sub { font-size: .6rem; }
    .topbar-links { flex-wrap: nowrap; gap: 6px; }
    .topbar-links a { padding: 4px 9px; font-size: .76rem; white-space: nowrap; }
    .live-match .flash { top: 50px; font-size: .95rem; padding: 9px 12px; }

    .scorebar { gap: 10px; }
    .sb-player { gap: 8px; padding: 6px 8px; }
    .sb-ring { width: 40px; height: 40px; flex-basis: 40px; font-size: 1.1rem; border-radius: 12px; }
    .sb-name { font-size: 1rem; }
    .round-title { font-size: 1rem; margin: 4px 0 8px; }

    .buzz-screen { min-height: calc(100vh - 166px); min-height: calc(100dvh - 166px); }
    .buzz-screen .buzz-pads { margin: 6px 0; }
    .buzz-pad { min-height: 200px; font-size: 1.35rem; gap: 10px; }
    .tap-ico { width: 78px; height: 78px; border-radius: 24px; }
    .tap-ico svg { width: 44px; height: 44px; }
    .buzz-hint { font-size: 1.05rem; line-height: 1.7; margin: 8px 4px; }
    .reveal-btn { width: 100%; padding: 15px 10px; }
    .reveal-screen { min-height: calc(100vh - 166px); min-height: calc(100dvh - 166px); }
    .reveal-screen .q-card { padding: 16px 14px; margin: 6px 0; }
    .reveal-screen .q-text { font-size: 1.15rem; line-height: 1.6; }
    .suggest-pill { font-size: .95rem; padding: 5px 12px; }
    .answered-title { font-size: 1.3rem; margin: 22px 4px 10px; }
    .answer-pad { padding: 34px 6px; }
    .nobody-btn { width: 68px; height: 68px; font-size: 2rem; border-radius: 20px; }

    .tc-header { margin: 2px 0 6px; }
    .tc-title { font-size: 1.05rem; }
    .tc-players { grid-template-columns: 1fr 1fr; gap: 8px; margin: 4px 0 6px; }
    .tc-players-single { grid-template-columns: 1fr; }
    .tc-player { padding: 10px 8px 10px 8px; gap: 6px; }
    .tc-player-head { flex-direction: column; text-align: center; gap: 4px; }
    .tc-player-head .avatar { width: 32px; height: 32px; font-size: .95rem; }
    .tc-player-info { align-items: center; }
    .tc-player-info strong { font-size: .95rem; }
    .tc-btn-row { flex-direction: row; gap: 5px; }
    .tc-btn-row form { flex: 1; }
    .tc-btn-row .btn { width: 100%; padding: 9px 4px; font-size: .78rem; white-space: nowrap; }
    .q-card { padding: 14px; }
    .q-text { font-size: 1.15rem; line-height: 1.6; }
    .tc-answers .warmup-answers { gap: 6px; }
    .tc-answers .ans-form { flex: 1 1 calc(50% - 6px); }
    .tc-answers .ans-btn { min-width: 0; width: 100%; font-size: .88rem; padding: 10px 8px; }
    .tc-finish-row .btn { width: 100%; }
    .auction-finish { flex-direction: row; gap: 8px; flex-wrap: nowrap; }
    .auction-finish form { flex: 1; }
    .auction-finish .btn { width: 100%; font-size: .85rem; padding: 12px 6px; }

    .auction-setup { margin: 16px 0 6px; gap: 12px; }
    .who-title { font-size: 1.4rem; }
    .who-row { gap: 12px; }
    .who-btn { font-size: 1.25rem; padding: 16px 6px; }
    .count-row { margin-top: 6px; gap: 12px; }
    .count-label { font-size: 1.25rem; }
    .step-btn { width: 54px; height: 54px; font-size: 2rem; border-radius: 16px; }
    .count-num { font-size: 2.7rem; min-width: 56px; }
    .start-btn { width: 100%; margin-top: 18px; }
    .play-hud { flex-wrap: nowrap; justify-content: space-around; gap: 8px; margin: 4px 0; }
    .play-hud .countdown, .play-hud .counter-grid { margin: 0; }
    .counter-now { font-size: 3.2rem; }
    .cd-box { width: 110px; height: 110px; }
    .cd-num { font-size: 2rem; }

    .turn-card { padding: 20px 14px; }
    .tl-text { font-size: 1rem; }
    .clutch-actions { flex-direction: column; }
    .answer-ref { flex-direction: column; align-items: flex-start; gap: 2px; }
    .rstep small { display: none; }
    .rstep.now small { display: block; position: absolute; top: 40px; white-space: nowrap; }
    .round-progress { margin-bottom: 30px; }
    .table th, .table td { padding: 8px 6px; font-size: .85rem; }
}

/* أرقام موجبة داخل النص العربي تبقى مقروءة (+2 لا 2+) */
.pts-badge b, .judge b, .count-num { direction: ltr; unicode-bidi: isolate; display: inline-block; }
/* أزرار الحكم ثابتة أسفل الشاشة كي لا تحتاج تمريراً */
.clutch-actions {
    position: sticky; bottom: max(10px, env(safe-area-inset-bottom)); z-index: 5; padding: 8px 0 2px;
    background: linear-gradient(to bottom, transparent, var(--ink-0) 40%);
}
@media (min-width: 561px) {
    .buzz-screen { min-height: calc(100vh - 200px); min-height: calc(100dvh - 200px); }
}

/* ====== التعويض: اختيار قيمة النقاط ====== */
.award-box { margin-top: 6px; }
.pts-picker { display: flex; align-items: center; justify-content: center; gap: 10px; margin: 10px 0 2px; direction: rtl; flex-wrap: wrap; }
.pts-label { font-weight: 700; color: var(--muted); }
.pts-opt {
    font-family: inherit; font-size: 1.05rem; font-weight: 700; cursor: pointer; padding: 10px 22px; border-radius: var(--radius-xs);
    border: 1px solid var(--aqua); background: rgba(46, 224, 208, .07); color: var(--aqua); touch-action: manipulation;
    display: inline-flex; flex-direction: column; align-items: center; line-height: 1.2;
}
.pts-opt small { font-size: .7rem; font-weight: 400; opacity: .8; }
.pts-opt.is-selected { background: var(--aqua); color: #051020; }
.award-box .answered-title { margin-top: 18px; }
.award-box .nobody-row { margin-top: 22px; }
@media (max-width: 560px) {
    .award-box .answered-title { font-size: 1.15rem; margin: 8px 4px 6px; }
    .award-box .answer-pad { padding: 20px 6px; font-size: 1.35rem; }
    .award-box .nobody-row { margin-top: 10px; }
    .award-box .nobody-btn { width: 56px; height: 56px; font-size: 1.7rem; border-radius: 16px; }
    .pts-picker { margin: 4px 0 0; gap: 8px; }
    .pts-opt { padding: 7px 16px; }
    .tl-item { padding: 4px 0; }
    .tl-item:not(:last-child)::after { top: 34px; }
    .hint-timeline { margin: 8px 0; }
    .answer-ref { margin: 8px 0; padding: 8px 12px; }
}

/* ====== جولة «المستحيل» ====== */
.cat-badge {
    display: inline-block; padding: 4px 14px; border-radius: 8px; background: rgba(167, 139, 250, .15);
    border: 1px solid rgba(167, 139, 250, .45); color: #d6c7ff; font-weight: 700; font-size: .85rem; margin-bottom: 6px;
}
.pit-row { display: flex; gap: 14px; direction: rtl; margin: 4px 0 10px; }
.pit-row form { flex: 1; margin: 0; }
.pit-btn {
    width: 100%; font-family: inherit; font-weight: 700; font-size: 1.05rem; padding: 12px 8px; border-radius: 14px;
    border: 2px dashed color-mix(in srgb, var(--pc) 60%, transparent); color: var(--pc);
    background: color-mix(in srgb, var(--pc) 12%, transparent);
    cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 2px; touch-action: manipulation;
}
.pit-btn small { font-weight: 500; opacity: .75; font-size: .72rem; }
.pit-btn:not(:disabled):active { transform: translateY(2px); background: color-mix(in srgb, var(--pc) 26%, transparent); }
.pit-btn:disabled { background: var(--ink-2); color: var(--muted); border-color: var(--line); opacity: .5; cursor: default; }
.pit-banner {
    text-align: center; font-weight: 800; padding: 10px; border-radius: var(--radius-sm); margin: 8px 0; color: #051020;
    background: linear-gradient(135deg, color-mix(in srgb, var(--pc) 92%, #fff), color-mix(in srgb, var(--pc) 70%, #000));
}
.answer-miss { background: var(--ink-2); color: var(--bad); border: 2px solid var(--bad); box-shadow: none; }
.cats-pick { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; margin-top: 10px; }
.cats-pick .cp-label { color: var(--muted); font-weight: 600; }

/* جدول النتائج بخمس جولات: يبقى ضمن عرض الموبايل */
@media (max-width: 520px) {
    .score-table th, .score-table td { padding: 8px 2px; text-align: center; font-size: .8rem; }
    .score-table th { font-size: .66rem; line-height: 1.2; white-space: normal; }
    .score-table .pname { text-align: start; max-width: 58px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .score-table .total { font-size: 1rem; }
}
.pit-sub { display: block; font-size: .8rem; font-weight: 600; margin-top: 6px; opacity: .8; }

/* اختيار فئات الجولة من شاشة الجولة */
.round-cats { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 14px; margin: 12px 0; background: rgba(125, 170, 255, .04); }
.round-cats summary { cursor: pointer; font-weight: 700; }
.round-cats .cat-group { margin-top: 10px; }
.round-cats .cat-children { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 6px; }

/* ========== «اسأل AI» للحكم: زر صغير يتوسع للجنب ولا يحرّك شيئاً في الصفحة ========== */
.ai-widget { position: fixed; left: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 60; direction: ltr; max-width: calc(100vw - 24px); }
.ai-bar { display: flex; align-items: center; padding: 3px; border-radius: 16px; background: var(--ink-2); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ai-fab { flex: 0 0 40px; width: 40px; height: 40px; border: 0; border-radius: 13px; cursor: pointer; font-size: 1.1rem; line-height: 1; color: #0a0620; background: var(--beam-135); }
.ai-form { display: flex; align-items: center; gap: 6px; margin: 0; overflow: hidden; max-width: 0; opacity: 0; transition: max-width .26s ease, opacity .2s ease, margin .26s ease; }
.ai-widget.is-open .ai-form { max-width: min(74vw, 290px); opacity: 1; margin-left: 6px; margin-right: 3px; }
.ai-input { flex: 1 1 auto; min-width: 0; width: 170px; padding: 8px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--ink-0); color: var(--txt); font: inherit; font-size: 16px; }
.ai-input:focus { outline: 2px solid var(--aqua); outline-offset: 1px; }
.ai-send { flex: 0 0 auto; padding: 8px 16px; border: 0; border-radius: 12px; cursor: pointer; font: inherit; font-weight: 700; white-space: nowrap; color: #0a0620; background: var(--aqua); }
.ai-send:disabled { opacity: .55; cursor: default; }
.ai-widget.is-loading .ai-fab { animation: ai-pulse 1s ease-in-out infinite; }
@keyframes ai-pulse { 50% { transform: scale(.88); opacity: .7; } }
.ai-result { position: absolute; left: 0; bottom: calc(100% + 8px); max-width: min(88vw, 340px); direction: rtl; text-align: start; padding: 8px 14px; border-radius: var(--radius-sm); line-height: 1.5; font-weight: 700; background: var(--ink-2); border: 1px solid var(--line); box-shadow: var(--shadow); }
.ai-result small { display: block; margin-top: 2px; font-size: .74rem; font-weight: 400; color: var(--muted); }
.ai-result .ai-who { font-weight: 600; }
.ai-result.is-yes { border-color: var(--good); color: var(--good); }
.ai-result.is-no { border-color: var(--bad); color: var(--bad); }
.ai-result.is-unsure { border-color: var(--aqua); color: var(--aqua); }
.ai-result.is-error, .ai-result.is-loading { color: var(--muted); }
body.has-ai .wrap { padding-bottom: 84px; }
@media (prefers-reduced-motion: reduce) {
    .ai-form, .ai-widget.is-loading .ai-fab, .buzz-pad.is-pressed .bell-ico { transition: none; animation: none; }
}
.ai-result .ai-id { direction: ltr; unicode-bidi: isolate; font-size: .78rem; font-weight: 400; color: var(--muted); }

/* ====== أفاتار اللاعب (إيموجي أو الحرف الأول) ====== */
.p-emoji { display: inline-block; font-style: normal; line-height: 1; }
.avatar { font-size: 1.25rem; }

/* ====== اختيار اللون والأفاتار في شاشة الإعداد ====== */
.p-card { --pc: var(--p0); }
.p-card.p1 { --pc: var(--p1); }
.p-style { margin-top: 10px; display: flex; flex-direction: column; gap: 8px; }
.p-style-row { display: flex; flex-wrap: wrap; gap: 6px; }
.p-style-row label { display: inline-flex; margin: 0; position: relative; }
.p-style-row input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.swatch, .emoji-opt {
    width: 34px; height: 34px; border-radius: 10px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center;
    border: 2px solid transparent; transition: transform .1s ease, border-color .1s ease;
}
.swatch { background: var(--sw); }
.emoji-opt { background: var(--ink-2); font-size: 1.2rem; }
.emoji-opt.is-none { font-size: .75rem; color: var(--muted); }
.p-style-row input:checked + .swatch { border-color: #fff; transform: scale(1.1); box-shadow: 0 0 0 3px color-mix(in srgb, var(--sw) 40%, transparent); }
.p-style-row input:checked + .emoji-opt { border-color: var(--pc); background: color-mix(in srgb, var(--pc) 22%, transparent); }
.p-style-row input:focus-visible + span { outline: 2px solid var(--aqua); outline-offset: 2px; }
.p-style-row input:disabled + .swatch { opacity: .25; cursor: not-allowed; }
.p-style-label { font-size: .8rem; color: var(--muted); }

/* ====== بدء المباراة: لعب سريع / إعداد يدوي ====== */
.start-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 14px 0 6px; }
.start-modes .btn { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.start-modes small { font-size: .78rem; font-weight: 400; opacity: .8; }
.btn-quick { background: linear-gradient(135deg, #fbbf24, #fb923c); color: #1a0e00; border: 0; }
.quick-note { margin: 0 0 10px; }
@media (max-width: 420px) { .start-modes { grid-template-columns: 1fr; } }

/* ====== زر التراجع العائم (يمين الشاشة، مقابل «اسأل AI») ====== */
.undo-fab-form { position: fixed; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 60; margin: 0; }
.undo-fab {
    display: flex; align-items: center; gap: 8px; max-width: min(62vw, 260px); padding: 7px 14px 7px 10px; cursor: pointer;
    font: inherit; color: var(--txt); background: var(--ink-2); border: 1px solid var(--line-2); border-radius: 16px;
    box-shadow: var(--shadow); animation: fadein .2s ease;
}
.undo-fab:active { transform: translateY(2px); }
.undo-ico { font-size: 1.2rem; line-height: 1; }
.undo-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; text-align: start; }
.undo-txt b { font-size: .95rem; }
.undo-txt small { font-size: .72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.live-match .wrap { padding-bottom: 96px; }

/* ====== لحظة الجرس: وميض وارتجاج أقوى للّوح الفائز ====== */
.buzz-pad.is-pressed { animation: buzz-hit .5s cubic-bezier(.3, 1.6, .5, 1); }
.buzz-pad.is-pressed::after {
    content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--pc) 70%, #fff), transparent 70%);
    animation: buzz-flash .6s ease-out forwards;
}
@keyframes buzz-hit {
    0% { transform: scale(.94); }
    35% { transform: scale(1.05) rotate(-1deg); }
    55% { transform: scale(.99) rotate(1deg); }
    100% { transform: scale(1); }
}
@keyframes buzz-flash { from { opacity: .9; } to { opacity: 0; } }
body.buzz-shake .match-root { animation: screen-shake .35s ease; }
@keyframes screen-shake {
    20% { transform: translateX(-5px); } 40% { transform: translateX(5px); }
    60% { transform: translateX(-3px); } 80% { transform: translateX(3px); }
}
@media (prefers-reduced-motion: reduce) {
    .buzz-pad.is-pressed, .buzz-pad.is-pressed::after, body.buzz-shake .match-root, .undo-fab { animation: none; }
}
