/* ==========================================================
   DS EVIL — قضية الفندق
   جو رعب سينمائي: أسود مزرق، دم قانٍ، ورق قديم وحبر، وأيقونات محفورة
   ========================================================== */
:root {
  --bg: #06070b;
  --panel: #0f1219;
  --panel-2: #151924;
  --line: #232838;
  --text: #d6d2c6;
  --muted: #868b9c;
  --blood: #b3242e;
  --blood-2: #d5333d;
  --blood-dark: #6d1219;
  --gold: #c8a860;
  --green: #4f9e6a;
  --font: 'Cairo', 'Segoe UI', Tahoma, sans-serif;
  --ink: 'Aref Ruqaa', 'Amiri', serif;
  --display: 'Rakkas', 'Aref Ruqaa', serif;
  --serif: 'Amiri', serif;
  --glass-bg: rgba(24, 25, 28, .5);
  --glass-bg-2: rgba(30, 31, 35, .48);
  --glass-border: rgba(255, 255, 255, .08);
  --glass-solid: #1a1b1e;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }
html { scrollbar-width: none; } /* فايرفوكس: يخفي شريط التمرير مع إبقاء التمرير فعّالاً */
html::-webkit-scrollbar { display: none; } /* كروم/إيدج/سفاري */
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::-webkit-scrollbar { display: none; }
button { font-family: inherit; cursor: pointer; }
input { font-family: inherit; }
::selection { background: var(--blood-dark); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: #0a0c12; }
::-webkit-scrollbar-thumb { background: #262c3a; border-radius: 6px; }
::-webkit-scrollbar-thumb:hover { background: #3a2226; }
.hidden { display: none !important; }

/* ---------- الأيقونات ---------- */
.icn { width: 1em; height: 1em; display: inline-block; vertical-align: -0.15em; flex-shrink: 0; }
.icn-lead { margin-inline-end: .55em; }
.icon-btn .icn { width: 20px; height: 20px; }

/* ---------- طبقة المطر (كانفس/فيديو) ---------- */
#rain-bg { position: fixed; inset: 0; z-index: 0; pointer-events: none; overflow: hidden; background: #05060a; }
#rain-canvas { position: absolute; inset: 0; }
#rain-video {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  opacity: .55; filter: brightness(.5) saturate(.7) contrast(1.1);
}
#app { position: relative; z-index: 1; }

/* ---------- مؤثرات الشاشة ---------- */
#fx-vignette {
  position: fixed; inset: 0; pointer-events: none; z-index: 90;
  background: radial-gradient(ellipse at 50% 42%, transparent 48%, rgba(0,0,0,.62) 100%);
  animation: breathe 9s ease-in-out infinite;
}
@keyframes breathe { 0%,100% { opacity: .92; } 50% { opacity: 1; } }
#fx-scanlines {
  position: fixed; inset: 0; pointer-events: none; z-index: 89; opacity: .5;
  background: repeating-linear-gradient(0deg, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.14) 2px 3px);
  mix-blend-mode: multiply;
}
#fx-flash { position: fixed; inset: 0; pointer-events: none; z-index: 91; background: #cfe0f4; opacity: 0; transition: opacity .1s; }
#fx-flash.on { opacity: .2; }
#fx-blackout { position: fixed; inset: 0; pointer-events: none; z-index: 92; background: #000; opacity: 0; transition: opacity .3s; }
#fx-blackout.on { opacity: .97; pointer-events: all; }

.screen { min-height: 100vh; display: flex; flex-direction: column; }

