:root {
  --paper: #f5f0e7;
  --paper-deep: #ece3d5;
  --panel: rgba(255, 252, 246, 0.9);
  --panel-strong: #fffdf9;
  --ink: #111111;
  --ink-soft: #4d4a45;
  --ink-muted: #7f786f;
  --line: rgba(17, 17, 17, 0.14);
  --line-strong: rgba(17, 17, 17, 0.28);
  --accent: #1e1e1e;
  --success: #2d6d4b;
  --warning: #9c6a1d;
  --danger: #943434;
  --shadow: 0 10px 30px rgba(40, 30, 18, 0.08);
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --conversation-width: 960px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow: hidden;
  font-family: "Libre Franklin", "Noto Sans SC", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top right, rgba(17, 17, 17, 0.03), transparent 24%),
    linear-gradient(180deg, var(--paper) 0%, var(--paper-deep) 100%);
}

body.app-mode {
  overflow: auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(17, 17, 17, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 17, 17, 0.018) 1px, transparent 1px);
  background-size: 28px 28px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.22), transparent 82%);
}

.page-shell {
  width: min(1320px, calc(100vw - 32px));
  margin: 0 auto;
  min-height: 100vh;
  padding: 10px 0;
}

.page-shell.app-active {
  height: auto;
  padding: 18px 0 40px;
  overflow: visible;
}

.cover,
.panel-block,
.result-hero,
.section-card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.cover::before,
.panel-block::before,
.result-hero::before,
.section-card::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.8);
}

.cover {
  min-height: calc(100vh - 20px);
  padding: 16px 24px 18px;
  border-radius: 32px;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

.cover.is-hidden,
.workspace.is-hidden,
.chat-input-shell.is-hidden {
  display: none;
}

.cover-nav,
.cover-auth,
.result-meta-row,
.panel-head,
.section-card-head,
.actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.cover-nav,
.panel-head,
.section-card-head {
  justify-content: space-between;
}

.cover-nav {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line-strong);
}

.brand-mark,
.eyebrow,
.section-label {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 11px;
  font-weight: 700;
  color: var(--ink-muted);
}

.cover-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  max-width: 980px;
  margin: 8px auto 0;
  text-align: center;
  padding: 0 0 6px;
}

.hero-tv {
  display: flex;
  justify-content: center;
  margin: 0 auto 8px;
}

.tv-set {
  position: relative;
  width: min(640px, 72vw);
}

.tv-antenna {
  position: absolute;
  top: -14px;
  left: 50%;
  width: 94px;
  height: 24px;
  transform: translateX(-50%);
}

.tv-antenna::before,
.tv-antenna::after {
  content: "";
  position: absolute;
  bottom: 0;
  width: 2px;
  height: 24px;
  background: rgba(17, 17, 17, 0.5);
  transform-origin: bottom center;
}

.tv-antenna::before {
  left: 30px;
  transform: rotate(-28deg);
}

.tv-antenna::after {
  right: 30px;
  transform: rotate(28deg);
}

.tv-shell {
  position: relative;
  padding: 12px 12px 12px;
  border-radius: 28px;
  background: linear-gradient(180deg, #262626 0%, #111111 100%);
  box-shadow: 0 18px 36px rgba(17, 17, 17, 0.18);
}

.tv-screen {
  position: relative;
  aspect-ratio: 2.05 / 1;
  overflow: hidden;
  border-radius: 22px;
  background: #d8d2c7;
  border: 3px solid rgba(255, 255, 255, 0.3);
}

.tv-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), transparent 22%),
    radial-gradient(circle at center, transparent 48%, rgba(0, 0, 0, 0.14) 100%);
  pointer-events: none;
  z-index: 4;
}

.tv-static,
.tv-gif {
  position: absolute;
  inset: 0;
}

.tv-static {
  background:
    linear-gradient(90deg, rgba(0, 0, 0, 0.08) 50%, transparent 50%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.2), rgba(0, 0, 0, 0.16)),
    repeating-linear-gradient(
      0deg,
      rgba(20, 20, 20, 0.12) 0,
      rgba(20, 20, 20, 0.12) 2px,
      rgba(240, 240, 240, 0.12) 2px,
      rgba(240, 240, 240, 0.12) 4px
    );
  background-size: 8px 100%, 100% 100%, 100% 10px;
  animation: tvNoise 1.1s steps(6) infinite, tvStaticFade 6s ease-in-out infinite;
  z-index: 3;
}

