:root {
  --ease-premium: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-soft: cubic-bezier(0.16, 1, 0.3, 1);
  --motion-fast: 180ms;
  --motion-base: 320ms;
  --motion-slow: 620ms;
  --motion-glow-gold: rgba(200, 164, 106, 0.24);
  --motion-glow-soft: rgba(243, 240, 232, 0.12);
  --morpheus-aura-sage: rgba(160, 224, 171, 0.18);
  --morpheus-aura-gold: rgba(255, 172, 46, 0.18);
  --morpheus-aura-oxblood: rgba(165, 45, 37, 0.13);
  --morpheus-aura-ivory: rgba(243, 240, 232, 0.1);
  --morpheus-aura-deep: rgba(7, 10, 18, 0.96);
  --morpheus-ease-liquid: cubic-bezier(0.19, 1, 0.22, 1);
  --m-chat-obsidian: #05060f;
  --m-chat-ink: #0a1020;
  --m-chat-bg-deep: #05060f;
  --m-chat-bg-navy: #0a1020;
  --m-chat-sage: rgba(160, 224, 171, 0.34);
  --m-chat-amber: rgba(255, 172, 46, 0.3);
  --m-chat-oxblood: rgba(165, 45, 37, 0.24);
  --m-chat-ivory: rgba(243, 240, 232, 0.16);
  --m-chat-gold: rgba(200, 164, 106, 0.24);
  --m-chat-cyan: rgba(110, 210, 205, 0.16);
  --m-chat-gold-strong: rgba(200, 164, 106, 0.3);
  --m-chat-gold-soft: rgba(217, 184, 117, 0.22);
  --m-chat-teal: rgba(95, 189, 182, 0.26);
  --m-chat-emerald: rgba(110, 156, 134, 0.22);
  --m-chat-oxblood-soft: rgba(165, 45, 37, 0.16);
  --m-chat-ease-liquid: cubic-bezier(0.19, 1, 0.22, 1);
}

.entry-logo {
  transform-origin: center;
  animation: entryLogoBreath 4s ease-in-out infinite;
}

.entry-logo-wrap::after {
  content: "";
  position: absolute;
  inset: -12%;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(200, 164, 106, 0.13) 50%, transparent 100%);
  transform: translateX(-120%);
  animation: entryLogoShimmer 3.8s ease-in-out infinite;
  mix-blend-mode: screen;
}

.entry-screen {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.62s var(--ease-premium),
    transform 0.62s var(--ease-premium);
  pointer-events: none;
}

.entry-screen.is-active {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.premium-tabs-indicator {
  left: var(--tab-x, var(--tab-indicator-left, 5px));
  width: var(--tab-width, var(--tab-indicator-width, calc((100% - 22px) / 4)));
  transition:
    left 0.42s var(--ease-premium),
    width 0.42s var(--ease-premium),
    opacity 0.32s ease;
}

.btn,
.chip-button,
.timeframe-switcher button {
  transition:
    transform 0.2s var(--ease-premium),
    box-shadow 0.28s ease,
    border-color 0.28s ease,
    background 0.28s ease,
    color 0.28s ease;
}

.btn:hover,
.chip-button:hover,
.timeframe-switcher button:hover {
  transform: translateY(-1px);
}

.btn:active,
.chip-button:active,
.timeframe-switcher button:active {
  transform: scale(0.97);
}

.btn-primary:hover {
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.24),
    0 0 22px rgba(200, 164, 106, 0.14);
}

.practice-drawer .chip-button,
.practice-card .chip-button {
  position: relative;
  overflow: hidden;
}

.practice-drawer .chip-button.is-selected,
.practice-card .chip-button.is-selected {
  color: #c8a46a;
  border-color: rgba(200, 164, 106, 0.28);
  background: rgba(200, 164, 106, 0.1);
}

.practice-drawer .chip-button::after,
.practice-card .chip-button::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.42);
  background: radial-gradient(circle at center, rgba(200, 164, 106, 0.18), transparent 68%);
  transition:
    opacity 0.42s ease,
    transform 0.42s ease;
}

.practice-drawer .chip-button:active::after,
.practice-card .chip-button:active::after {
  opacity: 1;
  transform: scale(1.4);
}

.pulse-dot,
.status-chip--gold span {
  animation: pulseGold 2.6s ease-in-out infinite;
}

.typing-dot {
  width: 5px;
  height: 5px;
  animation: typingWave 1.4s ease-in-out infinite;
}

