/* «سامر» — زر عائم + لوحة محادثة. يعتمد على متغيرات styles.css (--stage, --lime, --cream …). */
.samer-fab {
  position: fixed; z-index: 70; bottom: max(16px, env(safe-area-inset-bottom)); inset-inline-end: 16px;
  width: 64px; height: 64px; border-radius: 50%; border: 1px solid var(--line-dark);
  background: var(--stage); color: var(--lime); display: grid; place-items: center; cursor: pointer;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .28), 0 0 0 0 rgba(198, 240, 58, .0);
  transition: transform .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
.samer-fab-face { width: 58px; height: 58px; display: grid; place-items: center; pointer-events: none; }
.samer-fab-face > svg { width: 40px; height: 40px; }                       /* the still face until the animation loads */
.samer-fab-face > svg:not(:only-child), .samer-fab-face > svg[width] { width: 100% !important; height: 100% !important; } /* the live face */
.samer-fab:hover { transform: translateY(-2px); box-shadow: 0 14px 34px rgba(0, 0, 0, .32), 0 0 0 4px rgba(198, 240, 58, .18); }
.samer-fab:focus-visible { outline: 3px solid var(--lime); outline-offset: 3px; }
.samer-open .samer-fab { transform: scale(.92); }
.samer-tip {
  position: absolute; inset-inline-end: 74px; white-space: nowrap; background: var(--lime); color: var(--ink);
  font: 600 14px/1 var(--body); padding: 10px 14px; border-radius: 999px; box-shadow: 0 8px 20px rgba(0, 0, 0, .18);
  opacity: 0; transform: translateX(-6px); pointer-events: none; transition: opacity .3s, transform .3s var(--ease-out);
}
.samer-fab.tip-on .samer-tip { opacity: 1; transform: none; }

.samer-panel {
  position: fixed; z-index: 71; bottom: calc(max(16px, env(safe-area-inset-bottom)) + 76px); inset-inline-end: 16px;
  width: min(380px, calc(100vw - 32px)); height: min(580px, calc(100svh - 120px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--stage); color: var(--cream); border: 1px solid var(--line-dark); border-radius: 22px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, .4); font-family: var(--body);
  animation: samer-in .32s var(--ease-out);
}
.samer-panel[hidden] { display: none; }
@keyframes samer-in { from { opacity: 0; transform: translateY(12px) scale(.98); } }

.samer-head { display: flex; align-items: center; gap: 12px; padding: 10px 10px 10px 18px; padding-inline-start: 18px; border-bottom: 1px solid var(--line-dark); }
.samer-id { flex: 1; min-width: 0; }
.samer-id h2 { margin: 0; font: 800 18px/1.2 var(--display); color: var(--cream); }
.samer-id p { margin: 2px 0 0; font-size: 12.5px; color: var(--on-stage); }
.samer-x { width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; color: var(--cream); cursor: pointer; display: grid; place-items: center; }
.samer-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.samer-x:hover { background: var(--char); }
.samer-x:focus-visible, .samer-send:focus-visible, .samer-chip:focus-visible, .samer-act:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }

