:root {
  --bg: #f5f1e8;
  --paper: #fffdf8;
  --paper-soft: #fbf8ef;
  --ink: #151515;
  --ink-soft: #313131;
  --muted: #767066;
  --muted-2: #9b9285;
  --border: #ded4c3;
  --border-soft: #eee5d8;
  --navy: #161b33;
  --navy-2: #222a51;
  --blue: #3447ff;
  --blue-soft: #e7eaff;
  --gold: #c9963a;
  --gold-soft: #fff3ce;
  --green: #15803d;
  --green-soft: #e8f7ee;
  --amber: #b7791f;
  --amber-soft: #fff4db;
  --purple: #6d28d9;
  --purple-soft: #f0e7ff;
  --red: #b91c1c;
  --red-soft: #fee8e8;
  --gray: #71717a;
  --gray-soft: #eeeeef;
  --highlight: #fff1a8;
  --shadow: 0 24px 70px rgba(45, 35, 20, 0.12);
  --shadow-soft: 0 10px 40px rgba(45, 35, 20, 0.08);
  --project-sidebar: 320px;
  --topbar: 96px;
  --reader-toolbar-top: var(--topbar);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --radius-sm: 10px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body.theorytrace-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 0%, rgba(201, 150, 58, 0.16), transparent 32%),
    radial-gradient(circle at 88% 10%, rgba(52, 71, 255, 0.10), transparent 34%),
    linear-gradient(135deg, var(--bg), #faf7ef);
  color: var(--ink);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

a:hover {
  text-decoration: none;
}

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

.app-shell {
  display: grid;
  grid-template-columns: minmax(620px, 1fr) var(--project-sidebar);
  height: 100vh;
  min-height: 100vh;
  overflow: hidden;
}

.app-shell.app-shell-full {
  grid-template-columns: minmax(0, 1fr);
}

.main-area {
  min-width: 0;
  height: 100vh;
  overflow-x: hidden;
  overflow-y: auto;
  padding: 20px 28px 56px;
  scrollbar-width: thin;
  scrollbar-color: rgba(118, 112, 102, 0.54) transparent;
}

@media (min-width: 901px) {
  .main-area {
    overflow-y: scroll;
    scrollbar-gutter: stable;
  }

  .main-area::-webkit-scrollbar {
    width: 11px;
    height: 11px;
  }

  .main-area::-webkit-scrollbar-track {
    background: transparent;
  }

  .main-area::-webkit-scrollbar-thumb {
    min-height: 48px;
    border: 3px solid transparent;
    border-radius: 999px;
    background: rgba(118, 112, 102, 0.48);
    background-clip: padding-box;
  }

  .main-area::-webkit-scrollbar-thumb:hover {
    background: rgba(22, 27, 51, 0.45);
    background-clip: padding-box;
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  min-height: var(--topbar);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin: -20px -28px 24px;
  padding: 12px 28px;
  background: rgba(245, 241, 232, 0.78);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(222, 212, 195, 0.6);
}

.topbar-compact {
  min-height: 72px;
}

.main-area:has(> .topbar-reader),
.main-area:has(> .topbar-compact) {
  padding-top: 0;
}

.main-area:has(> .topbar-reader) > .topbar-reader,
.main-area:has(> .topbar-compact) > .topbar-compact {
  margin-top: 0;
}

.top-actions,
.tt-actions,
.tt-form-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tt-hidden-status-form {
  display: none;
}

.btn,
.tt-btn {
  border: 0;
  border-radius: 999px;
  min-height: 42px;
  padding: 0 16px;
  cursor: pointer;
  font-weight: 700;
  font-size: 13px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: inherit;
  transition: 180ms ease;
}

.btn:hover,
.tt-btn:hover {
  transform: translateY(-1px);
}

.btn.primary,
.tt-btn-primary {
  background: var(--navy);
  color: white;
  box-shadow: 0 14px 28px rgba(22, 27, 51, 0.18);
}

.btn.soft,
.tt-btn {
  background: var(--paper);
  color: var(--ink-soft);
  border: 1px solid var(--border);
}

.tt-btn-danger {
  color: var(--red);
  border-color: #efbcbc;
}

.reader-frame {
  max-width: 940px;
  margin: 0 auto;
}

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 0;
}

.breadcrumb strong {
  display: block;
  max-width: 34vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink-soft);
  font-weight: 700;
}

.tt-quiz-breadcrumb {
  flex-wrap: nowrap;
  overflow: hidden;
  width: 100%;
}

.tt-quiz-breadcrumb .tt-breadcrumb-crumb {
  display: block;
  min-width: 0;
  max-width: 14ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-quiz-breadcrumb .tt-breadcrumb-document {
  max-width: 18ch;
}

.tt-quiz-breadcrumb strong {
  flex: 0 0 auto;
  max-width: none;
}

.tt-math-title {
  line-height: 1.35;
}

.tt-math-title .katex {
  max-width: 100%;
  font-size: 1em;
  line-height: 1;
  vertical-align: -0.08em;
}

.tt-math-title .katex-html {
  white-space: nowrap;
}

.tt-math-title .katex-display {
  display: inline-block;
  margin: 0;
  text-align: inherit;
}

.breadcrumb strong.tt-math-title,
.project-title-text.tt-math-title,
.doc-name strong.tt-math-title {
  min-height: 1.35em;
}

.project-title-text.tt-math-title {
  display: inline-block;
  vertical-align: middle;
}

.project-tree .doc-name strong.tt-math-title,
.project-tree .project-title-text.tt-math-title {
  display: inline-flex;
  align-items: baseline;
  gap: 0.18em;
  width: max-content;
  min-width: max-content;
  max-width: none;
  white-space: nowrap;
}

.project-tree .doc-name strong.tt-math-title .katex,
.project-tree .project-title-text.tt-math-title .katex {
  flex: 0 0 auto;
  max-width: none;
  overflow: visible;
}

.reader-label-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
}

.reader-label-main .breadcrumb {
  flex: 1 1 auto;
}

.reader-labels {
  width: min(940px, 100%);
  margin: 0;
  padding: 0;
  color: var(--ink-soft);
}

.reader-label-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex: 0 0 auto;
}

.inline-add-project-form,
.inline-publish-project-form {
  display: inline-flex;
  margin: 0;
}

.reader-label-actions .btn {
  min-height: 34px;
  padding: 0 12px;
  font-size: 12px;
}

.publish-project-button {
  border-color: rgba(21, 128, 61, 0.28);
  color: var(--green);
}

.reader-label-toggle {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.reader-label-toggle:hover {
  background: var(--paper-soft);
  color: var(--navy);
}

.reader-label-toggle span {
  width: 8px;
  height: 8px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-135deg) translate(-1px, -1px);
  transition: transform 140ms ease;
}

.reader-labels.is-collapsed .reader-label-actions,
.reader-labels.is-collapsed .reader-document-meta,
.reader-labels.is-collapsed .reader-extra-crumb {
  display: none;
}

.reader-labels.is-collapsed .reader-label-main {
  align-items: center;
}

.reader-labels.is-collapsed .reader-label-toggle span {
  transform: rotate(45deg) translate(-1px, -1px);
}

.topbar.reader-labels-collapsed {
  min-height: 58px;
}

.reader-document-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.reader-document-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 7px;
  border: 1px solid rgba(222, 212, 195, 0.64);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.42);
}

.reader-collaboration {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: max-content;
}

.member-stack {
  display: inline-flex;
  align-items: center;
  padding-left: 8px;
}

.member-avatar {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  margin-left: -8px;
  overflow: hidden;
  border: 2px solid rgba(255, 253, 248, 0.94);
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  font-size: 11px;
  font-weight: 850;
  text-decoration: none;
  box-shadow: 0 8px 18px rgba(45, 35, 20, 0.10);
}

.member-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tt-header-menu {
  position: relative;
}

.tt-header-menu summary {
  list-style: none;
}

.tt-header-menu summary::-webkit-details-marker {
  display: none;
}

.header-icon-button {
  position: relative;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(118, 112, 102, 0.18);
  border-radius: 999px;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.header-icon-button:hover,
.tt-header-menu[open] .header-icon-button {
  border-color: rgba(22, 27, 51, 0.24);
  background: rgba(255, 253, 248, 0.76);
  color: var(--navy);
  box-shadow: 0 10px 26px rgba(45, 35, 20, 0.08);
}

.tt-invite-icon,
.tt-bell-icon {
  position: relative;
  display: block;
}

.tt-invite-icon {
  width: 19px;
  height: 19px;
}

.tt-invite-icon svg,
.tt-bell-icon svg {
  width: 100%;
  height: 100%;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.tt-bell-icon {
  width: 19px;
  height: 19px;
}

.notification-count {
  position: absolute;
  right: -3px;
  top: -4px;
  min-width: 16px;
  height: 16px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 2px solid #ffffff;
  border-radius: 999px;
  background: var(--red);
  color: #ffffff;
  font-size: 9px;
  font-weight: 900;
  line-height: 1;
}

.header-menu-panel {
  position: absolute;
  top: calc(100% + 9px);
  right: 0;
  z-index: 80;
  width: min(330px, calc(100vw - 32px));
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.header-menu-panel > strong {
  display: block;
  margin-bottom: 9px;
  color: var(--ink);
  font-size: 12px;
}

.invite-panel form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.invite-panel input {
  min-width: 0;
  height: 34px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink);
  padding: 0 11px;
  outline: none;
  font-size: 13px;
}

.invite-panel input:focus {
  border-color: rgba(52, 71, 255, 0.34);
  box-shadow: 0 0 0 3px rgba(52, 71, 255, 0.10);
}

.invite-panel button,
.invitation-item button {
  min-height: 34px;
  border: 0;
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.invitation-list {
  display: grid;
  gap: 7px;
}

.tt-invitation-list-page {
  max-width: 520px;
  margin-top: 16px;
}

.invitation-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin: 0;
  padding: 8px;
  border-radius: 10px;
  background: var(--paper-soft);
}

.invitation-item span {
  min-width: 0;
}

.invitation-item b,
.invitation-item small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.invitation-item b {
  color: var(--ink);
  font-size: 12px;
}

.invitation-item small,
.notification-panel p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 11px;
}

.reader-paper {
  position: relative;
  padding: 42px 48px 56px;
  border-radius: var(--radius-xl);
  background: var(--paper);
  border: 1px solid rgba(222, 212, 195, 0.9);
  box-shadow: var(--shadow);
}

.tt-profile-paper {
  max-width: 760px;
  margin: 0 auto;
}

.tt-profile-head {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 28px;
}

.tt-profile-avatar {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--navy);
  color: white;
  font-weight: 800;
}

.tt-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tt-profile-head h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.tt-profile-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.tt-profile-form {
  display: grid;
  gap: 14px;
}

.tt-profile-section h2 {
  margin: 0;
  font-size: 16px;
}

.tt-profile-section p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tt-profile-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tt-profile-form input,
.tt-profile-form select,
.tt-profile-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  font: inherit;
}

.tt-profile-form textarea {
  min-height: 92px;
  resize: vertical;
}

.tt-profile-form .errorlist,
.tt-profile-errors {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.tt-profile-status {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 12px;
}

.tt-profile-status span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--gray-soft);
  color: var(--gray);
  font-weight: 800;
}

.tt-profile-status span.ready {
  background: var(--green-soft);
  color: var(--green);
}

.tt-profile-status em {
  font-style: normal;
}

.tt-profile-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
}

.tt-profile-actions a,
.tt-profile-actions button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
}

.tt-profile-actions a {
  background: var(--paper-soft);
  color: var(--muted);
}

.tt-profile-actions button {
  background: var(--gold);
  color: #211600;
  cursor: pointer;
}

.tt-profile-actions-inline {
  justify-content: flex-start;
  margin-top: 0;
}

.tt-ai-access-paper {
  max-width: 920px;
}

.tt-ai-access-summary {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.tt-ai-access-bulk {
  flex-wrap: wrap;
}

.tt-ai-access-bulk form,
.tt-ai-access-controls form {
  margin: 0;
}

.tt-ai-access-bulk button,
.tt-ai-access-controls button {
  border: 0;
  border-radius: 999px;
  padding: 10px 14px;
  background: var(--gold);
  color: #211600;
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
}

.tt-ai-access-bulk button.muted,
.tt-ai-access-controls button.muted {
  background: var(--paper-soft);
  color: var(--muted);
}

.tt-ai-access-row {
  align-items: center;
}

.tt-ai-access-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.tt-subscription-paper .tt-profile-section h1 {
  margin: 0;
  font-size: 24px;
}

.tt-subscription-lock-note {
  display: grid;
  gap: 5px;
  border-radius: 8px;
  background: var(--gold-soft);
  color: var(--ink);
  padding: 11px 12px;
  font-size: 12px;
  line-height: 1.45;
}

.tt-subscription-lock-note strong {
  font-size: 13px;
}

.tt-subscription-lock-note span {
  color: var(--muted);
}

.tt-subscription-lock-note a {
  color: var(--navy);
  font-weight: 800;
}

.tt-subscription-list {
  display: grid;
  gap: 8px;
}

.tt-subscription-list.compact {
  margin-top: 4px;
}

.tt-subscription-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 10px 11px;
  border-radius: 8px;
  background: var(--paper-soft);
  font-size: 12px;
}

.tt-subscription-row-link {
  color: var(--ink-soft);
  text-decoration: none;
}

.tt-subscription-row-link:hover {
  background: var(--gold-soft);
}

.tt-subscription-row div {
  display: grid;
  gap: 3px;
}

.tt-subscription-row span,
.tt-muted {
  color: var(--muted);
}

.tt-subscription-status {
  font-style: normal;
  white-space: nowrap;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--gray-soft);
  color: var(--gray);
  font-weight: 800;
}

.tt-subscription-status-pending {
  background: var(--gold-soft);
  color: #6d4b00;
}

.tt-subscription-status-accepted {
  background: var(--green-soft);
  color: var(--green);
}

.tt-subscription-status-rejected {
  background: var(--red-soft);
  color: var(--red);
}

.tt-plan-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--gray-soft);
  color: var(--gray);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tt-plan-pill-pro {
  background: var(--green-soft);
  color: var(--green);
}

.tt-plan-pill-pending {
  background: var(--gold-soft);
  color: #6d4b00;
}

.tt-plan-pill-rejected {
  background: var(--red-soft);
  color: var(--red);
}

.tt-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.tt-plan-card {
  display: grid;
  gap: 7px;
  border-radius: 8px;
  background: var(--paper-soft);
  padding: 14px;
}

.tt-plan-card strong {
  font-size: 15px;
}

.tt-plan-card p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tt-plan-card-pro {
  background: var(--green-soft);
}