.tv-gif {
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: grayscale(1) contrast(1.12) brightness(0.86);
  z-index: 1;
}

.tv-kicker,
.tv-caption {
  position: absolute;
  z-index: 4;
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.56);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.tv-kicker {
  top: 10px;
  left: 10px;
}

.tv-caption {
  left: 50%;
  bottom: 10px;
  transform: translateX(-50%);
}

.tv-controls {
  display: flex;
  justify-content: end;
  gap: 10px;
  margin-top: 4px;
}

.tv-controls span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.48);
}

.cover-body h1,
.panel-head h2,
.result-copy h2,
.section-card-head h3,
.media-copy h4 {
  margin: 0;
}

.cover-body h1 {
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(52px, 8vw, 96px);
  line-height: 0.86;
  font-weight: 700;
  letter-spacing: -0.05em;
}

.cover-quote {
  max-width: 28ch;
  margin: 12px auto 0;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(20px, 2.35vw, 34px);
  line-height: 1.08;
  font-weight: 400;
  color: #26231f;
}

.cover-source {
  margin: 8px 0 0;
  color: var(--ink-soft);
  font-size: 13px;
  font-weight: 600;
}

.cover-actions {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
}

.auth-button,
.cover-button {
  width: 250px;
}

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

button {
  cursor: pointer;
  border: 0;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.primary-button,
.secondary-button,
.ghost-button {
  border-radius: 999px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 600;
}

.primary-button {
  color: #fffdf9;
  background: linear-gradient(180deg, #202020 0%, #111111 100%);
  border: 1px solid rgba(17, 17, 17, 0.8);
}

.secondary-button,
.ghost-button {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.54);
  border: 1px solid var(--line);
}

.secondary-button:hover,
.ghost-button:hover {
  background: rgba(255, 255, 255, 0.84);
  border-color: var(--line-strong);
}

.cover-button {
  padding: 14px 24px;
}

@keyframes tvNoise {
  0% {
    transform: translateY(0);
    opacity: 0.95;
  }

  20% {
    transform: translateY(-1px);
    opacity: 0.72;
  }

  40% {
    transform: translateY(1px);
    opacity: 0.9;
  }

  60% {
    transform: translateX(-1px);
    opacity: 0.8;
  }

  80% {
    transform: translateX(1px);
    opacity: 0.94;
  }

  100% {
    transform: translateY(0);
    opacity: 0.78;
  }
}

@keyframes tvStaticFade {
  0%,
  18% {
    opacity: 0.96;
  }

  28%,
  100% {
    opacity: 0.12;
  }
}

.workspace {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
  margin-top: 18px;
  align-items: stretch;
  max-width: 1040px;
  margin-left: auto;
  margin-right: auto;
}

.page-shell.app-active .workspace {
  height: auto;
  margin-top: 8px;
}

.chat-stage,
.control-panel,
.result-panel,
.result-sections {
  display: grid;
  gap: 22px;
  min-height: 0;
}

.result-panel {
  grid-template-rows: auto;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
}

.result-panel.is-hidden {
  display: none;
}

.panel-block,
.result-hero,
.section-card {
  border-radius: var(--radius-xl);
  padding: 24px;
}

.chat-intro {
  max-width: 760px;
  margin: 0 auto;
  padding: 24px 0 2px;
  text-align: center;
}

.chat-intro h2 {
  margin: 12px 0 0;
  font-family: "Libre Franklin", "Noto Sans SC", sans-serif;
  font-size: clamp(34px, 4.8vw, 56px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.04em;
}

.chat-intro-copy {
  max-width: 58ch;
  margin: 14px auto 0;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.7;
}

.composer,
.result-hero,
.sources-card {
  min-height: 100%;
}

.page-shell.app-active .control-panel,
.page-shell.app-active .result-panel,
.page-shell.app-active .result-sections,
.page-shell.app-active .sources-card {
  overflow: visible;
}

.composer {
  max-width: 860px;
  margin: 0 auto;
}

.chat-composer {
  display: grid;
  gap: 14px;
  padding: 20px;
  background: rgba(255, 253, 249, 0.96);
  border-radius: 30px;
  box-shadow: 0 18px 40px rgba(40, 30, 18, 0.07);
}

.composer-field {
  gap: 12px;
}

.composer-toolbar {
  display: grid;
  gap: 16px;
}

.field,
.request-preview {
  display: grid;
  gap: 10px;
}

.input-hint {
  margin: 8px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
}

.input-hint.is-hidden {
  display: none;
}

.field span,
.request-preview p:last-child,
.evidence-item p,
.sample-subtitle,
#verdict-summary,
.media-copy p {
  font-family: "Libre Franklin", "Noto Sans SC", sans-serif;
}

.field span {
  font-size: 13px;
  color: var(--ink-soft);
  font-weight: 600;
}

.field-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 14px;
  margin-top: 2px;
}

.actions {
  justify-content: flex-end;
  gap: 14px;
  margin-top: 0;
  flex-wrap: wrap;
}

.actions .primary-button {
  min-width: 196px;
}

.actions .secondary-button {
  min-width: 114px;
  padding-inline: 24px;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  outline: none;
}

textarea::placeholder,
input::placeholder {
  color: #8f877d;
}

textarea {
  min-height: 146px;
  resize: vertical;
  border-radius: 24px;
  line-height: 1.72;
}

.page-shell.app-active textarea {
  min-height: 132px;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #5b544b 50%),
    linear-gradient(135deg, #5b544b 50%, transparent 50%);
  background-position:
    calc(100% - 18px) calc(50% - 2px),
    calc(100% - 12px) calc(50% - 2px);
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

textarea:focus,
input:focus,
select:focus {
  border-color: rgba(17, 17, 17, 0.34);
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.05);
}

textarea.input-error {
  border-color: rgba(148, 52, 52, 0.34);
  box-shadow: 0 0 0 4px rgba(148, 52, 52, 0.06);
}

.request-preview {
  margin-top: 4px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(17, 17, 17, 0.02), rgba(17, 17, 17, 0.04));
  border: 1px solid rgba(17, 17, 17, 0.08);
}

.page-shell.app-active .request-preview {
  margin-top: 14px;
  padding: 16px 18px;
  min-height: 152px;
  max-height: none;
  overflow: visible;
}

.request-preview p {
  margin: 0;
  line-height: 1.72;
  color: var(--ink-soft);
}

.page-shell.app-active .request-preview p:last-child {
  font-size: 14px;
  line-height: 1.78;
}

.sample-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  border-top: 0;
  justify-content: center;
}

