:root {
  color-scheme: light;
  --bg-top: #fbfaf6;
  --bg-bottom: #f3f8f6;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: #ffffff;
  --surface-soft: rgba(245, 251, 248, 0.86);
  --ink: #10212b;
  --muted: #4f6470;
  --line: rgba(24, 78, 119, 0.14);
  --accent: #1a759f;
  --accent-deep: #184e77;
  --accent-soft: rgba(26, 117, 159, 0.12);
  --success: #76c893;
  --highlight: #d9ed92;
  --assistant-bubble: #f8fbff;
  --user-bubble: #184e77;
  --shadow: 0 24px 60px rgba(24, 78, 119, 0.14);
  --radius-xl: 2px;
  --radius-lg: 2px;
  --radius-md: 2px;
  --mobile-width: 860px;
  --composer-textarea-base-height: 52px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  height: 100%;
  overflow: hidden;
  overscroll-behavior: none;
}

body {
  position: relative;
  background:
    radial-gradient(circle at top left, rgba(217, 237, 146, 0.14), transparent 28%),
    radial-gradient(circle at 82% 14%, rgba(26, 117, 159, 0.08), transparent 24%),
    linear-gradient(180deg, var(--bg-top) 0%, var(--bg-bottom) 100%);
  color: var(--ink);
  font-family: "Plus Jakarta Sans", "Avenir Next", "Segoe UI", sans-serif;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  display: none;
  will-change: transform;
}

body::before {
  top: -12vw;
  left: -10vw;
  width: 42vw;
  height: 42vw;
  background: radial-gradient(
    circle,
    rgba(217, 237, 146, 0.22) 0%,
    rgba(118, 200, 147, 0.16) 42%,
    transparent 74%
  );
  filter: blur(14px);
}

body::after {
  right: -8vw;
  bottom: -14vw;
  width: 36vw;
  height: 36vw;
  background: radial-gradient(
    circle,
    rgba(26, 117, 159, 0.2) 0%,
    rgba(24, 78, 119, 0.14) 44%,
    transparent 76%
  );
  filter: blur(18px);
}

button,
textarea {
  font: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  height: 100dvh;
  overflow: hidden;
  overscroll-behavior: none;
  padding:
    max(0px, env(safe-area-inset-top))
    0
    max(0px, env(safe-area-inset-bottom))
    0;
}

html.ios-safari .page-shell {
  min-height: 100svh;
  height: 100svh;
}

.page-shell::before,
.page-shell::after {
  content: "";
  position: fixed;
  pointer-events: none;
  opacity: 0;
  z-index: 0;
  display: none;
  will-change: transform;
}

.page-shell::before {
  top: -10vw;
  right: -9vw;
  width: 34vw;
  height: 34vw;
  background: radial-gradient(
    circle,
    rgba(217, 237, 146, 0.18) 0%,
    rgba(118, 200, 147, 0.13) 42%,
    transparent 74%
  );
  filter: blur(16px);
}

.page-shell::after {
  left: -9vw;
  bottom: -12vw;
  width: 32vw;
  height: 32vw;
  background: radial-gradient(
    circle,
    rgba(26, 117, 159, 0.16) 0%,
    rgba(24, 78, 119, 0.12) 44%,
    transparent 76%
  );
  filter: blur(18px);
}

.app-frame {
  position: relative;
  z-index: 2;
  width: 100%;
  min-height: 100%;
  height: 100%;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid transparent;
  overflow: hidden;
  animation: rise 360ms ease-out;
}

.app-header {
  padding: 16px 20px 16px;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  align-items: start;
  border-bottom: 1px solid var(--line);
}

.identity-mark {
  width: 50px;
  height: 50px;
  border-radius: 2px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #ffffff;
  border: 1px solid rgba(24, 78, 119, 0.12);
  box-shadow: 0 8px 18px rgba(24, 78, 119, 0.08);
}

.identity-photo {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  object-position: center 24%;
  transition: opacity 180ms ease;
}

.identity-link {
  text-decoration: none;
}

.identity-link:hover .identity-photo,
.identity-link:focus-visible .identity-photo {
  opacity: 0.82;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent-deep);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.72rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.header-copy h1 {
  margin: 0;
  font-size: 1.24rem;
  line-height: 1.06;
  letter-spacing: -0.02em;
}

.name-link {
  color: inherit;
  text-decoration: none;
  text-underline-offset: 0.14em;
  text-decoration-thickness: 1.5px;
  display: inline-flex;
  align-items: center;
}