.tt-section-head-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.tt-section-head-row > a {
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  padding: 8px 12px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.tt-payment-calendar-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 14px;
}

.tt-payment-calendar-month {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.tt-payment-calendar-month h3 {
  margin: 0;
  font-size: 13px;
  color: var(--ink-soft);
}

.tt-payment-calendar-weekdays,
.tt-payment-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.tt-payment-calendar-weekdays span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.tt-payment-calendar-day {
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  min-width: 0;
  border-radius: 7px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.tt-payment-calendar-day.outside {
  opacity: 0.35;
}

.tt-payment-calendar-day.covered {
  background: var(--green-soft);
  color: var(--green);
  box-shadow: inset 0 0 0 1px rgba(20, 116, 58, 0.18);
}

.tt-payment-calendar-day.today {
  box-shadow: inset 0 0 0 2px var(--gold);
}

.tt-payment-calendar-day.covered.today {
  box-shadow:
    inset 0 0 0 1px rgba(20, 116, 58, 0.18),
    0 0 0 2px var(--gold-soft);
}

.tt-review-list {
  display: grid;
  gap: 18px;
  margin-top: 18px;
}

.tt-review-card {
  display: grid;
  gap: 14px;
  padding-top: 18px;
  border-top: 1px solid var(--border-soft);
}

.tt-review-head,
.tt-review-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.tt-review-head div {
  display: grid;
  gap: 3px;
}

.tt-review-head span {
  color: var(--muted);
  font-size: 12px;
}

.tt-review-head h1 {
  margin: 0;
  font-size: 24px;
}

.tt-review-head a {
  color: var(--navy);
  font-weight: 800;
}

.tt-review-grid {
  display: grid;
  grid-template-columns: minmax(180px, 240px) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.tt-review-receipt {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: contain;
  border-radius: 8px;
  background: var(--paper-soft);
}

.tt-review-detail {
  display: grid;
  gap: 10px;
  font-size: 12px;
  color: var(--muted);
}

.tt-review-detail p {
  margin: 0;
}

.tt-review-detail label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.tt-review-detail textarea,
.tt-review-actions textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 9px 10px;
  font: inherit;
  resize: vertical;
}

.tt-review-actions textarea {
  flex: 1 1 260px;
}

.tt-review-actions button {
  border: 0;
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.tt-review-actions button[value="accepted"] {
  background: var(--green-soft);
  color: var(--green);
}

.tt-review-actions button[value="rejected"] {
  background: var(--red-soft);
  color: var(--red);
}

@media (max-width: 760px) {
  .tt-review-grid {
    grid-template-columns: 1fr;
  }

  .tt-subscription-row,
  .tt-review-head,
  .tt-review-actions {
    align-items: flex-start;
  }

  .tt-subscription-row {
    flex-direction: column;
  }

  .tt-section-head-row {
    flex-direction: column;
  }

  .tt-ai-access-controls {
    margin-left: 0;
    flex-wrap: wrap;
  }

  .tt-plan-grid {
    grid-template-columns: 1fr;
  }
}

.tt-profile-contributions {
  display: grid;
  gap: 12px;
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--border-soft);
}

.tt-profile-project-list {
  display: grid;
  gap: 6px;
}

.tt-profile-project-list a {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 12px;
}

.tt-profile-project-list span {
  color: var(--muted);
  white-space: nowrap;
}

.tt-profile-logout {
  display: flex;
  justify-content: flex-end;
  margin-top: 16px;
}

.tt-profile-logout button {
  border: 0;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--red);
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.tt-activity-topbar .reader-labels {
  width: min(980px, 100%);
  line-height: 1;
}

.tt-activity-topbar {
  min-height: 44px;
  margin: 0 -28px 14px;
  padding: 6px 28px;
}

.tt-activity-label-main {
  min-height: 24px;
}

.tt-activity-breadcrumb {
  gap: 6px;
  flex-wrap: nowrap;
  overflow: hidden;
  font-size: 12px;
  white-space: nowrap;
}

.tt-activity-breadcrumb a,
.tt-activity-breadcrumb span {
  flex: 0 0 auto;
}

.tt-activity-breadcrumb strong {
  flex: 0 1 auto;
  max-width: none;
}

.tt-activity-frame {
  width: min(980px, 100%);
}

.tt-activity-page {
  display: grid;
  gap: 10px;
}

.tt-activity-page-detail {
  width: min(780px, 100%);
}

.tt-activity-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.tt-activity-head small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.tt-activity-back {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 0 11px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.tt-activity-user-list,
.tt-activity-day-list,
.tt-activity-event-list {
  display: grid;
  gap: 4px;
}

.tt-activity-user-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-soft);
  color: inherit;
  text-decoration: none;
}

.tt-activity-user-row:hover {
  background: rgba(255, 248, 231, 0.46);
}

.tt-activity-user-avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 999px;
  background: var(--navy);
  color: white;
  font-size: 11px;
  font-weight: 900;
}

.tt-activity-user-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.tt-activity-user-main {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tt-activity-user-main strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-activity-user-main small {
  min-width: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tt-activity-user-latest.tt-math-title {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.tt-activity-user-row > em {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: white;
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.tt-activity-day-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  scroll-margin-top: 70px;
  gap: 5px 10px;
  padding: 9px 4px;
  border-bottom: 1px solid var(--border-soft);
  border-radius: 0;
  color: inherit;
  text-decoration: none;
}

.tt-activity-day-row:hover {
  background: rgba(255, 248, 231, 0.46);
}

.tt-activity-day-row.active {
  background: rgba(255, 248, 231, 0.56);
  box-shadow: inset 3px 0 0 var(--gold);
}

.tt-activity-day-row strong {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.32;
  text-overflow: ellipsis;
}

.tt-activity-event-body strong {
  display: block;
  min-width: 0;
  overflow: visible;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.tt-activity-day-row small,
.tt-activity-event-body small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.tt-activity-event-body .tt-math-title {
  overflow: visible;
  text-overflow: clip;
  white-space: normal;
}

.tt-activity-day-row em {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  border-radius: 999px;
  background: white;
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.tt-activity-chips {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.tt-activity-chips b {
  display: inline-flex;
  align-items: center;
  min-height: 18px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 900;
}

.tt-activity-detail {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.tt-activity-detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.tt-activity-detail-head h2 {
  margin: 0;
  font-size: 18px;
}

.tt-activity-detail-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.tt-activity-detail-head > strong {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 12px;
}

.tt-activity-event {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border-soft);
  color: inherit;
  text-decoration: none;
  scroll-margin-top: 72px;
}

.tt-activity-event:hover {
  background: rgba(255, 248, 231, 0.46);
}

.tt-activity-event:target {
  background: rgba(255, 248, 231, 0.72);
  box-shadow: inset 3px 0 0 var(--gold);
}

.tt-activity-event time {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.tt-activity-event-body {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.tt-activity-event-badge {
  justify-self: start;
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 900;
  text-transform: uppercase;
}

.tt-activity-event-green .tt-activity-event-badge {
  background: var(--green-soft);
  color: var(--green);
}

.tt-activity-event-gold .tt-activity-event-badge {
  background: var(--gold-soft);
  color: var(--gold);
}

.tt-activity-event-navy .tt-activity-event-badge {
  background: rgba(222, 226, 233, 0.72);
  color: var(--navy);
}

.tt-activity-event-red .tt-activity-event-badge {
  background: rgba(254, 242, 242, 0.92);
  color: var(--red);
}

.tt-aksbel-report-page {
  width: min(980px, 100%);
}

.tt-aksbel-report-head {
  margin-bottom: 12px;
}

.tt-aksbel-user-report-page {
  padding-top: 18px;
}

.tt-aksbel-user-hero {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.tt-aksbel-user-hero .tt-activity-user-avatar {
  width: 42px;
  height: 42px;
}

.tt-aksbel-user-hero h1 {
  margin: 1px 0 2px;
  color: var(--navy);
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1;
}

.tt-aksbel-user-hero p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.tt-aksbel-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 18px;
}

.tt-aksbel-summary div {
  display: grid;
  gap: 2px;
  min-height: 70px;
  align-content: center;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.78);
  border: 1px solid var(--border-soft);
}

.tt-aksbel-summary strong {
  color: var(--navy);
  font-size: 28px;
  line-height: 1;
}

.tt-aksbel-summary span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}

.tt-aksbel-report-section {
  display: grid;
  gap: 8px;
  margin-top: 18px;
}

.tt-aksbel-section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-soft);
}

.tt-aksbel-section-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 18px;
}

.tt-aksbel-section-head p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.tt-aksbel-learner-list,
.tt-aksbel-history-list,
.tt-aksbel-day-list {
  display: grid;
  gap: 4px;
}

.tt-aksbel-learner-row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.tt-aksbel-learner-row.active {
  background: rgba(232, 247, 238, 0.36);
}

.tt-aksbel-learner-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.tt-aksbel-learner-main strong,
.tt-aksbel-history-row header strong,
.tt-aksbel-day-row strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}

.tt-aksbel-learner-main small,
.tt-aksbel-history-row header small,
.tt-aksbel-day-row small {
  color: var(--muted);
  font-size: 11px;
}

.tt-aksbel-learner-row > em,
.tt-aksbel-day-row > em {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: white;
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.tt-aksbel-history-row {
  display: grid;
  gap: 8px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border-soft);
}

.tt-aksbel-history-row header {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
}

.tt-aksbel-history-row header span:last-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.tt-aksbel-history-title {
  color: inherit;
  text-decoration: none;
}

.tt-aksbel-project-report-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 32px;
  align-items: center;
  gap: 10px;
  padding: 10px 4px;
  border-bottom: 1px solid var(--border-soft);
}

.tt-aksbel-project-report-row.active {
  background: rgba(232, 247, 238, 0.36);
}

.tt-aksbel-project-report-main {
  display: grid;
  gap: 2px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.tt-aksbel-project-report-main strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.3;
}

.tt-aksbel-project-report-main small {
  color: var(--muted);
  font-size: 11px;
}

.tt-aksbel-project-report-row > em {
  display: inline-grid;
  place-items: center;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  background: white;
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.tt-learning-report-page {
  width: min(980px, 100%);
  display: grid;
  gap: 16px;
}

@media (min-width: 901px) {
  .tt-page.tt-learning-report-page {
    width: min(980px, calc(100% - 72px));
    margin-left: 0;
    margin-right: 72px;
  }
}

.tt-learning-report-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}

.tt-learning-report-head h1 {
  margin: 2px 0;
  color: var(--navy);
  font-size: clamp(24px, 4vw, 38px);
  line-height: 1;
}

.tt-learning-report-head p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.tt-learning-score {
  display: grid;
  justify-items: end;
  gap: 2px;
  min-width: 116px;
}

.tt-learning-score strong {
  color: var(--green);
  font-size: clamp(38px, 8vw, 68px);
  line-height: 0.9;
}

.tt-learning-score span,
.tt-learning-stat-grid span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
  text-transform: uppercase;
}

.tt-learning-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.tt-learning-stat-grid article {
  display: grid;
  gap: 3px;
  min-height: 82px;
  align-content: center;
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.74);
  border: 1px solid var(--border-soft);
}

.tt-learning-stat-grid strong {
  color: var(--ink);
  font-size: 30px;
  line-height: 1;
}

.tt-learning-stat-grid small {
  color: var(--muted);
  font-size: 11px;
}

.tt-learning-chart-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tt-learning-donut-card {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  align-items: center;
  gap: 14px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.68);
  border: 1px solid var(--border-soft);
}

.tt-learning-donut {
  --value: 0;
  width: 84px;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background:
    radial-gradient(circle at center, var(--paper) 0 54%, transparent 55%),
    conic-gradient(var(--green) calc(var(--value) * 1%), rgba(34, 197, 94, 0.12) 0);
}

.tt-learning-donut.read {
  background:
    radial-gradient(circle at center, var(--paper) 0 54%, transparent 55%),
    conic-gradient(var(--gold) calc(var(--value) * 1%), rgba(212, 175, 55, 0.14) 0);
}

.tt-learning-donut strong {
  color: var(--ink);
  font-size: 20px;
  line-height: 1;
}

.tt-learning-donut-card h2,
.tt-learning-section-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 15px;
  line-height: 1.2;
}

.tt-learning-donut-card p,
.tt-learning-section-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.tt-learning-trend {
  display: grid;
  gap: 10px;
}

.tt-learning-section-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 12px;
}

.tt-learning-section-head > span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.tt-learning-bars {
  display: grid;
  gap: 6px;
}

.tt-learning-bar-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px solid var(--border-soft);
}

.tt-learning-bar-row span {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.tt-learning-bar-row strong {
  color: var(--ink);
  font-size: 12px;
  line-height: 1.2;
}

.tt-learning-bar-row small {
  color: var(--muted);
  font-size: 10px;
}

.tt-learning-bar-row em {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 24px;
  border-radius: 999px;
  background: white;
  color: var(--ink-soft);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.tt-learning-bar-track {
  position: relative;
  height: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(27, 47, 74, 0.08);
}

.tt-learning-bar-track i {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
}

.tt-learning-bar-track .total {
  background: rgba(27, 47, 74, 0.18);
}

.tt-learning-bar-track .questions {
  height: 10px;
  top: 4px;
  background: rgba(212, 175, 55, 0.55);
}

.tt-learning-bar-track .correct {
  height: 5px;
  top: 6.5px;
  background: var(--green);
}

.tt-aksbel-day-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 8px;
  padding: 7px 4px;
  border-radius: 7px;
}

.tt-aksbel-day-row.active {
  background: rgba(255, 248, 231, 0.54);
}

.tt-aksbel-day-row .tt-activity-chips {
  grid-column: 1 / -1;
}

.tt-auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px;
}

.tt-auth-panel {
  width: min(430px, 100%);
  display: grid;
  gap: 22px;
  padding: 28px;
  border: 1px solid rgba(222, 212, 195, 0.86);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow-soft);
}

.tt-auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--navy);
  font-weight: 850;
}

.tt-auth-brand span {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--navy);
  color: #fff;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 30px;
  line-height: 1;
}

.tt-auth-head {
  display: grid;
  gap: 6px;
}

.tt-auth-head h1,
.tt-auth-head p {
  margin: 0;
}

.tt-auth-head h1 {
  color: var(--ink);
  font-size: 28px;
  line-height: 1.1;
}

.tt-auth-head p {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tt-auth-form {
  display: grid;
  gap: 14px;
}

.tt-auth-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
}

.tt-auth-form label > span {
  text-transform: uppercase;
}

.tt-auth-form input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  padding: 11px 12px;
}

.tt-auth-form small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.45;
}

.tt-auth-form .errorlist {
  margin: 0;
  padding-left: 18px;
  color: var(--red);
  font-size: 12px;
  font-weight: 800;
}