.typing-dot:nth-child(2) {
  animation-delay: 0.2s;
}

.typing-dot:nth-child(3) {
  animation-delay: 0.4s;
}

.confirm-modal {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.confirm-modal.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.confirm-backdrop {
  backdrop-filter: blur(0);
  transition: backdrop-filter 0.42s ease;
}

.confirm-modal.is-visible .confirm-backdrop {
  backdrop-filter: blur(8px);
}

.confirm-card {
  opacity: 0;
  transform: scale(0.96) translateY(10px);
  transition:
    opacity 0.38s ease,
    transform 0.42s var(--ease-premium);
}

.confirm-modal.is-visible .confirm-card {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.capital-board.is-updating::after,
.market-chart-shell.is-updating::after,
.trade-history.is-updating::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 6;
  pointer-events: none;
  transform: translateX(-110%);
  background: linear-gradient(90deg, transparent, rgba(243, 240, 232, 0.055), transparent);
  animation: premiumMotionShimmer 1.1s ease both;
}

.history-list article,
.trade-row {
  animation: ledgerRowIn 0.5s var(--ease-premium) both;
}

.morpheus-chat-card {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  border-radius: 32px;
  background:
    radial-gradient(circle at 18% 12%, rgba(200, 164, 106, 0.1), transparent 32%),
    linear-gradient(135deg, rgba(5, 6, 15, 0.98), rgba(10, 16, 32, 0.9) 52%, rgba(5, 6, 15, 0.96));
  border: 1px solid rgba(200, 164, 106, 0.15);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.055),
    0 28px 80px rgba(0, 0, 0, 0.34);
}

.morpheus-chat-card::before {
  content: "";
  position: absolute;
  inset: -45%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(circle at 18% 24%, var(--m-chat-gold-strong), transparent 30%),
    radial-gradient(circle at 74% 18%, var(--m-chat-teal), transparent 28%),
    radial-gradient(circle at 84% 78%, var(--m-chat-ivory), transparent 28%),
    radial-gradient(circle at 28% 80%, var(--m-chat-emerald), transparent 34%),
    radial-gradient(circle at 54% 54%, var(--m-chat-oxblood-soft), transparent 38%);
  filter: blur(62px);
  opacity: 0.72;
  transform: translate3d(-4%, -4%, 0) scale(1.08) rotate(-8deg);
  animation: morpheusChatAuraDrift 16s var(--m-chat-ease-liquid) infinite alternate;
  will-change: transform, opacity;
}

.morpheus-chat-card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background:
    linear-gradient(
      135deg,
      transparent 6%,
      rgba(160, 224, 171, 0.05) 18%,
      rgba(95, 189, 182, 0.16) 32%,
      rgba(255, 172, 46, 0.2) 47%,
      rgba(243, 240, 232, 0.09) 58%,
      rgba(165, 45, 37, 0.1) 72%,
      transparent 88%
    );
  background-size: 210% 210%;
  filter: blur(46px);
  opacity: 0.58;
  mix-blend-mode: screen;
  transform: translate3d(-14%, -10%, 0) rotate(-13deg) scale(1.12);
  animation: morpheusChatDiagonalFlow 12s var(--m-chat-ease-liquid) infinite alternate;
  will-change: transform, opacity, background-position;
}

.morpheus-chat-card.is-thinking::before {
  opacity: 0.88;
  animation-duration: 11s;
}

.morpheus-chat-card.is-thinking::after {
  opacity: 0.76;
  animation-duration: 8s;
}

.morpheus-chat-card.has-new-message::after {
  animation: morpheusChatMessageGlow 1.15s ease both;
}

.morpheus-chat-head,
.morpheus-chat,
.morpheus-chat-suggestions,
.morpheus-input-row {
  position: relative;
  z-index: 3;
}

.morpheus-chat {
  background: transparent !important;
  border: none;
  box-shadow: none;
}

.morpheus-chat-head {
  background:
    linear-gradient(180deg, rgba(5, 6, 15, 0.62), rgba(5, 6, 15, 0.22)) !important;
  border-bottom: 1px solid rgba(243, 240, 232, 0.075);
  backdrop-filter: blur(10px);
}

.morpheus-chat-suggestions {
  background: transparent !important;
}

.morpheus-input-row {
  background:
    linear-gradient(180deg, rgba(5, 6, 15, 0.06), rgba(5, 6, 15, 0.46)) !important;
  border-top: 1px solid rgba(243, 240, 232, 0.075);
  backdrop-filter: blur(10px);
}

