/* Speak uses the shared app shell. Only the communication workspace is styled here. */
body.sc-speak-body { background: var(--sc-native-bg); }
body.sc-speak-body .sc-app-shell { min-height: 0 !important; }
body.sc-speak-body .sc-app-shell main.sc-app-main {
  display: block; width: 100%; max-width: 960px !important; margin-inline: auto;
  padding: 12px max(16px, env(safe-area-inset-right)) 16px max(16px, env(safe-area-inset-left)) !important;
}
body.sc-speak-body .sc-product-bar { padding-top: env(safe-area-inset-top, 0px); }
body.sc-speak-body .sc-product-bar__inner { min-height: 64px; padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
#speak-board { width: 100%; max-width: 100%; margin-inline: auto; color: var(--fnd-navy); overflow-anchor: none; }
#speak-board :is(button, textarea, input) { font-family: inherit; -webkit-tap-highlight-color: transparent; }
#speak-board button { touch-action: manipulation; cursor: pointer; }
#speak-board [hidden] { display: none !important; }
#speak-board :is(button, a, textarea, input):focus-visible { outline: 3px solid var(--fnd-magenta); outline-offset: 2px; }
#speak-board button:disabled { cursor: default; opacity: .55; }
.speak-heading { margin: 8px 0 20px; }
#speak-board h1 { font-size: clamp(1.75rem, 5vw, 2.25rem); line-height: 1.15; letter-spacing: -.025em; margin: 0 0 8px; }
#speak-board h2 { font-size: 1.5rem; margin: 16px 0; }
.speak-heading p { font-size: 1.125rem; margin: 0; }
.speak-phrases { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.speak-phrase { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; min-height: 112px; padding: 16px 10px; border: 2px solid var(--fnd-border-strong); border-radius: 16px; background: #fff; color: var(--fnd-navy); font-size: 1.375rem; line-height: 1.2; font-weight: 750; overflow-wrap: anywhere; }
.speak-phrase .bi { font-size: 1.8rem; line-height: 1; }
.speak-phrase--yes { background: var(--fnd-success-bg); border-color: var(--fnd-success); color: var(--fnd-success); }
.speak-phrase--no { background: var(--fnd-danger-bg); border-color: var(--fnd-danger); color: var(--fnd-danger); }
.speak-phrase--mint { background: #e7f6ee; border-color: #1f7a4d; color: #145c38; }
.speak-phrase--sky { background: #e7f2fb; border-color: #1a5f99; color: #0f4470; }
.speak-phrase--lilac { background: #f3eefe; border-color: #6b4ea3; color: #4d3478; }
.speak-phrase--butter { background: #fff6d8; border-color: #8a6a00; color: #6b5200; }
.speak-phrase--peach { background: #ffefe4; border-color: #b85a24; color: #8a3e12; }
.speak-phrase--sand { background: #f6f1ea; border-color: #7a6248; color: #5c4632; }
.speak-rows { display: grid; gap: 14px; margin-top: 18px; }
.speak-row { padding: 14px 14px 16px; border-radius: 22px; background: rgba(0, 43, 95, 0.045); }
.speak-row__title { margin: 0 0 10px; text-align: left; color: var(--fnd-navy); font-size: 1rem; font-weight: 750; letter-spacing: 0.01em; }
.speak-choice { border: 0; margin: 18px 0 0; padding: 0; }
.speak-choice legend { font-weight: 750; font-size: 1.25rem; margin-bottom: 10px; }
.speak-icon-picker, .speak-tone-picker { display: flex; flex-wrap: wrap; gap: 8px; }
.speak-icon-choice, .speak-tone-choice { min-width: 52px; min-height: 52px; padding: 8px 12px; border: 2px solid var(--fnd-border-strong); border-radius: 14px; background: #fff; color: var(--fnd-navy); font-size: 1rem; font-weight: 700; }
.speak-icon-choice { font-size: 1.4rem; }
.speak-icon-choice.is-selected, .speak-tone-choice.is-selected { box-shadow: inset 0 0 0 3px var(--fnd-navy); }
#speak-button-place { display: block; width: 100%; min-height: 64px; margin-top: 8px; padding: 12px; border: 2px solid var(--fnd-border-strong); border-radius: 12px; background: #fff; color: var(--fnd-navy); font-size: 1.125rem; }
.speak-row-editor { display: grid; gap: 10px; margin: 16px 0; padding: 14px; border-radius: 18px; background: rgba(0, 43, 95, 0.045); }
.speak-row-editor label { font-weight: 750; }
.speak-row-editor input { width: 100%; min-height: 56px; padding: 12px; border: 2px solid var(--fnd-border-strong); border-radius: 12px; font-size: 1.125rem; color: var(--fnd-navy); background: #fff; }
.speak-row-editor__tools { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.speak-row-editor__tools .speak-button { min-height: 52px; font-size: 1rem; }
.speak-phrase.is-selected { box-shadow: inset 0 0 0 3px currentColor; }
.speak-phrase:active, .speak-button:active, .speak-keys button:active, .speak-edit-keys button:active { background: #e3eaf4; color: var(--fnd-navy); }
.speak-page-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.speak-button { display: flex; justify-content: center; align-items: center; gap: 10px; width: 100%; min-height: 64px; padding: 14px 12px; border: 2px solid var(--fnd-border-strong); border-radius: 14px; background: #fff; color: var(--fnd-navy); font-size: 1.25rem; font-weight: 700; line-height: 1.3; }
.speak-button--primary { background: var(--fnd-navy); color: #fff; border-color: var(--fnd-navy); }
.speak-return { justify-content: flex-start; }
.speak-type-link { margin-top: 16px; }
.speak-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.speak-customise { flex: 0 0 auto; margin-top: 2px; min-height: 36px; padding: 6px 12px; border: 1.5px solid var(--fnd-border-strong); border-radius: 999px; background: #fff; color: var(--fnd-navy); font-size: 0.95rem; font-weight: 750; }
.speak-output { margin-top: 18px; padding: 16px; border: 1px solid var(--fnd-border); border-radius: 22px; background: #fff; box-shadow: 0 10px 28px rgba(0, 43, 95, 0.06); scroll-margin-top: 16px; }
.speak-output-label { margin: 0 0 6px; color: var(--fnd-muted); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; }
#speak-message { font-size: clamp(1.35rem, 4vw, 1.8rem); font-weight: 750; line-height: 1.25; margin: 0 0 8px; overflow-wrap: anywhere; white-space: pre-wrap; }
#speak-status { min-height: 1.25em; font-size: 0.95rem; line-height: 1.4; margin: 0 0 12px; color: var(--fnd-muted); }
.speak-playback { display: flex; gap: 8px; }
.speak-playback .speak-button { width: auto; flex: 1; min-height: 46px; padding: 8px 10px; font-size: 1rem; }
#speak-sound-help { width: auto; min-height: 36px; margin-top: 8px; padding: 4px 2px; border-color: transparent; background: transparent; color: var(--fnd-muted); font-size: 0.95rem; }
.speak-form-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.speak-form-actions .speak-button { width: auto; flex: 1 1 6rem; min-height: 48px; padding: 8px 12px; font-size: 1rem; }
.speak-add-tile { display: flex; align-items: center; justify-content: center; width: 100%; min-height: 64px; margin-top: 12px; border: 1.5px dashed var(--fnd-navy); border-radius: 16px; background: transparent; color: var(--fnd-navy); font-size: 1.05rem; font-weight: 750; }
.speak-selection { margin-top: 12px; padding: 12px; border-radius: 16px; background: rgba(0, 43, 95, 0.045); }
.speak-selection__title { margin: 0 0 8px; color: var(--fnd-navy); font-size: 0.95rem; }
.speak-selection__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.speak-selection__actions .speak-button { width: auto; min-height: 42px; padding: 6px 10px; font-size: 0.95rem; }
.speak-svg-icon { display: inline-flex; width: 1.8rem; height: 1.8rem; }
.speak-svg-icon svg { width: 100%; height: 100%; }
.speak-help, .speak-hint { font-size: 1rem; line-height: 1.5; color: var(--fnd-muted); margin: 20px 0 12px; }
.speak-help { padding-bottom: 8px; }
/* Keep the message, Speak action and editing tools together in both orientations. */
#speak-type-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
#speak-type-toolbar .speak-return { grid-column: 1 / -1; }
#speak-type-toolbar .speak-button { width: auto; min-height: 48px; padding: 8px 12px; font-size: 1rem; }
#speak-type-toolbar #speak-custom { font-size: 1.125rem; }
#speak-draft { display: block; width: 100%; min-width: 0; height: 64px; min-height: 48px; resize: vertical; border: 2px solid var(--fnd-border-strong); border-radius: var(--radius-md); background: var(--surface); color: var(--fnd-navy); padding: 8px 12px; font-size: 1.25rem; line-height: 1.3; }
#speak-draft::placeholder { color: var(--fnd-muted); opacity: 1; }
#speak-rotate-hint { display: flex; align-items: center; gap: 12px; margin: 8px 0; font-size: .875rem; line-height: 1.35; }
#speak-rotate-hint i { flex: 0 0 auto; font-size: 1.5rem; }
.speak-using-native-keyboard #speak-rotate-hint { display: none; }
.speak-keys { display: grid; gap: 6px; margin-top: 8px; }
.speak-key-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.speak-key-row button { flex: 0 0 calc((100% - 24px) / 5); }
.speak-key-row:last-child:nth-child(3) button { flex-basis: calc((100% - 18px) / 4); }
.speak-keys button, .speak-edit-keys button { min-height: 44px; min-width: 44px; border: 1px solid var(--fnd-border-strong); border-radius: var(--radius-sm); background: var(--surface); color: var(--fnd-navy); font-size: 1.25rem; line-height: 1.2; font-weight: 700; padding: 8px 4px; }
.speak-edit-keys { display: grid; grid-template-columns: repeat(4, minmax(44px, 1fr)) minmax(0, 1.7fr); gap: 6px; margin-top: 8px; }
.speak-edit-keys button { font-size: .875rem; overflow-wrap: anywhere; }
@media (max-width: 359px) {
  .speak-edit-keys { grid-template-columns: repeat(4, minmax(44px, 1fr)); }
  .speak-keyboard-choice { grid-column: 1 / -1; }
}
#speak-undo { grid-column: 1 / -1; }
#speak-online { display: grid; gap: 12px; margin-top: 16px; }
#speak-voice-note { margin: 8px 0 0; font-size: .875rem; line-height: 1.35; }
#speak-board[data-active-screen="type"] > :is(.speak-help, #speak-offline-status, #speak-account-status, #speak-account-actions, #speak-download-status, #speak-retry-downloads) { display: none; }
/* Wide displays keep the familiar three QWERTY rows. On a narrow phone, each
   row wraps into larger targets instead of shrinking keys or scrolling sideways. */
@media (min-width: 600px) {
  #speak-rotate-hint { display: none; }
  #speak-type-toolbar { grid-template-columns: auto minmax(0, 1fr) auto; }
  #speak-type-toolbar .speak-return { grid-column: auto; }
  .speak-key-row { flex-wrap: nowrap; }
  .speak-key-row button, .speak-key-row:last-child:nth-child(3) button { flex-basis: calc((100% - 54px) / 10); }
  .speak-keys button { min-height: 56px; font-size: 1.5rem; }
  .speak-edit-keys { grid-template-columns: 2fr repeat(3, 1fr) 2fr; }
  .speak-edit-keys button { font-size: 1rem; min-height: 48px; }
}
/* A short landscape viewport budgets space for both standard navigation bars.
   Text enlargement still reflows naturally; nothing is clipped to a fixed height. */
@media (min-width: 600px) and (max-height: 500px) {
  body.sc-speak-body .sc-product-bar__inner { min-height: 56px; padding-block: 4px !important; }
  body.sc-speak-body .sc-product-brand img { height: 44px !important; width: auto !important; }
  body.sc-speak-body .sc-app-shell main.sc-app-main { padding-top: 6px !important; padding-bottom: 6px !important; }
  #speak-type-toolbar { gap: 6px; }
  #speak-type-toolbar .speak-button { min-height: 44px; padding: 4px 8px; }
  #speak-draft { height: 48px; padding: 4px 8px; font-size: 1.125rem; }
  .speak-keys { gap: 4px; margin-top: 6px; }
  .speak-keys button { min-height: 44px; padding-block: 4px; font-size: 1.25rem; }
  .speak-edit-keys { margin-top: 6px; }
  .speak-edit-keys button { min-height: 44px; padding-block: 4px; }
  .speak-heading { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 16px; margin: 0 0 8px; }
  #speak-board h1 { margin: 0; font-size: 1.5rem; }
  .speak-heading p { font-size: 1rem; }
  .speak-phrases { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
  .speak-phrase { flex-direction: row; min-height: 64px; gap: 8px; padding: 8px; font-size: 1.125rem; }
  .speak-phrase .bi { font-size: 1.5rem; }
  .speak-page-actions { margin-top: 8px; gap: 8px; }
  .speak-page-actions .speak-button { min-height: 48px; padding: 8px; font-size: 1rem; }
}
.speak-sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.speak-notice { padding: 16px; border: 2px solid #aa0077; }
@media (max-width: 359px) { .speak-phrase { font-size: 1.25rem; } }
@media (min-width: 600px) and (min-height: 501px) { .speak-phrase { min-height: 124px; font-size: 1.5rem; } }
@media (forced-colors: active) { .speak-phrase.is-selected { outline: 4px solid Highlight; outline-offset: -6px; } }

/* Editing is deliberately separate from the one-tap speaking board. */
.speak-setup-link { margin-top: 28px; background: transparent; }
.speak-voice-picker { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 10px; margin: 8px 0 18px; }
.speak-voice-choice { display: grid; gap: 2px; justify-items: start; min-height: 72px; padding: 12px 14px; border: 2px solid var(--fnd-border-strong); border-radius: 16px; background: #fff; color: var(--fnd-navy); text-align: left; }
.speak-voice-choice strong { font-size: 1.15rem; }
.speak-voice-choice span { color: var(--fnd-muted); font-size: 0.95rem; font-weight: 650; }
.speak-voice-choice.is-selected { box-shadow: inset 0 0 0 3px var(--fnd-navy); }
.speak-arrange-list { list-style: none; padding: 0; margin: 12px 0 28px; display: grid; gap: 10px; }
.speak-arrange-row { border: 2px solid var(--fnd-border-strong); border-radius: 14px; overflow: hidden; background: #fff; }
.speak-arrange-select { display: flex; align-items: center; gap: 12px; text-align: left; width: 100%; min-height: 80px; border: 0; background: #fff; color: var(--fnd-navy); padding: 14px; font-size: 1.25rem; font-weight: 700; }
.speak-arrange-select > span:nth-child(2) { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.speak-arrange-number { color: var(--fnd-muted); font-weight: 500; min-width: 1.25em; }
.speak-arrange-tools { padding: 0 12px 12px; display: grid; gap: 10px; }
.speak-arrange-row.is-active { border-color: var(--fnd-navy); }
.speak-arrange-row.is-active .speak-arrange-select { background: #e8eef7; margin-bottom: 12px; }
.speak-move-pair { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 7rem), 1fr)); gap: 10px; }
.speak-move-pair .speak-button { flex-wrap: wrap; }
.speak-arrange-tools .speak-hint { margin: 0; }
.speak-editor-actions { display: flex; gap: 8px; position: sticky; bottom: calc(4.25rem + env(safe-area-inset-bottom)); padding: 12px 0; background: var(--sc-native-bg); z-index: 4; }
.speak-editor-actions .speak-button { width: auto; flex: 1; min-height: 48px; font-size: 1rem; }
.speak-button-form label { display: block; font-weight: 750; font-size: 1.25rem; margin-top: 24px; }
.speak-button-form input, .speak-button-form textarea { display: block; width: 100%; min-height: 64px; padding: 14px; border: 2px solid var(--fnd-border-strong); border-radius: 12px; color: var(--fnd-navy); background: #fff; font-size: 1.25rem; }
.speak-button-form textarea { resize: vertical; margin-top: 12px; }
.speak-button-form .speak-hint { margin-top: 8px; }
#speak-account-actions { display: grid; gap: 12px; margin-top: 12px; }
#speak-download-status:empty, #speak-account-status:empty, #speak-arrange-status:empty, #speak-form-status:empty { display: none; }
.speak-account-check [data-screen], .speak-account-check .speak-output, .speak-account-check .speak-heading { display: none; }
.speak-arrange-select:focus-visible { outline-offset: -5px; }
.speak-button { text-decoration: none; overflow-wrap: anywhere; }

.speak-button-form .speak-editor-actions { position: static; }

.speak-arrange-select > span:last-child { font-size: 1rem; }

.speak-skip { position: absolute; top: -6rem; left: 1rem; z-index: 10; padding: 1rem; border-radius: .5rem; background: var(--fnd-navy); color: #fff; font-weight: 700; }
.speak-skip:focus { top: max(1rem, env(safe-area-inset-top)); }
@media (max-height: 540px) { #speak-draft:read-only, .speak-compose-action, .speak-editor-actions { position: static; } }

body.sc-speak-body #speak-board .speak-sr-only { margin: 0; padding: 0; border: 0; }

/* iPad: more large buttons on the first screen. Phones stay at two columns. */
html.sc-ipad .speak-phrases {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
html.sc-ipad #speak-main [data-open="more"],
html.sc-ipad #speak-more .speak-return,
html.sc-ipad #speak-more .speak-type-link {
  display: none !important;
}
html.sc-ipad #speak-main .speak-page-actions {
  grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 1080px) {
  html.sc-ipad .speak-phrases {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
}
@media (min-width: 1280px) {
  html.sc-ipad .speak-phrases {
    grid-template-columns: repeat(8, minmax(0, 1fr));
  }
}
