:root {
  --ink: #1a2332;
  --soft: #5a6675;
  --faint: #7a8797;
  --blue:#3391ff;
  --blue-deep: #1a7ae6;
  --blue-bg: #eef6ff;
  --green: #15803d;
  --green-bg: #e6f6ec;
  --green-border: #b9e5c8;
  --amber: #9a6300;
  --amber-bg: #fdf3e0;
  --amber-border: #efd39c;
  --red: #c20002;
  --red-bg: #fdecec;
  --red-border: #f2c4c5;
  --top-surface: #f3f5f7;
  --row: #f5f7fa;
  --row-border: #e2e8f0;
  --divider: #eef1f6;
  --font: "Roboto", Arial, sans-serif;
  --phone-width: 452px;
  --phone-height: 904px;
}

html[data-animation-size="large"] {
  --phone-height: 840px;
}

* {
  box-sizing: border-box;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

html,
body {
  margin: 0;
}

body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: transparent;
  font-family: var(--font);
}

html[data-animation-size="large"] body {
  padding-block: 8px;
}

button {
  font: inherit;
}

.stage {
  width: 100%;
  max-width: 560px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.scale-outer {
  width: 100%;
  display: flex;
  justify-content: center;
  overflow: hidden;
}

.scale-wrap {
  transform-origin: top center;
  will-change: transform;
}

.phone {
  width: var(--phone-width);
  height: var(--phone-height);
  padding: 14px;
  position: relative;
  overflow: hidden;
  border-radius: 54px;
  background: var(--ink);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .04);
}

.phone::after {
  content: "";
  position: absolute;
  right: -3px;
  top: 200px;
  width: 3px;
  height: 84px;
  border-radius: 3px;
  background: #10161e;
}

.screen {
  width: 100%;
  height: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 42px;
  background: #ffffff;
}

.statusbar {
  height: 50px;
  flex: 0 0 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 30px 0;
  background: var(--top-surface);
  color: var(--ink);
}

.statusbar-time {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: .2px;
}

.statusbar-icons {
  display: flex;
  align-items: center;
  gap: 7px;
}

.statusbar-icons svg {
  display: block;
}

.appbar {
  min-height: 70px;
  flex: 0 0 70px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 22px 12px;
  border-bottom: 1px solid var(--divider);
  background: var(--top-surface);
}

.avatar {
  display: block;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border-radius: 50%;
  object-fit: cover;
  box-shadow: 0 4px 12px -4px rgba(37, 99, 235, .5);
}

.identity {
  min-width: 0;
  display: flex;
  flex: 1;
  flex-direction: column;
  line-height: 1.2;
}

.identity-name {
  font-size: 19px;
  font-weight: 700;
  color: var(--ink);
}

.identity-role {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 1px;
  font-size: 11px;
  color: var(--soft);
}

.online-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #41bf21;
}

