/* MorphOrb (static/js/morph-orb.js) — ota-ona bo'limidagi AI yordamchi sahnasi.
   Sahna har doim tun rangida (nuqtali sfera oq/yashil — yorug' fonda ko'rinmaydi). */

.mo-root {
  --mo-ink: #e9eef6;
  --mo-muted: #8d99ad;
  --mo-green: #34d399;
  --mo-green-2: #10b981;
  --mo-amber: #f5b041;
  position: relative;
  height: 470px;
  overflow: hidden;
  isolation: isolate;
  border-radius: var(--r-xl, 22px);
  background: #06080d;
  color: var(--mo-ink);
  border: 1px solid rgba(255, 255, 255, .07);
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}
@media (max-width: 560px) {
  .mo-root { height: 540px; border-radius: var(--r-l, 16px); }
}

.mo-bg {
  position: absolute;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(90% 70% at 50% 0%, rgba(75, 143, 209, .16), transparent 62%),
    radial-gradient(70% 55% at 50% 108%, rgba(249, 115, 22, .10), transparent 70%),
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, .055) 1px, transparent 1.4px) 0 0 / 22px 22px,
    #06080d;
  mask-image: radial-gradient(120% 100% at 50% 40%, #000 55%, transparent 100%);
  -webkit-mask-image: radial-gradient(120% 100% at 50% 40%, #000 55%, transparent 100%);
}
.mo-halo {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 440px;
  height: 440px;
  z-index: -1;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  background: radial-gradient(circle, rgba(170, 196, 235, .22), rgba(75, 143, 209, .08) 40%, transparent 68%);
  opacity: var(--oCenter, 0);
  pointer-events: none;
}

/* sahna markazi — mover shu nuqtadan JS orqali siljiydi */
.mo-mover {
  position: absolute;
  left: 50%;
  top: 44%;
  width: 0;
  height: 0;
  visibility: hidden;
  will-change: transform;
}
.mo-root[data-ready] .mo-mover { visibility: visible; }

.mo-trail {
  position: absolute;
  left: 0;
  top: 0;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(circle, rgba(255, 255, 255, .95), rgba(170, 196, 235, .45) 45%, transparent 70%);
}

.mo-actor {
  --w: 560px;
  --h: 60px;
  --r: 999px;
  position: absolute;
  left: 0;
  top: 0;
  width: var(--w);
  height: var(--h);
  border-radius: var(--r);
  transform: translate(-50%, -50%) scale(var(--cs, 1));
}
.mo-actor > * { position: absolute; border-radius: inherit; }
.mo-actor[data-shake] { animation: mo-shake .26s cubic-bezier(.36, .07, .19, .97); }
@keyframes mo-shake {
  0%, 100% { translate: 0 0; }
  20% { translate: -7px 0; }
  40% { translate: 6px 0; }
  60% { translate: -4px 0; }
  80% { translate: 2px 0; }
}

.mo-underglow {
  inset: 18% 4% -42%;
  background: linear-gradient(90deg, #4b8fd1, #8b7cf6 45%, #f97316);
  filter: blur(26px);
  opacity: calc(.42 * var(--oGlow, 1));
  transition: filter .3s;
  pointer-events: none;
}
.mo-actor[data-typing] .mo-underglow { filter: blur(22px) brightness(1.35); }
.mo-halo-green {
  inset: -38px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(52, 211, 153, .55), rgba(16, 185, 129, .12) 50%, transparent 70%);
  opacity: var(--oHalo, 0);
  pointer-events: none;
}

.mo-surface {
  inset: 0;
  overflow: hidden;
  background: rgba(15, 20, 30, .9);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .07), 0 18px 40px -18px rgba(0, 0, 0, .8);
  opacity: var(--oPill, 1);
}
.mo-aurora { position: absolute; inset: 0; opacity: calc(.5 * var(--oAur, 1)); }
.mo-aurora i {
  position: absolute;
  width: 46%;
  height: 220%;
  top: -60%;
  border-radius: 50%;
  filter: blur(26px);
  opacity: .45;
  animation: mo-drift 9s ease-in-out infinite alternate;
}
.mo-aurora i:nth-child(1) { left: -8%; background: #2f6fac; }
.mo-aurora i:nth-child(2) { left: 22%; background: #6d5bd0; animation-duration: 11s; animation-delay: -3s; }
.mo-aurora i:nth-child(3) { left: 52%; background: #0e9f8a; animation-duration: 13s; animation-delay: -6s; }
.mo-aurora i:nth-child(4) { left: 74%; background: #c2560f; animation-duration: 10s; animation-delay: -2s; }
@keyframes mo-drift {
  from { transform: translateX(-12%) scaleY(.9); }
  to { transform: translateX(14%) scaleY(1.1); }
}

.mo-ball {
  inset: 0;
  background: radial-gradient(circle at 34% 28%, #ffffff, #dbe4f2 30%, #8ea2c2 70%, #4d5d79);
  box-shadow: 0 0 34px rgba(190, 210, 240, .45), inset -6px -8px 16px rgba(30, 40, 60, .35);
  opacity: var(--oBall, 0);
}
.mo-green {
  inset: 0;
  background: radial-gradient(circle at 34% 28%, #d1fae5, #6ee7b7 25%, #34d399 55%, #059669);
  box-shadow: 0 0 40px rgba(52, 211, 153, .55);
  opacity: var(--oGreen, 0);
  transform: scale(var(--gs, .55));
}
.mo-card {
  inset: 0;
  background: linear-gradient(180deg, rgba(22, 30, 42, .96), rgba(14, 19, 28, .97));
  border: 1px solid rgba(52, 211, 153, .22);
  box-shadow: 0 24px 60px -20px rgba(0, 0, 0, .85), 0 0 0 1px rgba(255, 255, 255, .03) inset;
  opacity: var(--oCard, 0);
}
.mo-root[data-error] .mo-card { border-color: rgba(245, 176, 65, .3); }
.mo-ring {
  inset: 0;
  border: 1px solid rgba(255, 255, 255, .13);
  opacity: var(--oRing, 1);
  pointer-events: none;
  transition: border-color .2s;
}
.mo-actor:focus-within .mo-ring { border-color: rgba(106, 167, 227, .55); }
.mo-actor[data-flash] .mo-ring { border-color: rgba(240, 93, 93, .8); }

.mo-input {
  inset: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 0 18px;
  opacity: var(--oInput, 1);
  transform: scale(var(--inScale, 1));
}
.mo-root:not([data-phase="idle"]) .mo-input { pointer-events: none; }
.mo-spark { display: flex; width: 20px; height: 20px; color: #a9b8d0; flex: none; }
.mo-spark svg { width: 100%; height: 100%; }
.mo-field {
  flex: 1;
  min-width: 0;
  height: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--mo-ink);
  font: inherit;
  font-size: 16px;
  font-weight: 500;
  user-select: text;
}
.mo-field::placeholder { color: #7b879b; }
.mo-send {
  flex: none;
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  color: #a9b8d0;
  cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
}
.mo-send svg { width: 20px; height: 20px; }
.mo-send[data-ready] { background: #f4f7fb; color: #0a0d13; }
.mo-send[data-ready]:hover { transform: scale(1.05); }
.mo-send:focus-visible { outline: 2px solid var(--accent-2, #6aa7e3); outline-offset: 2px; }

.mo-orb {
  left: 50%;
  top: 50%;
  width: 220px;
  height: 220px;
  border-radius: 0;
  transform: translate(-50%, -50%);
  pointer-events: none;
}
.mo-pulse {
  left: calc(50% - 66px);
  top: calc(50% - 66px);
  width: 132px;
  height: 132px;
  border-radius: 50% !important;
  border: 2px solid var(--mo-green);
  opacity: 0;
  pointer-events: none;
}

/* javob kartasi */
.mo-answer {
  inset: 0;
  overflow: hidden;
  visibility: hidden;
  outline: none;
  user-select: text;
}
.mo-root[data-phase="unfold"] .mo-answer,
.mo-root[data-phase="answered"] .mo-answer,
.mo-root[data-phase="reset"] .mo-answer { visibility: visible; }
.mo-root[data-phase="answered"][data-scroll] .mo-answer {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.mo-a-in {
  position: absolute;
  left: 50%;
  top: 0;
  box-sizing: border-box;
  padding: 16px 20px 18px;
  transform: translateX(-50%);
}
.mo-a-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  opacity: var(--hOp, 0);
  color: var(--mo-muted);
  font-size: 13px;
  font-weight: 600;
}
.mo-a-dot {
  flex: none;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--mo-green);
  box-shadow: 0 0 calc(var(--bloom, 1) * 16px) calc(var(--bloom, 1) * 3px) rgba(52, 211, 153, .55);
  transform: scale(var(--dotS, 0));
}
.mo-root[data-error] .mo-a-dot { background: var(--mo-amber); box-shadow: 0 0 calc(var(--bloom, 1) * 16px) rgba(245, 176, 65, .55); }
.mo-a-q { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-a-body { font-size: 15px; line-height: 1.6; color: var(--mo-ink); }
.mo-a-body p { margin: 0 0 8px; }
.mo-a-body p:last-child { margin-bottom: 0; }
.mo-w { display: inline-block; opacity: 0; will-change: opacity, transform, filter; }

/* "O'ylayapman…" yozuvi — shar ostida */
.mo-status {
  position: absolute;
  left: 50%;
  top: calc(44% + 84px);
  height: 22px;
  width: 280px;
  margin-left: -140px;
  opacity: var(--sOp, 0);
  transform: translateY(calc(var(--sTy, 6) * 1px));
  pointer-events: none;
}
.mo-lab {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 14px;
  font-weight: 600;
  color: #c7d1e0;
  white-space: nowrap;
}
.mo-lab.mo-in { animation: mo-lab-in .36s cubic-bezier(.22, 1, .36, 1) both; }
.mo-lab.mo-out { animation: mo-lab-out .26s ease-in both; }
@keyframes mo-lab-in { from { opacity: 0; transform: translateY(8px); filter: blur(3px); } }
@keyframes mo-lab-out { to { opacity: 0; transform: translateY(-8px); filter: blur(3px); } }
.mo-lab-done { color: var(--mo-green); }
.mo-dots { display: inline-flex; gap: 3px; margin-left: 4px; }
.mo-dots i { width: 4px; height: 4px; border-radius: 50%; background: currentColor; animation: mo-dot 1.1s ease-in-out infinite; }
.mo-dots i:nth-child(2) { animation-delay: .15s; }
.mo-dots i:nth-child(3) { animation-delay: .3s; }
@keyframes mo-dot { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }

.mo-reset {
  position: absolute;
  left: 50%;
  bottom: 30px;
  transform: translate(-50%, 8px);
  height: 44px;
  padding: 0 22px;
  border: 1px solid rgba(255, 255, 255, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .06);
  color: var(--mo-ink);
  font: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  visibility: hidden;
  transition: opacity .3s, transform .3s var(--ease-out, ease), visibility 0s .3s, background .2s;
}
.mo-reset:hover { background: rgba(255, 255, 255, .11); }
.mo-root[data-phase="answered"] .mo-reset { opacity: 1; visibility: visible; transform: translate(-50%, 0); transition-delay: .25s, .25s, 0s, 0s; }

.mo-live {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce) {
  .mo-aurora i, .mo-dots i { animation: none; }
  .mo-lab.mo-in, .mo-lab.mo-out { animation-duration: .01s; }
}

/* ---------------- Ota-ona sahifasidagi AI kartasi ---------------- */
.pai-card .card-head { margin-bottom: 4px; }
.pai-sub { margin: 0 0 14px; }
.pai-sugg { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.pai-sugg button {
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, border-color .2s, opacity .2s;
}
.pai-sugg button:hover { border-color: var(--accent); background: var(--accent-soft); }
.pai-card.busy .pai-sugg button { opacity: .45; pointer-events: none; }
@media (max-width: 560px) {
  .pai-sugg { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin: 12px -16px 0; padding: 0 16px 2px; }
  .pai-sugg::-webkit-scrollbar { display: none; }
  .pai-sugg button { flex: none; }
}
.pai-foot { display: flex; flex-wrap: wrap; gap: 6px 16px; justify-content: space-between; margin-top: 10px; }
.pai-hist { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.pai-hist h4 { margin: 0 0 8px; font-size: 13px; color: var(--muted); }
.pai-qa { padding: 10px 0; border-bottom: 1px solid var(--line); }
.pai-qa:last-child { border-bottom: 0; }
.pai-qa .q { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.pai-qa .a { font-size: 14px; line-height: 1.55; color: var(--muted); white-space: pre-line; }
.pai-qa.err .a { color: var(--warn); }
