/* ===== غرفة العمليات: إعادة البناء (٢٠٢٦-١١-٢٢) =====
   شريط المراحل فوق المشهد (لا شيء أسفله يتصادم مع شريط الموقع)، اللوحة بجانب المشهد على الكمبيوتر وتحته على الجوال. */
.th-main { padding-bottom: calc(118px + env(safe-area-inset-bottom)); }
.th-gate-card h1 { text-wrap: balance; }
.th-gate-card p { max-width: 46ch; margin-inline: auto; line-height: 1.8; }

/* شريط المراحل والأنشطة الحرة */
.th-bar { display: flex; gap: 10px; align-items: stretch; margin: 0 0 12px; }
.th-track { flex: 1; min-width: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; list-style: none; margin: 0; padding: 5px;
  border-radius: 18px; background: rgba(3, 12, 16, .6); box-shadow: inset 0 0 0 1px var(--line); }
.th-track li { min-width: 0; }
.th-track button { width: 100%; min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 7px 10px; border: 0; border-radius: 13px; background: none;
  color: var(--muted); font-size: 14px; text-align: start; transition: background .25s, color .25s; }
.th-track button:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .04); }
.th-track b { flex: none; width: 27px; height: 27px; border-radius: 50%; display: grid; place-items: center; font-size: 13.5px; font-weight: 700;
  box-shadow: inset 0 0 0 1.5px var(--line-2); transition: background .25s, color .25s; }
.th-track span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.th-track button[aria-current="step"] { background: color-mix(in srgb, var(--th) 32%, transparent); color: #fff; box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--th-l) 40%, transparent); }
.th-track button[aria-current="step"] b { background: var(--th-l); color: #04232a; box-shadow: none; }
.th-track button.done b { background: rgba(91, 227, 138, .16); color: #a8f0c0; box-shadow: inset 0 0 0 1.5px rgba(91, 227, 138, .5); }
.th-track button:disabled { opacity: .42; cursor: not-allowed; }
.th-freebtn { flex: none; display: flex; align-items: center; gap: 8px; min-height: 54px; padding: 0 18px; border-radius: 18px; border: 1px solid var(--line-2);
  background: rgba(3, 12, 16, .6); color: var(--text); font-size: 14.5px; white-space: nowrap; transition: border-color .2s, background .2s; }
.th-freebtn svg { width: 20px; height: 20px; color: var(--th-l); }
.th-freebtn:hover, .th-freebtn[aria-expanded="true"] { border-color: var(--th-l); background: color-mix(in srgb, var(--th) 18%, rgba(3, 12, 16, .6)); }

/* قائمة الأنشطة الحرة */
.th-sheet { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr); gap: 18px; padding: 18px; margin: 0 0 12px; border-radius: 22px;
  background: rgba(5, 19, 25, .94); box-shadow: inset 0 0 0 1px var(--line-2), 0 24px 50px -24px #000; animation: thCardIn .35s cubic-bezier(.22, 1, .36, 1); }
.th-sheet[hidden] { display: none; }
.th-sheet h3 { margin: 0 0 10px; font-size: 13.5px; font-weight: 600; color: var(--muted); }
.th-sheet-g > div { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr)); gap: 8px; }
.th-sheet button { display: grid; grid-template-columns: 22px minmax(0, 1fr); column-gap: 10px; row-gap: 3px; align-items: center; text-align: start; padding: 12px 14px;
  border-radius: 15px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .22); color: var(--text); transition: border-color .2s, background .2s; }
