:root {
  --bg: #f5f5f2;
  --surface: #fffffb;
  --surface-2: #eeeeeb;
  --ink: #20251f;
  --muted: #626661;
  --quiet: #989a95;
  --line: rgba(32, 37, 31, 0.11);
  --moss: #555f62;
  --moss-soft: #f7f7f4;
  --clay: #8d6f52;
  --blue: #5d7380;
  --evidence: #f4f0e8;
  --danger: #9b4e3f;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.32) 1px, transparent 1px),
    linear-gradient(180deg, rgba(255, 255, 255, 0.28) 1px, transparent 1px),
    var(--bg);
  background-size: 42px 42px;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.app-frame {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(100vw, 430px);
  min-height: 100dvh;
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
}

@media (min-width: 720px) {
  body {
    padding: 24px;
  }

  .app-frame {
    width: min(430px, calc(100vw - 48px));
    height: calc(100dvh - 48px);
    min-height: 680px;
    border: 1px solid var(--line);
    border-radius: 28px;
    box-shadow: 0 22px 70px rgba(48, 39, 25, 0.14);
  }
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 24px 20px 12px;
  background: linear-gradient(180deg, var(--bg) 82%, rgba(245, 245, 242, 0));
}

.topbar h1 {
  margin: 0;
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
  font-weight: 760;
}

.top-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.topbar p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 520;
}

.review-button,
.quiet-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 251, 0.82);
  font-size: 13px;
  font-weight: 680;
}

.review-button svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.review-button:disabled {
  color: rgba(32, 37, 31, 0.32);
  background: rgba(255, 255, 251, 0.48);
  cursor: default;
}

.review-button.secondary {
  color: var(--muted);
  background: transparent;
}

.page {
  flex: 1;
  min-height: 0;
  padding: 0 20px 132px;
  overflow-y: auto;
}

.app-frame.answering .page {
  padding-bottom: 96px;
}

.intro {
  margin: 6px 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.empty {
  display: grid;
  justify-items: center;
  gap: 16px;
  width: min(100%, 322px);
  margin: clamp(88px, 11dvh, 112px) auto 0;
  padding: 0 12px;
  text-align: center;
}

.empty-art {
  position: relative;
  display: grid;
  width: min(238px, 78vw);
  aspect-ratio: 1.22;
  place-items: center;
}

.empty-art::after {
  position: absolute;
  right: 20%;
  bottom: 5%;
  left: 18%;
  height: 20px;
  border-radius: 999px;
  background: rgba(48, 39, 25, 0.12);
  content: "";
  filter: blur(14px);
}

.empty-art svg {
  position: relative;
  z-index: 1;
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.empty-photo-shadow {
  fill: rgba(48, 39, 25, 0.08);
  transform: translate(3px, 7px) rotate(2deg);
  transform-origin: center;
}

.empty-photo {
  fill: #fffefa;
  stroke: rgba(32, 37, 31, 0.12);
  stroke-width: 1.4;
  transform: rotate(-2deg);
  transform-origin: center;
}

.empty-window {
  fill: url("#emptySky");
  stroke: rgba(32, 37, 31, 0.08);
  stroke-width: 1.2;
  transform: rotate(-2deg);
  transform-origin: center;
}

.empty-horizon {
  fill: url("#emptyGround");
  opacity: 0.82;
  transform: rotate(-2deg);
  transform-origin: center;
}

.empty-sun {
  fill: #d9a85f;
  opacity: 0.82;
  transform: rotate(-2deg);
  transform-origin: center;
}

.empty-note {
  fill: rgba(255, 255, 251, 0.94);
  stroke: rgba(32, 37, 31, 0.12);
  stroke-width: 1.4;
  filter: drop-shadow(0 10px 18px rgba(35, 45, 36, 0.08));
}

.empty-note-line {
  fill: none;
  stroke: rgba(85, 95, 98, 0.5);
  stroke-linecap: round;
  stroke-width: 3;
}

.empty-note-line.short {
  stroke: rgba(141, 111, 82, 0.42);
}

.empty-pin {
  fill: #555f62;
}

.empty-pin-mark {
  fill: none;
  stroke: #fffefa;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

.empty-spark {
  fill: none;
  stroke: rgba(141, 111, 82, 0.34);
  stroke-linecap: round;
  stroke-width: 2;
}

.empty-spark.two {
  stroke: rgba(85, 95, 98, 0.28);
}

.empty-copy {
  display: grid;
  gap: 8px;
}

.empty h2 {
  margin: 0;
  font-size: 17px;
  line-height: 1.25;
}

.empty p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

@media (prefers-reduced-motion: no-preference) {
  .empty-art svg {
    animation: empty-float 7s ease-in-out infinite;
  }

  .empty-spark {
    animation: empty-twinkle 3.8s ease-in-out infinite;
  }

  .empty-spark.two {
    animation-delay: 1.1s;
  }

  .empty-spark.three {
    animation-delay: 2s;
  }
}

@keyframes empty-float {
  0%,
  100% {
    transform: translateY(0) rotate(0deg);
  }

  50% {
    transform: translateY(-4px) rotate(0.6deg);
  }
}

@keyframes empty-twinkle {
  0%,
  100% {
    opacity: 0.32;
  }

  50% {
    opacity: 0.86;
  }
}

.date-group {
  margin-bottom: 22px;
}

.date-group + .date-group {
  margin-top: 24px;
}

.date-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin: 0 2px 10px;
}

.date-header strong {
  display: block;
  font-size: 14px;
  line-height: 1.2;
}

.date-header span {
  display: block;
  margin-top: 4px;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.35;
}

.fragment {
  position: relative;
  padding: 14px 14px 13px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 251, 0.82);
  box-shadow: 0 8px 24px rgba(35, 45, 36, 0.05);
}

.fragment + .fragment {
  margin-top: 10px;
}

.fragment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.35;
}

