/* ═══ SPEAK TO POST (Ren 2026-10-31) — speakpost.js. Phone only, like the
   2-step Post a task it sits in. Colours: the --ag-* tokens from
   agreements.css, so dark mode follows. ═══ */
.spk-btn, .spk-or, .spk-note, .spk-guess, .spk-sheet { display: none; }
@media (max-width: 900px) {
  #taskModalOverlay.ptk-on .modal-container, #agreementOverlay .agreement-container { position: relative; }
  .spk-btn svg, .spk-note svg, .spk-guess svg, .spk-sheet svg { fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

  /* the button (option A: soft green, like the attach button) */
  #taskModalOverlay.ptk-on .spk-btn, #agreementOverlay .spk-btn {
    display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 48px; min-height: 48px;
    margin: 0 0 6px; padding: 0; border: 1.5px solid #bfe3c8; border-radius: 14px; background: var(--ag-green-bg); color: var(--ag-green-ink);
    font-family: inherit; font-size: 15px; font-weight: 700; cursor: pointer; flex-shrink: 0;
  }
  #taskModalOverlay.ptk-on .spk-btn[hidden], #agreementOverlay .spk-btn[hidden] { display: none; }
  .spk-btn svg { width: 18px; height: 18px; }

  /* "or" divider between Speak to post and typing */
  #taskModalOverlay.ptk-on .spk-or, #agreementOverlay .spk-or {
    display: flex; align-items: center; gap: 12px; margin: 4px 0 10px; color: var(--ag-ink, #1f2a24);
    font-size: 13px; font-weight: 700; flex-shrink: 0;
  }
  #taskModalOverlay.ptk-on .spk-or::before, #taskModalOverlay.ptk-on .spk-or::after, #agreementOverlay .spk-or::before, #agreementOverlay .spk-or::after { content: ''; flex: 1; height: 1px; background: #b9c4bd; }
  #taskModalOverlay.ptk-on .spk-or[hidden], #agreementOverlay .spk-or[hidden] { display: none; }

  /* notes on the form after filling */
  #taskModalOverlay.ptk-on .spk-note, #agreementOverlay .spk-note {
    display: flex; align-items: center; gap: 10px; margin: 0 0 6px; padding: 10px 10px 10px 14px; border-radius: 16px;
    background: var(--ag-blue-bg); color: var(--ag-blue-ink); font-size: 13px; line-height: 1.4;
  }
  .spk-note svg { width: 20px; height: 20px; }
  .spk-note span { flex: 1; }
  .spk-note b { font-weight: 800; }
  .spk-note button { height: 36px; padding: 0 10px; border: 0; border-radius: 10px; background: var(--ag-card); color: var(--ag-blue-ink); font-family: inherit; font-size: 12px; font-weight: 800; white-space: nowrap; cursor: pointer; }
  #taskModalOverlay.ptk-on .spk-guess {
    display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: 12px;
    background: var(--ag-orange-bg); color: var(--ag-orange-ink); font-size: 13px; line-height: 1.4;
  }
  .spk-guess svg { width: 16px; height: 16px; margin-top: 1px; }
  #taskModalOverlay.ptk-on .spk-guessed:not(.ptk-exp), #agreementOverlay .spk-guessed { border: 1.5px dashed var(--ag-orange) !important; background: var(--ag-orange-bg) !important; }
  #taskModalOverlay.ptk-on .ptk-exp.spk-guessed button[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--ag-orange); }

  /* the full-screen sheet over the form */
  #taskModalOverlay.ptk-on .spk-sheet, #agreementOverlay .spk-sheet {
    display: flex; flex-direction: column; position: absolute; inset: 0; z-index: 30; background: var(--ag-page); color: var(--ag-ink);
    font-family: 'Inter', system-ui, sans-serif;
  }
  .spk-top { height: 56px; padding: max(8px, env(safe-area-inset-top)) 8px 0; display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
  .spk-top b { flex: 1; font-size: 18px; font-weight: 800; }
  .spk-ico { width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--ag-card); color: var(--ag-ink); display: flex; align-items: center; justify-content: center; cursor: pointer; }
  .spk-ico svg { width: 20px; height: 20px; }
  .spk-rec { height: 30px; padding: 0 10px; border-radius: 999px; background: var(--ag-pink-bg); color: var(--ag-pink-ink); font-size: 12px; font-weight: 800; display: inline-flex; align-items: center; gap: 6px; }
  .spk-rec i { width: 8px; height: 8px; border-radius: 50%; background: var(--ag-pink); animation: spkBlink 1.2s infinite; }
  .spk-body { flex: 1; min-height: 0; overflow-y: auto; padding: 8px 14px 14px; display: flex; flex-direction: column; gap: 12px; }
  .spk-card { background: var(--ag-card); border-radius: 20px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
  .spk-lbl { font-size: 12px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase; color: var(--ag-label); }
  .spk-heard { min-height: 150px; }
  .spk-heard p { margin: 0; font-size: 18px; line-height: 1.5; font-weight: 600; }
  .spk-dim { color: var(--ag-label); font-weight: 500; }
  .spk-say { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .spk-say span { height: 40px; padding: 0 10px; border-radius: 12px; background: var(--ag-green-bg); color: var(--ag-green-ink); font-size: 13px; font-weight: 700; display: flex; align-items: center; gap: 6px; }
  .spk-say svg { width: 15px; height: 15px; stroke-width: 2.6; }
  .spk-mic { flex: 1; min-height: 200px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; font-size: 14px; font-weight: 700; color: var(--ag-muted); }
  .spk-ring { width: 168px; height: 168px; border-radius: 50%; background: var(--ag-green-bg); display: flex; align-items: center; justify-content: center; animation: spkPulse 1.6s ease-in-out infinite; }
  .spk-ring2 { width: 132px; height: 132px; border-radius: 50%; background: #a9dbb5; display: flex; align-items: center; justify-content: center; }
  .spk-stop { width: 96px; height: 96px; border: 0; border-radius: 50%; background: var(--ag-green); color: #fff; display: flex; align-items: center; justify-content: center; cursor: pointer; }
  .spk-stop svg { width: 30px; height: 30px; fill: currentColor; stroke: none; }
  .spk-foot { flex-shrink: 0; display: flex; gap: 10px; padding: 12px 14px max(18px, env(safe-area-inset-bottom)); background: var(--ag-card); border-radius: 22px 22px 0 0; }
  .spk-b1, .spk-b2, .spk-b3 { height: 52px; border: 0; border-radius: 14px; font-family: inherit; font-size: 15px; font-weight: 800; display: flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; }
  .spk-b1 { flex: 1.4; background: var(--ag-green); color: #fff; }
  .spk-b2 { flex: 1; background: var(--ag-soft); color: var(--ag-ink); font-weight: 700; }
  .spk-b3 { height: 48px; background: var(--ag-green-bg); color: var(--ag-green-ink); }
  .spk-b1 svg { width: 20px; height: 20px; }
  .spk-wide { width: 100%; flex: none; }
  .spk-center { align-items: center; text-align: center; }
  .spk-pad { display: flex; flex-direction: column; gap: 10px; padding: 18px 0 6px; }
  .spk-center h2, .spk-pop h2 { margin: 0; font-size: 22px; font-weight: 800; line-height: 1.25; }
  .spk-center p, .spk-pop p { margin: 0; max-width: 310px; font-size: 15px; line-height: 1.5; color: var(--ag-muted); }
  .spk-big { width: 88px; height: 88px; border-radius: 26px; display: flex; align-items: center; justify-content: center; margin-top: 12px; }
  .spk-big svg { width: 38px; height: 38px; stroke-width: 2; }
  .spk-green { background: var(--ag-green-bg); color: var(--ag-green); }
  .spk-orange { background: var(--ag-orange-bg); color: var(--ag-orange); }
  .spk-blue { background: var(--ag-blue-bg); color: var(--ag-blue-ink); }
  .spk-dots { display: flex; gap: 8px; padding: 6px 0; }
  .spk-dots i { width: 10px; height: 10px; border-radius: 50%; background: var(--ag-green); animation: spkBlink 1.2s infinite; }
  .spk-dots i:nth-child(2) { animation-delay: .2s; }
  .spk-dots i:nth-child(3) { animation-delay: .4s; }
  .spk-row { flex-direction: row; align-items: center; text-align: left; font-size: 13px; line-height: 1.4; color: var(--ag-text); }
  .spk-row svg { width: 18px; height: 18px; color: var(--ag-blue-ink); }
  .spk-h3 { font-size: 15px; font-weight: 800; }
  .spk-field { display: flex; flex-direction: column; gap: 6px; }
  .spk-field span { font-size: 13px; font-weight: 700; color: var(--ag-label); }
  .spk-field textarea { border: 1.5px solid var(--ag-line); border-radius: 12px; padding: 12px 14px; font-family: inherit; font-size: 16px; line-height: 1.45; color: var(--ag-ink); background: var(--ag-card); resize: none; }
  .spk-steps { margin: 0; padding: 0 0 0 22px; display: flex; flex-direction: column; gap: 10px; font-size: 15px; line-height: 1.45; color: var(--ag-text); }
  .spk-steps li::marker { font-weight: 800; color: var(--ag-green-ink); }
  .spk-steps b { font-weight: 800; color: var(--ag-ink); }
  .spk-center p b { color: var(--ag-ink); }
  .spk-code { font-size: 11px; color: var(--ag-label); font-family: ui-monospace, monospace; word-break: break-all; }
  .spk-link { height: 48px; border: 0; background: none; color: var(--ag-green-ink); font-family: inherit; font-size: 15px; font-weight: 700; text-decoration: underline; cursor: pointer; }

  /* daily limit: a bottom sheet over a dim form */
  #taskModalOverlay.ptk-on .spk-sheet.spk-dim-bg, #agreementOverlay .spk-sheet.spk-dim-bg { background: rgba(16, 26, 20, .45); justify-content: flex-end; }
  .spk-pop { background: var(--ag-card); border-radius: 26px 26px 0 0; padding: 10px 18px max(22px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
  .spk-pop .spk-big { width: 64px; height: 64px; border-radius: 20px; margin: 0; }
  .spk-pop .spk-big svg { width: 30px; height: 30px; }
  .spk-grab { align-self: center; width: 44px; height: 5px; border-radius: 3px; background: var(--ag-track); }

  @keyframes spkPulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.06); } }
  @keyframes spkBlink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
  @media (prefers-reduced-motion: reduce) { .spk-ring, .spk-rec i, .spk-dots i { animation: none; } }

  /* New agreement form (Speak to fill) */
  #agreementOverlay .spk-btn { margin: 4px 0 8px; }
  #agreementOverlay .spk-note { margin: 4px 0 12px; }
  #agreementOverlay .spk-sheet { border-radius: inherit; overflow: hidden; }
}
