.sony-assistant {
  bottom: 1.25rem;
  font-family:
    'Space Grotesk',
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    'Segoe UI',
    sans-serif;
  position: fixed;
  right: 1.25rem;
  z-index: 60;
}

.sony-assistant * {
  box-sizing: border-box;
}

.sony-assistant__launcher {
  align-items: center;
  background: #ffffff;
  border: 1px solid #d4d4d8;
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(15, 23, 42, 0.12);
  cursor: pointer;
  display: flex;
  height: 76px;
  justify-content: center;
  padding: 0;
  position: relative;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease;
  width: 76px;
}

.sony-assistant__launcher:hover {
  border-color: #0284c7;
  box-shadow: 0 16px 34px rgba(2, 132, 199, 0.18);
  transform: translateY(-2px);
}

.sony-assistant__launcher:focus-visible,
.sony-assistant__icon-btn:focus-visible,
.sony-assistant__form button:focus-visible,
.sony-assistant__suggestions button:focus-visible {
  outline: 2px solid #0ea5e9;
  outline-offset: 3px;
}

.sony-assistant__mascot {
  animation: sonyMascotFloat 3.6s ease-in-out infinite;
  display: block;
  height: 62px;
  object-fit: contain;
  position: relative;
  transform-origin: center bottom;
  width: 62px;
  z-index: 1;
}

.sony-assistant__launcher::after {
  animation: sonyMascotBlink 5s infinite;
  background: rgba(255, 255, 255, 0.86);
  border-radius: 999px;
  content: '';
  height: 6px;
  left: 25px;
  pointer-events: none;
  position: absolute;
  top: 38px;
  transform: scaleY(0);
  transform-origin: center;
  width: 28px;
}

.sony-assistant__launcher.is-thinking .sony-assistant__mascot {
  animation: sonyMascotThink 900ms ease-in-out infinite;
}

.sony-assistant__launcher.is-greeting .sony-assistant__mascot {
  animation: sonyMascotWave 600ms ease-in-out;
}

.sony-assistant__launcher.is-happy .sony-assistant__mascot {
  animation: sonyMascotHappy 500ms ease-out;
}

.sony-assistant__launcher.is-sleepy .sony-assistant__mascot {
  animation: sonyMascotSleep 4s ease-in-out infinite;
  opacity: 0.7;
}

.sony-assistant__launcher.is-attentive .sony-assistant__mascot {
  animation: sonyMascotAttentive 1.2s ease-in-out;
}

.sony-assistant__launcher:hover .sony-assistant__mascot {
  animation: sonyMascotExcited 400ms ease-in-out;
}

.sony-assistant__pulse {
  animation: sonyAssistantPulse 2.8s ease-out infinite;
  border: 1px solid rgba(14, 165, 233, 0.34);
  border-radius: 999px;
  inset: -5px;
  pointer-events: none;
  position: absolute;
}

.sony-assistant__nudge {
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  bottom: 88px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  color: #111827;
  display: flex;
  gap: 0.6rem;
  max-width: 280px;
  padding: 0.8rem 0.85rem;
  position: absolute;
  right: 0;
}

.sony-assistant__nudge p {
  font-size: 0.86rem;
  line-height: 1.35;
  margin: 0;
}

.sony-assistant__nudge button {
  background: transparent;
  border: 0;
  color: #64748b;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  padding: 0;
}

.sony-assistant__panel {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 8px;
  bottom: 88px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
  color: #111827;
  display: none;
  flex-direction: column;
  max-height: min(680px, calc(100vh - 7rem));
  overflow: hidden;
  position: absolute;
  right: 0;
  width: min(390px, calc(100vw - 2.5rem));
}

.sony-assistant__panel.is-open {
  display: flex;
}

.sony-assistant__header {
  align-items: flex-start;
  border-bottom: 1px solid rgba(15, 23, 42, 0.1);
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem;
  position: relative;
  z-index: 2;
}

.sony-assistant__eyebrow {
  color: #0284c7;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 0.2rem;
  text-transform: uppercase;
}

.sony-assistant__header > div:first-child {
  min-width: 0;
  overflow: hidden;
}

.sony-assistant__header h2 {
  color: #0f172a;
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sony-assistant__icon-btn {
  align-items: center;
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.12);
  border-radius: 6px;
  color: #334155;
  cursor: pointer;
  display: inline-flex;
  flex: 0 0 auto;
  font-size: 1.3rem;
  height: 36px;
  justify-content: center;
  line-height: 1;
  min-height: 36px;
  min-width: 36px;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  width: 36px;
}

