:root {
  --ink: #0d0e10;
  --ink-2: #15171b;
  --ink-3: #1d2026;
  --line: #2b2f37;
  --line-2: #3a3f49;
  --fog: #8d93a0;
  --smoke: #b9bec8;
  --paper: #e9e3d3;
  --paper-2: #d9d1bb;
  --paper-ink: #25211a;
  --blood: #c0392b;
  --blood-2: #8e2a20;
  --amber: #e0a943;
  --neon: #4fb3bf;
  --ok: #6fae72;
  --radius: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .45);
  --f-body: "Tajawal", system-ui, "Segoe UI", Tahoma, sans-serif;
  --f-head: "Cairo", "Tajawal", sans-serif;
  --f-quote: "Noto Naskh Arabic", "Tajawal", serif;
  --f-type: "Special Elite", "Courier New", monospace;
  --bar-h: 64px;
  --title: #e9e3d3;
  --primary: #e9e3d3;
  --primary-ink: #25211a;
  --page-bg: radial-gradient(1200px 700px at 80% -10%, #1b2230 0%, #0d0e10 55%) fixed, #0d0e10;
  --bar-bg: rgba(13, 14, 16, .94);
  --card-grad: linear-gradient(180deg, #181b21, #121418);
  --mine-bg: #2a2418;
  --mine-line: #5a4a26;
  --tl-text: #e9e3d3;
  --tl-grid: #2e333c;
  --tl-grid-2: #22262d;
}

:root[data-theme="light"] {
  --ink: #efebe2;
  --ink-2: #ffffff;
  --ink-3: #f5f1e8;
  --line: #e0d8c9;
  --line-2: #cbc1ae;
  --fog: #6d675c;
  --smoke: #37332c;
  --title: #1c1914;
  --paper: #f7f0de;
  --paper-2: #ece2c6;
  --amber: #9a6a12;
  --neon: #17737e;
  --ok: #3b7a3f;
  --blood: #b3261e;
  --blood-2: #9c2a20;
  --primary: #1c1914;
  --primary-ink: #fbf8f0;
  --page-bg: #efebe2;
  --bar-bg: rgba(250, 247, 240, .95);
  --card-grad: linear-gradient(180deg, #ffffff, #faf7f0);
  --mine-bg: #fbf0d6;
  --mine-line: #e2c98c;
  --shadow: 0 6px 20px rgba(60, 50, 30, .12);
  --tl-text: #1c1914;
  --tl-grid: #d9d1c1;
  --tl-grid-2: #ebe5d8;
}
:root[data-theme="light"] #rain { display: none; }
:root[data-theme="light"] .logo { border-color: transparent; box-shadow: 0 2px 8px rgba(60, 50, 30, .25); }
:root[data-theme="light"] .file::before { opacity: .65; }


* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--page-bg);
  color: var(--smoke);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.7;
  overflow-x: hidden;
}
#rain {
  position: fixed; inset: 0; pointer-events: none; z-index: 0; opacity: .12;
  background-image: repeating-linear-gradient(105deg, transparent 0 22px, rgba(180, 200, 230, .35) 22px 23px);
  animation: rain 1.4s linear infinite;
}
@keyframes rain { from { background-position: 0 0; } to { background-position: -120px 400px; } }
@media (prefers-reduced-motion: reduce) { #rain { animation: none; } }

.screen { position: relative; z-index: 1; }
[hidden] { display: none !important; }
h1, h2, h3 { font-family: var(--f-head); color: var(--title); margin: 0 0 .5em; font-weight: 700; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
a { color: var(--neon); }
.hint { color: var(--fog); font-size: .88rem; margin: .3em 0 .8em; }
.mono { font-family: var(--f-type); letter-spacing: .02em; }

/* ------------------------------------------------------------ buttons */
.btn {
  font: inherit; cursor: pointer; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--title);
  padding: .55em 1.1em; border-radius: 8px; transition: background .15s, border-color .15s, transform .05s;
}
.btn:hover { border-color: var(--smoke); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: var(--primary); color: var(--primary-ink); border-color: var(--primary); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--blood-2); border-color: var(--blood); }
.btn.danger:hover { background: var(--blood); }
.btn.small { padding: .25em .7em; font-size: .85rem; }
.btn.big { padding: .8em 1.6em; font-size: 1.05rem; width: 100%; margin-top: .6em; }
.btn.ghost { background: transparent; }
.icon-btn { font: inherit; background: none; border: 1px solid var(--line-2); color: var(--smoke); width: 36px; height: 36px; border-radius: 50%; cursor: pointer; }
.icon-btn:hover { color: var(--title); border-color: var(--smoke); }
.chip-btn { font: inherit; font-size: .8rem; background: var(--ink-3); color: var(--amber); border: 1px dashed var(--amber); border-radius: 999px; padding: .2em .8em; cursor: pointer; }

