/* ==========================================================================
   Exam Insights — View compositions
   Page-level layouts (Home, Auth, Dashboard, Pricing) built on the token
   system + base components. Editorial, off-centre, full light/dark parity.
   ========================================================================== */

.nav__user { font-size: var(--text-sm); color: var(--color-text-muted); padding-inline: var(--space-2); }
.accent-text { color: var(--color-accent-text); }
@media (max-width: 860px) { .nav__user { display: none; } }

/* Shared media card (videos / previews) */
.media-card {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-lg);
}
.media-card video { display: block; width: 100%; height: 100%; object-fit: cover; }
.media-card--muted { box-shadow: var(--shadow-sm); filter: saturate(0.85); }
.media-card__bar {
  display: flex; gap: 6px; padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border); background: var(--color-surface-sunken);
}
.media-card__bar span { width: 10px; height: 10px; border-radius: var(--radius-full); background: var(--color-border-strong); }
.media-card__tag {
  position: absolute; bottom: var(--space-3); left: var(--space-3);
  padding: var(--space-1) var(--space-3); font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--color-text-on-accent); background: var(--color-accent); border-radius: var(--radius-full);
}

/* ==========================================================================
   HOME — HERO (off-centre: text left, floating video right)
   ========================================================================== */
.hero--home { min-height: clamp(560px, 84vh, 820px); }
.hero-home__grid {
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  align-items: center;
  gap: var(--space-12);
}
.hero__title em { font-style: italic; color: var(--color-accent-text); }
.hero-home__media { justify-self: end; width: 100%; max-width: 460px; }

.media-card--float { transform: rotate(1.4deg); animation: float-card 9s var(--ease-in-out) infinite; will-change: transform; }
@keyframes float-card {
  0%, 100% { transform: translate3d(0, 0, 0) rotate(1.4deg); }
  50%      { transform: translate3d(0, -12px, 0) rotate(1.4deg); }
}
@media (prefers-reduced-motion: reduce) { .media-card--float { animation: none; } }

@media (max-width: 880px) {
  .hero-home__grid { grid-template-columns: 1fr; gap: var(--space-8); }
  .hero-home__media { justify-self: start; max-width: 420px; }
  .media-card--float { transform: rotate(0); animation: none; }
}

/* ==========================================================================
   HOME — STATS (asymmetric: lead text left, numbers right)
   ========================================================================== */
.stats__grid { display: grid; grid-template-columns: 1fr 1.1fr; gap: var(--space-10); align-items: end; }
.stats__lead h2 { margin-top: var(--space-2); }
.stats__nums { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-6); }
.stat { border-top: 2px solid var(--color-text); padding-top: var(--space-3); }
.stat__num { display: block; font-family: var(--font-display); font-size: var(--text-3xl); line-height: 1; letter-spacing: var(--tracking-tight); }
.stat__num em { font-style: normal; color: var(--color-accent-text); }
.stat__label { display: block; margin-top: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); }
@media (max-width: 820px) {
  .stats__grid { grid-template-columns: 1fr; gap: var(--space-8); }
  .stats__nums { gap: var(--space-4); }
}
@media (max-width: 520px) { .stats__nums { grid-template-columns: 1fr; } }

/* ==========================================================================
   HOME — HOW IT WORKS (scroll-drawn guide line threading 01 → 02 → 03)
   The rail is an SVG with a faint full-height track + an accent line whose
   stroke-dashoffset is driven by --thread (set by js/motion.js on scroll).
   ========================================================================== */
.how__head { margin-bottom: var(--space-12); }
.how__title { margin-top: var(--space-3); max-width: 18ch; }

.how__body { position: relative; }
/* Rail sits at the centre (x=32px) of the 64px marker column */
.how__rail { position: absolute; left: 31px; top: 6px; bottom: 6px; width: 2px; pointer-events: none; }
.how__rail svg { width: 100%; height: 100%; display: block; }
.how__rail-track { color: var(--color-border-strong); opacity: 0.5; }
.how__rail-draw {
  color: var(--color-accent);
  stroke-dasharray: 1;
  stroke-dashoffset: calc(1 - var(--thread, 0));
}

.how__list { display: flex; flex-direction: column; gap: var(--space-16); }
.how__step { display: grid; grid-template-columns: 64px 1fr; gap: var(--space-6); align-items: start; }
.how__marker { display: flex; justify-content: center; }
.how__node {
  display: inline-flex; align-items: center; justify-content: center;
  width: 48px; height: 48px; border-radius: var(--radius-full);
  font-family: var(--font-display); font-weight: var(--weight-semibold); font-size: var(--text-md);
  color: var(--color-text-muted);
  background: var(--color-surface); border: 2px solid var(--color-border-strong);
  transition: color var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out),
              background var(--dur) var(--ease-out), transform var(--dur) var(--ease-spring);
}
.how__step.is-active .how__node {
  color: var(--color-text-on-accent);
  background: var(--color-accent);
  border-color: var(--color-accent);
  transform: scale(1.06);
}
.how__content { padding-top: var(--space-2); max-width: 560px; }
.how__content h3 { font-size: var(--text-xl); margin-bottom: var(--space-2); transition: color var(--dur) var(--ease-out); }
.how__content p { color: var(--color-text-soft); }
@media (max-width: 560px) {
  .how__step { grid-template-columns: 48px 1fr; gap: var(--space-4); }
  .how__rail { left: 23px; }
  .how__node { width: 40px; height: 40px; font-size: var(--text-sm); }
}

/* ==========================================================================
   HOME — COMPARE (legacy vs Insights)
   ========================================================================== */
