:root {
  color-scheme: dark;
  --gold: #d4af37;
  --gold-soft: rgba(212, 175, 55, 0.72);
  --ink: #09090a;
  --panel: #121214;
  --line: rgba(212, 175, 55, 0.22);
  --text: #f2efe7;
  --muted: #b7b2a8;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  color: var(--text);
  background: var(--ink);
}

body {
  overflow-x: hidden;
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.screen-reader-text {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.r32-merchant-frame-app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  background:
    radial-gradient(circle at 50% -10%, rgba(212, 175, 55, 0.09), transparent 38%),
    linear-gradient(180deg, #111113, #09090a 68%);
}

.r32-merchant-portrait-wrap {
  position: relative;
  flex: 0 0 auto;
  height: clamp(210px, 36vh, 310px);
  overflow: hidden;
  border-bottom: 1px solid var(--line);
  background: #09090a;
}

.r32-merchant-portrait {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 50% 22%;
  filter: saturate(0.92) contrast(1.04);
}

.r32-merchant-portrait-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(0, 0, 0, 0.02) 25%, rgba(0, 0, 0, 0.78) 100%),
    linear-gradient(90deg, rgba(0, 0, 0, 0.32), transparent 35%, transparent 70%, rgba(0, 0, 0, 0.22));
  pointer-events: none;
}

.r32-merchant-identity {
  position: absolute;
  right: 18px;
  bottom: 16px;
  left: 18px;
  text-shadow: 0 2px 12px #000;
}

.r32-merchant-eyebrow {
  margin: 0 0 3px;
  color: var(--gold);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.16em;
  line-height: 1.2;
  text-transform: uppercase;
}

.r32-merchant-identity h1 {
  margin: 0;
  color: #fffaf0;
  font-family: Cinzel, Georgia, serif;
  font-size: clamp(23px, 7vw, 31px);
  font-weight: 600;
  letter-spacing: 0.025em;
  line-height: 1;
}

.r32-merchant-conversation {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 9px;
  min-height: 120px;
  max-height: none;
  padding: 15px 14px 8px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(212, 175, 55, 0.32) transparent;
}

.r32-merchant-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  padding: 0;
  color: var(--text);
  animation: message-in 170ms ease-out both;
}

.r32-merchant-message-avatar {
  display: block;
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  overflow: hidden;
  background: #0b0b0c;
  border: 1px solid rgba(212, 175, 55, 0.42);
  border-radius: 50%;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.42);
}

.r32-merchant-message-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  margin: 0;
  object-fit: cover;
}

.r32-merchant-message.is-merchant .r32-merchant-message-avatar img {
  object-position: 50% 20%;
}

.r32-merchant-message-bubble {
  width: fit-content;
  max-width: calc(100% - 42px);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: 0 7px 18px rgba(0, 0, 0, 0.2);
}

.r32-merchant-message-bubble p {
  margin: 0;
  font-size: 13px;
  line-height: 1.48;
}

.r32-merchant-message.is-merchant .r32-merchant-message-bubble {
  border-color: rgba(212, 175, 55, 0.2);
  border-bottom-left-radius: 3px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.12), rgba(255, 255, 255, 0.035));
}

.r32-merchant-message.is-user {
  flex-direction: row-reverse;
}

.r32-merchant-message.is-user .r32-merchant-message-avatar {
  border-color: rgba(180, 184, 194, 0.32);
}

.r32-merchant-message.is-user .r32-merchant-message-bubble {
  border-bottom-right-radius: 3px;
  color: #f8f7f3;
  background: rgba(87, 89, 98, 0.34);
}

@keyframes message-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: translateY(0); }
}

.r32-merchant-typing {
  display: flex;
  align-items: center;
  gap: 4px;
  min-height: 22px;
  padding: 2px 18px 4px;
}

.r32-merchant-typing[hidden] {
  display: none;
}

.r32-merchant-typing > span:not(.screen-reader-text) {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--gold);
  animation: typing 900ms infinite ease-in-out;
}

.r32-merchant-typing > span:nth-child(2) { animation-delay: 120ms; }
.r32-merchant-typing > span:nth-child(3) { animation-delay: 240ms; }

@keyframes typing {
  0%, 70%, 100% { opacity: 0.3; transform: translateY(0); }
  35% { opacity: 1; transform: translateY(-2px); }
}

.r32-merchant-preview-prompt {
  padding: 3px 14px 9px;
}

.r32-merchant-preview-prompt[hidden] {
  display: none !important;
}

.r32-merchant-preview-prompt button {
  width: 100%;
  min-height: 35px;
  padding: 7px 10px;
  color: var(--gold);
  background: rgba(212, 175, 55, 0.06);
  border: 1px solid rgba(212, 175, 55, 0.24);
  border-radius: 7px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.045em;
  line-height: 1.25;
  text-transform: uppercase;
}

.r32-merchant-preview-prompt button:hover,
.r32-merchant-preview-prompt button:focus-visible {
  color: #17130a;
  background: var(--gold);
}

.r32-merchant-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: rgba(8, 8, 9, 0.96);
  border-top: 1px solid var(--line);
}