.tt-auth-switch {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.tt-auth-switch a {
  color: var(--navy);
  font-weight: 850;
}

.tt-profile-check {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid rgba(21, 128, 61, 0.22);
  border-radius: 10px;
  background: rgba(232, 247, 238, 0.48);
}

.tt-profile-check input {
  width: 16px;
  height: 16px;
  margin-top: 2px;
  accent-color: var(--green);
}

.tt-profile-check strong,
.tt-profile-check small {
  display: block;
}

.tt-profile-check strong {
  color: var(--ink);
  font-size: 13px;
}

.tt-profile-check small {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tt-public-library {
  width: min(1180px, 100%);
  margin: 0 auto;
}

.tt-library-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0;
  padding: 4px 0 10px;
  border-bottom: 0;
}

.tt-library-section-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 30px;
  line-height: 1.04;
  letter-spacing: 0;
}

.tt-public-graph-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  text-align: left;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tt-public-graph-meta span {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  text-align: left;
  min-height: 28px;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.72);
  border: 1px solid rgba(222, 212, 195, 0.78);
}

.tt-public-invitations {
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.72);
}

.tt-public-invitations > strong {
  display: block;
  margin-bottom: 8px;
  color: var(--ink);
  font-size: 13px;
}

.tt-aksbel-library-main {
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.94), rgba(245, 241, 232, 0.88)),
    var(--bg);
}

.tt-aksbel-brand-label {
  justify-content: flex-start;
  min-height: 38px;
}

.tt-library-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.tt-library-brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 34px;
  border: 1px solid rgba(161, 118, 32, 0.28);
  border-radius: 10px;
  background:
    radial-gradient(circle at 35% 26%, rgba(255, 255, 255, 0.72), transparent 34%),
    linear-gradient(135deg, var(--gold), #f4d47c);
  color: #31220a;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 29px;
  font-weight: 700;
  line-height: 1;
  box-shadow: 0 8px 22px rgba(161, 118, 32, 0.18);
}

.tt-library-brand-copy {
  display: grid;
  gap: 1px;
  min-width: 0;
}

.tt-library-brand-copy strong {
  color: var(--navy);
  font-size: 15px;
  font-weight: 900;
  line-height: 1.05;
}

.tt-library-brand-copy small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  line-height: 1.2;
  white-space: nowrap;
}

.tt-library-top-actions {
  position: relative;
  margin-left: auto;
}

.tt-library-search {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 8;
  width: min(320px, calc(100vw - 36px));
  padding: 8px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow-soft);
}

.tt-library-search[hidden] {
  display: none;
}

.tt-library-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 12px;
  background: white;
  color: var(--ink);
  font-size: 13px;
}

.tt-aksbel-library-page,
.tt-aksbel-book-form-page {
  width: min(1180px, calc(100% - 48px));
  margin: 0 auto;
  padding: 28px 0 60px;
}

.tt-aksbel-library-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(222, 212, 195, 0.68);
}

.tt-aksbel-library-head h1 {
  margin: 2px 0;
  color: var(--navy);
  font-size: clamp(34px, 7vw, 74px);
  line-height: 0.95;
}

.tt-aksbel-library-head p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.tt-aksbel-library-head small {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.tt-aksbel-library-side {
  display: grid;
  justify-items: end;
  gap: 10px;
  flex: 0 0 auto;
}

.tt-aksbel-field-strip {
  display: flex;
  gap: 8px;
  margin: -4px 0 18px;
  padding: 2px 0 8px;
  overflow-x: auto;
  scrollbar-width: thin;
}

.tt-aksbel-field-strip button {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  border: 1px solid rgba(118, 112, 102, 0.18);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.66);
  color: var(--ink-soft);
  padding: 0 12px;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}

.tt-aksbel-field-strip button.active {
  border-color: rgba(161, 118, 32, 0.42);
  background: rgba(255, 248, 231, 0.96);
  color: #6f4b0e;
}

.tt-aksbel-field-strip span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 900;
}

.tt-aksbel-book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 22px;
  align-items: start;
}

.tt-aksbel-book-card {
  min-width: 0;
  color: inherit;
  text-decoration: none;
}

.tt-aksbel-cover-canvas {
  width: 100%;
  aspect-ratio: 2 / 3;
  display: block;
  border-radius: 8px;
  background: #060810;
  box-shadow: 0 18px 36px rgba(22, 27, 51, 0.22), 0 0 0 1px rgba(22, 27, 51, 0.08);
  transition: transform 180ms ease, box-shadow 180ms ease;
}

.tt-aksbel-book-card:hover .tt-aksbel-cover-canvas {
  transform: translateY(-4px);
  box-shadow: 0 24px 48px rgba(22, 27, 51, 0.28), 0 0 0 1px rgba(22, 27, 51, 0.1);
}

.tt-aksbel-book-meta {
  display: grid;
  gap: 5px;
  margin-top: 10px;
}

.tt-aksbel-book-meta strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
}

.tt-aksbel-book-meta small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.tt-aksbel-new-book-card {
  aspect-ratio: 2 / 3;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 10px;
  padding: 22px;
  border: 1px dashed rgba(161, 118, 32, 0.45);
  border-radius: 8px;
  background: rgba(255, 253, 248, 0.7);
  text-align: center;
  transition: transform 180ms ease, background 180ms ease;
}

.tt-aksbel-new-book-card:hover {
  transform: translateY(-3px);
  background: rgba(255, 248, 231, 0.9);
}

.tt-aksbel-new-book-plus {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--gold), #f6d97b);
  color: #33230a;
  font-size: 34px;
  line-height: 1;
  font-weight: 500;
}

.tt-aksbel-new-book-card strong {
  color: var(--navy);
  font-size: 18px;
}

.tt-aksbel-new-book-card small {
  max-width: 220px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.tt-aksbel-grid-create-card {
  grid-column: -2 / -1;
  grid-row: 1;
  width: 100%;
  box-sizing: border-box;
}

.tt-aksbel-book-form {
  display: grid;
  gap: 14px;
  width: min(720px, 100%);
  padding: 20px;
  border: 1px solid var(--border-soft);
  border-radius: 12px;
  background: rgba(255, 253, 248, 0.74);
}

.tt-aksbel-book-form label {
  display: grid;
  gap: 6px;
}

.tt-aksbel-book-form label > span {
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.tt-aksbel-book-form input,
.tt-aksbel-book-form textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
}

.tt-aksbel-book-form .error,
.tt-form-errors {
  color: var(--red);
  font-size: 12px;
}

.tt-aksbel-generation-overlay {
  position: fixed;
  inset: 0;
  z-index: 240;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(8, 8, 16, 0.54);
  backdrop-filter: blur(14px);
}

.tt-aksbel-generation-overlay[hidden] {
  display: none;
}

.tt-aksbel-generation-panel {
  width: min(420px, calc(100vw - 28px));
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 24px;
  border-radius: 14px;
  background: var(--paper);
  box-shadow: 0 30px 90px rgba(22, 27, 51, 0.28);
  text-align: center;
}

.tt-aksbel-generation-panel h2 {
  margin: 0;
  color: var(--navy);
  font-size: 24px;
}

.tt-aksbel-generation-panel p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
}

