
.aglaunch {
  position: fixed;
  z-index: 79;
  right: clamp(14px, 2.4vw, 26px);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 0;
  padding: 13px;
  border: 1px solid transparent;
  border-radius: var(--r-pill);
  background: none;
  color: var(--fg);
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
}
.aglaunch svg { width: 24px; height: 24px; flex: none; color: var(--brand); }
.aglaunch__t { display: none; white-space: nowrap; }
.aglaunch:hover,
.aglaunch:focus-visible {
  gap: 9px;
  padding: 13px 18px 13px 15px;
  border-color: var(--line);
  background: var(--surface);
}
.aglaunch:hover .aglaunch__t,
.aglaunch:focus-visible .aglaunch__t { display: inline; }
.aglaunch.is-hidden { visibility: hidden; }

@media (max-width: 900px) {
  .aglaunch,
  .aglaunch:hover,
  .aglaunch:focus-visible {
    top: auto; right: 0; bottom: 0; left: 0;
    transform: none;
    justify-content: center;
    gap: 9px;
    padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border: 0;
    border-top: 1px solid var(--line);
    border-radius: 0;
    background: var(--surface);
  }
  .aglaunch .aglaunch__t { display: inline; }
  html[data-vo-dock] .aglaunch { right: 0; }
}

html[data-vo-dock] .aglaunch { right: calc(var(--vodock-w, 460px) + 10px); }