.compare__head { max-width: 620px; margin-bottom: var(--space-10); }
.compare__head h2 { margin: var(--space-3) 0; }
.compare__grid { display: grid; grid-template-columns: 1fr 1.12fr; gap: var(--space-8); align-items: start; }
.compare__col--win { margin-top: clamp(0px, 4vw, 56px); }
.compare__col video { aspect-ratio: 16 / 10; }
.compare__col figcaption { margin-top: var(--space-4); color: var(--color-text-muted); font-size: var(--text-sm); }
.compare__label {
  display: inline-block; margin-right: var(--space-2); padding: 2px var(--space-2);
  font-weight: var(--weight-semibold); color: var(--color-text-soft);
  background: var(--color-surface-sunken); border-radius: var(--radius-full);
}
.compare__label--win { color: var(--color-text-on-accent); background: var(--color-accent); }
@media (max-width: 760px) {
  .compare__grid { grid-template-columns: 1fr; gap: var(--space-6); }
  .compare__col--win { margin-top: 0; }
}

/* Coming-soon pill (shared dashboard + pricing) */
.tile-pill {
  display: inline-flex; align-items: center; padding: 2px var(--space-3);
  font-size: var(--text-xs); font-weight: var(--weight-semibold);
  border-radius: var(--radius-full); background: var(--color-surface-sunken); color: var(--color-text-muted);
}
.tile-pill--soon { background: var(--color-accent); color: var(--color-text-on-accent); }

/* ==========================================================================
   HOME — CTA BAND + FOOTER
   ========================================================================== */
.cta-band__inner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-8); flex-wrap: wrap;
  padding: var(--space-12); border-radius: var(--radius-2xl);
  background: var(--color-text); color: var(--color-bg);
}
.cta-band__inner h2 { color: var(--color-bg); }
.cta-band__inner .lead { color: var(--color-bg); opacity: 0.7; }

/* Global footer (shows under every route) */
.footer { position: relative; border-top: 1px solid var(--color-border); padding-block: var(--space-16) max(var(--space-8), env(safe-area-inset-bottom)); }
.footer__grid { display: grid; grid-template-columns: 1.6fr 1fr 1fr 1.2fr; gap: var(--space-10); }
.footer__brand .nav__brand { margin-right: 0; }
.footer__tag { margin-top: var(--space-3); max-width: 34ch; }
.footer__col { display: flex; flex-direction: column; align-items: flex-start; gap: var(--space-3); }
.footer__heading { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--color-text-muted); margin-bottom: var(--space-1); }
.footer__link { font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-soft); }
.footer__link:hover { color: var(--color-accent-text); }
.footer__mail { display: inline-block; font-family: var(--font-display); font-size: var(--text-lg); color: var(--color-text); }
.footer__mail:hover { color: var(--color-accent-text); }
.footer__base {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--space-3);
  margin-top: var(--space-12); padding-top: var(--space-6); border-top: 1px solid var(--color-border); font-size: var(--text-sm);
}
.footer__base-links { display: flex; gap: var(--space-5); }
.footer__base-links a { color: var(--color-text-muted); }
.footer__base-links a:hover { color: var(--color-text); }
@media (max-width: 820px) { .footer__grid { grid-template-columns: 1fr 1fr; gap: var(--space-8); } .footer__brand { grid-column: span 2; } }
@media (max-width: 480px) { .footer__grid { grid-template-columns: 1fr; } .footer__brand { grid-column: auto; } }

/* ==========================================================================
   AUTH + ONBOARDING
   ========================================================================== */
.auth-grid { display: grid; grid-template-columns: 0.85fr 1.15fr; min-height: calc(100dvh - var(--nav-height)); }
.auth-aside { position: relative; overflow: hidden; padding: var(--space-12); display: flex; align-items: flex-end; background: var(--color-text); color: var(--color-bg); }
.auth-aside__aurora {
  position: absolute; inset: -30%; z-index: 0; pointer-events: none; filter: blur(80px);
  background:
    radial-gradient(circle at 30% 30%, var(--aurora-1), transparent 60%),
    radial-gradient(circle at 70% 70%, var(--aurora-2), transparent 60%);
  animation: aurora-drift-a 24s var(--ease-in-out) infinite;
}
@media (prefers-reduced-motion: reduce) { .auth-aside__aurora { animation: none; } }
.auth-aside__inner { position: relative; z-index: 1; }
.auth-aside__quote { font-family: var(--font-display); font-size: var(--text-2xl); line-height: 1.2; margin: var(--space-6) 0 var(--space-4); color: var(--color-bg); }
.auth-aside__meta { color: var(--color-bg); opacity: 0.66; max-width: 38ch; }

.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: var(--space-10) var(--gutter); }
.auth-card { width: 100%; max-width: 420px; animation: card-rise 0.5s var(--ease-out) both; }
@keyframes card-rise { from { opacity: 0; transform: translate3d(0, 14px, 0); } to { opacity: 1; transform: none; } }
.auth-progress { display: flex; gap: var(--space-2); width: 100%; max-width: 420px; margin-bottom: var(--space-8); }
.auth-dot { flex: 1; height: 4px; border-radius: var(--radius-full); background: var(--color-border); transition: background var(--dur) var(--ease-out); }
.auth-dot.is-done { background: var(--color-accent); }
.auth-title { font-size: var(--text-3xl); }
.auth-lead { margin: var(--space-3) 0 var(--space-6); color: var(--color-text-muted); }
.auth-fineprint { margin-top: var(--space-5); font-size: var(--text-xs); color: var(--color-text-faint); }
.auth-back { margin-bottom: var(--space-4); font-size: var(--text-sm); color: var(--color-text-muted); }
.auth-back:hover { color: var(--color-text); }

