/* ================= غرفة الاستجواب بالتصميم الجديد ================= */
body.room-mode .top { display: none; }
body.room-mode main { padding-top: 0; }
body.room-mode .freej { display: none; }
.room { height: 100vh; height: 100dvh; display: grid; grid-template-rows: auto minmax(0, 1fr) auto; background: #07080a; font-family: var(--font); }
.room-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid rgba(255,255,255,.06); background: #0a0b0e; }
.rt-right, .rt-left { display: flex; align-items: center; gap: 10px; }
.rt-back { width: 38px; height: 38px; border-radius: 50%; border: 1px solid rgba(255,255,255,.16); display: grid; place-items: center; font-size: 1.15rem; flex: none; }
.rt-back:hover { border-color: #d9a441; color: #e7b357; }
.rt-title { margin: 0; font-size: 1.2rem; font-weight: 500; color: var(--paper-2); display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.rt-title b { color: var(--paper); font-weight: 800; }
.rt-dot { width: 9px; height: 9px; border-radius: 50%; background: #e04444; box-shadow: 0 0 10px #e04444; flex: none; animation: pulse 2s infinite; }
.rb { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px; font-weight: 700; font-size: .92rem; border: 1px solid transparent; background: transparent; color: var(--paper); white-space: nowrap; transition: filter .2s, transform .2s; }
.rb .icon { width: 17px; height: 17px; }
.rb:hover { filter: brightness(1.15); }
.rb:active { transform: scale(.97); }
.rb[disabled] { opacity: .45; pointer-events: none; }
.rb-red { background: #c8363c; color: #fff; box-shadow: 0 6px 18px -8px rgba(200,54,60,.8); }
.rb-amber { border-color: rgba(217,164,65,.6); color: #e7b357; background: rgba(217,164,65,.07); }
.rb-redline { border-color: rgba(200,54,60,.55); color: #e8767a; background: rgba(200,54,60,.07); }
.rb-ghost { border-color: rgba(217,164,65,.45); color: #e7b357; }
.rb-block { width: 100%; justify-content: center; }

.room-main { display: grid; grid-template-columns: 236px minmax(0, 1fr); min-height: 0; }
.room-side { border-inline-end: 1px solid rgba(255,255,255,.06); padding: 20px 16px; display: flex; flex-direction: column; gap: 12px; overflow-y: auto; background: #0a0b0e; }
.rs-photo { position: relative; width: 130px; margin: 8px auto 0; border-radius: 10px; overflow: hidden; border: 1px solid rgba(255,255,255,.1); box-shadow: 0 16px 30px -14px #000; }
.rs-photo .av { aspect-ratio: 5 / 6; }
.rs-lamp { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 50px; height: 4px; border-radius: 0 0 4px 4px; background: #f0c36b; box-shadow: 0 0 22px 8px rgba(240,195,107,.4); }
.rs-id { text-align: center; }
.rs-id h2 { margin: 4px 0 0; font-size: 1.4rem; font-weight: 800; }
.rs-id p { margin: 0; color: #e7b357; font-size: .9rem; font-weight: 600; }
.rs-quota { margin: 4px 0 0; font-size: .76rem; color: var(--muted); text-align: center; }
.rs-quota b { color: var(--paper); }
.mt-top { display: flex; justify-content: space-between; align-items: baseline; font-size: .88rem; font-weight: 700; margin-bottom: 5px; }
.mt-stress .mt-top b { color: #e7b357; }
.mt-pat .mt-top b { color: #86b4f0; }
.mt.hot .mt-top b, .mt.low .mt-top b { color: #ff6b5f; }
.mt-bar { height: 6px; border-radius: 6px; background: rgba(255,255,255,.08); overflow: hidden; }
.mt-bar i { display: block; height: 100%; width: var(--v, 0%); transition: width .9s cubic-bezier(.2,.7,.2,1); }
.mt-stress .mt-bar i, .mini i.st { background: linear-gradient(to left, #4fb3a9, #e7b357 55%, #d9453f); }
.mt-pat .mt-bar i, .mini i.pt { background: linear-gradient(to left, #8db8f2, #4c7fd0); }
.mt.low .mt-bar i { background: #d9453f; }
.rs-warn { margin: 0; text-align: center; color: #ff8f7d; font-size: .82rem; font-weight: 700; }
.rs-actions { display: grid; gap: 8px; margin-top: 6px; }
.rs-actions .tts { justify-content: center; }
.rs-empty { text-align: center; color: var(--muted); margin-top: 30px; display: grid; gap: 10px; justify-items: center; }
.rs-empty b { color: var(--paper); font-size: 1.1rem; }

.room-stage { position: relative; min-height: 0; }
.panel { display: none; position: absolute; inset: 0; flex-direction: column; overflow: hidden; }
.panel.show { display: flex; }
#p-sus, #p-ev { overflow-y: auto; padding: 22px clamp(14px, 3vw, 32px) 40px; }
#p-sus.show, #p-ev.show { display: block; }
.panel-head h2 { margin: 0; font-size: 1.35rem; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.panel-head h2 .mono { font-size: .8rem; color: var(--muted); }
.panel-head p { margin: 4px 0 18px; color: var(--muted); font-size: .92rem; }
.panel-head.row { display: flex; align-items: center; gap: 10px; padding: 12px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head.row .rb { margin-inline-start: auto; }

.ps-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.ps-card { text-align: start; background: #0f1013; border: 1px solid rgba(255,255,255,.07); border-radius: 14px; overflow: hidden; padding: 0; transition: transform .25s, border-color .25s, box-shadow .25s; color: var(--paper); }
.ps-card:hover { transform: translateY(-4px); border-color: rgba(217,164,65,.4); }
.ps-card.on { border-color: rgba(217,164,65,.75); box-shadow: 0 0 0 3px rgba(217,164,65,.15); }
.ps-photo { position: relative; }
.ps-photo .av { aspect-ratio: 5 / 6; }
.ps-count { position: absolute; bottom: 8px; inset-inline-start: 8px; font-size: .72rem; background: rgba(0,0,0,.72); padding: 2px 9px; border-radius: 999px; color: #e7b357; font-weight: 700; }
.ps-info { padding: 10px 12px 12px; }
.ps-info b { display: block; font-size: 1.08rem; font-weight: 800; }
.ps-info small { display: block; color: var(--muted); font-size: .8rem; line-height: 1.4; min-height: 2.2em; }
.ps-meters { display: grid; gap: 6px; margin-top: 8px; }
.mini span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.mini .mt-bar { height: 4px; margin-top: 2px; }
.ps-feed { margin-top: 26px; }
.ps-feed h3 { font-size: .95rem; color: var(--paper-2); }

/* المحادثة */
.pc-scene { position: absolute; inset: 0; z-index: 0; }
.pc-scene svg { width: 100%; height: 100%; display: block; }
.pc-scene::after { content: ''; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(7,8,10,.45), rgba(7,8,10,.72) 70%, rgba(7,8,10,.9)); }
#p-chat > *:not(.pc-scene) { position: relative; z-index: 1; }
.pc-chat { flex: 1; min-height: 0; overflow-y: auto; padding: 24px clamp(14px, 3vw, 38px); display: flex; flex-direction: column; gap: 18px; overscroll-behavior: contain; }
.bb { display: flex; flex-direction: column; gap: 5px; max-width: min(880px, 84%); animation: popIn .35s cubic-bezier(.2,.7,.2,1); }
.bb-name { font-size: .78rem; font-weight: 800; color: #d9a441; padding-inline: 4px; }
.bb-me { align-self: flex-end; }
.bb-me .bb-name { color: #e8767a; }
.bb-me .bb-body { background: rgba(32,16,18,.88); border: 1px solid rgba(200,54,60,.38); border-radius: 12px; padding: 10px 16px; font-size: 1rem; white-space: pre-wrap; }
.bb-them { align-self: flex-start; }
.bb-them .bb-body { background: rgba(8,9,12,.86); border: 1px solid rgba(217,164,65,.3); border-inline-start: 3px solid #d9a441; border-radius: 12px; padding: 14px 18px; line-height: 2; font-size: 1.02rem; white-space: pre-wrap; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); box-shadow: 0 12px 30px -18px #000; }
.bb-body .act { color: #a3967e; font-style: italic; }
.bb-body .shown { display: block; font-size: .8rem; color: #e7b357; margin-bottom: 4px; font-weight: 700; }
.bb-refused .bb-body { border-color: rgba(200,54,60,.6); border-inline-start-color: #c8363c; }
.bb .typing { background: rgba(8,9,12,.86); border: 1px solid rgba(217,164,65,.3); border-radius: 12px; align-self: flex-start; }
.bb-found { align-self: center; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: center; padding: 10px 16px; border-radius: 12px; background: rgba(79,179,169,.14); border: 1px solid rgba(79,179,169,.5); color: #c8efe9; font-size: .92rem; max-width: 92%; text-align: center; }
.bb-sys { align-self: center; color: #ffb3a6; font-size: .9rem; border: 1px dashed rgba(200,54,60,.5); padding: 8px 14px; border-radius: 10px; background: rgba(0,0,0,.55); }
.pc-empty { margin: auto; text-align: center; max-width: 54ch; background: rgba(8,9,12,.78); border: 1px solid rgba(255,255,255,.08); padding: 26px; border-radius: 16px; backdrop-filter: blur(3px); }
.pc-empty b { display: block; font-size: 1.3rem; font-weight: 800; margin-bottom: 6px; }
.pc-empty p { color: var(--paper-2); }
.pc-empty .tip { font-size: .88rem; color: #e7b357; background: rgba(217,164,65,.08); border: 1px dashed rgba(217,164,65,.35); border-radius: 12px; padding: 10px 14px; }
.pc-composer { position: relative; padding: 12px clamp(12px, 2vw, 22px) 14px; border-top: 1px solid rgba(255,255,255,.06); background: rgba(7,8,10,.94); }
.pc-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.pc-chips:empty { display: none; }
.chip-q { height: 34px; padding: 0 16px; border-radius: 999px; border: 1px solid rgba(255,255,255,.14); background: rgba(255,255,255,.03); color: var(--paper-2); font-size: .88rem; font-weight: 600; }
.chip-q:hover { border-color: #d9a441; color: #e7b357; }
.pc-pending:empty { display: none; }
.pc-pending { margin-bottom: 8px; }
.pc-pending .chip { display: inline-flex; gap: 8px; align-items: center; font-size: .85rem; padding: 4px 6px 4px 12px; border-radius: 999px; background: rgba(217,164,65,.12); border: 1px solid rgba(217,164,65,.4); color: #f0c36b; font-weight: 700; }
.pc-pending .chip button { border: 0; background: transparent; color: inherit; font-size: 1.05rem; padding: 0 6px; }
.pc-hint { position: absolute; top: -40px; left: 22px; background: #e7b357; color: #1a1105; font-weight: 800; font-size: .85rem; padding: 7px 14px; border-radius: 10px; z-index: 3; box-shadow: 0 10px 24px -10px rgba(231,179,87,.7); animation: bob 2.4s ease-in-out infinite; }
.pc-hint::after { content: ''; position: absolute; bottom: -6px; left: 22px; border: 7px solid transparent; border-top-color: #e7b357; border-bottom: 0; }
@keyframes bob { 50% { transform: translateY(-4px); } }
.pc-form { display: flex; gap: 10px; align-items: stretch; }
.pc-confront { display: inline-flex; align-items: center; gap: 8px; padding: 0 18px; min-height: 50px; border-radius: 12px; border: 1px solid rgba(217,164,65,.6); background: rgba(217,164,65,.07); color: #e7b357; font-weight: 800; white-space: nowrap; position: relative; }
.pc-confront .icon { width: 18px; height: 18px; }
.pc-confront[disabled] { opacity: .45; }
.pc-evcount { position: absolute; top: -9px; inset-inline-end: -7px; min-width: 21px; height: 21px; border-radius: 11px; background: #d9a441; color: #1a1105; font-size: .72rem; display: grid; place-items: center; font-weight: 800; padding: 0 5px; }
.pc-form .mic { min-height: 50px; width: 50px; padding: 0; border-radius: 12px; justify-content: center; }
.pc-input { flex: 1; min-width: 0; display: flex; align-items: flex-end; gap: 8px; background: #0e0f12; border: 1px solid rgba(255,255,255,.12); border-radius: 12px; padding: 6px; }
.pc-input:focus-within { border-color: rgba(217,164,65,.6); }
.pc-input textarea { flex: 1; min-width: 0; resize: none; border: 0; background: transparent; outline: none; padding: 8px 10px; min-height: 36px; max-height: 120px; line-height: 1.6; font-size: 1rem; }
.pc-send { width: 38px; height: 38px; border-radius: 9px; border: 0; background: #c8363c; color: #fff; font-size: 1.15rem; font-weight: 800; flex: none; }
.pc-send[disabled] { opacity: .5; }
.pc-mhead { display: none; }

.room-tabs { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid rgba(255,255,255,.07); background: #0a0b0e; padding-bottom: env(safe-area-inset-bottom); }
.room-tabs button { position: relative; border: 0; background: transparent; color: var(--muted); padding: 9px 4px 10px; display: grid; justify-items: center; gap: 2px; font-size: .86rem; font-weight: 700; }
.room-tabs button .icon { width: 22px; height: 22px; }
.room-tabs button.on { color: var(--paper); }
.room-tabs button.on::before { content: ''; position: absolute; top: 0; inset-inline: 32%; height: 3px; border-radius: 0 0 3px 3px; background: #c8363c; }
.room-tabs .dot { position: absolute; top: 5px; inset-inline-start: calc(50% + 10px); min-width: 18px; height: 18px; border-radius: 9px; background: #c8363c; color: #fff; font-size: .7rem; display: grid; place-items: center; padding: 0 4px; }

.ev-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.ev-use { margin-top: 10px; border: 1px solid rgba(36,28,16,.35); background: rgba(36,28,16,.07); color: #241c10; font-weight: 800; border-radius: 8px; padding: 4px 12px; font-size: .85rem; }
.ev-pick { width: 100%; text-align: start; background: rgba(0,0,0,.25); color: var(--paper); }
.ev-pick:hover { border-color: rgba(217,164,65,.6); }
#p-ev .notes { margin-top: 22px; }
#p-room .chat-wrap { flex: 1; min-height: 0; }
.sum-body ul.sum-list { margin: 0; padding-inline-start: 20px; display: grid; gap: 6px; color: var(--paper-2); }
.sum-body p { color: var(--paper-2); }
.scene-file .card h3 { margin: 0; }
.scene-file .card { margin-bottom: 6px; }

@media (max-width: 860px) {
  .room-main { grid-template-columns: minmax(0, 1fr); }
  .room-side { display: none; }
  .room-top { flex-direction: column; align-items: stretch; gap: 8px; padding: 8px 10px; }
  .rt-right { gap: 8px; }
  .rt-right .rb span { display: none; }
  .rt-right .rb { padding: 0 12px; }
  .rt-title { font-size: 1rem; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
  .rt-left { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .rt-left .rb { justify-content: center; padding: 0 6px; font-size: .78rem; height: 36px; gap: 5px; }
  .rt-left .rb .icon { width: 15px; height: 15px; }
  .pc-mhead { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: rgba(8,9,12,.92); border-bottom: 1px solid rgba(255,255,255,.06); }
  .pc-mhead:empty { display: none; }
  .mh-photo { width: 44px; height: 52px; border-radius: 8px; overflow: hidden; padding: 0; border: 1px solid rgba(217,164,65,.45); flex: none; background: none; }
  .mh-photo .av { width: 100%; height: 100%; }
  .mh-info { min-width: 0; flex: 1; }
  .mh-info b { display: block; font-size: 1rem; font-weight: 800; }
  .mh-info small { display: block; color: #e7b357; font-size: .74rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .mh-meters { display: grid; gap: 4px; width: 128px; flex: none; }
  .pc-chat { padding: 16px 12px; gap: 14px; }
  .bb { max-width: 94%; }
  .pc-form { gap: 6px; }
  .pc-confront span:not(.pc-evcount) { display: none; }
  .pc-confront { padding: 0 13px; }
  .pc-form .mic { width: 46px; }
  .pc-hint { top: -38px; left: 12px; font-size: .8rem; }
  .ps-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .room-tabs button { font-size: .78rem; }
}

.chip-q { transition: opacity .25s, transform .25s; }
.chip-q.gone { opacity: 0; transform: scale(.85) translateY(6px); pointer-events: none; }
.delta { font-style: normal; font-size: .72rem; font-weight: 800; padding: 0 6px; border-radius: 6px; margin-inline-start: 4px; animation: deltaIn .5s cubic-bezier(.3,1.6,.5,1); display: inline-block; }
.delta.up { color: #ff7a6b; background: rgba(217,69,63,.16); }
.delta.down { color: #6fd3c8; background: rgba(79,179,169,.16); }
@keyframes deltaIn { from { transform: translateY(6px) scale(.6); opacity: 0; } }