.sample-item {
  display: grid;
  gap: 4px;
  text-align: left;
  min-width: 0;
  padding: 14px 15px;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(255, 255, 255, 0.95));
  border: 1px solid var(--line);
  box-shadow: 0 8px 20px rgba(40, 30, 18, 0.05);
  position: relative;
  overflow: hidden;
  max-width: 100%;
}

.sample-item::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 0;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(17, 17, 17, 0.82), rgba(17, 17, 17, 0.18));
}

.sample-item:hover {
  background: rgba(255, 255, 255, 0.98);
  border-color: var(--line-strong);
}

.sample-title {
  font-family: "Libre Franklin", "Noto Sans SC", sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.3;
}

.sample-subtitle {
  font-size: 12px;
  color: var(--ink-muted);
  line-height: 1.4;
}

.sample-inline {
  margin-top: 2px;
}

.sample-inline-head {
  margin-bottom: 8px;
  text-align: center;
}

.sample-inline .section-label {
  display: block;
  text-align: center;
}

.sample-inline .sample-list {
  max-width: none;
  margin: 0 auto;
}

.thread-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.thread-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  background: rgba(17, 17, 17, 0.08);
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.thread-avatar-assistant {
  background: linear-gradient(180deg, #1d1d1d 0%, #111111 100%);
  color: #fffdf9;
}

.thread-content {
  min-width: 0;
}

.thread-user .thread-content {
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 252, 246, 0.84);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.thread-query {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.7;
}

.thread-assistant .thread-content {
  display: grid;
  gap: 14px;
}

.result-hero {
  display: flex;
  align-items: center;
  min-height: auto;
  justify-content: flex-start;
  text-align: left;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.result-hero::before {
  display: none;
}

.page-shell.app-active .result-hero {
  min-height: auto;
  padding: 0;
}

.result-copy h2 {
  margin-top: 12px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(34px, 4vw, 52px);
  line-height: 0.98;
  font-weight: 700;
}

.page-shell.app-active .result-copy h2 {
  font-size: clamp(32px, 3.3vw, 46px);
}

#verdict-summary {
  margin: 16px 0 0;
  max-width: 60ch;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.82;
}

.page-shell.app-active #verdict-summary {
  margin-top: 12px;
  font-size: 14px;
  line-height: 1.68;
}