.fragment-more {
  display: grid;
  width: 26px;
  height: 22px;
  place-items: center;
  border-radius: 9px;
  color: var(--quiet);
  background: transparent;
  font-size: 16px;
  line-height: 1;
  letter-spacing: 1px;
}

.fragment-more:hover,
.fragment-more[aria-expanded="true"] {
  color: var(--ink);
  background: var(--surface-2);
}

.fragment-menu {
  position: absolute;
  top: 36px;
  right: 12px;
  z-index: 8;
  min-width: 96px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 251, 0.96);
  box-shadow: 0 14px 36px rgba(35, 45, 36, 0.14);
  backdrop-filter: blur(16px);
}

.fragment-menu button {
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 10px;
  color: var(--danger);
  background: transparent;
  font-size: 13px;
  font-weight: 650;
  text-align: left;
}

.fragment-menu button:hover {
  background: rgba(155, 78, 63, 0.1);
}

.fragment-content {
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
  font-weight: 450;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.clamp-text {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
}

.clamp-text.lines-5 {
  -webkit-line-clamp: 5;
}

.clamp-text.lines-4 {
  -webkit-line-clamp: 4;
}

.clamp-text.lines-2 {
  -webkit-line-clamp: 2;
}

.expand-fragment {
  margin-top: 8px;
  padding: 0;
  color: var(--blue);
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}

.image-grid {
  display: grid;
  gap: 4px;
  width: 100%;
  max-height: 320px;
  overflow: hidden;
  border-radius: 14px;
  background: var(--surface-2);
}

.image-grid.count-1 {
  display: block;
}

.image-grid.count-2 {
  grid-template-columns: repeat(2, 1fr);
  aspect-ratio: 16 / 9;
  max-height: 260px;
}

.image-grid.count-3,
.image-grid.count-4 {
  grid-template-columns: repeat(2, 1fr);
  aspect-ratio: 1.35 / 1;
  max-height: 260px;
}

.image-grid.count-3 .image-tile:first-child {
  grid-row: span 2;
}

.image-tile {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  place-items: center;
  background: var(--surface-2);
  cursor: zoom-in;
  text-align: left;
}

.image-tile:focus-visible {
  outline: 2px solid rgba(85, 101, 112, 0.5);
  outline-offset: -2px;
}

.image-tile img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-grid.count-1 .image-tile {
  max-height: 320px;
}

.image-grid.count-1 .image-tile img {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 320px;
  object-fit: contain;
}

.image-tile span {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: var(--surface);
  background: rgba(32, 37, 31, 0.46);
  font-size: 22px;
  font-weight: 760;
}

.image-caption {
  margin-top: 10px;
  color: var(--muted);
}

.voice-card {
  display: grid;
  gap: 12px;
}

.source-icon {
  flex: 0 0 auto;
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-2);
  color: var(--clay);
  font-size: 16px;
  font-weight: 760;
}