/* Google button — visually authentic, white surface + 4-colour mark */
.btn-google {
  display: flex; align-items: center; justify-content: center; gap: var(--space-3);
  width: 100%; min-height: 52px; padding: 0 var(--space-5);
  font-weight: var(--weight-semibold); font-size: var(--text-md);
  color: #1f1f1f; background: #fff;
  border: 1px solid var(--color-border-strong); border-radius: var(--radius-full);
  box-shadow: var(--shadow-xs); transition: box-shadow var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.btn-google:hover { box-shadow: var(--shadow-md); }
.btn-google:active { transform: scale(0.98); }
.btn-google:focus-visible { box-shadow: var(--shadow-focus); outline: none; }

.auth-divider { display: flex; align-items: center; gap: var(--space-3); margin: var(--space-5) 0; color: var(--color-text-faint); font-size: var(--text-sm); }
.auth-divider::before, .auth-divider::after { content: ""; flex: 1; height: 1px; background: var(--color-border); }

/* Email + password form (sits below Google on the start screen) */
.auth-form { display: flex; flex-direction: column; gap: var(--space-4); }

/* Password field with an inline show/hide toggle */
.input-affix { position: relative; display: flex; align-items: center; }
.input-affix .input { padding-right: 4.75rem; }
.input-affix__btn {
  position: absolute; right: var(--space-2); top: 50%; transform: translateY(-50%);
  display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--space-3);
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--color-text-muted); border-radius: var(--radius-sm);
  transition: color var(--dur) var(--ease-out), background var(--dur) var(--ease-out);
}
.input-affix__btn:hover { color: var(--color-text); background: var(--color-surface-sunken); }
.input-affix__btn:focus-visible { box-shadow: var(--shadow-focus); outline: none; }

/* Form-level error (wrong password, email exists, bad code, …) */
.auth-error {
  font-size: var(--text-sm); font-weight: var(--weight-medium);
  color: var(--color-danger); line-height: var(--leading-snug);
}

/* Sign-up ⇄ sign-in / resend toggle line */
.auth-switch { margin-top: var(--space-5); font-size: var(--text-sm); color: var(--color-text-muted); text-align: center; }
.auth-switch__btn {
  color: var(--color-accent-text); font-weight: var(--weight-semibold);
  padding: 0; background: none; border: 0;
}
.auth-switch__btn:hover { text-decoration: underline; }
.auth-switch__btn:disabled { opacity: 0.5; cursor: not-allowed; text-decoration: none; }

/* Clerk bot-protection widget mount. Empty (invisible challenge) → no space;
   only reserves room when Clerk actually renders an interactive challenge. */
.clerk-captcha:not(:empty) { margin-top: var(--space-4); display: flex; justify-content: center; }

/* Verification code input */
.input--code {
  font-family: var(--font-mono); text-align: center;
  font-size: var(--text-lg); letter-spacing: 0.4em; padding-left: calc(var(--space-4) + 0.4em);
}

/* Auth loading state (shown while Clerk resolves / OAuth finalises) */
.auth-loading { display: flex; flex-direction: column; align-items: center; gap: var(--space-4); padding: var(--space-8) 0; text-align: center; }
.spinner {
  width: 28px; height: 28px; border-radius: 50%;
  border: 3px solid var(--color-border); border-top-color: var(--color-text);
  animation: spin 0.7s linear infinite;
}
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 1.6s; } }

/* Exam-type choice cards */
.choice-grid { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); margin-top: var(--space-2); }
.choice-card {
  position: relative; text-align: left; padding: var(--space-5);
  background: var(--color-surface); border: 1.5px solid var(--color-border); border-radius: var(--radius-lg);
  transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out), transform var(--dur-fast) var(--ease-out);
}
.choice-card:hover { border-color: var(--color-border-strong); }
.choice-card:active { transform: scale(0.99); }
.choice-card.is-selected { border-color: var(--color-accent); background: var(--color-accent-soft); }
.choice-card__check { position: absolute; top: var(--space-4); right: var(--space-4); width: 20px; height: 20px; border-radius: var(--radius-full); border: 2px solid var(--color-border-strong); transition: all var(--dur) var(--ease-out); }
.choice-card.is-selected .choice-card__check { border-color: var(--color-accent); background: var(--color-accent); box-shadow: inset 0 0 0 3px var(--color-surface); }
.choice-card__title { display: block; font-family: var(--font-display); font-size: var(--text-lg); font-weight: var(--weight-semibold); }
.choice-card__desc { display: block; margin-top: var(--space-1); font-size: var(--text-sm); color: var(--color-text-muted); }

/* Subject multi-select chips */
.subject-grid { display: flex; flex-wrap: wrap; gap: var(--space-2); max-height: 320px; overflow-y: auto; padding: 2px; }
.subject-chip {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-2) var(--space-4); min-height: 44px;
  border: 1.5px solid var(--color-border-strong); border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: var(--weight-medium); cursor: pointer; user-select: none;
  transition: border-color var(--dur) var(--ease-out), background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.subject-chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.subject-chip:hover { border-color: var(--color-text-faint); }
.subject-chip.is-selected { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-text-on-accent); }

@media (max-width: 860px) {
  .auth-grid { grid-template-columns: 1fr; min-height: auto; }
  .auth-aside { display: none; }
  .auth-panel { padding-top: var(--space-12); }
}

/* ==========================================================================
   DASHBOARD
   ========================================================================== */
.dash-hello { margin: var(--space-2) 0 var(--space-5); }
.dash-subline { display: flex; align-items: center; flex-wrap: wrap; gap: var(--space-3); }
.subject-tags { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.subject-tag {
  padding: var(--space-1) var(--space-3); font-size: var(--text-sm); font-weight: var(--weight-medium);
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-full); color: var(--color-text-soft);
}