.th-sheet button svg { width: 20px; height: 20px; color: var(--th-l); grid-row: span 2; }
.th-sheet button b { font-size: 15px; }
.th-sheet button span { color: var(--dim); font-size: 12.5px; line-height: 1.55; }
.th-sheet button:hover { border-color: color-mix(in srgb, var(--th-l) 55%, transparent); }
.th-sheet button[aria-pressed="true"] { border-color: var(--th-l); background: color-mix(in srgb, var(--th) 22%, transparent); }
.th-sheet button.seen b::after { content: ''; display: inline-block; width: 7px; height: 7px; margin-inline-start: 8px; border-radius: 50%; background: #5be38a; vertical-align: 2px; }

/* اللوحة والمشهد */
.th-console { grid-template-areas: "panel room"; }
.th-modes, .th-drag { display: none !important; }
.th-canvas.pos { aspect-ratio: 800 / 360; background: radial-gradient(70% 80% at 50% 40%, #12303b, #071419); }
.th-fit { position: absolute; top: 12px; inset-inline-start: 12px; z-index: 2; display: flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
  border: 1px solid rgba(127, 220, 236, .28); background: rgba(4, 16, 21, .84); color: #e6f6f9; font-size: 13px; }
.th-fit svg { width: 15px; height: 15px; }
.th-fit[hidden] { display: none; }
.th-console.list { grid-template-areas: "panel"; }
.th-console.list .th-panel { max-width: 760px; }

/* البطاقة */
.th-card h2 { font-size: 21px; line-height: 1.55; margin: 2px 0 12px; text-wrap: balance; }
.th-card h2:focus { outline: none; }
.th-card h2 small { font-size: 13px; font-weight: 500; color: var(--dim); margin-inline-start: 6px; }
.th-lead { font-size: 16px; line-height: 1.85; margin: 0 0 12px; }
.th-small { font-size: 13px; }
.th-tag { display: inline-block; margin: 0 0 10px; padding: 3px 11px; border-radius: 999px; font-size: 12.5px; color: var(--muted); border: 1px solid var(--line-2); }
.th-tag.ster { color: var(--th-l); border-color: color-mix(in srgb, var(--th-l) 45%, transparent); }
.th-opts { display: grid; gap: 8px; }
.th-opts-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.th-opts button, .th-pool button { min-height: 46px; line-height: 1.65; }
.th-opts button:hover:not(:disabled), .th-pool button:hover { border-color: color-mix(in srgb, var(--th-l) 55%, transparent); }
.th-opts button.picked { border-color: var(--th-l); }
.th-opts button.no:disabled { opacity: .6; }
.th-opts button.ok:disabled { opacity: 1; }
.th-q { font-weight: 700; margin: 14px 0 10px; line-height: 1.7; }
.th-fb { display: flex; gap: 9px; align-items: flex-start; padding: 11px 13px; border-radius: 13px; line-height: 1.8; font-size: 14.5px; }
.th-fb svg { flex: none; width: 18px; height: 18px; margin-top: 4px; vertical-align: 0; }
.th-fb.ok { color: #c6f6d6; background: rgba(91, 227, 138, .09); box-shadow: inset 0 0 0 1px rgba(91, 227, 138, .22); }
.th-fb.no { color: #ffd0d5; background: rgba(255, 107, 120, .08); box-shadow: inset 0 0 0 1px rgba(255, 107, 120, .2); }
.th-dots i.done { background: #5be38a; }
.th-nav .btn-primary:not([hidden]) { animation: thCardIn .35s cubic-bezier(.22, 1, .36, 1); }

/* رتّب الخطوات */
.th-seq { list-style: none; counter-reset: s; margin: 0 0 10px; padding: 0; display: grid; gap: 6px; }
.th-seq li { counter-increment: s; display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: rgba(255, 255, 255, .04); line-height: 1.65; font-size: 14.5px; }
.th-seq li::before { content: counter(s, arabic-indic); flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 13px; font-weight: 700;
  background: color-mix(in srgb, var(--th) 40%, transparent); color: #fff; }
.th-seq li.ph { justify-content: center; color: var(--dim); background: none; border: 1px dashed var(--line-2); }
.th-seq li.ph::before { display: none; }
.th-seq li.ok { background: rgba(91, 227, 138, .09); } .th-seq li.no { background: rgba(255, 107, 120, .12); box-shadow: inset 0 0 0 1px rgba(255, 107, 120, .4); }
.th-pool { display: grid; gap: 8px; }
.th-pool button { border: 1px dashed var(--line-2); background: rgba(0, 0, 0, .2); color: var(--text); border-radius: 12px; padding: 9px 13px; font-size: 14px; text-align: start; }
.th-row { display: flex; justify-content: flex-end; margin-top: 8px; }
.th-row .btn svg { width: 15px; height: 15px; }

/* الأدوات */
.th-toolgrid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin: 6px 0 12px; }
.th-toolgrid button { display: grid; justify-items: center; gap: 4px; padding: 12px 6px 10px; border-radius: 15px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .24);
  color: #dde4ea; font-size: 13.5px; transition: border-color .2s, background .2s; }
.th-toolgrid button svg { width: 100%; max-width: 132px; height: 44px; }
.th-toolgrid button b { color: var(--text); font-weight: 600; }
.th-toolgrid button span { color: var(--dim); font-size: 11px; }
.th-toolgrid button:hover:not(:disabled) { border-color: color-mix(in srgb, var(--th-l) 55%, transparent); color: #fff; }
.th-toolgrid button.on { border-color: var(--th-l); background: color-mix(in srgb, var(--th) 20%, transparent); }
.th-toolgrid button.ok { border-color: #5be38a; background: rgba(91, 227, 138, .1); color: #c6f6d6; }
.th-toolgrid button.no { border-color: rgba(255, 107, 120, .6); opacity: .7; }
.th-toolgrid button.seen b::after { content: ''; display: inline-block; width: 6px; height: 6px; margin-inline-start: 6px; border-radius: 50%; background: #5be38a; vertical-align: 2px; }
.th-tool-big { padding: 14px; border-radius: 16px; background: radial-gradient(80% 90% at 50% 40%, rgba(255, 255, 255, .06), transparent); color: #e6edf2; }
.th-tool-big svg { width: 100%; height: 86px; display: block; }
.th-tool h3 small { color: var(--dim); font-weight: 500; font-size: 13px; }

/* لوحة العدّ */
.th-count { width: 100%; border-collapse: separate; border-spacing: 0; margin: 4px 0 6px; font-size: 14.5px; border-radius: 14px; overflow: hidden;
  background: #f4efe6; color: #1d2a2f; font-variant-numeric: tabular-nums; }
.th-count th { padding: 9px 12px; font-size: 12.5px; font-weight: 600; text-align: start; background: #e3ddd2; color: #4b585d; }
.th-count td { padding: 10px 12px; border-top: 1px solid #ddd5c8; font-weight: 600; }
.th-count td + td { text-align: center; font-size: 16px; } .th-count th + th { text-align: center; }

/* حوار وقفة التأكيد */
.th-talk { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 8px; }
.th-talk li { display: grid; gap: 2px; padding: 10px 13px; border-radius: 14px 14px 14px 4px; background: rgba(255, 255, 255, .05); line-height: 1.75;
  animation: thCardIn .45s cubic-bezier(.22, 1, .36, 1); }
.th-talk b { color: var(--th-l); font-size: 13px; }
.th-doc { margin: 10px 0 4px; padding: 14px 16px; border-radius: 14px; background: #f4efe6; color: #1d2a2f; box-shadow: 0 14px 30px -18px #000; animation: thCardIn .45s cubic-bezier(.22, 1, .36, 1); }
.th-doc > b { display: block; font-size: 14px; margin-bottom: 8px; color: #6b1d27; }
.th-doc dl { display: grid; gap: 6px; margin: 0; }
.th-doc dl div { display: flex; justify-content: space-between; gap: 10px; padding-top: 6px; border-top: 1px solid #ddd5c8; }
.th-doc dt { color: #4b585d; font-size: 13.5px; } .th-doc dd { margin: 0; font-weight: 700; }

/* النتائج والتقارير */
.th-win { text-align: start; }
.th-win-ico { width: 52px; height: 52px; margin-bottom: 8px; border-radius: 50%; display: grid; place-items: center; background: rgba(91, 227, 138, .14); color: #5be38a;
  box-shadow: inset 0 0 0 1.5px rgba(91, 227, 138, .45); }
.th-win-ico svg { width: 26px; height: 26px; }
.th-win-ico.part { background: rgba(232, 196, 122, .12); color: #e8c47a; box-shadow: inset 0 0 0 1.5px rgba(232, 196, 122, .45); }
.th-score { margin: 0 0 8px; color: var(--muted); } .th-score b { font-size: 34px; color: var(--text); margin-inline-end: 6px; vertical-align: -4px; }
.th-dh { margin: 16px 0 6px; font-size: 14px; color: var(--muted); font-weight: 600; }
.th-objs { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.th-objs li { display: flex; gap: 9px; align-items: center; padding: 8px 11px; border-radius: 11px; background: rgba(255, 255, 255, .035); font-size: 14px; }
.th-objs li svg { flex: none; width: 17px; height: 17px; }
.th-objs li.ok svg { color: #5be38a; } .th-objs li.retry svg { color: #e8c47a; }
.th-objs li span { flex: 1; } .th-objs li small { color: var(--dim); font-size: 12px; }
.th-found li { display: flex; gap: 10px; align-items: flex-start; }
.th-found li > div { display: grid; gap: 2px; } .th-found li span { color: var(--muted); }
.th-found li svg { flex: none; margin-top: 5px; }
.th-found li.ok svg { color: #5be38a; }
.th-found li.miss { background: rgba(232, 196, 122, .08); } .th-found li.miss svg { color: #e8c47a; }

/* المؤقت والتلميحات */
.th-timer { position: relative; display: flex; justify-content: flex-end; margin: -4px 0 10px; padding-top: 8px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.th-timer i { position: absolute; top: 0; inset-inline: 0; height: 4px; border-radius: 3px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.th-timer i::after { content: ''; position: absolute; inset: 0; inset-inline-end: auto; width: calc(var(--k) * 100%); background: var(--th-l); transition: width .5s linear; }
.th-timer.low { color: #ffb4bb; } .th-timer.low i::after { background: #ff6b78; }
.th-hint, .th-zones { margin: 6px 0; font-size: 14px; }
.th-hint summary, .th-zones summary { cursor: pointer; color: var(--muted); padding: 4px 0; }
.th-zones .th-chips { margin-top: 6px; }

/* المشهد على الشاشات الضيقة */
@media (max-width: 980px) {
  .th-console { grid-template-areas: "room" "panel"; }
  .th-canvas { min-width: 0 !important; }
  .th-hot .hit { r: 64px; }
  .th-hot .r { r: 30px; }
}
@media (max-width: 720px) {
  .th-top { padding-bottom: 10px; }
  .th-top p { font-size: 14.5px; }
  .th-bar { gap: 6px; }
  .th-track { display: flex; padding: 4px; }
  .th-track li { flex: 0 0 auto; }
  .th-track li:has([aria-current="step"]) { flex: 1 1 auto; }
  .th-track button { padding: 6px; justify-content: center; }
  .th-track button span { display: none; }
  .th-track button[aria-current="step"] span { display: inline; }
  .th-freebtn { min-height: 0; padding: 0 12px; }
  .th-freebtn span { display: none; }
  .th-sheet { grid-template-columns: 1fr; padding: 14px; }
  .th-opts-2 { grid-template-columns: 1fr; }
  .th-toolgrid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .th-card { padding: 16px; }
  .th-card h2 { font-size: 19px; }
  .th-prompt { font-size: 12px; bottom: 8px; }
  .th-fit { top: 8px; inset-inline-start: 8px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .th-talk li, .th-doc, .th-sheet, .th-nav .btn-primary:not([hidden]) { animation: none; } .th-timer i::after { transition: none; } }
.lite .th-talk li, .lite .th-doc { animation: none; }

/* زر «التالي» يتوقف فوق شريط الموقع العائم عند التمرير إليه */
.th-nav .btn, .th-fb { scroll-margin-bottom: calc(120px + env(safe-area-inset-bottom)); }

/* ===== الجولة الثانية: رأس أقصر، إطار ٤:٣ على الجوال، أزرار اختيار بهوية ===== */
.th-main .th-top { align-items: center; padding: clamp(10px, 1.6vw, 18px) 0 12px; }
.th-main .th-top h1 { font-size: clamp(26px, 2.5vw, 34px); }
.th-main .th-top p { font-size: 14.5px; margin-top: 4px; }
.th-track button:disabled { opacity: .62; }
.th-track button:disabled b { box-shadow: inset 0 0 0 1.5px rgba(176, 228, 240, .22); }
.th-opts { counter-reset: o; }
.th-opts button { position: relative; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 14px; background: rgba(255, 255, 255, .03);
  border: 1px solid rgba(176, 228, 240, .16); transition: border-color .2s, background .2s, transform .2s var(--spring, ease); }
.th-opts button::before { content: ''; flex: none; width: 18px; height: 18px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px rgba(176, 228, 240, .45); transition: box-shadow .2s, background .2s; }
.th-opts button:hover:not(:disabled) { background: color-mix(in srgb, var(--th) 14%, transparent); transform: translateX(-2px); }
.th-opts button:hover:not(:disabled)::before { box-shadow: inset 0 0 0 1.5px var(--th-l); }
.th-opts button.ok { border-color: #5be38a; background: rgba(91, 227, 138, .1); }
.th-opts button.ok::before { background: #5be38a; box-shadow: inset 0 0 0 4px #0b2a1a; }
.th-opts button.no { border-color: rgba(255, 107, 120, .55); background: rgba(255, 107, 120, .07); }
.th-opts button.no::before { background: rgba(255, 107, 120, .75); box-shadow: none; }
.th-opts button:focus-visible { outline: 2px solid var(--th-l); outline-offset: 2px; }
@media (max-width: 720px) {
  .th-canvas:not(.pos) { aspect-ratio: 4 / 3; }
  .th-main .th-top h1 { font-size: 26px; }
}

/* ===== الجولة الثانية (تتمة): لوحة بطول طبيعي ومشهد ثابت، عدّاد القرار، حالات التغذية، قائمة الأنشطة على الجوال ===== */
.th-console { overflow: clip; align-items: start; }
@media (min-width: 981px) {
  .th-panel { contain: none; overflow: visible; }
  .th-stage { position: sticky; top: 76px; }
}
.th-bar { scroll-margin-top: 76px; }
.th-pos { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin: 0 0 6px; font-size: 13px; color: var(--dim); }
.th-pos b { color: var(--th-l); font-weight: 600; }
.th-step.solved .th-opts button.no, .th-step.solved .th-toolgrid button.no { opacity: .5; background: none; border-color: rgba(176, 228, 240, .14); }
.th-step.solved .th-opts button.no::before { background: none; box-shadow: inset 0 0 0 1.5px rgba(255, 107, 120, .5); }
.th-fb.info { color: var(--text); background: rgba(255, 255, 255, .05); box-shadow: inset 0 0 0 1px var(--line-2); }
.th-fb.info svg { color: var(--th-l); }
.th-nav-top { justify-content: flex-start; margin: 4px 0 8px; }
.th-record { margin: 12px 0 4px; }
.th-record summary { cursor: pointer; color: var(--muted); font-size: 14px; padding: 6px 0; }
.th-sheet-top { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; margin-bottom: -4px; }
.th-sheet-top h2 { margin: 0; font-size: 17px; }
.th-sheet-top .th-x { position: static; }
.th-hot .r { animation: none; opacity: .95; }
.th-hot:hover .r, .th-hot:focus-visible .r { fill: rgba(127, 209, 196, .32); }
@media (max-width: 720px) {
  .th-freebtn span { display: inline; }
  .th-freebtn { padding: 0 12px; font-size: 13px; gap: 6px; }
  .th-sheet { max-height: 62svh; overflow-y: auto; overscroll-behavior: contain; padding: 12px; gap: 12px; }
  .th-sheet button { padding: 10px 12px; }
  .th-sheet button span { font-size: 12px; }
}
@media (max-width: 560px) {
  .th-gate-scene { height: clamp(240px, 36svh, 380px); }
  .th-gate-card { margin-top: -38px; }
}
.th-freebtn .th-xl { font-style: normal; }
@media (max-width: 720px) { .th-freebtn .th-xl { display: none; } .th-track li:has([aria-current="step"]) { min-width: 0; } }

/* ===== الجولة الثالثة: الشاشة الحيّة (٢٠٢٦-١١-٢٢) ===== */
.mon { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; padding: 10px 12px; border-radius: 16px; direction: ltr;
  background: linear-gradient(180deg, #071a17, #030c0b); box-shadow: inset 0 0 0 1px rgba(62, 240, 138, .18), 0 18px 40px -20px #000; color: #dff; transition: box-shadow .3s; }
.mon-waves { height: 108px; padding-inline-end: 34px; }
.mon-waves canvas { width: 100%; height: 100%; display: block; border-radius: 8px; }
.mon-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 10px; margin: 0; }
.mon-nums div { min-width: 0; }
.mon-nums div { display: grid; line-height: 1; }
.mon-nums dt { font: 600 11px/1 ui-monospace, monospace; letter-spacing: .06em; opacity: .85; }
.mon-nums dd { margin: 2px 0 0; display: flex; align-items: baseline; gap: 4px; }
.mon-nums b { font: 700 28px/1 var(--font-num, ui-monospace), monospace; font-variant-numeric: tabular-nums; }
.mon-nums small { font-size: 10.5px; opacity: .7; }
.mon-hr { color: #3ef08a; } .mon-spo2 { color: #4fd8ff; } .mon-bp { color: #f2f5f7; } .mon-bp b { font-size: 22px; }
.mon-co2 { color: #ffd54a; } .mon-t { color: #ff9ec8; } .mon-t b, .mon-co2 b { font-size: 22px; }
.mon-nums .bad b { color: #ff5a5a; animation: monBlink 1s steps(2, start) infinite; }
.mon-nums .hint { animation: monHint 1.6s ease 2; border-radius: 8px; }
.mon.alarm { box-shadow: inset 0 0 0 2px #ff4d4d, 0 0 34px -6px rgba(255, 77, 77, .55); }
.mon-alarm { position: absolute; inset-inline: 12px; bottom: -12px; margin: 0; text-align: center; font-size: 12.5px; color: #ffd0d0; direction: rtl; pointer-events: none; }
.mon-alarm:empty { display: none; }
.mon-alarm:not(:empty) { bottom: auto; top: -11px; } .mon-alarm span { background: #b3202a; padding: 2px 10px; border-radius: 99px; }
.mon-snd { position: absolute; top: 8px; right: 8px; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(255, 255, 255, .06); color: #cfe; display: grid; place-items: center; }
.mon-snd svg { width: 16px; height: 16px; } .mon-snd .off { display: none; } .mon.muted .mon-snd .on { display: none; } .mon.muted .mon-snd .off { display: inline; }
@keyframes monBlink { to { opacity: .35; } }
@keyframes monHint { 50% { box-shadow: 0 0 0 3px rgba(255, 255, 255, .5); } }
@media (prefers-reduced-motion: reduce) { .mon-nums .bad b, .mon-nums .hint { animation: none; } }

/* الحالة الحيّة: اللوحة والعناصر الجديدة */
.th-track { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.th-vitals { position: sticky; top: -14px; z-index: 3; display: grid; gap: 8px; margin: -14px -14px 12px; padding: 14px 14px 10px; background: #061319; box-shadow: 0 10px 18px -12px #000; }
.th-vitals[hidden] { display: none; }
.th-safe { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
.th-safe i { height: 8px; border-radius: 99px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.th-safe b { display: block; height: 100%; width: 100%; border-radius: inherit; background: linear-gradient(90deg, #3ee08a, #9ef0b8); transition: width .6s cubic-bezier(.22, 1, .36, 1), background .3s; }
.th-safe.low b { background: linear-gradient(90deg, #ff5a5a, #ff9a6a); }
.th-safe em { font-style: normal; font-weight: 700; color: var(--text); min-width: 3.2em; text-align: end; }
.th-ctx { margin: 0 0 10px; padding: 10px 12px; border-radius: 12px; background: rgba(79, 216, 255, .07); box-shadow: inset 3px 0 0 #4fd8ff; line-height: 1.75; font-size: 14.5px; }
.th-file { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 10px 0 12px; }
.th-file div { padding: 9px 11px; border-radius: 12px; background: rgba(255, 255, 255, .04); box-shadow: inset 0 0 0 1px var(--line); }
.th-file dt { font-size: 12px; color: var(--muted); } .th-file dd { margin: 3px 0 0; font-size: 14px; line-height: 1.6; }
.th-src { display: inline-flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 12.5px; color: var(--th-l); text-decoration: none; }
.th-src svg { width: 14px; height: 14px; } .th-src:hover { text-decoration: underline; }
.th-srcline:empty { display: none; } .th-srcline { margin: 4px 0 0; }
.th-found .th-src { display: flex; }
.th-rank { margin: 6px 0 0; text-align: center; font-size: 13px; letter-spacing: .02em; color: var(--th-l); font-weight: 700; }
.th-count tr.diff td { color: #ffb3a8; font-weight: 700; }
.th-dial { display: grid; justify-items: center; gap: 4px; margin: 8px 0 10px; }
.th-dial output { font: 800 46px/1 var(--font-num, ui-monospace), monospace; color: #ffd54a; }
.th-dial small { color: var(--muted); }
.th-dial input { width: 100%; accent-color: #ffd54a; }
.th-body svg, .th-lapview svg { width: 100%; height: auto; display: block; border-radius: 14px; }
.th-body { max-width: 300px; margin: 6px auto 10px; }
.th-spot { cursor: pointer; } .th-spot circle { fill: rgba(79, 216, 255, .18); stroke: #4fd8ff; stroke-width: 2; transition: fill .2s; }
.th-spot .d { fill: #4fd8ff; stroke: none; } .th-spot:hover circle:first-child, .th-spot:focus-visible circle:first-child { fill: rgba(79, 216, 255, .4); }
.th-spot.ok circle:first-child { fill: rgba(62, 224, 138, .45); stroke: #3ee08a; } .th-spot.no circle:first-child { fill: rgba(255, 90, 90, .35); stroke: #ff5a5a; }
.th-lapview { margin: 8px 0; }
.th-cvs { list-style: none; margin: 8px 0; padding: 0; display: grid; gap: 6px; }
.th-cvs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 12px; background: rgba(255, 255, 255, .04); font-size: 13.5px; line-height: 1.6; }
.th-cvs li div { display: flex; gap: 4px; }
.th-cvs button { min-height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-2); background: none; color: var(--text); font-size: 13px; }
.th-cvs button.on { border-color: var(--th-l); background: color-mix(in srgb, var(--th) 25%, transparent); }
.th-cvs button.ok { border-color: #3ee08a; background: rgba(62, 224, 138, .16); } .th-cvs button.no { border-color: #ff5a5a; background: rgba(255, 90, 90, .14); }
.th-timer.done { opacity: .35; }

/* في الحالة الحيّة: تعتيم أخف لبقية الغرفة حتى يبقى المشهد حيًا */
.th-room.dim .th-item:not(.on) { opacity: .62; } .th-room.dim .th-deco { opacity: .72; }
.mon-snd svg.on, .mon.muted .mon-snd svg.off { display: block; } .mon-snd svg.off, .mon.muted .mon-snd svg.on { display: none; }
@media (max-width: 420px) { .mon-nums b { font-size: 22px; } .mon-bp b { font-size: 18px; } .mon-nums { gap: 4px 6px; } }
.mon-nums dd { white-space: nowrap; }
@media (max-width: 980px) {
  .th-vitals { top: 72px; margin: 0 0 10px; padding: 6px 0 8px; background: #061319; }
  .mon { padding: 8px 10px; gap: 6px; }
  .mon-waves { height: 58px; }
}
.th-stage.alarm::after { content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 90px rgba(255, 45, 45, .42); animation: thAlarm 1.1s ease-in-out infinite; }
@keyframes thAlarm { 50% { box-shadow: inset 0 0 40px rgba(255, 45, 45, .12); } }
@media (max-width: 980px) { .mon-nums { grid-template-columns: repeat(5, minmax(0, 1fr)); } .mon-nums small { display: none; } }

/* «تعلّم أولًا» وشاشة البداية (الجولة الرابعة) */
.th-learn { margin: 0 0 12px; border-radius: 14px; background: linear-gradient(160deg, rgba(230, 200, 143, .1), rgba(230, 200, 143, .03)); box-shadow: inset 0 0 0 1px rgba(230, 200, 143, .28); }
.th-learn summary { display: flex; align-items: center; gap: 8px; padding: 11px 13px; cursor: pointer; font-weight: 700; color: #f0d9a8; font-size: 14.5px; list-style: none; }
.th-learn summary::-webkit-details-marker { display: none; }
.th-learn summary::after { content: ''; margin-inline-start: auto; width: 8px; height: 8px; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform .25s; opacity: .7; }
.th-learn[open] summary::after { transform: rotate(-135deg); }
.th-learn summary svg { width: 18px; height: 18px; flex: none; }
.th-learn p { margin: 0 13px 8px; line-height: 1.85; font-size: 14.5px; }
.th-learn ul { margin: 0 13px 12px; padding: 0 18px 0 0; display: grid; gap: 5px; font-size: 14px; line-height: 1.7; }
.th-learn li::marker { color: #e6c88f; }
.th-ready-row { display: grid; justify-items: start; gap: 6px; margin: 2px 0 12px; }
.th-ready-row small { color: #ffb3a8; font-size: 12.5px; }
.th-learnlist { list-style: none; margin: 0 0 6px; padding: 0; display: grid; gap: 6px; }
.th-learnlist li { display: flex; gap: 8px; align-items: flex-start; line-height: 1.7; font-size: 14.5px; }
.th-learnlist svg { width: 18px; height: 18px; flex: none; margin-top: 4px; color: #5be38a; }
.th-how { margin: 0 0 10px; padding: 0; list-style: none; counter-reset: how; display: grid; gap: 6px; }
.th-how li { counter-increment: how; display: grid; grid-template-columns: 28px minmax(0, 1fr); column-gap: 10px; align-items: start; padding: 9px 11px; border-radius: 12px; background: rgba(255, 255, 255, .04); }
.th-how li::before { content: counter(how, arabic-indic); grid-row: span 2; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--th-l); color: #04232a; font-weight: 700; font-size: 13px; }
.th-how b { font-size: 14.5px; } .th-how span { color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.th-guide { margin: 4px 0 12px; border-radius: 14px; box-shadow: inset 0 0 0 1px var(--line); }
.th-guide summary { padding: 11px 13px; cursor: pointer; font-weight: 700; }
.th-guide table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.th-guide th, .th-guide td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; text-align: start; }
.th-guide th { font: 700 13px ui-monospace, monospace; color: #4fd8ff; white-space: nowrap; }
.th-guide tr:nth-child(1) th { color: #3ef08a; } .th-guide tr:nth-child(4) th { color: #ffd54a; } .th-guide tr:nth-child(5) th { color: #ff9ec8; }
.th-guide td b { display: block; } .th-guide td span { color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.th-range { white-space: nowrap; color: var(--text); font-weight: 600; }
#th-act { scroll-margin-top: 250px; } @media (max-width: 980px) { #th-act { scroll-margin-top: 260px; } }
@media (max-width: 980px) { .th-console { grid-template-columns: minmax(0, 1fr) !important; } .th-panel, .th-stage, #th-cardbox, .th-card { min-width: 0; } .th-guide table { table-layout: fixed; } .th-guide th { width: 64px; } .th-range { width: 86px; white-space: normal; } }