.samer-log { position: relative; flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.samer-msg { max-width: 86%; display: flex; flex-direction: column; gap: 8px; }
.samer-msg p { margin: 0; padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.65; white-space: pre-wrap; overflow-wrap: anywhere; }
.samer-msg.is-samer { align-self: flex-start; flex-direction: row; align-items: center; gap: 4px; max-width: 96%; }
.samer-body { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* Samer's face beside his message: the newest one is live (lottie: the reply's expression), older ones are still */
.samer-ava { width: 72px; height: 72px; flex: none; color: var(--lime); display: grid; place-items: center; margin: -10px -6px -10px 0; margin-inline: -8px -4px; }
.samer-live { position: relative; z-index: 3; width: 100%; height: 100%; display: grid; place-items: center; will-change: transform; }
.samer-live.is-flowing { filter: drop-shadow(0 0 10px rgba(198, 240, 58, .35)); }
/* the lines Samer draws while he flows down to the next message */
.samer-trail { position: absolute; inset: 0 0 auto 0; width: 100%; pointer-events: none; overflow: visible; z-index: 2; }
.samer-trail-line { fill: none; stroke: var(--lime); stroke-width: 1.6; stroke-linecap: round; opacity: .5; }
.samer-trail-line.is-main { stroke-width: 2.6; opacity: .9; }
.samer-live > svg:not(.samer-still) { width: 100% !important; height: 100% !important; }
.samer-still { width: 46%; height: 46%; opacity: .5; }
.samer-live > .samer-still { opacity: 1; }
.samer-msg.is-samer p { background: var(--char); color: var(--cream); border-start-start-radius: 6px; }
.samer-msg.is-user { align-self: flex-end; }
.samer-msg.is-user p { background: var(--lime); color: var(--ink); border-start-end-radius: 6px; }
.samer-msg.is-new { animation: samer-msg .28s var(--ease-out); }
@keyframes samer-msg { from { opacity: 0; transform: translateY(6px); } }
.samer-act {
  align-self: flex-start; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--lime);
  background: transparent; color: var(--lime); font: 600 14px/1 var(--body); cursor: pointer;
  display: inline-flex; align-items: center; text-decoration: none;
}
.samer-act:hover { background: var(--lime); color: var(--ink); }
.samer-act.is-second { margin-top: -2px; border-color: var(--line-dark); color: var(--cream); }
.samer-act.is-second:hover { border-color: var(--lime); background: transparent; color: var(--lime); }
.samer-msg.is-typing p { display: inline-flex; gap: 5px; padding: 14px 16px; } /* (kept for older markup — the typing row is now the face alone) */
.samer-msg.is-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--on-stage); animation: samer-dot 1s infinite; }
.samer-msg.is-typing i:nth-child(2) { animation-delay: .15s; }
.samer-msg.is-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes samer-dot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

.samer-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 14px 10px; }
.samer-chips[hidden] { display: none; }
.samer-chip {
  min-height: 36px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line-dark); background: var(--stage-2);
  color: var(--cream); font: 500 13.5px/1 var(--body); cursor: pointer;
}
.samer-chip:hover { border-color: var(--lime); color: var(--lime); }

.samer-form { display: flex; align-items: flex-end; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-dark); }
.samer-form textarea {
  flex: 1; resize: none; min-height: 44px; max-height: 120px; padding: 11px 14px; border-radius: 22px;
  border: 1px solid var(--line-dark); background: var(--stage-2); color: var(--cream); font: 16px/1.4 var(--body);
}
.samer-form textarea::placeholder { color: var(--on-stage); opacity: .8; }
.samer-form textarea:focus { outline: none; border-color: var(--lime); }
.samer-send {
  width: 44px; height: 44px; flex: none; border-radius: 50%; border: 0; background: var(--lime); color: var(--ink);
  cursor: pointer; display: grid; place-items: center;
}
.samer-send svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.samer-send:disabled { opacity: .5; cursor: progress; }
.samer-note { margin: 0; padding: 0 14px 10px; font-size: 11.5px; line-height: 1.5; color: var(--on-stage); opacity: .85; }

@media (max-width: 640px) {
  .samer-fab { width: 58px; height: 58px; inset-inline-end: 12px; }
  .samer-panel { inset: auto 8px max(8px, env(safe-area-inset-bottom)) 8px; width: auto; height: min(82svh, 640px); border-radius: 20px; }
  .samer-open .samer-fab { opacity: 0; pointer-events: none; }
}
@media (prefers-reduced-motion: reduce) {
  .samer-panel, .samer-msg.is-new { animation: none; }
  .samer-msg.is-typing i { animation: none; opacity: .8; }
  .samer-fab, .samer-tip { transition: none; }
}