.message.morpheus {
  background:
    linear-gradient(135deg, rgba(243, 240, 232, 0.12), rgba(95, 189, 182, 0.065) 48%, rgba(200, 164, 106, 0.075)) !important;
  border: 1px solid rgba(243, 240, 232, 0.085);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.045),
    0 10px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
}

.message.user {
  background:
    linear-gradient(135deg, rgba(200, 164, 106, 0.26), rgba(200, 164, 106, 0.1)) !important;
  border: 1px solid rgba(200, 164, 106, 0.18);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.05),
    0 10px 28px rgba(0, 0, 0, 0.12);
  backdrop-filter: blur(12px);
}

@keyframes entryLogoBreath {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.92;
  }
  50% {
    transform: scale(1.015);
    opacity: 1;
  }
}

@keyframes entryLogoShimmer {
  0%,
  35% {
    transform: translateX(-120%);
    opacity: 0;
  }
  50% {
    opacity: 1;
  }
  75%,
  100% {
    transform: translateX(120%);
    opacity: 0;
  }
}

@keyframes pulseGold {
  0%,
  100% {
    opacity: 1;
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(200, 164, 106, 0.28);
  }
  50% {
    opacity: 0.72;
    transform: scale(0.92);
    box-shadow: 0 0 0 8px rgba(200, 164, 106, 0);
  }
}

@keyframes typingWave {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.38;
  }
  30% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes premiumMotionShimmer {
  to {
    transform: translateX(110%);
  }
}

@keyframes ledgerRowIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes morpheusLiquidAura {
  0% {
    transform: translate3d(-3%, -2%, 0) scale(1) rotate(0deg);
  }
  45% {
    transform: translate3d(3%, 2%, 0) scale(1.07) rotate(1.4deg);
  }
  100% {
    transform: translate3d(1%, -4%, 0) scale(1.03) rotate(-1deg);
  }
}

@keyframes morpheusIridescentVeil {
  0%,
  20% {
    transform: translateX(-45%);
    opacity: 0.12;
  }
  50% {
    opacity: 0.38;
  }
  100% {
    transform: translateX(45%);
    opacity: 0.16;
  }
}

@keyframes morpheusMessageGlow {
  0% {
    opacity: 0.16;
  }
  40% {
    opacity: 0.56;
  }
  100% {
    opacity: 0.22;
  }
}

@keyframes morpheusChatLiquidAura {
  0% {
    transform: translate3d(-4%, -2%, 0) scale(1) rotate(0deg);
  }
  42% {
    transform: translate3d(3%, 2%, 0) scale(1.08) rotate(1.5deg);
  }
  100% {
    transform: translate3d(1%, -4%, 0) scale(1.03) rotate(-1deg);
  }
}

@keyframes morpheusChatIridescentVeil {
  0%,
  18% {
    transform: translateX(-48%);
    opacity: 0.18;
  }
  48% {
    opacity: 0.58;
  }
  100% {
    transform: translateX(48%);
    opacity: 0.24;
  }
}

@keyframes morpheusChatMessageGlow {
  0% {
    opacity: 0.28;
  }
  38% {
    opacity: 0.88;
  }
  100% {
    opacity: 0.46;
  }
}

@keyframes morpheusChatAuraDrift {
  0% {
    transform: translate3d(-6%, -4%, 0) scale(1.04) rotate(-10deg);
    opacity: 0.58;
  }
  35% {
    transform: translate3d(2%, 3%, 0) scale(1.12) rotate(-5deg);
    opacity: 0.78;
  }
  70% {
    transform: translate3d(7%, -1%, 0) scale(1.08) rotate(-12deg);
    opacity: 0.7;
  }
  100% {
    transform: translate3d(10%, 8%, 0) scale(1.14) rotate(-6deg);
    opacity: 0.64;
  }
}

@keyframes morpheusChatDiagonalFlow {
  0% {
    background-position: 0% 0%;
    transform: translate3d(-16%, -12%, 0) rotate(-14deg) scale(1.08);
    opacity: 0.3;
  }
  45% {
    background-position: 58% 42%;
    transform: translate3d(2%, 4%, 0) rotate(-8deg) scale(1.16);
    opacity: 0.66;
  }
  100% {
    background-position: 100% 100%;
    transform: translate3d(14%, 12%, 0) rotate(-4deg) scale(1.1);
    opacity: 0.42;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }

  .morpheus-chat-card::before,
  .morpheus-chat-card::after {
    animation: none !important;
  }
}