.dash-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); grid-auto-flow: dense; }
.dash-tile {
  grid-column: span 2; display: flex; flex-direction: column;
  padding: var(--space-6);
  background:
    radial-gradient(130% 90% at 0% 0%, var(--glass-sheen), transparent 55%),
    var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--glass-shadow), var(--glass-inset);
}
.dash-tile.row-2 { grid-row: span 2; }
.dash-tile--accent { background: var(--color-accent-soft); border-color: transparent; }
.dash-tile--soon { background: var(--color-surface-sunken); }
.dash-tile__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); }
.dash-tile__title { font-size: var(--text-xl); margin-bottom: var(--space-3); }
.dash-tile__body { flex: 1; color: var(--color-text-soft); }
.dash-tile__cta { align-self: flex-start; margin-top: var(--space-4); }
.dash-tile__foot { margin-top: var(--space-4); font-size: var(--text-xs); color: var(--color-text-faint); }
.tile__text { color: var(--color-text-soft); }

.exam-list { display: flex; flex-direction: column; }
.exam-list--scroll { max-height: 340px; overflow-y: auto; }
.exam-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.exam-row:last-child { border-bottom: 0; }
.exam-row__subject { font-weight: var(--weight-medium); }
.exam-row__when { font-size: var(--text-sm); color: var(--color-text-muted); }
.predict-list { display: flex; flex-direction: column; gap: var(--space-2); }
.predict-list li { padding-left: var(--space-4); position: relative; color: var(--color-text-soft); }
.predict-list li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--color-accent); }

@media (max-width: 760px) {
  .dash-grid { grid-template-columns: 1fr; }
  .dash-tile, .dash-tile.row-2 { grid-column: auto; grid-row: auto; }
}

/* ==========================================================================
   PRICING
   ========================================================================== */
.pricing-hero { padding-bottom: var(--space-8); }
.pricing-title { margin: var(--space-3) 0 var(--space-4); }
.plan-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); align-items: start; }
.plan {
  position: relative; display: flex; flex-direction: column;
  padding: var(--space-6);
  background:
    radial-gradient(130% 90% at 0% 0%, var(--glass-sheen), transparent 55%),
    var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-xl);
  box-shadow: var(--glass-shadow), var(--glass-inset);
  transition: transform var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.plan--popular { border-color: var(--color-accent); box-shadow: var(--shadow-lg); transform: translateY(-8px); }
.plan__flag {
  position: absolute; top: 0; left: 50%; transform: translate(-50%, -50%);
  padding: var(--space-1) var(--space-4); font-size: var(--text-xs); font-weight: var(--weight-semibold);
  color: var(--color-text-on-accent); background: var(--color-accent); border-radius: var(--radius-full); white-space: nowrap;
}
.plan__name { font-size: var(--text-xl); }
.plan__price { display: flex; align-items: baseline; gap: var(--space-2); margin: var(--space-3) 0 var(--space-1); }
.plan__amount { font-family: var(--font-display); font-size: var(--text-3xl); line-height: 1; }
.plan__cadence { font-size: var(--text-sm); color: var(--color-text-muted); }
.plan__tagline { color: var(--color-text-muted); font-size: var(--text-sm); margin-bottom: var(--space-5); min-height: 2.6em; }
.plan__features { display: flex; flex-direction: column; gap: var(--space-3); margin-top: var(--space-6); }
.plan__features li { display: flex; align-items: flex-start; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-soft); }
.feat-ico { flex: none; margin-top: 2px; color: var(--color-accent); }
.feat-ico--soon { color: var(--color-text-faint); }
.plan__features li.is-soon { color: var(--color-text-faint); }
.plan-soon-head { margin-top: var(--space-3); padding-top: var(--space-3); border-top: 1px dashed var(--color-border); font-size: var(--text-xs) !important; font-weight: var(--weight-semibold); text-transform: uppercase; letter-spacing: var(--tracking-wide); color: var(--color-text-muted) !important; }
.pricing-note { margin-top: var(--space-8); font-size: var(--text-sm); text-align: center; }

@media (max-width: 900px) {
  .plan-grid { grid-template-columns: 1fr 1fr; }
  .plan--popular { transform: none; }
}
@media (max-width: 540px) { .plan-grid { grid-template-columns: 1fr; } }

/* CTA band actions + pricing link (Pricing is also in the top nav) */
.cta-band__actions { display: flex; flex-direction: column; align-items: flex-end; gap: var(--space-3); }
.cta-band__link { color: var(--color-bg); opacity: 0.75; font-weight: var(--weight-medium); font-size: var(--text-sm); }
.cta-band__link:hover { color: var(--color-bg); opacity: 1; }
@media (max-width: 560px) { .cta-band__actions { align-items: stretch; width: 100%; } .cta-band__link { text-align: center; } }

/* ==========================================================================
   LINE MOTION — reveal hairlines (draw in on scroll) + legal pages
   `.rule` is a thin section divider that draws across when scrolled into view
   (scaleX, GPU-light). js/motion.js adds .is-in; reduced-motion → instant.
   ========================================================================== */
.rule {
  display: block; height: 1px; width: 100%;
  margin-bottom: var(--space-12);
  background: linear-gradient(90deg, transparent, var(--color-border-strong) 12%, var(--color-border-strong) 88%, transparent);
  transform: scaleX(0); transform-origin: left center;
  transition: transform 1.1s var(--ease-out);
}
.rule.is-in { transform: scaleX(1); }

