/* مازن — فوق الشريط السفلي، روبوت بطقية شيخ */
.mazen-root {
  --mazen-kb: 0px;
  --mazen-dock: calc(var(--dock, 64px) + env(safe-area-inset-bottom, 0px));
  pointer-events: none;
}
.mazen-root > * { pointer-events: auto; }

.mazen-face {
  position: fixed;
  right: 10px;
  bottom: calc(var(--mazen-dock) + 8px);
  width: 62px;
  height: 78px;
  padding: 0;
  margin: 0;
  border: 0;
  background: transparent;
  z-index: 250;
  cursor: pointer;
  filter: drop-shadow(0 6px 14px rgba(0,0,0,0.45));
  transition: bottom 0.28s cubic-bezier(.2,.9,.3,1.15), transform 0.28s cubic-bezier(.2,.9,.3,1.15);
  -webkit-tap-highlight-color: transparent;
}
.mazen-face svg { width: 100%; height: 100%; display: block; overflow: visible; }
.mazen-face.is-listening {
  filter: drop-shadow(0 0 10px rgba(212,175,55,0.85)) drop-shadow(0 6px 14px rgba(0,0,0,0.45));
}
.mazen-face.is-listening::after {
  content: "";
  position: absolute;
  inset: 8px 4px 2px;
  border-radius: 50%;
  border: 2px solid rgba(212,175,55,0.7);
  animation: mazen-ring 1.2s ease-out infinite;
  pointer-events: none;
}
@keyframes mazen-ring {
  0% { transform: scale(0.92); opacity: 0.9; }
  100% { transform: scale(1.28); opacity: 0; }
}

.mazen-root.kb-open .mazen-face {
  bottom: calc(var(--mazen-kb) + 8px);
  transform: translateY(-6px);
  animation: mazen-jump 0.38s cubic-bezier(.2,1.3,.4,1);
}
@keyframes mazen-jump {
  0% { transform: translateY(18px) scale(0.96); }
  55% { transform: translateY(-14px) scale(1.06); }
  100% { transform: translateY(-6px) scale(1); }
}

.mazen-eye { transform-origin: center; transform-box: fill-box; animation: mazen-blink 5.6s ease-in-out infinite; }
.mazen-eye.right { animation-delay: 0.12s; }
.mazen-mouth { transform-origin: 40px 72px; animation: mazen-speak 7s ease-in-out infinite; }
.mazen-face.is-talking .mazen-mouth { animation: mazen-talk 0.35s ease-in-out infinite; }
@keyframes mazen-blink {
  0%, 92%, 100% { transform: scaleY(1); }
  94% { transform: scaleY(0.08); }
}
@keyframes mazen-speak {
  0%, 70%, 100% { transform: scaleY(1); }
  78% { transform: scaleY(1.15); }
}
@keyframes mazen-talk {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(1.45); }
}

.mazen-welcome {
  position: fixed;
  right: 78px;
  bottom: calc(var(--mazen-dock) + 28px);
  max-width: min(72vw, 280px);
  background: linear-gradient(175deg, #1a3a2a, #0c1c14);
  color: #fff8dc;
  border: 1px solid rgba(212,175,55,0.5);
  border-radius: 16px 16px 4px 16px;
  padding: 10px 12px;
  font-size: 0.82rem;
  line-height: 1.55;
  z-index: 249;
  box-shadow: 0 10px 28px rgba(0,0,0,0.45);
  display: none;
}
.mazen-welcome.show { display: block; animation: mazen-pop 0.35s ease; }
@keyframes mazen-pop {
  from { opacity: 0; transform: translateY(8px) scale(0.96); }
  to { opacity: 1; transform: none; }
}

.mazen-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.38);
  z-index: 239;
}
.mazen-backdrop.open { display: block; }