input, textarea, select {
  font: inherit; color: var(--title); background: var(--ink); border: 1px solid var(--line-2);
  border-radius: 8px; padding: .55em .8em; width: 100%;
}
input:focus, textarea:focus, select:focus { outline: 2px solid var(--amber); outline-offset: 1px; }
.field { display: block; margin-bottom: .8em; }
.field > span { display: block; font-size: .82rem; color: var(--fog); margin-bottom: .25em; }

/* ------------------------------------------------------------ app shell */
.appbar {
  position: sticky; top: 0; z-index: 6; display: flex; justify-content: space-between; align-items: center;
  padding: 10px 20px; background: var(--bar-bg); border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.logo { display: block; width: 44px; height: 44px; border-radius: 10px; object-fit: cover; border: 1px solid var(--line-2);
  box-shadow: 0 0 14px rgba(192, 57, 43, .25); }
.appbar-end { display: flex; gap: 10px; align-items: center; }
.online-pill { display: inline-flex; align-items: center; gap: 6px; font-size: .85rem; color: var(--smoke); border: 1px solid var(--line-2); border-radius: 999px; padding: .2em .8em; }
.online-pill i { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }
.me-chip { font: inherit; font-weight: 600; color: var(--title); background: var(--ink-3); border: 1px solid var(--line-2); border-radius: 999px; padding: .25em 1em; cursor: pointer; }
.page { max-width: 1120px; margin: 0 auto; padding: 24px 16px calc(var(--bar-h) + 40px); }
.welcome { margin: 8px 0 22px; }
.welcome h1 { font-size: clamp(1.6rem, 3.4vw, 2.2rem); margin-bottom: .2em; }
.welcome p { color: var(--fog); margin: 0; max-width: 60ch; font-size: 1.02rem; }
.actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.action {
  display: flex; flex-direction: column; gap: 12px; background: var(--card-grad);
  border: 1px solid var(--line); border-radius: 14px; padding: 20px; box-shadow: var(--shadow);
}
.action.accent { border-color: rgba(79, 179, 191, .45); }
.action-head { display: flex; gap: 12px; align-items: flex-start; }
.action-head h2 { margin: 0; font-size: 1.3rem; }
.action-head p { margin: 2px 0 0; color: var(--fog); font-size: .92rem; }
.action .big { margin-top: auto; }
.ic { width: 40px; height: 40px; flex: none; color: var(--amber); padding: 8px; background: var(--ink); border: 1px solid var(--line-2); border-radius: 12px; }
.ic.sm { width: 22px; height: 22px; padding: 0; border: 0; background: none; vertical-align: middle; }
.accent .ic { color: var(--neon); }
.mode-pills { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pill {
  font: inherit; font-weight: 600; cursor: pointer; background: var(--ink); color: var(--smoke); border: 1px solid var(--line-2);
  border-radius: 10px; padding: .5em .3em; text-align: center; line-height: 1.3;
}
.pill small { display: block; font-weight: 400; color: var(--fog); font-size: .74rem; direction: ltr; }
.pill.active { border-color: var(--amber); color: var(--title); box-shadow: inset 0 0 0 1px var(--amber); }
.join-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; }
.online-mini { font-size: .9rem; color: var(--smoke); display: grid; gap: 4px; }
.online-mini b { color: var(--neon); }
.seed-box summary { cursor: pointer; color: var(--fog); font-size: .88rem; }
.seed-box input { margin-top: 6px; }
.block { margin-top: 28px; }
.block-head { display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.block-head h2 { margin: 0 0 .4em; font-size: 1.15rem; }
.guide-links { margin-top: 32px; padding-top: 14px; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; gap: 6px 20px; font-size: .92rem; }
.guide-links a { color: var(--fog); }
.guide-links a:hover { color: var(--title); }
.mode-info { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.mode-info div { background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.mode-info b { font-family: var(--f-head); color: var(--title); display: block; }
.mode-info span { color: var(--fog); font-size: .9rem; }
.mode-info .mono, .mode-card .mono { color: var(--amber); font-size: .78rem; direction: ltr; unicode-bidi: isolate; display: inline-block; }
.mode-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.mode-card {
  font: inherit; text-align: right; cursor: pointer; background: var(--ink-2); color: var(--smoke); border: 1px solid var(--line-2);
  border-radius: 14px; padding: 16px; transition: border-color .15s, transform .15s;
}
.mode-card:hover { transform: translateY(-2px); border-color: var(--smoke); }
.mode-card.active { border-color: var(--neon); box-shadow: inset 0 0 0 1px var(--neon); }
.mode-card b { font-family: var(--f-head); font-size: 1.15rem; color: var(--title); display: block; }
.mode-card .mono { color: var(--amber); font-size: .78rem; }
.mode-card p { margin: 6px 0 0; font-size: .88rem; color: var(--fog); }
.mode-card .waiting { margin-top: 8px; font-size: .82rem; color: var(--neon); }
.stats-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 16px; }
.stat-box { background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; padding: 14px; text-align: center; }
.stat-box b { display: block; font-family: var(--f-head); font-size: 1.8rem; color: var(--title); line-height: 1.2; }
.stat-box span { color: var(--fog); font-size: .85rem; }
.lb { width: 100%; border-collapse: collapse; background: var(--ink-2); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.lb th, .lb td { padding: 10px 14px; text-align: right; border-bottom: 1px solid var(--line); }
.lb th { color: var(--fog); font-weight: 500; font-size: .85rem; background: var(--ink-3); }
.lb tr.me td { background: rgba(224, 169, 67, .08); }
.lb .rank { font-family: var(--f-head); font-weight: 800; color: var(--title); width: 56px; }
.lb tr:nth-child(2) .rank { color: #f0c75e; } .lb tr:nth-child(3) .rank { color: #c9ced6; } .lb tr:nth-child(4) .rank { color: #d08b53; }
.profile-head { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.profile-head .avatar { width: 64px; height: 64px; font-size: 1.6rem; }
.name-edit { display: grid; grid-template-columns: 1fr auto; gap: 8px; max-width: 420px; }
.grade-badge { font-family: var(--f-type); color: var(--amber); }
.bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 8; height: var(--bar-h); display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--bar-bg); border-top: 1px solid var(--line); backdrop-filter: blur(8px);
}
.bottombar button {
  font: inherit; font-size: .82rem; font-weight: 600; background: none; border: 0; color: var(--fog); cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; position: relative;
}
.bottombar svg { width: 24px; height: 24px; }
.bottombar button.active { color: var(--title); }
.bottombar button.active::before { content: ""; position: absolute; top: 0; width: 40px; height: 3px; border-radius: 0 0 3px 3px; background: var(--amber); }
.bottombar button:hover { color: var(--smoke); }

/* room */
.room-wrap { max-width: 1120px; margin: 0 auto; padding: 24px 16px; display: grid; grid-template-columns: 360px minmax(0, 1fr); gap: 16px; }
.room-kind { font-family: var(--f-type); color: var(--amber); font-size: .85rem; letter-spacing: .08em; }
.room-code { display: flex; align-items: center; gap: 8px; margin: 8px 0 16px; flex-wrap: wrap; }
.room-code .code { font-family: var(--f-type); font-size: 1.9rem; letter-spacing: .25em; color: var(--title); background: var(--ink); border: 1px dashed var(--amber); border-radius: 10px; padding: .1em .6em; direction: ltr; }
.members { display: grid; gap: 8px; margin-bottom: 10px; }
.member { display: flex; align-items: center; gap: 10px; background: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.member .avatar { width: 34px; height: 34px; font-size: 1rem; }
.member .host { font-size: .72rem; color: var(--amber); border: 1px solid var(--amber); border-radius: 999px; padding: 0 .5em; margin-inline-start: auto; }
.room-chat { display: flex; flex-direction: column; height: calc(100vh - 140px); min-height: 420px; }
.chat-title { display: flex; align-items: center; gap: 8px; }
.chat-title h2 { margin: 0; }
.chat-msgs { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 10px 2px; }
.bubble { max-width: 80%; align-self: flex-start; background: var(--ink-3); border: 1px solid var(--line-2); border-radius: 12px 12px 12px 3px; padding: 6px 12px; }
.bubble.mine { align-self: flex-end; background: var(--mine-bg); border-color: var(--mine-line); border-radius: 12px 12px 3px 12px; }
.bubble .who { font-size: .75rem; color: var(--amber); font-weight: 700; }
.bubble .txt { color: var(--title); white-space: pre-wrap; word-break: break-word; }
.sys { align-self: center; font-size: .8rem; color: var(--fog); }
.chat-form { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; z-index: 15; width: min(400px, 100%); background: var(--ink-2); border-right: 1px solid var(--line-2);
  box-shadow: var(--shadow); padding: 16px; display: flex; flex-direction: column; gap: 8px; animation: drawer .2s ease-out;
}
@keyframes drawer { from { transform: translateX(-30px); opacity: 0; } }
.drawer-head { display: flex; justify-content: space-between; align-items: center; }
#btn-chat .badge { background: var(--blood); color: #fff; border-radius: 999px; font-size: .72rem; padding: 0 .5em; margin-inline-start: 4px; }
.gen-status {
  position: fixed; inset: 0; z-index: 25; display: flex; flex-direction: column; gap: 14px; align-items: center; justify-content: center;
  background: rgba(8, 9, 11, .88); text-align: center;
}
.gen-line { font-family: var(--f-type); color: var(--amber); font-size: .85rem; direction: ltr; text-align: right; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--amber); animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.recent { display: grid; gap: 8px; }
.recent-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; border-bottom: 1px solid var(--line); padding: 6px 0; }
.recent-item .r-title { color: var(--title); }
.tag { font-size: .72rem; padding: .1em .6em; border-radius: 999px; border: 1px solid var(--line-2); color: var(--fog); white-space: nowrap; }
.tag.quick { color: var(--ok); border-color: var(--ok); }
.tag.standard { color: var(--amber); border-color: var(--amber); }
.tag.detective { color: var(--blood); border-color: var(--blood); }
.tag.closed { color: var(--fog); }

/* ------------------------------------------------------------ game */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 10px 16px;
  background: var(--bar-bg); border-bottom: 1px solid var(--line); backdrop-filter: blur(6px);
}
.case-id { flex: 1; min-width: 0; }
.case-crime { font-family: var(--f-type); color: var(--blood); font-size: .8rem; letter-spacing: .08em; }
.topbar h1 { font-size: 1.25rem; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-stats { display: flex; gap: 14px; align-items: center; }
.stat { display: flex; flex-direction: column; align-items: center; line-height: 1.2; }
.stat-k { font-size: .7rem; color: var(--fog); }
.stat-v { font-family: var(--f-type); color: var(--title); font-size: 1rem; direction: ltr; }
.tb-actions { display: flex; gap: 8px; align-items: center; }

.layout { display: grid; grid-template-columns: 200px minmax(0, 1fr) 290px; gap: 16px; padding: 16px; max-width: 1600px; margin: 0 auto; }
.tabs { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 76px; align-self: start; }
.tab {
  font: inherit; text-align: right; cursor: pointer; background: transparent; color: var(--smoke);
  border: 1px solid transparent; border-radius: 8px; padding: .55em .8em; display: flex; justify-content: space-between; align-items: center;
}
.tab:hover { background: var(--ink-2); }
.tab.active { background: var(--ink-3); border-color: var(--line-2); color: var(--title); }
.tab .badge { font-family: var(--f-type); font-size: .72rem; background: var(--blood-2); color: #fff; border-radius: 999px; padding: 0 .5em; min-width: 1.4em; text-align: center; }
.tab .badge.soft { background: var(--ink); color: var(--fog); border: 1px solid var(--line-2); }
.view { min-width: 0; }
.feed { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); overflow: auto; background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.feed-item { font-size: .84rem; border-bottom: 1px dashed var(--line); padding: 6px 0; }
.feed-item time { font-family: var(--f-type); color: var(--fog); font-size: .72rem; margin-left: 6px; direction: ltr; display: inline-block; }
.feed-item.director { color: var(--amber); }
.feed-item.confession, .feed-item.verdict { color: var(--blood); font-weight: 600; }
.feed-item.secret, .feed-item.story { color: var(--neon); }

.section-head { display: flex; justify-content: space-between; align-items: end; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-head p { margin: 0; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); }
.card { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.card h3 { margin-bottom: .2em; }
.card .meta { font-size: .8rem; color: var(--fog); }
.card-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

/* briefing */
.file {
  background: linear-gradient(180deg, var(--paper), var(--paper-2)); color: var(--paper-ink); border-radius: 6px;
  padding: 26px 28px; box-shadow: var(--shadow); position: relative; font-family: var(--f-quote); font-size: 1.1rem;
}
.file::before { content: "سرّي"; position: absolute; top: 18px; left: 22px; font-family: var(--f-head); color: var(--blood); border: 3px solid var(--blood); padding: 0 12px; transform: rotate(-8deg); opacity: .8; font-size: 1.2rem; }
.file h2 { color: var(--paper-ink); font-size: 1.6rem; }
.file .stamp-line { font-family: var(--f-type); font-size: .85rem; color: #5b5242; direction: ltr; text-align: right; }
.file ul { padding-right: 1.2em; margin: .4em 0; }
.file .narr { font-style: italic; border-right: 3px solid var(--blood); padding-right: 12px; margin: 12px 0; }
.objectives { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.objectives span { font-family: var(--f-body); font-size: .8rem; background: var(--paper-ink); color: var(--paper); padding: .2em .8em; border-radius: 999px; }
.incidents { margin-top: 16px; display: grid; gap: 10px; }
.incident { border-right: 4px solid var(--blood); background: var(--ink-2); padding: 10px 14px; border-radius: 6px; }
.incident.linked { border-right-color: var(--amber); }

/* locations */
.loc-flags { display: flex; gap: 6px; margin: 6px 0; flex-wrap: wrap; }
.flag { font-size: .72rem; border: 1px solid var(--line-2); border-radius: 999px; padding: 0 .6em; color: var(--fog); }
.flag.cam { color: var(--neon); border-color: var(--neon); }
.flag.card { color: var(--amber); border-color: var(--amber); }
.flag.done { color: var(--ok); border-color: var(--ok); }
.flag.scene { color: #fff; background: var(--blood-2); border-color: var(--blood); }

/* people */
.person { display: flex; flex-direction: column; gap: 4px; cursor: pointer; transition: border-color .15s; }
.person:hover { border-color: var(--smoke); }
.person.dead { opacity: .55; cursor: default; }
.person .p-name { font-family: var(--f-head); color: var(--title); font-size: 1.1rem; }
.avatar { width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; font-family: var(--f-head); color: var(--ink); font-size: 1.2rem; flex: none; }
.p-row { display: flex; gap: 10px; align-items: center; }
.meters { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; font-size: .72rem; color: var(--fog); align-items: center; margin-top: 4px; }
.meter { height: 5px; background: var(--ink); border-radius: 3px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--amber); }
.meter.trust > i { background: var(--neon); }
.pillars { display: flex; gap: 4px; }
.pillar { font-size: .68rem; border: 1px solid var(--line-2); padding: 0 .5em; border-radius: 4px; color: var(--fog); }
.pillar.on { color: var(--blood); border-color: var(--blood); }

/* interrogation */
.interro { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 16px; }
.dossier { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; align-self: start; position: sticky; top: 76px; }
.dossier .rel { font-size: .82rem; color: var(--fog); }
.chat { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); display: flex; flex-direction: column; min-height: 520px; }
.chat-log { flex: 1; padding: 14px; overflow: auto; max-height: 60vh; display: flex; flex-direction: column; gap: 10px; }
.q { align-self: flex-start; background: var(--ink-3); border: 1px solid var(--line-2); color: var(--title); padding: 8px 12px; border-radius: 12px 12px 12px 2px; max-width: 80%; }
.a { align-self: flex-end; background: var(--paper); color: var(--paper-ink); padding: 10px 14px; border-radius: 12px 12px 2px 12px; max-width: 86%; font-family: var(--f-quote); font-size: 1.06rem; }
.a.nervous { box-shadow: inset 0 -3px 0 var(--amber); }
.a.angry, .a.hostile { box-shadow: inset 0 -3px 0 var(--blood); }
.a.broken { background: #f3d6d1; }
.a .a-meta { font-family: var(--f-body); font-size: .72rem; color: #6d6451; margin-top: 4px; display: flex; gap: 8px; flex-wrap: wrap; }
.event-pill { font-family: var(--f-body); font-size: .72rem; background: var(--blood-2); color: #fff; border-radius: 999px; padding: 0 .6em; }
.gave { font-family: var(--f-body); font-size: .75rem; color: #2d5d33; }
.chat-empty { color: var(--fog); text-align: center; margin: auto; font-family: var(--f-quote); font-size: 1.1rem; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; padding: 10px 14px 0; }
.chip { font: inherit; font-size: .8rem; cursor: pointer; background: var(--ink); border: 1px solid var(--line-2); color: var(--smoke); border-radius: 999px; padding: .2em .8em; }
.chip:hover { border-color: var(--amber); color: var(--title); }
.composer { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.present-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 0 14px 12px; }
.typing { align-self: flex-end; color: var(--fog); font-size: .85rem; }

/* evidence */
.ev-filters { display: flex; gap: 6px; flex-wrap: wrap; }
.evidence { background: var(--paper); color: var(--paper-ink); border-radius: 4px; padding: 14px; position: relative; box-shadow: 0 4px 14px rgba(0, 0, 0, .35); }
.evidence::after { content: ""; position: absolute; top: -7px; right: 22px; width: 14px; height: 14px; border-radius: 50%; background: var(--blood); box-shadow: 0 2px 3px rgba(0,0,0,.4); }
.evidence h3 { color: var(--paper-ink); font-family: var(--f-head); font-size: 1rem; margin: 0 0 .3em; }
.evidence .e-id { font-family: var(--f-type); font-size: .75rem; color: #7a6f59; }
.evidence .e-desc { font-family: var(--f-quote); font-size: 1.02rem; white-space: pre-line; }
.evidence .e-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; font-size: .72rem; }
.evidence .e-meta span { border: 1px solid #a89f88; border-radius: 999px; padding: 0 .6em; }
.evidence .rel-high { color: #2d5d33; border-color: #2d5d33 !important; }
.evidence .rel-medium { color: #8a6a1c; border-color: #8a6a1c !important; }
.evidence .rel-low { color: var(--blood-2); border-color: var(--blood-2) !important; }
.evidence .btn { background: var(--paper-ink); color: var(--paper); border-color: var(--paper-ink); }
.evidence.new { animation: glow 2.4s ease-out 1; }
@keyframes glow { 0% { box-shadow: 0 0 0 4px var(--amber); } 100% { box-shadow: 0 4px 14px rgba(0,0,0,.35); } }

/* requests */
.request { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.request .r-kind { font-family: var(--f-type); font-size: .75rem; color: var(--neon); }

/* contradictions */
.contra { border-right: 4px solid var(--amber); }
.contra .c-head { font-family: var(--f-type); color: var(--amber); font-size: .8rem; letter-spacing: .1em; }
.contra.high { border-right-color: var(--blood); }
.contra.high .c-head { color: var(--blood); }

/* timeline */
.tl-wrap { background: var(--ink-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; overflow-x: auto; direction: ltr; }
.tl-wrap .hint, .tl-wrap .empty { direction: rtl; }
.tl-legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: .8rem; color: var(--fog); margin-bottom: 8px; direction: rtl; }
.tabs::-webkit-scrollbar, .tl-wrap::-webkit-scrollbar { height: 6px; }
.tabs::-webkit-scrollbar-thumb, .tl-wrap::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 3px; }
.tabs::-webkit-scrollbar-track, .tl-wrap::-webkit-scrollbar-track { background: transparent; }
.tl-legend i { display: inline-block; width: 18px; height: 10px; border-radius: 2px; vertical-align: middle; margin-left: 4px; }
svg text { font-family: var(--f-body); }

/* theory */
.theory-person { border-top: 3px solid var(--line-2); }
.theory-person .links { display: grid; gap: 6px; margin-top: 8px; }
.theory-link { font-size: .85rem; background: var(--ink); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; display: flex; justify-content: space-between; gap: 8px; }
.mmo { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.mmo label { font-size: .8rem; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.mmo input { width: auto; }

/* notes & team */
.notes-area { min-height: 55vh; font-family: var(--f-quote); font-size: 1.05rem; line-height: 1.9; background: var(--paper); color: var(--paper-ink); border: none; }
.team-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.chatbox { display: flex; flex-direction: column; height: 60vh; }
.chat-msgs { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 6px; padding: 6px 0; }
.chat-msg { font-size: .9rem; }
.chat-msg b { color: var(--amber); font-weight: 500; }
.online { display: inline-block; width: 8px; height: 8px; background: var(--ok); border-radius: 50%; margin-left: 6px; }

/* modal & accusation */
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0, 0, 0, .72); display: grid; place-items: center; padding: 16px; }
.modal-card { position: relative; width: min(900px, 100%); max-height: 92vh; overflow: auto; background: var(--ink-2); border: 1px solid var(--line-2); border-radius: var(--radius); padding: 24px; box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 14px; left: 14px; }
.acc-incident { border: 1px solid var(--line-2); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.acc-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; }
.acc-ev { max-height: 200px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; }
.acc-ev label, .acc-acc label { display: flex; gap: 8px; align-items: baseline; font-size: .86rem; padding: 2px 0; cursor: pointer; }
.acc-ev input, .acc-acc input { width: auto; }
.verdict-grade { font-family: var(--f-type); font-size: 88px; line-height: 1; color: var(--title); text-align: center; }
.verdict-grade.bad { color: var(--blood); }
.part { display: flex; justify-content: space-between; border-bottom: 1px dashed var(--line); padding: 4px 0; font-size: .92rem; }
.part .ok { color: var(--ok); }
.part .no { color: var(--blood); }
.debrief { font-family: var(--f-quote); font-size: 1.05rem; background: var(--paper); color: var(--paper-ink); padding: 14px 18px; border-radius: 6px; }
.debrief p { margin: .4em 0; }

.toasts { position: fixed; bottom: 16px; left: 16px; z-index: 30; display: grid; gap: 8px; width: min(380px, calc(100% - 32px)); }
.toast { background: var(--ink-3); border: 1px solid var(--line-2); border-right: 4px solid var(--amber); padding: 10px 14px; border-radius: 8px; box-shadow: var(--shadow); animation: slide .25s ease-out; }
.toast.bad { border-right-color: var(--blood); }
.toast.good { border-right-color: var(--ok); }
@keyframes slide { from { transform: translateY(12px); opacity: 0; } }

.empty { color: var(--fog); text-align: center; padding: 30px; font-family: var(--f-quote); font-size: 1.1rem; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1200px) {
  .layout { grid-template-columns: 180px minmax(0, 1fr); }
  .feed { grid-column: 1 / -1; position: static; max-height: 260px; }
}
@media (max-width: 960px) {
  .actions, .mode-info, .mode-cards { grid-template-columns: 1fr; }
  .room-wrap { grid-template-columns: 1fr; }
  .room-chat { height: 60vh; }
}
@media (max-width: 860px) {
  .stats-row { grid-template-columns: 1fr 1fr 1fr; }
  .appbar { padding: 8px 12px; }
  .logo { width: 38px; height: 38px; }
  .lb th:nth-child(4), .lb td:nth-child(4), .lb th:nth-child(5), .lb td:nth-child(5) { display: none; }
  .topbar { flex-wrap: wrap; gap: 8px; }
  .tb-stats { order: 3; width: 100%; justify-content: space-between; }
  .layout { grid-template-columns: minmax(0, 1fr); padding: 10px; }
  .tabs { flex-direction: row; overflow-x: auto; position: sticky; top: 0; z-index: 4; background: var(--ink); padding: 6px 0; }
  .tab { white-space: nowrap; }
  .interro { grid-template-columns: 1fr; }
  .dossier { position: static; }
  .team-grid, .acc-grid { grid-template-columns: 1fr; }
  .q, .a { max-width: 95%; }
}

/* ------------------------------------------------------------ settings, toggles, tells */
.gear svg { width: 20px; height: 20px; }
.icon-btn.gear { display: inline-grid; place-items: center; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting b { color: var(--title); font-family: var(--f-head); }
.setting .hint { margin: 2px 0 0; max-width: 46ch; }
.seg { display: inline-flex; background: var(--ink); border: 1px solid var(--line-2); border-radius: 10px; padding: 3px; gap: 3px; flex: none; }
.seg button { font: inherit; font-weight: 600; background: none; border: 0; color: var(--fog); padding: .35em 1em; border-radius: 7px; cursor: pointer; }
.seg button.active { background: var(--primary); color: var(--primary-ink); }
.btn.toggle { display: inline-flex; align-items: center; gap: 6px; }
.btn.toggle.on { border-color: var(--neon); color: var(--neon); }
.tell { font-family: var(--f-body); font-style: italic; font-size: .82rem; color: #7a6f59; margin-bottom: 4px; }

/* English (left-to-right) interface; generated case content stays Arabic, right-to-left */
[dir="ltr"] .tab, [dir="ltr"] .mode-card, [dir="ltr"] .mode, [dir="ltr"] .lb th, [dir="ltr"] .lb td { text-align: left; }
[dir="ltr"] .tl-wrap .hint, [dir="ltr"] .tl-wrap .empty, [dir="ltr"] .tl-legend { direction: ltr; }
/* dialects are an Arabic-only feature */
:root[lang="en"] #btn-dialect, :root[lang="en"] #dialect-inline { display: none; }
.lang-btn { font-weight: 700; min-width: 2.6em; }
@media (max-width: 860px) { .setting { flex-direction: column; align-items: flex-start; } #btn-dialect span { display: none; } }

/* accounts & career */
.auth-form { display: grid; gap: 12px; margin: 14px 0; }
.auth-tabs { width: 100%; margin-top: 12px; }
.auth-tabs button { flex: 1; }
.auth-error { color: var(--danger, #e06a5f); font-size: .9rem; }
.profile-head #logout { margin-inline-start: auto; }
.career-title { color: var(--primary); font-weight: 700; }
.career-bar { height: 8px; border-radius: 4px; background: var(--line-2); overflow: hidden; margin-bottom: 8px; }
.career-bar i { display: block; height: 100%; background: var(--primary); border-radius: 4px; }
.save-career { border: 1px solid var(--primary); border-radius: 12px; padding: 14px 16px; }