.result-meta-row {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.status-pill,
.confidence-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  background: rgba(17, 17, 17, 0.04);
  border: 1px solid rgba(17, 17, 17, 0.08);
}

.status-pill.true {
  color: var(--success);
  background: rgba(45, 109, 75, 0.09);
  border-color: rgba(45, 109, 75, 0.14);
}

.status-pill.false {
  color: var(--danger);
  background: rgba(148, 52, 52, 0.08);
  border-color: rgba(148, 52, 52, 0.14);
}

.status-pill.mixed {
  color: var(--warning);
  background: rgba(156, 106, 29, 0.08);
  border-color: rgba(156, 106, 29, 0.14);
}

.status-pill.pending {
  color: var(--ink-soft);
  background: rgba(17, 17, 17, 0.04);
}

.featured-media {
  margin-bottom: 16px;
}

.page-shell.app-active .featured-media {
  margin-bottom: 12px;
}

.media-card {
  display: grid;
  grid-template-columns: minmax(280px, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.media-preview {
  min-height: 220px;
  border-radius: 18px;
  background:
    linear-gradient(180deg, rgba(17, 17, 17, 0.05), rgba(17, 17, 17, 0.1)),
    linear-gradient(135deg, #dad3c7, #f5f0e7 58%, #e6dccd);
  display: grid;
  place-items: center;
  overflow: hidden;
}

.page-shell.app-active .media-preview {
  min-height: 160px;
}

.media-preview-empty {
  background:
    linear-gradient(180deg, rgba(17, 17, 17, 0.03), rgba(17, 17, 17, 0.08)),
    linear-gradient(135deg, #e9e2d7, #f7f1e8);
}

.media-preview-inner {
  width: calc(100% - 24px);
  height: calc(100% - 24px);
  border-radius: 16px;
  border: 1px solid rgba(17, 17, 17, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(17, 17, 17, 0.08)),
    rgba(255, 255, 255, 0.24);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 16px;
}

.play-badge,
.preview-time,
.timestamp-chip,
.source-chip {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
}

.play-badge,
.preview-time {
  padding: 8px 12px;
  color: #fffdf9;
  background: rgba(17, 17, 17, 0.72);
}

.preview-time {
  align-self: flex-end;
}

.media-copy {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.media-copy h4 {
  margin: 8px 0 10px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 28px;
  line-height: 1.04;
  font-weight: 600;
}

.page-shell.app-active .media-copy h4 {
  font-size: 24px;
}

.media-copy p {
  margin: 0;
  color: var(--ink-soft);
  line-height: 1.78;
}

.page-shell.app-active .media-copy p {
  line-height: 1.62;
}

.media-provider {
  margin-top: 14px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}

.media-meta,
.evidence-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.media-meta {
  margin-top: 16px;
}

.timestamp-chip,
.source-chip {
  padding: 8px 12px;
  color: var(--ink-soft);
  background: rgba(17, 17, 17, 0.04);
  border: 1px solid rgba(17, 17, 17, 0.08);
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  align-content: start;
}

.page-shell.app-active .evidence-grid {
  gap: 12px;
}

.evidence-item {
  min-height: 160px;
  padding: 18px;
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
  border: 1px solid var(--line);
}

.page-shell.app-active .evidence-item {
  min-height: 132px;
  padding: 16px;
}

.evidence-item strong {
  display: block;
  margin-bottom: 6px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.04;
}

.page-shell.app-active .evidence-item strong {
  font-size: 21px;
}

.evidence-item p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.75;
}

.page-shell.app-active .evidence-item p {
  font-size: 13px;
  line-height: 1.6;
}

.evidence-footer {
  margin-top: 14px;
}

.evidence-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  font-size: 11px;
  color: var(--ink-muted);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cover,
.panel-block,
.result-hero,
.section-card,
.sample-item,
.media-card,
.evidence-item {
  animation: fadeUp 420ms ease both;
}

@media (max-width: 1080px) {
  .workspace,
  .field-grid,
  .evidence-grid,
  .media-card {
    grid-template-columns: 1fr;
  }

  .sample-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .result-hero {
    min-height: auto;
  }
}

@media (max-height: 920px) {
  .cover {
    padding: 14px 22px 16px;
  }

  .cover-body {
    margin-top: 4px;
    padding-bottom: 4px;
  }

  .tv-set {
    width: min(600px, 68vw);
  }

  .hero-tv {
    margin-bottom: 6px;
  }

  .cover-body h1 {
    font-size: clamp(48px, 7vw, 82px);
  }

  .cover-quote {
    margin-top: 10px;
    font-size: clamp(18px, 2.05vw, 30px);
  }

  .cover-source {
    margin-top: 6px;
  }

  .cover-actions {
    margin-top: 12px;
    gap: 8px;
  }

  .auth-button,
  .cover-button {
    width: 236px;
  }

  .cover-button {
    padding-block: 13px;
  }
}

@media (max-width: 720px) {
  .page-shell {
    width: min(100vw - 20px, 100%);
    padding-top: 10px;
  }

  .cover,
  .panel-block,
  .result-hero,
  .section-card {
    padding: 18px;
    border-radius: 24px;
  }

  .cover {
    min-height: calc(100vh - 20px);
  }

  .cover-nav,
  .actions {
    flex-direction: column;
    align-items: stretch;
  }

  .hero-tv {
    margin-bottom: 10px;
  }

  .tv-set {
    width: min(100%, 480px);
  }

  .sample-list {
    grid-template-columns: 1fr;
  }

  .thread-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .thread-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }

  .cover-body {
    margin-top: 12px;
    padding: 0 0 10px;
  }

  .chat-intro {
    padding-top: 8px;
  }

  .chat-intro h2 {
    font-size: 34px;
  }

  .chat-intro-copy {
    font-size: 14px;
  }

  .cover-quote {
    max-width: none;
  }

  .primary-button,
  .secondary-button,
  .ghost-button {
    width: 100%;
  }

  .auth-button,
  .cover-button {
    max-width: 280px;
  }

  .actions .primary-button,
  .actions .secondary-button {
    min-width: 0;
  }
}

.page-shell.app-active {
  width: min(1440px, calc(100vw - 24px));
  padding: 12px 0;
}

.workspace {
  grid-template-columns: 280px minmax(0, 1fr);
  max-width: none;
  min-height: calc(100vh - 24px);
  gap: 16px;
}

.page-shell.app-active .workspace {
  margin-top: 0;
}

.chat-sidebar,
.chat-main {
  min-height: 0;
}

.chat-sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 16px;
  border-radius: 28px;
  background: rgba(255, 252, 246, 0.74);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sidebar-head {
  display: grid;
  gap: 12px;
}

.new-chat-button {
  width: 100%;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.86);
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  text-align: left;
}

.sidebar-section {
  display: grid;
  gap: 12px;
  min-height: 0;
  overflow: hidden;
}

.history-list {
  display: grid;
  gap: 8px;
  align-content: start;
  overflow: auto;
  padding-right: 4px;
}

.history-empty {
  display: grid;
  gap: 6px;
  padding: 14px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.58);
  border: 1px dashed rgba(17, 17, 17, 0.14);
}

.history-empty p,
.history-empty span {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.5;
}

.history-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 18px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
}

