.grammar-tutor-trigger {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  margin-top: 13px;
  padding: 9px 16px;
  border: 2px solid #58cc02;
  border-bottom: 4px solid #3c8b04;
  border-radius: 14px;
  background: #e3ffc7;
  color: #3c8b04;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform 90ms ease, border-bottom-width 90ms ease;
}

.grammar-tutor-trigger::before {
  content: "✦";
}

.grammar-tutor-trigger:hover {
  background: #d4f7ad;
  transform: translateY(-1px);
}

.grammar-tutor-trigger:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

.grammar-tutor-trigger:focus-visible,
.grammar-tutor-close:focus-visible,
.grammar-tutor-actions button:focus-visible,
.grammar-tutor-send:focus-visible,
.grammar-tutor-stop:focus-visible {
  outline: 3px solid rgb(88 204 2 / 30%);
  outline-offset: 3px;
}

.grammar-tutor-backdrop {
  position: fixed;
  z-index: 1190;
  inset: 0;
  background: rgb(10 15 12 / 40%);
  backdrop-filter: blur(2px);
}

.grammar-tutor-panel {
  position: fixed;
  z-index: 1200;
  top: 0;
  right: 0;
  width: min(430px, 94vw);
  height: 100dvh;
  display: flex;
  flex-direction: column;
  border-left: 1px solid #e5e5e5;
  background: #ffffff;
  color: #3c3c3c;
  box-shadow:
    -18px 0 46px rgb(0 0 0 / 14%);
  transform: translateX(105%);
  transition: transform 190ms ease;
}

.grammar-tutor-panel[aria-hidden="false"] {
  transform: translateX(0);
}

.grammar-tutor-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding: 24px;
  border-bottom: 4px solid #58cc02;
  background: #ffffff;
}

.grammar-tutor-header h2 {
  margin: 3px 0 5px;
  color: #3c3c3c;
  font-weight: 900;
  font-size: 1.7rem;
}

.grammar-tutor-eyebrow {
  margin: 0;
  color: #3c8b04;
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.grammar-tutor-context {
  margin: 0;
  color: #6b7280;
  font-size: 0.9rem;
  line-height: 1.45;
}

.grammar-tutor-close {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  border: 2px solid #e5e5e5;
  border-radius: 12px;
  background: white;
  color: #3c3c3c;
  font-size: 1.65rem;
  line-height: 1;
  cursor: pointer;
}

.grammar-tutor-close:hover {
  border-color: #d3d3d3;
  background: #f7f9fa;
}

.grammar-tutor-body {
  flex: 1;
  overflow-y: auto;
  padding: 22px;
}

.grammar-tutor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.grammar-tutor-actions button {
  min-height: 38px;
  padding: 7px 11px;
  border: 2px solid #e5e5e5;
  border-radius: 999px;
  background: white;
  color: #3c8b04;
  font: inherit;
  font-size: 0.84rem;
  font-weight: 800;
  cursor: pointer;
}

.grammar-tutor-actions button:hover {
  border-color: #58cc02;
  background: #e3ffc7;
}

.grammar-tutor-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.grammar-tutor-wrong-action {
  border-color: #ffb347 !important;
  background: #ffeed2 !important;
  color: #a35a00 !important;
}

.grammar-tutor-status {
  min-height: 24px;
  margin: 18px 0 8px;
  color: #6b7280;
  font-size: 0.9rem;
}

.grammar-tutor-status.is-error {
  color: #d93030;
}

.grammar-tutor-response {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.grammar-tutor-turn {
  padding: 19px;
  border: 2px solid #e5e5e5;
  border-radius: 16px;
  background: white;
  box-shadow:
    0 8px 20px rgb(0 0 0 / 5%);
}

.grammar-tutor-turn-user {
  border-color: #58cc02;
  background: #e3ffc7;
}

.grammar-tutor-turn-user p {
  margin: 0;
  color: #23480a;
  font-weight: 800;
}

.grammar-tutor-turn-tutor section + section {
  margin-top: 20px;
}

.grammar-tutor-response h3 {
  margin: 0 0 7px;
  color: #3c3c3c;
  font-weight: 900;
  font-size: 1.13rem;
}

.grammar-tutor-response p,
.grammar-tutor-response li {
  color: #4b5563;
  line-height: 1.58;
}

.grammar-tutor-live {
  white-space: pre-wrap;
  color: #4b5563;
  line-height: 1.58;
}

.grammar-tutor-response ul {
  margin: 8px 0 0;
  padding-left: 20px;
}

.grammar-tutor-response a {
  color: #3c8b04;
  font-weight: 800;
}

.grammar-tutor-notice {
  padding: 11px 13px;
  border-radius: 10px;
  background: #fff6d2;
  color: #7a5b00 !important;
  font-size: 0.86rem;
}

.grammar-tutor-question-form {
  position: sticky;
  bottom: 0;
  margin-top: 22px;
  padding-top: 20px;
  padding-bottom: 2px;
  background: #ffffff;
  border-top: 1px solid #e5e5e5;
}

.grammar-tutor-question-form label {
  display: block;
  margin-bottom: 8px;
  color: #3c3c3c;
  font-weight: 850;
}

.grammar-tutor-question-form textarea {
  width: 100%;
  min-height: 92px;
  resize: vertical;
  padding: 11px 13px;
  border: 2px solid #e5e5e5;
  border-radius: 14px;
  background: white;
  color: #3c3c3c;
  font: inherit;
}

.grammar-tutor-question-form textarea:focus {
  border-color: #58cc02;
  outline: none;
  box-shadow:
    0 0 0 4px rgb(88 204 2 / 16%);
}

.grammar-tutor-form-actions {
  display: flex;
  gap: 10px;
  margin-top: 11px;
}

.grammar-tutor-send,
.grammar-tutor-stop {
  min-height: 42px;
  padding: 8px 17px;
  border-radius: 14px;
  font: inherit;
  font-weight: 850;
  cursor: pointer;
  transition: transform 90ms ease, border-bottom-width 90ms ease;
}

.grammar-tutor-send {
  border: none;
  border-bottom: 4px solid #3c8b04;
  background: #58cc02;
  color: white;
}

.grammar-tutor-send:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}

.grammar-tutor-stop {
  border: 2px solid #ffb3b3;
  border-bottom: 4px solid #ff4b4b;
  background: white;
  color: #d93030;
}

.grammar-tutor-stop:active {
  transform: translateY(3px);
  border-bottom-width: 1px;
}


@media (max-width: 700px) {
  .grammar-tutor-panel {
    top: 0;
    bottom: 0;
    width: 100%;
    height: 100dvh;
    border-top: 1px solid #e5e5e5;
    border-left: 0;
    border-radius: 0;
    transform: translateY(105%);
  }

  .grammar-tutor-panel[aria-hidden="false"] {
    transform: translateY(0);
  }

  .grammar-tutor-header {
    padding: 18px;
  }

  .grammar-tutor-body {
    padding: 18px;
  }
}