.name-link:hover,
.name-link:focus-visible {
  color: inherit;
  text-decoration: underline;
}

.name-signature {
  display: block;
  width: clamp(180px, 30vw, 250px);
  max-width: 100%;
  height: auto;
  max-height: 40px;
  transition: opacity 180ms ease;
}

.name-link:hover .name-signature,
.name-link:focus-visible .name-signature {
  opacity: 0.82;
}

.header-links {
  margin-top: 7px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  align-items: center;
}

.header-link {
  color: var(--accent-deep);
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.78rem;
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

.header-link:hover,
.header-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
  text-decoration-thickness: 1.5px;
}

.chat-log {
  padding: 14px 20px 18px;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 15px;
  overflow-y: auto;
  overscroll-behavior-y: contain;
  overscroll-behavior-x: none;
  -webkit-overflow-scrolling: touch;
  scroll-behavior: smooth;
}

html.ios-safari .chat-log {
  -webkit-overflow-scrolling: auto;
  scroll-behavior: auto;
}

.message-row {
  display: flex;
}

.message-row.assistant {
  justify-content: flex-start;
}

.message-row.user {
  justify-content: flex-end;
}

.message-bubble {
  max-width: 88%;
  padding: 14px 15px;
  border-radius: var(--radius-md);
  font-size: 0.96rem;
  line-height: 1.6;
  letter-spacing: -0.01em;
  word-wrap: break-word;
  box-shadow: 0 10px 24px rgba(24, 78, 119, 0.08);
}

.message-bubble > :first-child {
  margin-top: 0;
}

.message-bubble > :last-child {
  margin-bottom: 0;
}

.message-bubble p,
.message-bubble ul,
.message-bubble ol,
.message-bubble pre,
.message-bubble blockquote,
.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
  margin: 0 0 0.72em;
}

.message-bubble ul,
.message-bubble ol {
  padding-left: 1.2em;
}

.message-bubble li > ul,
.message-bubble li > ol {
  margin-top: 0.4em;
}

.message-bubble li + li {
  margin-top: 0.32em;
}

.message-bubble a {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.18em;
}

.message-bubble code {
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.9em;
  background: rgba(24, 78, 119, 0.08);
  border-radius: 2px;
  padding: 0.12em 0.36em;
}

.message-bubble pre {
  overflow-x: auto;
  padding: 12px;
  border-radius: 2px;
  background: #10212b;
  color: #f4fbff;
}

.message-bubble pre code {
  background: transparent;
  padding: 0;
  color: inherit;
}

.message-bubble blockquote {
  padding-left: 12px;
  border-left: 3px solid rgba(118, 200, 147, 0.7);
  color: var(--muted);
}

.message-bubble h1,
.message-bubble h2,
.message-bubble h3,
.message-bubble h4,
.message-bubble h5,
.message-bubble h6 {
  line-height: 1.25;
}

.message-row.assistant .message-bubble {
  background: var(--assistant-bubble);
  border-top-left-radius: 2px;
  color: var(--ink);
  border: 1px solid rgba(24, 78, 119, 0.08);
}

.message-row.user .message-bubble {
  background: linear-gradient(135deg, var(--accent) 0%, var(--user-bubble) 100%);
  color: white;
  border-top-right-radius: 2px;
  white-space: pre-wrap;
}

.message-row.user .message-bubble a {
  color: var(--highlight);
}

.message-row.error .message-bubble {
  background: #fff0ea;
  color: #7b2d12;
  white-space: pre-wrap;
}

