.jarvis-launcher,
.jarvis-panel {
  --jarvis-ink: var(--text, #111114);
  --jarvis-muted: var(--muted, #77777f);
  --jarvis-surface: color-mix(in srgb, var(--panel, #ffffff) 94%, transparent);
  --jarvis-field: color-mix(in srgb, var(--field, #ffffff) 88%, #f5f5f7);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", system-ui, sans-serif;
}

.jarvis-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 2147483000;
  isolation: isolate;
  width: 56px;
  height: 56px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  background: rgba(255, 255, 255, .88);
  color: #17171a;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .055),
    0 1px 2px rgba(0, 0, 0, .06),
    0 12px 30px rgba(19, 24, 35, .16),
    inset 0 1px 0 rgba(255, 255, 255, .9);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  font: 650 15px/1 -apple-system, BlinkMacSystemFont, "Segoe UI Variable", system-ui, sans-serif;
  letter-spacing: .08em;
  cursor: pointer;
  transform: translateZ(0) scale(1);
  transition:
    transform 180ms cubic-bezier(.2, .8, .2, 1),
    background-color 220ms cubic-bezier(.32, .72, 0, 1),
    color 220ms cubic-bezier(.32, .72, 0, 1),
    box-shadow 220ms cubic-bezier(.32, .72, 0, 1);
}

.jarvis-launcher::before {
  content: "";
  position: absolute;
  inset: -10px;
  z-index: -1;
  border-radius: 24px;
  background: conic-gradient(from 205deg, #54d6ff, #6b7cff, #b55cff, #ff5fa2, #ffab4a, #55e6bc, #54d6ff);
  opacity: 0;
  filter: blur(11px) saturate(140%);
  transform: scale(.76) rotate(-24deg);
  pointer-events: none;
}

.jarvis-launcher::after {
  content: "";
  position: absolute;
  inset: 4px;
  z-index: -1;
  border-radius: 12px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .68);
  pointer-events: none;
}

.jarvis-launcher:hover {
  transform: translateY(-1px) scale(1.015);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .07),
    0 2px 4px rgba(0, 0, 0, .06),
    0 16px 34px rgba(19, 24, 35, .18),
    inset 0 1px 0 rgba(255, 255, 255, .95);
}

.jarvis-launcher:active { transform: scale(.94); }
.jarvis-launcher.is-open { background: rgba(18, 18, 20, .94); color: #fff; }
.jarvis-launcher.is-awake::before { animation: jarvis-siri-bloom 520ms cubic-bezier(.22, .8, .24, 1) both; }

@keyframes jarvis-siri-bloom {
  0% { opacity: 0; transform: scale(.72) rotate(-24deg); filter: blur(13px) saturate(125%); }
  34% { opacity: .92; transform: scale(.96) rotate(28deg); filter: blur(9px) saturate(165%); }
  72% { opacity: .54; transform: scale(1.18) rotate(92deg); filter: blur(13px) saturate(150%); }
  100% { opacity: 0; transform: scale(1.32) rotate(132deg); filter: blur(17px) saturate(135%); }
}

.jarvis-panel {
  position: fixed;
  right: 22px;
  bottom: 94px;
  z-index: 2147482999;
  width: min(368px, calc(100vw - 28px));
  max-height: min(620px, calc(100dvh - 118px));
  display: grid;
  grid-template-rows: auto minmax(0, auto) auto;
  overflow: hidden;
  border: 0;
  border-radius: 26px;
  background: var(--jarvis-surface);
  color: var(--jarvis-ink);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, .055),
    0 2px 5px rgba(0, 0, 0, .05),
    0 30px 80px rgba(19, 24, 35, .2),
    inset 0 1px 0 rgba(255, 255, 255, .82);
  backdrop-filter: blur(28px) saturate(165%);
  -webkit-backdrop-filter: blur(28px) saturate(165%);
  font-size: 14px;
  line-height: 1.45;
  opacity: 0;
  filter: blur(5px);
  transform: translateY(10px) scale(.982);
  transform-origin: bottom right;
  pointer-events: none;
  transition:
    opacity 220ms cubic-bezier(.32, .72, 0, 1),
    filter 220ms cubic-bezier(.32, .72, 0, 1),
    transform 240ms cubic-bezier(.32, .72, 0, 1);
}

.jarvis-panel.is-visible {
  opacity: 1;
  filter: blur(0);
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.jarvis-panel[hidden] { display: none !important; }
.jarvis-head, .jarvis-compose { padding: 14px 16px; }

.jarvis-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  gap: 16px;
}

.jarvis-title { display: flex; align-items: center; min-width: 0; }
.jarvis-title strong { font-size: 15px; font-weight: 650; letter-spacing: .12em; }

.jarvis-visually-hidden {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.jarvis-panel button {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(118, 118, 128, .09);
  color: inherit;
  font: 560 18px/1 -apple-system, BlinkMacSystemFont, "Segoe UI Variable", system-ui, sans-serif;
  cursor: pointer;
  transform: scale(1);
  transition:
    transform 160ms cubic-bezier(.2, .8, .2, 1),
    opacity 160ms cubic-bezier(.2, .8, .2, 1),
    background-color 180ms cubic-bezier(.32, .72, 0, 1);
}

.jarvis-panel button:hover { background: rgba(118, 118, 128, .16); }
.jarvis-panel button:active { transform: scale(.92); }
.jarvis-panel button:disabled { opacity: .28; cursor: not-allowed; }

.jarvis-log {
  max-height: min(420px, calc(100dvh - 260px));
  margin: 0;
  padding: 10px 16px 16px;
  overflow: auto;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overscroll-behavior: contain;
}

.jarvis-log:empty { display: none; }
.jarvis-log li { max-width: 88%; border-radius: 18px; padding: 10px 13px; white-space: pre-wrap; overflow-wrap: anywhere; }
.jarvis-user {
  align-self: flex-end;
  background: #18181b;
  color: #fff;
  opacity: 1;
  transition: opacity 160ms cubic-bezier(.2, .8, .2, 1);
}
.jarvis-transcript-draft { opacity: .62; }
.jarvis-assistant {
  align-self: flex-start;
  background: rgba(118, 118, 128, .09);
  box-shadow: inset 0 0 0 1px rgba(118, 118, 128, .06);
}
.jarvis-system { align-self: center; max-width: 100% !important; color: var(--jarvis-muted); font-size: 12px; text-align: center; }

.jarvis-compose {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 0 8px 8px;
  padding: 7px 7px 7px 14px;
  border-radius: 21px;
  background: var(--jarvis-field);
  box-shadow:
    0 0 0 1px rgba(118, 118, 128, .13),
    inset 0 1px 0 rgba(255, 255, 255, .72);
}

.jarvis-compose input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  padding: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: inherit;
  font: inherit;
}

.jarvis-compose input::placeholder { color: color-mix(in srgb, var(--jarvis-muted) 76%, transparent); }
.jarvis-compose:focus-within {
  box-shadow:
    0 0 0 1px rgba(61, 61, 67, .24),
    inset 0 1px 0 rgba(255, 255, 255, .78);
}
.jarvis-compose input:focus,
.jarvis-compose input:focus-visible {
  outline: none !important;
  box-shadow: none !important;
}

.jarvis-mic-icon {
  position: relative;
  display: block;
  width: 9px;
  height: 14px;
  border: 1.4px solid currentColor;
  border-radius: 6px;
}

.jarvis-mic-icon::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 13px;
  height: 8px;
  border: 1.4px solid currentColor;
  border-top: 0;
  border-radius: 0 0 8px 8px;
  transform: translateX(-50%);
}

.jarvis-mic-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -8px;
  width: 7px;
  height: 1.4px;
  border-radius: 2px;
  background: currentColor;
  transform: translateX(-50%);
}

.jarvis-mic[data-active="true"] {
  background: conic-gradient(from 205deg, #54d6ff, #b55cff, #ff5fa2, #ffab4a, #55e6bc, #54d6ff);
  color: #fff;
}

.jarvis-send { background: #18181b !important; color: #fff !important; font-size: 20px !important; padding-bottom: 2px !important; }

@media (max-width: 560px) {
  .jarvis-launcher { right: 14px; bottom: 14px; width: 54px; height: 54px; border-radius: 15px; }
  .jarvis-panel { right: 14px; bottom: 80px; width: calc(100vw - 28px); max-height: calc(100dvh - 102px); border-radius: 24px; }
  .jarvis-log { max-height: calc(100dvh - 242px); }
}

@media (prefers-reduced-motion: reduce) {
  .jarvis-launcher,
  .jarvis-launcher::before,
  .jarvis-panel,
  .jarvis-panel button {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