.sony-assistant__messages {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.65rem;
  min-height: 220px;
  overflow-y: auto;
  padding: 1rem;
}

.sony-assistant__message {
  border-radius: 8px;
  font-size: 0.9rem;
  line-height: 1.45;
  max-width: 92%;
  padding: 0.7rem 0.78rem;
  white-space: pre-wrap;
}

.sony-assistant__message--assistant {
  align-self: flex-start;
  background: #f1f5f9;
  color: #0f172a;
}

.sony-assistant__message--user {
  align-self: flex-end;
  background: #0369a1;
  color: #ffffff;
}

.sony-assistant__message--error {
  align-self: flex-start;
  background: #fef2f2;
  color: #991b1b;
}

.sony-assistant__message strong {
  font-weight: 700;
}

.sony-assistant__message em {
  font-style: italic;
}

.sony-assistant__message code {
  background: rgba(15, 23, 42, 0.08);
  border-radius: 4px;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82em;
  padding: 0.08em 0.32em;
}

.sony-assistant__message a {
  color: #0369a1;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sony-assistant__message a:hover {
  color: #0c4a6e;
}

html.dark .sony-assistant__message a {
  color: #38bdf8;
}

html.dark .sony-assistant__message a:hover {
  color: #7dd3fc;
}

.sony-assistant__message ul {
  margin: 0.35rem 0 0.25rem;
  padding-left: 1.1rem;
}

.sony-assistant__message ul li {
  margin: 0.15rem 0;
}

.sony-assistant__message--typing {
  align-items: center;
  display: inline-flex;
  gap: 0.55rem;
  padding: 0.55rem 0.78rem;
}

.sony-assistant__typing-avatar {
  animation: sonyMascotThink 900ms ease-in-out infinite;
  border-radius: 999px;
  flex: 0 0 auto;
  height: 26px;
  object-fit: contain;
  width: 26px;
}

.sony-assistant__typing-dots {
  align-items: center;
  display: inline-flex;
  gap: 4px;
}

.sony-assistant__typing-dots span {
  animation: sonyTypingDot 1.1s ease-in-out infinite;
  background: #475569;
  border-radius: 999px;
  display: inline-block;
  height: 6px;
  width: 6px;
}

.sony-assistant__typing-dots span:nth-child(2) {
  animation-delay: 0.15s;
}
.sony-assistant__typing-dots span:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes sonyTypingDot {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}

html.dark .sony-assistant__message code {
  background: rgba(148, 163, 184, 0.18);
  color: #e2e8f0;
}

html.dark .sony-assistant__typing-dots span {
  background: #cbd5e1;
}

.sony-assistant__suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0 1rem 0.8rem;
}

.sony-assistant__suggestions button {
  background: #ffffff;
  border: 1px solid rgba(14, 165, 233, 0.3);
  border-radius: 999px;
  color: #075985;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.45rem 0.62rem;
}

.sony-assistant__form {
  border-top: 1px solid rgba(15, 23, 42, 0.1);
  display: grid;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
}

.sony-assistant__form textarea {
  background: #f8fafc;
  border: 1px solid rgba(15, 23, 42, 0.14);
  border-radius: 8px;
  color: #0f172a;
  font: inherit;
  line-height: 1.4;
  max-height: 130px;
  min-height: 56px;
  padding: 0.7rem;
  resize: vertical;
  width: 100%;
}

.sony-assistant__form button {
  background: #0f172a;
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 700;
  padding: 0.68rem 0.9rem;
}

.sony-assistant__form button:disabled {
  cursor: wait;
  opacity: 0.65;
}

.sony-assistant__note {
  color: #64748b;
  font-size: 0.72rem;
  line-height: 1.35;
  margin: 0;
  padding: 0 1rem 0.5rem;
}

.sony-assistant__close-bottom {
  background: transparent;
  border: 1px solid rgba(15, 23, 42, 0.15);
  border-radius: 6px;
  color: #64748b;
  cursor: pointer;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  margin: 0 1rem 0.85rem;
  padding: 0.5rem;
  text-align: center;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.sony-assistant__close-bottom:hover {
  background: #f1f5f9;
  color: #0f172a;
}

html.dark .sony-assistant__launcher,
html.dark .sony-assistant__panel,
html.dark .sony-assistant__nudge {
  background: #121212;
  border-color: #374151;
  color: #f8fafc;
}

html.dark .sony-assistant__launcher {
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.34);
}

