body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-color: var(--mt-bg-0);
  color: var(--mt-ink-0);
  font-family: var(--mt-font-sans);
  font-variant-numeric: tabular-nums;
}
.speak-stage {
  flex: 1;
  width: 100%;
  max-width: 780px;
  margin: 0 auto;
  padding: 1.25rem 1rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.speak-chat-pane {
  flex: 1 1 auto;
  min-inline-size: 0;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}
.speak-stage.has-preview {
  max-width: 1640px;
  flex-direction: row;
  align-items: flex-start;
  gap: 1rem;
}
.speak-stage.has-preview .speak-chat-pane {
  flex: 0 0 430px;
  max-width: 44%;
}
.speak-intro {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--mt-bg-1);
  border: 1px solid var(--mt-line-hair);
  border-radius: var(--mt-r-panel);
}
.speak-intro-title {
  font-family: var(--mt-font-display);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--mt-ink-0);
  margin-bottom: 0.15rem;
}
.speak-intro-sub {
  font-size: 0.82rem;
  color: var(--mt-ink-1);
}
.speak-thread {
  flex: 1;
  min-height: 360px;
  max-height: calc(100dvh - 310px);
  overflow-y: auto;
  overscroll-behavior: contain;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  padding: 1rem;
  background: var(--mt-bg-1);
  border: 1px solid var(--mt-line-hair);
  border-radius: var(--mt-r-panel);
}
.speak-stage.has-preview .speak-thread {
  min-height: 240px;
  max-height: calc(100dvh - 420px);
}
.speak-msg {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  max-width: 86%;
}
.speak-msg.assistant {
  align-self: flex-start;
}
.speak-msg.user {
  align-self: flex-end;
}
.speak-msg-meta {
  font-family: var(--mt-font-mono);
  font-size: 0.68rem;
  color: var(--mt-ink-2);
  display: flex;
  align-items: center;
  gap: 0.45rem;
}
.speak-msg.user .speak-msg-meta {
  justify-content: flex-end;
}
.speak-bubble {
  padding: 0.85rem 1rem;
  border-radius: var(--mt-r-panel);
  font-size: 0.95rem;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}
