/* Folio landing: study toys (flashcards, quiz, Lio chat, personas). Everything is prefixed ts-. */

.ts-root,
.ts-root *,
.ts-root *::before,
.ts-root *::after { box-sizing: border-box; }

.ts-root {
  --ts-paper: var(--paper, #FBF7EE);
  --ts-sheet: var(--sheet, #FFFDF8);
  --ts-line: var(--line, #E4DCCB);
  --ts-ink: var(--ink, #1D1B2E);
  --ts-ink2: var(--ink-2, #5E5B70);
  --ts-hl: var(--hl, #FFD84D);
  --ts-margin: var(--margin, #C2352B);
  --ts-rule: var(--rule, #B9C4F0);
  --ts-accent: var(--accent, #4A55C9);
  --ts-accent2: var(--accent-2, #8F9BFF);
  --ts-night: var(--night, #1D1B2E);
  --ts-night2: var(--night-2, #26243A);
  --ts-night3: var(--night-3, #2C2A40);
  --ts-nline: var(--night-line, #3A3852);
  --ts-on: var(--on-night, #FBF7EE);
  --ts-on2: var(--on-night-2, #A9A6BD);
  --ts-pink: var(--m-pink, #FEB4C2);
  --ts-mint: var(--m-mint, #9BFBE1);
  --ts-lime: var(--m-lime, #BFFA37);
  --ts-coral: #F4A598;
  --ts-display: var(--f-display, "Instrument Serif", Georgia, "Times New Roman", serif);
  --ts-sans: var(--f-sans, -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, sans-serif);
  --ts-hand: var(--f-hand, "Kalam", "Bradley Hand", cursive);
  --ts-spring: var(--ease-spring, cubic-bezier(.34, 1.56, .64, 1));
  --ts-out: var(--ease-out, cubic-bezier(.22, 1, .36, 1));
  --ts-glass: rgba(255, 255, 255, .06);
  --ts-glass-line: rgba(255, 255, 255, .10);

  position: relative;
  width: 100%;
  margin-inline: auto;
  font-family: var(--ts-sans);
  color: var(--ts-on);
  -webkit-font-smoothing: antialiased;
  text-align: left;
}

.ts-root :where(button) { font: inherit; color: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.ts-root :focus-visible { outline: 2px solid var(--ts-hl); outline-offset: 3px; }
.ts-root p, .ts-root h3 { margin: 0; }
.ts-root kbd {
  font: 600 11px/1 var(--ts-sans); padding: 3px 6px; border-radius: 6px;
  background: rgba(255, 255, 255, .10); border: 1px solid rgba(255, 255, 255, .14); color: var(--ts-on);
}
.ts-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.ts-lio { display: grid; place-items: center; flex: none; }
.ts-lio lio-star { display: block; }

/* shared buttons */
.ts-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 22px; border: 0; border-radius: 999px;
  background: var(--ts-hl); color: var(--ts-ink); font-weight: 650; font-size: 15px; letter-spacing: -.005em;
  box-shadow: 0 10px 24px -8px rgba(255, 216, 77, .55), inset 0 1px 0 rgba(255, 255, 255, .5);
  transition: transform .35s var(--ts-spring), box-shadow .25s ease, filter .2s ease;
}
.ts-btn:active { transform: scale(.96); }
.ts-btn svg { width: 16px; height: 16px; }
.ts-btn.is-ghost {
  background: rgba(255, 255, 255, .08); color: var(--ts-on); box-shadow: none;
  border: 1px solid var(--ts-glass-line);
}
@media (hover: hover) {
  .ts-btn:hover { transform: translateY(-2px); filter: brightness(1.04); }
  .ts-btn.is-ghost:hover { background: rgba(255, 255, 255, .14); }
}

/* =====================================================================
   1. FLASHCARDS
   ===================================================================== */
.ts-fc {
  position: relative; display: grid; max-width: 920px; margin-inline: auto;
  min-height: 540px; padding: 32px 28px; border-radius: 28px; overflow: hidden;
  background:
    radial-gradient(520px 320px at 12% 0%, rgba(143, 155, 255, .16), transparent 70%),
    radial-gradient(420px 300px at 100% 100%, rgba(255, 216, 77, .07), transparent 70%),
    var(--ts-glass);
  border: 1px solid var(--ts-glass-line);
  box-shadow: 0 40px 90px -40px rgba(0, 0, 0, .7);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.ts-fc-panel {
  grid-area: 1 / 1; align-self: center;
  opacity: 0; visibility: hidden; transform: translateY(10px) scale(.985);
  transition: opacity .35s ease, transform .5s var(--ts-out), visibility 0s linear .35s;
}
.ts-fc[data-phase="gen"] .ts-gen,
.ts-fc[data-phase="study"] .ts-study,
.ts-fc[data-phase="done"] .ts-done {
  opacity: 1; visibility: visible; transform: none;
  transition: opacity .4s ease .1s, transform .55s var(--ts-out) .1s, visibility 0s;
}

/* phase A */
.ts-gen {
  display: grid; grid-template-columns: minmax(0, 250px) 60px minmax(0, 300px);
  justify-content: center; align-items: center; gap: 0 10px;
}
.ts-left { display: grid; gap: 12px; grid-template-areas: "chip" "pdf" "status"; }
.ts-filechip {
  grid-area: chip; justify-self: start; max-width: 100%;
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--ts-glass-line);
  font-size: 12.5px; font-weight: 550; color: var(--ts-on);
}
.ts-filechip svg { flex: none; color: #FF8E80; }
.ts-filechip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.ts-pdf {
  grid-area: pdf; position: relative; aspect-ratio: 4 / 4.6; overflow: hidden;
  border-radius: 12px; padding: 16px 16px; background: var(--ts-sheet);
  box-shadow: 0 30px 50px -22px rgba(0, 0, 0, .65), 0 0 0 1px rgba(0, 0, 0, .05);
  display: flex; flex-direction: column; gap: 7px;
}
.ts-pdf i, .ts-pdf b { display: block; border-radius: 3px; flex: none; }
.ts-pdf .ts-pt { height: 9px; width: 62%; background: var(--ts-ink); border-radius: 4px; }
.ts-pdf .ts-ps { height: 5px; width: 38%; background: var(--ts-accent2); margin-bottom: 5px; }
.ts-pdf i { height: 5px; width: var(--w, 90%); background: #DDD6C6; }
.ts-pdf i.is-hl { background: linear-gradient(#DDD6C6, #DDD6C6) padding-box; position: relative; }
.ts-pdf i.is-hl::after { content: ""; position: absolute; inset: -2px -3px; border-radius: 3px; background: var(--hlc, var(--ts-hl)); opacity: .7; mix-blend-mode: multiply; }
.ts-pdf .ts-fig {
  height: 22%; border-radius: 8px; margin: 3px 0;
  background: radial-gradient(circle at 30% 50%, rgba(155, 251, 225, .9) 0 18%, transparent 19%),
              radial-gradient(circle at 62% 45%, rgba(254, 180, 194, .85) 0 14%, transparent 15%),
              linear-gradient(135deg, #EEF0FF, #E1E6FF);
}
.ts-scanwrap { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.ts-scanfill {
  position: absolute; inset: 0; opacity: 0; transform: translateY(-100%);
  background: linear-gradient(to bottom, rgba(255, 216, 77, 0), rgba(255, 216, 77, .26));
  border-bottom: 2px solid var(--ts-hl);
  box-shadow: 0 8px 22px rgba(255, 216, 77, .75);
  will-change: transform;
}
.ts-fc.is-scanning .ts-scanfill { opacity: 1; animation: ts-scan 2.4s linear forwards; }
.ts-fc.is-ready .ts-scanfill { opacity: 0; animation: none; transition: opacity .5s ease; }
@keyframes ts-scan { to { transform: translateY(0); } }

.ts-status { grid-area: status; display: flex; align-items: center; gap: 10px; min-height: 60px; }
.ts-statustext { min-width: 0; flex: 1; }
.ts-label { font-size: 14px; font-weight: 550; line-height: 1.35; min-height: 2.7em; display: flex; align-items: center; color: var(--ts-on); }
.ts-bar { height: 5px; border-radius: 99px; background: rgba(255, 255, 255, .10); overflow: hidden; margin-top: 4px; }
.ts-bar i {
  display: block; height: 100%; width: 100%; border-radius: inherit; transform-origin: 0 50%; transform: scaleX(0);
  background: linear-gradient(90deg, var(--ts-accent2), var(--ts-hl));
  transition: transform var(--ts-d, .45s) ease-out;
}

.ts-flow { display: flex; justify-content: center; gap: 4px; opacity: .9; }
.ts-flow i {
  width: 8px; height: 8px; border-top: 2px solid var(--ts-hl); border-right: 2px solid var(--ts-hl);
  transform: rotate(45deg); opacity: .18;
}
.ts-fc.is-scanning:not(.is-ready) .ts-flow i { animation: ts-flow 1.2s ease-in-out infinite; }
.ts-fc.is-scanning:not(.is-ready) .ts-flow i:nth-child(2) { animation-delay: .15s; }
.ts-fc.is-scanning:not(.is-ready) .ts-flow i:nth-child(3) { animation-delay: .3s; }
@keyframes ts-flow { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }

.ts-right { display: grid; justify-items: center; gap: 14px; }
.ts-stack {
  --fx: -230px; --fy: 10px;
  position: relative; width: 100%; max-width: 300px; height: 240px;
}
.ts-mini {
  --tx: 0px; --ty: 0px; --r: 0deg;
  position: absolute; left: 50%; top: 50%; width: 190px; aspect-ratio: 3 / 2;
  padding: 12px 14px 12px 28px; border-radius: 14px; overflow: hidden;
  display: flex; flex-direction: column; gap: 6px;
  background-color: var(--ts-sheet);
  background-image:
    linear-gradient(90deg, transparent 0 20px, rgba(194, 53, 43, .35) 20px 21px, transparent 21px),
    repeating-linear-gradient(180deg, transparent 0 17px, rgba(185, 196, 240, .5) 17px 18px);
  color: var(--ts-ink);
  box-shadow: 0 22px 34px -14px rgba(0, 0, 0, .65), 0 2px 6px rgba(0, 0, 0, .2);
  transform: translate(-50%, -50%) translate(var(--fx), var(--fy)) rotate(-24deg) scale(.55);
  opacity: 0;
  transition: transform .75s var(--ts-spring), opacity .25s ease;
  will-change: transform;
}
.ts-mini.is-in { transform: translate(-50%, -50%) translate(var(--tx), var(--ty)) rotate(var(--r)) scale(1); opacity: 1; }
.ts-mini small { font: 700 9.5px/1 var(--ts-sans); letter-spacing: .08em; text-transform: uppercase; color: var(--ts-accent); }
.ts-mini span { font: 400 16px/1.2 var(--ts-display); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

.ts-count {
  min-width: 90px; text-align: center; padding: 6px 14px; border-radius: 999px; font-size: 13px; font-weight: 600;
  background: rgba(255, 255, 255, .08); border: 1px solid var(--ts-glass-line);
  font-variant-numeric: tabular-nums;
}
.ts-count.is-bump { animation: ts-bump .4s var(--ts-spring); }
@keyframes ts-bump { 0% { transform: scale(1); } 40% { transform: scale(1.14); } 100% { transform: scale(1); } }

.ts-go { visibility: hidden; opacity: 0; transform: translateY(8px) scale(.94); transition: opacity .3s ease, transform .5s var(--ts-spring); }
.ts-fc.is-ready .ts-go { visibility: visible; opacity: 1; transform: none; }
.ts-go.is-pulse { animation: ts-pulse 1.7s ease-out infinite; }
@keyframes ts-pulse {
  0% { box-shadow: 0 10px 24px -8px rgba(255, 216, 77, .55), 0 0 0 0 rgba(255, 216, 77, .55); }
  70%, 100% { box-shadow: 0 10px 24px -8px rgba(255, 216, 77, .55), 0 0 0 16px rgba(255, 216, 77, 0); }
}

/* phase B */
.ts-study { display: grid; justify-items: center; gap: 14px; }
.ts-shead {
  width: min(480px, 100%); display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px;
}
.ts-pips { display: flex; align-items: center; gap: 7px; }
.ts-pips i {
  width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .16);
  transition: background .3s ease, transform .45s var(--ts-spring), box-shadow .3s ease;
}
.ts-pips i.is-done { background: var(--ts-hl); }
.ts-pips i.is-cur { background: transparent; box-shadow: 0 0 0 2px var(--ts-hl); transform: scale(1.25); }
.ts-prog { font-size: 12.5px; color: var(--ts-on2); font-weight: 550; margin-left: 10px; font-variant-numeric: tabular-nums; }
.ts-sheadl { display: flex; align-items: center; }

.ts-deckwrap {
  position: relative; width: min(480px, 100%); aspect-ratio: 3 / 2; isolation: isolate; margin-bottom: 8px;
}
.ts-deckwrap::before, .ts-deckwrap::after {
  content: ""; position: absolute; inset: 0; z-index: 0; border-radius: 20px; background: var(--ts-sheet);
  box-shadow: 0 20px 30px -16px rgba(0, 0, 0, .6);
  transition: opacity .3s ease, transform .5s var(--ts-spring);
}
.ts-deckwrap::before { opacity: .55; transform: translateY(9px) scale(.955) rotate(-1.1deg); }
.ts-deckwrap::after { opacity: .28; transform: translateY(18px) scale(.91) rotate(1.3deg); z-index: -1; }
.ts-deckwrap[data-left="0"]::before, .ts-deckwrap[data-left="0"]::after { opacity: 0; transform: translateY(0) scale(.96); }
.ts-deckwrap[data-left="1"]::after { opacity: 0; }

.ts-card {
  position: absolute; inset: 0; z-index: 2; padding: 0; border: 0; background: none; border-radius: 20px;
  perspective: 1400px; display: block; text-align: center; touch-action: manipulation;
}
.ts-card:focus-visible { outline-offset: 5px; }
.ts-flip { position: absolute; inset: 0; display: block; transform-style: preserve-3d; transition: transform .6s var(--ts-spring); }
.ts-flip.is-flipped { transform: rotateY(180deg); }
.ts-card.ts-noanim .ts-flip { transition: none; }
.ts-face {
  position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  padding: 34px 26px 26px 52px; border-radius: 20px; color: var(--ts-ink);
  -webkit-backface-visibility: hidden; backface-visibility: hidden;
  background-color: var(--ts-sheet);
  background-image:
    linear-gradient(90deg, transparent 0 38px, rgba(194, 53, 43, .38) 38px 39.5px, transparent 39.5px),
    repeating-linear-gradient(180deg, transparent 0 31px, rgba(185, 196, 240, .5) 31px 32px);
  background-position: 0 0, 0 10px;
  box-shadow: 0 34px 60px -24px rgba(0, 0, 0, .65), 0 6px 16px rgba(0, 0, 0, .22);
}
.ts-back { transform: rotateY(180deg); }
.ts-tag {
  position: absolute; top: 13px; left: 52px; font: 700 10.5px/1 var(--ts-sans); letter-spacing: .09em; text-transform: uppercase;
  color: var(--ts-accent); padding: 5px 9px; border-radius: 99px; background: rgba(74, 85, 201, .09);
}
.ts-cue {
  position: absolute; right: 14px; bottom: 11px; display: inline-flex; align-items: center; gap: 5px;
  font: 600 11px/1 var(--ts-sans); color: var(--ts-ink2); opacity: .75;
}
.ts-cue svg { width: 13px; height: 13px; }
.ts-q { display: block; font: 400 clamp(19px, 3.2vw + 6px, 31px)/1.22 var(--ts-display); letter-spacing: -.005em; text-wrap: balance; }
.ts-mark {
  color: inherit; padding: 0 .12em; margin: 0 -.12em; -webkit-box-decoration-break: clone; box-decoration-break: clone;
  background: linear-gradient(transparent 52%, var(--ts-hl) 52% 94%, transparent 94%);
}
.ts-blank { display: inline-block; width: 3.6em; height: .9em; vertical-align: -.1em; border-bottom: 3px solid var(--ts-ink); margin: 0 .1em; }
.ts-opts { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px 6px; }
.ts-opt {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 9px 4px 5px; border-radius: 99px;
  font: 500 12px/1.1 var(--ts-sans); color: var(--ts-ink); background: rgba(29, 27, 46, .06);
}
.ts-opt b { display: grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--ts-ink); color: var(--ts-sheet); font-size: 10px; }

.ts-ctl { position: relative; display: grid; width: min(480px, 100%); height: 78px; }
.ts-ctl > * {
  grid-area: 1 / 1; align-self: start;
  opacity: 0; visibility: hidden; transform: translateY(8px);
  transition: opacity .25s ease, transform .4s var(--ts-spring), visibility 0s linear .25s;
}
.ts-ctl[data-state="hint"] .ts-hint,
.ts-ctl[data-state="rate"] .ts-rate,
.ts-ctl[data-state="toast"] .ts-toast { opacity: 1; visibility: visible; transform: none; transition-delay: 0s; }
.ts-hint { justify-self: center; padding-top: 14px; font-size: 13.5px; color: var(--ts-on2); display: flex; align-items: center; gap: 6px; }
.ts-hint-t { display: none; }
@media (hover: none) { .ts-hint-d { display: none; } .ts-hint-t { display: inline; } }
.ts-rate { width: 100%; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ts-rbtn {
  --c: var(--ts-hl);
  position: relative; display: grid; gap: 2px; justify-items: center; padding: 11px 4px 9px; border-radius: 14px; overflow: hidden;
  background: rgba(255, 255, 255, .07); border: 1px solid var(--ts-glass-line);
  transition: transform .35s var(--ts-spring), background .2s ease, border-color .2s ease;
}
.ts-rbtn::before { content: ""; position: absolute; left: 14%; right: 14%; top: 0; height: 3px; border-radius: 0 0 4px 4px; background: var(--c); }
.ts-rl { font-weight: 650; font-size: 14px; }
.ts-ri { font-size: 12px; color: var(--ts-on2); font-variant-numeric: tabular-nums; }
.ts-rbtn kbd { position: absolute; top: 5px; right: 6px; padding: 2px 4px; font-size: 9.5px; opacity: .55; background: none; border: 0; }
.ts-rbtn:active { transform: scale(.94); }
@media (hover: hover) { .ts-rbtn:hover { transform: translateY(-3px); background: rgba(255, 255, 255, .13); border-color: var(--c); } }
.ts-toast {
  justify-self: center; display: inline-flex; align-items: center; gap: 8px; margin-top: 10px;
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  background: var(--ts-hl); color: var(--ts-ink); box-shadow: 0 12px 26px -10px rgba(255, 216, 77, .6);
}
.ts-toast svg { width: 15px; height: 15px; }

/* done */
.ts-done { display: grid; justify-items: center; gap: 8px; text-align: center; padding: 8px 0; }
.ts-done h3 { font: 400 clamp(30px, 5vw, 40px)/1.05 var(--ts-display); margin-top: 4px; }
.ts-done p { color: var(--ts-on2); font-size: 15.5px; margin-bottom: 12px; }
.ts-done p b { color: var(--ts-on); font-weight: 600; }

@media (max-width: 760px) {
  .ts-fc { padding: 24px 18px; }
  .ts-gen { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ts-flow { display: none; }
  .ts-left { grid-template-columns: 112px minmax(0, 1fr); grid-template-areas: "chip chip" "pdf status"; gap: 12px 14px; align-items: center; }
  .ts-pdf { padding: 11px 10px; gap: 5px; border-radius: 9px; }
  .ts-pdf i { height: 4px; }
  .ts-pdf .ts-pt { height: 7px; }
  .ts-status { flex-direction: column; align-items: flex-start; gap: 6px; }
  .ts-label { min-height: 0; }
  .ts-stack { --fx: -50px; --fy: -150px; height: 188px; max-width: 280px; }
  .ts-mini { width: 156px; padding: 10px 11px 10px 24px; }
  .ts-mini span { font-size: 14px; }
  .ts-right { gap: 10px; }
}
@media (max-width: 560px) {
  .ts-fc { min-height: 560px; padding: 20px 14px; border-radius: 24px; }
  .ts-rbtn { padding: 12px 2px 8px; }
  .ts-rl { font-size: 13px; }
  .ts-face { padding: 30px 18px 24px 44px; gap: 8px; }
  .ts-tag { left: 44px; top: 11px; }
  .ts-cue { display: none; }
  .ts-opt { font-size: 11px; padding: 3px 8px 3px 4px; }
  .ts-ctl { height: 84px; }
}

/* =====================================================================
   2. QUIZ
   ===================================================================== */
.ts-quiz {
  position: relative; max-width: 560px; margin-inline: auto; min-height: 470px;
  display: grid; padding: 22px 22px 20px; border-radius: 24px; color: var(--ts-ink);
  background-color: var(--ts-sheet);
  background-image:
    linear-gradient(90deg, transparent 0 30px, rgba(194, 53, 43, .22) 30px 31.5px, transparent 31.5px);
  box-shadow: 0 44px 80px -34px rgba(0, 0, 0, .7), 0 0 0 1px rgba(255, 255, 255, .05);
}
.ts-qpanel { grid-area: 1 / 1; display: flex; flex-direction: column; transition: opacity .3s ease, transform .5s var(--ts-out), visibility 0s; }
.ts-qpanel.is-off { opacity: 0; visibility: hidden; pointer-events: none; transform: translateY(8px); transition: opacity .25s ease, transform .4s var(--ts-out), visibility 0s linear .25s; }
.ts-qhead { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 40px; margin-left: 14px; }
.ts-qcount {
  font: 700 12px/1 var(--ts-sans); letter-spacing: .07em; text-transform: uppercase; color: var(--ts-ink);
  padding: 4px 4px; margin-left: -4px; background: linear-gradient(transparent 38%, var(--ts-hl) 38% 90%, transparent 90%);
}
.ts-qpips { display: flex; gap: 6px; margin-top: 8px; }
.ts-qpips i { width: 26px; height: 5px; border-radius: 4px; background: var(--ts-line); transition: background .3s ease; }
.ts-qpips i.is-cur { background: var(--ts-accent2); }
.ts-qpips i.is-ok { background: #38C9A0; }
.ts-qpips i.is-no { background: var(--ts-coral); }
.ts-root .ts-qtext { color: var(--ink, #1D1B2E); font: 400 clamp(23px, 3vw + 10px, 29px)/1.18 var(--ts-display); margin: 10px 0 16px 14px; min-height: 2.36em; text-wrap: balance; display: flex; align-items: center; }
.ts-opts-q { display: grid; gap: 9px; margin-left: 14px; }
.ts-oq {
  position: relative; display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px 11px 11px; text-align: left;
  border-radius: 14px; border: 1.5px solid var(--ts-line); background: rgba(29, 27, 46, .03); color: var(--ts-ink);
  font-weight: 560; font-size: 16px;
  transition: transform .35s var(--ts-spring), background .2s ease, border-color .2s ease, opacity .25s ease;
}
.ts-key {
  flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px;
  font: 700 12.5px/1 var(--ts-sans); background: var(--ts-paper); border: 1px solid var(--ts-line); color: var(--ts-ink2);
  transition: background .2s ease, color .2s ease, border-color .2s ease;
}
.ts-otext { flex: 1; min-width: 0; }
.ts-oico { flex: none; width: 22px; height: 22px; display: grid; place-items: center; opacity: 0; transform: scale(.4); transition: transform .45s var(--ts-spring), opacity .2s ease; }
.ts-oico svg { width: 20px; height: 20px; }
@media (hover: hover) {
  .ts-oq:not([aria-disabled="true"]):hover { transform: translateX(3px); border-color: var(--ts-accent2); background: rgba(143, 155, 255, .12); }
  .ts-oq:not([aria-disabled="true"]):hover .ts-key { background: var(--ts-accent); color: #fff; border-color: var(--ts-accent); }
}
.ts-oq:active:not([aria-disabled="true"]) { transform: scale(.98); }
.ts-oq[aria-disabled="true"] { cursor: default; }
.ts-oq.is-dim { opacity: .5; }
.ts-oq.is-right { background: var(--ts-mint); border-color: #4FD9B3; }
.ts-oq.is-right .ts-key { background: #14705A; color: #fff; border-color: #14705A; }
.ts-oq.is-right .ts-oico { opacity: 1; transform: none; color: #14705A; }
.ts-oq.is-wrong { background: var(--ts-coral); border-color: #E7806F; animation: ts-shake .5s cubic-bezier(.36, .07, .19, .97); }
.ts-oq.is-wrong .ts-key { background: #A8321F; color: #fff; border-color: #A8321F; }
.ts-oq.is-wrong .ts-oico { opacity: 1; transform: none; color: #A8321F; }
@keyframes ts-shake {
  10%, 90% { transform: translateX(-2px); } 20%, 80% { transform: translateX(5px); }
  30%, 50%, 70% { transform: translateX(-8px); } 40%, 60% { transform: translateX(8px); }
}
.ts-qfoot { display: flex; align-items: center; gap: 12px; margin: 14px 0 0 14px; min-height: 66px; }
.ts-expl { flex: 1; font-size: 14px; line-height: 1.4; color: var(--ts-ink2); opacity: 0; transform: translateY(6px); transition: opacity .3s ease .1s, transform .45s var(--ts-spring) .1s; }
.ts-expl.is-on { opacity: 1; transform: none; }
.ts-quiz .ts-btn { background: var(--ts-ink); color: var(--ts-paper); box-shadow: 0 10px 22px -10px rgba(29, 27, 46, .6); }
.ts-next { visibility: hidden; opacity: 0; transform: translateX(-8px); transition: opacity .25s ease, transform .45s var(--ts-spring); white-space: nowrap; }
.ts-next.is-on { visibility: visible; opacity: 1; transform: none; }
.ts-confetti { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.ts-bit { position: absolute; width: 9px; height: 6px; border-radius: 1.5px; will-change: transform; }

.ts-qres { align-items: center; justify-content: center; text-align: center; gap: 4px; }
.ts-ringwrap { position: relative; width: 140px; height: 140px; }
.ts-ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ts-ring circle { fill: none; stroke-width: 10; stroke-linecap: round; }
.ts-ring .ts-rt { stroke: var(--ts-line); }
.ts-ring .ts-rp { stroke: var(--ts-accent); stroke-dasharray: 314.16; stroke-dashoffset: 314.16; transition: stroke-dashoffset 1.1s var(--ts-out) .15s; }
.ts-ringnum { position: absolute; inset: 0; display: grid; place-items: center; font: 400 44px/1 var(--ts-display); }
.ts-resline { font: 400 clamp(26px, 4vw, 32px)/1.1 var(--ts-display); margin-top: 8px; }
.ts-resline mark { background: linear-gradient(transparent 52%, var(--ts-hl) 52% 94%, transparent 94%); color: inherit; padding: 0 .1em; }
.ts-ressub { color: var(--ts-ink2); font-size: 14.5px; margin-bottom: 12px; }
.ts-reslio { position: absolute; right: 12px; top: 8px; }
@media (max-width: 560px) {
  .ts-quiz { min-height: 560px; padding: 18px 14px 16px; }
  .ts-qhead, .ts-opts-q, .ts-qfoot, .ts-qtext { margin-left: 8px; }
  .ts-oq { font-size: 15px; }
  .ts-qfoot { flex-direction: column; align-items: stretch; gap: 8px; min-height: 100px; }
  .ts-next { align-self: flex-start; }
}

/* =====================================================================
   3. CHAT
   ===================================================================== */
.ts-chat {
  position: relative; display: flex; flex-direction: column; max-width: 580px; height: 540px; margin-inline: auto;
  border-radius: 24px; overflow: hidden;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04));
  border: 1px solid var(--ts-glass-line);
  box-shadow: 0 44px 90px -40px rgba(0, 0, 0, .75), inset 0 1px 0 rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(22px) saturate(1.3); backdrop-filter: blur(22px) saturate(1.3);
}
.ts-chead { flex: none; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-bottom: 1px solid var(--ts-glass-line); }
.ts-cname { font-weight: 650; font-size: 15px; }
.ts-csub { font-size: 11.5px; color: var(--ts-on2); line-height: 1.2; }
.ts-scope { margin-left: auto; display: flex; padding: 3px; gap: 2px; border-radius: 999px; background: rgba(0, 0, 0, .22); border: 1px solid var(--ts-glass-line); }
.ts-scope button {
  border: 0; background: none; padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; color: var(--ts-on2);
  transition: background .25s ease, color .25s ease, transform .35s var(--ts-spring); white-space: nowrap;
}
.ts-scope button[aria-pressed="true"] { background: var(--ts-hl); color: var(--ts-ink); }
.ts-scope button:active { transform: scale(.94); }
.ts-clist {
  flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px 8px; display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .18) transparent;
}
.ts-m { display: flex; flex-direction: column; gap: 6px; max-width: 88%; animation: ts-pop .45s var(--ts-spring) both; }
.ts-m-user { align-self: flex-end; align-items: flex-end; }
.ts-m-lio { align-self: flex-start; align-items: flex-start; }
@keyframes ts-pop { from { opacity: 0; transform: translateY(10px) scale(.96); } to { opacity: 1; transform: none; } }
.ts-bub { padding: 10px 14px; border-radius: 18px; font-size: 15px; line-height: 1.5; overflow-wrap: anywhere; }
.ts-m-user .ts-bub { background: var(--ts-accent); color: #fff; border-bottom-right-radius: 6px; box-shadow: 0 10px 22px -12px rgba(74, 85, 201, .9); }
.ts-m-lio .ts-bub { background: rgba(255, 255, 255, .09); border: 1px solid var(--ts-glass-line); border-bottom-left-radius: 6px; color: var(--ts-on); }
.ts-bub.is-streaming::after { content: ""; display: inline-block; width: 7px; height: 1.05em; margin-left: 3px; vertical-align: -.17em; border-radius: 2px; background: var(--ts-hl); animation: ts-blink .8s steps(2) infinite; }
@keyframes ts-blink { 50% { opacity: 0; } }
.ts-bub.ts-typing { display: flex; gap: 5px; padding: 14px 16px; }
.ts-bub.ts-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--ts-on2); animation: ts-dot 1s ease-in-out infinite; }
.ts-bub.ts-typing i:nth-child(2) { animation-delay: .15s; }
.ts-bub.ts-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes ts-dot { 0%, 60%, 100% { transform: none; opacity: .5; } 30% { transform: translateY(-5px); opacity: 1; } }
.ts-cite {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px 5px 9px; border-radius: 999px; font-size: 12.5px; font-weight: 550;
  color: var(--ts-hl); background: rgba(255, 216, 77, .12); border: 1px solid rgba(255, 216, 77, .32);
  animation: ts-pop .45s var(--ts-spring) both;
}
.ts-cite svg { width: 13px; height: 13px; }
.ts-dl {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 999px; font-size: 13px; font-weight: 650;
  background: var(--ts-hl); color: var(--ts-ink); text-decoration: none; animation: ts-pop .45s var(--ts-spring) both;
  transition: transform .35s var(--ts-spring);
}
.ts-dl:hover { transform: translateY(-2px); }

.ts-chips { flex: none; display: flex; flex-wrap: wrap; gap: 8px; padding: 6px 14px 10px; min-height: 52px; align-content: flex-start; }
.ts-chip {
  border: 1px solid var(--ts-glass-line); background: rgba(255, 255, 255, .07); border-radius: 999px; padding: 7px 13px; font-size: 13px; font-weight: 550;
  animation: ts-pop .5s var(--ts-spring) both; transition: background .2s ease, transform .35s var(--ts-spring), border-color .2s ease;
}
.ts-chip:active { transform: scale(.95); }
@media (hover: hover) { .ts-chip:hover { background: rgba(255, 216, 77, .16); border-color: rgba(255, 216, 77, .5); transform: translateY(-2px); } }
.ts-form { flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--ts-glass-line); }
.ts-input {
  flex: 1; min-width: 0; padding: 11px 16px; border-radius: 999px; border: 1px solid var(--ts-glass-line);
  background: rgba(0, 0, 0, .22); color: var(--ts-on); font: 400 16px/1.2 var(--ts-sans); outline: none;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.ts-input::placeholder { color: var(--ts-on2); }
.ts-input:focus { border-color: var(--ts-hl); box-shadow: 0 0 0 3px rgba(255, 216, 77, .2); }
.ts-send {
  flex: none; width: 42px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: var(--ts-hl); color: var(--ts-ink); transition: transform .35s var(--ts-spring), opacity .2s ease;
}
.ts-send svg { width: 18px; height: 18px; }
.ts-send:active { transform: scale(.9); }
.ts-send:disabled { opacity: .4; cursor: default; }
.ts-cnote { flex: none; text-align: center; font-size: 11.5px; letter-spacing: .01em; color: var(--ts-on2); padding: 0 12px 11px; }
@media (max-width: 560px) {
  .ts-chat { height: 580px; border-radius: 22px; }
  .ts-m { max-width: 94%; }
  .ts-chips { min-height: 86px; }
  .ts-csub { display: none; }
}

/* =====================================================================
   4. PERSONA
   ===================================================================== */
.ts-persona { max-width: 640px; margin-inline: auto; min-height: 430px; display: flex; flex-direction: column; gap: 18px; }
.ts-pchips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }
.ts-pchip {
  border: 1px solid var(--ts-glass-line); background: rgba(255, 255, 255, .06); padding: 9px 18px; border-radius: 999px;
  font-size: 14.5px; font-weight: 600; color: var(--ts-on);
  transition: background .25s ease, color .25s ease, transform .4s var(--ts-spring), border-color .25s ease;
}
.ts-pchip:active { transform: scale(.94); }
@media (hover: hover) { .ts-pchip:not([aria-pressed="true"]):hover { background: rgba(255, 255, 255, .13); transform: translateY(-2px); } }
.ts-pchip[aria-pressed="true"] { background: var(--ts-hl); color: var(--ts-ink); border-color: var(--ts-hl); transform: scale(1.04); box-shadow: 0 10px 24px -10px rgba(255, 216, 77, .6); }

.ts-pcard {
  display: flex; flex-direction: column; gap: 16px; padding: 20px; border-radius: 24px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .08), rgba(255, 255, 255, .04));
  border: 1px solid var(--ts-glass-line); box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .7), inset 0 1px 0 rgba(255, 255, 255, .08);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.ts-ask { align-self: flex-end; font: 400 17px/1.3 var(--ts-hand); color: var(--ts-hl); padding: 2px 4px; text-align: right; }
.ts-ask::before { content: "You: "; font-family: var(--ts-sans); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ts-on2); margin-right: 6px; }
.ts-say { display: flex; align-items: flex-start; gap: 14px; }
.ts-say .ts-lio { margin-top: 4px; }
.ts-speech {
  position: relative; flex: 1; min-width: 0; padding: 14px 18px; border-radius: 6px 20px 20px 20px; background: var(--ts-sheet); color: var(--ts-ink);
  box-shadow: 0 18px 34px -16px rgba(0, 0, 0, .6); font-size: 16px; line-height: 1.5;
}
.ts-speech::before { content: ""; position: absolute; left: -7px; top: 14px; width: 16px; height: 16px; background: var(--ts-sheet); transform: rotate(45deg); border-radius: 3px 0 0 0; }
.ts-stk { display: grid; position: relative; }
.ts-stk > * { grid-area: 1 / 1; }
.ts-ghost { visibility: hidden; }
.ts-typed::after { content: ""; display: inline-block; width: 2px; height: 1em; margin-left: 2px; vertical-align: -.14em; background: var(--ts-accent); opacity: 0; }
.ts-typed.is-typing::after { opacity: 1; animation: ts-blink .7s steps(2) infinite; }
.ts-sliders { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; padding: 4px 4px 2px; }
.ts-sl { display: grid; gap: 9px; }
.ts-slh { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--ts-on2); }
.ts-slh b { color: var(--ts-on); font-variant-numeric: tabular-nums; }
.ts-track { position: relative; height: 6px; border-radius: 99px; background: rgba(255, 255, 255, .12); margin: 6px 8px 6px 0; }
.ts-fill { position: absolute; left: 0; top: 0; bottom: 0; width: calc(var(--v, 50) * 1%); border-radius: inherit; background: linear-gradient(90deg, var(--c1), var(--c2)); transition: width .7s var(--ts-spring); }
.ts-thumb {
  position: absolute; top: 50%; left: calc(var(--v, 50) * 1%); width: 18px; height: 18px; margin: -9px 0 0 -9px; border-radius: 50%;
  background: #fff; box-shadow: 0 3px 8px rgba(0, 0, 0, .45), 0 0 0 4px rgba(255, 255, 255, .12); transition: left .7s var(--ts-spring);
}
@media (max-width: 560px) {
  .ts-persona { min-height: 560px; }
  .ts-pcard { padding: 14px; }
  .ts-say { gap: 10px; }
  .ts-speech { padding: 12px 14px; font-size: 15px; }
  .ts-sliders { gap: 12px; }
  .ts-pchip { padding: 8px 14px; font-size: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .ts-root *, .ts-root *::before, .ts-root *::after { animation: none !important; transition-duration: .001s !important; transition-delay: 0s !important; }
  .ts-fc-panel { transform: none !important; }
}
