:root,
.stt-widget {
  --stt-btn-size: 36px;
  --stt-btn-radius: 8px;
  --stt-btn-bg: var(--btn-bg, var(--primary));
  --stt-btn-ink: var(--btn-ink, #fff);
  --stt-btn-border: var(--ring, #cbd5e1);
}

.stt-widget {
  border: 1px solid #ddd;
  border-radius: 10px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  max-width: 720px;
}

.stt-widget--toolbar {
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
  max-width: none;
}

.stt-widget__controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.stt-widget__btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: var(--stt-btn-size);
  height: var(--stt-btn-size);
  padding: 0.4rem;
  border: 1px solid var(--stt-btn-border);
  border-radius: var(--stt-btn-radius);
  background: var(--stt-btn-bg);
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
  font-size: 18px;
  color: var(--stt-btn-ink);
  box-shadow: 0 2px 6px rgba(31, 63, 191, 0.2);
}

.stt-widget__btn:hover:not(:disabled) {
  background: var(--stt-btn-bg);
  filter: brightness(0.97);
  transform: translateY(-1px);
}

.stt-widget__btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  box-shadow: none;
}

.stt-widget__btn--record {
  background: var(--stt-btn-bg);
  border-color: var(--stt-btn-border);
}

.stt-widget__btn--recording {
  background: linear-gradient(135deg, #0f1d4c, #1d4ed8);
  border-color: #1f3fb5;
  color: #e0ecff;
}

.stt-widget__sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.stt-widget__graph {
  position: absolute;
  inset: 50%;
  width: 68%;
  height: 68%;
  transform: translate(-50%, -50%);
  border-radius: calc(var(--stt-btn-radius) - 0.35rem);
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 8px 12px rgba(12, 35, 102, 0.28);
  background: radial-gradient(circle at 25% 25%, #1a2e77, #102056);
  display: none;
}

.stt-widget__btn .stt-widget__icon {
  font-size: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.15em;
  height: 1.15em;
}

.stt-widget__btn .stt-widget__icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.stt-widget__btn--recording .stt-widget__icon {
  display: none;
}

.stt-widget__btn--recording .stt-widget__graph {
  display: block;
}

.stt-widget__output-label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 600;
  color: #222;
}

.wysiwyg-toolbar .stt-widget--toolbar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.wysiwyg-toolbar .stt-widget--toolbar .stt-widget__btn {
  width: var(--stt-btn-size);
  height: var(--stt-btn-size);
  padding: 0;
  border: 1px solid #1f4bff;
  background: linear-gradient(135deg, #203b9f, #2f6bed);
  color: #f6f9ff;
  box-shadow: 0 10px 18px rgba(20, 52, 142, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.18);
  position: relative;
}

.wysiwyg-toolbar .stt-widget--toolbar .stt-widget__btn .stt-widget__icon {
  font-size: 18px;
}

.wysiwyg-toolbar .stt-widget--toolbar .stt-widget__btn .stt-widget__graph {
  inset: 50%;
  width: 70%;
  height: 70%;
  border-radius: 10px;
  background: radial-gradient(circle at 25% 25%, #1a2e77, #0f1f5c);
}

.wysiwyg-toolbar .stt-widget--toolbar .stt-widget__btn--recording {
  background: linear-gradient(135deg, #12235c, #1f3e9c);
  border-color: #193680;
  box-shadow: 0 12px 20px rgba(31, 71, 188, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.wysiwyg-toolbar .stt-widget--toolbar .stt-widget__btn--recording .stt-widget__graph {
  display: block;
}

.wysiwyg-toolbar .stt-widget--toolbar .stt-widget__btn--recording .stt-widget__icon {
  display: none;
}

.wysiwyg-toolbar .stt-widget--toolbar .stt-widget__controls {
  margin: 0;
}

.stt-widget__output {
  min-height: 96px;
  resize: vertical;
  padding: 10px;
  font-size: 14px;
  border-radius: 6px;
  border: 1px solid #d1d9e6;
  background: #fafbff;
}

.stt-trigger {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
}

.stt-trigger .stt-widget {
  border: none;
  padding: 0;
  box-shadow: none;
  background: transparent;
}

.stt-trigger .stt-widget__controls {
  margin: 0;
}

.stt-trigger .stt-widget__btn {
  width: var(--stt-btn-size, 36px);
  height: var(--stt-btn-size, 36px);
  padding: 0;
  border-radius: var(--stt-btn-radius, 8px);
  box-shadow: 0 10px 18px rgba(20, 52, 142, 0.25);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.stt-trigger .stt-widget__btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(0.97);
}

.stt-widget__note {
  margin-top: 10px;
  font-size: 13px;
  color: #4b5563;
}

.stt-widget--compact {
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
  max-width: 100%;
}

.stt-widget--compact .stt-widget__controls {
  margin-bottom: 0;
  gap: 6px;
}

.stt-widget--compact .stt-widget__btn {
  min-width: var(--stt-btn-size);
  width: var(--stt-btn-size);
  height: var(--stt-btn-size);
  font-size: 16px;
  padding: 0.4rem;
}

.stt-widget--compact .stt-widget__output-label,
.stt-widget--compact .stt-widget__note {
  display: none;
}

.stt-widget--icon {
  border: none;
  padding: 0;
  background: transparent;
  box-shadow: none;
}

.stt-widget--icon .stt-widget__controls {
  margin: 0;
}

.stt-widget--icon .stt-widget__btn {
  width: var(--stt-btn-size);
  height: var(--stt-btn-size);
  padding: 0.35rem 0.6rem;
  border-radius: var(--stt-btn-radius);
  border: 1px solid #1f4bff;
  background: linear-gradient(135deg, #203b9f, #2f6bed);
  color: #f6f9ff;
  box-shadow: 0 10px 18px rgba(20, 52, 142, 0.28), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  font-size: 1.1rem;
}

.stt-widget--icon .stt-widget__btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #1c348d, #2b63df);
  border-color: #1c348d;
}

.stt-widget--icon .stt-widget__btn--recording {
  background: linear-gradient(135deg, #15295c, #1f3d9f);
  border-color: #0f3bc4;
  color: #e0ecff;
}

.stt-widget--icon .stt-widget__output-label,
.stt-widget--icon .stt-widget__note {
  display: none;
}

@media (max-width: 640px) {
  .stt-widget__visual {
    grid-template-columns: 1fr;
  }
}