html.dark .sony-assistant__launcher:hover {
  border-color: #0ea5e9;
  box-shadow: 0 16px 34px rgba(14, 165, 233, 0.2);
}

html.dark .sony-assistant__launcher::after {
  background: rgba(18, 18, 18, 0.9);
}

html.dark .sony-assistant__header,
html.dark .sony-assistant__form {
  border-color: rgba(148, 163, 184, 0.18);
}

html.dark .sony-assistant__header h2,
html.dark .sony-assistant__nudge p {
  color: #f8fafc;
}

html.dark .sony-assistant__message--assistant {
  background: #1e293b;
  color: #e2e8f0;
}

html.dark .sony-assistant__form textarea,
html.dark .sony-assistant__icon-btn,
html.dark .sony-assistant__suggestions button {
  background: #0f172a;
  border-color: rgba(148, 163, 184, 0.22);
  color: #e2e8f0;
}

html.dark .sony-assistant__form button {
  background: #e2e8f0;
  color: #0f172a;
}

html.dark .sony-assistant__note {
  color: #94a3b8;
}

html.dark .sony-assistant__close-bottom {
  border-color: rgba(148, 163, 184, 0.22);
  color: #94a3b8;
}

html.dark .sony-assistant__close-bottom:hover {
  background: #1e293b;
  color: #f8fafc;
}

@keyframes sonyMascotFloat {
  0%,
  100% {
    transform: translateY(0) rotate(-1deg);
  }
  50% {
    transform: translateY(-6px) rotate(1deg);
  }
}

@keyframes sonyMascotThink {
  0%,
  100% {
    transform: translateY(0) rotate(-2deg) scale(1);
  }
  50% {
    transform: translateY(-3px) rotate(2deg) scale(1.03);
  }
}

@keyframes sonyMascotBlink {
  0%,
  92%,
  100% {
    transform: scaleY(0);
  }
  94%,
  96% {
    transform: scaleY(1);
  }
}

@keyframes sonyMascotWave {
  0% {
    transform: rotate(0deg);
  }
  20% {
    transform: rotate(14deg);
  }
  40% {
    transform: rotate(-8deg);
  }
  60% {
    transform: rotate(10deg);
  }
  80% {
    transform: rotate(-4deg);
  }
  100% {
    transform: rotate(0deg);
  }
}

@keyframes sonyMascotHappy {
  0% {
    transform: translateY(0) scale(1);
  }
  40% {
    transform: translateY(-10px) scale(1.08);
  }
  60% {
    transform: translateY(-4px) scale(1.04);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes sonyMascotSleep {
  0%,
  100% {
    transform: translateY(0) rotate(0deg) scale(1);
  }
  25% {
    transform: translateY(2px) rotate(-3deg) scale(0.97);
  }
  75% {
    transform: translateY(2px) rotate(3deg) scale(0.97);
  }
}

@keyframes sonyMascotAttentive {
  0% {
    transform: translateY(0) scale(1);
  }
  30% {
    transform: translateY(-4px) scale(1.05);
  }
  60% {
    transform: translateY(-2px) scale(1.02);
  }
  100% {
    transform: translateY(0) scale(1);
  }
}

@keyframes sonyMascotExcited {
  0% {
    transform: translateY(0) rotate(0deg);
  }
  25% {
    transform: translateY(-5px) rotate(4deg);
  }
  50% {
    transform: translateY(-3px) rotate(-3deg);
  }
  75% {
    transform: translateY(-5px) rotate(2deg);
  }
  100% {
    transform: translateY(0) rotate(0deg);
  }
}

@keyframes sonyAssistantPulse {
  0% {
    opacity: 0.65;
    transform: scale(0.98);
  }
  70%,
  100% {
    opacity: 0;
    transform: scale(1.24);
  }
}

@media (max-width: 640px) {
  .sony-assistant {
    bottom: 0.85rem;
    right: 0.85rem;
  }

  .sony-assistant__launcher {
    height: 66px;
    width: 66px;
  }

  .sony-assistant__mascot {
    height: 54px;
    width: 54px;
  }

  .sony-assistant__panel {
    bottom: 78px;
    max-height: min(620px, calc(100vh - 6rem));
    width: calc(100vw - 1.7rem);
  }

  .sony-assistant__nudge {
    bottom: 78px;
    max-width: calc(100vw - 1.7rem);
  }

  .sony-assistant__icon-btn {
    height: 40px;
    width: 40px;
    font-size: 1.4rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sony-assistant__mascot,
  .sony-assistant__pulse,
  .sony-assistant__launcher::after {
    animation: none;
  }
}