.r32-merchant-composer textarea {
  width: 100%;
  min-height: 44px;
  max-height: 108px;
  resize: vertical;
  padding: 10px 11px;
  color: #fff;
  background: #151517;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 8px;
  outline: 0;
  font-size: 13px;
  line-height: 1.35;
}

.r32-merchant-composer textarea::placeholder {
  color: #8f8b84;
}

.r32-merchant-composer textarea:focus {
  border-color: rgba(212, 175, 55, 0.72);
  box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.1);
}

.r32-merchant-composer button {
  align-self: stretch;
  touch-action: manipulation;
  min-width: 62px;
  padding: 0 12px;
  color: #151108;
  background: linear-gradient(180deg, #e2c34f, #caa528);
  border: 1px solid #f0d66a;
  border-radius: 8px;
  font-family: Cinzel, Georgia, serif;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.r32-merchant-composer button:disabled {
  cursor: wait;
  opacity: 0.48;
}

.r32-merchant-start-over {
  align-self: center;
  margin: 7px 0 10px;
  padding: 7px 13px;
  color: rgba(226, 195, 79, 0.9);
  background: rgba(212, 175, 55, 0.055);
  border: 1px solid rgba(212, 175, 55, 0.24);
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.r32-merchant-start-over:hover,
.r32-merchant-start-over:focus-visible {
  color: #17130a;
  background: var(--gold);
  border-color: var(--gold);
  outline: 0;
}

html[data-shell-state="reduced"],
html[data-shell-state="reduced"] body {
  height: 100%;
  min-height: 0;
  overflow: hidden;
}

html[data-shell-state="reduced"] .r32-merchant-frame-app {
  min-height: 0;
  height: 100%;
  overflow: hidden;
}

html[data-shell-state="reduced"] .r32-merchant-portrait-wrap,
html[data-shell-state="reduced"] .r32-merchant-preview-prompt,
html[data-shell-state="reduced"] .r32-merchant-start-over {
  display: none !important;
}

html[data-shell-state="reduced"] .r32-merchant-conversation {
  display: flex;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  padding: 9px 10px 6px;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  scrollbar-gutter: stable;
}

html[data-shell-state="reduced"] .r32-merchant-message {
  align-self: flex-start;
  align-items: flex-end;
  gap: 8px;
  width: 100%;
  max-width: 100%;
  padding: 0;
  overflow: visible;
}

html[data-shell-state="reduced"] .r32-merchant-message-avatar {
  width: 38px;
  height: 38px;
}

html[data-shell-state="reduced"] .r32-merchant-message-bubble {
  width: auto;
  max-width: calc(100% - 46px);
  padding: 8px 10px;
  overflow: visible;
}

html[data-shell-state="reduced"] .r32-merchant-message-bubble p {
  display: block;
  overflow: visible;
  overflow-wrap: anywhere;
  -webkit-line-clamp: unset;
  font-size: 11.5px;
  line-height: 1.4;
  white-space: normal;
}

html[data-shell-state="reduced"] .r32-merchant-typing {
  position: absolute;
  right: 14px;
  bottom: 63px;
  padding: 0;
}

html[data-shell-state="reduced"] .r32-merchant-composer {
  flex: 0 0 auto;
  gap: 6px;
  padding: 7px 9px calc(7px + env(safe-area-inset-bottom));
}

html[data-shell-state="reduced"] .r32-merchant-composer textarea {
  min-height: 39px;
  max-height: 39px;
  resize: none;
  padding: 9px;
  font-size: 12px;
}

html[data-shell-state="reduced"] .r32-merchant-composer button {
  min-width: 54px;
  padding: 0 9px;
  font-size: 10px;
}

@media (max-width: 920px) and (min-height: 700px) {
  .r32-merchant-portrait-wrap {
    height: min(38vh, 330px);
  }
}

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

/* 0.8.1 conversation containment: keep long shopper turns inside the frame and
   leave breathing room beside the scrollbar on desktop. */
.r32-merchant-conversation {
  padding-right: 18px;
  overflow-x: hidden;
  scroll-padding-block: 10px;
}

.r32-merchant-message {
  flex: 0 0 auto;
  min-width: 0;
  margin-block: 1px;
}

.r32-merchant-message-bubble {
  flex: 0 1 auto;
  min-width: 0;
  overflow: hidden;
  overflow-wrap: anywhere;
  word-break: normal;
}

.r32-merchant-message-bubble p {
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: normal;
  white-space: normal;
}

.r32-merchant-message.is-user {
  padding-left: 8px;
}

.r32-merchant-message.is-user .r32-merchant-message-bubble {
  margin-left: auto;
  max-width: calc(100% - 50px);
}

html[data-shell-state="reduced"] .r32-merchant-conversation {
  padding-right: 12px;
}

/* Cross-mode handoff choices */

.r32-merchant-message.has-actions {
  flex-wrap: wrap;
}

.r32-merchant-message.has-actions .r32-merchant-message-bubble {
  max-width: calc(100% - 50px);
}
.r32-merchant-message-actions {
  display: flex;
  flex: 1 1 100%;
  flex-wrap: wrap;
  gap: 7px;
  margin: 5px 0 0 42px;
}

.r32-merchant-message-action {
  min-height: 34px;
  margin: 0;
  padding: 7px 10px;
  border-radius: 7px;
  font-family: Cinzel, Georgia, serif;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.045em;
  line-height: 1.2;
  text-transform: uppercase;
}

.r32-merchant-message-action.is-primary {
  color: #17130a;
  background: linear-gradient(180deg, #e2c34f, #caa528);
  border: 1px solid #f0d66a;
}

.r32-merchant-message-action.is-secondary {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.055);
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.r32-merchant-message-action:hover,
.r32-merchant-message-action:focus-visible {
  filter: brightness(1.08);
  outline: 2px solid rgba(212, 175, 55, 0.28);
  outline-offset: 1px;
}

.r32-merchant-message-action:disabled {
  cursor: default;
  opacity: 0.52;
}

html[data-shell-state="reduced"] .r32-merchant-message-actions {
  margin: 3px 0 0 46px;
  gap: 5px;
}

html[data-shell-state="reduced"] .r32-merchant-message-action {
  min-height: 30px;
  padding: 6px 8px;
  font-size: 8.5px;
}

/* 0.10.3 — compact product recommendations inside Tal's conversation. */
.r32-merchant-recommendations {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.r32-merchant-product-card {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr);
  gap: 9px;
  min-width: 0;
  padding: 7px;
  background: rgba(6, 6, 7, 0.72);
  border: 1px solid rgba(212, 175, 55, 0.24);
  border-radius: 8px;
}

.r32-merchant-product-media,
.r32-merchant-product-title,
.r32-merchant-product-control {
  appearance: none;
  -webkit-appearance: none;
}

.r32-merchant-product-media {
  display: block;
  width: 78px;
  height: 78px;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background: #080809;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
}

.r32-merchant-product-media img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.r32-merchant-product-details {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.r32-merchant-product-title {
  width: 100%;
  margin: 0;
  padding: 0;
  color: #fffaf0;
  background: transparent;
  border: 0;
  font-family: Cinzel, Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-align: left;
}

.r32-merchant-product-title:hover,
.r32-merchant-product-title:focus-visible {
  color: var(--gold);
  outline: 0;
}

.r32-merchant-product-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.r32-merchant-product-badge {
  padding: 2px 5px;
  color: var(--gold);
  border: 1px solid rgba(212, 175, 55, 0.38);
  border-radius: 3px;
  font-size: 7.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.r32-merchant-product-price {
  color: var(--gold);
  font-size: 10px;
  font-weight: 800;
}

.r32-merchant-product-controls {
  display: flex;
  gap: 6px;
  margin-top: auto;
  padding-top: 7px;
}

.r32-merchant-product-control {
  min-height: 29px;
  margin: 0;
  padding: 5px 7px;
  border-radius: 4px;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.r32-merchant-product-control.is-view {
  color: var(--gold);
  background: rgba(212, 175, 55, 0.05);
  border: 1px solid rgba(212, 175, 55, 0.28);
}

.r32-merchant-product-control.is-add {
  flex: 1 1 auto;
  color: #17130a;
  background: linear-gradient(180deg, #e2c34f, #caa528);
  border: 1px solid #efd568;
}

.r32-merchant-product-control:disabled {
  cursor: default;
  opacity: 0.58;
}

.r32-merchant-product-status {
  min-height: 12px;
  margin-top: 5px;
  color: #bdb7a7;
  font-size: 8.5px;
  line-height: 1.25;
}

.r32-merchant-product-status.is-success {
  color: #d8c56c;
}

.r32-merchant-product-status.is-error {
  color: #e6a5a5;
}

html[data-shell-state="reduced"] .r32-merchant-recommendations {
  display: none !important;
}


/* 0.10.33 compact first-party guide for the three Roll 32 shopping paths. */
.r32-merchant-mode-guide {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.r32-merchant-mode-guide p {
  margin: 0;
}

.r32-merchant-mode-guide-lead {
  color: #fffaf0;
  font-family: Cinzel, Georgia, serif;
  font-size: 13px !important;
  font-weight: 700;
  letter-spacing: 0.015em;
}

.r32-merchant-mode-guide-section {
  display: grid;
  gap: 2px;
  padding: 7px 8px 7px 10px;
  border-left: 2px solid rgba(212, 175, 55, 0.72);
  background: rgba(0, 0, 0, 0.16);
}

.r32-merchant-mode-guide-title {
  color: #e1bd42;
  font-family: Cinzel, Georgia, serif;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.055em;
  line-height: 1.2;
  text-transform: uppercase;
}

.r32-merchant-mode-guide-section p,
.r32-merchant-mode-guide-closing {
  font-size: 12.5px !important;
  line-height: 1.42 !important;
}

.r32-merchant-mode-guide-closing {
  padding-top: 2px;
  color: rgba(255, 250, 240, 0.9);
}

.r32-merchant-mode-guide-closing strong {
  color: #e1bd42;
}
