.nysa-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  border: 1px solid #bd93f94d;
  border-radius: 14px;
  background: var(--panel);
  color: var(--purple);
  padding: 12px 18px;
  min-height: 44px;
  font: 600 12px var(--mono);
  box-shadow: 0 6px 24px #0003;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nysa-assistant[hidden],
.nysa-assistant [hidden] {
  display: none !important;
}
.nysa-assistant {
  position: fixed;
  right: 22px;
  bottom: 80px;
  z-index: 41;
  width: min(440px, calc(100vw - 32px));
  max-height: calc(100vh - 100px);
  max-height: calc(100dvh - 100px);
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
  background: var(--panel);
  border: 1px solid #bd93f94d;
  border-radius: 14px;
  padding: 18px;
  box-shadow: 0 18px 60px #0008;
}
.nysa-assistant-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font: 12px var(--mono);
  color: var(--purple);
}
.nysa-assistant-top button {
  flex-shrink: 0;
  min-width: 36px;
  min-height: 36px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--fg);
  font-size: 23px;
}
.nysa-assistant p {
  margin: 10px 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.nysa-assistant #nysa-mode {
  font: 9px/1.5 var(--mono);
  color: var(--cyan);
}
.nysa-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0;
}
.nysa-presets button {
  flex: 1 1 120px;
  font: 10px/1.4 var(--mono);
  padding: 8px;
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #bd93f90c;
  color: var(--purple);
}
.nysa-assistant label {
  display: block;
  margin-bottom: 6px;
  font: 10px/1.5 var(--mono);
}
.nysa-assistant textarea {
  width: 100%;
  height: 64px;
  min-height: 64px;
  max-height: 120px;
  font-size: 12px;
  line-height: 1.5;
  padding: 10px 12px;
  resize: vertical;
  margin: 0 0 8px;
  background: var(--bg);
  color: var(--fg);
}
.nysa-assistant textarea::placeholder {
  color: var(--muted);
  opacity: 0.7;
}
.nysa-assistant .button {
  justify-content: center;
  padding: 10px 12px;
  min-height: 40px;
}
.nysa-assistant #nysa-send {
  width: 100%;
  border: 1px solid #bd93f966;
  background: #bd93f90c;
  color: var(--purple);
  box-shadow: none;
}
.nysa-assistant #nysa-send:not(:disabled):hover {
  background: #bd93f91a;
  border-color: var(--purple);
  color: var(--fg);
  scale: 1.01;
  box-shadow: none;
}
.nysa-assistant #nysa-send:disabled {
  background: transparent;
  border-color: var(--line);
  color: var(--muted);
  opacity: 0.65;
  box-shadow: none;
}
.nysa-assistant #nysa-reply {
  color: var(--fg);
  overflow-wrap: anywhere;
  position: relative;
  margin: 16px 0 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: linear-gradient(135deg, #bd93f90b, transparent), var(--bg);
  line-height: 1.75;
}
.nysa-assistant #nysa-reply::before {
  content: '✧ Nysa';
  display: block;
  margin-bottom: 8px;
  color: var(--cyan);
  font: 600 10px/1.5 var(--mono);
  letter-spacing: 0.04em;
}
.nysa-reply-paragraph {
  display: block;
  white-space: pre-line;
}
.nysa-reply-paragraph + .nysa-reply-paragraph {
  margin-top: 10px;
}
.nysa-assistant #nysa-reply.is-pending::before {
  animation: nysa-thinking 1600ms ease-in-out infinite;
}
@keyframes nysa-thinking {
  50% {
    opacity: 0.4;
  }
}
.nysa-assistant #nysa-reply:empty {
  display: none;
}
.nysa-assistant .nysa-plan {
  display: grid;
  gap: 6px;
  padding: 0;
  margin: 10px 0;
  list-style: none;
}
.nysa-assistant .nysa-plan li {
  padding: 10px 12px;
  font: 10px/1.4 var(--mono);
  overflow-wrap: anywhere;
  border: 1px solid var(--line);
  border-left: 2px solid var(--purple);
  border-radius: 5px;
  background: #bd93f908;
}
.nysa-plan li strong {
  display: block;
  color: var(--fg);
  font-weight: 600;
}
.nysa-plan li span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}
.nysa-assistant #nysa-apply {
  width: 100%;
}
.nysa-assistant .showcase-note {
  font-size: 9px;
  line-height: 1.5;
  margin-bottom: 0;
}
.nysa-assistant button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.nysa-launcher-icon {
  display: inline-block;
  color: var(--purple);
  font-size: 16px;
  transition:
    color 180ms ease,
    text-shadow 180ms ease;
}
.nysa-launcher[aria-expanded='true'] {
  border-color: #79dfc34d;
  background: #1b252b;
}
.nysa-launcher[aria-expanded='true'] .nysa-launcher-icon,
.nysa-heading-icon {
  color: #79dfc3;
  text-shadow: 0 0 10px #79dfc333;
}
.nysa-assistant:not([hidden]) {
  transform-origin: bottom right;
  animation: nysa-assistant-open 520ms cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes nysa-assistant-open {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
@media (hover: hover) and (pointer: fine) {
  .nysa-presets button:hover {
    background: #bd93f91a;
    border-color: var(--purple);
    color: var(--fg);
  }
}
@media (max-width: 720px) {
  .nysa-launcher {
    right: 16px;
    bottom: 16px;
  }
  .nysa-assistant {
    right: 16px;
    bottom: 72px;
    padding: 14px;
    max-height: calc(100vh - 88px);
    max-height: calc(100dvh - 88px);
  }
}
@media (max-height: 700px) {
  .nysa-assistant {
    padding: 12px;
  }
  .nysa-assistant p {
    margin: 7px 0;
  }
  .nysa-presets {
    margin: 8px 0;
  }
  .nysa-assistant textarea {
    height: 64px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .nysa-assistant #nysa-reply.is-pending::before {
    animation: none;
  }
  .nysa-assistant:not([hidden]) {
    animation: none;
  }
  .nysa-launcher,
  .nysa-launcher-icon,
  .nysa-presets button {
    transition: none;
  }
}

.nysa-assistant .nysa-restart {
  display: flex;
  width: 100%;
  margin-top: 8px;
  min-height: 36px;
  background: transparent;
  border: 1px solid var(--line);
  color: var(--purple);
}

@media (pointer: coarse) {
  .nysa-assistant textarea {
    font-size: 16px;
  }
}