.history-item:hover,
.history-item.is-active {
  background: rgba(255, 255, 255, 0.82);
  border-color: var(--line);
}

.history-title {
  color: var(--ink);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.4;
}

.history-meta {
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.4;
}

.chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  padding: 12px 0 0;
}

.chat-main-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
}

.chat-main-head h2 {
  margin: 8px 0 0;
  font-family: "Libre Franklin", "Noto Sans SC", sans-serif;
  font-size: 22px;
  line-height: 1.1;
  font-weight: 600;
  letter-spacing: -0.03em;
}

.chat-scroll {
  overflow: auto;
  min-height: 0;
  padding: 8px 24px 0;
  position: relative;
  z-index: 1;
}

.chat-home {
  max-width: 860px;
  margin: 0 auto;
  padding: 48px 0 32px;
}

.chat-home.is-hidden {
  display: none;
}

.chat-intro {
  max-width: 720px;
  margin: 0 auto;
  text-align: center;
}

.chat-intro h2 {
  margin: 14px 0 0;
  font-family: "Libre Franklin", "Noto Sans SC", sans-serif;
  font-size: clamp(42px, 5vw, 64px);
  line-height: 1.02;
  font-weight: 600;
  letter-spacing: -0.05em;
}

.chat-intro-copy {
  margin: 16px auto 0;
  max-width: 60ch;
  color: var(--ink-soft);
  font-size: 16px;
  line-height: 1.7;
}

