.osh-snurr {
  --osh-forest: #173c2d;
  --osh-forest-dark: #0d261d;
  --osh-paper: #fff8e8;
  --osh-paper-deep: #f1e4c8;
  --osh-ink: #17221c;
  --osh-orange: #ff8b52;
  --osh-orange-dark: #d85f2e;
  --osh-gold: #d6aa55;
  --osh-border: rgba(61, 45, 26, 0.18);
  --osh-shadow: 0 18px 55px rgba(7, 24, 17, 0.22);
  max-width: 820px;
  margin: 2rem auto;
  color: var(--osh-ink);
  font-family: inherit;
}

.osh-snurr *,
.osh-snurr *::before,
.osh-snurr *::after {
  box-sizing: border-box;
}

.osh-snurr__panel {
  overflow: hidden;
  border: 1px solid var(--osh-border);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(214, 170, 85, 0.2), transparent 34%),
    linear-gradient(180deg, #fffaf0 0%, var(--osh-paper) 100%);
  box-shadow: var(--osh-shadow);
}

.osh-snurr__header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.3rem 1.5rem;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(13, 38, 29, 0.98), rgba(23, 60, 45, 0.94)),
    repeating-linear-gradient(45deg, transparent, transparent 12px, rgba(255, 255, 255, 0.025) 12px, rgba(255, 255, 255, 0.025) 24px);
}

.osh-snurr__avatar {
  display: grid;
  width: 58px;
  height: 58px;
  flex: 0 0 58px;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.32);
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.2);
  font-size: 2rem;
}

.osh-snurr__header h2 {
  margin: 0;
  color: #fff;
  font-size: clamp(1.6rem, 4vw, 2.25rem);
  line-height: 1.05;
}

.osh-snurr__eyebrow {
  margin: 0 0 0.2rem;
  color: #f3d898;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.osh-snurr__conversation {
  display: flex;
  min-height: 260px;
  max-height: 560px;
  flex-direction: column;
  gap: 1rem;
  overflow-y: auto;
  padding: 1.5rem;
  scroll-behavior: smooth;
}

.osh-message {
  display: flex;
  max-width: 86%;
  flex-direction: column;
  gap: 0.3rem;
}

.osh-message--agent {
  align-self: flex-end;
  align-items: flex-end;
}

.osh-message--snurr {
  align-self: flex-start;
  align-items: flex-start;
}

.osh-message__name {
  padding: 0 0.35rem;
  color: #5e675f;
  font-size: 0.78rem;
  font-weight: 700;
}

.osh-message__bubble {
  border: 1px solid var(--osh-border);
  border-radius: 18px 18px 18px 5px;
  background: #fff;
  box-shadow: 0 7px 20px rgba(22, 47, 35, 0.08);
  padding: 0.9rem 1rem;
  line-height: 1.55;
}

.osh-message--agent .osh-message__bubble {
  border-color: rgba(23, 60, 45, 0.2);
  border-radius: 18px 18px 5px 18px;
  color: #fff;
  background: var(--osh-forest);
}

.osh-message__bubble > :first-child {
  margin-top: 0;
}

.osh-message__bubble > :last-child {
  margin-bottom: 0;
}

.osh-message__audio {
  display: block;
  width: 100%;
  min-width: min(420px, 70vw);
  margin-top: 0.85rem;
}

.osh-snurr__code-form,
.osh-snurr__actions {
  padding: 1.15rem 1.5rem;
  border-top: 1px solid var(--osh-border);
  background: rgba(255, 255, 255, 0.62);
}

.osh-snurr__code-form label {
  display: block;
  margin-bottom: 0.45rem;
  font-weight: 800;
}

.osh-snurr__code-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
}

.osh-snurr__code-row input {
  min-height: 52px;
  width: 100%;
  border: 2px solid rgba(23, 60, 45, 0.28);
  border-radius: 12px;
  background: #fff;
  color: var(--osh-ink);
  font: inherit;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.75rem 0.9rem;
  text-transform: uppercase;
}

.osh-snurr__code-row input:focus {
  border-color: var(--osh-orange-dark);
  outline: 3px solid rgba(255, 139, 82, 0.26);
  outline-offset: 1px;
}

.osh-snurr__privacy {
  margin: 0.65rem 0 0;
  color: #5d645e;
  font-size: 0.86rem;
}

.osh-snurr__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.osh-snurr__actions:empty {
  display: none;
}

.osh-button {
  min-height: 48px;
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 12px;
  font: inherit;
  font-weight: 800;
  line-height: 1.2;
  padding: 0.72rem 1rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.osh-button:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 7px 18px rgba(14, 38, 28, 0.16);
}

.osh-button:focus-visible {
  outline: 3px solid rgba(255, 139, 82, 0.36);
  outline-offset: 2px;
}

.osh-button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.osh-button--primary {
  color: #1e1b17;
  background: var(--osh-orange);
  border-color: var(--osh-orange);
}

.osh-button--secondary {
  color: var(--osh-forest-dark);
  background: #fff;
  border-color: rgba(23, 60, 45, 0.32);
}

.osh-button--danger {
  color: #fff;
  background: #8b3428;
  border-color: #8b3428;
}

.osh-button--text {
  color: #49554d;
  background: transparent;
  border-color: transparent;
  text-decoration: underline;
  text-underline-offset: 0.18em;
}

.osh-snurr__status {
  min-height: 1.2rem;
  padding: 0 1.5rem 1rem;
  color: #5b625c;
  font-size: 0.9rem;
  font-weight: 700;
}

.osh-snurr.is-loading .osh-snurr__status::before {
  display: inline-block;
  width: 0.85rem;
  height: 0.85rem;
  margin-right: 0.5rem;
  content: '';
  vertical-align: -0.1rem;
  border: 2px solid rgba(23, 60, 45, 0.25);
  border-top-color: var(--osh-forest);
  border-radius: 50%;
  animation: osh-spin 0.8s linear infinite;
}

@keyframes osh-spin {
  to { transform: rotate(360deg); }
}

@media (max-width: 620px) {
  .osh-snurr {
    margin: 1rem 0;
  }

  .osh-snurr__panel {
    border-radius: 16px;
  }

  .osh-snurr__header,
  .osh-snurr__conversation,
  .osh-snurr__code-form,
  .osh-snurr__actions {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .osh-snurr__code-row {
    grid-template-columns: 1fr;
  }

  .osh-snurr__actions {
    flex-direction: column;
  }

  .osh-button {
    width: 100%;
  }

  .osh-message {
    max-width: 94%;
  }

  .osh-message__audio {
    min-width: min(300px, 76vw);
  }
}

@media (prefers-reduced-motion: reduce) {
  .osh-snurr *,
  .osh-snurr *::before,
  .osh-snurr *::after {
    scroll-behavior: auto !important;
    transition: none !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}
