/* ============================================================
   JARVIS «цөм» товчлуур — улаан неон хувилбар
   Хэмжээ, өнгийг доорх хувьсагчаар тохируулна.
   ============================================================ */
.core {
  --size: 160px;              /* бөмбөрцгийн диаметр */
  --red: #ff2a30;             /* үндсэн улаан */
  --red-soft: #ff8a8c;        /* цайвар улаан (гэрэл) */
  --red-deep: #8f0a0e;        /* гүн улаан */
  --ease: cubic-bezier(.2, .7, .2, 1);
  position: relative;
  width: var(--size);
  height: var(--size);
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: transparent;
  cursor: pointer;
  display: grid;
  place-items: center;
  isolation: isolate;
  -webkit-tap-highlight-color: transparent;
  transition: transform .45s var(--ease);
}

/* Гэрэлтэх цөм */
.core-orb {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #fff 0 7%, var(--red-soft) 16%, var(--red) 36%, rgba(229, 22, 29, .35) 58%, transparent 72%);
  box-shadow:
    0 0 24px 6px rgba(255, 42, 48, .55),
    0 0 70px 20px rgba(229, 22, 29, .3),
    inset 0 0 18px rgba(255, 255, 255, .35);
  animation: core-breathe 2.6s ease-in-out infinite;
  transition: filter .4s var(--ease), box-shadow .4s var(--ease);
}

/* Эргэлдэх HUD тойргууд */
.core-rings, .core-rings i { position: absolute; inset: 0; border-radius: 50%; pointer-events: none; }
.core-rings i:nth-child(1) {             /* гадна нимгэн тойрог */
  border: 1px solid rgba(255, 90, 90, .45);
}
.core-rings i:nth-child(2) {             /* тасархай нумууд */
  inset: 8%;
  background: conic-gradient(from 0deg, var(--red) 0 12%, transparent 12% 25%, var(--red) 25% 31%, transparent 31% 50%, var(--red) 50% 66%, transparent 66% 100%);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 3px), #000 calc(100% - 2px));
  opacity: .85;
  filter: drop-shadow(0 0 6px var(--red));
  animation: core-spin 9s linear infinite;
}
.core-rings i:nth-child(3) {             /* хуваарийн зураас */
  inset: 14%;
  background: repeating-conic-gradient(rgba(255, 120, 120, .7) 0 1deg, transparent 1deg 10deg);
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
          mask: radial-gradient(farthest-side, transparent calc(100% - 6px), #000 calc(100% - 5px));
  animation: core-spin 22s linear infinite reverse;
}

/* Доорх бичиг */
.core-label {
  position: absolute;
  top: calc(100% + 14px);
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font: 500 11px/1 "JetBrains Mono", ui-monospace, Consolas, monospace;
  letter-spacing: .18em;
  color: var(--red-soft);
  text-shadow: 0 0 8px rgba(255, 60, 60, .8);
  pointer-events: none;
}

/* Дарахад тархах долгион (JS үүсгэнэ) */
.core-ripple {
  position: absolute;
  inset: 22%;
  border-radius: 50%;
  border: 2px solid var(--red);
  box-shadow: 0 0 18px var(--red);
  pointer-events: none;
  animation: core-ripple 1.1s var(--ease) forwards;
}

/* ---------- Төлөвүүд ---------- */
.core:hover { transform: scale(1.06); }
.core:hover .core-orb { filter: brightness(1.2) saturate(1.2); box-shadow: 0 0 30px 10px rgba(255, 42, 48, .7), 0 0 90px 30px rgba(229, 22, 29, .38), inset 0 0 18px rgba(255, 255, 255, .45); }
.core:hover .core-rings i:nth-child(2) { animation-duration: 4s; }
.core:active { transform: scale(.94); transition-duration: .12s; }
.core:focus-visible { outline: 2px solid var(--red-soft); outline-offset: 8px; }

.core.is-busy .core-orb { animation: core-busy .5s ease-in-out infinite; }
.core.is-busy .core-rings i:nth-child(2) { animation-duration: 1.4s; }
.core.is-busy .core-rings i:nth-child(3) { animation-duration: 4s; }
.core.is-busy .core-label { animation: core-flick .7s steps(2) infinite; }

/* ---------- Анимаци ---------- */
@keyframes core-breathe { 0%, 100% { transform: scale(1); opacity: .92; } 50% { transform: scale(1.08); opacity: 1; } }
@keyframes core-busy { 0%, 100% { transform: scale(.95); filter: brightness(1); } 50% { transform: scale(1.12); filter: brightness(1.5); } }
@keyframes core-spin { to { transform: rotate(360deg); } }
@keyframes core-ripple { from { transform: scale(1); opacity: .9; } to { transform: scale(3.2); opacity: 0; } }
@keyframes core-flick { 50% { opacity: .35; } }

/* Хөдөлгөөнийг хаасан хэрэглэгчид */
@media (prefers-reduced-motion: reduce) {
  .core-orb, .core-rings i, .core.is-busy .core-label { animation: none !important; }
  .core-ripple { display: none; }
}

/* Хөвөгч (баруун доод буланд) хувилбар */
.core.core--fab {
  --size: 76px;
  position: fixed;
  right: max(20px, env(safe-area-inset-right, 0px));
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  z-index: 50;
}
.core.core--fab .core-label {
  top: 50%; left: auto; right: calc(100% + 14px);
  transform: translateY(-50%);
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(5, 6, 10, .8);
  border: 1px solid rgba(255, 90, 90, .3);
  opacity: 0;
  transition: opacity .3s var(--ease);
}
.core.core--fab:hover .core-label, .core.core--fab.is-busy .core-label { opacity: 1; }
@media (hover: none) { .core.core--fab .core-label { display: none; } }