/* ---------- أزرار ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  padding: 15px 30px; border-radius: 9px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--text); min-height: 52px; min-width: 150px;
  font-size: 16px; font-weight: 700; letter-spacing: .2px;
  transition: transform .15s, box-shadow .2s, background .2s, border-color .2s;
}
.btn:hover { transform: translateY(-1px); border-color: #3a4258; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn .icn { width: 18px; height: 18px; }
.btn-blood {
  background: linear-gradient(160deg, #90222b, #58101a);
  border-color: #b23640; color: #f6e9e6;
  box-shadow: 0 4px 26px rgba(150, 25, 35, .4), inset 0 1px 0 rgba(255,255,255,.08);
}
.btn-blood:hover { box-shadow: 0 6px 36px rgba(190, 40, 50, .6); border-color: #d24a54; }
.btn-gold { background: linear-gradient(160deg, #8a713c, #5c4a24); border-color: #a98d52; color: #f6efdc; }
.btn-ghost { background: rgba(255,255,255,.03); }
.btn-discord {
  background: linear-gradient(160deg, #b12e36, #7f1d24); border-color: #d24a54; color: #f6e8c8;
  font-size: 17px; padding: 16px 34px; box-shadow: 0 6px 30px rgba(177, 46, 54, .35);
}
.icon-btn {
  width: 40px; height: 40px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted); display: inline-flex; align-items: center; justify-content: center; position: relative;
}
.icon-btn:hover { color: var(--text); border-color: #3a2226; }
.icon-btn.active-voice { color: var(--gold); border-color: #55471f; }
/* الأزرار الأيقونية بلا نص: صفّر هامش icn-lead المحقون كي تتوسّط الأيقونة تماماً */
.icon-btn .icn { margin: 0; vertical-align: middle; }
.icon-btn .unread { position: absolute; top: 6px; left: 6px; width: 9px; height: 9px; background: var(--blood); border-radius: 50%; }
.settings-overlay {
  position: fixed; inset: 0; z-index: 120; display: flex; align-items: center; justify-content: center;
  background: rgba(3, 4, 8, 0.82); backdrop-filter: blur(4px); padding: 20px;
}
.settings-panel {
  width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px;
  padding: 22px; box-shadow: 0 24px 70px rgba(0,0,0,.55);
}
.settings-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 18px; }
.settings-head h3 { font-size: 20px; margin-bottom: 4px; color: #f0e4cf; }
.settings-head p { color: var(--muted); font-size: 13px; line-height: 1.7; }
.setting-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.setting-row:last-child { border-bottom: 0; }
.setting-row > div { display: flex; flex-direction: column; gap: 4px; }
.setting-row span { font-weight: 700; color: var(--text); }
.setting-row small { color: var(--muted); font-size: 12px; }
.setting-row input[type="range"] { width: 140px; accent-color: var(--blood); }
.setting-row b { min-width: 46px; text-align: right; color: var(--gold); font-size: 13px; }

/* ---------- نص دموي (بلا قطرات) ---------- */
.bloody {
  position: relative; color: #cf3540; font-family: var(--display);
  text-shadow:
    0 0 4px rgba(179,36,46,.6), 0 0 22px rgba(179,36,46,.4),
    0 2px 2px #3a0508, 0 3px 4px #000;
}

/* ==========================================================
   شاشة الدخول — هوية DS EVIL
   ========================================================== */
#screen-landing { justify-content: center; align-items: center; position: relative; }
#screen-landing::before {
  content: ''; position: absolute; inset: 0;
  background: radial-gradient(ellipse 900px 500px at 50% 20%, rgba(20,27,46,.5) 0%, transparent 60%),
              radial-gradient(ellipse 700px 400px at 75% 110%, rgba(40,10,14,.6) 0%, transparent 55%),
              linear-gradient(180deg, rgba(6,7,12,.4), rgba(6,7,12,.82));
}
.landing-inner { position: relative; z-index: 2; text-align: center; padding: 30px 20px; max-width: 760px; }
.ds-evil {
  direction: ltr; display: flex; align-items: baseline; justify-content: center; gap: 16px;
  font-family: 'Cinzel', serif; font-weight: 800; font-size: clamp(34px, 7.8vw, 72px);
  letter-spacing: 4px; margin-bottom: 4px; line-height: 1;
}
.de-ds { color: #dcd6c8; text-shadow: 0 3px 14px #000, 0 0 24px rgba(180,180,190,.28); }
.de-evil { color: #c0272f; text-shadow: 0 0 12px rgba(179,36,46,.7), 0 0 34px rgba(179,36,46,.45), 0 3px 5px #000; animation: title-flicker 5s infinite; }
.landing-badge {
  display: inline-block; padding: 5px 18px; border: 1px solid var(--blood-dark);
  color: #c98a8f; border-radius: 3px; font-size: 12px; letter-spacing: 3px;
  background: rgba(90, 15, 20, .14); margin: 14px 0; transform: rotate(-1.2deg);
}
@keyframes title-flicker {
  0%, 100% { opacity: 1; } 91% { opacity: 1; } 92% { opacity: .5; }
  93% { opacity: 1; } 96% { opacity: .7; } 97% { opacity: 1; }
}
.landing-tagline { margin: 30px 0 8px; color: var(--muted); font-size: 18px; line-height: 1.9; font-family: var(--serif); }
.landing-facts { display: flex; justify-content: center; gap: 34px; list-style: none; margin: 24px 0 34px; color: var(--muted); font-size: 14px; }
.landing-facts b { color: var(--gold); font-size: 24px; display: block; text-align: center; font-family: var(--display); }
.landing-actions { display: flex; flex-direction: column; align-items: center; gap: 14px; }
.dev-login { display: flex; gap: 8px; }
.dev-login input { background: var(--panel); border: 1px solid var(--line); color: var(--text); padding: 10px 14px; border-radius: 8px; width: 220px; }
.landing-note { margin-top: 22px; color: #5b6070; font-size: 12.5px; }
.landing-footer {
  position: absolute; bottom: 18px; width: 100%; z-index: 2; text-align: center;
  color: #6a6f7e; font-size: 13px; display: flex; gap: 12px; justify-content: center; align-items: center;
}
.landing-footer .credit i { font-style: normal; color: #4a4f5e; font-size: 11px; letter-spacing: 1px; }
.landing-footer .credit b { color: #9a7d45; font-family: 'Cinzel', serif; letter-spacing: 1px; margin-inline-start: 5px; }
.landing-footer .sep { color: var(--blood-dark); }

/* ==========================================================
   اللوبي
   ========================================================== */
.topbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 26px; border-bottom: 1px solid var(--line);
  background: rgba(8, 10, 16, .85); backdrop-filter: blur(6px);
  position: sticky; top: 0; z-index: 10;
}
.brand { font-family: 'Cinzel', serif; font-weight: 800; letter-spacing: 2px; color: #d8d2c4; }
.brand b { color: #c0272f; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 5px 14px 5px 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 24px; font-size: 14px; font-weight: 700; }
.user-chip img { width: 28px; height: 28px; border-radius: 50%; background: #232836; object-fit: cover; }
.lobby-main { flex: 1; padding: 20px 30px 24px; max-width: 1440px; margin: 0 auto; width: 100%; }
.lobby-grid { display: grid; grid-template-columns: 1fr 300px; gap: 22px; align-items: start; }
@media (max-width: 980px) { .lobby-grid { grid-template-columns: 1fr; } }
.case-poster {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border); border-radius: 18px; overflow: hidden;
  display: grid; grid-template-columns: 300px 1fr;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 24px 70px rgba(0,0,0,.6);
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
}
@media (max-width: 760px) { .case-poster { grid-template-columns: 1fr; } }
.case-poster-art { min-height: 110px; position: relative; overflow: hidden; background: #0b0d13; }
.case-poster-art svg { width: 100%; height: 100%; position: absolute; inset: 0; transform: translateX(3%); }
.case-poster-body { padding: 10px 22px; display: flex; flex-direction: column; }
.case-chip { display: inline-block; font-size: 11.5px; letter-spacing: 2px; color: var(--gold); border: 1px solid #55471f; padding: 2px 10px; border-radius: 4px; margin-bottom: 3px; align-self: flex-start; }
.case-poster-body h2 { font-size: 30px; margin-bottom: 3px; font-family: var(--ink); letter-spacing: .3px; line-height: 1.1; }
.case-poster-body > p { color: var(--muted); line-height: 1.3; font-size: 14px; font-weight: 500; }
.case-meta { display: flex; gap: 18px; margin: 5px 0; color: #8890a0; font-size: 13px; flex-wrap: wrap; }
.case-meta span { display: inline-flex; align-items: center; }
.case-meta .icn { width: 14px; height: 14px; }
.mystats { order: 1; }
.lobby-section-label {
  order: 2; display: flex; align-items: center; gap: 12px; margin: 5px 0 3px;
  color: #6d7383; font-size: 11.5px; letter-spacing: 1.5px;
}
.lobby-section-label::before, .lobby-section-label::after { content: ''; flex: 1; height: 1px; background: var(--glass-border); }
.case-actions { order: 3; display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 3px; }
.case-actions .btn { min-height: 36px; padding: 7px 16px; font-size: 15px; }
.squad-actions {
  order: 4; display: flex; gap: 12px; flex-wrap: nowrap; align-items: center; overflow-x: auto;
  background: rgba(255,255,255,.02); border: 1px solid var(--glass-border); border-radius: 12px;
  padding: 5px 14px; margin-top: 1px;
}
.join-row { display: flex; gap: 8px; flex-shrink: 0; }
.join-row input { width: 170px; flex-shrink: 0; text-align: center; letter-spacing: 4px; text-transform: uppercase; background: var(--panel-2); border: 1px solid var(--line); color: var(--gold); padding: 6px; border-radius: 8px; font-weight: 700; font-size: 14px; }
.squad-actions .btn { min-width: auto; min-height: auto; white-space: nowrap; flex-shrink: 0; padding: 6px 14px; font-size: 14px; }
.mystats { color: #8890a0; font-size: 13px; line-height: 1.3; margin-top: 1px; }
.mystats b { color: var(--gold); }
.panel {
  background: var(--glass-bg-2); border: 1px solid var(--glass-border); border-radius: 18px; padding: 20px 22px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), 0 20px 60px rgba(0,0,0,.5);
  backdrop-filter: blur(22px) saturate(150%); -webkit-backdrop-filter: blur(22px) saturate(150%);
}
.lobby-side { display: flex; flex-direction: column; gap: 18px; }
.panel-title { font-size: 16px; margin-bottom: 12px; color: #d8d4c8; display: flex; align-items: center; }
.panel-title .icn { width: 18px; height: 18px; color: var(--gold); }
.leaderboard { display: flex; flex-direction: column; gap: 8px; max-height: 44vh; overflow-y: auto; padding-inline-end: 4px; }
.lb-row { display: flex; align-items: center; gap: 10px; padding: 10px 12px; background: rgba(255,255,255,.03); border: 1px solid transparent; border-radius: 10px; font-size: 13.5px; transition: background .15s, border-color .15s; }
.lb-row:hover { background: rgba(255,255,255,.06); border-color: var(--glass-border); }
.lb-row .lb-pos { width: 22px; color: var(--gold); font-weight: 900; text-align: center; font-family: var(--display); }
.lb-row img { width: 26px; height: 26px; border-radius: 50%; background: #232836; object-fit: cover; }
.lb-row .lb-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: flex; align-items: center; gap: 4px; }
.lb-row .lb-name .icn { width: 13px; height: 13px; color: var(--muted); }
.lb-row .lb-score { color: #cf3540; font-weight: 800; }
.lb-empty { color: #565b6b; font-size: 13.5px; text-align: center; padding: 14px 0; }
@media (max-height: 800px) {
  .lobby-main { padding: 14px 30px 18px; }
  .case-poster-art { min-height: 100px; }
  .case-poster-body { padding: 6px 20px; }
  .case-poster-body > p { line-height: 1.25; }
  .leaderboard { max-height: 32vh; }
}
.next-file { opacity: .78; }
.next-file-name { font-size: 20px; font-family: var(--ink); color: #a08b58; margin-bottom: 6px; }
.next-file-hint { color: #565b6b; font-size: 13px; font-style: italic; }

/* ==========================================================
   لوبي السكواد
   ========================================================== */
#screen-squadlobby { justify-content: center; align-items: center; padding: 18px 16px; }
.squadlobby-inner { width: 100%; max-width: 640px; text-align: center; border-radius: 14px; padding: 20px 26px; background: var(--panel); border: 1px solid var(--line); box-shadow: 0 20px 60px rgba(0,0,0,.55); }
.sq-title { font-size: 25px; }
.sq-sub { color: var(--muted); margin: 5px 0 14px; font-size: 14px; }
.sq-code-wrap { display: flex; align-items: center; justify-content: center; gap: 12px; margin-bottom: 16px; }
.sq-code { font-family: monospace; font-size: 32px; letter-spacing: 10px; padding: 7px 12px 7px 22px; color: var(--gold); background: var(--panel-2); border: 1px dashed #55471f; border-radius: 10px; }
.sq-code-wrap .btn { min-height: 40px; padding: 9px 16px; }
.sq-members { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin-bottom: 14px; }
.sq-member { display: flex; flex-direction: column; align-items: center; gap: 5px; width: 92px; padding: 9px 8px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; }
.sq-member img, .sq-member .noavatar { width: 40px; height: 40px; border-radius: 50%; background: #232836; object-fit: cover; }
.sq-member .noavatar { display: flex; align-items: center; justify-content: center; font-size: 18px; color: var(--muted); }
.sq-member span { font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); font-weight: 700; }
.sq-member .leader-tag { font-size: 10px; color: var(--gold); display: flex; align-items: center; gap: 3px; }
.sq-member .leader-tag .icn { width: 10px; height: 10px; }
.sq-member.offline { opacity: .4; }
.sq-chat { text-align: right; margin-bottom: 14px; background: var(--panel-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px; }
.chat-log { height: 130px; overflow-y: auto; display: flex; flex-direction: column; gap: 7px; padding: 4px; }
.chat-msg { font-size: 14px; line-height: 1.6; color: var(--text); }
.chat-msg b { color: var(--gold); font-weight: 700; }
.chat-msg.sys { color: var(--muted); font-style: italic; font-size: 13px; }
.chat-input-row { display: flex; gap: 8px; margin-top: 8px; }
.chat-input-row input { flex: 1; background: var(--panel-2); border: 1px solid var(--line); color: var(--text); padding: 10px 14px; border-radius: 8px; }
.sq-actions { display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 14px; flex-wrap: wrap; }
.sq-actions .btn { min-height: 42px; padding: 10px 20px; }
.sq-wait { color: var(--muted); font-size: 13.5px; }
@media (max-height: 760px) {
  #screen-squadlobby { padding: 10px 16px; }
  .squadlobby-inner { padding: 14px 22px; }
  .sq-title { font-size: 21px; }
  .sq-sub { margin: 4px 0 10px; }
  .sq-code { font-size: 26px; letter-spacing: 8px; padding: 6px 10px 6px 18px; }
  .sq-members, .sq-code-wrap { margin-bottom: 10px; }
  .sq-chat { margin-bottom: 10px; padding: 8px; }
  .chat-log { height: 90px; }
}

/* ==========================================================
   المقدمة
   ========================================================== */
#screen-intro { justify-content: center; align-items: center; }
.intro-inner { max-width: 780px; padding: 30px 22px; text-align: center; position: relative; z-index: 2; }
.intro-slide { min-height: 260px; display: flex; flex-direction: column; justify-content: center; gap: 22px; }
#intro-time { font-size: clamp(26px, 5vw, 42px); color: #cf3540; font-family: var(--display); text-shadow: 0 0 26px rgba(179, 36, 46, .45), 0 2px 4px #000; }
#intro-text { font-size: clamp(16px, 2.5vw, 21px); line-height: 2.3; color: #d4cfc0; min-height: 120px; font-family: var(--serif); }
#intro-text .cursor { border-left: 2px solid var(--gold); animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.intro-controls { display: flex; gap: 14px; justify-content: center; margin-top: 30px; }

/* ==========================================================
   شاشة اللعبة
   ========================================================== */
#screen-game { height: 100vh; overflow: hidden; }
#game-topbar { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 16px; background: rgba(9,11,17,.95); border-bottom: 1px solid var(--line); flex-wrap: wrap; z-index: 20; }
.gt-right { display: flex; align-items: center; gap: 14px; }
.gt-phase { color: var(--gold); font-size: 13.5px; font-weight: 700; }
.gt-timer { font-family: monospace; color: #6d7383; font-size: 14px; }
.gt-mid { display: flex; gap: 8px; flex-wrap: wrap; }
.gt-left { display: flex; gap: 8px; }
.tb-btn { display: inline-flex; align-items: center; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel-2); color: var(--text); font-size: 13.5px; font-weight: 700; transition: border-color .2s, background .2s; }
.tb-btn .icn { width: 16px; height: 16px; }
.tb-btn:hover { border-color: #3a2226; }
.tb-btn b { color: var(--gold); margin-inline-start: 5px; font-family: var(--display); }
.tb-accuse { background: linear-gradient(160deg, #90222b, #58101a); border-color: #b23640; animation: accuse-pulse 2s ease-in-out infinite; }
@keyframes accuse-pulse { 0%,100% { box-shadow: 0 0 0 rgba(179,36,46,0); } 50% { box-shadow: 0 0 22px rgba(179,36,46,.55); } }
#game-main { flex: 1; display: flex; min-height: 0; }
#scene-wrap { flex: 1; position: relative; overflow: hidden; background: #05060a; }
#scene-svg, #scene-svg svg, #scene-svg img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* طبقة توحيد نوارية فوق الصور الواقعية (تغميق + تحبّب) لتطابق جو الرسوم */
.scene-photo-fx {
  position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(ellipse at 50% 44%, transparent 46%, rgba(0,0,0,.55) 100%),
    linear-gradient(0deg, rgba(4,5,8,.35) 0%, transparent 30%);
  mix-blend-mode: multiply;
}
/* وميض إضاءة محيط رخيص جداً (تحريك opacity على طبقة واحدة — بديل حركات SVG المكلفة) */
#scene-fx {
  position: absolute; inset: 0; pointer-events: none; mix-blend-mode: soft-light;
  background: radial-gradient(ellipse at 50% 28%, rgba(255,232,180,.12), transparent 62%);
  animation: sceneFlicker 6s ease-in-out infinite; will-change: opacity;
}
@keyframes sceneFlicker { 0%,100% { opacity: .8; } 46% { opacity: 1; } 50% { opacity: .58; } 54% { opacity: .95; } 72% { opacity: .74; } }
#hotspots { position: absolute; inset: 0; }
.hotspot {
  position: absolute; transform: translate(-50%, -50%); width: 44px; height: 44px; border-radius: 50%;
  border: 2px solid rgba(200, 168, 96, .65); background: radial-gradient(circle, rgba(200,168,96,.18), transparent 70%);
  display: flex; align-items: center; justify-content: center; color: var(--gold);
  animation: hotspot-pulse 2.4s ease-in-out infinite; transition: transform .2s, border-color .2s; padding: 0;
}
.hotspot .icn { width: 18px; height: 18px; }
.hotspot:hover { transform: translate(-50%, -50%) scale(1.22); border-color: var(--gold); animation-play-state: paused; }
.hotspot.done { border-color: rgba(120, 130, 150, .4); color: #5b6070; background: none; animation: none; }
.hotspot .hs-label { position: absolute; top: 108%; right: 50%; transform: translateX(50%); white-space: nowrap; font-size: 12px; color: #cfc9b8; background: rgba(8, 10, 15, .85); padding: 3px 10px; border-radius: 4px; border: 1px solid var(--line); opacity: 0; pointer-events: none; transition: opacity .2s; }
.hotspot:hover .hs-label { opacity: 1; }
@keyframes hotspot-pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(200,168,96,.35); } 60% { box-shadow: 0 0 0 14px rgba(200,168,96,0); } }
#scene-caption { position: absolute; right: 0; left: 0; bottom: 0; padding: 44px 26px 16px; background: linear-gradient(0deg, rgba(4,5,8,.94) 20%, transparent); pointer-events: none; }
#room-name { font-size: 29px; color: #e6e1d2; text-shadow: 0 2px 12px #000; font-family: var(--ink); }
#room-desc { color: #9298a8; font-size: 15.5px; max-width: 780px; line-height: 1.8; margin-top: 6px; }
#scene-ticker {
  display: flex; align-items: center; gap: 7px; max-width: 760px;
  color: var(--gold); font-size: 12.5px; margin-top: 9px; height: 15px;
  opacity: 0; transform: translateY(4px); transition: opacity .35s ease, transform .35s ease;
}
#scene-ticker.show { opacity: 1; transform: translateY(0); }
#scene-ticker .icn { width: 14px; height: 14px; flex-shrink: 0; }
#suspect-row { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 3vw; padding: 0 4vw 90px; flex-wrap: wrap; }
.suspect-card { width: clamp(110px, 13vw, 176px); background: rgba(10, 12, 18, .55); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; transition: transform .25s, border-color .25s, box-shadow .25s; backdrop-filter: blur(2px); padding: 0; text-align: center; }
.suspect-card:hover { transform: translateY(-8px); border-color: #7d2830; box-shadow: 0 14px 40px rgba(140, 25, 35, .4); }
.suspect-card .face { width: 100%; }
.suspect-card .sc-name { padding: 8px 6px 2px; font-weight: 800; font-size: 14.5px; color: #e2ddd0; }
.suspect-card .sc-role { padding: 0 6px 10px; font-size: 11px; color: #79808f; }

/* وجوه الشخصيات (صورة واقعية أو بورتريه) */
.face { position: relative; overflow: hidden; border-radius: 10px; background: #0b0d13; aspect-ratio: 6 / 7; }
.face svg, .face .face-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.face .face-fx { position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(180deg, transparent 55%, rgba(6,7,12,.55) 100%),
             repeating-linear-gradient(0deg, rgba(0,0,0,0) 0 2px, rgba(0,0,0,.12) 2px 3px);
  mix-blend-mode: multiply; }

#squad-panel { width: 280px; border-right: 1px solid var(--line); background: #0b0d13; display: flex; flex-direction: column; padding: 12px; }
.sp-head { font-size: 13px; color: var(--gold); font-weight: 800; margin-bottom: 8px; }
.sp-members { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sp-members img, .sp-members .noavatar { width: 30px; height: 30px; border-radius: 50%; background: #232836; border: 2px solid transparent; object-fit: cover; }
.sp-members .online { border-color: var(--green); }
.sp-members .noavatar { display: inline-flex; align-items: center; justify-content: center; font-size: 13px; color: var(--muted); }
#sp-chat-log { flex: 1; }
#sp-chat-log .chat-msg { color: var(--text); font-family: var(--font); }
#sp-chat-log .chat-msg b { color: var(--gold); }
#sp-chat-log .chat-msg.sys { color: var(--muted); }
#squad-panel .chat-input-row input { background: var(--panel-2); border-color: var(--line); color: var(--text); }

#banner { position: fixed; top: 18%; right: 50%; transform: translateX(50%); background: rgba(8, 10, 15, .95); border: 1px solid #55471f; border-radius: 12px; padding: 18px 42px; z-index: 60; text-align: center; box-shadow: 0 20px 70px rgba(0,0,0,.75); animation: banner-in .5s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes banner-in { from { opacity: 0; transform: translateX(50%) scale(.8); } }
#banner .b-kicker { color: var(--gold); font-size: 12px; letter-spacing: 3px; margin-bottom: 6px; }
#banner .b-title { font-size: 24px; font-weight: 700; font-family: var(--ink); display: flex; align-items: center; justify-content: center; gap: 8px; }
#banner .b-title .icn { width: 22px; height: 22px; }
#banner .b-sub { color: var(--muted); font-size: 13px; margin-top: 6px; }
#banner.blood { border-color: #7d2830; }
#banner.blood .b-kicker { color: #cf3540; }

/* ==========================================================
   النوافذ المنبثقة — ورق أبيض قديم بحواف بنية غامقة محروقة
   ========================================================== */
.modal-overlay { position: fixed; inset: 0; background: rgba(3, 4, 7, .84); z-index: 100; display: flex; align-items: center; justify-content: center; padding: 20px; animation: fade-in .25s ease; backdrop-filter: blur(3px); }
@keyframes fade-in { from { opacity: 0; } }
/* الإطار الخارجي ثابت لا يتحرك مع التمرير — الخلفية والحواف المحروقة تُرسم مرة واحدة فقط
   وتبقى بلا إعادة رسم أثناء السكرول، بينما التمرير الفعلي يحدث داخل .modal-scroll وحدها
   (كانت الخلفية الثقيلة + الظلال الداخلية على نفس عنصر overflow-y سبب البطء عند التمرير) */
.modal {
  display: flex; flex-direction: column;
  background-color: #fbf6ea;
  background-image:
    radial-gradient(ellipse at 20% 15%, rgba(255,255,255,.5), transparent 45%),
    radial-gradient(ellipse at 85% 90%, rgba(120,90,50,.08), transparent 55%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2'/%3E%3CfeColorMatrix type='matrix' values='0 0 0 0 0.35 0 0 0 0 0.28 0 0 0 0 0.16 0 0 0 0.05 0'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  border: 3px solid #4a3018; border-radius: 10px;
  width: 100%; max-width: 660px; max-height: 88vh; position: relative; overflow: hidden;
  box-shadow:
    inset 0 0 3px rgba(74,48,24,.5),
    inset 0 0 46px 10px rgba(74,48,24,.45),
    inset 0 0 100px rgba(50,32,14,.3),
    0 30px 90px rgba(0,0,0,.8);
  animation: modal-in .3s cubic-bezier(.2, 1.2, .4, 1);
  color: #2b2015;
}
.modal-scroll { flex: 1; min-height: 0; overflow-y: auto; padding: 26px; }
.modal-scroll::-webkit-scrollbar-track { background: rgba(74,48,24,.08); }
.modal-scroll::-webkit-scrollbar-thumb { background: #8a6a3a; }
.modal-scroll::-webkit-scrollbar-thumb:hover { background: #6d1219; }
@keyframes modal-in { from { opacity: 0; transform: translateY(24px) scale(.96); } }
.modal.wide { max-width: 920px; }
.modal-close { position: absolute; top: 14px; left: 14px; width: 34px; height: 34px; border-radius: 8px; border: 1px solid #7c6339; background: rgba(74,48,24,.1); color: #5a3d1e; display: inline-flex; align-items: center; justify-content: center; z-index: 2; }
.modal-close:hover { color: #6d1219; border-color: #6d1219; }
.modal-close .icn { width: 16px; height: 16px; margin: 0; vertical-align: middle; }
.modal h3 { font-size: 21px; margin-bottom: 4px; padding-left: 40px; font-family: var(--ink); color: #3a2510; }
.modal .m-kicker { color: #7a2b22; font-size: 12px; letter-spacing: 2.5px; margin-bottom: 8px; font-weight: 700; }
.modal h3.d-board-title { font-size: 26px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.d-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(120,20,26,.08); border: 1px solid #a5564a; color: #6d1219;
  font-size: 13px; font-weight: 800; padding: 4px 12px; border-radius: 20px;
  font-family: var(--font); flex-shrink: 0;
}
.modal .m-body, .modal p, .modal li { color: #4a3826; line-height: 2; font-size: 15px; margin-top: 12px; }
.modal .m-actions { display: flex; gap: 10px; margin-top: 22px; flex-wrap: wrap; }
.modal .btn-ghost { background: rgba(74,48,24,.08); border-color: #8a6a3a; color: #3a2510; }
.modal .btn-ghost:hover { border-color: #6d1219; }

.evidence-pop { text-align: center; }
.evidence-pop .ev-icon { margin: 10px auto; color: #6d1219; }
.evidence-pop .ev-icon .icn { width: 54px; height: 54px; filter: drop-shadow(0 4px 12px rgba(109,18,25,.3)); }
.evidence-pop .ev-cat { color: #7a6038; font-size: 12px; }

/* الاستجواب */
.interro { display: grid; grid-template-columns: 210px 1fr; gap: 20px; }
@media (max-width: 640px) { .interro { grid-template-columns: 1fr; } .interro-side { display: flex; gap: 14px; align-items: center; } .interro-side .face { width: 120px; } }
.interro-side .face { border: 1px solid #8a6a3a; border-radius: 12px; }
.interro-side .i-name { font-weight: 900; font-size: 17px; margin-top: 10px; font-family: var(--ink); color: #3a2510; }
.interro-side .i-role { color: #7a6038; font-size: 12px; }
.interro-claim { background: rgba(120, 20, 26, .06); border: 1px dashed #a5564a; border-radius: 10px; padding: 12px 16px; font-size: 13.5px; color: #4a2418; line-height: 1.9; margin-bottom: 14px; }
.interro-claim b { color: #6d1219; }
.topic-btn { display: flex; align-items: center; gap: 8px; width: 100%; text-align: right; padding: 11px 16px; margin-bottom: 8px; background: rgba(74,48,24,.05); border: 1px solid #8a6a3a; border-radius: 10px; color: #3a2510; font-size: 14px; transition: border-color .2s, transform .15s; }
.topic-btn:hover { border-color: #6d1219; transform: translateX(-3px); }
.topic-btn.asked { color: #7a6038; }
.topic-btn.present { border-color: #a5564a; color: #6d1219; }
.topic-btn .icn { width: 16px; height: 16px; }
.dialog-answer { background: rgba(255,255,255,.55); border-right: 3px solid #8a6a3a; border-radius: 8px; padding: 14px 18px; margin: 12px 0; line-height: 2.1; font-size: 14.5px; color: #33230f; animation: fade-in .4s ease; position: relative; }
.dialog-answer.reaction { border-right-color: #a5564a; }
.dialog-answer .voice-btn { position: absolute; top: 8px; left: 8px; width: 28px; height: 28px; border-radius: 6px; border: 1px solid #8a6a3a; background: rgba(255,255,255,.5); color: #6d1219; display: inline-flex; align-items: center; justify-content: center; }
.dialog-answer .voice-btn .icn { width: 15px; height: 15px; }

/* دفتر التحقيق */
.notebook-tabs { display: flex; gap: 6px; margin-bottom: 18px; flex-wrap: wrap; }
.nb-tab { display: inline-flex; align-items: center; gap: 5px; padding: 8px 16px; border-radius: 8px 8px 0 0; border: 1px solid #8a6a3a; border-bottom: none; background: transparent; color: #7a6038; font-size: 13.5px; font-weight: 700; }
.nb-tab.active { background: rgba(255,255,255,.5); color: #6d1219; border-color: #6d1219; }
.nb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.nb-item { background: rgba(74,48,24,.05); border: 1px solid #8a6a3a; border-radius: 10px; padding: 12px; text-align: right; color: #3a2510; transition: border-color .2s, transform .15s; }
.nb-item:hover { border-color: #6d1219; transform: translateY(-2px); }
.nb-item .nb-icon { color: #6d1219; }
.nb-item .nb-icon .icn { width: 24px; height: 24px; }
.nb-item .nb-name { font-size: 13.5px; font-weight: 800; margin: 6px 0 3px; font-family: var(--ink); }
.nb-item .nb-short { font-size: 11.5px; color: #6a4f2a; line-height: 1.6; }
.nb-empty { color: #7a6038; text-align: center; padding: 30px 0; grid-column: 1 / -1; }
.nb-suspect { display: flex; gap: 12px; align-items: flex-start; text-align: right; }
.nb-suspect .face { width: 80px; flex-shrink: 0; border: 1px solid #8a6a3a; }
.nb-sus-claim { font-size: 12px; color: #6a4f2a; margin-top: 5px; line-height: 1.7; font-style: italic; }

/* لوحة الاستنتاجات */
.deduction-card { background: rgba(74,48,24,.05); border: 1px solid #8a6a3a; border-radius: 12px; padding: 16px 18px; margin-bottom: 12px; }
.deduction-card.locked { opacity: .55; }
.deduction-card.solved { border-color: #4a7a4a; background: rgba(70,130,70,.06); }
.deduction-card h4 { font-size: 16px; margin-bottom: 6px; display: flex; align-items: center; gap: 8px; font-family: var(--ink); color: #3a2510; }
.deduction-card h4 .icn { width: 18px; height: 18px; }
.deduction-card h4 .d-status { font-size: 12px; margin-inline-start: auto; color: #7a6038; }
.deduction-card .d-q { color: #4a3218; font-size: 13.5px; line-height: 1.9; }
.deduction-card .d-req { color: #7a6038; font-size: 12px; margin-top: 8px; display: flex; align-items: center; gap: 6px; }
.deduction-card .d-req .icn { width: 14px; height: 14px; }
.d-options { margin-top: 12px; display: flex; flex-direction: column; gap: 8px; }
.d-opt { text-align: right; padding: 11px 16px; border-radius: 10px; background: rgba(255,255,255,.5); border: 1px solid #8a6a3a; color: #33230f; font-size: 13.5px; line-height: 1.7; transition: border-color .2s; }
.d-opt:hover { border-color: #6d1219; }
.d-reveal { background: rgba(60,120,60,.1); border: 1px solid #4a7a4a; border-radius: 10px; padding: 12px 16px; margin-top: 12px; font-size: 13.5px; line-height: 1.9; color: #2f4a24; }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(6px); } 75% { transform: translateX(-6px); } }
.shake { animation: shake .3s ease 2; }

/* خريطة الطابق */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.map-room { padding: 16px; border-radius: 12px; border: 1px solid #8a6a3a; background: rgba(74,48,24,.05); text-align: right; color: #3a2510; transition: border-color .2s, transform .15s; position: relative; }
.map-room:hover:not(.locked) { border-color: #6d1219; transform: translateY(-2px); }
.map-room.current { border-color: #a5564a; }
.map-room.locked { opacity: .5; }
.map-room .mr-name { font-weight: 800; font-size: 14.5px; font-family: var(--ink); }
.map-room .mr-info { font-size: 11.5px; color: #6a4f2a; margin-top: 4px; }
.map-room .mr-lock { position: absolute; top: 10px; left: 12px; color: #6d1219; }
.map-room .mr-lock .icn { width: 15px; height: 15px; }

/* الاتهام */
.accuse-step-title { text-align: center; color: #7a2b22; font-size: 14px; margin-bottom: 18px; }
.accuse-suspects { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.accuse-sus { background: rgba(74,48,24,.05); border: 2px solid #8a6a3a; border-radius: 12px; overflow: hidden; padding: 0; transition: border-color .2s, transform .2s; text-align: center; }
.accuse-sus:hover { transform: translateY(-4px); }
.accuse-sus.selected { border-color: var(--blood); box-shadow: 0 0 26px rgba(179,36,46,.35); }
.accuse-sus .face { border-radius: 0; }
.accuse-sus .as-name { padding: 10px; font-weight: 800; font-size: 14px; font-family: var(--ink); color: #3a2510; }
.pillar { background: rgba(74,48,24,.05); border: 1px solid #8a6a3a; border-radius: 12px; padding: 14px 16px; margin-bottom: 12px; }
.pillar h4 { font-size: 14.5px; color: #6d1219; margin-bottom: 10px; font-family: var(--ink); }
.pillar-pick { display: flex; align-items: center; gap: 8px; width: 100%; text-align: right; padding: 11px 14px; border-radius: 8px; background: rgba(255,255,255,.4); border: 1px dashed #8a6a3a; color: #7a6038; font-size: 13.5px; }
.pillar-pick.filled { border-style: solid; border-color: #a5564a; color: #33230f; }
.pillar-pick .icn { width: 16px; height: 16px; }
.ev-pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-top: 10px; }
.ev-pick { display: flex; align-items: flex-start; gap: 6px; background: rgba(255,255,255,.4); border: 1px solid #8a6a3a; border-radius: 8px; padding: 10px; text-align: right; color: #33230f; font-size: 12.5px; transition: border-color .2s; }
.ev-pick:hover { border-color: #6d1219; }
.ev-pick .icn { width: 16px; height: 16px; color: #6d1219; margin-top: 2px; }
.vote-box { text-align: center; }
.vote-timer { font-family: monospace; font-size: 26px; color: #6d1219; margin: 10px 0; }

/* ==========================================================
   شاشة النهاية
   ========================================================== */
#screen-ending { justify-content: center; align-items: center; padding: 30px 16px; }
.ending-inner { max-width: 800px; width: 100%; text-align: center; position: relative; z-index: 2; }
.ending-slide h2 { font-size: clamp(26px, 5vw, 42px); font-family: var(--display); color: #cf3540; text-shadow: 0 0 30px rgba(179,36,46,.45), 0 2px 4px #000; margin-bottom: 22px; }
.ending-slide p { font-size: clamp(15px, 2.3vw, 19px); line-height: 2.4; color: #d4cfc0; font-family: var(--serif); }
.ending-controls { margin-top: 34px; display: flex; gap: 12px; justify-content: center; }
.teaser-text { font-family: var(--ink) !important; font-style: italic; color: #b08a4a !important; }
.score-card { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 30px; margin-top: 10px; text-align: center; }
.score-rank { font-size: 15px; letter-spacing: 3px; color: var(--gold); font-family: var(--ink); }
.score-value { font-size: clamp(48px, 9vw, 80px); font-weight: 400; color: #e6e1d2; margin: 8px 0; font-family: var(--display); }
.score-value.fail { color: #cf3540; }
.score-rows { display: flex; flex-direction: column; gap: 7px; max-width: 440px; margin: 18px auto 0; }
.score-row { display: flex; justify-content: space-between; font-size: 13.5px; color: var(--muted); border-bottom: 1px dashed #1d2230; padding-bottom: 6px; }
.score-row b { color: var(--text); }
.score-row.bad b { color: #cf3540; }

/* ---------- توست ---------- */
#toasts { position: fixed; bottom: 24px; right: 24px; z-index: 200; display: flex; flex-direction: column; gap: 10px; }
.toast { background: rgba(13, 16, 23, .97); border: 1px solid var(--line); border-radius: 10px; padding: 12px 20px; font-size: 13.5px; box-shadow: 0 10px 40px rgba(0,0,0,.6); animation: toast-in .3s ease; max-width: 340px; line-height: 1.7; }
.toast.gold { border-color: #55471f; }
.toast.blood { border-color: #7d2830; }
.toast .icn { width: 14px; height: 14px; vertical-align: -.15em; }
@keyframes toast-in { from { opacity: 0; transform: translateY(14px); } }

/* ---------- تجاوب ---------- */
@media (max-width: 860px) {
  #squad-panel { position: fixed; top: 0; bottom: 0; right: 0; z-index: 80; width: min(300px, 85vw); box-shadow: -10px 0 50px rgba(0,0,0,.6); }
  .gt-mid { order: 3; width: 100%; justify-content: center; }
  #suspect-row { gap: 10px; padding-bottom: 110px; overflow-y: auto; align-content: center; }
  .hotspot { width: 40px; height: 40px; }
  .hotspot .hs-label { opacity: 1; font-size: 10.5px; }
}