.voice-primary {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 7px 9px;
  border: 1px solid rgba(138, 104, 70, 0.14);
  border-radius: 14px;
  background: rgba(255, 249, 236, 0.66);
}

.voice-primary audio {
  display: none;
}

.voice-summary {
  display: grid;
  min-width: 0;
  gap: 2px;
}

.voice-summary strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 720;
  line-height: 1.2;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.voice-transcript-copy {
  margin: 0;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.35;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.voice-progress {
  width: 100%;
  height: 4px;
  overflow: hidden;
  border: 0;
  border-radius: 999px;
  background: rgba(138, 104, 70, 0.12);
  appearance: none;
}

.voice-progress::-webkit-progress-bar {
  border-radius: inherit;
  background: rgba(138, 104, 70, 0.12);
}

.voice-progress::-webkit-progress-value {
  border-radius: inherit;
  background: rgba(138, 104, 70, 0.58);
}

.voice-progress::-moz-progress-bar {
  border-radius: inherit;
  background: rgba(138, 104, 70, 0.58);
}

.voice-transcript-note {
  padding: 9px 10px;
  border-radius: 12px;
  background: rgba(238, 238, 235, 0.58);
}

.voice-transcript-note p {
  margin: 0;
  color: var(--muted);
}

.voice-transcript-note.pending p {
  color: var(--quiet);
}

.voice-transcript-note.failed p {
  color: var(--danger);
}

.voice-play {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 11px;
  color: var(--surface);
  background: var(--moss);
}

.voice-play:disabled {
  color: var(--quiet);
  background: var(--surface-2);
  cursor: default;
}

.voice-play.playing {
  background: var(--clay);
}

.capture-dock {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 10;
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 7px;
  width: min(calc(100vw - 40px), 390px);
  height: 52px;
  padding: 7px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(255, 255, 251, 0.92);
  box-shadow: 0 14px 34px rgba(35, 45, 36, 0.11);
  backdrop-filter: blur(18px);
}

@media (min-width: 720px) {
  .capture-dock {
    width: min(390px, calc(100vw - 96px));
    bottom: 40px;
  }
}

.dock-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-width: 0;
  height: 38px;
  padding: 0 8px 0 12px;
  border-radius: 14px;
  background: rgba(232, 237, 228, 0.72);
  color: var(--quiet);
  text-align: left;
}

.dock-field input {
  width: 100%;
  min-width: 0;
  padding: 0;
  overflow: hidden;
  border: 0;
  outline: 0;
  color: var(--quiet);
  background: transparent;
  font-size: 13px;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-field input:focus {
  color: var(--ink);
}

.dock-field input::placeholder {
  color: var(--quiet);
}

.capture-dock.recording .dock-field {
  gap: 10px;
  border: 1px solid rgba(155, 78, 63, 0.16);
  background: rgba(255, 255, 251, 0.76);
}

.capture-dock.recording .dock-field input {
  color: var(--ink);
  font-weight: 650;
}

.recording-indicator {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 7px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 680;
  white-space: nowrap;
}

.recording-indicator[hidden],
.recording-meter[hidden] {
  display: none !important;
}

.recording-dot {
  position: relative;
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--danger);
}

.recording-dot::after {
  position: absolute;
  inset: -5px;
  content: "";
  border-radius: inherit;
  background: rgba(155, 78, 63, 0.14);
  animation: recordingPulse 1.45s ease-out infinite;
}

