/* الثيمات (الألوان) + الوضعية التانية (شريط علوي)
   كل ثيم = ألوان + فلتر بيلوّن صور الخلفية الحمرا. الافتراضي: خمري وذهبي. */
:root{
  --on-gold:#4a0a14; --gold-sh:#6e4a0e; --sec-a:#9c1626; --sec-b:#6a0a16; --sec-sh:#3a0508;
  --sheet-a:#3a0508; --sheet-b:#1c0204; --turn:#f5cf63; --bgf:none;
}
html[data-theme="blue"]{
  --felt:#0b2142; --wine:#0d2650; --red:#163d75; --red-2:#1d4b8f; --gold:#d9b25a; --gold-hi:#f6dc96; --gold-lo:#9c7a2c; --cream:#f2e3b8;
  --ink:#030b1a; --ink-2:rgba(4,14,32,.82); --on-gold:#1a2440; --gold-sh:#6b5520; --sec-a:#1f4f93; --sec-b:#0f2d5c; --sec-sh:#06152e;
  --sheet-a:#0f2a52; --sheet-b:#06142b; --turn:#f6dc96; --bgf:hue-rotate(218deg) saturate(.75) brightness(1.12);
}
html[data-theme="graphite"]{
  --felt:#1d2024; --wine:#24282e; --red:#32383f; --red-2:#3c434c; --gold:#3fc1b0; --gold-hi:#7fe3d5; --gold-lo:#23887b; --cream:#e6eaee;
  --ink:#0b0c0e; --ink-2:rgba(12,14,17,.85); --on-gold:#0d2421; --gold-sh:#1a5c53; --sec-a:#3a4048; --sec-b:#23272c; --sec-sh:#101214;
  --sheet-a:#2a2e34; --sheet-b:#141619; --turn:#7fe3d5; --bgf:grayscale(1) brightness(1.6) contrast(1.05);
}
html[data-theme="green"]{
  --felt:#0d3b23; --wine:#0f4a2b; --red:#176a3e; --red-2:#1f7a48; --cream:#f8e6b0;
  --ink:#03170c; --ink-2:rgba(4,24,13,.82); --on-gold:#3a2a08; --sec-a:#1f7a48; --sec-b:#0f4a2b; --sec-sh:#062615;
  --sheet-a:#0f4a2b; --sheet-b:#052313; --turn:#fbe39a; --bgf:hue-rotate(128deg) saturate(.8) brightness(1.15);
}
html[data-theme="purple"]{
  --felt:#1f0f38; --wine:#2e1650; --red:#45247a; --red-2:#5a2f8a; --gold:#e7b29a; --gold-hi:#ffd9c7; --gold-lo:#a87560; --cream:#f6dfd3;
  --ink:#0c0418; --ink-2:rgba(16,6,30,.82); --on-gold:#3a1e2a; --gold-sh:#7a4c3a; --sec-a:#5a2f8a; --sec-b:#33175a; --sec-sh:#160a2a;
  --sheet-a:#2e1650; --sheet-b:#140726; --turn:#ffd9c7; --bgf:hue-rotate(262deg) saturate(.7) brightness(1.15);
}
html[data-theme="sand"]{
  --felt:#cdb994; --wine:#7a4e2a; --red:#8f5c31; --red-2:#a26a3a; --gold:#8a5a2b; --gold-hi:#ffd9a0; --gold-lo:#5e3a17; --cream:#fff3dc;
  --ink:#2e1a09; --ink-2:rgba(74,44,18,.88); --on-gold:#fff3dc; --gold-sh:#4a2c12; --sec-a:#a26a3a; --sec-b:#6e4420; --sec-sh:#3e240e;
  --sheet-a:#6e4420; --sheet-b:#3e240e; --turn:#fff3dc; --bgf:grayscale(1) sepia(.8) saturate(1.2) brightness(3) contrast(.78);
}
html[data-theme="sand"] .chip.king{color:#4a2c12}
html[data-theme="sand"] .btn{background:linear-gradient(#b07a45,var(--gold) 55%,var(--gold-lo));border-color:#e9c99b}
html[data-theme="teal"]{
  --felt:#0a3332; --wine:#0b3b3a; --red:#125755; --red-2:#17605d; --gold:#d48f55; --gold-hi:#f4c08f; --gold-lo:#9a6030; --cream:#f7e2cc;
  --ink:#021312; --ink-2:rgba(3,22,21,.84); --on-gold:#3a1f0b; --gold-sh:#6e421c; --sec-a:#17605d; --sec-b:#0b3b3a; --sec-sh:#041c1b;
  --sheet-a:#0b3b3a; --sheet-b:#041b1a; --turn:#f4c08f; --bgf:hue-rotate(168deg) saturate(.7) brightness(1.2);
}

/* لما الثيم مش الأحمر: صورة القائمة (بإطارها الذهبي) بتتبدّل بالسجادة الملوّنة + إطار بلون الثيم */
html[data-theme]:not([data-theme="red"]) #v-menu>.bg,html[data-theme]:not([data-theme="red"]) #v-lobby>.bg{background-image:url(../assets/img/bg-table.webp)}
html[data-theme]:not([data-theme="red"]) .deco{display:block}

/* المكوّنات بتاخد ألوان الثيم */
.btn{color:var(--on-gold);box-shadow:0 6px 0 var(--gold-sh),0 10px 18px rgba(0,0,0,.45)}
.btn:active{box-shadow:0 3px 0 var(--gold-sh),0 6px 12px rgba(0,0,0,.45)}
.btn.small{box-shadow:0 4px 0 var(--gold-sh)}
.btn.sec{background:linear-gradient(var(--sec-a),var(--sec-b));color:var(--cream);box-shadow:0 6px 0 var(--sec-sh),0 10px 18px rgba(0,0,0,.45)}
.btn.sec.small{box-shadow:0 4px 0 var(--sec-sh)}
.sheet,.mbox{background:linear-gradient(var(--sheet-a),var(--sheet-b))}
.panel{background:linear-gradient(var(--sheet-a),var(--sheet-b))}
.contracts button{background:linear-gradient(var(--sec-a),var(--sec-b))}
.contracts button:hover{filter:brightness(1.15)}
.board th{background:var(--sheet-a)}
.hud .contract{color:var(--gold-hi)}
.tag.turn{box-shadow:0 0 0 3px var(--turn),0 0 24px var(--turn)}
.card.mine.ok.lit{box-shadow:0 0 0 3px var(--turn),0 8px 16px rgba(0,0,0,.5)}
.toast,.gtoast,.tapsound,.chip.bot,.chip.king,.seg button[aria-pressed="true"],.ctrls .big,.ctrls .round[aria-pressed="true"]{color:var(--on-gold)}
.chip.king{background:var(--gold-hi)}
.code-box,.seat{background:var(--ink-2)}

/* اختيار الثيم بالإعدادات */
.swatches{display:grid;grid-template-columns:repeat(4,1fr);gap:8px}
.swatches button{display:flex;flex-direction:column;align-items:center;gap:4px;background:none;border:1.5px solid transparent;border-radius:12px;padding:6px 2px;font-weight:700;font-size:12px;color:var(--cream)}
.swatches button[aria-pressed="true"]{border-color:var(--gold-hi);background:rgba(255,255,255,.06)}
.swatches i{width:34px;height:34px;border-radius:50%;display:block;border:2px solid rgba(255,255,255,.35)}

/* ===== الوضعية التانية: شريط علوي + لاعبين بصور دائرية ===== */
html[data-layout="bar"]:not([data-orient="portrait"]) .hud{top:0;right:0;left:0;width:auto;height:58px;border-radius:0;border-width:0 0 1.5px;display:flex;align-items:center;gap:18px;padding:0 24px;flex-direction:row-reverse;justify-content:flex-end}
html[data-layout="bar"]:not([data-orient="portrait"]) .hud .contract{font-size:32px;order:-1}
html[data-layout="bar"]:not([data-orient="portrait"]) .hud .k{order:1}
html[data-layout="bar"]:not([data-orient="portrait"]) .hud .sub{order:2;opacity:.8}
html[data-layout="bar"]:not([data-orient="portrait"]) .score{top:0;left:24px;width:auto;height:58px;background:none;border:0;display:flex;align-items:center;gap:22px;padding:0;z-index:6}
html[data-layout="bar"]:not([data-orient="portrait"]) .score .t{display:none}
html[data-layout="bar"]:not([data-orient="portrait"]) .score .row{gap:10px;font-size:18px}
html[data-layout="bar"]:not([data-orient="portrait"]) .s-top{top:72px}
html[data-layout="bar"]:not([data-orient="portrait"]) .toast{top:72px}
html[data-layout="bar"] .tag{flex-direction:column;gap:4px;border-radius:20px;padding:10px 14px 8px;text-align:center}
html[data-layout="bar"] .tag .av{width:64px;height:64px;font-size:32px;box-shadow:0 0 0 3px var(--gold)}
html[data-layout="bar"] .tag .nm{font-size:18px}
html[data-layout="bar"]:not([data-orient="portrait"]) #tag-2{top:160px;left:calc(50% + 190px)}
html[data-layout="bar"]:not([data-orient="portrait"]) #tag-1{top:462px;right:14px}
html[data-layout="bar"]:not([data-orient="portrait"]) #tag-3{top:462px;left:14px}
html[data-layout="bar"] #tag-0{flex-direction:row;padding:6px 16px 6px 8px}
html[data-layout="bar"] #tag-0 .av{width:46px;height:46px;font-size:24px}
html[data-layout="bar"]:not([data-orient="portrait"]) .left-tools{flex-direction:row}
html[data-layout="bar"] .left-tools .pill{padding:8px 12px;font-size:15px}

/* الطرنيب: إله سجادة خاصة (اللوبي والطاولة)، وبتتلوّن مع كل الثيمات */
html[data-game="tarneeb"] #v-table>.bg,html[data-game="tarneeb"] #v-lobby>.bg{background-image:url(../assets/img/bg-tarneeb.webp)}
html[data-game="tarneeb"] #v-lobby>.deco{display:block}