.legal { padding-block: var(--space-16) var(--section-y); max-width: var(--container-text); }
.legal h1 { margin: var(--space-2) 0 var(--space-2); }
.legal .legal__updated { margin-bottom: var(--space-6); font-size: var(--text-sm); color: var(--color-text-muted); }
.legal h2 {
  margin-top: var(--space-10); margin-bottom: var(--space-3);
  font-size: var(--text-xl); letter-spacing: var(--tracking-snug);
}
.legal h3 { margin-top: var(--space-6); margin-bottom: var(--space-2); font-size: var(--text-lg); }
.legal p { margin-bottom: var(--space-4); color: var(--color-text-soft); max-width: none; }
.legal .lead { color: var(--color-text-soft); margin-bottom: var(--space-6); }
.legal ul, .legal ol { margin: 0 0 var(--space-4); padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); }
.legal ul { list-style: disc; }
.legal ol { list-style: decimal; }
.legal li { color: var(--color-text-soft); line-height: var(--leading-relaxed); padding-left: var(--space-1); }
.legal li::marker { color: var(--color-text-faint); }
.legal a:not(.subpage-back):not(.btn) { color: var(--color-accent-text); text-decoration: underline; text-underline-offset: 2px; }
.legal a:not(.subpage-back):not(.btn):hover { color: var(--color-accent-hover); }
/* Long URLs / emails must never force horizontal scroll on narrow phones. */
.legal p, .legal li { overflow-wrap: anywhere; }
@media (max-width: 560px) {
  .legal { padding-block: var(--space-10) var(--space-16); }
  .legal h2 { margin-top: var(--space-8); }
}

/* ==========================================================================
   DASHBOARD SUB-PAGES (Explorer · Predictor · Mock)
   ========================================================================== */
.subpage-head { padding-top: var(--space-12); padding-bottom: var(--space-8); }
.subpage-back { display: inline-block; margin-bottom: var(--space-5); font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-muted); }
.subpage-back:hover { color: var(--color-text); }
.subpage-title { margin: var(--space-2) 0 var(--space-3); }
.placeholder-flag {
  display: inline-block; margin-top: var(--space-4); padding: 2px var(--space-3);
  font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase;
  color: var(--color-text-muted); background: var(--color-surface-sunken); border-radius: var(--radius-full);
}
.subpage-note { margin-top: var(--space-8); padding-bottom: var(--section-y); font-size: var(--text-sm); }
.explorer-rail__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--color-text-muted); margin-bottom: var(--space-3); }

/* Explorer */
.explorer-grid { display: grid; grid-template-columns: 240px 1fr; gap: var(--space-8); align-items: start; padding-bottom: var(--section-y); }
.explorer-rail { position: sticky; top: calc(var(--nav-height) + var(--space-4)); display: flex; flex-direction: column; gap: var(--space-1); }
.explorer-subject {
  text-align: left; padding: var(--space-3) var(--space-4); min-height: 44px; border-radius: var(--radius-md);
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-soft);
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.explorer-subject:hover { background: var(--color-surface-sunken); color: var(--color-text); }
.explorer-subject.is-active { background: var(--color-accent); color: var(--color-text-on-accent); }
.explorer-papers { display: grid; gap: var(--space-5); }
.paper-card {
  padding: var(--space-6); border-radius: var(--radius-lg);
  background: radial-gradient(130% 90% at 0% 0%, var(--glass-sheen), transparent 55%), var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), var(--glass-inset);
}
.paper-card__head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-4); }
.paper-card__head h3 { font-size: var(--text-lg); }
.topic-list { display: flex; flex-direction: column; }
.topic-row { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.topic-row:last-child { border-bottom: 0; }
.topic-row__name { font-weight: var(--weight-medium); }
.topic-row__meta { font-size: var(--text-sm); color: var(--color-text-muted); }

/* Explorer — live paper cards (wired to API): collapsible year cards + lazy topic/question reveal.
   Buttons inherit the global reset in base.css (no border/background, cursor:pointer). */
.paper-card__toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); text-align: left; }
.paper-card__toggle h3 { font-size: var(--text-lg); }
.paper-card__body { margin-top: var(--space-4); }
.topic-row--expandable { flex-direction: column; align-items: stretch; padding: 0; }
.topic-row__toggle { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); padding: var(--space-3) 0; text-align: left; }
.topic-row__toggle[disabled] { cursor: default; opacity: 0.75; }
.topic-questions { list-style: none; margin: 0 0 var(--space-3); padding: 0 0 0 var(--space-4); border-left: 2px solid var(--color-border); display: flex; flex-direction: column; gap: var(--space-2); }
.eq-q { display: flex; gap: var(--space-3); align-items: baseline; font-size: var(--text-sm); color: var(--color-text-soft); }
.eq-q__num { color: var(--color-text-muted); flex: none; font-weight: var(--weight-semibold); }
.eq-q__text { line-height: var(--leading-snug); }
.explorer-empty { padding: var(--space-4) 0; }