.recording-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.recording-time {
  min-width: 34px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.recording-meter {
  display: inline-grid;
  grid-template-columns: repeat(4, 4px);
  align-items: center;
  gap: 3px;
  height: 24px;
  margin-left: auto;
}

.meter-bar {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: rgba(155, 78, 63, 0.34);
  animation: recordingMeter 900ms ease-in-out infinite;
}

.meter-bar:nth-child(2) {
  height: 15px;
  animation-delay: 120ms;
}

.meter-bar:nth-child(3) {
  height: 20px;
  animation-delay: 240ms;
}

.meter-bar:nth-child(4) {
  height: 12px;
  animation-delay: 360ms;
}

.capture-dock.recording .send-button {
  color: var(--surface);
  background: var(--danger);
}

.dock-tools {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding-left: 8px;
}

.dock-tool {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 10px;
  background: transparent;
  color: var(--muted);
  font-size: 14px;
  font-weight: 760;
}

.dock-tool svg,
.send-button svg,
.input-tool svg,
.voice-play svg,
.source-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.dock-tool.image {
  color: var(--blue);
}

.dock-tool.voice {
  color: var(--clay);
}

.dock-tool.recording {
  color: var(--danger);
  background: rgba(155, 78, 63, 0.12);
}

@keyframes recordingPulse {
  0% {
    opacity: 0.9;
    transform: scale(0.7);
  }
  100% {
    opacity: 0;
    transform: scale(1.75);
  }
}

@keyframes recordingMeter {
  0%, 100% {
    transform: scaleY(0.56);
  }
  50% {
    transform: scaleY(1);
  }
}

.send-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 14px;
  color: var(--surface);
  background: var(--moss);
  font-size: 18px;
  font-weight: 820;
}

.send-button svg {
  width: 21px;
  height: 21px;
  stroke-width: 2.4;
}

.send-button:disabled {
  opacity: 0.44;
  cursor: default;
}

.input-surface,
.backup-surface,
.answer-surface {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
}

.review-surface {
  margin-top: 2px;
  padding: 8px 0 4px;
}

.question-recap {
  margin-bottom: 12px;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 251, 0.72);
}

.question-recap span {
  display: block;
  margin-bottom: 5px;
  color: var(--quiet);
  font-size: 12px;
  font-weight: 620;
}

.question-recap p {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
  font-weight: 620;
}

.input-surface h2,
.backup-surface h2,
.answer-surface h2 {
  margin: 0 0 10px;
  font-size: 20px;
  line-height: 1.18;
  letter-spacing: 0;
}

.question-composer {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 251, 0.78);
}

.input-surface textarea,
.review-surface textarea {
  width: 100%;
  min-height: 154px;
  margin-top: 14px;
  padding: 0;
  resize: none;
  border: 0;
  outline: 0;
  color: var(--ink);
  background: transparent;
  font-size: 18px;
  line-height: 1.38;
  font-weight: 600;
}

.review-surface textarea {
  min-height: 54px;
  margin-top: 0;
  padding: 0;
  font-size: 15px;
  line-height: 1.45;
  font-weight: 560;
}

.input-surface textarea {
  min-height: 276px;
  font-size: 17px;
  font-weight: 540;
}

.input-surface textarea::placeholder,
.review-surface textarea::placeholder {
  color: rgba(32, 37, 31, 0.32);
}

.input-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.input-tool {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--ink);
  background: var(--surface-2);
  text-align: left;
}

.input-tool b {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  margin-bottom: 8px;
  color: inherit;
}

.input-tool span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.action-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 18px;
}

.review-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 10px;
  padding-top: 0;
  border-top: 0;
}

.review-actions .primary-button {
  min-width: 88px;
  min-height: 36px;
  border-radius: 12px;
  font-size: 13px;
}

.backup-actions {
  display: grid;
  gap: 10px;
  margin-top: 8px;
}

.backup-actions .primary-button,
.backup-actions .quiet-button {
  width: 100%;
}

