/* Charcounting assistant (chat.js). One dark, glassy look in both page themes, like the site's dark bands. */
.ask-fab {
  position: fixed; z-index: 35; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px));
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 20px 6px 6px; border-radius: 999px;
  border: 1px solid rgba(120, 180, 230, .3); color: #EDF4F6; font: 600 .95rem/1 var(--f-sans); letter-spacing: -.01em; cursor: pointer;
  background: linear-gradient(180deg, rgba(16, 34, 54, .94), rgba(7, 18, 31, .97));
  box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .6), inset 0 1px 0 rgba(255, 255, 255, .06);
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  transform-origin: right center; transition: box-shadow .35s, border-color .35s, translate .35s var(--ease);
}
.ask-fab::after { content: ""; position: absolute; top: 5px; right: 12px; width: 6px; height: 6px; border-radius: 50%; background: #5FB0F0; box-shadow: 0 0 10px 2px rgba(95, 176, 240, .75); }
.ask-fab:hover { translate: 0 -2px; border-color: rgba(120, 190, 240, .6); box-shadow: 0 14px 34px -12px rgba(0, 0, 0, .6), 0 0 30px -4px rgba(56, 150, 220, .6), inset 0 1px 0 rgba(255, 255, 255, .08); }
.ask-avatar { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle at 30% 25%, #2D86B2, #0D3B52 75%); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .14); }
.ask-avatar i { width: 19px; height: 12px; background: #FFFFFF; -webkit-mask: url(/mark.png) center / contain no-repeat; mask: url(/mark.png) center / contain no-repeat; }

.ask-dim { position: fixed; inset: 0; z-index: 34; background: rgba(3, 9, 13, .3); }

.ask-panel {
  position: fixed; z-index: 36; right: max(18px, env(safe-area-inset-right, 0px)); bottom: max(18px, env(safe-area-inset-bottom, 0px));
  width: min(420px, calc(100vw - 36px)); max-height: min(650px, calc(100dvh - 110px));
  display: flex; flex-direction: column; overflow: hidden; isolation: isolate; border-radius: 22px; color: #EDF4F6;
  background: linear-gradient(180deg, #0F2338 0%, #0A182A 34%, #08131F 100%);
  border: 1px solid rgba(110, 175, 230, .24);
  box-shadow: 0 40px 90px -30px rgba(0, 0, 0, .8), 0 0 70px -18px rgba(43, 140, 210, .5);
  transform-origin: right bottom;
}
.ask-panel::before { content: ""; position: absolute; z-index: -1; left: 8%; right: 8%; top: -55%; height: 80%; pointer-events: none; background: radial-gradient(closest-side, rgba(56, 150, 230, .38), transparent); }
.ask-panel :focus-visible { outline: 2px solid #5FB0F0; outline-offset: 2px; }

.ask-head { display: flex; align-items: center; gap: 12px; padding: 18px 14px 12px 18px; }
.ask-head .ask-avatar { width: 42px; height: 42px; }
.ask-head .ask-avatar i { width: 22px; height: 14px; }
.ask-head > div { flex: 1; min-width: 0; display: grid; gap: 3px; }
.ask-head b { font-size: 1.04rem; font-weight: 600; font-stretch: 106%; }
.ask-head small { font-size: .76rem; line-height: 1.35; color: #93A9BC; }
.ask-status { display: inline-flex; align-items: center; gap: 6px; font-size: .76rem; color: #B8CAD8; white-space: nowrap; }
.ask-status i { width: 8px; height: 8px; border-radius: 50%; background: #3FD18A; box-shadow: 0 0 8px rgba(63, 209, 138, .8); }
.ask-status.off i { background: #7D8F96; box-shadow: none; }
.ask-x { flex: none; width: 34px; height: 34px; border: 0; border-radius: 10px; display: grid; place-items: center; background: transparent; color: #B8CAD8; cursor: pointer; transition: background .2s, color .2s; }
.ask-x:hover { background: rgba(255, 255, 255, .07); color: #FFFFFF; }
.ask-x svg { width: 18px; height: 18px; }

.ask-body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 4px 18px 12px; }
.ask-welcome { display: grid; gap: 10px; padding: 12px 0 4px; overflow: hidden; }
.ask-welcome h2 { margin: 0; font-size: 1.55rem; font-weight: 600; font-stretch: 108%; letter-spacing: -.03em; line-height: 1.15; color: #F2F8FA; }
.ask-welcome p { color: #A7BCCB; font-size: .92rem; line-height: 1.5; }
.ask-topics { margin-top: 8px; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.ask-topics button { display: flex; align-items: center; gap: 10px; padding: 12px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .07); background: rgba(255, 255, 255, .035); color: #E3EEF2; font: 500 .82rem/1.25 var(--f-sans); text-align: left; cursor: pointer; transition: border-color .2s, background .2s; }
.ask-topics button:hover { border-color: rgba(95, 176, 240, .45); background: rgba(95, 176, 240, .08); }
.ask-topics svg { flex: none; width: 18px; height: 18px; color: #9CC7DE; }

.ask-log { display: flex; flex-direction: column; gap: 14px; padding-top: 4px; }
.msg { display: flex; align-items: flex-start; gap: 10px; }
.msg .ask-avatar { width: 30px; height: 30px; }
.msg .ask-avatar i { width: 15px; height: 10px; }
.msg > div { display: grid; gap: 5px; min-width: 0; max-width: 85%; }
.msg.me { justify-content: flex-end; }
.msg.me > div { justify-items: end; }
.msg time { font: 400 .62rem/1 var(--f-mono); color: #7E95A8; }
.bubble { margin: 0; padding: 11px 14px; border-radius: 6px 16px 16px 16px; border: 1px solid rgba(255, 255, 255, .07); background: rgba(255, 255, 255, .05); font-size: .9rem; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .bubble { border-radius: 16px 6px 16px 16px; border-color: transparent; background: linear-gradient(180deg, #2F8FD0, #1E6EAD); color: #FFFFFF; }
.bubble a { color: #8FD3F2; }
.msg.me .bubble a { color: #FFFFFF; }
.ask-typing { display: inline-flex; gap: 4px; padding: 15px 14px; }
.ask-typing i { width: 6px; height: 6px; border-radius: 50%; background: #93A9BC; animation: ask-blink 1.2s infinite both; }
.ask-typing i:nth-child(2) { animation-delay: .15s; }
.ask-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ask-blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.ask-input { display: flex; gap: 8px; padding: 10px 14px 8px; }
.ask-input input { flex: 1; min-width: 0; padding: 13px 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(255, 255, 255, .04); color: #EDF4F6; font: inherit; font-size: 1rem; transition: border-color .2s, box-shadow .2s; }
.ask-input input::placeholder { color: #7E95A8; }
.ask-input input:focus { outline: none; border-color: rgba(95, 176, 240, .6); box-shadow: 0 0 0 3px rgba(95, 176, 240, .15); }
.ask-send { flex: none; width: 46px; border: 0; border-radius: 12px; display: grid; place-items: center; color: #FFFFFF; cursor: pointer; background: linear-gradient(180deg, #3196DA, #1E6EAD); box-shadow: 0 8px 20px -8px rgba(49, 150, 218, .8); transition: opacity .2s, box-shadow .2s; }
.ask-send svg { width: 19px; height: 19px; }
.ask-send:disabled { opacity: .4; cursor: default; box-shadow: none; }
.ask-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; padding: 0 16px 13px; font-size: .68rem; line-height: 1.4; color: #7E95A8; }
.ask-foot a, .ask-foot button { padding: 0; border: 0; background: none; color: #B8CAD8; font: 600 .74rem/1.4 var(--f-sans); text-decoration: underline; text-decoration-color: rgba(184, 202, 216, .35); text-underline-offset: 3px; cursor: pointer; }
.ask-foot a:hover, .ask-foot button:hover { color: #FFFFFF; }
.ask-foot span { flex-basis: 100%; }

.ask-lead { display: grid; gap: 8px; padding: 14px; border-radius: 14px; border: 1px solid rgba(255, 255, 255, .08); background: rgba(255, 255, 255, .04); }
.ask-lead b { font-size: .9rem; font-weight: 600; }
.ask-lead input, .ask-lead textarea { width: 100%; padding: 11px 12px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .1); background: rgba(0, 0, 0, .2); color: #EDF4F6; font: inherit; font-size: 1rem; }
.ask-lead textarea { min-height: 72px; resize: vertical; }
.ask-lead-send { justify-self: start; padding: 11px 16px; border: 0; border-radius: 10px; background: linear-gradient(180deg, #3196DA, #1E6EAD); color: #FFFFFF; font: 600 .88rem/1 var(--f-sans); cursor: pointer; }
.ask-lead-send:disabled { opacity: .5; cursor: progress; }
.ask-lead .err { color: #F49A9A; font-size: .82rem; }

@media (max-width: 560px) {
  .ask-fab { right: max(14px, env(safe-area-inset-right, 0px)); bottom: max(14px, env(safe-area-inset-bottom, 0px)); }
  .ask-panel { left: 8px; right: 8px; bottom: max(8px, env(safe-area-inset-bottom, 0px)); width: auto; max-height: calc(100dvh - 72px - env(safe-area-inset-top, 0px)); border-radius: 20px; }
  .ask-topics button { padding: 11px 10px; }
}
@media (prefers-reduced-motion: reduce) {
  .ask-fab { transition: none; }
  .ask-typing i { animation: none; opacity: .6; }
}