.home-samples {
  margin-top: 28px;
}

.chat-home .sample-list {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  max-width: none;
}

.result-panel {
  width: min(calc(var(--conversation-width) + 64px), 100%);
  margin: 0 auto;
  grid-template-rows: auto;
  gap: 22px;
  padding-bottom: 28px;
}

.thread-card {
  display: grid;
  grid-template-columns: 48px minmax(0, var(--conversation-width));
  justify-content: center;
  gap: 16px;
}

.thread-content {
  min-width: 0;
}

.thread-user .thread-content {
  width: min(100%, var(--conversation-width));
  padding: 18px 20px;
  border-radius: 22px;
  background: rgba(255, 252, 246, 0.88);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.thread-query {
  margin: 8px 0 0;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.72;
}

.thread-assistant .thread-content {
  display: grid;
  gap: 18px;
  width: min(100%, var(--conversation-width));
}

.result-hero {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  margin-top: 6px;
}

.result-hero::before {
  display: none;
}

.result-copy {
  width: min(100%, var(--conversation-width));
}

.result-copy h2 {
  margin-top: 12px;
}

.result-meta-row {
  justify-content: flex-start;
}

#verdict-summary {
  max-width: 62ch;
}

.verdict-summary {
  margin: 16px 0 0;
  max-width: 62ch;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.82;
}

.result-panel .thread-card + .thread-card {
  margin-top: 18px;
}

.result-panel .thread-assistant + .thread-user {
  margin-top: 42px;
}

.workflow-card {
  overflow: visible;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  margin-top: 8px;
}

.workflow-card::before {
  display: none;
}

.verification-workflow {
  display: grid;
  gap: 14px;
  margin-top: 10px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  gap: 14px;
  position: relative;
  padding: 12px 0 16px;
  border-radius: 0;
  background: transparent;
  border: 0;
}

.workflow-step:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 34px;
  bottom: -15px;
  width: 1px;
  height: 15px;
  background: rgba(17, 17, 17, 0.18);
}

.workflow-index {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  color: #fffdf9;
  background: #111111;
  font-size: 13px;
  font-weight: 700;
}

.workflow-copy h3 {
  margin: 6px 0 8px;
  font-family: "Source Serif 4", Georgia, serif;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.05;
}

.workflow-copy p {
  margin: 0;
  color: var(--ink-soft);
  font-size: 15px;
  line-height: 1.7;
}

.workflow-copy .result-meta-row {
  justify-content: flex-start;
  margin-top: 12px;
}

.workflow-frame-step .keyframe-preview {
  max-width: 520px;
  margin: 12px 0;
}

.sources-card {
  padding: 0;
}

.media-card {
  grid-template-columns: minmax(300px, 0.95fr) minmax(0, 1.05fr);
  align-items: start;
}

.media-visuals {
  display: grid;
  gap: 14px;
}

.media-preview,
.keyframe-preview {
  min-height: 0;
  aspect-ratio: 16 / 9;
}

.media-preview {
  position: relative;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.2)),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.08) 0,
      rgba(255, 255, 255, 0.08) 1px,
      rgba(0, 0, 0, 0.06) 1px,
      rgba(0, 0, 0, 0.06) 3px
    ),
    linear-gradient(135deg, #d7d0c6, #9f9688 55%, #4c4740);
}

.media-preview::before,
.media-preview::after {
  content: "";
  position: absolute;
  bottom: 18%;
  border-radius: 999px 999px 18px 18px;
  background: rgba(20, 20, 20, 0.72);
}

.media-preview::before {
  left: 22%;
  width: 74px;
  height: 118px;
}

.media-preview::after {
  right: 22%;
  width: 74px;
  height: 118px;
}

.media-preview-inner {
  position: relative;
  z-index: 2;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(17, 17, 17, 0.1)),
    transparent;
}

.media-preview-inner::after {
  content: "";
  display: block;
  align-self: stretch;
  height: 10px;
  margin-top: auto;
  border-radius: 999px;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.7) 0 34%, rgba(255, 255, 255, 0.2) 34% 100%),
    rgba(17, 17, 17, 0.38);
}