/* Explorer search */
.explorer-main { display: flex; flex-direction: column; gap: var(--space-5); }
.explorer-search { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; }
.explorer-search__input {
  flex: 1 1 240px; min-height: 44px; padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md); border: 1px solid var(--color-border);
  background: var(--glass-bg); color: var(--color-text); font-size: var(--text-sm);
  transition: border-color var(--dur) var(--ease-out);
}
.explorer-search__input:focus { outline: none; border-color: var(--color-text-soft); }
.explorer-search__toggle { display: inline-flex; align-items: center; gap: var(--space-2); font-size: var(--text-sm); color: var(--color-text-muted); white-space: nowrap; }
.search-results { border-left: none; padding-left: 0; }
.search-result { padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
.search-result .eq-q__num { min-width: 140px; }
.search-result mark { background: var(--glass-sheen, rgba(255, 220, 120, 0.35)); color: inherit; border-radius: 2px; padding: 0 1px; }
.badge--muted { opacity: 0.7; }

/* Predictor */
.predict-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
.predict-card {
  padding: var(--space-6); border-radius: var(--radius-lg);
  background: radial-gradient(130% 90% at 0% 0%, var(--glass-sheen), transparent 55%), var(--glass-bg);
  -webkit-backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  backdrop-filter: blur(var(--glass-blur)) saturate(180%);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), var(--glass-inset);
}
.predict-card__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: var(--space-4); }
.predict-card__head h3 { font-size: var(--text-lg); }
.predict-items { display: flex; flex-direction: column; gap: var(--space-4); }
.predict-item__top { display: flex; justify-content: space-between; font-size: var(--text-sm); margin-bottom: var(--space-2); color: var(--color-text-soft); }
.predict-bar { height: 6px; background: var(--color-surface-sunken); border-radius: var(--radius-full); overflow: hidden; }
.predict-bar span { display: block; height: 100%; background: var(--color-accent); border-radius: var(--radius-full); transform-origin: left center; animation: predict-grow 1.1s var(--ease-out) both; }
@keyframes predict-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@media (max-width: 680px) { .predict-grid { grid-template-columns: 1fr; } }

/* Mock */
.mock-layout { display: grid; grid-template-columns: 280px 1fr; gap: var(--space-8); align-items: start; padding-bottom: var(--section-y); }
.mock-picks { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.mock-pick {
  padding: var(--space-2) var(--space-4); min-height: 44px; border-radius: var(--radius-full);
  border: 1.5px solid var(--color-border-strong); font-size: var(--text-sm); font-weight: var(--weight-medium);
  transition: background var(--dur) var(--ease-out), border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.mock-pick:hover { border-color: var(--color-text-faint); }
.mock-pick.is-active { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-text-on-accent); }
.mock-meta { display: flex; flex-direction: column; margin: var(--space-4) 0; }
.mock-meta li { display: flex; justify-content: space-between; padding: var(--space-3) 0; border-bottom: 1px solid var(--color-border); }
.mock-meta li:last-child { border-bottom: 0; }
.mock-meta li span:first-child { color: var(--color-text-muted); }

@media (max-width: 760px) {
  .explorer-grid, .mock-layout { grid-template-columns: 1fr; gap: var(--space-6); }
  .explorer-rail { position: static; flex-direction: row; flex-wrap: nowrap; overflow-x: auto; gap: var(--space-2); padding-bottom: var(--space-2); }
  .explorer-subject { white-space: nowrap; }
}

/* ==========================================================================
   AI TUTOR CHAT
   Full-height column under the nav: compact header, a scrolling thread, and a
   pinned composer. The global footer sits just below the fold.
   ========================================================================== */
.chat-shell { display: flex; flex-direction: column; height: calc(100dvh - var(--nav-height)); }
.chat-head { padding-top: var(--space-6); padding-bottom: var(--space-4); }
.chat-head .subpage-back { margin-bottom: var(--space-3); }
.chat-head .subpage-title { margin: var(--space-1) 0 0; font-size: var(--text-2xl); }

.chat-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.chat-thread { display: flex; flex-direction: column; gap: var(--space-5); padding-top: var(--space-2); padding-bottom: var(--space-8); }

.chat-msg { display: flex; }
.chat-msg--user { justify-content: flex-end; }
.chat-msg--bot { justify-content: flex-start; }
.chat-bubble {
  max-width: min(680px, 86%); padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-lg); line-height: var(--leading-relaxed);
  animation: chat-bubble-in var(--dur) var(--ease-out) both;
}
@keyframes chat-bubble-in { from { opacity: 0; transform: translate3d(0, 6px, 0); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .chat-bubble { animation: none; } }
.chat-msg--user .chat-bubble { background: var(--color-accent); color: var(--color-text-on-accent); border-bottom-right-radius: var(--radius-xs); }
.chat-msg--bot .chat-bubble { background: var(--color-surface); border: 1px solid var(--color-border); border-bottom-left-radius: var(--radius-xs); }

.chat-md p { margin: 0 0 var(--space-3); }
.chat-md p:last-child { margin-bottom: 0; }
.chat-md code { font-family: var(--font-mono); font-size: 0.9em; background: var(--color-surface-sunken); padding: 0 4px; border-radius: var(--radius-xs); }
.chat-cite { color: var(--color-accent-text); font-weight: var(--weight-semibold); font-size: 0.72em; vertical-align: super; }

.chat-typing { display: inline-flex; gap: 5px; padding: var(--space-1) 0; }
.chat-typing span { width: 7px; height: 7px; border-radius: var(--radius-full); background: var(--color-text-faint); animation: chat-bounce 1.2s var(--ease-in-out) infinite; }
.chat-typing span:nth-child(2) { animation-delay: 0.15s; }
.chat-typing span:nth-child(3) { animation-delay: 0.3s; }
@keyframes chat-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: 0.5; } 30% { transform: translateY(-4px); opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .chat-typing span { animation: none; } }

.chat-error { margin: 0; color: var(--color-danger); font-size: var(--text-sm); }

.chat-sources { margin-top: var(--space-4); padding-top: var(--space-3); border-top: 1px solid var(--color-border); }
.chat-sources__label { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--color-text-muted); margin-bottom: var(--space-2); }
.chat-sources__list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-1); }
.chat-sources__list li { font-size: var(--text-sm); color: var(--color-text-soft); }