.tt-aksbel-generation-panel small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.tt-aksbel-doc-cover {
  display: grid;
  align-content: end;
  min-height: 560px;
  margin: -8px 0 28px;
  padding: 36px;
  border-radius: 8px;
  background:
    radial-gradient(circle at 42% 28%, color-mix(in srgb, var(--aksbel-cover-color, #5dcaa5) 32%, transparent), transparent 38%),
    linear-gradient(180deg, #060810, #0f111b);
  color: #f2ece2;
  box-shadow: inset 5px 0 0 var(--aksbel-cover-color, #5dcaa5);
}

.tt-aksbel-doc-cover.cover-color-0 {
  --aksbel-cover-color: #5dcaa5;
}

.tt-aksbel-doc-cover.cover-color-1 {
  --aksbel-cover-color: #7f77dd;
}

.tt-aksbel-doc-cover.cover-color-2 {
  --aksbel-cover-color: #d85a30;
}

.tt-aksbel-doc-cover.cover-color-3 {
  --aksbel-cover-color: #378add;
}

.tt-aksbel-doc-cover.cover-color-4 {
  --aksbel-cover-color: #ef9f27;
}

.tt-aksbel-doc-cover.cover-color-5 {
  --aksbel-cover-color: #c9a84c;
}

.tt-aksbel-doc-cover.cover-color-6 {
  --aksbel-cover-color: #a51c30;
}

.tt-aksbel-doc-cover.cover-color-7 {
  --aksbel-cover-color: #2f9d7e;
}

.tt-aksbel-doc-cover.cover-color-8 {
  --aksbel-cover-color: #5b8def;
}

.tt-aksbel-doc-cover.cover-color-9 {
  --aksbel-cover-color: #b85aa1;
}

.tt-aksbel-doc-cover span {
  color: var(--aksbel-cover-color, #5dcaa5);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.tt-aksbel-doc-cover h1 {
  max-width: 760px;
  margin: 8px 0 10px;
  color: #f2ece2;
  font-size: clamp(42px, 9vw, 88px);
  line-height: 0.95;
}

.tt-aksbel-doc-cover p {
  max-width: 640px;
  margin: 0;
  color: rgba(210, 225, 235, 0.78);
  font-size: 20px;
  line-height: 1.25;
}

.tt-aksbel-doc-cover small {
  margin-top: 34px;
  color: rgba(210, 225, 235, 0.48);
  font-size: 12px;
}

.tt-contributors-page,
.tt-project-overview {
  width: min(1040px, 100%);
}

.tt-contributor-list {
  display: grid;
  gap: 8px;
}

.tt-contributor-list-large {
  gap: 10px;
}

.tt-contributor-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.78);
}

.tt-contributor-row strong {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--ink);
  font-size: 13px;
}

.tt-contributor-row strong small {
  color: var(--green);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
}

.tt-contributor-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.reader-toolbar {
  position: sticky;
  top: var(--reader-toolbar-top);
  z-index: 23;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  padding: 12px 0 16px;
  margin-bottom: 30px;
  border-bottom: 1px solid var(--border-soft);
  background: rgba(255, 253, 248, 0.92);
  backdrop-filter: blur(18px);
}

.reader-toolbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
}

.tool-chip {
  border: 1px solid var(--border);
  background: var(--paper-soft);
  color: var(--ink-soft);
  border-radius: 999px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.tool-chip.active {
  border-color: rgba(21, 128, 61, 0.24);
  background: var(--green-soft);
  color: var(--green);
}

.tool-chip.locked {
  cursor: default;
  color: var(--muted);
  background: var(--gray-soft);
}

.tool-chip.copied {
  border-color: rgba(21, 128, 61, 0.24);
  background: var(--green-soft);
  color: var(--green);
}

.tool-chip.debunk-pass {
  border-color: rgba(21, 128, 61, 0.34);
  background: var(--green-soft);
  color: var(--green);
}

.tt-quiz-paper {
  display: grid;
  gap: 16px;
}

.tt-quiz-paper-complete {
  display: flex;
  flex-direction: column;
  box-sizing: border-box;
  min-height: min(680px, calc(100svh - 32px));
  max-height: calc(100svh - 32px);
  padding-top: clamp(22px, 4svh, 36px);
  padding-bottom: clamp(22px, 4svh, 36px);
}

.tt-quiz-paper-complete .tt-quiz-score {
  flex: 0 0 auto;
}

.tt-quiz-page .reader-frame {
  padding-top: 20px;
}

.tt-quiz-page .reader-frame:has(.tt-quiz-paper-complete) {
  padding-top: 0;
}

body.tt-debunk-loading-active {
  overflow: hidden;
}

body.tt-debunk-loading-active .app-shell {
  filter: blur(1.5px);
  pointer-events: none;
  user-select: none;
}

.tt-debunk-loading-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  min-height: 100svh;
  padding:
    max(16px, env(safe-area-inset-top))
    max(16px, env(safe-area-inset-right))
    max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
  overflow-y: auto;
  overscroll-behavior: contain;
  background: rgba(21, 21, 21, 0.2);
  backdrop-filter: blur(10px);
}

.tt-debunk-loading-overlay[hidden] {
  display: none;
}

.tt-debunk-loading-panel {
  position: fixed;
  top: 50%;
  left: 50%;
  width: min(420px, calc(100vw - 32px));
  max-height: calc(100dvh - 32px);
  margin: 0;
  transform: translate(-50%, -50%);
  overflow-y: auto;
  display: grid;
  justify-items: center;
  gap: 12px;
  padding: 28px;
  border-radius: 20px;
  border: 1px solid rgba(222, 212, 195, 0.95);
  background: rgba(255, 253, 248, 0.96);
  box-shadow: var(--shadow);
  text-align: center;
}

.tt-debunk-loading-panel h2 {
  margin: 4px 0 0;
  font-size: 20px;
  line-height: 1.2;
}

.tt-debunk-loading-panel p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.tt-debunk-loading-panel small {
  color: var(--muted-2);
  font-size: 12px;
  line-height: 1.45;
}

.tt-debunk-loading-orbit {
  position: relative;
  width: 58px;
  height: 58px;
  border-radius: 999px;
  border: 1px solid rgba(201, 150, 58, 0.26);
  animation: ttDebunkOrbit 1.8s linear infinite;
}

.tt-debunk-loading-orbit span {
  position: absolute;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--gold);
}

.tt-debunk-loading-orbit span:nth-child(1) {
  top: -5px;
  left: 24px;
}

.tt-debunk-loading-orbit span:nth-child(2) {
  right: 2px;
  bottom: 7px;
  background: var(--green);
}

.tt-debunk-loading-orbit span:nth-child(3) {
  left: 2px;
  bottom: 7px;
  background: var(--navy);
}

.tt-debunk-loading-bars {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 7px;
  margin-top: 2px;
}

.tt-debunk-loading-bars span {
  height: 5px;
  border-radius: 999px;
  background: var(--gold-soft);
  overflow: hidden;
}

.tt-debunk-loading-bars span::before {
  content: "";
  display: block;
  width: 55%;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
  animation: ttDebunkPulse 1.35s ease-in-out infinite;
}

.tt-debunk-loading-bars span:nth-child(2)::before {
  animation-delay: 0.18s;
}

.tt-debunk-loading-bars span:nth-child(3)::before {
  animation-delay: 0.36s;
}

@keyframes ttDebunkOrbit {
  to {
    transform: rotate(360deg);
  }
}

@keyframes ttDebunkPulse {
  0%,
  100% {
    transform: translateX(-65%);
    opacity: 0.45;
  }
  50% {
    transform: translateX(115%);
    opacity: 1;
  }
}

.tt-quiz-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.tt-quiz-head h1 {
  margin: 0;
  font-size: 19px;
  line-height: 1.2;
  display: -webkit-box;
  max-width: 680px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.tt-quiz-page .topbar-reader,
.tt-quiz-page .reader-labels,
.tt-quiz-page .reader-label-toggle,
.tt-quiz-page .tt-search-icon {
  display: none;
}

.tt-quiz-actions,
.tt-quiz-next {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.tt-quiz-score {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  flex-wrap: wrap;
}

.tt-quiz-back-link {
  display: inline-grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  color: var(--ink-soft);
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.tt-quiz-back-link:hover {
  background: var(--paper-soft);
}

.tt-quiz-score-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  min-width: 0;
}

.tt-quiz-score span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tt-quiz-question {
  display: grid;
  gap: 10px;
  padding-top: 4px;
}

.tt-quiz-question-text {
  margin: 0;
  font-size: 17px;
  line-height: 1.35;
}

.tt-quiz-question-text [data-block-id="block-1"] {
  font-size: 0.94em;
}

.tt-quiz-markdown :is(p, ul, ol, blockquote) {
  margin: 0;
  line-height: 1.55;
}

.tt-quiz-markdown :is(p, ul, ol, blockquote) + :is(p, ul, ol, blockquote, table) {
  margin-top: 8px;
}

.tt-quiz-markdown :is(ul, ol) {
  padding-left: 22px;
}

.tt-quiz-markdown .tt-raw-math {
  white-space: normal;
}

.tt-quiz-markdown .katex-display {
  margin: 8px 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.tt-quiz-form {
  display: grid;
  gap: 10px;
}

.tt-quiz-choice {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 253, 248, 0.88);
  color: var(--ink);
  padding: 13px 14px;
  text-align: left;
  cursor: pointer;
}

.tt-quiz-choice:hover {
  border-color: rgba(179, 129, 39, 0.45);
  background: rgba(255, 248, 231, 0.9);
}

.tt-quiz-choice:disabled {
  cursor: default;
}

.tt-quiz-choice-index {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: var(--paper-soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.tt-quiz-choice-text {
  font-size: 14px;
  line-height: 1.45;
  min-width: 0;
}

.tt-quiz-choice.correct {
  border-color: rgba(21, 128, 61, 0.35);
  background: var(--green-soft);
}

.tt-quiz-choice.correct .tt-quiz-choice-index {
  background: var(--green);
  color: white;
}

.tt-quiz-choice.incorrect {
  border-color: rgba(185, 28, 28, 0.3);
  background: rgba(254, 242, 242, 0.92);
}

.tt-quiz-choice.incorrect .tt-quiz-choice-index {
  background: var(--red);
  color: white;
}

.tt-quiz-choice.selected {
  box-shadow: inset 0 0 0 2px rgba(39, 39, 42, 0.08);
}

.tt-quiz-result,
.tt-quiz-empty {
  display: grid;
  gap: 8px;
  padding: 16px;
  border-radius: 12px;
  background: var(--paper-soft);
  color: var(--ink-soft);
}

.tt-quiz-result.correct {
  background: var(--green-soft);
}

.tt-quiz-result.correct {
  font-size: 13px;
}

.tt-quiz-result.correct strong {
  font-size: 14px;
}

.tt-quiz-result.incorrect {
  background: rgba(254, 242, 242, 0.92);
}

.tt-quiz-result.incorrect {
  font-size: 13px;
}

.tt-quiz-result.incorrect strong {
  font-size: 14px;
}

.tt-quiz-result strong,
.tt-quiz-empty h2 {
  margin: 0;
  font-size: 15px;
}

.tt-quiz-result-label,
.tt-quiz-result .tt-quiz-markdown,
.tt-quiz-empty p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.tt-quiz-result-answer {
  color: var(--ink);
  font-weight: 800;
}

.tt-quiz-complete {
  justify-items: center;
  gap: 12px;
  margin-top: auto;
  min-height: min(50svh, 496px);
  padding: 32px 18px;
  text-align: center;
  align-content: center;
}

.tt-quiz-result.tt-quiz-complete > strong {
  font-size: 18px;
}

.tt-quiz-complete-score {
  display: grid;
  justify-items: center;
  gap: 4px;
  color: var(--ink);
}

.tt-quiz-result.tt-quiz-complete .tt-quiz-complete-score strong {
  font-size: clamp(92px, 20vw, 220px);
  line-height: 0.95;
  letter-spacing: 0;
}

.tt-quiz-complete-score span {
  color: var(--ink-soft);
  font-size: clamp(16px, 2.4vw, 24px);
  font-weight: 800;
}

.tt-quiz-paper-complete .tt-quiz-next {
  justify-content: center;
  margin-top: 8px;
  margin-bottom: auto;
}

.tt-quiz-history,
.tt-quiz-document-list {
  display: grid;
  gap: 10px;
}

.tt-quiz-history.compact {
  margin-top: 8px;
}

.tt-quiz-history.compact > h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.tt-quiz-history-row,
.tt-quiz-document-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-soft);
}

.tt-quiz-history-row {
  color: inherit;
  text-decoration: none;
}

.tt-quiz-history-row:hover {
  background: rgba(255, 248, 231, 0.56);
}

.tt-quiz-history-row:target,
.tt-quiz-history-row.tt-quiz-history-return-focus {
  background: rgba(255, 243, 206, 0.86);
  box-shadow: inset 3px 0 0 var(--gold);
}

.tt-quiz-document-row {
  color: inherit;
  text-decoration: none;
}

.tt-quiz-history-question,
.tt-quiz-history-row h3 {
  margin: 6px 0 4px;
  font-size: 15px;
  line-height: 1.35;
}

.tt-quiz-history-answer,
.tt-quiz-document-row span {
  display: block;
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tt-quiz-history-answer strong {
  display: block;
  margin: 7px 0 3px;
  color: var(--muted);
  font-size: 11px;
  text-transform: uppercase;
}

.tt-quiz-history-row time,
.tt-quiz-document-row em {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.tt-quiz-history-row span.correct,
.tt-quiz-history-row span.incorrect {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 900;
}

.tt-quiz-history-row span.correct {
  background: var(--green-soft);
  color: var(--green);
}

.tt-quiz-history-row span.incorrect {
  background: rgba(254, 242, 242, 0.92);
  color: var(--red);
}

.status-toggle-form {
  display: inline-flex;
  margin: 0;
}

.document-search {
  position: relative;
  display: inline-flex;
  margin-left: auto;
}

.reader-label-main > .document-search,
.reader-label-actions .document-search {
  flex: 0 0 auto;
  margin-left: 0;
}

.topbar-document-search .search-trigger {
  min-height: 34px;
  padding: 0 11px;
}

.search-trigger {
  min-width: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.search-trigger span {
  font-size: 18px;
  line-height: 1;
}

.document-search.open .search-trigger {
  border-color: rgba(52, 71, 255, 0.24);
  background: var(--blue-soft);
  color: var(--blue);
}

.document-search-panel {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 60;
  display: grid;
  width: min(430px, calc(100vw - 36px));
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--paper);
  box-shadow: var(--shadow-soft);
}

.document-search-panel[hidden] {
  display: none;
}

.tt-search-icon {
  position: relative;
  display: block;
  width: 14px;
  height: 14px;
}

.tt-search-icon::before {
  content: "";
  position: absolute;
  left: 1px;
  top: 1px;
  width: 8px;
  height: 8px;
  border: 1.8px solid currentColor;
  border-radius: 999px;
}

.tt-search-icon::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 6px;
  height: 1.8px;
  border-radius: 999px;
  background: currentColor;
  transform: rotate(45deg);
  transform-origin: center;
}

.document-search-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: var(--paper-soft);
}

.document-search-field input {
  width: 100%;
  min-height: 32px;
  border: 0;
  border-radius: 999px;
  padding: 6px 8px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
  outline: none;
}

.document-search-field:focus-within {
  border-color: rgba(52, 71, 255, 0.34);
  box-shadow: 0 0 0 3px rgba(52, 71, 255, 0.10);
}

.document-search-field button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--navy);
  color: white;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
}

.document-search-results {
  display: grid;
  gap: 4px;
  max-height: 320px;
  margin-top: 8px;
  overflow-y: auto;
}

.search-result {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr);
  gap: 4px;
  column-gap: 8px;
  padding: 9px 8px;
  border-radius: 10px;
}

.search-result:hover {
  background: var(--paper-soft);
}

.search-result-head {
  display: flex;
  align-items: center;
  gap: 7px;
  grid-column: 2;
  min-width: 0;
  color: var(--ink);
  font-size: 12px;
}

.search-result-dot {
  grid-row: 1 / span 2;
  width: 6px;
  height: 6px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--gold);
}

.search-result-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-number {
  flex: 0 0 auto;
  min-width: 24px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: right;
}

.search-result-snippet,
.search-result-project,
.document-search-empty {
  display: block;
  grid-column: 2;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.search-result-project {
  font-size: 11px;
  line-height: 1.3;
}

.tt-search-result-hit {
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(255, 215, 107, 0.55);
  color: inherit;
}

.document-search-empty {
  padding: 10px 8px;
}

.parent-back-chip {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  font-size: 12px;
  line-height: 1;
}

.parent-back-arrow {
  font-size: 21px;
  line-height: 0.8;
  transform: translateY(-1px);
}

.article {
  --tt-line-number-gap: 12px;
  counter-reset: block;
  font-family: "Source Serif 4", Georgia, serif;
  color: var(--ink);
  font-size: 19px;
  line-height: 1.82;
}

.article h1,
.article h2,
.article h3,
.article h4 {
  font-family: Inter, system-ui, sans-serif;
  margin: 44px 0 14px;
  color: var(--navy);
  line-height: 1.18;
  letter-spacing: 0;
}

.article h1 { font-size: 30px; }
.article h2 { font-size: 26px; }
.article h3 { font-size: 24px; }
.article h4 { font-size: 20px; }

.article p,
.article li,
.article [data-block-id],
.equation-block {
  position: relative;
}

.article [data-block-id]::before {
  counter-increment: block;
  content: counter(block);
  position: absolute;
  left: auto;
  right: calc(100% + var(--tt-line-number-gap));
  top: 3px;
  width: 24px;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--muted-2);
  opacity: 0.65;
  pointer-events: none;
}

.article :is(ul, ol) [data-block-id]::before {
  right: calc(100% + var(--tt-line-number-gap) + 28px);
}

.article :is(ul, ol) :is(ul, ol) [data-block-id]::before {
  right: calc(100% + var(--tt-line-number-gap) + 56px);
}

.article :is(ul, ol) :is(ul, ol) :is(ul, ol) [data-block-id]::before {
  right: calc(100% + var(--tt-line-number-gap) + 84px);
}

.article :is(ul, ol) :is(ul, ol) :is(ul, ol) :is(ul, ol) [data-block-id]::before {
  right: calc(100% + var(--tt-line-number-gap) + 112px);
}

.article li[data-block-id]:has(> p)::before,
.article blockquote[data-block-id]::before,
.article [data-block-equation="true"]::before,
.article [data-block-empty="true"]::before,
.article [data-block-id]:empty::before,
.article [data-block-id]:has(> br:only-child)::before {
  counter-increment: none;
  content: none;
}

.article,
.article * {
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: text;
  user-select: text;
}

body.tt-document-right-dragging .main-area,
body.tt-document-right-dragging .main-area .reader-paper,
body.tt-document-right-dragging .main-area .article,
body.tt-document-right-dragging .main-area .article * {
  cursor: grabbing !important;
}

body.tt-document-right-dragging .main-area .reader-paper,
body.tt-document-right-dragging .main-area .article,
body.tt-document-right-dragging .main-area .article * {
  -webkit-user-select: none;
  user-select: none;
}

.article::selection,
.article *::selection {
  background: rgba(255, 216, 105, 0.5);
  color: var(--ink);
  text-shadow: none;
}

.article mark:not(.tt-read-mark) {
  border-radius: 4px;
  background: rgba(255, 216, 105, 0.42);
  color: inherit;
  padding: 0 0.12em;
}

.article p {
  margin: 0 0 22px;
}

.article ul,
.article ol {
  padding-left: 24px;
  margin: 10px 0 18px;
}

.article li {
  margin-bottom: 4px;
  padding-left: 3px;
}

.article li > p {
  margin: 0 0 6px;
}

.article li > p:last-child {
  margin-bottom: 0;
}

.article li > :is(ul, ol) {
  margin-top: 6px;
  margin-bottom: 8px;
}

.article blockquote {
  margin: 34px 0;
  padding: 18px 20px;
  border-left: 4px solid var(--gold);
  border-radius: 0 18px 18px 0;
  background: var(--gold-soft);
  font-family: Inter, sans-serif;
  font-size: 14px;
  line-height: 1.65;
  color: #4d3711;
}

.article pre {
  margin: 28px 0;
  border-radius: 18px;
  background: #161b33;
  color: #f7f4ee;
  overflow: auto;
  box-shadow: 0 18px 44px rgba(22, 27, 51, 0.16);
  font-family: "JetBrains Mono", monospace;
  font-size: 13px;
  line-height: 1.75;
  padding: 18px 20px 22px;
}

.article code {
  font-family: "JetBrains Mono", monospace;
}

.article :not(pre) > code {
  padding: 2px 5px;
  border-radius: 6px;
  background: #f2eadb;
}

.article table {
  display: block;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  border-spacing: 0;
  border-collapse: separate;
  margin: 24px 0;
  background: rgba(255, 253, 248, 0.92);
  font-family: Inter, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.55;
}

.article thead {
  background: rgba(245, 241, 232, 0.9);
}

.article th,
.article td {
  min-width: 128px;
  padding: 10px 12px;
  border: 0;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

.article th {
  color: var(--ink);
  font-weight: 700;
}

.article tr:last-child td {
  border-bottom: 0;
}

.article th:last-child,
.article td:last-child {
  border-right: 0;
}

.equation-block,
.katex-display {
  margin: 30px 0;
  padding: 20px 24px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(245, 241, 232, 0.68), rgba(255, 253, 248, 0.8));
  border: 1px solid var(--border-soft);
  overflow-x: auto;
  text-align: center;
  font-size: 18px;
}

.katex-display {
  position: relative;
  overflow: hidden;
}

.article .katex-display .tt-equation-scroll {
  display: block;
  min-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  padding-left: 3em;
  padding-right: 5em;
  box-sizing: border-box;
  scrollbar-width: thin;
}

.article .katex-display .tt-equation-scroll > .katex,
.article .katex-display > .katex {
  display: inline-block;
  min-width: 100%;
}