.speak-msg.assistant .speak-bubble {
  background: var(--mt-bg-2);
  border: 1px solid var(--mt-line-hair);
  color: var(--mt-ink-0);
}
.speak-msg.user .speak-bubble {
  background: color-mix(in srgb, var(--mt-accent) 18%, var(--mt-bg-2));
  border: 1px solid var(--mt-line-accent);
  color: var(--mt-ink-0);
}
.speak-msg.receipt .speak-bubble {
  background: color-mix(in srgb, var(--mt-ok) 14%, var(--mt-bg-2));
  border: 1px solid var(--mt-ok);
  color: var(--mt-ink-0);
}
.speak-starters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.speak-chip {
  appearance: none;
  min-height: 44px;
  padding: 0.5rem 0.85rem;
  border-radius: var(--mt-r-panel);
  background: var(--mt-bg-0);
  border: 1px solid var(--mt-line-hair);
  color: var(--mt-ink-1);
  font-family: var(--mt-font-sans);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.16s ease, color 0.16s ease;
}
.speak-chip:hover {
  border-color: var(--mt-accent);
  color: var(--mt-ink-0);
}
.speak-handoff-bar {
  display: none;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
  padding: 0.6rem 0.85rem;
  background: var(--mt-bg-1);
  border: 1px solid var(--mt-line-accent);
  border-radius: var(--mt-r-panel);
}
.speak-handoff-bar.visible {
  display: flex;
}
.speak-handoff-info {
  font-family: var(--mt-font-mono);
  font-size: 0.74rem;
  color: var(--mt-ink-1);
}
.speak-handoff-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.speak-contact-input {
  min-height: 44px;
  padding: 0.45rem 0.75rem;
  background: var(--mt-bg-0);
  border: 1px solid var(--mt-line-hair);
  border-radius: var(--mt-r-panel);
  color: var(--mt-ink-0);
  font-family: var(--mt-font-sans);
  font-size: 0.82rem;
  width: 220px;
}
.speak-composer {
  display: flex;
  align-items: stretch;
  gap: 0.6rem;
  background: var(--mt-bg-1);
  border: 1px solid var(--mt-line-hair);
  border-radius: var(--mt-r-panel);
  padding: 0.55rem;
}
.speak-input {
  flex: 1;
  min-height: 48px;
  max-height: 140px;
  resize: none;
  background: var(--mt-bg-0);
  border: 1px solid var(--mt-line-hair);
  border-radius: var(--mt-r-panel);
  padding: 0.65rem 0.85rem;
  color: var(--mt-ink-0);
  font-family: var(--mt-font-sans);
  font-size: 0.95rem;
  line-height: 1.45;
}
.speak-input:focus, .speak-contact-input:focus {
  outline: none;
  border-color: var(--mt-accent);
}
.speak-send-btn {
  min-height: 48px;
  min-width: 112px;
  padding: 0 1.15rem;
  border-radius: var(--mt-r-panel);
  background: var(--mt-accent);
  color: var(--mt-accent-contrast);
  border: 1px solid var(--mt-accent);
  font-family: var(--mt-font-sans);
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
}
.speak-send-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}
.speak-handoff-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0 0.9rem;
  border-radius: var(--mt-r-panel);
  background: var(--mt-bg-2);
  color: var(--mt-accent);
  border: 1px solid var(--mt-line-accent);
  font-family: var(--mt-font-mono);
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
}
.speak-handoff-btn[hidden] {
  display: none;
}
.speak-pay-card {
  margin-top: 0.65rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--mt-r-panel);
  border: 1px solid var(--mt-line-accent);
  background: var(--mt-bg-0);
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.speak-pay-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  font-family: var(--mt-font-mono);
  font-size: 0.74rem;
  color: var(--mt-accent);
}
.speak-pay-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.speak-live-receipt {
  margin-top: 0.35rem;
  font-family: var(--mt-font-mono);
  font-size: 0.74rem;
  color: var(--mt-accent);
}
.speak-link {
  color: var(--mt-accent);
  text-decoration: underline;
}
.leo-studio-dialog {
  width: min(920px, 95vw);
  max-height: 90vh;
  margin: auto;
  padding: 0;
  border: 1px solid var(--mt-line-accent);
  border-radius: var(--mt-r-panel);
  background: var(--mt-bg-1);
  color: var(--mt-ink-0);
}
.leo-studio-dialog:modal {
  overscroll-behavior: contain;
}
.leo-studio-dialog::backdrop {
  background: rgba(8, 12, 18, 0.72);
  overflow: hidden;
  overscroll-behavior: contain;
}
.poetics-surface-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 0.65rem;
  white-space: normal;
}
.poetics-surface-card {
  flex: 1 1 236px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--mt-line-hair);
  border-radius: var(--mt-r-panel);
  background: var(--mt-bg-0);
  overflow: hidden;
  text-decoration: none;
  color: var(--mt-ink-0);
  transition: border-color 0.16s ease;
}
.poetics-surface-card:hover {
  border-color: var(--mt-accent);
}
.poetics-surface-thumb {
  width: 100%;
  height: 120px;
  overflow: hidden;
  background: var(--mt-bg-1);
  border-bottom: 1px solid var(--mt-line-hair);
  display: block;
  flex-shrink: 0;
}
.poetics-surface-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  display: block;
}
.poetics-surface-body {
  padding: 0.55rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
}
.poetics-surface-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}
.poetics-surface-title {
  font-family: var(--mt-font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--mt-ink-0);
}
.poetics-surface-badge {
  font-family: var(--mt-font-mono);
  font-size: 0.68rem;
  color: var(--mt-accent);
  white-space: nowrap;
}
.poetics-surface-desc {
  font-family: var(--mt-font-sans);
  font-size: 0.74rem;
  color: var(--mt-ink-2);
  line-height: 1.4;
}
.poetics-surface-url {
  font-family: var(--mt-font-mono);
  font-size: 0.68rem;
  color: var(--mt-accent);
}
.leo-studio-shell {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem 1.1rem;
  max-height: 88vh;
  overflow-y: auto;
}
.leo-studio-head,
.leo-studio-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.leo-studio-title {
  margin: 0;
  font-family: var(--mt-font-display);
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--mt-ink-0);
}
.leo-studio-sub {
  font-family: var(--mt-font-mono);
  font-size: 0.68rem;
  color: var(--mt-ink-2);
}
.leo-studio-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--mt-line-hair);
  border-radius: var(--mt-r-panel);
  background: var(--mt-bg-0);
}
.leo-studio-label {
  font-family: var(--mt-font-mono);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--mt-accent);
}
.leo-select {
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: var(--mt-r-panel);
  border: 1px solid var(--mt-line-hair);
  background: var(--mt-bg-1);
  color: var(--mt-ink-0);
  font-family: var(--mt-font-mono);
  font-size: 0.74rem;
  flex: 1;
  min-width: 220px;
}
.leo-ai-textarea {
  width: 100%;
  min-height: 68px;
  resize: vertical;
  padding: 0.6rem 0.75rem;
  border-radius: var(--mt-r-panel);
  border: 1px solid var(--mt-line-hair);
  background: var(--mt-bg-1);
  color: var(--mt-ink-0);
  font-family: var(--mt-font-sans);
  font-size: 0.82rem;
  line-height: 1.45;
}
.leo-code-textarea {
  width: 100%;
  min-height: 230px;
  max-height: 340px;
  resize: vertical;
  padding: 0.65rem 0.8rem;
  border-radius: var(--mt-r-panel);
  border: 1px solid var(--mt-line-hair);
  background: var(--mt-bg-1);
  color: var(--mt-ink-0);
  font-family: var(--mt-font-mono);
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: pre;
  overflow-x: auto;
}
.leo-props-line {
  font-family: var(--mt-font-mono);
  font-size: 0.68rem;
  color: var(--mt-ink-2);
  line-height: 1.45;
  word-break: break-word;
}
.leo-btn-primary {
  background: var(--mt-accent);
  color: var(--mt-accent-contrast);
  border-color: var(--mt-accent);
}
.sofia-bilingual-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
}
.sofia-bilingual-col {
  flex: 1 1 260px;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.28rem;
}
.sofia-field-input {
  width: 100%;
  min-height: 44px;
  padding: 0 0.75rem;
  border-radius: var(--mt-r-panel);
  border: 1px solid var(--mt-line-hair);
  background: var(--mt-bg-1);
  color: var(--mt-ink-0);
  font-family: var(--mt-font-sans);
  font-size: 0.82rem;
}
.sofia-section-panel[hidden] {
  display: none;
}
.speak-preview-pane {
  position: sticky;
  top: 0.85rem;
  flex: 1 1 0%;
  min-inline-size: 0;
  height: calc(100dvh - 88px);
  min-height: 360px;
  max-height: calc(100dvh - 88px);
  display: flex;
  flex-direction: column;
  background: var(--mt-bg-1);
  border: 1px solid var(--mt-line-accent);
  border-radius: var(--mt-r-panel);
  overflow: hidden;
}
.speak-preview-pane[hidden] {
  display: none;
}
.speak-preview-head {
  min-height: 52px;
  padding: 0.35rem 0.65rem 0.35rem 0.85rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  background: var(--mt-bg-2);
  border-bottom: 1px solid var(--mt-line-hair);
}
.speak-preview-meta {
  flex: 1 1 auto;
  min-inline-size: 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.speak-preview-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: var(--mt-r-panel);
  background: var(--mt-ok);
}
.speak-preview-dot.loading {
  background: var(--mt-accent);
}
.speak-preview-dot.fallback {
  background: var(--mt-ink-2);
}
.speak-preview-title {
  min-inline-size: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--mt-ink-0);
}
.speak-preview-host {
  flex: 0 0 auto;
  max-width: 190px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0.15rem 0.45rem;
  border-radius: var(--mt-r-panel);
  border: 1px solid var(--mt-line-hair);
  background: var(--mt-bg-1);
  font-family: var(--mt-font-mono);
  font-size: 0.68rem;
  color: var(--mt-ink-1);
}
.speak-preview-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}
.speak-preview-icon-btn {
  appearance: none;
  min-width: 44px;
  min-height: 44px;
  padding: 0 0.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  border-radius: var(--mt-r-panel);
  border: 1px solid var(--mt-line-hair);
  background: var(--mt-bg-1);
  color: var(--mt-ink-0);
  font-family: var(--mt-font-sans);
  font-size: 0.74rem;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.speak-preview-icon-btn:hover {
  border-color: var(--mt-accent);
  background: var(--mt-bg-0);
}
.speak-preview-body {
  position: relative;
  flex: 1 1 0%;
  min-inline-size: 0;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: var(--mt-bg-0);
}
.speak-preview-loading {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 2;
  padding: 0.3rem 0.65rem;
  border-radius: var(--mt-r-panel);
  border: 1px solid var(--mt-line-accent);
  background: var(--mt-bg-1);
  font-family: var(--mt-font-mono);
  font-size: 0.68rem;
  color: var(--mt-ink-1);
  pointer-events: none;
}
.speak-preview-loading[hidden] {
  display: none;
}
.speak-preview-iframe {
  display: block;
  width: 100%;
  height: 100%;
  flex: 1 1 0%;
  min-height: 0;
  border: 0;
  background: #ffffff;
}
.speak-preview-iframe[hidden] {
  display: none;
}
.speak-preview-fallback {
  flex: 1 1 0%;
  min-inline-size: 0;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 0.75rem;
  background: var(--mt-bg-1);
}
.speak-preview-fallback[hidden] {
  display: none;
}
.speak-preview-fallback-thumb {
  width: 100%;
  max-width: 520px;
  max-height: 240px;
  object-fit: cover;
  display: block;
  border-radius: var(--mt-r-panel);
  border: 1px solid var(--mt-line-hair);
}
.speak-preview-fallback-thumb[hidden] {
  display: none;
}
.speak-preview-fallback-title {
  margin: 0;
  font-family: var(--mt-font-display);
  font-size: 1.28rem;
  font-weight: 700;
  color: var(--mt-ink-0);
  word-break: break-word;
}
.speak-preview-fallback-desc {
  margin: 0;
  max-width: 58ch;
  font-size: 0.82rem;
  line-height: 1.55;
  color: var(--mt-ink-1);
  word-break: break-word;
}
.speak-preview-fallback-note {
  margin: 0;
  font-family: var(--mt-font-mono);
  font-size: 0.68rem;
  color: var(--mt-ink-2);
}
@media (max-width: 960px) {
  .speak-stage.has-preview {
    max-width: 100%;
    flex-direction: column;
  }
  .speak-stage.has-preview .speak-chat-pane {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
  }
  .speak-preview-pane {
    position: static;
    width: 100%;
    flex: 0 0 auto;
    height: min(68dvh, 520px);
    min-height: 260px;
    max-height: 68dvh;
  }
  .speak-preview-host {
    display: none;
  }
}
@media (max-width: 640px) {
  .speak-msg {
    max-width: 94%;
  }
  .speak-contact-input {
    width: 100%;
  }
}