.agpanel {
  position: fixed;
  z-index: 96;
  inset: var(--dk-top, var(--fxstrip-h, 0px)) 0 0 auto;
  width: min(420px, 100vw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  color: var(--fg);
  font-family: var(--f-sans);
  font-size: 0.9375rem;
  line-height: 1.6;
}
.agpanel[hidden] { display: none; }
@media (max-width: 560px) {
  .agpanel { width: 100vw; border-left: 0; }
}

.agpanel__head {
  flex: none;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 18px 12px 16px 20px;
  border-bottom: 1px solid var(--line);
}
.agpanel__id { flex: 1; min-width: 0; }
.agpanel__title {
  margin: 0;
  font-family: var(--f-display);
  font-size: 1.25rem;
  font-weight: 600;
  line-height: 1.15;
  letter-spacing: -0.02em;
  text-wrap: balance;
}
.agpanel__mode {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 1.4em;
  margin: 6px 0 0;
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  line-height: 1.4;
  color: var(--fg-subtle);
}
.agpanel__mode::before {
  content: "";
  flex: none;
  width: 6px;
  height: 6px;
  border: 1px solid var(--fg-subtle);
}
.agpanel[data-mode="live"] .agpanel__mode::before { border-color: var(--brand); background: var(--brand); }
.agpanel[data-mode=""] .agpanel__mode::before { display: none; }

.agpanel__tools { flex: none; display: flex; gap: 2px; }
.agpanel__ic {
  width: 36px;
  height: 36px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  background: none;
  color: var(--fg-subtle);
  cursor: pointer;
}
.agpanel__ic:hover { color: var(--fg); border-color: var(--line); }
.agpanel__ic svg { width: 16px; height: 16px; }

.agpanel__body {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}
.agpanel__body:focus { outline: none; }

.ag-empty[hidden] { display: none; }
.ag-empty__line {
  margin: 0 0 16px;
  color: var(--fg-muted);
  text-wrap: pretty;
}
.ag-seeds {
  list-style: none;
  margin: 0;
  padding: 0;
  border-top: 1px solid var(--line);
}
.ag-seeds li { border-bottom: 1px solid var(--line); }
.ag-seed {
  display: grid;
  grid-template-columns: 2.5ch minmax(0, 1fr);
  column-gap: 14px;
  align-items: baseline;
  width: 100%;
  padding: 13px 0;
  border: 0;
  background: none;
  color: var(--fg);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ag-seed__n {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  font-variant-numeric: tabular-nums;
  color: var(--fg-subtle);
}
.ag-seed__t { text-wrap: pretty; }
.ag-seed:hover,
.ag-seed:hover .ag-seed__n { color: var(--brand); }

.ag-turn + .ag-turn {
  margin-top: 22px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.ag-q {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 12px;
  color: var(--fg-muted);
  font-weight: 500;
}
.ag-q__mark { flex: none; font-family: var(--f-mono); color: var(--brand); }
.ag-q__t { min-width: 0; overflow-wrap: anywhere; text-wrap: pretty; }

.ag-a { animation: ag-in 0.32s var(--dk-ease, ease-out) both; }
@keyframes ag-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ag-a { animation: none; }
}
.ag-a > * { margin: 0; }
.ag-a > * + * { margin-top: 10px; }
.ag-a__p { overflow-wrap: anywhere; text-wrap: pretty; }

.ag-fig {
  font-family: var(--f-mono);
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  word-spacing: -0.3em;
}

.ag-a--none {
  padding-left: 14px;
  border-left: 2px solid var(--fg-subtle);
}
.ag-a__flag,
.ag-a__loose,
.ag-wait {
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  line-height: 1.5;
  color: var(--fg-subtle);
}
.ag-a .ag-a__loose { margin-top: 12px; }

.ag-a--withheld { color: var(--fg-subtle); }

.ag-wait { margin: 0; }
.ag-wait__s { margin-left: 1ch; font-variant-numeric: tabular-nums; }

.ag-cites {
  list-style: none;
  margin: 0;
  padding: 10px 0 0;
  border-top: 1px solid var(--line);
  display: grid;
  gap: 2px;
}
.ag-a .ag-cites { margin-top: 14px; }
.ag-cite {
  display: grid;
  grid-template-columns: 4ch minmax(0, 1fr);
  column-gap: 8px;
  align-items: baseline;
  width: 100%;
  padding: 3px 0;
  border: 0;
  background: none;
  color: var(--fg-subtle);
  font-family: var(--f-mono);
  font-size: 0.6875rem;
  line-height: 1.5;
  text-align: left;
}
.ag-cite__p { font-variant-numeric: tabular-nums; }
.ag-cite__t { text-wrap: balance; }
button.ag-cite { color: var(--fg); cursor: pointer; }
button.ag-cite .ag-cite__p { color: var(--brand); }
button.ag-cite .ag-cite__t {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--fg-subtle);
  text-underline-offset: 0.25em;
}
button.ag-cite:hover .ag-cite__t { color: var(--brand); text-decoration-color: var(--brand); }

.agpanel__foot {
  flex: none;
  padding: 14px 20px 16px;
  border-top: 1px solid var(--line);
}
.agpanel__form { display: flex; gap: 8px; }
.agpanel__in {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: none;
  color: var(--fg);
  font: inherit;
}
.agpanel__in::placeholder { color: var(--fg-subtle); opacity: 1; }
.agpanel__in:hover { border-color: var(--fg-subtle); }
.agpanel__send {
  flex: none;
  width: 42px;
  height: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--brand);
  border-radius: var(--r-sm);
  background: none;
  color: var(--brand);
  cursor: pointer;
}
.agpanel__send:hover { background: var(--brand); color: var(--brand-fg); }
.agpanel__send:disabled { border-color: var(--line); background: none; color: var(--fg-subtle); cursor: default; }
.agpanel__send svg { width: 17px; height: 17px; }
.agpanel__note {
  margin: 10px 0 0;
  font-size: 0.75rem;
  line-height: 1.4;
  color: var(--fg-subtle);
  text-wrap: pretty;
}

@media (pointer: coarse) {
  .agpanel__ic { width: 44px; height: 44px; }
  .agpanel__in, .agpanel__send { height: 44px; }
  .agpanel__send { width: 44px; }
  .agpanel__in { font-size: 1rem; }
  button.ag-cite { min-height: 44px; align-items: center; }
  button.ag-cite .ag-cite__p, button.ag-cite .ag-cite__t { align-self: center; }
}

@media print {
  .aglaunch, .agpanel { display: none !important; }
}
