/* Ask Ria anywhere: Ria's round button, circling, and her sheet (phone) or side panel (from 1180px). Design A,
   Spoorthi's pick on the canvas (28 Sep 2026). On app.css's tokens; Ria's violet only for Ria's things, terracotta only
   for Send. */
.ask-btn { position: fixed; right: 16px; bottom: var(--ask-bottom, 16px); z-index: 45; width: 52px; height: 52px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 50%; background: var(--sheet); color: var(--ria); box-shadow: 0 0 0 1px var(--line-strong), 0 8px 24px rgba(61, 47, 42, .14); transition: bottom .16s ease, transform .1s ease; }
.ask-btn:hover { box-shadow: 0 0 0 1px var(--ria), 0 8px 24px rgba(61, 47, 42, .16); }
.ask-btn:active { transform: scale(.96); }
.ask-btn .ico { width: 24px; height: 24px; }
.ask-btn[hidden], .ask-tip[hidden], .ask-veil[hidden], .ask-cont[hidden], .ask-form[hidden] { display: none; }
:root[data-theme="dark"] .ask-btn { box-shadow: 0 0 0 1px var(--line-strong), 0 8px 24px rgba(0, 0, 0, .45); }
@media (min-width: 1180px) { .ask-btn { right: 24px; } }

.ask-tip { position: fixed; right: 16px; bottom: calc(var(--ask-bottom, 16px) + 64px); z-index: 45; width: 236px; display: grid; gap: 2px; padding: 12px 14px 0; border-radius: 14px; background: var(--ink); color: var(--ground); font-size: 14px; line-height: 1.45; box-shadow: 0 8px 24px rgba(61, 47, 42, .18); pointer-events: none; }
.ask-tip::after { content: ""; position: absolute; right: 20px; bottom: -6px; width: 12px; height: 12px; background: var(--ink); transform: rotate(45deg); }
.ask-tip-ok { pointer-events: auto; justify-self: start; min-height: 44px; padding: 0; border: 0; background: none; color: #DFA78F; font-weight: 600; }
:root[data-theme="dark"] .ask-tip-ok { color: #A64A30; }
@media (min-width: 1180px) { .ask-tip { right: 24px; } }

.ask-veil { position: fixed; inset: 0; z-index: 70; background: rgba(61, 47, 42, .10); touch-action: none; cursor: crosshair; -webkit-user-select: none; user-select: none; }
:root[data-theme="dark"] .ask-veil { background: rgba(0, 0, 0, .28); }
.ask-hint { position: absolute; left: 12px; right: 12px; top: calc(10px + env(safe-area-inset-top, 0px)); max-width: 460px; margin: 0 auto; min-height: 52px; display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px 14px; border-radius: 16px; background: var(--ink); color: var(--ground); box-shadow: 0 8px 24px rgba(61, 47, 42, .2); cursor: default; }
.ask-hint-ico { display: grid; color: #B7A6E8; }
:root[data-theme="dark"] .ask-hint-ico { color: #5B4A8B; }
.ask-hint-ico .ico { width: 18px; height: 18px; }
.ask-hint-t { flex: 1; display: grid; gap: 1px; font-size: 14.5px; font-weight: 500; }
.ask-hint-t small { font-size: 13.5px; font-weight: 400; line-height: 1.4; opacity: .85; text-wrap: balance; }
.ask-cancel { min-height: 44px; padding: 0 12px; border: 0; border-radius: 12px; background: rgba(248, 244, 239, .12); color: var(--ground); font-size: 14px; font-weight: 500; }
:root[data-theme="dark"] .ask-cancel { background: rgba(28, 22, 19, .08); }
.ask-draw { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.ask-draw path, .ask-kept path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.ask-draw .u, .ask-kept .u { stroke: rgba(91, 74, 139, .18); stroke-width: 11; }
.ask-draw .l, .ask-kept .l { stroke: var(--ria); stroke-width: 3.5; }
:root[data-theme="dark"] .ask-draw .u, :root[data-theme="dark"] .ask-kept .u { stroke: rgba(183, 166, 232, .22); }
.ask-veil.empty .ask-draw { opacity: .45; transition: opacity .3s; }
.ask-veil.empty .ask-draw .u { display: none; }
.ask-veil.empty .ask-draw .l { stroke-dasharray: 2 8; }
.ask-kept { position: absolute; z-index: 44; pointer-events: none; overflow: visible; }

.ask-panel { z-index: 50; width: 100%; max-width: 100%; max-height: 86dvh; margin: auto 0 0; padding: 0; border: 0; border-radius: 22px 22px 0 0; background: var(--sheet); color: var(--ink); box-shadow: 0 -1px 0 var(--line), 0 -10px 30px rgba(61, 47, 42, .10); overflow: hidden; }
.ask-panel[open] { display: flex; flex-direction: column; }
/* the sheet's colour runs on below its bottom edge, out of sight: when an iPhone's keyboard (and its floating AutoFill bar)
   or a bounce of the page lifts the screen's edge, the story behind never shows under the box (6 Oct, her iPhone) */
@media (max-width: 1179px) { .ask-panel { margin-bottom: -40vh; padding-bottom: 40vh; max-height: calc(86dvh + 40vh); } }
.ask-panel::backdrop { background: rgba(61, 47, 42, .10); }
:root[data-theme="dark"] .ask-panel::backdrop { background: rgba(0, 0, 0, .28); }
:root[data-theme="dark"] .ask-panel { box-shadow: 0 -1px 0 var(--line), 0 -10px 30px rgba(0, 0, 0, .35); }
.ask-grip { width: 40px; height: 4px; margin: 10px auto 0; border-radius: 999px; background: var(--line-strong); flex-shrink: 0; }
.ask-head { display: flex; align-items: center; gap: 10px; padding: 6px 16px 0; flex-shrink: 0; }
.ask-head .av { width: 30px; height: 30px; }
.ask-head .av .ico { width: 16px; height: 16px; }
.ask-head b { font-size: 14.5px; font-weight: 600; }
.ask-cont { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 8px; border-radius: 10px; color: var(--accent-ink); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.ask-cont .ico { width: 15px; height: 15px; }
.ask-cont:hover { background: var(--sand-2); }
.ask-x { margin-left: auto; width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 12px; background: transparent; color: var(--muted); flex-shrink: 0; }
.ask-cont:not([hidden]) + .ask-x { margin-left: 0; }
.ask-x .ico { width: 20px; height: 20px; }
.ask-x:hover { background: var(--sand-2); color: var(--ink); }
.ask-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; display: grid; align-content: start; gap: 12px; padding: 12px 16px; }
.ask-quote { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: 12px; background: var(--sand-2); color: var(--muted); font-size: 14px; line-height: 1.5; }
.ask-quote .ico { width: 16px; height: 16px; flex-shrink: 0; margin-top: 3px; color: var(--ria); }
.ask-quote span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.ask-q { margin: 2px 0 0; font-size: 16px; line-height: 1.5; }
.ask-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.ask-chip { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 14px 8px 12px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--sheet); color: var(--ink); font-size: 14px; text-align: left; }
.ask-chip:hover { border-color: var(--ink); }
.ask-chip .ico { width: 16px; height: 16px; color: var(--ria); flex-shrink: 0; }
.ask-me-wrap { justify-self: end; display: grid; justify-items: end; gap: 6px; max-width: min(86%, 560px); }
.ask-me { padding: 10px 15px; border-radius: 18px 18px 6px 18px; background: var(--sand); font-size: 15px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.ask-note { margin: 8px 0 0; font-size: 13px; color: var(--faint); }
.ask-panel .md { font-size: 15.5px; line-height: 1.65; overflow-wrap: anywhere; }
.ask-panel .md > * { margin: 0; }
.ask-panel .md > * + * { margin-top: 10px; }
.ask-panel .md ol, .ask-panel .md ul { padding-left: 22px; }
.ask-panel .md li + li { margin-top: 5px; }
.ask-panel .md strong { font-weight: 600; }
.ask-panel .md h1, .ask-panel .md h2, .ask-panel .md h3, .ask-panel .md h4 { font: 600 16px/1.4 var(--sans); margin-top: 18px; }
.ask-panel .md a { color: var(--accent-ink); }
.ask-panel .md :not(pre) > code { font: 500 .86em/1.4 var(--mono); padding: 1px 5px; border-radius: 6px; background: var(--sand-2); }
.ask-panel .md pre { margin-top: 12px; padding: 14px 16px; border-radius: 12px; background: var(--code-bg); color: var(--code-ink); font: 13px/1.6 var(--mono); overflow-x: auto; }
.ask-panel .md pre code { background: none; padding: 0; font: inherit; }
.ask-panel .md blockquote { padding: 2px 0 2px 14px; box-shadow: inset 2px 0 0 var(--line-strong); color: var(--muted); }
.ask-panel .md table { display: block; overflow-x: auto; border-collapse: collapse; font-size: 14px; }
.ask-panel .md th, .ask-panel .md td { padding: 6px 10px; border: 1px solid var(--line); text-align: left; }
.ask-panel .caret { display: inline-block; width: 7px; height: 1.05em; margin-left: 2px; border-radius: 2px; background: var(--ria); vertical-align: text-bottom; animation: ask-blink 1s steps(2, start) infinite; }
@keyframes ask-blink { to { visibility: hidden; } }
.ask-panel .err-line { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(178, 58, 43, .08); color: var(--err); font-size: 14px; }
.ask-panel .err-line span { flex: 1 1 100%; }
.ask-panel .err-line .btn { min-height: 44px; }
.ask-panel .err-line .ico { width: 16px; height: 16px; }
.ask-form { display: flex; align-items: center; gap: 8px; margin: 0 16px 8px; padding: 4px 4px 4px 16px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--sheet); flex-shrink: 0; }
.ask-warn { margin: 0 16px calc(12px + env(safe-area-inset-bottom, 0px)); font-size: 12px; line-height: 1.4; color: var(--faint); text-align: center; flex-shrink: 0; }
.ask-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200, 92, 62, .18); }
.ask-in { flex: 1; min-width: 0; min-height: 44px; padding: 0; border: 0; background: transparent; font-size: 15.5px; outline: none; }
.ask-in::placeholder { color: var(--faint); }
.ask-send { width: 44px; height: 44px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 14px; background: var(--accent); color: var(--on-accent); flex-shrink: 0; transition: background .15s, opacity .15s; }
.ask-send:hover { background: var(--accent-hover); }
.ask-send:disabled { opacity: .4; cursor: default; }
.ask-send.stop { background: var(--ink); color: var(--ground); }
.ask-send .ico { width: 18px; height: 18px; }
.ask-send.stop .ico { width: 14px; height: 14px; }
.ask-gate { display: grid; gap: 12px; padding: 4px 0 6px; }
.ask-gate h2 { margin: 0; font: 600 28px/1.12 var(--sans); letter-spacing: -.01em; text-wrap: balance; }
.ask-gate p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.55; }
.ask-gate .btns { display: grid; gap: 10px; margin-top: 6px; }
.ask-gate .btn { min-height: 48px; font-size: 15px; }
.ask-panel.gated .ask-body { padding-bottom: calc(22px + env(safe-area-inset-bottom, 0px)); }
@media (min-width: 1180px) {
  .ask-panel { position: fixed; inset: 0 0 0 auto; width: 380px; height: 100dvh; max-height: none; margin: 0; border-radius: 0; box-shadow: -1px 0 0 var(--line), -12px 0 32px rgba(61, 47, 42, .08); }
  :root[data-theme="dark"] .ask-panel { box-shadow: -1px 0 0 var(--line), -12px 0 32px rgba(0, 0, 0, .35); }
  .ask-grip { display: none; }
  .ask-head { padding: 16px 20px 0; }
  .ask-body { padding: 14px 20px; }
  .ask-form { margin: 0 20px 8px; }
  .ask-warn { margin: 0 20px 16px; }
}
@media (prefers-reduced-motion: no-preference) {
  .ask-panel[open] { animation: ask-up .26s cubic-bezier(.16, 1, .3, 1); }
}
@media (prefers-reduced-motion: no-preference) and (min-width: 1180px) {
  .ask-panel[open] { animation-name: ask-side; }
}
@keyframes ask-up { from { transform: translateY(24px); opacity: 0; } }
@keyframes ask-side { from { transform: translateX(24px); opacity: 0; } }

/* Ria draws back: the marks on the page (Spoorthi's picks, 29 Sep). Ria's violet only; they never catch a click. */
.ask-marks { position: absolute; top: 0; left: 0; width: 0; height: 0; z-index: 44; pointer-events: none; }
.ask-mark { transition: opacity .3s; }
.ask-mark.old { opacity: .35; }
.ask-mk { position: absolute; border-radius: 5px; background: rgba(91, 74, 139, .18); }
:root[data-theme="dark"] .ask-mk { background: rgba(183, 166, 232, .22); }
.ask-mk svg { position: absolute; left: 0; bottom: -3px; overflow: visible; }
.ask-mk path { fill: none; stroke: var(--ria); stroke-width: 2.5; stroke-linecap: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
@media (prefers-reduced-motion: no-preference) {
  .ask-mk path { stroke-dashoffset: 1; animation: ask-underline .25s ease-out forwards; }
  .ask-mark.pulse .ask-mk { animation: ask-pulse .6s ease-out; }
}
@keyframes ask-underline { to { stroke-dashoffset: 0; } }
@keyframes ask-pulse { 30% { background: rgba(91, 74, 139, .38); } }

/* Ria draws back: her mention of the page's words inside an answer (Spoorthi's picks, 29 Sep) */
.ask-panel .md .ask-ref { display: inline; padding: 0 3px; margin: 0 -1px; border: 0; border-radius: 4px; background: rgba(91, 74, 139, .12); color: var(--ria); font: inherit; font-weight: 500; text-align: left; cursor: pointer; }
.ask-panel .md .ask-ref:hover { background: rgba(91, 74, 139, .2); }
:root[data-theme="dark"] .ask-panel .md .ask-ref { background: rgba(183, 166, 232, .16); }
:root[data-theme="dark"] .ask-panel .md .ask-ref:hover { background: rgba(183, 166, 232, .26); }

/* hold Option (Alt) and draw: the crosshair says the page is ready for a loop (computers with a mouse) */
html.ask-alt, html.ask-alt body, html.ask-alt a, html.ask-alt button, html.ask-alt [role="button"] { cursor: crosshair; }
.ask-veil.quick .ask-hint { display: none; }

/* once Ria has marked words, the member's own loop steps back so her mark is the strongest violet on the page */
.ask-kept.dim { opacity: .45; transition: opacity .3s; }
/* her mention reads as tappable on touch too (a dotted underline), keeps a focus ring and a pressed state, and its touch area reaches past the words */
.ask-panel .md .ask-ref { position: relative; text-decoration: underline dotted var(--ria) 1.5px; text-underline-offset: 3px; }
.ask-panel .md .ask-ref::after { content: ""; position: absolute; inset: -6px -4px; }
.ask-panel .md .ask-ref:focus-visible { outline: 2px solid var(--ria); outline-offset: 1px; }
.ask-panel .md .ask-ref:active { background: rgba(91, 74, 139, .32); }
:root[data-theme="dark"] .ask-panel .md .ask-ref:active { background: rgba(183, 166, 232, .36); }