.article .katex-display .tt-equation-scroll > .katex > .katex-html,
.article .katex-display > .katex > .katex-html {
  box-sizing: border-box;
  min-width: 100%;
}

.article .katex-display .tag {
  z-index: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.1em;
  min-height: 2.1em;
  margin-left: 1.5em;
  padding: 0.12em 0.55em;
  border: 1px solid rgba(197, 185, 159, 0.78);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 6px 18px rgba(22, 27, 51, 0.1);
  box-sizing: border-box;
  color: var(--ink);
  white-space: nowrap;
}

.article .katex-display > .tt-equation-page-tag {
  position: absolute !important;
  top: 50%;
  right: 24px;
  transform: translateY(-50%) !important;
}

.anchor-highlight,
.tt-anchor-highlight {
  --tt-anchor-highlight-bg: var(--highlight);
  --tt-anchor-highlight-ring: rgba(255, 241, 168, 0.42);
  --tt-anchor-badge-bg: var(--navy);
  --tt-anchor-badge-fg: #ffffff;
  --tt-anchor-badge-border: transparent;
  --tt-anchor-badge-shadow: rgba(22, 27, 51, 0.2);
  position: relative;
  background: linear-gradient(to bottom, transparent 46%, var(--tt-anchor-highlight-bg) 46%);
  border-radius: 4px;
  cursor: pointer;
  padding: 0 2px;
  color: inherit;
  text-decoration: none;
  scroll-margin-top: 96px;
  transition: 160ms ease;
}

.tt-anchor-highlight.tt-status-edge-verified {
  --tt-anchor-highlight-bg: rgba(187, 247, 208, 0.9);
  --tt-anchor-highlight-ring: rgba(187, 247, 208, 0.42);
  --tt-anchor-badge-bg: var(--green);
  --tt-anchor-badge-shadow: rgba(21, 128, 61, 0.22);
  background: linear-gradient(to bottom, transparent 46%, var(--tt-anchor-highlight-bg) 46%);
}

.tt-anchor-highlight.tt-anchor-linked-document {
  --tt-anchor-link-border: rgba(37, 99, 235, 0.72);
  --tt-anchor-badge-border: var(--tt-anchor-link-border);
  border-bottom: 2px solid var(--tt-anchor-link-border);
}

.tt-anchor-highlight.tt-anchor-math {
  background: var(--tt-anchor-highlight-bg);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  box-shadow: 0 0 0 3px var(--tt-anchor-highlight-ring);
}

.tt-anchor-highlight.tt-anchor-linked-document.tt-anchor-math {
  box-shadow:
    0 0 0 3px var(--tt-anchor-highlight-ring),
    inset 0 0 0 1px var(--tt-anchor-link-border);
}

.tt-anchor-highlight.tt-anchor-math .katex,
.tt-anchor-highlight.tt-anchor-math .tt-raw-math {
  border-radius: 5px;
  background: var(--tt-anchor-highlight-bg);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.tt-anchor-highlight.tt-anchor-display-math {
  display: block;
  padding: 8px;
  margin: 16px 0;
  border-radius: 18px;
}

.tt-anchor-highlight.tt-anchor-linked-document.tt-anchor-display-math {
  border: 1px solid var(--tt-anchor-link-border);
}

.tt-anchor-highlight.tt-anchor-display-math .katex-display {
  margin: 0;
  background: transparent;
  border-color: transparent;
}

.anchor-highlight:hover,
.tt-anchor-highlight:hover {
  background: var(--tt-anchor-highlight-bg);
  box-shadow: 0 0 0 4px var(--tt-anchor-highlight-ring);
}

.tt-anchor-highlight.tt-status-edge-verified:hover {
  background: var(--tt-anchor-highlight-bg);
  box-shadow: 0 0 0 4px var(--tt-anchor-highlight-ring);
}

.tt-anchor-highlight.tt-return-focus {
  box-shadow: 0 0 0 5px var(--tt-anchor-highlight-ring);
}

.tt-anchor-highlight.tt-anchor-multi {
  cursor: default;
}

.tt-anchor-badge-list {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  margin-left: 4px;
  vertical-align: baseline;
}

.tt-anchor-badge-list .tt-anchor-badge {
  margin-left: 0;
  text-decoration: none;
  cursor: pointer;
}

.tt-anchor-badge.tt-return-focus {
  box-shadow: 0 0 0 5px var(--tt-anchor-highlight-ring), 0 8px 18px var(--tt-anchor-badge-shadow, rgba(22, 27, 51, 0.2));
}

.tt-read-mark {
  border-radius: 3px;
  background: rgba(220, 252, 231, 0.56);
  color: inherit;
  padding: 0 1px;
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
  scroll-margin-top: 96px;
}

.article pre .tt-read-mark {
  background: rgba(187, 247, 208, 0.2);
  color: inherit;
}

.tt-read-mark .katex,
.tt-read-mark .tt-raw-math {
  border-radius: 3px;
  background: rgba(220, 252, 231, 0.48);
}

.tt-read-mark > .tt-raw-math,
.tt-read-mark .katex-display,
.tt-read-mark .tt-equation-scroll {
  background: rgba(220, 252, 231, 0.56);
}

.tt-read-mark .katex-display {
  border-color: rgba(74, 222, 128, 0.14);
}

.tt-read-mark.tt-read-mark-display-math {
  display: block;
  margin: 0;
  padding: 0;
  background: transparent;
}

.tt-read-mark + .tt-read-mark.tt-read-mark-display-math {
  margin-top: 2px;
}

.tt-read-mark.tt-read-mark-display-math > .tt-raw-math {
  display: block;
}

.tt-read-mark.tt-read-mark-display-math .katex-display {
  margin: 4px 0;
}

.article p:has(+ p > .tt-read-mark-display-math) {
  margin-bottom: 4px;
}

.article p:has(> .tt-read-mark-display-math:only-child) {
  margin: 0 0 6px;
}

.tt-read-mark.tt-return-focus {
  box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.18);
}

.tt-document-search-hit {
  padding: 0 2px;
  border-radius: 5px;
  background: rgba(255, 215, 107, 0.68);
  color: inherit;
  box-shadow: 0 0 0 2px rgba(255, 215, 107, 0.20);
}

.tt-document-search-hit.tt-document-search-focus {
  box-shadow: 0 0 0 5px rgba(255, 215, 107, 0.36);
}

.article [data-block-id].tt-document-search-block-hit {
  border-radius: 8px;
  box-shadow: inset 4px 0 0 rgba(201, 150, 58, 0.42);
}

.article [data-block-id].tt-document-search-block-hit.tt-document-search-focus {
  box-shadow: inset 4px 0 0 rgba(201, 150, 58, 0.62), 0 0 0 5px rgba(255, 215, 107, 0.20);
}

.article pre .tt-anchor-highlight {
  --tt-anchor-highlight-bg: rgba(255, 241, 168, 0.18);
  --tt-anchor-highlight-ring: rgba(255, 241, 168, 0.18);
  --tt-anchor-badge-bg: var(--navy);
  --tt-anchor-badge-fg: #ffffff;
  --tt-anchor-badge-shadow: rgba(0, 0, 0, 0.26);
  background: var(--tt-anchor-highlight-bg);
  color: #fff6bf;
  border-bottom: 1px solid rgba(255, 241, 168, 0.46);
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.article pre .tt-anchor-highlight.tt-status-edge-verified {
  --tt-anchor-highlight-bg: rgba(74, 222, 128, 0.24);
  --tt-anchor-highlight-ring: rgba(74, 222, 128, 0.18);
  --tt-anchor-badge-bg: var(--green);
  color: #dcfce7;
  border-bottom-color: rgba(134, 239, 172, 0.54);
}

.article pre .tt-anchor-highlight.tt-anchor-linked-document {
  border-bottom-color: var(--tt-anchor-link-border);
}

.article pre .tt-anchor-highlight:hover,
.article pre .tt-anchor-highlight.tt-status-edge-verified:hover {
  background: var(--tt-anchor-highlight-bg);
  box-shadow: 0 0 0 3px var(--tt-anchor-highlight-ring);
}

.anchor-badge,
.tt-anchor-badge {
  position: relative;
  z-index: 4;
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-width: 22px;
  height: 22px;
  margin-left: 4px;
  padding: 0 6px;
  transform: translateY(-2px);
  border: 1px solid var(--tt-anchor-badge-border, transparent);
  border-radius: 999px;
  background: var(--tt-anchor-badge-bg, var(--navy)) !important;
  background-color: var(--tt-anchor-badge-bg, var(--navy)) !important;
  background-image: none !important;
  background-clip: padding-box;
  color: var(--tt-anchor-badge-fg, #ffffff) !important;
  font-family: Inter, sans-serif;
  font-size: 11px;
  font-weight: 800;
  line-height: 1;
  opacity: 1 !important;
  isolation: isolate;
  mix-blend-mode: normal;
  text-shadow: none;
  vertical-align: baseline;
  white-space: nowrap;
  box-shadow: 0 8px 18px var(--tt-anchor-badge-shadow, rgba(22, 27, 51, 0.2));
}

.article pre .tt-anchor-badge {
  border-color: rgba(255, 255, 255, 0.32);
}

.project-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 18px 16px 22px;
  border-left: 1px solid rgba(214, 203, 184, 0.92);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(245, 239, 226, 0.92));
  backdrop-filter: blur(18px);
  overflow: visible;
}

.project-tree-scroll {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  padding-bottom: 10px;
  padding-right: 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(118, 112, 102, 0.54) transparent;
}

@media (min-width: 901px) {
  .project-tree-scroll {
    overflow-x: auto;
    overflow-y: scroll;
    scrollbar-gutter: stable;
  }

  .project-tree-scroll::-webkit-scrollbar {
    width: 11px;
    height: 11px;
  }

  .project-tree-scroll::-webkit-scrollbar-track {
    background: transparent;
  }

  .project-tree-scroll::-webkit-scrollbar-thumb {
    min-height: 42px;
    border: 3px solid transparent;
    border-radius: 999px;
    background: rgba(118, 112, 102, 0.48);
    background-clip: padding-box;
  }

  .project-tree-scroll::-webkit-scrollbar-thumb:hover {
    background: rgba(22, 27, 51, 0.45);
    background-clip: padding-box;
  }
}

.sidebar-resize-handle {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 12;
  width: 14px;
  cursor: col-resize;
  touch-action: none;
}

.sidebar-resize-handle::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 18px;
  bottom: 18px;
  width: 2px;
  border-radius: 999px;
  background: rgba(22, 27, 51, 0.12);
  opacity: 0.34;
  transition: opacity 140ms ease, background 140ms ease, width 140ms ease;
}

.sidebar-resize-handle:hover::before,
.sidebar-resize-handle:focus-visible::before,
body.sidebar-resizing .sidebar-resize-handle::before {
  background: rgba(22, 27, 51, 0.34);
  width: 3px;
  opacity: 1;
}

body.sidebar-resizing {
  cursor: col-resize;
  user-select: none;
}

.mobile-theorytrace-bar,
.sidebar-backdrop,
.sidebar-close-button {
  display: none;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 2px 16px;
  margin-bottom: 14px;
  border-bottom: 1px solid rgba(222, 212, 195, 0.72);
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 13px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: white;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 28px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 12px 28px rgba(22, 27, 51, 0.18);
}

.brand-text strong {
  display: block;
  font-size: 15px;
  letter-spacing: 0;
}

.brand-text span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
}

.sidebar-profile-link {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 8px;
  margin: -2px 0 16px;
  border-radius: 8px;
  color: var(--ink);
  text-decoration: none;
}

.sidebar-profile-link:hover {
  background: rgba(22, 27, 51, 0.05);
  text-decoration: none;
}

.sidebar-profile-avatar {
  width: 30px;
  height: 30px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: var(--navy);
  color: white;
  font-size: 12px;
  font-weight: 800;
  flex: 0 0 auto;
}

.sidebar-profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.sidebar-profile-text {
  display: grid;
  min-width: 0;
  line-height: 1.15;
}

.sidebar-profile-text strong,
.sidebar-profile-text small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-profile-text strong {
  font-size: 12px;
}

.sidebar-profile-text small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}

.sidebar-plan-button {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 32px;
  border-radius: 999px;
  background: var(--gold);
  color: #211600;
  font-size: 11px;
  font-weight: 800;
  text-decoration: none;
}

.sidebar-plan-cta {
  width: calc(100% - 16px);
  margin: -8px 8px 16px;
  box-shadow: 0 8px 18px rgba(180, 132, 20, 0.16);
}

.sidebar-plan-button:hover {
  background: #f1bf37;
  text-decoration: none;
}

.sidebar-plan-rejected.sidebar-plan-button {
  background: var(--red-soft);
  color: var(--red);
}

.project-card {
  padding: 18px;
  border-radius: var(--radius-lg);
  background: linear-gradient(145deg, rgba(22, 27, 51, 0.97), rgba(34, 42, 81, 0.96));
  color: white;
  box-shadow: var(--shadow-soft);
  margin-bottom: 18px;
}

.project-card .eyebrow {
  color: rgba(255,255,255,0.58);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 10px;
}

.project-card h1 {
  margin: 0;
  font-size: 20px;
  line-height: 1.18;
  letter-spacing: 0;
}

.project-card p {
  margin: 10px 0 0;
  color: rgba(255,255,255,0.66);
  font-size: 13px;
  line-height: 1.5;
}

.nav-section {
  margin-top: 14px;
  overflow: visible;
}

.nav-section-public {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(222, 212, 195, 0.72);
}

.nav-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding: 0 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tree-project,
.tree-doc-row {
  position: relative;
}

.tree-project {
  display: grid;
  gap: 3px;
}

.tree-row {
  position: relative;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) 34px;
  gap: 3px;
  align-items: center;
  min-height: 36px;
}

.tree-toggle,
.tree-toggle-spacer,
.tree-menu-button {
  width: 26px;
  height: 30px;
  border: 0;
  background: transparent;
}

.tree-toggle,
.tree-menu-button {
  display: grid;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  cursor: pointer;
}

.tree-toggle:hover,
.tree-menu-button:hover {
  background: rgba(255, 255, 255, 0.62);
  color: var(--navy);
}

.tree-toggle span {
  width: 0;
  height: 0;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-left: 5px solid currentColor;
  transform: rotate(90deg);
  transition: transform 120ms ease;
}

.tree-project.collapsed > .tree-row .tree-toggle span,
.tree-doc-row.collapsed > .tree-row .tree-toggle span {
  transform: rotate(0deg);
}

.tree-menu-button {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 2px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 120ms ease, background 140ms ease, color 140ms ease;
}

