:root {
  --ink: #14352f;
  --ink-soft: #315c52;
  --paper: #f5f2e9;
  --paper-deep: #e8e1d0;
  --sea: #6aa39b;
  --sea-pale: #dbeee8;
  --sun: #ebc66b;
  --coral: #c96d56;
  --line: rgba(20, 53, 47, 0.16);
  --shadow: 0 22px 55px rgba(20, 53, 47, 0.14);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--paper);
}

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 10% 0%, rgba(235, 198, 107, 0.17), transparent 29rem),
    linear-gradient(160deg, #f9f7f1 0%, var(--paper) 55%, #ece7da 100%);
}

button,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

a {
  color: inherit;
}

.shell {
  width: min(1180px, calc(100% - 40px));
  margin: 0 auto;
  padding: 26px 0 52px;
}

.back-link {
  display: inline-flex;
  gap: 0.4rem;
  align-items: center;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 720;
  text-decoration: none;
}

.back-link:hover,
.back-link:focus-visible {
  text-decoration: underline;
  text-underline-offset: 0.2em;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  padding: 44px 2px 30px;
}

.eyebrow,
.panel-label {
  margin: 0 0 0.65rem;
  color: var(--ink-soft);
  font-size: 0.73rem;
  font-weight: 820;
  letter-spacing: 0.13em;
  line-height: 1.25;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  letter-spacing: -0.045em;
}

h1 {
  max-width: 740px;
  margin-bottom: 0.38rem;
  color: var(--ink);
  font-size: clamp(3.55rem, 8vw, 6.3rem);
  line-height: 0.9;
}

h1 span {
  color: var(--coral);
}

.lede {
  max-width: 645px;
  margin-bottom: 0;
  color: var(--ink-soft);
  font-size: clamp(1.04rem, 2vw, 1.27rem);
  line-height: 1.55;
}

.hero-ty-art {
  width: min(190px, 18vw);
  min-width: 120px;
  flex: 0 0 auto;
  border-radius: 50%;
  filter: drop-shadow(0 16px 19px rgba(20, 53, 47, 0.16));
}

.notice {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  margin-bottom: 28px;
  padding: 13px 16px;
  border: 1px solid rgba(201, 109, 86, 0.3);
  border-radius: 11px;
  background: rgba(255, 250, 242, 0.7);
  color: #5b4138;
  font-size: 0.86rem;
  line-height: 1.45;
}

.notice p {
  margin: 0;
}

.notice-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 auto;
  margin-top: 0.35rem;
  border-radius: 50%;
  background: var(--coral);
}

.demo-grid {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.54fr);
  gap: 24px;
  align-items: stretch;
}

.context-panel {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 690px;
  padding: 29px;
  border: 1px solid rgba(20, 53, 47, 0.11);
  border-radius: 19px;
  background: var(--ink);
  box-shadow: var(--shadow);
  color: #f9f4e9;
}

.context-panel .panel-label {
  color: #b8d6ce;
}

.context-panel h2 {
  margin-bottom: 1rem;
  font-size: clamp(2.2rem, 4vw, 3.15rem);
  line-height: 0.94;
}

.context-panel > div > p:not(.panel-label) {
  color: #d8e7e1;
  font-size: 0.97rem;
  line-height: 1.58;
}

.rule-list {
  display: grid;
  gap: 19px;
  margin: 34px 0;
}

.rule-list > div {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 10px;
  align-items: start;
}

.rule-number {
  color: var(--sun);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.rule-list p {
  margin: 0;
  color: #d8e7e1;
  font-size: 0.86rem;
  line-height: 1.5;
}

.rule-list strong {
  color: #fffaf0;
}

.source-note {
  padding-top: 18px;
  border-top: 1px solid rgba(222, 236, 230, 0.22);
}

.source-note p:last-child {
  margin-bottom: 0;
}

.chat-card {
  display: flex;
  min-height: 690px;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(20, 53, 47, 0.14);
  border-radius: 19px;
  background: rgba(255, 254, 250, 0.87);
  box-shadow: var(--shadow);
}

.chat-topbar {
  display: flex;
  gap: 12px;
  align-items: center;
  min-height: 78px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
}

.message-avatar {
  display: grid;
  width: 39px;
  height: 39px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.23);
  color: white;
  font-size: 0.76rem;
  font-weight: 850;
  letter-spacing: 0.03em;
}

.ty-badge {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  border: 2px solid rgba(20, 53, 47, 0.12);
  border-radius: 50%;
  object-fit: cover;
  object-position: center;
}

.ty-avatar {
  overflow: hidden;
  border: 2px solid rgba(20, 53, 47, 0.1);
  background: #d7eaf3;
}

.ty-avatar img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.chat-name {
  margin: 0;
  font-size: 0.96rem;
  font-weight: 820;
}