.mazen-panel {
  position: fixed;
  left: 10px;
  right: 10px;
  bottom: calc(var(--mazen-dock) + 90px);
  width: auto;
  max-width: 520px;
  margin: 0 auto;
  background: linear-gradient(175deg, rgba(16, 38, 28, 0.98), rgba(6, 16, 12, 0.99));
  border: 1px solid rgba(212, 175, 55, 0.45);
  border-radius: 22px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.6);
  padding: 12px 14px 12px;
  color: #faf6e8;
  display: none;
  z-index: 241;
  max-height: min(58vh, 480px);
  overflow: hidden;
  flex-direction: column;
  transition: bottom 0.22s ease;
}
.mazen-panel.open { display: flex; }
.mazen-root.kb-open .mazen-panel {
  bottom: calc(var(--mazen-kb) + 92px);
  max-height: min(42vh, 360px);
}
.mazen-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}
.mazen-panel h3 {
  margin: 0;
  font-size: 1.05rem;
  color: #fff3b0;
  font-weight: 800;
}
.mazen-close {
  border: 0;
  background: transparent;
  color: #cfc6a0;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 4px 8px;
}
.mazen-hello { display: none; }
.mazen-log {
  flex: 0 1 auto;
  max-height: 120px;
  overflow-y: auto;
  font-size: 0.86rem;
  line-height: 1.5;
  margin-bottom: 8px;
}
.mazen-log:empty { display: none; }
.mazen-log .me, .mazen-log .bot {
  padding: 8px 11px;
  border-radius: 14px;
  margin: 6px 0;
  max-width: 92%;
}
.mazen-log .me { background: rgba(212,175,55,0.16); color: #fff3b0; margin-right: auto; }
.mazen-log .bot { background: rgba(255,255,255,0.07); margin-left: auto; }

.mazen-hints {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0;
}
.mazen-hints button {
  font-size: 0.78rem;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(212,175,55,0.35);
  background: rgba(212,175,55,0.08);
  color: #e8d48a;
  cursor: pointer;
  min-height: 36px;
}
.mazen-hints button:active { background: rgba(212,175,55,0.22); }

.mazen-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  align-items: stretch;
}
.mazen-toolbar button {
  flex: 1;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(212,175,55,0.45);
  background: #1c402e;
  color: #fff3b0;
  font-weight: 700;
  font-size: 0.86rem;
  cursor: pointer;
}
.mazen-toolbar .mazen-kb {
  background: linear-gradient(160deg, #2a5a40, #163325);
}
.mazen-toolbar .mazen-kb.is-on,
.mazen-mic.is-on-x {
  background: linear-gradient(160deg, #c9a44a, #8a6a1e);
  color: #06120d;
}

.mazen-type {
  display: flex;
  gap: 7px;
  align-items: stretch;
  margin-top: 8px;
}
.mazen-type[hidden] { display: none !important; }
.mazen-type input {
  flex: 1;
  min-height: 44px;
  border-radius: 14px;
  border: 1px solid rgba(212,175,55,0.3);
  background: #0a1a13;
  color: #faf6e8;
  padding: 8px 12px;
  font: inherit;
  font-size: 16px;
}
.mazen-type .mazen-send {
  min-width: 60px;
  border-radius: 14px;
  border: 1px solid rgba(212,175,55,0.5);
  background: #1c402e;
  color: #fff3b0;
  font-weight: 800;
  cursor: pointer;
}

.mazen-status {
  font-size: 0.78rem;
  color: #d4af37;
  min-height: 1.15em;
  margin: 0 0 6px;
  font-weight: 600;
}

@media (max-width: 380px) {
  .mazen-face { width: 54px; height: 68px; }
  .mazen-welcome { right: 68px; font-size: 0.76rem; }
  .mazen-panel { bottom: calc(var(--mazen-dock) + 80px); }
}

/* t304b: ارفع مازن فوق شريط أدوات المصحف وفوق زر السبحة */
.mazen-face {
  bottom: calc(var(--mazen-dock) + 66px);
  right: 10px;
  z-index: 260;
}
.mazen-welcome {
  right: 78px;
  bottom: calc(var(--mazen-dock) + 86px);
  z-index: 259;
}
.mazen-panel {
  bottom: calc(var(--mazen-dock) + 152px);
}
.mazen-root.kb-open .mazen-face {
  bottom: calc(var(--mazen-kb) + 8px);
}
.mazen-root.kb-open .mazen-panel {
  bottom: calc(var(--mazen-kb) + 92px);
}

/* t459: full grouped command menu + mic button */
.mazen-menu { overflow-y: auto; max-height: 34vh; display: flex; flex-direction: column; gap: 6px; padding: 2px 0; -webkit-overflow-scrolling: touch; }
.mazen-group h4 { margin: 0 2px 4px; font-size: 11px; font-weight: 700; color: #d4af37; opacity: .9; }
.mazen-group .mazen-hints { margin: 0; }
.mazen-root.kb-open .mazen-menu { display: none; }
.mazen-toolbar .mazen-mic { flex: 1.4; background: linear-gradient(135deg, #d4af37, #b8902a); color: #1a1406; font-weight: 700; border-color: transparent; }
.mazen-toolbar .mazen-mic.is-on { animation: mazenMicPulse 1s ease-in-out infinite; }
@keyframes mazenMicPulse { 0%,100% { box-shadow: 0 0 0 0 rgba(212,175,55,.55); } 50% { box-shadow: 0 0 0 7px rgba(212,175,55,0); } }
@media (prefers-reduced-motion: reduce) { .mazen-toolbar .mazen-mic.is-on { animation: none; } }

/* t460: chips moved from mazen-dict.css (user Mazen settings page removed) */
.mazen-help-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 4px; justify-content: flex-end; }
.mazen-help-chips button { border: 1px solid rgba(212,175,55,.4); background: rgba(212,175,55,.12); color: #fff3b0; border-radius: 999px; padding: 7px 12px; font-size: 13px; font-family: inherit; cursor: pointer; }
.mazen-menu .mazen-hints button { white-space: nowrap; }