.tree-project:hover > .tree-row > .tree-menu-button,
.tree-doc-row:hover > .tree-row > .tree-menu-button,
.tree-row:hover > .tree-menu-button,
.tree-row:focus-within > .tree-menu-button,
.tree-menu-button[aria-expanded="true"] {
  opacity: 1;
  pointer-events: auto;
}

.tree-row > .tree-menu-button {
  grid-column: 3;
  position: sticky;
  right: 4px;
  z-index: 22;
  justify-self: end;
  background: rgba(255, 253, 248, 0.98);
  box-shadow: 0 0 0 5px rgba(255, 253, 248, 0.92);
}

.tree-menu-button span {
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: currentColor;
}

.tree-menu {
  position: absolute;
  top: 32px;
  right: 0;
  z-index: 180;
  min-width: 132px;
  padding: 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  box-shadow: 0 16px 36px rgba(45, 35, 20, 0.16);
}

.tree-menu-floating {
  position: fixed;
  z-index: 500;
}

.tree-menu button,
.tree-menu a {
  width: 100%;
  min-height: 30px;
  display: flex;
  align-items: center;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-soft);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
}

.tree-menu button:hover,
.tree-menu a:hover {
  background: var(--paper-soft);
  color: var(--navy);
}

.sidebar-add-project-form {
  display: inline-flex;
  justify-content: flex-end;
  margin: 0;
}

.tree-add-button {
  min-height: 28px;
  border: 0;
  border-radius: 999px;
  background: rgba(22, 27, 51, 0.08);
  color: var(--navy);
  padding: 0 9px;
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.tree-add-button:hover {
  background: var(--navy);
  color: #ffffff;
}

.sidebar-empty-state {
  padding: 7px 30px 10px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.tree-rename-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 4px 0 7px 30px;
}

.tree-rename-form[hidden] {
  display: none;
}

.tree-rename-form input {
  min-width: 0;
  height: 32px;
  border: 1px solid rgba(180, 166, 141, 0.68);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 8px;
  font-size: 12px;
  font-weight: 650;
}

.tree-rename-form input:focus {
  border-color: rgba(22, 27, 51, 0.42);
  outline: 3px solid rgba(22, 27, 51, 0.08);
}

@media (hover: none) {
  .tree-menu-button {
    opacity: 1;
    pointer-events: auto;
  }
}

.sidebar-create-form {
  display: grid;
  margin: 4px 0 7px 28px;
}

.sidebar-create-form input {
  min-width: 0;
  height: 30px;
  border: 1px solid var(--border-soft);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.58);
  padding: 0 9px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
}

.sidebar-create-form input::placeholder {
  color: var(--muted);
  font-weight: 500;
}

.sidebar-create-button,
.sidebar-create-wide,
.sidebar-create-form .sidebar-create-wide {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.sidebar-create-wide,
.sidebar-create-form .sidebar-create-wide {
  display: grid;
  grid-template-columns: 28px 15px minmax(0, 1fr);
  gap: 7px;
  justify-items: start;
  text-align: left;
}

.sidebar-create-button {
  margin-bottom: 4px;
}

.sidebar-create-button:hover,
.sidebar-create-wide:hover,
.sidebar-create-form .sidebar-create-wide:hover {
  background: rgba(255, 255, 255, 0.56);
  color: var(--navy);
}

.create-tree-row {
  margin-bottom: 4px;
}

.create-icon {
  position: relative;
  flex: 0 0 auto;
}

.create-icon::after {
  content: "+";
  position: absolute;
  right: -6px;
  bottom: -5px;
  width: 12px;
  height: 12px;
  display: grid;
  place-items: center;
  border: 1px solid #ffffff;
  border-radius: 999px;
  background: var(--navy);
  color: #ffffff;
  font-size: 10px;
  font-weight: 900;
  line-height: 1;
}

.create-icon-project {
  width: 18px;
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f6cf70, #d89c24);
  box-shadow: inset 0 -1px 0 rgba(111, 77, 7, 0.16);
}

.create-icon-project::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -5px;
  width: 9px;
  height: 6px;
  border-radius: 3px 3px 0 0;
  background: #f8dc94;
}

.create-icon-document {
  width: 15px;
  height: 18px;
  border: 1.5px solid currentColor;
  border-radius: 4px;
  background: #ffffff;
}

.create-icon-document::before {
  content: "";
  position: absolute;
  top: -1.5px;
  right: -1.5px;
  width: 6px;
  height: 6px;
  border-left: 1.5px solid currentColor;
  border-bottom: 1.5px solid currentColor;
  border-radius: 0 4px 0 2px;
  background: var(--paper);
}

.doc-list {
  display: grid;
  gap: 4px;
}

.doc-item,
.project-item {
  position: relative;
  display: grid;
  grid-template-columns: 28px 15px minmax(0, 1fr);
  gap: 7px;
  align-items: center;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 8px;
  color: var(--ink-soft);
  background: transparent;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.project-tree,
.project-document-list {
  display: grid;
  gap: 3px;
  min-width: 100%;
  width: max-content;
}

.project-item {
  grid-template-columns: 22px 1fr;
}

.project-item .doc-name strong {
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-title-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-public-dot {
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  margin-left: 0;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.project-public-dot-row {
  position: absolute;
  right: -4px;
  bottom: -4px;
  z-index: 2;
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--green-soft);
}

.project-aksbel-dot {
  background: #A51C30;
  box-shadow: 0 0 0 3px rgba(165, 28, 48, 0.16);
}

.project-public-dot-row.project-aksbel-dot {
  box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px rgba(165, 28, 48, 0.16);
}

.doc-number {
  min-width: 0;
  align-self: center;
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  font-weight: 800;
  line-height: 1;
  opacity: 0.72;
  overflow: hidden;
  text-align: right;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.doc-item.active .doc-number {
  color: var(--navy);
  opacity: 1;
}

.create-doc-number {
  opacity: 0;
}

.doc-item:hover,
.project-item:hover {
  background: rgba(255, 255, 255, 0.56);
}

.doc-item.active,
.project-item.active {
  background: rgba(22, 27, 51, 0.08);
  color: var(--navy);
}

.project-document-list {
  position: relative;
  margin: 3px 0 10px 0;
}

.tree-doc-row {
  min-height: 36px;
  margin-left: var(--tree-indent, 28px);
}

.tree-doc-row.doc-tree-depth-0 { margin-left: 28px; }
.tree-doc-row.doc-tree-depth-1 { margin-left: 56px; }
.tree-doc-row.doc-tree-depth-2 { margin-left: 84px; }
.tree-doc-row.doc-tree-depth-3 { margin-left: 112px; }
.tree-doc-row.doc-tree-depth-4 { margin-left: 140px; }
.tree-doc-row.doc-tree-depth-5 { margin-left: 168px; }
.tree-doc-row.doc-tree-depth-6 { margin-left: 196px; }
.tree-doc-row.doc-tree-depth-7 { margin-left: 224px; }
.tree-doc-row.doc-tree-depth-8 { margin-left: 252px; }
.tree-doc-row.doc-tree-depth-9 { margin-left: 280px; }
.tree-doc-row.doc-tree-depth-10 { margin-left: 308px; }
.tree-doc-row.doc-tree-depth-11 { margin-left: 336px; }
.tree-doc-row.doc-tree-depth-12 { margin-left: 364px; }

.tree-doc-row.doc-tree-root {
  margin-top: 0;
}

.tree-doc-row.doc-tree-child::before,
.tree-doc-row.doc-tree-child::after {
  content: "";
  position: absolute;
  background: rgba(118, 112, 102, 0.18);
}

.tree-doc-row.doc-tree-child::before {
  left: -18px;
  top: 16px;
  width: 16px;
  height: 1px;
}

.tree-doc-row.doc-tree-child::after {
  left: -18px;
  top: -4px;
  width: 1px;
  height: 21px;
}

.tree-doc-row[data-has-children="true"] > .tree-row .doc-name strong {
  font-weight: 760;
}

.tree-doc-row[data-has-children="true"] > .tree-row .doc-icon {
  background: rgba(255, 253, 248, 0.86);
  opacity: 0.86;
}

.project-icon {
  position: relative;
  width: 18px;
  height: 13px;
  border-radius: 4px;
  background: linear-gradient(180deg, #f6cf70, #d89c24);
  box-shadow: inset 0 -1px 0 rgba(111, 77, 7, 0.16);
}

.project-icon::before {
  content: "";
  position: absolute;
  left: 2px;
  top: -5px;
  width: 9px;
  height: 6px;
  border-radius: 3px 3px 0 0;
  background: #f8dc94;
}

.project-item.active .project-icon {
  background: linear-gradient(180deg, #ffd978, #de9c1b);
}

.doc-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--amber);
}

.doc-dot.verified { background: var(--green); }
.doc-dot.needs,
.doc-dot.needs_verification { background: var(--purple); }
.doc-dot.rejected { background: var(--red); }
.doc-dot.obsolete { background: var(--gray); }

.doc-icon {
  position: relative;
  width: 14px;
  height: 17px;
  border: 1.4px solid currentColor;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.56);
  color: var(--muted);
  opacity: 0.72;
}

.doc-icon::before {
  content: "";
  position: absolute;
  top: -1.4px;
  right: -1.4px;
  width: 5px;
  height: 5px;
  border-left: 1.4px solid currentColor;
  border-bottom: 1.4px solid currentColor;
  border-radius: 0 4px 0 2px;
  background: var(--paper);
}

.doc-item.active .doc-icon {
  color: var(--navy);
  opacity: 1;
}

.doc-item.active .doc-icon.verified,
.doc-icon.verified {
  color: var(--green);
  background: var(--green-soft);
}

.doc-icon.debunk-pass {
  opacity: 1;
  box-shadow: 0 0 0 2px #22c55e, 0 0 0 4px rgba(34, 197, 94, 0.18);
}

.tree-doc-row[data-has-children="true"] > .tree-row .doc-icon.verified {
  background: var(--green-soft);
}

.tree-doc-row[data-has-children="true"] > .tree-row .doc-icon.debunk-pass {
  opacity: 1;
}

.doc-icon.needs,
.doc-icon.needs_verification { color: var(--purple); }
.doc-icon.rejected { color: var(--red); }
.doc-icon.obsolete { color: var(--gray); }

.doc-item.active::before {
  content: "";
  position: absolute;
  left: 3px;
  top: 7px;
  bottom: 7px;
  width: 2px;
  border-radius: 999px;
  background: var(--navy);
}

.doc-name {
  min-width: 0;
}

.doc-name strong {
  display: block;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.project-tree .doc-name strong,
.project-tree .doc-name > span,
.project-tree .project-title-text {
  overflow: visible;
  text-overflow: clip;
}

.project-tree .doc-item,
.project-tree .project-item,
.project-tree .sidebar-create-wide {
  min-width: max-content;
}

.project-tree .doc-name {
  min-width: max-content;
}

.doc-name > span {
  display: block;
  margin-top: 3px;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.side-panel {
  border-radius: var(--radius-xl);
  background: rgba(255,255,255,0.52);
  border: 1px solid var(--border-soft);
  box-shadow: 0 14px 38px rgba(45, 35, 20, 0.06);
  padding: 16px;
  margin-bottom: 16px;
}

.side-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}

.side-title h3 {
  margin: 0;
  font-size: 14px;
  letter-spacing: 0;
}

.side-title span,
.side-title a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.verification-stack {
  display: grid;
  gap: 10px;
}

.verification-card {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  transition: 180ms ease;
}

.verification-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(45, 35, 20, 0.10);
}

.verification-card.active {
  outline: 2px solid rgba(52, 71, 255, 0.16);
  background: #ffffff;
}

.number-token {
  width: 32px;
  height: 32px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: white;
  font-weight: 800;
  font-size: 12px;
  background: var(--navy);
}

.verification-body {
  min-width: 0;
}

.verification-body strong {
  display: block;
  font-size: 13px;
  line-height: 1.28;
  letter-spacing: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.verification-body p {
  margin: 6px 0 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.status-chip,
.tt-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 800;
  border-radius: 999px;
  padding: 4px 8px;
  font-style: normal;
}

.status-chip::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: currentColor;
}

.status-chip.verified,
.tt-status-verified {
  color: var(--green);
  background: var(--green-soft);
}

.status-chip.working,
.tt-status-working {
  color: var(--amber);
  background: var(--amber-soft);
}

.status-chip.needs,
.status-chip.needs_verification,
.tt-status-needs_verification {
  color: var(--purple);
  background: var(--purple-soft);
}

.status-chip.rejected,
.tt-status-rejected {
  color: var(--red);
  background: var(--red-soft);
}

.status-chip.obsolete,
.tt-status-obsolete {
  color: var(--gray);
  background: var(--gray-soft);
}

.tt-status-bg-working { background: var(--amber); }
.tt-status-bg-needs_verification { background: var(--purple); }
.tt-status-bg-verified { background: var(--green); }
.tt-status-bg-rejected { background: var(--red); }
.tt-status-bg-obsolete { background: var(--gray); }

.graph-preview {
  height: 230px;
  border-radius: 20px;
  background:
    radial-gradient(circle at 20% 20%, rgba(52, 71, 255, 0.08), transparent 35%),
    linear-gradient(145deg, #fffdf8, #f7f1e5);
  border: 1px solid var(--border-soft);
  overflow: hidden;
}

.graph-preview svg {
  display: block;
  width: 100%;
  height: 100%;
}

.legend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 12px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.legend-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--amber);
}

.legend-dot.green { background: var(--green); }
.legend-dot.purple { background: var(--purple); }
.legend-dot.red { background: var(--red); }

.note-box {
  padding: 14px;
  border-radius: 18px;
  background: var(--blue-soft);
  border: 1px solid #d8ddff;
  color: #222a6a;
  font-size: 12px;
  line-height: 1.55;
}

.note-box strong {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.selection-menu {
  position: fixed;
  z-index: 100;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  padding: 8px;
  border-radius: 999px;
  background: rgba(22, 27, 51, 0.96);
  color: white;
  box-shadow: 0 18px 50px rgba(22, 27, 51, 0.30);
  backdrop-filter: blur(18px);
  max-width: calc(100vw - 20px);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px) scale(0.98);
  transition: opacity 140ms ease, transform 140ms ease, visibility 140ms ease;
  visibility: hidden;
}

.selection-menu.expanded {
  border-radius: 999px;
}

.selection-menu:has(.selection-existing-link-form:not([hidden])),
.selection-menu:has(.selection-custom-ai-form:not([hidden])),
.selection-menu:has(.selection-citation-form:not([hidden])) {
  border-radius: 18px;
}

.selection-menu.open {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
  visibility: visible;
}

.selection-menu-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
}

.selection-menu button {
  border: 0;
  background: rgba(255,255,255,0.08);
  color: white;
  border-radius: 999px;
  padding: 8px 11px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
  white-space: nowrap;
}