/* Empty state */
.chat-empty { max-width: 560px; margin: auto; padding: var(--space-12) 0; text-align: center; }
.chat-empty__mark {
  width: 56px; height: 56px; margin: 0 auto var(--space-5);
  display: flex; align-items: center; justify-content: center; border-radius: var(--radius-full);
  background: var(--color-accent); color: var(--color-text-on-accent);
  font-family: var(--font-display); font-weight: var(--weight-semibold);
}
.chat-empty__title { font-size: var(--text-2xl); margin-bottom: var(--space-3); }
.chat-empty__lead { color: var(--color-text-muted); margin-bottom: var(--space-6); }
.chat-suggests { display: flex; flex-direction: column; gap: var(--space-2); }
.chat-suggest {
  text-align: left; padding: var(--space-3) var(--space-4);
  border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text-soft); font-size: var(--text-sm);
  transition: border-color var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.chat-suggest:hover { border-color: var(--color-accent); color: var(--color-text); }

/* Composer (pinned to the bottom of the shell) */
.chat-composer {
  border-top: 1px solid var(--color-border);
  background: var(--color-surface-alpha);
  -webkit-backdrop-filter: blur(var(--glass-blur)); backdrop-filter: blur(var(--glass-blur));
  padding-bottom: max(var(--space-2), env(safe-area-inset-bottom));
}
.chat-form { display: flex; gap: var(--space-3); align-items: flex-end; padding-top: var(--space-4); }
.chat-input {
  flex: 1; resize: none; min-height: 48px; max-height: 160px;
  padding: var(--space-3) var(--space-4); border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-strong); background: var(--color-surface); color: var(--color-text);
  font: inherit; font-size: var(--text-base); line-height: var(--leading-snug);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.chat-input:focus { outline: none; border-color: var(--color-accent); box-shadow: var(--shadow-focus); }
.chat-input:disabled { opacity: 0.6; }
.chat-send { flex: none; min-height: 48px; }
.chat-disclaimer { margin: var(--space-2) auto 0; max-width: var(--container); padding-inline: var(--gutter); font-size: var(--text-xs); color: var(--color-text-faint); text-align: center; }

@media (max-width: 560px) {
  .chat-bubble { max-width: 92%; }
  .chat-send { padding-inline: var(--space-5); }
}

/* ==========================================================================
   CREATIVE STUDIO (Notes · Flashcards · Custom GPT) + TIMETABLE ASSISTANT
   ========================================================================== */
.spinner--sm { width: 18px; height: 18px; border-width: 2px; }

.studio-wrap { padding-bottom: var(--section-y); }

/* Segmented tab control */
.seg {
  display: inline-flex; gap: var(--space-1); margin-bottom: var(--space-6);
  padding: var(--space-1); border-radius: var(--radius-full);
  background: var(--color-surface-sunken); border: 1px solid var(--color-border);
}
.seg__btn {
  padding: var(--space-2) var(--space-5); min-height: 40px; border-radius: var(--radius-full);
  font-size: var(--text-sm); font-weight: var(--weight-medium); color: var(--color-text-muted);
  transition: background var(--dur) var(--ease-out), color var(--dur) var(--ease-out);
}
.seg__btn:hover { color: var(--color-text); }
.seg__btn.is-active { background: var(--color-surface); color: var(--color-text); box-shadow: var(--shadow-xs); }

/* Generation forms (subject + free-text + button on one row, wrap on mobile) */
.studio-form { display: flex; gap: var(--space-4); align-items: flex-end; flex-wrap: wrap; margin-bottom: var(--space-6); }
.studio-form .field { flex: 0 0 220px; }
.studio-form__grow { flex: 1 1 240px; }
.studio-go { flex: none; min-height: 48px; }

.studio-output { min-height: 80px; }
.studio-status { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) 0; color: var(--color-text-muted); }
.studio-status--error { color: var(--color-danger); }

/* Notes toolbar (download buttons); sits above the rendered article */
.studio-notes-bar { display: flex; justify-content: flex-end; gap: var(--space-2); margin-bottom: var(--space-3); }

/* Light-themed clone used only as the html2pdf capture source. It stays in
   normal flow (html2canvas measures an absolutely-positioned/offscreen element
   as zero height, producing a blank page) but its wrapper is collapsed to
   height:0 so nothing is visible on screen during capture. Fixed width keeps
   the PDF layout stable regardless of viewport or app theme. */