.chat-status {
  margin: 0.12rem 0 0;
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.reset-button {
  margin-left: auto;
  padding: 0.5rem 0.68rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 0.78rem;
  font-weight: 720;
}

.reset-button:hover,
.reset-button:focus-visible {
  border-color: var(--ink-soft);
  background: var(--sea-pale);
}

.messages {
  display: flex;
  min-height: 260px;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  overflow-y: auto;
  padding: 25px 24px 16px;
  scrollbar-color: var(--sea) transparent;
}

.message {
  display: flex;
  max-width: min(100%, 710px);
  gap: 10px;
  align-items: flex-start;
}

.message-content {
  min-width: 0;
  padding: 12px 14px;
  border-radius: 3px 15px 15px 15px;
  background: var(--sea-pale);
  color: var(--ink);
  font-size: 0.94rem;
  line-height: 1.55;
}

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

.message-content p,
.message-content ul,
.message-content ol {
  margin: 0 0 0.72rem;
}

.message-content ul,
.message-content ol {
  padding-left: 1.25rem;
}

.message-content h3,
.message-content h4 {
  margin: 0.1rem 0 0.55rem;
  font-size: 0.96rem;
}

.message-content a {
  color: #165a52;
  font-weight: 700;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.15em;
}

.user-message {
  align-self: flex-end;
  flex-direction: row-reverse;
}

.user-message .message-content {
  border-radius: 15px 3px 15px 15px;
  background: var(--ink);
  color: #fffdf8;
}

.user-message .message-avatar {
  background: var(--sun);
  color: var(--ink);
}

.message-sources {
  margin: 9px 0 0 49px;
}

.source-title {
  margin: 0 0 6px;
  color: var(--ink-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.source-list {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.source-list a {
  max-width: 100%;
  overflow: hidden;
  padding: 0.34rem 0.52rem;
  border: 1px solid rgba(20, 53, 47, 0.14);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 700;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-list a:hover,
.source-list a:focus-visible {
  border-color: var(--sea);
  background: var(--sea-pale);
}

.research-message .message-content {
  min-width: min(100%, 300px);
  border: 1px solid rgba(106, 163, 155, 0.28);
  background: #edf7f4;
}

.research-content p {
  margin: 0;
}

.research-title {
  margin-bottom: 0.12rem !important;
  color: var(--ink);
  font-weight: 820;
}

.research-title::after {
  display: inline-block;
  width: 0.85em;
  height: 0.85em;
  margin-left: 0.48rem;
  border: 2px solid var(--sea);
  border-right-color: transparent;
  border-radius: 50%;
  content: "";
  vertical-align: -0.08em;
  animation: source-spin 1s linear infinite;
}

.research-title + p {
  color: var(--ink-soft);
  font-size: 0.86rem;
}

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

.prompt-area {
  padding: 17px 20px 18px;
  border-top: 1px solid var(--line);
  background: rgba(247, 244, 236, 0.67);
}

.prompt-label {
  margin-bottom: 0.55rem;
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 780;
}

.quick-prompts {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 13px;
}

.quick-prompts button {
  padding: 0.44rem 0.63rem;
  border: 1px solid rgba(20, 53, 47, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.76);
  color: var(--ink-soft);
  font-size: 0.77rem;
  font-weight: 650;
  line-height: 1.25;
  text-align: left;
}

.quick-prompts button:hover,
.quick-prompts button:focus-visible {
  border-color: var(--sea);
  background: var(--sea-pale);
  color: var(--ink);
}

.chat-form {
  display: flex;
  gap: 10px;
  align-items: flex-end;
}

.chat-form textarea {
  width: 100%;
  min-height: 55px;
  resize: vertical;
  padding: 0.7rem 0.8rem;
  border: 1px solid rgba(20, 53, 47, 0.22);
  border-radius: 10px;
  outline: 0;
  background: #fffefb;
  color: var(--ink);
  line-height: 1.35;
}

.chat-form textarea:focus {
  border-color: var(--sea);
  box-shadow: 0 0 0 3px rgba(106, 163, 155, 0.22);
}

.chat-form button {
  min-height: 44px;
  padding: 0.7rem 0.87rem;
  border: 1px solid var(--ink);
  border-radius: 10px;
  background: var(--ink);
  color: #fffdf6;
  font-size: 0.86rem;
  font-weight: 800;
}

.chat-form button:hover,
.chat-form button:focus-visible {
  background: var(--ink-soft);
}

.chat-form button:disabled,
.quick-prompts button:disabled,
.reset-button:disabled,
.chat-form textarea:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.privacy-note {
  margin: 0.55rem 0 0;
  color: #6c746d;
  font-size: 0.72rem;
  line-height: 1.4;
}

.turnstile-container {
  min-height: 0;
  margin-top: 10px;
}

.turnstile-container:empty {
  display: none;
}

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

@media (max-width: 820px) {
  .shell {
    width: min(100% - 28px, 650px);
    padding-top: 19px;
  }

  .hero {
    align-items: flex-start;
    padding-top: 34px;
  }

  .hero-ty-art {
    width: 130px;
    min-width: 100px;
  }

  .demo-grid {
    grid-template-columns: 1fr;
  }

  .context-panel {
    min-height: unset;
    gap: 20px;
  }

  .context-panel .rule-list {
    margin: 6px 0;
  }

  .chat-card {
    min-height: 670px;
  }
}

@media (max-width: 500px) {
  .hero {
    padding-bottom: 22px;
  }

  .hero-copy {
    min-width: 0;
  }

  h1 {
    font-size: 3.5rem;
  }

  .hero-ty-art {
    display: none;
  }

  .context-panel,
  .chat-card {
    border-radius: 14px;
  }

  .context-panel {
    padding: 23px;
  }

  .chat-topbar,
  .prompt-area {
    padding-right: 15px;
    padding-left: 15px;
  }

  .messages {
    padding-right: 15px;
    padding-left: 15px;
  }

  .chat-form {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-form button {
    width: 100%;
  }
}


.page-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}
.page-nav nav {
  display: flex;
  align-items: center;
  gap: 16px;
  color: var(--ink-soft);
  font-size: .82rem;
}
.page-nav nav a {
  padding: 6px 0;
  border-bottom: 1px solid transparent;
}
.page-nav nav a:hover,
.page-nav nav .active {
  color: var(--ink);
  border-bottom-color: var(--sea);
}
@media (max-width: 650px) {
  .page-nav { align-items: flex-start; }
  .page-nav nav { flex-direction: column; align-items: flex-end; gap: 3px; font-size: .76rem; }
}