.selection-expand-button {
  width: 34px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 15px;
  line-height: 1;
}

.selection-chevron {
  width: 8px;
  height: 8px;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
  transform: rotate(45deg);
  transition: transform 140ms ease;
}

.selection-expand-button.is-expanded .selection-chevron {
  transform: rotate(-135deg);
}

.selection-extra-panel {
  flex: 1 0 100%;
  min-width: min(320px, calc(100vw - 36px));
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 7px;
  align-items: stretch;
  padding: 4px 2px 2px;
}

.selection-extra-panel[hidden] {
  display: none;
}

.selection-existing-link-form,
.selection-custom-ai-form,
.selection-citation-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
  align-items: end;
}

.selection-custom-ai-form,
.selection-citation-form {
  align-items: stretch;
}

.selection-custom-ai-form label,
.selection-citation-form label {
  grid-column: 1 / -1;
}

.selection-existing-link-form[hidden],
.selection-custom-ai-form[hidden],
.selection-citation-form[hidden] {
  display: none;
}

.selection-extra-panel label {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.selection-extra-panel label span,
.selection-extra-message {
  color: rgba(255, 255, 255, 0.74);
  font-size: 10px;
  font-weight: 750;
}

.selection-extra-panel input,
.selection-extra-panel textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  font-size: 12px;
  outline: none;
}

.selection-extra-panel input {
  height: 32px;
  border-radius: 999px;
  padding: 0 11px;
}

.selection-extra-panel textarea {
  min-height: 74px;
  max-height: 150px;
  border-radius: 14px;
  padding: 9px 11px;
  line-height: 1.42;
  resize: vertical;
}

.selection-extra-panel input:focus,
.selection-extra-panel textarea:focus {
  border-color: rgba(255, 255, 255, 0.42);
  background: rgba(255, 255, 255, 0.16);
}

.selection-custom-ai-form.is-locked textarea,
.selection-citation-form.is-locked textarea {
  cursor: wait;
  opacity: 0.68;
}

.selection-extra-message {
  grid-column: 1 / -1;
  min-height: 12px;
}

.selection-extra-message:empty {
  display: none;
}

.selection-menu button.primary-pop {
  background: var(--gold);
  color: #211600;
}

.selection-menu button.selection-read-mark-button {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #dcfce7;
  color: #166534;
}

.selection-read-mark-button svg {
  width: 15px;
  height: 15px;
  flex: 0 0 auto;
}

.selection-menu button.selection-read-mark-button.is-marked {
  background: #bbf7d0;
  color: #14532d;
}

.selection-menu button.selection-read-mark-button:hover,
.selection-menu button.selection-read-mark-button:focus-visible {
  background: #c9f7d8;
  color: #14532d;
}

.selection-menu button.selection-read-mark-button.is-overlap {
  cursor: not-allowed;
  opacity: 0.58;
}

.selection-menu button.copied {
  background: var(--green);
  color: white;
}

.selection-menu button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.selection-menu-message {
  display: none;
  padding: 8px 11px;
  color: white;
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.selection-menu.blocked button[data-action="create"],
.selection-menu.blocked button[data-action="ask-ai"],
.selection-menu.blocked button[data-action="verify-ai"],
.selection-menu.blocked button[data-action="show-citation-verification-form"],
.selection-menu.blocked button[data-action="run-ai"],
.selection-menu.blocked button[data-action="verify-citation"],
.selection-menu.blocked button[data-action="more"],
.selection-menu.blocked .selection-extra-panel {
  display: none;
}

.selection-menu.blocked .selection-menu-message {
  display: inline-flex;
}

.ai-settings-panel {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(22, 27, 51, 0.34);
  backdrop-filter: blur(10px);
}

.ai-settings-panel[hidden] {
  display: none;
}

.ai-settings-form {
  width: min(440px, 100%);
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 8px;
  background: #fffdf8;
  border: 1px solid var(--border-soft);
  box-shadow: 0 24px 70px rgba(22, 27, 51, 0.24);
  color: var(--ink);
}

.ai-settings-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.ai-settings-head h2 {
  margin: 0;
  font-size: 16px;
  line-height: 1.2;
}

.ai-settings-head p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ai-settings-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.ai-settings-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-settings-form input,
.ai-settings-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 11px;
  font: inherit;
}

.ai-settings-message {
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.ai-settings-message.error {
  color: var(--red);
  font-weight: 800;
}

.ai-settings-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.ai-settings-actions button {
  border: 0;
  border-radius: 999px;
  padding: 9px 13px;
  font-size: 12px;
  font-weight: 800;
  cursor: pointer;
}

.ai-settings-actions button:not(.primary-pop) {
  background: var(--paper-soft);
  color: var(--muted);
}

.ai-settings-actions .primary-pop {
  background: var(--gold);
  color: #211600;
}

.ai-settings-actions button:disabled {
  cursor: wait;
  opacity: 0.72;
}

.ai-generation-status {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 125;
  width: min(360px, calc(100vw - 32px));
  display: grid;
  gap: 4px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 14px;
  background: rgba(22, 27, 51, 0.96);
  color: #ffffff;
  box-shadow: 0 20px 60px rgba(22, 27, 51, 0.28);
  font-size: 13px;
  line-height: 1.45;
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
  transition: opacity 150ms ease, transform 150ms ease;
}

.ai-generation-status.open {
  opacity: 1;
  transform: translateY(0);
}

.ai-generation-status::before {
  content: "";
  position: absolute;
  left: 13px;
  top: 15px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--gold);
  box-shadow: 0 0 0 0 rgba(201, 150, 58, 0.38);
  animation: tt-pulse 1.2s ease-out infinite;
}

.ai-generation-status strong,
.ai-generation-status span {
  display: block;
  padding-left: 18px;
}

.ai-generation-status strong {
  font-size: 13px;
}

.ai-generation-status[data-state="done"] {
  background: rgba(21, 128, 61, 0.96);
}

.ai-generation-status[data-state="done"]::before {
  background: #bbf7d0;
  animation: none;
}

.ai-generation-status[data-state="error"] {
  background: rgba(185, 28, 28, 0.96);
}

.ai-generation-status[data-state="error"]::before {
  background: #fecaca;
  animation: none;
}

@keyframes tt-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(201, 150, 58, 0.42);
  }
  100% {
    box-shadow: 0 0 0 12px rgba(201, 150, 58, 0);
  }
}

.toast {
  max-width: 360px;
  padding: 14px 16px;
  border-radius: 18px;
  background: var(--navy);
  color: white;
  box-shadow: 0 20px 60px rgba(22, 27, 51, 0.28);
  font-size: 13px;
  line-height: 1.5;
}

.toast strong {
  display: block;
  margin-bottom: 3px;
}

.tt-toast-stack {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 120;
  display: grid;
  gap: 10px;
}

.tt-site-rights {
  padding: 12px 18px 16px;
  color: rgba(118, 112, 102, 0.72);
  font-size: 10px;
  font-weight: 700;
  text-align: center;
}

.tt-page {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.tt-split-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 0;
}

.tt-split-main {
  min-width: 0;
  padding: 32px clamp(24px, 5vw, 76px) 56px;
}

.tt-split-main > .tt-page-head,
.tt-split-main > .tt-focus-panel,
.tt-split-main > .tt-section-label,
.tt-split-main > .tt-project-grid,
.tt-split-main > .tt-document-list,
.tt-split-main > .tt-empty {
  max-width: 980px;
  margin-left: auto;
  margin-right: auto;
}

.tt-chat-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-left: 1px solid rgba(222, 212, 195, 0.88);
  background: rgba(255, 253, 248, 0.78);
  backdrop-filter: blur(24px);
  overflow: hidden;
}

.tt-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 0 0 auto;
  min-width: 0;
}

.tt-sidebar-brand .brand-text {
  min-width: 0;
}

.tt-sidebar-brand .brand-text strong {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tt-sidebar-actions {
  flex: 0 0 auto;
}

.tt-sidebar-actions .tt-btn {
  width: 100%;
}

.tt-rail-search {
  flex: 0 0 auto;
}

.tt-rail-search input {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.88);
  color: var(--ink);
  outline: none;
  padding: 0 13px;
  box-shadow: 0 8px 24px rgba(45, 35, 20, 0.04);
}

.tt-chat-sidebar .doc-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}

.tt-sidebar-footer {
  flex: 0 0 auto;
  display: grid;
  gap: 8px;
  padding-top: 12px;
  border-top: 1px solid var(--border-soft);
}

.tt-sidebar-footer a {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.tt-narrow {
  width: min(820px, calc(100vw - 32px));
}

.tt-editor {
  width: min(1160px, calc(100vw - 32px));
}

.tt-editor-workspace {
  width: min(1040px, 100%);
}

.tt-page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.tt-page-head h1,
.tt-danger-panel h1,
.tt-empty h2,
.tt-project-card h2 {
  margin: 0;
  color: var(--navy);
  font-size: 38px;
  line-height: 1;
  letter-spacing: 0;
}

.tt-kicker {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tt-page-subtitle {
  max-width: 760px;
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.6;
}

.tt-focus-panel {
  margin-bottom: 18px;
  padding: 24px;
  border: 1px solid rgba(222, 212, 195, 0.86);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(180deg, rgba(255, 253, 248, 0.96), rgba(251, 248, 239, 0.96));
  box-shadow: var(--shadow);
}

.tt-focus-kicker,
.tt-section-label {
  color: var(--gold);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.tt-focus-kicker {
  margin-bottom: 12px;
}

.tt-section-label {
  margin-top: 24px;
  margin-bottom: 10px;
}

.tt-focus-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
}

.tt-focus-head h2 {
  margin: 0;
  color: var(--navy);
  font-size: 34px;
  line-height: 1.05;
  letter-spacing: 0;
}

.tt-focus-head p {
  max-width: 700px;
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.65;
}

.tt-project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.tt-project-grid-compact {
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.tt-project-card,
.tt-document-row,
.tt-empty,
.tt-danger-panel,
.tt-form {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: rgba(255, 253, 248, .86);
  box-shadow: var(--shadow-soft);
}

.tt-project-card {
  min-height: 146px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 18px;
}

.tt-project-card p,
.tt-document-row p,
.tt-empty p,
.tt-danger-panel p {
  color: var(--muted);
  line-height: 1.55;
}

.tt-card-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.tt-empty,
.tt-danger-panel {
  padding: 26px;
}

.tt-document-list {
  display: grid;
  gap: 10px;
}

.tt-document-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 15px 16px;
}

.tt-row-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-weight: 850;
}

.tt-document-row p {
  margin: 5px 0 0;
  font-size: 13px;
}

.tt-icon-link {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--paper);
}

.tt-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.tt-form-note {
  display: grid;
  gap: 5px;
  margin-bottom: 12px;
  padding: 12px 14px;
  border: 1px solid rgba(201, 150, 58, 0.32);
  border-radius: 10px;
  background: rgba(255, 243, 206, 0.42);
  color: var(--ink-soft);
}

.tt-form-note strong {
  color: var(--navy);
  font-size: 13px;
}

.tt-form-note span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.tt-form label {
  display: grid;
  gap: 7px;
}

.tt-form label > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .06em;
}

.tt-form input,
.tt-form textarea,
.tt-form select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
}

.tt-document-form textarea[name="raw_text"] {
  min-height: 520px;
  font-family: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  line-height: 1.6;
}

.tt-document-form textarea[name="raw_text"]::placeholder {
  color: var(--muted-2);
  opacity: 1;
}

.tt-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(180px, .8fr) minmax(150px, .5fr);
  gap: 12px;
}

.errorlist {
  margin: 0;
  padding-left: 18px;
  color: var(--red);
}

.tt-graph {
  position: relative;
  min-height: calc(100vh - 176px);
  overflow: hidden;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  cursor: url("../icons/graph-grab.svg") 9 9, grab;
}

.tt-graph canvas {
  cursor: inherit !important;
}

.tt-graph.tt-graph-grabbing,
.tt-graph.tt-graph-grabbing canvas {
  cursor: url("../icons/graph-grabbing.svg") 9 9, grabbing !important;
}

.tt-graph-label-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  pointer-events: none;
}

.tt-graph-node-label {
  position: absolute;
  max-width: 190px;
  transform: translate(-50%, var(--tt-label-shift-y, 0px));
  color: #171d32;
  font-size: 11px;
  font-weight: 400;
  line-height: 1.22;
  text-align: center;
  overflow-wrap: anywhere;
}

.tt-graph-node-label[data-node-type="project"] {
  font-size: 12px;
  font-weight: 400;
}

.tt-graph-node-label.tt-graph-focus-label {
  color: var(--navy);
  font-weight: 750;
  text-shadow: 0 1px 0 rgba(255, 253, 248, 0.96), 0 0 14px rgba(242, 199, 103, 0.46);
}

.tt-graph-node-label.tt-graph-debunk-pass-label {
  color: var(--green);
}

.tt-public-graph .tt-graph-node-label {
  max-width: 156px;
  font-size: 10px;
}

.tt-public-graph .tt-graph-node-label[data-node-type="project"] {
  font-size: 11px;
}

.tt-graph-node-label .katex {
  font-size: 1em;
}

.tt-graph-node-label.tt-math-title {
  overflow-wrap: normal;
  word-break: normal;
}

.tt-graph-node-label.tt-math-title .katex {
  white-space: nowrap;
}

.tt-graph-controls {
  position: absolute;
  right: 14px;
  bottom: 14px;
  z-index: 8;
  display: inline-flex;
  gap: 6px;
  padding: 5px;
  border-radius: 999px;
  background: rgba(255, 253, 248, 0.86);
  box-shadow: 0 10px 26px rgba(45, 35, 20, 0.12);
  backdrop-filter: blur(12px);
}

.tt-graph-controls button {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--paper-soft);
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}

.tt-graph-controls button:hover {
  background: var(--gold-soft);
  color: var(--navy);
}

.tt-graph-controls button.tt-graph-layout-toggle {
  width: auto;
  min-width: 58px;
  padding: 0 12px;
  font-size: 12px;
  font-weight: 700;
}

.tt-graph-controls button.tt-graph-layout-toggle[aria-pressed="true"] {
  background: var(--gold-soft);
  color: var(--navy);
}

.tt-public-graph {
  min-height: 760px;
  height: calc(100vh - 150px);
}

.tt-project-graph {
  min-height: 720px;
  height: calc(100vh - 150px);
}