.pdf-export-clip { height: 0; overflow: hidden; }
.pdf-export { width: 760px; box-sizing: border-box;
  padding: 8px 12px; background: #fff; color: #1d1d1f;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; }
.pdf-export .studio-notes { max-width: none; }
.pdf-export .studio-notes p, .pdf-export .studio-notes li { color: #1d1d1f; }
.pdf-export__title { font-size: 1.7rem; line-height: 1.2; margin: 0 0 0.2rem; }
.pdf-export__meta { color: #6e6e73; margin: 0 0 1.4rem; font-size: 0.95rem; }

/* Generated notes / timetable prose (shared editorial reading style) */
.studio-notes { max-width: var(--container-text); }
.studio-notes h2 { margin: var(--space-6) 0 var(--space-2); font-size: var(--text-xl); }
.studio-notes h3 { margin: var(--space-5) 0 var(--space-2); font-size: var(--text-lg); }
.studio-notes h4, .studio-notes h5 { margin: var(--space-4) 0 var(--space-1); font-size: var(--text-md); }
.studio-notes p { margin-bottom: var(--space-3); color: var(--color-text-soft); line-height: var(--leading-relaxed); }
.studio-notes ul, .studio-notes ol { margin: 0 0 var(--space-4); padding-left: var(--space-5); display: flex; flex-direction: column; gap: var(--space-1); }
.studio-notes ul { list-style: disc; } .studio-notes ol { list-style: decimal; }
.studio-notes li { color: var(--color-text-soft); line-height: var(--leading-relaxed); }
.studio-notes li::marker { color: var(--color-text-faint); }
.studio-notes code { font-family: var(--font-mono); font-size: 0.9em; background: var(--color-surface-sunken); padding: 0 4px; border-radius: var(--radius-xs); }
.studio-notes table, .chat-md table { width: 100%; border-collapse: collapse; margin: var(--space-3) 0 var(--space-4); font-size: var(--text-sm); display: block; overflow-x: auto; }
.studio-notes th, .studio-notes td, .chat-md th, .chat-md td { border: 1px solid var(--color-border); padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; }
.studio-notes th, .chat-md th { background: var(--color-surface-sunken); font-weight: var(--weight-semibold); color: var(--color-text); white-space: nowrap; }
.studio-notes td, .chat-md td { color: var(--color-text-soft); }

/* Flashcards (server returns .flashcards-container; JS toggles .is-flipped) */
.flashcards-container { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: var(--space-4); }
.flashcard { perspective: 1200px; min-height: 190px; cursor: pointer; }
.flashcard-inner { position: relative; width: 100%; min-height: 190px; transition: transform var(--dur-slow) var(--ease-spring); transform-style: preserve-3d; }
.flashcard.is-flipped .flashcard-inner { transform: rotateY(180deg); }
.flashcard-front, .flashcard-back {
  position: absolute; inset: 0; -webkit-backface-visibility: hidden; backface-visibility: hidden;
  display: flex; flex-direction: column; justify-content: center; gap: var(--space-2);
  padding: var(--space-5); border-radius: var(--radius-lg);
  border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow), var(--glass-inset);
  background: radial-gradient(130% 90% at 0% 0%, var(--glass-sheen), transparent 55%), var(--glass-bg);
}
.flashcard-back { transform: rotateY(180deg); background: var(--color-accent-soft); }
.flashcard h4 { font-size: var(--text-xs); font-weight: var(--weight-semibold); letter-spacing: var(--tracking-wide); text-transform: uppercase; color: var(--color-text-muted); }
.flashcard p { color: var(--color-text); line-height: var(--leading-snug); }
.flashcard:focus-visible { outline: none; }
.flashcard:focus-visible .flashcard-inner { box-shadow: var(--shadow-focus); border-radius: var(--radius-lg); }
@media (prefers-reduced-motion: reduce) { .flashcard-inner { transition: none; } }

/* Custom GPT mini chat (reuses .chat-* bubble styles) */
.studio-chat { max-height: 52vh; overflow-y: auto; overscroll-behavior: contain; padding: var(--space-2) 0; }
.studio-chat .chat-thread { display: flex; flex-direction: column; gap: var(--space-4); }
.studio-chat-empty { padding: var(--space-6) 0; }
.studio-gpt-form { padding-top: var(--space-4); border-top: 1px solid var(--color-border); }

/* Custom GPT — attached notes */
.gpt-docs { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); margin-bottom: var(--space-4); }
.gpt-attach { cursor: pointer; display: inline-flex; }
.gpt-attach .btn { cursor: pointer; }
.gpt-docs__hint { font-size: var(--text-xs); color: var(--color-text-faint); }
.gpt-doc-list { display: flex; flex-wrap: wrap; gap: var(--space-2); width: 100%; }
.gpt-doc-list:empty { display: none; }
.gpt-doc {
  display: inline-flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) var(--space-2) var(--space-1) var(--space-3);
  border: 1px solid var(--color-border); border-radius: var(--radius-full);
  background: var(--color-surface); font-size: var(--text-sm);
}
.gpt-doc.is-loading { opacity: 0.7; }
.gpt-doc.is-error { border-color: var(--color-danger); color: var(--color-danger); }
.gpt-doc__name { font-weight: var(--weight-medium); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gpt-doc__meta { font-size: var(--text-xs); color: var(--color-text-muted); }
.gpt-doc.is-error .gpt-doc__meta { color: var(--color-danger); }
.gpt-doc__rm {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: var(--radius-full);
  color: var(--color-text-muted); font-size: 15px; line-height: 1;
}
.gpt-doc__rm:hover { background: var(--color-surface-sunken); color: var(--color-text); }

/* Timetable assistant */
.tt-grid { display: grid; grid-template-columns: 1fr 300px; gap: var(--space-8); align-items: start; padding-bottom: var(--section-y); }
.tt-main { display: flex; flex-direction: column; gap: var(--space-4); }
.tt-suggests { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.tt-suggests .chat-suggest { flex: 1 1 240px; }
.tt-go { align-self: flex-start; min-height: 48px; }
.tt-aside { position: sticky; top: calc(var(--nav-height) + var(--space-4)); }
.tt-output { margin-top: var(--space-2); }
.tt-output:empty { margin-top: 0; }
.tt-html { margin-top: var(--space-5); overflow-x: auto; }
.tt-html table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.tt-html th, .tt-html td { border: 1px solid var(--color-border); padding: var(--space-2) var(--space-3); text-align: left; vertical-align: top; }
.tt-html th { background: var(--color-surface-sunken); font-weight: var(--weight-semibold); }

@media (max-width: 760px) {
  .tt-grid { grid-template-columns: 1fr; gap: var(--space-6); }
  .tt-aside { position: static; }
  .studio-form .field, .studio-form__grow { flex: 1 1 100%; }
  .studio-go { width: 100%; }
}
