/* Ask Lowtides. Uses the shared brand variables when a page defines them, with safe fallbacks.
   Light and dark palettes each set BOTH background and text, so text is never dark on dark. */
.lta-root {
  --lta-accent: var(--lt-accent, #17775f);
  --lta-accent-ink: var(--lt-accent-ink, #ffffff);
  --lta-bg: var(--lt-panel-bg, #ffffff);
  --lta-ink: var(--lt-panel-ink, #17202a);
  --lta-soft: var(--lt-panel-soft, #eef3f1);
  --lta-line: var(--lt-panel-line, #c9d4d0);
  --lta-muted: var(--lt-panel-muted, #4a5a56);
  --lta-focus: var(--lt-focus, #0b57d0);
  position: fixed; right: 16px; bottom: 16px; z-index: 2147483000;
  font: 15px/1.45 var(--lt-font, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif);
  color: var(--lta-ink);
}
@media (prefers-color-scheme: dark) {
  .lta-root:not(.lta-light) {
    --lta-accent: var(--lt-accent-dark, #3fbf9f);
    --lta-accent-ink: #06231c;
    --lta-bg: #17211e; --lta-ink: #eaf2ef; --lta-soft: #22302c; --lta-line: #3a4c47; --lta-muted: #b4c5bf;
    --lta-focus: #8ab4ff;
  }
}
.lta-root *, .lta-root *::before, .lta-root *::after { box-sizing: border-box; }
:where(.lta-root) button, :where(.lta-root) input { font: inherit; color: inherit; }
.lta-root :focus-visible { outline: 3px solid var(--lta-focus); outline-offset: 2px; }
.lta-root [hidden] { display: none !important; }

.lta-fab {
  display: flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 18px 0 8px;
  background: var(--lta-accent); color: var(--lta-accent-ink); border: 0; border-radius: 999px; cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, .28); font-weight: 600;
}
.lta-fab-icon { width: 32px; height: 32px; border-radius: 50%; background: #f4ead6; object-fit: cover; flex: 0 0 auto; }
.lta-head-icon { width: 36px; height: 36px; border-radius: 50%; background: #f4ead6; object-fit: cover; flex: 0 0 auto; }
.lta-brand { display: flex; align-items: center; gap: 8px; min-width: 0; }
.lta-fab:hover { filter: brightness(1.08); }
.lta-open .lta-fab { display: none; }

.lta-panel {
  position: absolute; right: 0; bottom: 0; width: min(380px, calc(100vw - 32px));
  height: min(560px, calc(100vh - 32px)); height: min(560px, calc(100dvh - 32px));
  display: flex; flex-direction: column; background: var(--lta-bg); color: var(--lta-ink);
  border: 1px solid var(--lta-line); border-radius: 16px; box-shadow: 0 10px 40px rgba(0, 0, 0, .35); overflow: hidden;
}
.lta-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; background: var(--lta-soft); border-bottom: 1px solid var(--lta-line); }
.lta-title { font-size: 16px; }
.lta-tools { display: flex; gap: 6px; }
.lta-icon {
  min-height: 36px; min-width: 44px; padding: 0 10px; border: 1px solid var(--lta-line); border-radius: 8px;
  background: var(--lta-bg); color: var(--lta-ink); cursor: pointer; font-size: 13px;
}
.lta-x { min-width: 44px; min-height: 44px; font-size: 20px; font-weight: 700; line-height: 1; background: var(--lta-accent); color: var(--lta-accent-ink); border-color: var(--lta-accent); }
.lta-icon.lta-on, .lta-icon[aria-pressed="true"] { background: var(--lta-accent); color: var(--lta-accent-ink); border-color: var(--lta-accent); }

.lta-log { flex: 1 1 auto; overflow-y: auto; padding: 12px; display: flex; flex-direction: column; gap: 10px; overscroll-behavior: contain; }
.lta-msg { max-width: 92%; padding: 9px 12px; border-radius: 14px; overflow-wrap: anywhere; }
.lta-msg p { margin: 0; }
.lta-bot { align-self: flex-start; background: var(--lta-soft); color: var(--lta-ink); border-bottom-left-radius: 4px; }
.lta-me { align-self: flex-end; background: var(--lta-accent); color: var(--lta-accent-ink); border-bottom-right-radius: 4px; }
.lta-wait { opacity: .75; font-style: italic; }
.lta-meta { margin-top: 6px !important; display: flex; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--lta-muted); }
.lta-tag { padding: 1px 8px; border: 1px solid var(--lta-line); border-radius: 999px; background: var(--lta-bg); color: var(--lta-muted); }
.lta-tag-claude { border-color: var(--lta-accent); color: var(--lta-ink); }
.lta-cost { padding: 1px 0; }

.lta-card { align-self: stretch; padding: 10px 12px; border: 1px solid var(--lta-accent); border-radius: 12px; background: var(--lta-bg); color: var(--lta-ink); }
.lta-card-label { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.lta-card-note { margin: 4px 0 8px; font-size: 13px; color: var(--lta-muted); }
.lta-card-row { display: flex; gap: 8px; }
.lta-card-done { border-color: var(--lta-line); background: var(--lta-soft); }
.lta-card-off { border-color: var(--lta-line); opacity: .85; }
.lta-card-done .lta-card-note, .lta-card-off .lta-card-note { margin-bottom: 0; color: var(--lta-ink); }

.lta-btn { min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--lta-line); background: var(--lta-bg); color: var(--lta-ink); cursor: pointer; font-weight: 600; }
.lta-btn-go { background: var(--lta-accent); color: var(--lta-accent-ink); border-color: var(--lta-accent); }
.lta-btn:disabled { opacity: .6; cursor: default; }

.lta-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px 12px 0; overflow: hidden; max-height: 86px; flex: 0 0 auto; }
.lta-chip { flex: 0 0 auto; min-height: 36px; padding: 0 12px; border: 1px solid var(--lta-line); border-radius: 999px; background: var(--lta-bg); color: var(--lta-ink); cursor: pointer; font-size: 13px; white-space: nowrap; }
.lta-chip:hover { border-color: var(--lta-accent); }

.lta-form { display: flex; gap: 8px; padding: 10px 12px 4px; }
.lta-input { flex: 1 1 auto; min-width: 0; min-height: 44px; padding: 0 12px; border: 1px solid var(--lta-line); border-radius: 10px; background: var(--lta-bg); color: var(--lta-ink); font-size: 16px; }
.lta-send { min-height: 44px; }
.lta-foot { margin: 0; padding: 2px 12px 10px; font-size: 12px; color: var(--lta-muted); }
.lta-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Voice row (shown while Voice is on): which voice is speaking, the picker, and Stop. */
.lta-vrow { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 6px 12px; background: var(--lta-bg); border-bottom: 1px solid var(--lta-line); font-size: 13px; }
.lta-vlabel { color: var(--lta-muted); }
.lta-vlabel:empty { display: none; }
.lta-vlabel[data-engine="premium"] { color: var(--lta-ink); font-weight: 600; }
.lta-vlab { color: var(--lta-muted); }
.lta-vsel { min-height: 36px; max-width: 100%; flex: 1 1 140px; min-width: 0; padding: 0 8px; border: 1px solid var(--lta-line); border-radius: 8px; background: var(--lta-bg); color: var(--lta-ink); font-size: 13px; }
.lta-stop { min-height: 36px; padding: 0 14px; margin-left: auto; }
.lta-status { margin: 0; padding: 6px 12px 0; font-size: 13px; color: var(--lta-ink); background: var(--lta-bg); }

/* Phones: a small round button tucked in the corner, and a full-width sheet when open. */
@media (max-width: 600px) {
  .lta-root { right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .lta-fab { padding: 0; width: 48px; justify-content: center; }
  .lta-fab-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lta-open { right: 0; bottom: 0; left: 0; top: 0; }
  .lta-panel { position: fixed; inset: 0; width: auto; height: auto; border-radius: 0; border: 0; padding-bottom: env(safe-area-inset-bottom, 0px); }
}
@media (prefers-reduced-motion: no-preference) {
  .lta-panel:not([hidden]) { animation: lta-in .16s ease-out; }
  @keyframes lta-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
}

/* Talk to AI guide / Talk to a human: top right of every page */
.lta-talkbar { background: #f3f7f5; border-bottom: 1px solid #dbe5e1; font-family: inherit; }
.lta-talkbar-in { max-width: 1200px; margin: 0 auto; padding: 6px 16px; display: flex; justify-content: flex-end; gap: 8px; }
.lta-talk { min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1.5px solid #17775f; background: #17775f; color: #fff; font-weight: 700; font-size: 15px; line-height: 1; font-family: inherit; cursor: pointer; }
.lta-talk-human { background: #fff; color: #0f5a48; }
.lta-talk:hover { filter: brightness(1.08); }
.lta-talk:focus-visible { outline: 3px solid #0b57d0; outline-offset: 2px; }
@media (min-width: 720px) { .lta-talkbar-in { padding: 6px 32px; } }
.lta-human { flex: 1 1 auto; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.lta-human[hidden] { display: none; }
.lta-human-h { font-size: 16px; }
.lta-human-note, .lta-human-said { margin: 0; font-size: 14px; line-height: 1.45; color: var(--lta-muted); }
.lta-human-said { color: var(--lta-ink); font-weight: 600; min-height: 1.2em; }
.lta-human-l { font-size: 13px; font-weight: 700; }
.lta-human .lta-input { width: 100%; box-sizing: border-box; flex: none; }
.lta-human-msg { min-height: 96px; padding: 10px; font-family: inherit; resize: vertical; }
.lta-human-row { display: flex; flex-wrap: wrap; gap: 8px; }
.lta-human-row .lta-btn { min-height: 44px; }
.lta-foot-link { background: none; border: 0; padding: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; min-height: 24px; }
.lta-honey { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

/* Sign in (ui/account.js) */
.lta-acct { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.lta-acct-who { font-size: 13px; font-weight: 600; color: #16292c; max-width: 16em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lta-talkbar-in { flex-wrap: wrap; }
.lta-acct-dlg { width: min(440px, calc(100vw - 32px)); border: 0; border-radius: 16px; padding: 20px; box-shadow: 0 20px 60px -20px rgba(10, 27, 30, .5); font-family: system-ui, -apple-system, "Segoe UI", sans-serif; color: #16292c; }
.lta-acct-dlg::backdrop { background: rgba(10, 27, 30, .55); }
.lta-acct-form { display: flex; flex-direction: column; gap: 8px; }
.lta-acct-h { margin: 0; font-size: 20px; }
.lta-acct-p, .lta-acct-fine, .lta-acct-said { margin: 0; font-size: 14px; line-height: 1.45; color: #3d5357; }
.lta-acct-said { color: #16292c; font-weight: 600; min-height: 1.3em; }
.lta-acct-l { font-size: 13px; font-weight: 700; }
.lta-acct-dlg .lta-input { width: 100%; box-sizing: border-box; min-height: 44px; padding: 0 12px; border: 1.5px solid #c9d8d4; border-radius: 10px; font: inherit; }
.lta-acct-role { border: 0; padding: 0; margin: 0; display: flex; gap: 16px; align-items: center; font-size: 15px; }
.lta-acct-role legend { float: left; margin-right: 12px; font-weight: 700; font-size: 13px; padding: 0; }
.lta-acct-role label { display: inline-flex; align-items: center; min-height: 32px; }
.lta-acct-row { display: flex; flex-wrap: wrap; gap: 8px; }
.lta-acct-row .lta-btn { min-height: 44px; padding: 0 16px; border-radius: 10px; border: 1.5px solid #17775f; background: #fff; color: #0f5a48; font-weight: 700; font-size: 15px; line-height: 1; font-family: inherit; cursor: pointer; }
.lta-acct-row .lta-btn-go { background: #17775f; color: #fff; }
.lta-acct-row .lta-btn[disabled] { opacity: .55; cursor: default; }
.lta-acct-fine a { color: #0f5a48; }

/* Talk is live: a pulsing dot on the button and on the status line */
@keyframes ltaPulse { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.6); opacity: .45; } }
.lta-icon.lta-live::before, .lta-status.lta-live::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; background: #e5484d; vertical-align: middle; animation: ltaPulse 1s ease-in-out infinite; }
.lta-icon.lta-live::before { background: #fff; }
@media (prefers-reduced-motion: reduce) { .lta-icon.lta-live::before, .lta-status.lta-live::before { animation: none; } }

/* Big Talk / Read aloud buttons and the one-line how-to */
.lta-voicebar { display: flex; gap: 8px; padding: 10px 12px 4px; background: var(--lta-bg); }
.lta-big { flex: 1 1 0; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 12px; border-radius: 12px; border: 2px solid var(--lta-accent); background: var(--lta-bg); color: var(--lta-ink); font-weight: 700; font-size: 17px; line-height: 1.1; font-family: inherit; cursor: pointer; }
.lta-big svg { width: 24px; height: 24px; flex: none; }
.lta-big[aria-pressed="true"], .lta-big.lta-on { background: var(--lta-accent); color: var(--lta-accent-ink); }
.lta-big:focus-visible { outline: 3px solid #0b57d0; outline-offset: 2px; }
.lta-big.lta-live::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #fff; animation: ltaPulse 1s ease-in-out infinite; }
.lta-howto { margin: 0; padding: 4px 12px 8px; font-size: 15px; line-height: 1.4; color: var(--lta-ink); background: var(--lta-bg); border-bottom: 1px solid var(--lta-line); }
.lta-status { font-size: 15px; }
/* Help bubbles */
.lta-tip { position: fixed; z-index: 2147483647; box-sizing: border-box; padding: 10px 12px; border-radius: 10px; background: #0A1B1E; color: #fff; font: 600 16px/1.4 system-ui, -apple-system, "Segoe UI", sans-serif; box-shadow: 0 10px 30px -10px rgba(10, 27, 30, .6); pointer-events: none; }
.lta-tip[hidden] { display: none; }
.lta-sr { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (prefers-reduced-motion: reduce) { .lta-big.lta-live::before { animation: none; } }

/* After the person closes the helper it becomes a small tab on the right edge (remembered). Tap it to reopen. */
.lta-root.lta-tab:not(.lta-open) { right: 0; bottom: auto; top: 58%; transform: translateY(-50%); }
.lta-root.lta-tab:not(.lta-open) .lta-fab { flex-direction: column; gap: 6px; width: 44px; min-height: 0; padding: 8px 0 12px; justify-content: flex-start; border-radius: 14px 0 0 14px; box-shadow: -2px 4px 14px rgba(0, 0, 0, .25); }
.lta-root.lta-tab:not(.lta-open) .lta-fab-icon { width: 32px; height: 32px; }
.lta-root.lta-tab:not(.lta-open) .lta-fab-text { position: static; width: auto; height: auto; overflow: visible; clip: auto; white-space: nowrap; writing-mode: vertical-rl; font-size: 14px; font-weight: 700; letter-spacing: .02em; }
@media (max-width: 600px) {
  .lta-root.lta-tab:not(.lta-open) { right: 0; bottom: auto; }
  .lta-root.lta-tab:not(.lta-open) .lta-fab { width: 38px; }
  .lta-root.lta-tab:not(.lta-open) .lta-fab-icon { width: 28px; height: 28px; }
  .lta-root.lta-tab:not(.lta-open) .lta-fab-text { font-size: 13px; }
}