.backup-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.review-history {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.review-history h3 {
  margin: 0 0 10px;
  color: var(--quiet);
  font-size: 12px;
  line-height: 1;
  font-weight: 680;
}

.review-history-list {
  display: grid;
  gap: 8px;
}

.review-history-list button {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 10px;
  min-height: 44px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(32, 37, 31, 0.08);
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.review-history-list span {
  color: var(--quiet);
  font-size: 12px;
  line-height: 1.35;
  font-weight: 560;
}

.review-history-list strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  line-height: 1.35;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.primary-button {
  min-height: 48px;
  border-radius: 16px;
  color: var(--surface);
  background: var(--moss);
  font-size: 13px;
  font-weight: 680;
}

.answer-thread {
  display: grid;
  gap: 14px;
  min-width: 0;
}

.message-label {
  margin-bottom: 6px;
  color: var(--quiet);
  font-size: 11.5px;
  font-weight: 620;
}

.user-message {
  justify-self: end;
  width: min(316px, 86%);
}

.user-bubble {
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 18px 18px 6px 18px;
  background: var(--surface);
  font-size: 15px;
  line-height: 1.45;
  font-weight: 620;
}

.assistant-message {
  width: 100%;
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 251, 0.74);
}

.answer-copy {
  display: grid;
  gap: 13px;
  min-width: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.answer-copy li {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
}

.answer-copy b {
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 650;
}

.answer-copy p {
  min-width: 0;
  margin: 0;
  color: var(--muted);
  font-size: 13.5px;
  line-height: 1.62;
  font-weight: 430;
  overflow-wrap: anywhere;
}

.answer-copy strong {
  display: block;
  margin-bottom: 4px;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.4;
  font-weight: 660;
}

.cite {
  display: inline-grid;
  width: 18px;
  height: 18px;
  margin-left: 3px;
  transform: translateY(-1px);
  place-items: center;
  border-radius: 999px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 650;
}

.source-index {
  min-width: 0;
  margin-top: 16px;
  padding-top: 13px;
  border-top: 1px solid rgba(32, 37, 31, 0.08);
}

.source-index h2 {
  margin: 0 0 10px;
  color: var(--quiet);
  font-size: 11.5px;
  line-height: 1;
  font-weight: 620;
}

.empty-source {
  margin: 0;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
}

.source-list {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.source-item {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  width: 100%;
  min-width: 0;
  min-height: 50px;
  padding: 9px 10px;
  border: 1px solid rgba(32, 37, 31, 0.08);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 251, 0.58);
  text-align: left;
}

.source-item > span {
  min-width: 0;
}

.source-item .num {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 7px;
  color: var(--muted);
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 650;
}

.source-item strong {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  font-size: 13px;
  line-height: 1.34;
  font-weight: 640;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-meta {
  display: block;
  min-width: 0;
  overflow: hidden;
  color: var(--quiet);
  font-size: 11.5px;
  line-height: 1.25;
  font-weight: 520;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.follow-up {
  position: fixed;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 12;
  display: grid;
  grid-template-columns: 1fr 38px;
  gap: 7px;
  width: min(calc(100vw - 40px), 390px);
  height: 52px;
  margin: 0;
  padding: 7px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 19px;
  background: rgba(255, 255, 251, 0.92);
  box-shadow: 0 14px 34px rgba(35, 45, 36, 0.11);
  backdrop-filter: blur(18px);
}

@media (min-width: 720px) {
  .follow-up {
    width: min(390px, calc(100vw - 96px));
    bottom: 40px;
  }
}

.follow-up input {
  min-width: 0;
  height: 38px;
  padding: 0 12px;
  border: 0;
  outline: 0;
  border-radius: 14px;
  color: var(--ink);
  background: rgba(232, 237, 228, 0.72);
  font-size: 13px;
}

.follow-up input::placeholder {
  color: var(--quiet);
}

@media (max-width: 480px) {
  .topbar {
    padding: 22px 16px 10px;
  }

  .top-actions {
    flex-shrink: 0;
  }

  .page {
    padding: 0 16px 118px;
  }

  .app-frame.answering .page {
    padding-bottom: 92px;
  }

  .answer-thread {
    gap: 12px;
  }

  .user-message {
    width: min(304px, 88%);
  }

  .assistant-message {
    padding: 14px;
    border-radius: 18px;
  }

  .answer-copy {
    gap: 12px;
  }

  .answer-copy li {
    grid-template-columns: 18px minmax(0, 1fr);
    gap: 8px;
  }

  .answer-copy b {
    width: 18px;
    height: 18px;
    border-radius: 6px;
  }

  .answer-copy strong {
    font-size: 13.5px;
  }

  .answer-copy p {
    font-size: 13px;
    line-height: 1.58;
  }

  .source-index {
    margin-top: 14px;
    padding-top: 12px;
  }

  .source-item {
    padding: 9px;
  }

  .follow-up {
    width: min(calc(100vw - 32px), 398px);
    bottom: max(10px, env(safe-area-inset-bottom));
  }
}

.record-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(32, 37, 31, 0.18);
}

.record-card {
  width: min(calc(100vw - 48px), 390px);
  max-height: min(72dvh, 620px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: 0 16px 50px rgba(48, 39, 25, 0.18);
}

.image-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  background: rgba(10, 12, 11, 0.9);
  backdrop-filter: blur(10px);
}

.image-preview-card {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 14px;
  width: min(100%, 980px);
  height: min(100%, 760px);
  justify-self: center;
  align-self: center;
  color: rgba(255, 255, 250, 0.92);
}

.image-preview-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 40px;
  color: rgba(255, 255, 250, 0.74);
  font-size: 13px;
  font-weight: 650;
}

.image-preview-close {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  color: rgba(255, 255, 250, 0.94);
  background: rgba(255, 255, 255, 0.12);
}

.image-preview-close:hover {
  background: rgba(255, 255, 255, 0.18);
}

.image-preview-close svg {
  width: 17px;
  height: 17px;
  stroke: currentColor;
  stroke-width: 2.4;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.image-preview-stage {
  position: relative;
  display: grid;
  min-height: 0;
  place-items: center;
}

.image-preview-stage > img {
  display: block;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.image-preview-nav {
  position: absolute;
  top: 50%;
  display: grid;
  width: 42px;
  height: 42px;
  transform: translateY(-50%);
  place-items: center;
  border-radius: 999px;
  color: rgba(255, 255, 250, 0.94);
  background: rgba(255, 255, 255, 0.12);
  font-size: 30px;
  line-height: 1;
}

.image-preview-nav:hover {
  background: rgba(255, 255, 255, 0.18);
}

.image-preview-nav.prev {
  left: 0;
}

.image-preview-nav.next {
  right: 0;
}

.image-preview-thumbs {
  display: flex;
  gap: 8px;
  max-width: 100%;
  min-height: 58px;
  overflow-x: auto;
  padding: 4px 0;
}

.image-preview-thumb {
  flex: 0 0 auto;
  width: 52px;
  height: 52px;
  padding: 0;
  border: 2px solid transparent;
  overflow: hidden;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  opacity: 0.58;
}

.image-preview-thumb.active {
  border-color: rgba(255, 255, 250, 0.92);
  opacity: 1;
}

.image-preview-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.record-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--quiet);
  font-size: 12px;
  font-weight: 650;
}

.record-close {
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.record-card p {
  margin: 0;
  font-size: 15px;
  line-height: 1.55;
  font-weight: 620;
}

.record-card audio {
  width: 100%;
  margin-top: 12px;
}

.record-card small {
  display: block;
  margin-top: 6px;
  color: var(--quiet);
  font-size: 12px;
}

.delete-modal {
  position: fixed;
  inset: 0;
  z-index: 45;
  display: grid;
  padding: 24px;
  place-items: center;
  background: rgba(32, 37, 31, 0.18);
}

.delete-card {
  width: min(calc(100vw - 56px), 340px);
  max-height: min(72dvh, 560px);
  overflow: auto;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: 0 18px 54px rgba(48, 39, 25, 0.18);
}

.delete-card h2 {
  margin: 0 0 7px;
  font-size: 17px;
  line-height: 1.3;
}

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

.delete-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 16px;
}

.danger-button {
  min-height: 38px;
  border-radius: 14px;
  color: var(--surface);
  background: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 78px;
  z-index: 20;
  max-width: min(calc(100vw - 40px), 390px);
  padding: 10px 13px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--ink);
  background: rgba(255, 255, 251, 0.94);
  box-shadow: 0 10px 28px rgba(48, 39, 25, 0.12);
  font-size: 12px;
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.drop-catcher {
  position: absolute;
  inset: 14px;
  z-index: 30;
  display: none;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed rgba(80, 104, 82, 0.42);
  border-radius: 24px;
  color: var(--moss);
  background: rgba(238, 244, 234, 0.86);
  text-align: center;
  backdrop-filter: blur(12px);
}

.drop-catcher strong {
  font-size: 20px;
  line-height: 1.2;
}

.drop-catcher span {
  max-width: 260px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.app-frame.dragging .drop-catcher {
  display: grid;
}
