Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

40.0 KB
Raw Blame
@tailwind base;
@tailwind components;
@tailwind utilities;

/* Feature-page standards. Queries measure usable content after the sidebar
   and gutters, so the same cards behave consistently in both route groups. */
.dt-page-container {
  container: feature-page / inline-size;
}

.dt-page-icon {
  /* Revealed per UI layout; see features/ui-layout/modern/modern.css. */
  display: none;
}

.dt-page-title {
  font-size: 27px;
  /* A UI layout token: see features/ui-layout/{classic,modern}. */
  font-family: var(--dt-page-title-font, theme("fontFamily.sans"));
}

.dt-page-action,
[data-page-actions] > button,
[data-page-actions] > a,
[data-page-actions] > div > button,
[data-page-actions] > div > a {
  min-height: 44px;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 18px;
}

.dt-page-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 12px;
}

.dt-page-grid > * {
  min-width: 0;
}

@container feature-page (min-width: 520px) {
  .dt-page-grid-2,
  .dt-page-grid-3,
  .dt-page-grid-4,
  .dt-page-grid-5 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@container feature-page (min-width: 640px) {
  .dt-page-title { font-size: 30px; }
  .dt-page-header {
    flex-direction: row;
    align-items: flex-end;
    justify-content: space-between;
  }
  .dt-page-action,
  [data-page-actions] > button,
  [data-page-actions] > a,
  [data-page-actions] > div > button,
  [data-page-actions] > div > a { min-height: 36px; }
}

@container feature-page (min-width: 800px) {
  .dt-page-grid-3,
  .dt-page-grid-5,
  .dt-page-grid-board {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@container feature-page (min-width: 1040px) {
  .dt-page-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .dt-page-grid-5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
}

@layer base {
  /* ────────────────────────────────────────────────────────────────────────
     Theme palettes — four families:
       • Default (.theme-snow) → pure-white neutral greys, blue accent
       • Cream (:root) and Dark (.dark) → warm family, terracotta accent
       • Glass (.theme-glass) → translucent purple on near-black
     Tokens that every theme must publish:
       --background, --foreground, --card / --popover (+ their -foreground),
       --primary (+ -foreground), --secondary, --muted (+ -foreground),
       --accent (+ -foreground), --destructive (+ -foreground),
       --border, --input, --ring,
       --overlay   → scrim color for modal backdrops / picker shells
                     (replaces hardcoded bg-black/40 in components)
   ──────────────────────────────────────────────────────────────────────── */

  /* Cream — near-white warm canvas. Reads as off-white at first glance;
     the warm tint only surfaces on filled blocks (selected nav, panels)
     and against the terracotta primary. Inspired by Claude's chrome:
     keep bg essentially white, save the visible warmth for accents. */
  :root {
    color-scheme: light;
    --background: #fdfcf9;
    --foreground: #1c1816;
    --card: #ffffff;
    --card-foreground: #1c1816;
    --popover: #ffffff;
    --popover-foreground: #1c1816;
    --primary: #b0501e;
    --primary-foreground: #ffffff;
    --secondary: #f5f2ea;
    --secondary-foreground: #1c1816;
    --muted: #f1ede2;
    --muted-foreground: #6d645a;
    --accent: #ece7d8;
    --accent-foreground: #1c1816;
    --destructive: #c53a2c;
    --destructive-foreground: #ffffff;
    --border: #e6decc;
    --input: #e6decc;
    --ring: #b0501e;
    --overlay: rgba(28, 24, 22, 0.42);
    --success: #237a4b;
    --success-foreground: #14532d;
    --success-surface: #ecf8f0;
    --warning: #a15c00;
    --warning-foreground: #713f12;
    --warning-surface: #fff7df;
    --info: #2563eb;
    --info-foreground: #1e3a8a;
    --info-surface: #eff6ff;
    --surface-raised: #ffffff;
    --shadow-raised: 0 16px 40px rgba(69, 49, 31, 0.12);
  }

  /* Dark — warm near-black, same terracotta family as Cream. */
  .dark {
    color-scheme: dark;
    --background: #1a1918;
    --foreground: #e8e4de;
    --card: #242220;
    --card-foreground: #e8e4de;
    --popover: #242220;
    --popover-foreground: #e8e4de;
    --primary: #d4734b;
    --primary-foreground: #1a1918;
    --secondary: #2a2725;
    --secondary-foreground: #e8e4de;
    --muted: #2a2725;
    --muted-foreground: #9b9590;
    --accent: #302d2a;
    --accent-foreground: #e8e4de;
    --destructive: #d44a3c;
    --destructive-foreground: #ffffff;
    --border: #3a3634;
    --input: #3a3634;
    --ring: #d4734b;
    --overlay: rgba(0, 0, 0, 0.6);
    --success: #5fd08a;
    --success-foreground: #bbf7d0;
    --success-surface: #173424;
    --warning: #f2b84b;
    --warning-foreground: #fde68a;
    --warning-surface: #3a2c16;
    --info: #7ba7ff;
    --info-foreground: #bfdbfe;
    --info-surface: #172641;
    --surface-raised: #2a2826;
    --shadow-raised: 0 16px 44px rgba(0, 0, 0, 0.32);
  }

  /* Default — pure-white neutral canvas (theme id "snow" kept for stored
     preferences). No tint anywhere: flat #fff bg, plain grey surfaces and
     borders. The only chroma is the blue primary on interactive accents,
     in the spirit of Codex/ChatGPT chrome. */
  .theme-snow {
    color-scheme: light;
    --background: #ffffff;
    --foreground: #0d0d0d;
    --card: #ffffff;
    --card-foreground: #0d0d0d;
    --popover: #ffffff;
    --popover-foreground: #0d0d0d;
    --primary: #2563eb;
    --primary-foreground: #ffffff;
    --secondary: #f7f7f7;
    --secondary-foreground: #0d0d0d;
    --muted: #f2f2f2;
    --muted-foreground: #6e6e6e;
    --accent: #ececec;
    --accent-foreground: #0d0d0d;
    --destructive: #d92d20;
    --destructive-foreground: #ffffff;
    --border: #e5e5e5;
    --input: #e5e5e5;
    --ring: #2563eb;
    --overlay: rgba(0, 0, 0, 0.4);
    --success: #16794b;
    --success-foreground: #14532d;
    --success-surface: #ecfdf3;
    --warning: #a15c00;
    --warning-foreground: #713f12;
    --warning-surface: #fffaeb;
    --info: #2563eb;
    --info-foreground: #1e3a8a;
    --info-surface: #eff6ff;
    --surface-raised: #ffffff;
    --shadow-raised: 0 16px 40px rgba(13, 13, 13, 0.12);
  }

  /* Glass — translucent purple panels on near-black. Slightly brighter
     primary so the accent reads against the radial gradient. */
  .theme-glass {
    color-scheme: dark;
    --background: #0e0d1a;
    --foreground: #ffffff;
    --card: rgba(255, 255, 255, 0.06);
    --card-foreground: #ffffff;
    --popover: rgba(24, 22, 36, 0.92);
    --popover-foreground: #ffffff;
    --primary: #a855f7;
    --primary-foreground: #ffffff;
    --secondary: rgba(255, 255, 255, 0.04);
    --secondary-foreground: #eeeeee;
    --muted: rgba(255, 255, 255, 0.06);
    --muted-foreground: #b5b5c7;
    --accent: rgba(255, 255, 255, 0.12);
    --accent-foreground: #ffffff;
    --destructive: #f07178;
    --destructive-foreground: #ffffff;
    --border: rgba(255, 255, 255, 0.12);
    --input: rgba(255, 255, 255, 0.06);
    --ring: #a855f7;
    --overlay: rgba(0, 0, 0, 0.55);
    --success: #68dfa0;
    --success-foreground: #bbf7d0;
    --success-surface: rgba(34, 197, 94, 0.14);
    --warning: #f7c65a;
    --warning-foreground: #fde68a;
    --warning-surface: rgba(245, 158, 11, 0.16);
    --info: #9ab7ff;
    --info-foreground: #dbeafe;
    --info-surface: rgba(59, 130, 246, 0.16);
    --surface-raised: rgba(35, 32, 51, 0.96);
    --shadow-raised: 0 18px 48px rgba(0, 0, 0, 0.42);
  }

  .theme-glass body {
    background: radial-gradient(circle at 50% 50%, #1a1a2e 0%, #0d0d1a 100%);
    background-attachment: fixed;
  }

  .theme-glass .surface-card {
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  }

  @media (min-width: 768px) {
    .theme-glass .surface-card {
      backdrop-filter: blur(12px);
      -webkit-backdrop-filter: blur(12px);
    }
  }

  .theme-glass .btn-primary {
    background: linear-gradient(45deg, #9d50bb, #6e48aa);
    box-shadow: 0 0 15px rgba(157, 80, 187, 0.4);
    border: none;
    transition: all 0.3s ease;
  }

  .theme-glass .btn-primary:hover {
    box-shadow: 0 0 25px rgba(157, 80, 187, 0.6);
    transform: translateY(-1px);
  }

  /* Collection folder tints (Immersive Reading). These are user-picked
     category colours rather than theme accents, so they sit outside the
     palettes: one set for light canvases, a softer one for dark ones. */
  :root {
    --folder-default: #a8a29e;
    --folder-blue: #4f86f7;
    --folder-teal: #1fb5a8;
    --folder-green: #43b05c;
    --folder-amber: #eaa221;
    --folder-orange: #f07b3f;
    --folder-rose: #e8577a;
    --folder-violet: #8e6cf0;
    --folder-slate: #6b7a90;
  }

  .dark,
  .theme-glass {
    --folder-default: #8a847f;
    --folder-blue: #5b8def;
    --folder-teal: #2aa79c;
    --folder-green: #4aa35f;
    --folder-amber: #d69a2d;
    --folder-orange: #dd7a45;
    --folder-rose: #d65f7f;
    --folder-violet: #8b72e6;
    --folder-slate: #74839a;
  }

  * {
    @apply border-[color:var(--border)];
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
  }

  html,
  body {
    height: 100%;
    overflow: hidden;
  }

  html {
    -webkit-font-smoothing: antialiased;
    --motion-fast: 120ms;
    --motion-base: 180ms;
    --motion-slow: 240ms;
  }

  html[data-scroll-behavior="smooth"] {
    scroll-behavior: smooth;
  }

  body {
    @apply antialiased;
    background: var(--background);
    color: var(--foreground);
  }

  button,
  input,
  select,
  textarea {
    font: inherit;
  }

  summary::-webkit-details-marker {
    display: none;
  }

  :focus-visible {
    outline: 2px solid var(--ring);
    outline-offset: 2px;
  }

  @media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
      scroll-behavior: auto !important;
      animation-duration: 0.01ms !important;
      animation-iteration-count: 1 !important;
      transition-duration: 0.01ms !important;
    }
  }
}

@layer components {
  .surface-card {
    @apply rounded-2xl border bg-[var(--card)] shadow-sm;
  }

  .muted-chip {
    @apply rounded-full bg-[var(--muted)] px-3 py-1 text-xs text-[var(--muted-foreground)];
  }

  .surface-raised {
    background: var(--surface-raised);
    box-shadow: var(--shadow-raised);
  }

  /* Native selects in Settings are drawn with `appearance-none` so they match
     our inputs, which also removes the platform disclosure arrow — leaving a
     control that reads as a read-only text box. This paints the arrow back
     with a theme-neutral stroke that holds up on all four palettes. */
  .dt-select {
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23909090' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
    background-repeat: no-repeat;
    background-position: right 0.7rem center;
    background-size: 14px 14px;
    padding-right: 2.15rem;
  }
}

@layer utilities {
  .hide-scrollbar {
    -ms-overflow-style: none;
    scrollbar-width: none;
  }

  .hide-scrollbar::-webkit-scrollbar {
    display: none;
  }
}

/* ─── Scrollbar ─── */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--muted-foreground);
}

/* ─── Streaming surfaces ───
   Every scroll container that wraps an LLM-streaming surface (chat,
   trace card, quiz follow-up, book chat, …) opts into this contract
   by carrying ``data-chat-scroll-root="true"``.

   ``overflow-anchor: none``
     Disables the browser's automatic scroll anchoring. Anchoring tries
     to keep an in-viewport element fixed in screen space when content
     above it grows; for a chat surface this fights ``useChatAutoScroll``
     every time a code block / KaTeX block / dynamic viewer mounts and
     reflows the message list. Without this rule the page visibly jitters
     during fast streams.

   ``scroll-behavior: auto``
     The hook intentionally never animates ``scrollTop``. If a global
     ``scroll-behavior: smooth`` ever lands (theme, base reset, browser
     experiment), a smooth animation racing against the next-frame pin
     reintroduces the exact stutter this rule is here to prevent. */
[data-chat-scroll-root="true"] {
  overflow-anchor: none;
  scroll-behavior: auto;
}

/* ─── Prose: base ─── */
.prose {
  @apply font-serif text-[16px];
}

.prose pre {
  @apply rounded-lg p-4 overflow-x-auto my-4;
  background: #292524;
  color: #d6d3d1;
}

.prose code:not(.md-code-block__code):not(.md-inline-code) {
  @apply px-1.5 py-0.5 rounded text-sm font-mono;
  background: var(--muted);
  color: var(--foreground);
}

.prose pre code {
  @apply bg-transparent text-inherit p-0;
}

.md-renderer .md-inline-code {
  @apply px-1.5 py-0.5 rounded text-sm font-mono;
  background: var(--muted);
  color: var(--foreground);
}

.md-renderer .md-code-block {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* Force light text on dark code blocks regardless of theme. The wrapper
   .md-code-block always uses a fixed dark background (#1f2937 / #292524),
   so we need to override .prose pre (color: #D6D3D1) and any inherited
   --foreground from the prose wrapper that would otherwise render as
   near-black in the light theme. Specificity (0,2,1) beats .prose pre. */
.md-renderer .md-code-block,
.md-renderer .md-code-block pre,
.md-renderer .md-code-block code {
  color: #e5e7eb;
}

.md-renderer .md-code-block pre,
.md-renderer .md-code-block code {
  background: transparent !important;
}

.md-renderer .md-code-block pre {
  @apply overflow-x-auto;
  margin: 0 !important;
  border-radius: 0 !important;
  padding: 1rem !important;
}

.md-renderer .md-code-block__code {
  padding: 0 !important;
  border-radius: 0 !important;
  font-size: 0.875rem !important;
  line-height: 1.7 !important;
  color: inherit !important;
}

.md-renderer .md-code-block__code span {
  background: transparent !important;
  border: 0 !important;
  box-shadow: none !important;
}

/* ─── Headings ─── */
.prose h1,
.prose h2,
.prose h3,
.prose h4,
.prose h5,
.prose h6 {
  @apply font-sans;
}

.prose h1 {
  @apply text-2xl font-bold tracking-tight mt-8 mb-4;
  color: var(--foreground);
}

.prose h2 {
  @apply text-xl font-semibold tracking-tight mt-7 mb-3;
  color: var(--foreground);
}

.prose h3 {
  @apply text-lg font-semibold tracking-tight mt-6 mb-2.5;
  color: var(--foreground);
}

.prose h4 {
  @apply text-base font-semibold tracking-tight mt-5 mb-2;
  color: var(--foreground);
}

.prose h5 {
  @apply text-sm font-semibold tracking-tight mt-4 mb-2;
  color: var(--foreground);
}

.prose h6 {
  @apply text-sm font-semibold tracking-tight mt-4 mb-2;
  color: var(--muted-foreground);
}

/* ─── Body text ─── */
.prose p {
  @apply mb-4;
  line-height: 1.75;
  color: var(--foreground);
}

.prose strong {
  @apply font-semibold;
  color: var(--foreground);
}

.prose em {
  @apply italic;
}

/* ─── Strikethrough ─── */
.prose del,
.prose s {
  @apply line-through;
  color: var(--muted-foreground);
}

/* ─── Highlight / Mark ─── */
.prose mark {
  @apply rounded px-1 py-0.5;
  background: #fef08a;
  color: #422006;
}

.dark .prose mark {
  background: #854d0e;
  color: #fef9c3;
}

/* ─── Subscript / Superscript ─── */
.prose sub {
  @apply text-[0.75em];
  vertical-align: sub;
}

.prose sup {
  @apply text-[0.75em];
  vertical-align: super;
}

/* ─── Abbreviation ─── */
.prose abbr[title] {
  @apply cursor-help;
  text-decoration: underline dotted;
  text-underline-offset: 3px;
}

/* ─── Keyboard ─── */
.prose kbd {
  @apply inline-block rounded border px-1.5 py-0.5 font-mono text-[0.8em] font-medium leading-none;
  background: var(--muted);
  border-color: var(--border);
  color: var(--foreground);
  box-shadow: 0 1px 0 1px var(--border);
}

/* ─── Links ─── */
.prose a {
  @apply underline underline-offset-2;
  color: var(--primary);
}

/* ─── Lists ─── */
.prose ul {
  @apply list-disc list-outside ml-6 mb-4;
  color: var(--foreground);
}

.prose ol {
  @apply list-decimal list-outside ml-6 mb-4;
  color: var(--foreground);
}

.prose li {
  @apply mb-1;
}

.prose li > ul,
.prose li > ol {
  @apply mt-1 mb-0;
}

/* ─── Task list (GFM) ─── */
.prose ul:has(> li > input[type="checkbox"]) {
  @apply list-none ml-0 pl-0;
}

.prose li:has(> input[type="checkbox"]) {
  @apply flex items-start gap-0;
}

.prose li > input[type="checkbox"] {
  @apply mt-1.5 shrink-0;
}

/* ─── Blockquote ─── */
.prose blockquote {
  @apply border-l-[3px] pl-4 italic my-4;
  border-color: var(--muted-foreground);
  color: var(--muted-foreground);
}

.prose blockquote blockquote {
  @apply mt-2;
  border-color: var(--border);
}

/* ─── Horizontal rule ─── */
.prose hr {
  @apply my-6 border-none;
  height: 1px;
  background: var(--border);
}

/* ─── Tables ─── */
.prose table {
  @apply border-collapse;
}

.prose th {
  @apply font-semibold px-4 py-2 border text-left;
  background: var(--muted);
  color: var(--foreground);
  border-color: var(--border);
}

.prose td {
  @apply px-4 py-2 border;
  color: var(--foreground);
  border-color: var(--border);
}

/* ─── Images ─── */
.prose img {
  @apply my-4 max-w-full h-auto rounded-lg;
}

.prose figure {
  @apply my-4;
}

.prose figcaption {
  @apply mt-2 text-center text-sm;
  color: var(--muted-foreground);
}

/* ─── Details / Summary ─── */
.prose details {
  @apply my-4 rounded-lg border px-4 py-2;
  background: var(--card);
  border-color: var(--border);
}

.prose details:empty,
.prose details:not(:has(> :not(summary))),
.md-renderer details:empty,
.md-renderer details:not(:has(> :not(summary))) {
  display: none;
}

.prose > :empty:not(hr):not(br):not(img) {
  display: none;
}

.prose summary {
  @apply cursor-pointer font-medium select-none;
  color: var(--foreground);
}

.prose details[open] > summary {
  @apply mb-2;
}

/* ─── Definition list ─── */
.prose dl {
  @apply my-4;
}

.prose dt {
  @apply font-semibold mt-3;
  color: var(--foreground);
}

.prose dd {
  @apply ml-6 mt-1;
  color: var(--muted-foreground);
}

/* ─── Footnotes (remark-gfm) ─── */
.prose .footnotes {
  @apply mt-8 border-t pt-4 text-sm;
  border-color: var(--border);
  color: var(--muted-foreground);
}

.prose .footnotes ol {
  @apply ml-4;
}

/* ─── md-renderer: scope overrides only inside our component ─── */
.md-renderer .contains-task-list {
  @apply list-none ml-0 pl-0;
}

/* Animations */
@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Keep transform free for Reading toolbar hover and press motion. */
@keyframes dt-reading-button-enter {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.animate-fade-in {
  animation: fade-in 0.35s ease-out forwards;
}

/* Picker chrome: a soft scrim fade + a small spring-in for the card, so
   modal pickers feel placed rather than popped. */
@keyframes dt-overlay-in {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.animate-overlay-in {
  animation: dt-overlay-in 160ms ease-out;
}
@keyframes dt-pop-in {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.animate-pop-in {
  animation: dt-pop-in 200ms cubic-bezier(0.22, 1, 0.36, 1);
}

/* Streaming "breathing" label — used above the trace panel to surface that
   the assistant is still working. Cycles between full and dim opacity with
   a slow ease, mirroring Claude desktop's reasoning indicator. */
@keyframes dt-breathing {
  0%,
  100% {
    opacity: 0.45;
  }
  50% {
    opacity: 1;
  }
}

.dt-breathing-text {
  animation: dt-breathing 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

/* Whoever a turn was handed to, in the orb's place. A partner's face or an
   agent's mark on a soft tile; while they work a hairline ring breathes out
   from it — the orb's "still going" in their shape. */
.dt-answerer-mark {
  position: relative;
  display: inline-flex;
  flex: none;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
}
.dt-answerer-mark[data-kind="subagent"] { border-radius: 6px; }
.dt-answerer-tile {
  display: inline-flex;
  width: 100%;
  height: 100%;
  align-items: center;
  justify-content: center;
  border-radius: inherit;
  color: var(--foreground);
  background: color-mix(in srgb, var(--foreground) 7%, transparent);
}
.dt-answerer-mark.is-working::after {
  content: "";
  position: absolute;
  inset: -3px;
  border-radius: inherit;
  border: 1.5px solid color-mix(in srgb, var(--primary) 55%, transparent);
  animation: dt-answerer-ring 1.8s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  pointer-events: none;
}
.dt-answerer-mark[data-kind="subagent"].is-working::after { border-radius: 8px; }
@keyframes dt-answerer-ring {
  0%, 100% { opacity: 0.25; transform: scale(0.94); }
  50% { opacity: 1; transform: scale(1.04); }
}
.dt-answerer-name {
  margin-right: -4px;
  color: var(--foreground);
  font-weight: 600;
}
@media (prefers-reduced-motion: reduce) {
  .dt-answerer-mark.is-working::after { animation: none; opacity: 0.7; }
}

/* Trace detail, opening.
   Entry only, deliberately. A height transition would need the body mounted
   while collapsed, and a long transcript has dozens of collapsed rows — that
   is a lot of markdown kept alive to animate something nobody is looking at.
   Fading the body in on mount costs nothing and reads as an unfold; closing
   is instant, which is what a reader wants after deciding they are done. */
@keyframes dt-detail-in {
  from {
    opacity: 0;
    transform: translateY(-2px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.dt-detail-in {
  animation: dt-detail-in 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

/* Trace-row status dot, running state.
   Wider swing than the status header's own breathing (`dt-breathing-text`
   fades 0.45→1): a 5px dot has far less area to signal with than a line of
   text, so it needs the extra contrast to read as "this step is live" from
   across the column. Scale and opacity share one period here — at this size
   the out-of-phase drift the header uses just looks unsteady. */
@keyframes dt-dot-live {
  0%,
  100% {
    opacity: 0.3;
    transform: scale(0.75);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}

.dt-dot-live {
  animation: dt-dot-live 1.25s cubic-bezier(0.4, 0, 0.6, 1) infinite;
  will-change: opacity, transform;
}

/* ─── Turn navigator: arrival flash ───
   After the rail scrolls an earlier question back into view, the bubble
   has to identify itself — the transcript looks the same everywhere and
   a silent scroll leaves the user hunting for what moved. A ring blooms
   and decays once (no loop, no layout shift: `box-shadow` only, so the
   surrounding messages never reflow). Driven by `jumpToTurn`, which adds
   the class and strips it after the animation. */
@keyframes turn-flash {
  0% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 42%, transparent);
  }
  35% {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 32%, transparent);
  }
  100% {
    box-shadow: 0 0 0 7px transparent;
  }
}

.turn-flash {
  animation: turn-flash 1.3s cubic-bezier(0.2, 0.7, 0.3, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .turn-flash {
    animation-duration: 0.01ms;
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 30%, transparent);
  }
}

/* While a fullscreen picker/modal is open, freeze ambient background
   animations (live status dots, breathing labels). They live behind the
   modal's frosted `backdrop-filter`; their per-frame repaints were being
   re-sampled by the blur, reading as a constant shimmer behind the scrim.
   `paused` holds them at their current frame (no jump) and they resume on
   close.

   Canvas-backed marks cannot be reached this way — `ActivityOrb` reads the
   same `data-picker-open` flag in JS and passes `paused` to its rAF loop. */
body[data-picker-open] .dt-dot-live,
body[data-picker-open] .dt-breathing-text {
  animation-play-state: paused !important;
}

/* Capability menu pop-up — the dropdown blooms out of the chip itself
   rather than fading in from above the composer. Origin at bottom-left so
   the menu visually "unfurls" from the chevron corner of the chip. */
@keyframes dt-popup-up {
  from {
    opacity: 0;
    transform: translateY(6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.dt-popup-up {
  animation: dt-popup-up 180ms cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transform-origin: bottom left;
  will-change: opacity, transform;
}

/* Composer rail — the resource group's chips folding into and out of their
   group anchor. Each chip carries its own inline animation-delay, in render
   order on the way in and in reverse on the way out, so folding reads as the
   row collecting itself back into the anchor rather than as four chips
   blinking off together.

   `both` fill is what makes the stagger visible at all: without it a chip
   would sit at its natural, fully visible state through its delay and then
   animate from there. Kept as keyframes rather than transitions because the
   chips animate on mount, which a transition cannot do. */
@keyframes dt-rail-chip-in {
  from {
    opacity: 0;
    transform: translateX(-6px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes dt-rail-chip-out {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(-6px) scale(0.96);
  }
}

.dt-rail-chip-in,
.dt-rail-chip-out {
  animation-duration: 220ms;
  animation-timing-function: cubic-bezier(0.16, 1, 0.3, 1);
  animation-fill-mode: both;
}

.dt-rail-chip-in {
  animation-name: dt-rail-chip-in;
}

.dt-rail-chip-out {
  animation-name: dt-rail-chip-out;
  /* On its way out the chip is no longer a target. */
  pointer-events: none;
}

@media (prefers-reduced-motion: reduce) {
  /* The global override shortens the duration but leaves the delays, which
     would still walk the chips in one at a time. */
  .dt-rail-chip-in,
  .dt-rail-chip-out {
    animation-delay: 0ms !important;
  }
}

/* ----- Chat shell ↔ file preview drawer ---------------------------------
   Squeezes the chat column when the drawer is open. The transition
   timing here MUST match FilePreviewDrawer's transform transition so the
   slide-in and the squeeze animate as one motion. Stays a no-op below
   the lg breakpoint, where the drawer overlays instead. */
:root {
  /* The side panels' slide and the chat column's squeeze are one motion:
     they share this duration and curve, or the panel edge drifts off the
     column edge mid-flight. */
  --viewer-dur: 300ms;
  --viewer-ease: cubic-bezier(0.32, 0.72, 0, 1);
  /* Gap around the viewer panel once it floats as an inset sheet (md+). */
  --viewer-inset: 0px;
}
@media (min-width: 768px) {
  :root {
    --viewer-inset: 8px;
  }
}
@media (prefers-reduced-motion: reduce) {
  :root {
    --viewer-dur: 0ms;
  }
}
.chat-preview-shell {
  transition:
    padding-right var(--viewer-dur) var(--viewer-ease),
    padding-left 240ms cubic-bezier(0.32, 0.72, 0, 1);
  padding-left: 0;
  padding-right: 0;
}
/* While the viewer is being drag-resized, kill the squeeze transition so the
   chat column tracks the panel edge frame-for-frame instead of lagging. */
:root[data-viewer-resizing="true"] .chat-preview-shell {
  transition: none;
}
@media (min-width: 1024px) {
  /* The wider composer-side preview drawer (pre-send attachment peek)
     gets the largest squeeze. */
  .chat-preview-shell[data-preview-open="true"] {
    padding-right: min(560px, 92vw);
  }
  /* Viewer panel (tabbed file/web preview, opened from message attachments
     or assistant links) is next-widest. Wins over the activity panel when
     both are open. Width is user-resizable, so the squeeze tracks the
     ``--viewer-width`` var the panel writes (falls back to 520px). */
  .chat-preview-shell[data-preview-open="false"][data-viewer-open="true"] {
    padding-right: calc(
      min(var(--viewer-width, 520px), 92vw) + var(--viewer-inset)
    );
  }
}

/* ----- Session viewer panel ----------------------------------------------
   A full-screen sheet on phones; from md up an inset, rounded sheet that
   floats a hair off the window edge. Closed, it parks just past the right
   edge and turns hidden once the slide finishes — so its shadow never
   bleeds back on screen and its contents drop out of the tab order. The
   shadow is constant rather than toggled, so nothing pops at either end. */
.dt-viewer-panel {
  transform: translateX(calc(100% + var(--viewer-inset)));
  visibility: hidden;
  transition:
    transform var(--viewer-dur) var(--viewer-ease),
    visibility 0s linear var(--viewer-dur);
}
.dt-viewer-panel[data-open="true"] {
  transform: translateX(0);
  visibility: visible;
  transition:
    transform var(--viewer-dur) var(--viewer-ease),
    visibility 0s;
}
@media (min-width: 768px) {
  .dt-viewer-panel {
    top: var(--viewer-inset);
    right: var(--viewer-inset);
    bottom: var(--viewer-inset);
    height: auto;
    overflow: hidden;
    border: 1px solid color-mix(in srgb, var(--border) 75%, transparent);
    border-radius: 16px;
    /* md–lg: the sheet overlays the conversation, so it needs real lift. */
    box-shadow:
      0 1px 2px color-mix(in srgb, var(--foreground) 4%, transparent),
      0 16px 40px -16px color-mix(in srgb, var(--foreground) 18%, transparent);
  }
}
@media (min-width: 1024px) {
  /* Docked beside the squeezed column it overlaps nothing — a whisper of
     depth is enough to separate it from the page. */
  .dt-viewer-panel {
    box-shadow:
      0 1px 2px color-mix(in srgb, var(--foreground) 3%, transparent),
      0 6px 20px -12px color-mix(in srgb, var(--foreground) 10%, transparent);
  }
}

/* ----- Reading media source browser -------------------------------------
   Watching shares the conversation renderer and owns its responsive video surface. */
.dt-watching-shell {
  position: absolute;
  inset: 0 auto 0 0;
  z-index: 30;
  width: 100%;
  display: flex;
  transform: translateX(-100%);
  transition:
    transform 240ms cubic-bezier(0.32, 0.72, 0, 1),
    visibility 240ms;
  visibility: hidden;
}
.dt-watching-shell[data-watching-open="true"] {
  transform: translateX(0);
  visibility: visible;
}
.dt-watching-shell > * {
  flex: 1;
  min-width: 0;
}
@media (min-width: 1024px) {
  .dt-watching-shell {
    width: 64%;
  }
  .chat-preview-shell[data-watching-open="true"] {
    padding-left: 64%;
  }
}

/* pdf.js text layer. Flattened from pdfjs-dist's own stylesheet (which uses
   nested CSS this build's PostCSS pipeline does not compile) and scoped to the
   class pdf.js itself sets. The spans are transparent and sit exactly over the
   rendered glyphs — that alignment is what makes text selection in the reader
   land on the words the user is pointing at. */
.textLayer {
  position: absolute;
  inset: 0;
  overflow: clip;
  opacity: 1;
  line-height: 1;
  text-align: initial;
  letter-spacing: normal;
  word-spacing: normal;
  text-size-adjust: none;
  forced-color-adjust: none;
  transform-origin: 0 0;
  caret-color: CanvasText;
  z-index: 0;
  --min-font-size: 1;
  --text-scale-factor: calc(
    var(--total-scale-factor, 1) * var(--min-font-size)
  );
  --min-font-size-inv: calc(1 / var(--min-font-size));
}
.textLayer span,
.textLayer br {
  color: transparent;
  position: absolute;
  white-space: pre;
  cursor: text;
  transform-origin: 0% 0%;
  user-select: text;
}
.textLayer > :not(.markedContent),
.textLayer .markedContent span:not(.markedContent) {
  z-index: 1;
  --font-height: 0;
  --scale-x: 1;
  --rotate: 0deg;
  font-size: calc(var(--text-scale-factor) * var(--font-height));
  transform: rotate(var(--rotate)) scaleX(var(--scale-x))
    scale(var(--min-font-size-inv));
}
.textLayer .markedContent {
  display: contents;
}
.textLayer ::selection {
  /* The glyphs are transparent, so the selection tint IS the affordance. */
  background: rgb(59 130 246 / 0.32);
}

/* Highlight painted by `reader_goto`: pulses to catch the eye, then SETTLES at
   a still-visible tint rather than fading away.
   It persists until the next jump replaces it, because the question it answers
   — "which words is the assistant citing?" — is one the reader asks while
   reading the answer, not in the two seconds after the page moved. A highlight
   that vanished on a timer was simply missed. */
.dt-reader-flash {
  background: rgb(96 165 250 / 0.3);
  animation: dt-reader-flash 1.5s ease-out forwards;
  mix-blend-mode: multiply;
}
@keyframes dt-reader-flash {
  0%,
  22% {
    background: rgb(96 165 250 / 0.62);
    box-shadow: 0 0 0 3px rgb(96 165 250 / 0.55);
  }
  100% {
    background: rgb(96 165 250 / 0.3);
    box-shadow: 0 0 0 1px rgb(96 165 250 / 0.28);
  }
}
@media (prefers-reduced-motion: reduce) {
  .dt-reader-flash {
    animation: none;
    box-shadow: 0 0 0 1px rgb(96 165 250 / 0.28);
  }
}

/* Citation chips in assistant prose. Styled by href prefix so the reading
   feature adds no props to the shared Markdown renderer. */
a[href^="#dt-locator-"] {
  display: inline-flex;
  align-items: center;
  border-radius: 5px;
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  padding: 0 4px;
  font-family: var(--font-geist-mono, ui-monospace), monospace;
  font-size: 0.78em;
  font-weight: 500;
  line-height: 1.5;
  color: var(--primary);
  text-decoration: none;
  vertical-align: baseline;
  transition:
    background 120ms ease-out,
    color 120ms ease-out;
}
a[href^="#dt-locator-"]:hover {
  background: color-mix(in srgb, var(--primary) 22%, transparent);
}

/* Slimmer scrollbars inside the reader so the document, not the chrome,
   holds the eye.

   Deliberately NO `scroll-behavior: smooth` here. It would turn every
   `scrollTop` assignment into an animation, and programmatic smooth scrolling
   is silently a no-op in some embedded browsers — which would make citation
   jumps do nothing at all. A jump should also be instant on its merits: easing
   through 400 pages to reach a citation is slow and disorienting. The motion in
   this feature belongs to the pane sliding in and to the highlight pulse. */
.reading-v2[data-reading-workspace][data-learning="true"] {
  position: fixed;
  inset: 0;
  z-index: 60;
  width: 100%;
  height: 100dvh;
}

.dt-reader-scroll {
  scrollbar-width: thin;
}
.dt-reader-scroll::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
.dt-reader-scroll::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--foreground) 18%, transparent);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: content-box;
}
.dt-reader-scroll::-webkit-scrollbar-thumb:hover {
  background: color-mix(in srgb, var(--foreground) 30%, transparent);
  background-clip: content-box;
}
.dt-reader-scroll::-webkit-scrollbar-track {
  background: transparent;
}

/* Recogito Text Annotator's required overlay styles, scoped to the Reader.
   The package's global stylesheet also changes html/body overscroll and every
   selection in the app, so importing it would leak reader behaviour into chat.
   Source: @recogito/text-annotator 4.2.5 (BSD-3-Clause). */
.dt-reader-scroll .r6o-annotatable {
  position: relative;
  -webkit-tap-highlight-color: transparent;
}

.dt-reader-scroll .r6o-annotatable.no-focus-outline {
  outline: none;
}

.dt-reader-scroll .r6o-annotatable .r6o-span-highlight-layer {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  mix-blend-mode: multiply;
}

.dt-reader-scroll .r6o-annotatable .r6o-span-highlight-layer.hidden {
  display: none;
}

.dt-reader-scroll .r6o-annotatable .r6o-span-highlight-layer .r6o-annotation {
  position: absolute;
  display: block;
  box-sizing: content-box;
  border-style: solid;
  border-width: 0;
}

.dt-reader-scroll .r6o-annotatable .hovered * {
  cursor: pointer;
}

/* ─── Reduced motion ──────────────────────────────────────────────────────
   Honor the OS-level prefers-reduced-motion setting. We don't strip motion
   entirely — interaction-critical transitions (drawer slide, menu reveal)
   stay visible but are shortened to a near-imperceptible duration so the
   UI still communicates state changes without vestibular jitter. Loop
   animations (breathing, pulse, spin) are removed outright. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }

  .dt-detail-in,
  .dt-dot-live,
  .dt-breathing-text,
  .animate-spin {
    animation: none !important;
  }
}

/* Watching switches panes on small screens without unmounting playback or chat. */
.watching-mobile-tabs {
  display: none;
}
@media (max-width: 1023px) {
  .watching-mobile-tabs {
    display: flex;
    height: 44px;
    gap: 8px;
    padding: 4px 12px;
    position: absolute;
    inset: 0 0 auto;
    z-index: 40;
    background: var(--background);
    border-bottom: 1px solid var(--border);
  }
  .watching-mobile-tabs button {
    flex: 1;
    border-radius: 8px;
  }
  .watching-mobile-tabs button[aria-pressed="true"] {
    background: var(--muted);
    font-weight: 600;
  }
  .watching-surface .dt-watching-shell {
    top: 44px;
  }
  .watching-surface[data-mobile-view="chat"] .dt-watching-shell {
    visibility: hidden;
    pointer-events: none;
  }
  [data-watching-workspace="true"] > .chat-preview-shell {
    padding-top: 44px;
  }
  .watching-surface[data-mobile-view="video"] ~ .chat-preview-shell {
    visibility: hidden;
    pointer-events: none;
  }
}

/* Native provider browsing stays above the mounted learning workspace. */
.watching-browser {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: flex;
  flex-direction: column;
  background: var(--background);
}
.watching-browser-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 13px;
}
.watching-browser-button:hover,
.watching-browser-button[aria-pressed='true'] {
  background: var(--muted);
}
.watching-browser-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.watching-video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 24px 20px;
}
.watching-video-card {
  text-align: left;
  min-width: 0;
  border-radius: 12px;
}
.watching-video-card:hover h2 {
  text-decoration: underline;
}
.watching-browser-empty {
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  color: var(--muted-foreground);
  text-align: center;
}
.watching-browse-toggle {
  position: absolute;
  right: 12px;
  top: 8px;
  z-index: 44;
  background: var(--background);
}
.watching-account-error {
  position: absolute;
  bottom: 12px;
  left: 12px;
  right: 12px;
  z-index: 46;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--background);
}
.watching-surface[data-browsing] ~ .chat-preview-shell {
  visibility: hidden;
  pointer-events: none;
}
@media (max-width: 1023px) {
  .watching-browse-toggle {
    top: 48px;
  }
}
@media (max-width: 520px) {
  .watching-video-grid {
    grid-template-columns: 1fr;
  }
}
.watching-surface .dt-watching-shell { top: 48px; }
[data-watching-workspace="true"] > .chat-preview-shell { padding-top: 48px; }
@media (max-width: 1023px) {
  .watching-surface .dt-watching-shell { top: 92px; }
  [data-watching-workspace="true"] > .chat-preview-shell { padding-top: 92px; }
}
.watching-surface[data-browsing] .dt-watching-shell,
.watching-surface[data-browsing] .watching-mobile-tabs {
  visibility: hidden;
  pointer-events: none;
}