.keyframe-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border-radius: 18px;
  background: rgba(17, 17, 17, 0.03);
  border: 1px solid rgba(17, 17, 17, 0.08);
}

.keyframe-preview {
  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(17, 17, 17, 0.2)),
    repeating-linear-gradient(
      90deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 2px,
      transparent 2px,
      transparent 8px
    ),
    linear-gradient(135deg, #dfd6ca, #bdb2a3 60%, #8f8577);
}

.keyframe-image {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.keyframe-preview::before,
.keyframe-preview::after {
  content: "";
  position: absolute;
  border-radius: 999px;
  background: rgba(17, 17, 17, 0.55);
}

.keyframe-preview:has(.keyframe-image)::before,
.keyframe-preview:has(.keyframe-image)::after {
  content: none;
}

.keyframe-preview::before {
  width: 62px;
  height: 62px;
  left: 18%;
  bottom: 30%;
}

.keyframe-preview::after {
  width: 88px;
  height: 118px;
  right: 18%;
  bottom: 12%;
  border-radius: 999px 999px 18px 18px;
}

.keyframe-card::after {
  content: "Verified frame";
  width: fit-content;
  padding: 6px 10px;
  border-radius: 999px;
  color: var(--ink-muted);
  background: rgba(17, 17, 17, 0.04);
  border: 1px solid rgba(17, 17, 17, 0.08);
  font-size: 11px;
  font-weight: 700;
}

.frame-stage {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(17, 17, 17, 0.18)),
    linear-gradient(135deg, #e5ddd2, #cabfac 58%, #9d927f);
}

.frame-archive {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(17, 17, 17, 0.22)),
    linear-gradient(135deg, #d8d1c8, #b5aea5 58%, #827a71);
}

.frame-clip {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(17, 17, 17, 0.22)),
    linear-gradient(135deg, #ddd4c8, #beb2a4 58%, #8b7f71);
}

.keyframe-badge {
  position: absolute;
  z-index: 2;
  top: 12px;
  left: 12px;
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 11px;
  color: #fffdf9;
  background: rgba(17, 17, 17, 0.72);
  font-size: 11px;
  font-weight: 700;
}

.evidence-list {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.keyframe-note {
  margin: 0;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.6;
}

.chat-input-shell {
  margin: 0 24px 0;
  padding: 18px;
  border-radius: 28px;
  position: sticky;
  bottom: 0;
  z-index: 10;
  background:
    linear-gradient(180deg, rgba(255, 253, 249, 0.98), rgba(255, 251, 245, 0.98));
}

.composer-field {
  gap: 12px;
}

.composer-foot {
  display: grid;
  gap: 14px;
}

.chat-input-shell .field-grid {
  margin-top: 0;
}

.chat-input-shell .actions {
  justify-content: flex-end;
}

.chat-input-shell .actions .primary-button {
  min-width: 160px;
}

.chat-input-shell .actions .secondary-button {
  min-width: 112px;
}

@media (max-width: 1180px) {
  .workspace {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .chat-home .sample-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .media-card {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .chat-sidebar {
    order: 2;
    max-height: 260px;
  }

  .chat-main {
    order: 1;
    min-height: calc(100vh - 320px);
  }
}

@media (max-width: 720px) {
  .page-shell.app-active {
    width: min(100vw - 12px, 100%);
  }

  .chat-main-head,
  .chat-scroll,
  .chat-input-shell {
    padding-left: 14px;
    padding-right: 14px;
  }

  .chat-main-head {
    padding-right: 14px;
  }

  .chat-home {
    padding-top: 18px;
  }

  .chat-home .sample-list {
    grid-template-columns: 1fr;
  }

  .thread-card {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .thread-avatar {
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }

  .chat-input-shell {
    position: static;
    margin: 0 14px 14px;
    padding: 16px;
  }

  .chat-input-shell .field-grid {
    grid-template-columns: 1fr;
  }

  .chat-input-shell .actions {
    flex-direction: column-reverse;
    align-items: stretch;
  }

  .chat-input-shell .actions .primary-button,
  .chat-input-shell .actions .secondary-button {
    width: 100%;
  }
}

/* ChatGPT-style app layout override: no overlay, only the message area scrolls. */
body.app-mode {
  overflow: hidden;
}

.page-shell.app-active {
  width: 100vw;
  max-width: none;
  height: 100vh;
  min-height: 100vh;
  padding: 0;
}

.page-shell.app-active .workspace {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  width: 100%;
  height: 100vh;
  min-height: 0;
  gap: 0;
  margin: 0;
}

.chat-sidebar {
  height: 100vh;
  border-radius: 0;
  border-width: 0 1px 0 0;
  box-shadow: none;
  background: rgba(246, 241, 232, 0.88);
}

.chat-main {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  height: 100vh;
  min-height: 0;
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.chat-main-head {
  min-height: 74px;
  padding: 18px 32px 12px;
  border-bottom: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(245, 240, 231, 0.9);
}

.chat-scroll {
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 32px 32px 18px;
}

.chat-home {
  min-height: 100%;
  display: grid;
  align-content: center;
  padding: 0;
}

.result-panel {
  width: min(calc(var(--conversation-width) + 64px), 100%);
  padding-bottom: 0;
}

.chat-composer-area {
  box-sizing: border-box;
  width: min(calc(var(--conversation-width) + 64px), 100%);
  padding-left: 64px;
  margin: 0 auto 26px;
}

.chat-input-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  column-gap: 12px;
  position: static;
  z-index: auto;
  width: 100%;
  margin: 0;
  padding: 12px 16px;
  border-radius: 26px;
  border: 1px solid rgba(17, 17, 17, 0.08);
  background: rgba(248, 246, 241, 0.98);
  box-shadow: 0 10px 26px rgba(40, 30, 18, 0.08);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
}

.chat-input-shell::before {
  display: none;
}

.composer-field {
  gap: 0;
  min-width: 0;
}

.composer-field > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.composer-field input {
  min-height: 28px;
  height: 28px;
  max-height: 28px;
  width: 100%;
  padding: 0 2px;
  border: 0;
  border-radius: 0;
  background: transparent;
  overflow: hidden;
  line-height: 1.5;
  box-shadow: none;
  font-size: 16px;
}

.composer-field input::placeholder {
  color: #8f877d;
}

.composer-field input:focus {
  box-shadow: none;
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 0;
}

#speaker-input,
#content-type {
  display: none;
}

.chat-input-shell .input-hint {
  grid-column: 1 / 2;
  margin-top: 2px;
}

.composer-tools,
.chat-input-shell .actions {
  display: flex;
  gap: 8px;
  margin: 0;
  align-items: center;
}

.tool-button {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink-soft);
  font-size: 18px;
  line-height: 1;
  cursor: default;
}

.chat-input-shell .actions .primary-button,
.chat-input-shell .actions .secondary-button {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  width: 38px;
  min-height: 38px;
  height: 38px;
  padding: 0;
  border-radius: 50%;
  white-space: nowrap;
  font-size: 21px;
  line-height: 1;
}

.chat-input-shell:focus-within {
  border-color: rgba(17, 17, 17, 0.16);
  background: rgba(255, 253, 249, 1);
  box-shadow:
    0 12px 30px rgba(40, 30, 18, 0.1),
    0 0 0 4px rgba(17, 17, 17, 0.04);
}

.composer-disclaimer {
  margin: 8px 0 0;
  color: var(--ink-muted);
  font-size: 12px;
  line-height: 1.2;
  text-align: center;
}

.result-panel .thread-assistant .section-card {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  border-radius: 0;
}

.result-panel .thread-assistant .section-card::before {
  display: none;
}

.result-panel .thread-assistant .section-card-head {
  margin-bottom: 10px;
  padding: 0;
}

.thread-user .thread-content {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

@media (max-width: 960px) {
  .page-shell.app-active .workspace {
    grid-template-columns: 1fr;
  }

  .chat-sidebar {
    display: none;
  }

  .chat-main {
    min-height: 100vh;
  }
}

@media (max-width: 720px) {
  .chat-main-head {
    padding: 14px 16px 10px;
  }

  .chat-scroll {
    padding: 20px 14px;
  }

  .chat-composer-area {
    width: calc(100% - 20px);
    padding-left: 0;
    margin-bottom: 22px;
  }

  .chat-input-shell {
    padding: 2px 6px 4px;
  }

  .chat-input-shell .actions {
    justify-content: flex-end;
  }

  .chat-input-shell .actions .primary-button {
    width: auto;
  }
}