.app-label {
  flex: 0 0 auto;
  max-width: 132px;
  overflow: hidden;
  padding: 5px 9px;
  border-radius: 8px;
  background: var(--blue-bg);
  color: var(--blue-deep);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: .55px;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.chat {
  min-height: 0;
  flex: 1 1 auto;
  position: relative;
  overflow: hidden;
}

.chat-inner {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px 18px 22px;
  transition: transform .55s cubic-bezier(.22, .61, .36, 1);
}

.reveal {
  opacity: 0;
  transform: translateY(10px);
  transition: opacity .42s ease, transform .42s cubic-bezier(.22, .61, .36, 1);
}

.reveal.show {
  opacity: 1;
  transform: none;
}

.user {
  align-self: flex-end;
  max-width: 87%;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.question {
  min-height: 1em;
  padding: 13px 16px;
  border-radius: 20px 20px 6px 20px;
  background: var(--blue);
  color: #ffffff;
  box-shadow: 0 8px 18px -8px rgba(37, 99, 235, .5);
  font-size: 17px;
  font-weight: 500;
  line-height: 1.42;
  white-space: pre-wrap;
}

.prompt-attachment {
  width: min(100%, 340px);
  margin-top: 7px;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border: 1px solid #c9ddf7;
  border-radius: 12px 12px 5px 12px;
  background: #ffffff;
  box-shadow: 0 8px 18px -12px rgba(20, 30, 50, .42);
}

.prompt-attachment-icon {
  position: relative;
  width: 38px;
  height: 42px;
  display: grid;
  place-items: center;
  color: var(--blue-deep);
}

.prompt-attachment-icon svg {
  width: 32px;
  height: 36px;
}

.prompt-attachment-icon span {
  position: absolute;
  inset: auto 2px 2px;
  padding: 2px 3px;
  border-radius: 4px;
  background: var(--blue-deep);
  color: #ffffff;
  font-size: 7px;
  font-weight: 900;
  letter-spacing: .4px;
  line-height: 1;
  text-align: center;
}

.prompt-attachment-copy {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.prompt-attachment-copy strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.prompt-attachment-copy small {
  color: var(--faint);
  font-size: 9px;
  font-weight: 500;
  line-height: 1.2;
}

.prompt-attachment-state {
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: var(--blue-deep);
  font-size: 8px;
  font-weight: 900;
  letter-spacing: .16px;
  line-height: 1;
  text-transform: uppercase;
}

.lead {
  font-size: 16px;
  line-height: 1.48;
  color: var(--ink);
}

.evidence-preview {
  align-self: flex-end;
  width: min(80%, 304px);
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--row-border);
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 10px 22px -14px rgba(20, 30, 50, .42);
}

.evidence-preview img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 252 / 139;
  object-fit: cover;
}

.evidence-preview figcaption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  padding: 8px 9px;
  border-top: 1px solid var(--row-border);
}