.message-bubble.loading {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.loading-dot {
  width: 7px;
  height: 7px;
  border-radius: 2px;
  background: rgba(24, 78, 119, 0.58);
  animation: pulse 900ms infinite ease-in-out;
}

.loading-dot:nth-child(2) {
  animation-delay: 120ms;
}

.loading-dot:nth-child(3) {
  animation-delay: 240ms;
}

.composer {
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(16px);
  padding:
    14px
    16px
    calc(16px + max(0px, env(safe-area-inset-bottom)))
    16px;
}

html.ios-safari .composer,
html.ios-safari .suggested-panel {
  background: rgba(255, 255, 255, 0.98);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.composer textarea {
  width: 100%;
  resize: none;
  overflow-y: hidden;
  border: 1px solid rgba(24, 78, 119, 0.14);
  background: var(--surface-strong);
  border-radius: 2px;
  color: var(--ink);
  padding: 14px 16px;
  max-height: 164px;
  min-height: var(--composer-textarea-base-height);
  outline: none;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.composer textarea:focus {
  border-color: rgba(24, 78, 119, 0.44);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.65),
    0 0 0 4px rgba(217, 237, 146, 0.28);
}

.composer-bar {
  margin-top: 10px;
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

.composer-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.suggested-menu {
  position: relative;
}

.secondary-button {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  border: 1px solid rgba(24, 78, 119, 0.16);
  border-radius: 2px;
  padding: 11px 14px;
  min-width: 92px;
  background: rgba(248, 251, 255, 0.92);
  color: var(--accent-deep);
  font-weight: 600;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease;
}

.secondary-button-label {
  position: relative;
  z-index: 1;
}

.secondary-button-trace {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.secondary-button-trace-path {
  fill: none;
  stroke: rgba(26, 117, 159, 0);
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
  stroke-dasharray: 0 100;
  stroke-dashoffset: 0;
  opacity: 0;
}

.secondary-button.suggested-updated .secondary-button-trace-path {
  animation: suggested-border-trace 700ms linear 1;
}

.secondary-button:hover,
.secondary-button:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(24, 78, 119, 0.3);
  background: white;
  box-shadow: 0 10px 18px rgba(24, 78, 119, 0.08);
}

.secondary-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.suggested-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 10px);
  z-index: 4;
  width: min(420px, calc(100vw - 48px));
  border: 1px solid rgba(24, 78, 119, 0.12);
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 16px 36px rgba(24, 78, 119, 0.14);
  padding: 12px;
  backdrop-filter: blur(16px);
}

.suggested-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.suggested-panel-question {
  width: 100%;
  text-align: left;
  border: 1px solid rgba(24, 78, 119, 0.12);
  background: rgba(248, 251, 255, 0.92);
  color: var(--ink);
  border-radius: 2px;
  padding: 10px 11px;
  line-height: 1.45;
  cursor: pointer;
  transition:
    transform 150ms ease,
    border-color 150ms ease,
    background 150ms ease,
    box-shadow 150ms ease;
}

.suggested-panel-question:hover,
.suggested-panel-question:focus-visible {
  transform: translateY(-1px);
  border-color: rgba(24, 78, 119, 0.3);
  background: white;
  box-shadow: 0 8px 18px rgba(24, 78, 119, 0.08);
}

.composer .primary-button {
  border: 0;
  border-radius: 2px;
  padding: 11px 18px;
  min-width: 78px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: white;
  font-weight: 700;
  letter-spacing: -0.01em;
  cursor: pointer;
  transition:
    transform 150ms ease,
    box-shadow 150ms ease,
    opacity 150ms ease;
  box-shadow: 0 12px 24px rgba(24, 78, 119, 0.22);
}

.composer .primary-button:hover,
.composer .primary-button:focus-visible {
  transform: translateY(-1px);
}

.composer .primary-button:disabled {
  opacity: 0.55;
  cursor: wait;
  transform: none;
  box-shadow: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes pulse {
  0%,
  80%,
  100% {
    opacity: 0.28;
    transform: translateY(0);
  }

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

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

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

@keyframes fade-in {
  from {
    opacity: 0;
    transform: translateY(4px);
  }

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

@keyframes suggested-border-trace {
  0% {
    opacity: 0;
    stroke: rgba(26, 117, 159, 0);
    stroke-dasharray: 0 100;
    stroke-dashoffset: 0;
  }

  8% {
    opacity: 1;
    stroke: rgba(26, 117, 159, 0.96);
    stroke-dasharray: 18 82;
    stroke-dashoffset: 0;
  }

  72% {
    opacity: 1;
    stroke: rgba(26, 117, 159, 0.96);
    stroke-dasharray: 18 82;
    stroke-dashoffset: -92;
  }

  90% {
    opacity: 0.44;
    stroke: rgba(26, 117, 159, 0.72);
    stroke-dasharray: 12 88;
    stroke-dashoffset: -108;
  }

  100% {
    opacity: 0;
    stroke: rgba(26, 117, 159, 0);
    stroke-dasharray: 0 100;
    stroke-dashoffset: -114;
  }
}

@keyframes background-orbit-top-left {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.95;
  }

  17% {
    transform: translate3d(14vw, -1vh, 0) scale(1.03);
    opacity: 0.88;
  }

  36% {
    transform: translate3d(28vw, 5vh, 0) scale(0.99);
    opacity: 1;
  }

  54% {
    transform: translate3d(22vw, 16vh, 0) scale(1.04);
    opacity: 0.84;
  }

  73% {
    transform: translate3d(6vw, 24vh, 0) scale(1.01);
    opacity: 0.92;
  }

  88% {
    transform: translate3d(-2vw, 10vh, 0) scale(0.98);
    opacity: 0.86;
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.95;
  }
}

@keyframes background-orbit-bottom-right {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.94;
  }

  16% {
    transform: translate3d(1vw, -14vh, 0) scale(1.04);
    opacity: 0.86;
  }

  34% {
    transform: translate3d(-14vw, -28vh, 0) scale(1);
    opacity: 0.98;
  }

  57% {
    transform: translate3d(-30vw, -18vh, 0) scale(1.03);
    opacity: 0.83;
  }

  76% {
    transform: translate3d(-18vw, -3vh, 0) scale(0.99);
    opacity: 0.9;
  }

  89% {
    transform: translate3d(-5vw, -8vh, 0) scale(1.01);
    opacity: 0.87;
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.94;
  }
}

@keyframes background-orbit-top-right {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.9;
  }

  19% {
    transform: translate3d(1vw, 10vh, 0) scale(1.03);
    opacity: 0.84;
  }

  38% {
    transform: translate3d(-12vw, 22vh, 0) scale(0.98);
    opacity: 0.96;
  }

  56% {
    transform: translate3d(-26vw, 14vh, 0) scale(1.04);
    opacity: 0.82;
  }

  74% {
    transform: translate3d(-18vw, 2vh, 0) scale(1);
    opacity: 0.9;
  }

  87% {
    transform: translate3d(-4vw, 6vh, 0) scale(0.99);
    opacity: 0.85;
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.9;
  }
}

@keyframes background-orbit-bottom-left {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.92;
  }

  14% {
    transform: translate3d(0, -10vh, 0) scale(1.03);
    opacity: 0.86;
  }

  31% {
    transform: translate3d(12vw, -22vh, 0) scale(0.99);
    opacity: 0.99;
  }

  53% {
    transform: translate3d(26vw, -14vh, 0) scale(1.04);
    opacity: 0.84;
  }

  72% {
    transform: translate3d(18vw, -2vh, 0) scale(1);
    opacity: 0.91;
  }

  86% {
    transform: translate3d(4vw, -6vh, 0) scale(0.98);
    opacity: 0.87;
  }

  100% {
    transform: translate3d(0, 0, 0) scale(1);
    opacity: 0.92;
  }
}

