/* Speak Now sentence builder — Phase 235 / 239 / 241 / 242 */

/* Phase 236 — left-align within main content; keep max-width (not full stretch). */
.fb-speak-now-root {
  max-width: 52rem;
  margin: 0;
  margin-inline: 0;
  padding: 0 0 2rem;
  position: relative;
}

/*
 * Phase 237 — sticky sentence builder while vocabulary scrolls.
 */
.fb-speak-now-sentence {
  position: -webkit-sticky;
  position: sticky;
  top: 0.5rem;
  z-index: 5;
  margin: 0 0 1.25rem;
  padding: 0.75rem 0.85rem 0.85rem;
  max-width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 2px solid var(--vds-border, #d8d0e8);
  border-radius: 1rem;
  box-shadow: 0 4px 16px rgba(40, 20, 70, 0.08);
}

@media (max-width: 991.98px) {
  .fb-speak-now-sentence {
    top: calc(var(--topbar-height, 3.625rem) + 0.35rem);
  }
}

/* Phase 241 — editable sentence (type or tap). */
.fb-speak-now-sentence__input {
  display: block;
  width: 100%;
  min-height: 3.5rem;
  max-height: min(8.5rem, 28vh);
  margin: 0;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--vds-border, #d8d0e8);
  border-radius: 0.85rem;
  background: #faf8fd;
  color: #2a2140;
  font: inherit;
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.35;
  resize: none;
  overflow-x: hidden;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  box-sizing: border-box;
}

.fb-speak-now-sentence__input::placeholder {
  color: var(--vds-muted, #6b6280);
  font-weight: 500;
}

.fb-speak-now-sentence__input:focus {
  outline: 3px solid var(--vds-focus, #7c3aed);
  outline-offset: 2px;
}

.fb-speak-now-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 0.7rem;
}

.fb-speak-now-actions .vds-btn,
.fb-speak-now-actions .fb-speech-button {
  min-height: 3rem;
  min-width: 6.25rem;
  font-size: 1.05rem;
}

.fb-speak-now-hear[disabled],
.fb-speak-now-hear[aria-disabled="true"] {
  opacity: 0.45;
  pointer-events: none;
}

.fb-speak-now-block {
  margin-bottom: 1.35rem;
}

.fb-speak-now-quick-block {
  margin-bottom: 1rem;
}

.fb-speak-now-heading {
  margin: 0 0 0.65rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: #2a2140;
}

.fb-speak-now-chip-row,
.fb-speak-now-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.fb-speak-now-word,
.fb-speak-now-chip {
  appearance: none;
  border: 2px solid var(--vds-border, #d8d0e8);
  background: #fff;
  color: #2a2140;
  border-radius: 0.85rem;
  min-height: 3rem;
  padding: 0.45rem 0.9rem;
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  text-align: center;
}

.fb-speak-now-chip--quick {
  background: #f3eefc;
  border-color: #cbb8ef;
}

.fb-speak-now-word:focus-visible,
.fb-speak-now-chip:focus-visible,
.fb-speak-now-tab:focus-visible,
.fb-speak-now-move:focus-visible {
  outline: 3px solid var(--vds-focus, #7c3aed);
  outline-offset: 2px;
}

.fb-speak-now-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-bottom: 0.75rem;
}

.fb-speak-now-tab {
  appearance: none;
  border: 2px solid transparent;
  background: #efeaf8;
  color: #2a2140;
  border-radius: 999px;
  min-height: 2.75rem;
  padding: 0.35rem 0.95rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

.fb-speak-now-tab[aria-selected="true"] {
  background: #6d28d9;
  color: #fff;
}

.fb-speak-now-empty {
  margin: 0;
  color: var(--vds-muted, #6b6280);
  font-size: 1.05rem;
}

/* Phase 242 — three independently reorderable content boxes. */
.fb-speak-now-box-slot {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  max-width: 100%;
}

.fb-speak-now-box {
  margin: 0;
  padding: 0;
  max-width: 100%;
  box-sizing: border-box;
  background: #fff;
  border: 2px solid var(--vds-border, #d8d0e8);
  border-radius: 1rem;
  overflow: hidden;
  /* Phase 247 — comfortable clearance under sticky sentence when scrolling into view. */
  scroll-margin-top: 7.5rem;
}

@media (max-width: 991.98px) {
  .fb-speak-now-box {
    scroll-margin-top: calc(var(--topbar-height, 3.625rem) + 7rem);
  }
}

.fb-speak-now-box__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.75rem;
  background: #f7f4fc;
  border-bottom: 1px solid var(--vds-border, #d8d0e8);
  box-sizing: border-box;
}

.fb-speak-now-box__title {
  margin: 0;
  flex: 1 1 auto;
  min-width: 0;
}

.fb-speak-now-box__body {
  padding: 0.85rem 0.9rem 1rem;
  box-sizing: border-box;
}

.fb-speak-now-box__moves {
  display: inline-flex;
  flex-shrink: 0;
  align-items: center;
  gap: 0.35rem;
  position: relative;
  z-index: 2;
}

.fb-speak-now-move {
  min-width: 2.75rem;
  min-height: 2.75rem;
  padding: 0.25rem 0.45rem;
  font-size: 1.2rem;
  font-weight: 700;
  line-height: 1;
  position: relative;
  z-index: 2;
}

.fb-speak-now-move[hidden] {
  display: none !important;
}

/* Phase 239 — progressive disclosure (More words & tools). */
.fb-speak-now-more {
  margin: 0;
}

.fb-speak-now-more__header {
  padding: 0.35rem 0.45rem 0.35rem 0.25rem;
  gap: 0.35rem;
}

.fb-speak-now-more__toggle {
  appearance: none;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex: 1 1 auto;
  min-width: 0;
  min-height: 3.1rem;
  padding: 0.55rem 0.75rem;
  border: 0;
  border-radius: 0.65rem;
  background: transparent;
  color: #2a2140;
  font-size: 1.15rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.fb-speak-now-more__toggle:focus-visible {
  outline: 3px solid var(--vds-focus, #7c3aed);
  outline-offset: 2px;
}

.fb-speak-now-more__chevron {
  display: inline-block;
  width: 1.1rem;
  flex-shrink: 0;
}

.fb-speak-now-more__panel {
  padding: 0.85rem 1rem 1.1rem;
  border-top: 0;
}

.fb-speak-now.vds-page--blank-canvas .vds-workspace-hero,
.fb-speak-now .vds-workspace-hero {
  /* Phase 258 — shared page-header-gap only; no Speak Now header height/opacity */
  margin-bottom: var(--page-header-gap);
}

@media (max-width: 640px) {
  .fb-speak-now-sentence__input {
    min-height: 3.25rem;
    max-height: min(7.5rem, 26vh);
    font-size: 1.15rem;
  }

  .fb-speak-now-actions .vds-btn,
  .fb-speak-now-actions .fb-speech-button {
    flex: 1 1 calc(50% - 0.55rem);
  }

  .fb-speak-now-hear {
    flex: 1 1 100% !important;
  }

  .fb-speak-now-sentence {
    max-height: min(46vh, 18rem);
  }

  .fb-speak-now-sentence__input {
    max-height: min(5.5rem, 18vh);
  }

  .fb-speak-now-box__header {
    flex-wrap: wrap;
  }

  .fb-speak-now-move {
    min-width: 3rem;
    min-height: 3rem;
  }
}