.evidence-preview-label {
  color: var(--ink);
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.evidence-preview-status {
  flex: 0 0 auto;
  padding: 4px 6px;
  border-radius: 999px;
  background: var(--amber-bg);
  color: var(--amber);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: .18px;
  line-height: 1;
  text-transform: uppercase;
}

.status-list {
  display: flex;
  flex-direction: column;
  gap: 9px;
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 50px;
  padding: 10px 11px;
  border: 1px solid var(--row-border);
  border-radius: 13px;
  background: var(--row);
}

.status-icon {
  width: 21px;
  height: 21px;
  flex: 0 0 21px;
  display: grid;
  place-items: center;
  color: var(--soft);
}

.status-icon svg {
  width: 21px;
  height: 21px;
}

.status-label {
  min-width: 0;
  flex: 1;
  font-size: 14px;
  line-height: 1.28;
  color: var(--ink);
}

.status-state {
  min-width: 80px;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2.4px solid #d7deea;
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.context-status {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border: 1px solid var(--green-border);
  border-radius: 8px;
  background: var(--green-bg);
  color: var(--green);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  white-space: nowrap;
}

.context-status[data-tone="info"] {
  border-color: #c9ddf7;
  background: var(--blue-bg);
  color: var(--blue-deep);
}

.context-status[data-tone="caution"] {
  border-color: var(--amber-border);
  background: var(--amber-bg);
  color: var(--amber);
}

.context-status[data-tone="blocked"] {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: var(--red);
}

.context-status svg {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
}

.status-row.complete .spinner {
  display: none;
}

.status-row.complete .context-status {
  display: inline-flex;
}

.answer-card {
  overflow: hidden;
  border: 1px solid var(--row-border);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: 0 12px 28px -18px rgba(30, 45, 70, .3);
}

.answer-head {
  padding: 16px 17px 13px;
}

.answer-kicker {
  margin-bottom: 5px;
  color: var(--blue-deep);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .7px;
  text-transform: uppercase;
}

.answer-title {
  color: var(--ink);
  font-size: 23px;
  font-weight: 900;
  line-height: 1.12;
  letter-spacing: -.35px;
}

.answer-sub {
  margin-top: 6px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.42;
}

.answer-section {
  padding: 12px 17px;
  border-top: 1px solid var(--divider);
}

.section-title {
  margin-bottom: 7px;
  color: var(--blue-deep);
  font-size: 14px;
  font-weight: 700;
}

.summary-box {
  padding: 11px 12px;
  border: 1px solid var(--row-border);
  border-radius: 11px;
  background: var(--row);
  color: var(--ink);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.45;
}

.summary-box[data-tone="caution"] {
  border-color: var(--amber-border);
  background: var(--amber-bg);
  color: #704a08;
}

.summary-box[data-tone="blocked"] {
  border-color: var(--red-border);
  background: var(--red-bg);
  color: #7d2021;
}

.summary-box strong {
  font-weight: 900;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.metric {
  padding: 9px 10px;
  border: 1px solid var(--row-border);
  border-radius: 10px;
  background: var(--row);
}

.metric-value {
  color: var(--ink);
  font-size: 20px;
  font-weight: 900;
  line-height: 1.05;
}

.metric-value[data-tone="caution"] {
  color: var(--amber);
}

.metric-value[data-tone="blocked"] {
  color: var(--red);
}

.metric-label {
  margin-top: 4px;
  color: var(--soft);
  font-size: 10px;
  font-weight: 500;
  line-height: 1.3;
}

.evidence-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.evidence-row {
  display: grid;
  grid-template-columns: minmax(86px, .78fr) minmax(0, 1.5fr);
  gap: 9px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--divider);
  font-size: 12px;
  line-height: 1.4;
}

.evidence-row:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.evidence-label {
  color: var(--ink);
  font-weight: 700;
}

.evidence-detail {
  color: var(--soft);
}

.answer-section .evidence-list + .summary-box {
  margin-top: 10px;
}

.compact-list {
  margin: 0;
  padding-left: 18px;
  color: var(--soft);
  font-size: 12px;
  line-height: 1.45;
}

.compact-list li + li {
  margin-top: 4px;
}

.source-receipt,
.review-note {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 10px 11px;
  border-radius: 11px;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.42;
}

.source-receipt {
  border: 1px solid var(--amber-border);
  background: var(--amber-bg);
  color: #704a08;
}

.review-note {
  border: 1px solid var(--row-border);
  background: var(--row);
  color: var(--soft);
}

.source-receipt svg,
.review-note svg {
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  margin-top: 1px;
}

.source-receipt svg {
  color: var(--amber);
}

.review-note svg {
  color: var(--red);
}

.source-receipt strong {
  color: var(--amber);
  font-weight: 900;
}

.review-note strong {
  color: var(--ink);
  font-weight: 900;
}

.cta {
  position: relative;
  overflow: hidden;
  padding: 13px 14px 13px 16px;
  border-radius: 12px;
  background: var(--green-bg);
}

.cta::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 5px;
  background: #41bf21;
}

.cta[data-tone="caution"] {
  background: var(--amber-bg);
}

.cta[data-tone="caution"]::before {
  background: var(--amber);
}

.cta-text {
  min-height: 1em;
  color: var(--green);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.4;
  white-space: pre-wrap;
}

.cta[data-tone="caution"] .cta-text {
  color: var(--amber);
}

.caret::after {
  content: "";
  display: inline-block;
  width: 2px;
  height: 1.05em;
  margin-left: 1.5px;
  vertical-align: -2px;
  background: currentColor;
  animation: blink 1s steps(1) infinite;
}

.replay {
  margin-top: 14px;
  padding: 7px 12px;
  border: 1px solid var(--row-border);
  border-radius: 999px;
  background: #ffffff;
  color: var(--soft);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

html[data-animation-size="large"] .replay {
  margin-top: 8px;
}

.replay:hover {
  border-color: var(--blue);
  color: var(--blue-deep);
}

.replay:focus-visible {
  outline: 3px solid rgba(51, 145, 255, .32);
  outline-offset: 3px;
}

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

@keyframes blink {
  50% { opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .reveal {
    opacity: 1;
    transform: none;
    transition: none;
  }

  .chat-inner {
    transition: none;
  }

  .spinner,
  .caret::after {
    animation: none;
  }
}