@media (min-width: 640px) {
  body::before,
  body::after {
    display: block;
    opacity: 1;
  }

  .page-shell::before,
  .page-shell::after {
    display: block;
    opacity: 1;
  }

  body::before {
    animation: background-orbit-top-left 21s linear infinite;
    animation-delay: -11s;
  }

  body::after {
    animation: background-orbit-bottom-right 29s linear infinite;
    animation-delay: -27s;
  }

  .page-shell::before {
    animation: background-orbit-top-right 24s linear infinite;
    animation-delay: -18s;
  }

  .page-shell::after {
    animation: background-orbit-bottom-left 31s linear infinite;
    animation-delay: -34s;
  }

  .page-shell {
    display: flex;
    justify-content: center;
    padding:
      24px
      20px
      28px;
  }

  .app-frame {
    width: min(100%, var(--mobile-width));
    min-height: calc(100dvh - 52px);
    max-height: calc(100dvh - 52px);
    height: calc(100dvh - 52px);
    border-radius: var(--radius-xl);
    border-color: rgba(24, 78, 119, 0.1);
    box-shadow: var(--shadow);
  }

  .identity-mark {
    width: 80px;
    height: 80px;
  }

  .header-copy h1{
    font-size: 1.5rem;
  }

  .header-copy .eyebrow {
    font-size: 0.8rem;
  }
}

@media (min-width: 640px) {
  html.ios-safari .app-frame {
    min-height: calc(100svh - 52px);
    max-height: calc(100svh - 52px);
    height: calc(100svh - 52px);
  }
}

@media (max-width: 520px) {
  .composer-bar {
    align-items: flex-end;
  }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  body::after,
  .page-shell::before,
  .page-shell::after {
    animation: none;
  }

  .secondary-button.suggested-updated .secondary-button-trace-path {
    animation: none;
    opacity: 0;
  }
}