.tt-public-graph-frame,
.graph-frame {
  width: min(1180px, 100%);
  max-width: 100%;
  margin: 0 auto;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.main-area.graph-main-area,
.main-area.graph-main-area:has(> .topbar-reader),
.main-area.graph-main-area:has(> .topbar-compact) {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
}

.main-area.graph-main-area > .topbar,
.main-area.graph-main-area:has(> .topbar-reader) > .topbar-reader,
.main-area.graph-main-area:has(> .topbar-compact) > .topbar-compact {
  flex: 0 0 auto;
  margin: 0;
}

.graph-main-area .graph-frame,
.graph-main-area .tt-public-library,
.graph-main-area .tt-public-graph-frame {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.graph-main-area .graph-frame,
.graph-main-area .tt-public-library,
.graph-main-area .tt-public-graph-frame {
  flex: 1 1 auto;
  min-height: 0;
}

.graph-main-area .tt-public-library {
  position: relative;
  display: flex;
  flex-direction: column;
}

.graph-main-area .tt-library-section-head {
  position: absolute;
  top: 14px;
  left: 24px;
  z-index: 9;
  max-width: min(520px, calc(100% - 48px));
  margin: 0;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  box-shadow: none;
  pointer-events: none;
}

.graph-main-area .tt-library-section-head a {
  pointer-events: auto;
}

.graph-main-area .tt-graph,
.graph-main-area .tt-project-graph,
.graph-main-area .tt-public-graph {
  width: 100%;
  height: 100%;
  min-height: 0;
  margin: 0;
  padding: 0;
}

@media (max-width: 1280px) {
  .app-shell {
    grid-template-columns: minmax(0, 1fr) var(--project-sidebar);
  }
}

@media (max-width: 900px) {
  :root {
    --topbar: 74px;
    --mobile-header: 56px;
  }

  .app-shell,
  .tt-split-page {
    grid-template-columns: 1fr;
  }

  .app-shell {
    height: auto;
    min-height: 100dvh;
    overflow: visible;
  }

  .tt-split-main {
    padding: 24px 16px 32px;
  }

  .tt-chat-sidebar {
    position: static;
    height: auto;
    max-height: none;
    border-left: 0;
    border-top: 1px solid var(--border);
    overflow: visible;
  }

  .tt-chat-sidebar .doc-list {
    overflow: visible;
  }

  .mobile-theorytrace-bar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 95;
    min-height: var(--mobile-header);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 14px;
    border-bottom: 1px solid rgba(222, 212, 195, 0.8);
    background: rgba(255, 253, 248, 0.94);
    backdrop-filter: blur(18px);
  }

  .mobile-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
    gap: 9px;
    color: var(--navy);
  }

  .mobile-brand span {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: grid;
    place-items: center;
    background: var(--navy);
    color: #ffffff;
    font-family: "Source Serif 4", Georgia, serif;
    font-size: 26px;
    font-weight: 850;
    line-height: 1;
  }

  .mobile-brand strong {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 15px;
  }

  .mobile-tree-button {
    width: 42px;
    height: 42px;
    min-height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 42px;
    border: 1px solid rgba(184, 121, 13, 0.22);
    border-radius: 11px;
    background: #fffaf0;
    color: #9f690b;
    padding: 0;
    box-shadow: 0 5px 15px rgba(92, 61, 8, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.9);
    cursor: pointer;
    transition: background 140ms ease, border-color 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
  }

  .mobile-tree-button:hover,
  .mobile-tree-button:focus-visible {
    border-color: rgba(164, 103, 4, 0.42);
    background: #fff2c4;
    box-shadow: 0 7px 18px rgba(92, 61, 8, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
  }

  .mobile-tree-button[aria-expanded="true"] {
    border-color: #b8790d;
    background: #9f690b;
    color: #fff6d8;
    box-shadow: 0 6px 16px rgba(112, 68, 5, 0.22);
  }

  .mobile-tree-button:active {
    transform: scale(0.96);
  }

  .mobile-tree-button:focus-visible {
    outline: 3px solid rgba(194, 138, 30, 0.2);
    outline-offset: 2px;
  }

  .mobile-tree-icon {
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    overflow: visible;
    stroke-width: 1.8;
    filter: drop-shadow(0 1px 1px rgba(112, 68, 5, 0.13));
  }

  .mobile-tree-folder {
    fill: #f7d46f;
    stroke: #a66c09;
  }

  .mobile-tree-branch {
    stroke: #8b5a08;
  }

  .mobile-tree-button[aria-expanded="true"] .mobile-tree-folder {
    fill: #f8d978;
    stroke: #fff6d8;
  }

  .mobile-tree-button[aria-expanded="true"] .mobile-tree-branch {
    stroke: #fff6d8;
  }

  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: block;
    background: rgba(22, 27, 51, 0.36);
    backdrop-filter: blur(3px);
  }

  .sidebar-backdrop[hidden] {
    display: none;
  }

  .project-sidebar {
    position: fixed;
    top: 0;
    right: 0;
    z-index: 120;
    width: min(340px, 88vw);
    height: 100dvh;
    padding-top: 18px;
    border-left: 1px solid rgba(214, 203, 184, 0.92);
    border-top: 0;
    transform: translateX(100%);
    transition: transform 180ms ease;
    box-shadow: -24px 0 70px rgba(22, 27, 51, 0.18);
  }

  .sidebar-resize-handle {
    display: none;
  }

  .project-sidebar.open {
    transform: translateX(0);
  }

  body.sidebar-open {
    overflow: hidden;
  }

  .sidebar-close-button {
    position: absolute;
    top: 14px;
    right: 12px;
    z-index: 2;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border: 0;
    border-radius: 999px;
    background: rgba(22, 27, 51, 0.06);
    color: var(--ink-soft);
    font-size: 24px;
    line-height: 1;
    cursor: pointer;
  }

  .project-sidebar .brand {
    padding-right: 42px;
  }

  .main-area {
    height: auto;
    overflow: visible;
    order: 1;
    padding-top: calc(var(--mobile-header) + 16px);
  }

  .main-area:has(> .topbar-reader),
  .main-area:has(> .topbar-compact) {
    padding-top: var(--mobile-header);
  }

  .topbar {
    position: sticky;
    top: var(--mobile-header);
    margin-top: 0;
    min-height: var(--topbar);
    z-index: 50;
  }

  .main-area:has(> .topbar-reader) > .topbar-reader,
  .main-area:has(> .topbar-compact) > .topbar-compact {
    margin-top: 0;
  }

  .reader-toolbar {
    top: var(--reader-toolbar-top);
    margin: 0 -8px 22px;
    padding: 8px 8px 10px;
    overflow-x: auto;
    scrollbar-width: thin;
  }

  .reader-toolbar-left {
    flex-wrap: nowrap;
    min-width: max-content;
    width: 100%;
  }

  .tool-chip {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .document-search {
    flex: 0 0 auto;
    margin-left: 0;
  }

  .document-search-panel {
    position: fixed;
    top: calc(var(--mobile-header) + var(--topbar) + 52px);
    left: 14px;
    right: 14px;
    width: auto;
  }

  .reader-label-main {
    align-items: flex-start;
  }

  .reader-label-actions {
    gap: 8px;
  }

  .reader-collaboration {
    gap: 6px;
  }

  .member-stack {
    max-width: 94px;
    overflow: hidden;
  }

  .header-menu-panel {
    right: -2px;
  }

  .reader-paper {
    padding: 28px 28px 44px;
  }

  .reader-frame {
    max-width: 100%;
  }

  .article [data-block-id]::before {
    display: none;
  }

  .tt-page-head,
  .tt-focus-head {
    flex-direction: column;
  }

  .tt-form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .main-area {
    padding: calc(var(--mobile-header) + 10px) 12px 28px;
  }

  .main-area:has(> .topbar-reader),
  .main-area:has(> .topbar-compact) {
    padding: var(--mobile-header) 12px 28px;
  }

  .topbar {
    margin: -10px -12px 16px;
    padding: 10px 12px;
    align-items: stretch;
  }

  .main-area:has(> .topbar-reader) > .topbar-reader,
  .main-area:has(> .topbar-compact) > .topbar-compact {
    margin: 0 -12px 16px;
  }

  .main-area:has(> .tt-activity-topbar) > .tt-activity-topbar {
    min-height: 38px;
    margin: 0 -12px 10px;
    padding: 6px 12px;
  }

  .top-actions,
  .tt-actions,
  .reader-label-actions {
    justify-content: space-between;
  }

  .reader-paper {
    border-radius: 16px;
    padding: 18px;
  }

  .tt-activity-head {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
  }

  .tt-activity-label-main {
    min-height: 22px;
  }

  .tt-activity-day-list {
    max-height: none;
    overflow: visible;
    padding-right: 0;
  }

  .tt-activity-detail-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tt-activity-detail-head > strong {
    align-self: flex-start;
  }

  .tt-activity-event {
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 10px;
  }

  .tt-aksbel-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .tt-aksbel-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .tt-aksbel-learner-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .tt-aksbel-learner-row > em {
    grid-column: 2;
    justify-self: start;
  }

  .tt-aksbel-project-report-row {
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
  }

  .tt-aksbel-project-report-row > em {
    justify-self: start;
  }

  .tt-learning-report-head,
  .tt-learning-section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .tt-learning-score {
    justify-items: start;
  }

  .tt-learning-stat-grid,
  .tt-learning-chart-row {
    grid-template-columns: 1fr;
  }

  .tt-learning-donut-card {
    grid-template-columns: 78px minmax(0, 1fr);
  }

  .tt-learning-donut {
    width: 72px;
  }

  .tt-learning-bar-row {
    grid-template-columns: 84px minmax(0, 1fr) 28px;
  }

  .reader-label-main {
    gap: 10px;
    flex-wrap: wrap;
  }

  .tt-quiz-breadcrumb {
    gap: 5px;
    font-size: 12px;
  }

  .tt-quiz-breadcrumb .tt-breadcrumb-crumb {
    max-width: 8ch;
  }

  .tt-quiz-breadcrumb .tt-breadcrumb-document {
    max-width: 10ch;
  }

  .tt-quiz-actions {
    gap: 6px;
  }

  .tt-debunk-loading-overlay {
    padding:
      max(10px, env(safe-area-inset-top))
      max(10px, env(safe-area-inset-right))
      max(10px, env(safe-area-inset-bottom))
      max(10px, env(safe-area-inset-left));
    align-items: center;
    justify-content: center;
  }

  .tt-debunk-loading-panel {
    top: 52%;
    width: min(330px, calc(100vw - 20px));
    max-height: calc(100dvh - 20px);
    gap: 8px;
    padding: 18px 14px;
    border-radius: 16px;
  }

  .tt-debunk-loading-panel h2 {
    font-size: 17px;
  }

  .tt-debunk-loading-panel p {
    font-size: 13px;
    line-height: 1.45;
  }

  .tt-debunk-loading-panel small {
    font-size: 11px;
  }

  .tt-debunk-loading-orbit {
    width: 44px;
    height: 44px;
  }

  .tt-debunk-loading-orbit span {
    width: 8px;
    height: 8px;
  }

  .tt-debunk-loading-orbit span:nth-child(1) {
    top: -4px;
    left: 18px;
  }

  .tt-debunk-loading-orbit span:nth-child(2) {
    right: 1px;
    bottom: 5px;
  }

  .tt-debunk-loading-orbit span:nth-child(3) {
    left: 1px;
    bottom: 5px;
  }

  .tt-debunk-loading-bars {
    gap: 5px;
  }

  .tt-debunk-loading-bars span {
    height: 4px;
  }

  .tt-library-section-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tt-public-graph-meta {
    justify-content: flex-start;
  }

  .tt-public-graph {
    min-height: 540px;
    height: 72vh;
  }

  .tt-aksbel-library-page,
  .tt-aksbel-book-form-page {
    width: 100%;
    padding: 18px 0 36px;
  }

  .tt-library-brand-copy small {
    white-space: normal;
  }

  .tt-aksbel-library-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: start;
    gap: 12px;
  }

  .tt-aksbel-library-head small {
    white-space: normal;
  }

  .tt-aksbel-library-side {
    justify-items: start;
    max-width: none;
    width: 100%;
  }

  .tt-aksbel-book-grid {
    grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
    gap: 16px;
  }

  .tt-aksbel-book-form {
    padding: 14px;
  }

  .tt-aksbel-doc-cover {
    min-height: 420px;
    padding: 24px;
  }

  .member-avatar {
    width: 25px;
    height: 25px;
    font-size: 10px;
  }

  .header-icon-button {
    width: 30px;
    height: 30px;
  }

  .document-search {
    flex: 0 0 auto;
    justify-content: flex-end;
  }

  .document-search-panel {
    left: 10px;
    right: 10px;
    width: auto;
  }

  .selection-menu {
    border-radius: 12px;
    overflow-x: auto;
  }

  .selection-menu.expanded,
  .selection-menu:has(.selection-existing-link-form:not([hidden])),
  .selection-menu:has(.selection-custom-ai-form:not([hidden])),
  .selection-menu:has(.selection-citation-form:not([hidden])) {
    border-radius: 12px;
  }

  .selection-menu-actions {
    align-items: stretch;
  }

  .selection-menu button {
    border-radius: 10px;
  }

  .selection-expand-button {
    border-radius: 10px;
  }

  .ai-generation-status {
    left: 12px;
    right: 12px;
    bottom: 14px;
    width: auto;
  }

  .tt-document-form textarea[name="raw_text"] {
    min-height: calc(100dvh - 240px);
  }

  .tt-page-head h1,
  .tt-danger-panel h1,
  .tt-empty h2,
  .tt-project-card h2 {
    font-size: 28px;
  }

  .article {
    font-size: 17px;
  }
}

@media (max-width: 420px), (max-height: 560px) {
  .tt-debunk-loading-panel {
    top: 52%;
    width: min(300px, calc(100vw - 20px));
    gap: 7px;
    padding: 14px 12px;
  }

  .tt-debunk-loading-panel h2 {
    font-size: 15px;
  }

  .tt-debunk-loading-panel p {
    font-size: 12px;
    line-height: 1.35;
  }

  .tt-debunk-loading-panel small {
    font-size: 10px;
    line-height: 1.3;
  }

  .tt-debunk-loading-orbit {
    width: 34px;
    height: 34px;
  }

  .tt-debunk-loading-orbit span {
    width: 6px;
    height: 6px;
  }

  .tt-debunk-loading-orbit span:nth-child(1) {
    top: -3px;
    left: 14px;
  }

  .tt-debunk-loading-orbit span:nth-child(2) {
    right: 0;
    bottom: 4px;
  }

  .tt-debunk-loading-orbit span:nth-child(3) {
    left: 0;
    bottom: 4px;
  }
}

.main-area.main-area-flush-top {
  padding-top: 0;
}

.main-area.main-area-flush-top > .tt-activity-topbar {
  top: 0;
  margin-top: 0;
}
