/* FashionTube AI panel, /ask chat (and the answer panel FTAnswer.mount puts on other pages) and subtitle-translation
   status. Loaded by ai.js. UI v2: solid surfaces only (no glass), every value from the app.css tokens, light and dark. */

/* ------------------------------------------------------------------ watch page panel (below the about box) */
.ai-panel {
  display: grid;
  gap: 16px;
  margin-top: 12px;
  padding: 14px 16px 16px;
  border-radius: var(--radius-m, 12px);
  background: var(--bg-2, #f2f2f2);
  color: var(--text, #0f0f0f);
}
.ai-panel[hidden] {
  display: none;
}

.ai-summary__head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}
.ai-summary__title {
  margin: 0;
  color: var(--text-3, #5f5f66);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ai-summary__text {
  margin: 0;
  color: var(--text, #0f0f0f);
  line-height: 1.55;
}
.ai-badge {
  display: inline-flex;
  align-items: center;
  height: 20px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--fill-2, rgb(0 0 0 / 0.09));
  color: var(--text-2, #3f3f46);
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
}

.ai-ask {
  display: grid;
  gap: 8px;
}
.ai-ask__label {
  font-size: 15px;
  font-weight: 600;
}
.ai-ask__row {
  display: flex;
  gap: 8px;
  min-width: 0;
}
.ai-ask__input {
  flex: 1;
  min-width: 0;
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: var(--bg, #fff);
  box-shadow: inset 0 0 0 1px var(--separator, rgb(0 0 0 / 0.1));
  color: inherit;
  font: inherit;
  font-size: 16px; /* no iOS zoom on focus */
  outline: none;
}
.ai-ask__input::placeholder {
  color: var(--text-3, #5f5f66);
}
.ai-ask__input:focus-visible {
  box-shadow: inset 0 0 0 2px var(--focus, #0a66ff);
}

.ai-btn {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  background: var(--accent, #0f0f0f);
  color: var(--accent-contrast, #fff);
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity var(--dur-press, 120ms), transform var(--dur-press, 120ms) var(--ease-out, ease-out);
}
.ai-btn:hover {
  opacity: 0.88;
}
.ai-btn:disabled {
  opacity: 0.5;
  cursor: progress;
}
.ai-btn:focus-visible {
  outline: 2px solid var(--focus, #0a66ff);
  outline-offset: 2px;
}
.ai-btn--small {
  height: 30px;
  padding: 0 12px;
  font-size: 13px;
}

.ai-out:empty {
  display: none;
}
.ai-out__title {
  margin: 20px 0 10px;
  font-size: 17px;
  font-weight: 700;
}
.ai-answer {
  display: grid;
  gap: 10px;
}
.ai-answer__p {
  margin: 0;
  line-height: 1.6;
  overflow-wrap: anywhere;
}
.ai-note {
  margin: 0;
  color: var(--text-2, #3f3f46);
  font-size: 13px;
}
.ai-note--soft {
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bg, #fff);
  color: var(--text, #0f0f0f);
  font-size: 14px;
}

/* timestamp citations: pills that seek the player */
.ai-cite {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  margin: 0 1px;
  padding: 1px 8px;
  border: 0;
  border-radius: 999px;
  background: var(--bg, #fff);
  box-shadow: inset 0 0 0 1px var(--separator, rgb(0 0 0 / 0.1));
  color: var(--link, #065fd4);
  font: inherit;
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  vertical-align: baseline;
}
.ai-cite:hover {
  background: var(--fill, rgb(0 0 0 / 0.05));
}
.ai-cite:focus-visible {
  outline: 2px solid var(--focus, #0a66ff);
  outline-offset: 1px;
}
.ai-cites {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-cite--chip {
  max-width: 100%;
  min-height: 36px;
  align-items: center;
  padding: 4px 12px;
  text-align: start;
}
.ai-cite__text {
  max-width: 34ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-2, #3f3f46);
  font-family: var(--font-sans, system-ui, sans-serif);
}

.ai-vref {
  display: inline-block;
  min-width: 1.5em;
  margin: 0 2px;
  padding: 0 5px;
  border-radius: 999px;
  background: var(--fill, rgb(0 0 0 / 0.05));
  color: var(--link, #065fd4);
  font-size: 0.75em;
  font-weight: 600;
  line-height: 1.6;
  text-align: center;
  text-decoration: none;
  vertical-align: super;
}

.ai-turnstile:empty {
  display: none;
}

/* subtitle-translation status: inserted by ai.js after the #sub-lang label inside the strip (see app.css .sub-strip) */
.ai-sub-status {
  color: var(--glass-text-2, #3a3a40);
  font-size: 12px;
  line-height: 1.3;
}
.ai-sub-status:empty {
  display: none;
}

/* ------------------------------------------------------------------ /ask chat (the curator) */
.ai-chat {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 760px;
  margin: 12px auto 0;
}
.ai-chat__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.ai-chat__title {
  margin: 0;
  font-size: 32px;
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.022em;
}
.ai-chat__reset {
  flex: none;
  min-height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--fill, rgb(0 0 0 / 0.05));
  color: var(--text, #0f0f0f);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ai-chat__reset:hover {
  background: var(--fill-2, rgb(0 0 0 / 0.09));
}
.ai-chat__reset[hidden],
.ai-chat__intro[hidden] {
  display: none;
}
.ai-chat__intro {
  display: grid;
  gap: 14px;
}
.ai-chat__lead {
  margin: 0;
  color: var(--text-2, #3f3f46);
  line-height: 1.55;
}
.ai-chat__suggest {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ai-chip {
  min-height: 40px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  background: var(--fill, rgb(0 0 0 / 0.05));
  color: var(--text, #0f0f0f);
  font: inherit;
  font-size: 14px;
  line-height: 1.35;
  text-align: start;
  cursor: pointer;
  transition: background var(--dur-press, 120ms);
}
.ai-chip:hover {
  background: var(--fill-2, rgb(0 0 0 / 0.09));
}
.ai-chip:active {
  background: var(--fill-3, rgb(0 0 0 / 0.14));
}
.ai-chip:focus-visible,
.ai-chat__reset:focus-visible {
  outline: 2px solid var(--focus, #0a66ff);
  outline-offset: 2px;
}

.ai-chat__log {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-chat__log:empty {
  display: none;
}
.ai-msg {
  display: grid;
  gap: 10px;
  min-width: 0;
}
.ai-msg--user {
  justify-items: end;
}
.ai-msg--assistant + .ai-msg--user {
  margin-top: 26px;
  padding-top: 26px;
  border-top: 1px solid var(--separator, rgb(0 0 0 / 0.1));
}
.ai-msg__bubble {
  max-width: min(85%, 560px);
  padding: 10px 15px;
  border-radius: 20px;
  border-end-end-radius: 6px; /* the tail on the viewer's side */
  background: var(--bg-2, #f2f2f2);
  color: var(--text, #0f0f0f);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
/* ------------------------------------------------------------------ the answer: a composed result
   steps · headline · body (marks) · Watch in the library (rail) · From the web (source cards) · follow-ups.
   Solid surfaces, app.css tokens; the only tint is the web marks' (a cool violet from the AI ring), so a web fact and its
   source card read as one thing, apart from the ink-coloured video numbers. */
.ai-chat {
  --wref-fg: rgb(84 46 206);
  --wref-bg: rgb(var(--ai-cool, 118 70 255) / 0.1);
  --wref-ring: rgb(var(--ai-cool, 118 70 255) / 0.55);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ai-chat {
    --wref-fg: rgb(196 178 255);
    --wref-bg: rgb(var(--ai-cool, 156 122 255) / 0.2);
  }
}
:root[data-theme="dark"] .ai-chat {
  --wref-fg: rgb(196 178 255);
  --wref-bg: rgb(var(--ai-cool, 156 122 255) / 0.2);
}

.ai-res {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  min-width: 0;
}

/* progress: a short list while it runs, one quiet line when done */
.ai-res__steps {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
  padding: 0;
  list-style: none;
}
.ai-res__steps[hidden] {
  display: none;
}
.ai-res[data-state="done"] .ai-res__steps {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  margin-bottom: 12px;
}
.ai-step {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text-3, #5f5f66);
  font-size: 13px;
  line-height: 18px;
}
.ai-step[data-state="active"] {
  color: var(--text-2, #3f3f46);
}
.ai-step__text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-step__n {
  flex: none;
  color: var(--text-3, #5f5f66);
}
.ai-step__n::before {
  content: "·";
  margin-inline-end: 6px;
}
.ai-step__dot {
  position: relative;
  flex: none;
  width: 12px;
  height: 12px;
  border: 1.5px solid var(--separator, rgb(0 0 0 / 0.1));
  border-radius: 50%;
}
.ai-step[data-state="active"] .ai-step__dot {
  border-color: var(--text-2, #3f3f46);
  border-top-color: transparent;
  animation: ai-spin 0.8s linear infinite;
}
.ai-step[data-state="done"] .ai-step__dot {
  border-color: var(--text-3, #5f5f66);
  background: var(--text-3, #5f5f66);
}
.ai-step[data-state="done"] .ai-step__dot::after {
  content: "";
  position: absolute;
  left: 3px;
  top: 1px;
  width: 3px;
  height: 6px;
  border: solid var(--bg, #fff);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
}
.ai-res[data-state="done"] .ai-step {
  font-size: 12px;
}
.ai-res[data-state="done"] .ai-step__dot {
  width: 10px;
  height: 10px;
}
.ai-res[data-state="done"] .ai-step__dot::after {
  left: 2.5px;
  top: 0.5px;
  height: 5px;
}
@keyframes ai-spin {
  to {
    transform: rotate(360deg);
  }
}

/* the direct answer, then the body */
.ai-res__headline {
  display: grid;
  gap: 8px;
  margin: 0 0 10px;
  color: var(--text, #0f0f0f);
  font-size: 22px;
  font-weight: 650;
  line-height: 1.32;
  letter-spacing: -0.012em;
  overflow-wrap: anywhere;
}
.ai-res__headline[hidden],
.ai-res__body[hidden],
.ai-res__sec[hidden],
.ai-res__next[hidden],
.ai-res__foot[hidden],
.ai-res__missing[hidden] {
  display: none;
}
.ai-res__hl {
  display: block;
}
.ai-res__body {
  display: grid;
  gap: 10px;
  color: var(--text, #0f0f0f);
  font-size: 16px;
  line-height: 1.62;
}
.ai-res__p {
  margin: 0;
  overflow-wrap: anywhere;
}
.ai-res__sec {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  min-width: 0;
  margin-top: 28px;
}
.ai-res__kicker {
  margin: 0;
  color: var(--text-3, #5f5f66);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  line-height: 16px;
  text-transform: uppercase;
}
:lang(zh) .ai-res__kicker,
:lang(ja) .ai-res__kicker,
:lang(ko) .ai-res__kicker,
:lang(ar) .ai-res__kicker {
  letter-spacing: 0.02em;
}
.ai-res__missing {
  margin: 0;
  color: var(--text-3, #5f5f66);
  font-size: 13px;
  line-height: 1.45;
}
.ai-res__foot {
  margin-top: 16px;
}
.ai-res > .ai-note--soft {
  margin-top: 14px;
}

/* marks: video numbers (ink) and web letters (tinted, with a globe) */
.ai-vref,
.ai-wref {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
  min-width: 18px;
  height: 18px;
  margin: 0 2px;
  padding: 0 5px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 650;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  vertical-align: 2px;
  transition: background var(--dur-press, 120ms);
}
.ai-vref {
  background: var(--fill-2, rgb(0 0 0 / 0.09));
  color: var(--text, #0f0f0f);
}
.ai-vref:hover {
  background: var(--fill-3, rgb(0 0 0 / 0.14));
}
.ai-wref {
  padding: 0 5px 0 4px;
  background: var(--wref-bg);
  color: var(--wref-fg);
}
.ai-wref:hover {
  box-shadow: inset 0 0 0 1px var(--wref-ring);
}
.ai-wref__g {
  width: 10px;
  height: 10px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.4;
}
.ai-vref:focus-visible,
.ai-wref:focus-visible {
  outline: 2px solid var(--focus, #0a66ff);
  outline-offset: 1px;
}
.ai-res__headline .ai-vref,
.ai-res__headline .ai-wref {
  vertical-align: 3px;
}

/* video cards: a grid on wide screens, a rail on phones */
.ai-rail {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
  gap: 16px 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-vcard {
  min-width: 0;
}
.ai-vcard__link {
  display: grid;
  align-content: start;
  gap: 8px;
  min-width: 0;
  border-radius: var(--radius-m, 12px);
  color: inherit;
  text-decoration: none;
}
.ai-vcard__link:focus-visible {
  outline: 2px solid var(--focus, #0a66ff);
  outline-offset: 3px;
}
.ai-vcard__media {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: var(--radius-m, 12px);
  background: var(--thumb-bg, #ececec);
  aspect-ratio: 16 / 9;
}
.ai-vcard__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-fade, 200ms) var(--ease-out, ease-out);
}
.ai-vcard__thumb.is-broken {
  visibility: hidden;
}
@media (hover: hover) {
  .ai-vcard__link:hover .ai-vcard__thumb {
    transform: scale(1.02);
  }
}
.ai-vcard__num,
.ai-vcard__dur {
  position: absolute;
  padding: 1px 6px;
  border-radius: 6px;
  background: var(--overlay, rgb(0 0 0 / 0.8));
  color: var(--overlay-text, #fff);
  font-size: 12px;
  font-weight: 600;
  line-height: 18px;
  font-variant-numeric: tabular-nums;
}
.ai-vcard__num {
  top: 6px;
  inset-inline-start: 6px;
  min-width: 20px;
  text-align: center;
}
.ai-vcard__dur {
  inset-inline-end: 6px;
  bottom: 6px;
}
.ai-vcard__text {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.ai-vcard__kicker {
  overflow: hidden;
  color: var(--wref-fg);
  font-size: 12px;
  font-weight: 600;
  line-height: 16px;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-vcard__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
}
.ai-vcard__meta {
  overflow: hidden;
  color: var(--text-3, #5f5f66);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* web source cards: lead image (when the page has one), letter, favicon, publisher, date, title */
.ai-srcs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  align-items: start; /* a card without an image is shorter, not stretched empty */
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-src {
  min-width: 0;
  border-radius: var(--radius-m, 12px);
}
/* cards without a lead image go after the ones with one, so the grid has no holes */
.ai-src.is-text {
  order: 1;
}
.ai-src__link {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-width: 0;
  overflow: hidden;
  border-radius: var(--radius-m, 12px);
  background: var(--bg, #fff);
  box-shadow: inset 0 0 0 1px var(--separator, rgb(0 0 0 / 0.1));
  color: inherit;
  text-decoration: none;
  transition: box-shadow var(--dur-fade, 200ms) var(--ease-out, ease-out);
}
.ai-src__link:hover {
  box-shadow: inset 0 0 0 1px var(--fill-3, rgb(0 0 0 / 0.14));
}
.ai-src__link:focus-visible {
  outline: 2px solid var(--focus, #0a66ff);
  outline-offset: 2px;
}
.ai-src.is-flash .ai-src__link {
  box-shadow: inset 0 0 0 2px var(--wref-ring);
}
.ai-src__media {
  display: block;
  flex: none;
  overflow: hidden;
  background: var(--thumb-bg, #ececec);
  aspect-ratio: 1.91 / 1;
}
.ai-src__img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.ai-src__text {
  display: grid;
  align-content: start;
  gap: 6px;
  min-width: 0;
  padding: 10px 12px 12px;
}
.ai-src__meta {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--text-3, #5f5f66);
  font-size: 12px;
  line-height: 16px;
}
.ai-src__letter {
  flex: none;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 5px;
  background: var(--wref-bg);
  color: var(--wref-fg);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 16px;
  text-align: center;
}
.ai-src__icon {
  flex: none;
  width: 16px;
  height: 16px;
  border-radius: 4px;
  object-fit: cover;
}
.ai-src__icon--mono {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--fill-2, rgb(0 0 0 / 0.09));
  color: var(--text-2, #3f3f46);
  font-size: 9.5px;
  font-weight: 700;
}
.ai-src__site {
  min-width: 0;
  overflow: hidden;
  color: var(--text-2, #3f3f46);
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ai-src__date {
  flex: none;
}
.ai-src__date::before {
  content: "·";
  margin-inline-end: 6px;
}
.ai-src__title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.38;
  overflow-wrap: anywhere;
}
.ai-src.is-text .ai-src__title {
  -webkit-line-clamp: 4;
}
.ai-src__link:hover .ai-src__title {
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

/* follow-ups: ask with one tap */
.ai-res__next {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 26px;
}
.ai-chip--next {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.ai-chip__arrow {
  flex: none;
  color: var(--text-3, #5f5f66);
}
[dir="rtl"] .ai-chip__arrow {
  display: inline-block;
  transform: scaleX(-1);
}

/* placeholders while a section is on its way (same footprint as what replaces them) */
.ai-skel {
  display: block;
  border-radius: 6px;
  background: var(--fill, rgb(0 0 0 / 0.05));
}
.ai-skel--h {
  width: 92%;
  height: 22px;
  border-radius: 7px;
}
.ai-skel--line {
  width: 100%;
  height: 12px;
  margin: 4px 0;
}
.ai-skel--short {
  width: 58%;
}
.ai-skel--media {
  aspect-ratio: 16 / 9;
  border-radius: var(--radius-m, 12px);
}
.ai-skel-card {
  display: grid;
  align-content: start;
  gap: 6px;
}
.ai-srcs .ai-skel-card {
  padding-bottom: 8px;
  overflow: hidden;
  border-radius: var(--radius-m, 12px);
  box-shadow: inset 0 0 0 1px var(--separator, rgb(0 0 0 / 0.1));
}
.ai-srcs .ai-skel-card .ai-skel--media {
  border-radius: 0;
  aspect-ratio: 1.91 / 1;
}
.ai-srcs .ai-skel-card .ai-skel--line {
  width: auto;
  margin: 4px 12px;
}
.ai-src__media.ai-skel {
  border-radius: 0;
}
@media (prefers-reduced-motion: no-preference) {
  .ai-skel {
    background: linear-gradient(90deg, var(--fill, rgb(0 0 0 / 0.05)) 30%, var(--fill-2, rgb(0 0 0 / 0.09)) 50%, var(--fill, rgb(0 0 0 / 0.05)) 70%) 0 0 / 300% 100%;
    animation: ai-shimmer 1.4s ease-in-out infinite;
  }
  .ai-src.is-flash .ai-src__link {
    animation: ai-flash 1.5s var(--ease-out, ease-out);
  }
}
@keyframes ai-shimmer {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: 0 0;
  }
}
@keyframes ai-flash {
  0%,
  60% {
    box-shadow: inset 0 0 0 2px var(--wref-ring);
  }
  100% {
    box-shadow: inset 0 0 0 1px var(--separator, rgb(0 0 0 / 0.1));
  }
}

/* ------------------------------------------------------------------ v5 parts: numbered lines, blocks, chips, play, Shorts
   Same language as the cards: solid surfaces, hairline insets, app.css tokens; logical properties (RTL-safe). */

/* numbered lines in the body (a path, a brief): the number in its own column, like the video numbers */
.ai-res__ol {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-res__li {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: baseline;
}
.ai-res__n {
  color: var(--text-3, #5f5f66);
  font-size: 13px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  text-align: end;
}
.ai-res__lt {
  min-width: 0;
  overflow-wrap: anywhere;
}

/* blocks */
.ai-res__blocks {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
  margin-top: 20px;
}
.ai-res__blocks[hidden],
.ai-ents[hidden] {
  display: none;
}
.ai-res[data-kind="brief"] .ai-res__blocks {
  margin: 4px 0 18px;
}
.ai-blk {
  min-width: 0;
  padding: 14px 18px 16px;
  border-radius: var(--radius-l, 16px);
  background: var(--bg, #fff);
  box-shadow: inset 0 0 0 1px var(--separator, rgb(0 0 0 / 0.1));
}
.ai-blk__title {
  margin: 0 0 8px;
  color: var(--text, #0f0f0f);
  font-size: 15px;
  font-weight: 650;
  line-height: 1.35;
  letter-spacing: -0.005em;
}
.ai-blk--skel {
  display: grid;
  gap: 6px;
}

/* facts: label | value rows */
.ai-facts {
  display: grid;
  margin: 0;
}
.ai-facts__row {
  display: grid;
  grid-template-columns: minmax(84px, 32%) minmax(0, 1fr);
  gap: 14px;
  padding: 9px 0;
  border-top: 1px solid var(--separator, rgb(0 0 0 / 0.1));
}
.ai-facts__row:first-child {
  border-top: 0;
  padding-top: 2px;
}
.ai-facts__k {
  color: var(--text-3, #5f5f66);
  font-size: 13px;
  line-height: 1.5;
}
.ai-facts__v {
  margin: 0;
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* steps: numbered, a hairline joins them */
.ai-steps {
  display: grid;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.ai-steps__item {
  position: relative;
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 14px;
}
.ai-steps__item:last-child {
  padding-bottom: 0;
}
.ai-steps__item:not(:last-child)::before {
  content: "";
  position: absolute;
  inset-inline-start: 11.5px;
  top: 28px;
  bottom: 4px;
  width: 1px;
  background: var(--separator, rgb(0 0 0 / 0.1));
}
.ai-steps__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--fill-2, rgb(0 0 0 / 0.09));
  color: var(--text, #0f0f0f);
  font-size: 12px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
}
.ai-steps__body {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding-top: 2px;
}
.ai-steps__title {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
}
.ai-steps__text {
  margin: 0;
  color: var(--text-2, #3f3f46);
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* list: named things, one line each */
.ai-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  column-gap: 28px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.ai-list__item {
  display: grid;
  gap: 2px;
  min-width: 0;
  padding: 10px 0;
  border-top: 1px solid var(--separator, rgb(0 0 0 / 0.1));
}
.ai-list__item:first-child {
  border-top: 0;
  padding-top: 2px;
}
.ai-list__name {
  font-size: 15px;
  font-weight: 650;
  line-height: 1.4;
}
.ai-list__note {
  color: var(--text-2, #3f3f46);
  font-size: 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
@media (min-width: 720px) {
  .ai-res:not(.ai-res--compact) .ai-list:has(> :nth-child(4)) {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .ai-res:not(.ai-res--compact) .ai-list:has(> :nth-child(4)) > .ai-list__item:nth-child(2) {
    border-top: 0;
    padding-top: 2px;
  }
}

/* compare: aspect | A | B on wide screens */
.ai-cmp {
  display: grid;
  margin-top: 2px;
}
.ai-cmp__row {
  display: grid;
  grid-template-columns: minmax(84px, 0.7fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 16px;
  padding: 10px 0;
  border-top: 1px solid var(--separator, rgb(0 0 0 / 0.1));
}
.ai-cmp__head {
  padding-top: 0;
  border-top: 0;
}
.ai-cmp__h {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}
.ai-cmp__k {
  color: var(--text-3, #5f5f66);
  font-size: 13px;
  line-height: 1.5;
}
.ai-cmp__c {
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* timeline: dates on a hairline */
.ai-tl {
  position: relative;
  display: grid;
  gap: 12px;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
}
.ai-tl::before {
  content: "";
  position: absolute;
  inset-inline-start: 3.5px;
  top: 8px;
  bottom: 8px;
  width: 1px;
  background: var(--separator, rgb(0 0 0 / 0.1));
}
.ai-tl__item {
  position: relative;
  display: grid;
  grid-template-columns: minmax(64px, auto) minmax(0, 1fr);
  gap: 14px;
  padding-inline-start: 20px;
}
.ai-tl__item::before {
  content: "";
  position: absolute;
  inset-inline-start: 0;
  top: 0.45em;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--bg, #fff);
  box-shadow: inset 0 0 0 1.5px var(--text-3, #5f5f66);
}
.ai-tl__when {
  font-size: 14px;
  font-weight: 650;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}
.ai-tl__what {
  font-size: 15px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

/* entity chips: the library's pages for the names in the answer */
.ai-ents {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 18px;
}
.ai-ents__label {
  margin-inline-end: 2px;
  color: var(--text-3, #5f5f66);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
:lang(zh) .ai-ents__label,
:lang(ja) .ai-ents__label,
:lang(ko) .ai-ents__label,
:lang(ar) .ai-ents__label {
  letter-spacing: 0.02em;
}
.ai-ent {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--fill, rgb(0 0 0 / 0.05));
  color: var(--text, #0f0f0f);
  font-size: 14px;
  font-weight: 550;
  line-height: 20px;
  text-decoration: none;
  transition: background var(--dur-press, 120ms);
}
.ai-ent:hover {
  background: var(--fill-2, rgb(0 0 0 / 0.09));
}
.ai-ent:focus-visible,
.ai-play:focus-visible,
.ai-scard__link:focus-visible {
  outline: 2px solid var(--focus, #0a66ff);
  outline-offset: 2px;
}
.ai-ent__n {
  color: var(--text-3, #5f5f66);
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* "Watch in the library" header: kicker + Play all */
.ai-res__libhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 16px;
}
.ai-play {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 0 14px 0 12px;
  border-radius: 999px;
  background: var(--fill, rgb(0 0 0 / 0.05));
  color: var(--text, #0f0f0f);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--dur-press, 120ms), transform var(--dur-press, 120ms) var(--ease-out, ease-out);
}
.ai-play:hover {
  background: var(--fill-2, rgb(0 0 0 / 0.09));
}
.ai-play:active {
  transform: scale(0.97);
}
.ai-play__i {
  width: 14px;
  height: 14px;
  fill: currentColor;
}
[dir="rtl"] .ai-play__i {
  transform: scaleX(-1);
}
.ai-play__meta {
  color: var(--text-3, #5f5f66);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
/* a path is meant to be played: the button is the page's one filled action */
.ai-res[data-kind="path"] .ai-play {
  background: var(--accent, #0f0f0f);
  color: var(--accent-contrast, #fff);
}
.ai-res[data-kind="path"] .ai-play__meta {
  color: inherit;
  opacity: 0.7;
}
/* watch: the videos come right under the headline */
.ai-res[data-kind="watch"] .ai-res__lib {
  margin: 6px 0 22px;
}

/* Shorts: a rail of 9:16 cards, as on the home row */
.ai-shorts {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: 136px;
  gap: 12px;
  margin: 0;
  padding: 0 0 4px;
  list-style: none;
  overflow-x: auto;
  overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.ai-shorts::-webkit-scrollbar {
  display: none;
}
.ai-scard {
  min-width: 0;
  scroll-snap-align: start;
}
.ai-scard__link {
  display: grid;
  gap: 6px;
  border-radius: var(--radius-m, 12px);
  color: inherit;
  text-decoration: none;
}
.ai-scard__media {
  display: block;
  overflow: hidden;
  border-radius: var(--radius-m, 12px);
  background: var(--thumb-bg, #ececec);
  aspect-ratio: 9 / 16;
}
.ai-scard__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--dur-fade, 200ms) var(--ease-out, ease-out);
}
.ai-scard__thumb.is-broken {
  visibility: hidden;
}
@media (hover: hover) {
  .ai-scard__link:hover .ai-scard__thumb {
    transform: scale(1.02);
  }
}
.ai-scard__title {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.ai-scard__meta {
  overflow: hidden;
  color: var(--text-3, #5f5f66);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* compact (the search page's panel): denser, one row of cards */
.ai-res--compact .ai-res__headline {
  font-size: 18px;
}
.ai-res--compact .ai-res__body {
  font-size: 15px;
}
.ai-res--compact .ai-res__sec {
  margin-top: 18px;
}
.ai-res--compact .ai-res__blocks,
.ai-res--compact .ai-ents {
  margin-top: 14px;
}
.ai-res--compact .ai-blk {
  padding: 12px 14px 14px;
}
.ai-more {
  display: none;
}
/* the clamp: about five lines of the body, faded at the edge; "Read more" opens it in place */
.ai-res--compact:not(.is-open) .ai-res__body {
  max-height: calc(1.62em * 5 + 10px);
  overflow: hidden;
}
.ai-res--compact:not(.is-open) .ai-res__body.has-more {
  -webkit-mask-image: linear-gradient(#000 62%, transparent);
  mask-image: linear-gradient(#000 62%, transparent);
}
.ai-res--compact .ai-more:not([hidden]) {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  justify-self: start;
  min-height: 36px;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text-2, #3f3f46);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.ai-res--compact .ai-more::after {
  content: "";
  width: 6px;
  height: 6px;
  margin-top: -3px;
  border: solid currentColor;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  transition: transform var(--dur-fade, 200ms) var(--ease-out, ease-out);
}
.ai-res--compact.is-open .ai-more::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}
.ai-res--compact .ai-more:hover {
  color: var(--text, #0f0f0f);
}
.ai-res--compact .ai-more:focus-visible,
.ai-blk-more__sum:focus-visible {
  outline: 2px solid var(--focus, #0a66ff);
  outline-offset: 2px;
  border-radius: 6px;
}
/* a second block waits behind its title */
.ai-blk-more {
  border-radius: var(--radius-l, 16px);
  background: var(--bg, #fff);
  box-shadow: inset 0 0 0 1px var(--separator, rgb(0 0 0 / 0.1));
}
.ai-blk-more__sum {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 16px;
  font-size: 15px;
  font-weight: 650;
  list-style: none;
  cursor: pointer;
}
.ai-blk-more__sum::-webkit-details-marker {
  display: none;
}
.ai-blk-more__sum::after {
  content: "";
  flex: none;
  width: 7px;
  height: 7px;
  margin-top: -4px;
  border: solid var(--text-3, #5f5f66);
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(45deg);
  transition: transform var(--dur-fade, 200ms) var(--ease-out, ease-out);
}
.ai-blk-more[open] > .ai-blk-more__sum::after {
  margin-top: 3px;
  transform: rotate(-135deg);
}
.ai-blk-more > .ai-blk {
  padding-top: 0;
  box-shadow: none;
  background: none;
}
.ai-blk-more > .ai-blk > .ai-blk__title {
  display: none;
}

@media (min-width: 768px) {
  .ai-res--compact .ai-rail,
  .ai-res--compact .ai-srcs {
    grid-template-rows: auto;
    grid-auto-rows: 0;
    row-gap: 0;
    overflow: hidden;
  }
}

/* composer: solid, sticks to the bottom of the viewport while the conversation scrolls */
.ai-composer {
  position: sticky;
  bottom: calc(16px + var(--safe-bottom, 0px));
  z-index: 5;
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 4px;
  padding: 6px;
  padding-inline-start: 18px;
  border-radius: 26px;
  background: var(--bg, #fff);
  /* the outline is the .ai-ring inside (app.css): a light travels around it; .ai-aura glows outside it */
  box-shadow: 0 6px 20px rgb(0 0 0 / 0.06);
  --ai-aura-r: calc(26px + var(--ai-glow, 5px));
}
.ai-composer::before {
  /* fade the conversation out above the composer (same-color stops: no dark band in WebKit) */
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 100%;
  height: 20px;
  background: linear-gradient(rgb(var(--bg-rgb, 255 255 255) / 0), rgb(var(--bg-rgb, 255 255 255) / 1));
  pointer-events: none;
}
.ai-composer:focus-within {
  box-shadow:
    0 0 12px 1px rgb(var(--ai-cool, 118 70 255) / var(--ai-halo, 0.16)),
    0 6px 20px rgb(0 0 0 / 0.06);
}
.ai-composer__field {
  position: relative;
  display: flex;
  flex: 1;
  min-width: 0;
}
.ai-composer__field .ask-hint {
  inset: 11px 0 auto;
  height: 22px; /* the hint is size-contained: it needs its own height */
  color: var(--text-3, #5f5f66);
  font-size: 16px;
  line-height: 22px;
  --hint-o: 1;
}
/* "Tab" takes the example shown (app.js), only while the field is focused and empty, on mouse/keyboard devices */
.ai-composer__tab {
  position: absolute;
  inset-inline-end: 0;
  top: 11px;
  display: none;
  pointer-events: none;
}
@media (hover: hover) and (pointer: fine) {
  .ai-composer.has-example:focus-within:has(.ai-composer__input:placeholder-shown) .ai-composer__tab {
    display: inline-block;
  }
  .ai-composer.has-example:focus-within:has(.ai-composer__input:placeholder-shown) .ask-hint {
    inset-inline-end: 46px;
  }
}
.ai-composer__input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  max-height: 168px;
  padding: 11px 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  font-size: 16px; /* no iOS zoom on focus */
  line-height: 22px;
  resize: none;
  outline: none;
}
.ai-composer__input::placeholder {
  color: var(--text-3, #5f5f66);
}
.ai-composer__send {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid transparent; /* the AI gradient edge (app.css --ai-edge), the ring's hairline weight */
  border-radius: 50%;
  background: linear-gradient(var(--accent, #0f0f0f), var(--accent, #0f0f0f)) padding-box, var(--ai-edge, linear-gradient(var(--accent, #0f0f0f), var(--accent, #0f0f0f))) border-box;
  color: var(--accent-contrast, #fff);
  /* the light sweep (.ask-btn__sheen): white on the dark button, warm on the light one (dark theme) */
  --sheen: 255 255 255;
  --sheen-a: 0.34;
  cursor: pointer;
  transition: opacity var(--dur-press, 120ms), transform var(--dur-press, 120ms) var(--ease-out, ease-out);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ai-composer__send {
    --sheen: var(--ai-hot, 255 170 92);
    --sheen-a: 0.55;
  }
}
:root[data-theme="dark"] .ai-composer__send {
  --sheen: var(--ai-hot, 255 170 92);
  --sheen-a: 0.55;
}
.ai-composer__send:active {
  transform: scale(0.94);
}
.ai-composer__send:disabled {
  opacity: 0.45;
  cursor: progress;
}
.ai-composer__send:focus-visible {
  outline: 2px solid var(--focus, #0a66ff);
  outline-offset: 2px;
}
.ai-chat__fine {
  margin: -6px 0 0;
  color: var(--text-3, #5f5f66);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 767.98px) {
  .ai-chat {
    margin-top: 4px;
  }
  .ai-chat__title {
    font-size: 34px;
    line-height: 41px;
    letter-spacing: -0.012em;
  }
  .ai-chip {
    min-height: 44px;
  }
  .ai-chat__reset {
    min-height: 44px;
  }
  /* the answer: rails that run edge to edge (the page gutter becomes their padding), the next card peeking */
  .ai-res__headline {
    font-size: 20px;
    line-height: 1.34;
  }
  .ai-rail {
    grid-template-columns: none;
    grid-auto-flow: column;
    grid-auto-columns: 64%;
    gap: 12px;
    margin-inline: calc(-1 * var(--gutter, 16px));
    padding: 2px var(--gutter, 16px) 6px;
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scroll-padding-inline: var(--gutter, 16px);
    scrollbar-width: none;
  }
  .ai-rail::-webkit-scrollbar {
    display: none;
  }
  .ai-rail > li {
    scroll-snap-align: start;
  }
  .ai-rail.ai-rail--few {
    grid-auto-columns: calc(50% - 6px);
  }
  /* web sources on a phone: a list of compact rows, the lead image as a square on the trailing side (every card visible,
     no row height set by a card off screen) */
  .ai-srcs {
    grid-template-columns: minmax(0, 1fr);
    gap: 10px;
  }
  .ai-src__link {
    flex-direction: row-reverse;
    align-items: stretch;
  }
  .ai-src__media {
    width: 92px;
    min-height: 92px;
    aspect-ratio: auto;
  }
  .ai-src__text {
    flex: 1;
    align-content: center;
    padding: 10px 12px;
  }
  .ai-srcs .ai-skel-card {
    min-height: 92px;
    align-content: center;
  }
  .ai-srcs .ai-skel-card .ai-skel--media {
    display: none;
  }
  .ai-chip--next {
    min-height: 44px;
    align-items: center;
  }
  /* v5 parts on a phone: 44 px targets, compare stacked per aspect, rails edge to edge */
  .ai-ent,
  .ai-play,
  .ai-res--compact .ai-more:not([hidden]) {
    min-height: 44px;
  }
  .ai-blk {
    padding: 14px 16px 16px;
  }
  .ai-facts__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
  .ai-cmp__head {
    display: none;
  }
  .ai-cmp__row {
    grid-template-columns: minmax(0, 1fr);
    gap: 8px;
    padding: 12px 0;
  }
  .ai-cmp__head + .ai-cmp__row {
    border-top: 0;
    padding-top: 2px;
  }
  /* the aspect leads each card; the two sides are named in small type under it */
  .ai-cmp__k {
    color: var(--text, #0f0f0f);
    font-size: 14px;
    font-weight: 650;
  }
  .ai-cmp__c::before {
    content: attr(data-side);
    display: block;
    margin-bottom: 1px;
    color: var(--text-3, #5f5f66);
    font-size: 12px;
    font-weight: 600;
  }
  .ai-tl__item {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }
  .ai-shorts {
    grid-auto-columns: 38%;
    margin-inline: calc(-1 * var(--gutter, 16px));
    padding: 0 var(--gutter, 16px) 4px;
    scroll-padding-inline: var(--gutter, 16px);
  }
  /* the kicker keeps its line; Play all moves under it when both do not fit */
  .ai-res__libhead {
    flex-wrap: wrap;
    row-gap: 8px;
    min-height: 44px;
  }
  .ai-res__libhead .ai-res__kicker {
    white-space: nowrap;
  }
  .ai-composer {
    /* clear the floating tab bar */
    bottom: calc(var(--tabbar-h, 62px) + max(10px, var(--safe-bottom, 0px)) + 10px);
  }
}
/* a phone in landscape gets the tablet layout: keep the 44 px touch sizes */
@media (orientation: landscape) and (max-height: 540px) and (pointer: coarse) {
  .ai-chip,
  .ai-chat__reset {
    min-height: 44px;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ai-step[data-state="active"] .ai-step__dot {
    animation: none;
    border-top-color: var(--text-2, #3f3f46);
    border-style: dotted;
  }
  .ai-vref,
  .ai-wref,
  .ai-src__link,
  .ai-vcard__thumb,
  .ai-scard__thumb,
  .ai-chip,
  .ai-ent,
  .ai-play,
  .ai-composer__send {
    transition: none;
  }
  .ai-vcard__link:hover .ai-vcard__thumb,
  .ai-scard__link:hover .ai-scard__thumb,
  .ai-play:active {
    transform: none;
  }
  .ai-res--compact .ai-more::after,
  .ai-blk-more__sum::after {
    transition: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .ai-btn {
    transition: none;
  }
}
