:root {
  color-scheme: light;
  font: 16px/1.55 "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: #142b2a;
  background: #f3f5f1;
  --ink: #142b2a;
  --muted: #526662;
  --line: #e1e8e3;
  --paper: #fff;
  --accent: #136356;
  --accent-dark: #0c493e;
  --mint: #e3f3ed;
  --radius: 22px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 2% 0%, #e7eee4 0%, transparent 46%),
    radial-gradient(ellipse at 98% 85%, #ecf1eb 0%, transparent 38%),
    #f3f5f1;
}

h1, h2, h3, p, dl, dd { margin: 0; }

svg {
  width: 1.125rem;
  height: 1.125rem;
  flex: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell {
  width: min(100% - 5rem, 75rem);
  margin-inline: auto;
  padding-block: clamp(1.7rem, 4.8vh, 3.5rem) 2.25rem;
}

.masthead, .brand-lockup, .section-heading, .chat-controls {
  display: flex;
  align-items: center;
}

.masthead {
  justify-content: space-between;
  gap: 1.2rem;
  margin-bottom: 1.65rem;
}

.brand-lockup { gap: .95rem; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 3.4rem;
  height: 3.4rem;
  flex: none;
  border-radius: 1.05rem;
  color: #d8f7e5;
  background: linear-gradient(155deg, #1a6556, #113b37);
  box-shadow: 0 6px 13px #183b3326;
}

.brand-mark svg { width: 1.62rem; height: 1.62rem; }
.context { color: var(--muted); font-size: .74rem; letter-spacing: .09em; }

h1 {
  font-size: clamp(1.65rem, 3vw, 2.15rem);
  line-height: 1.2;
  letter-spacing: -.045em;
}

.demo-tag {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  flex: none;
  padding: .38rem .75rem;
  border: 1px solid #d6e4d8;
  border-radius: 100px;
  background: #eaf3e9;
  color: #315947;
  font-size: .76rem;
  font-weight: 650;
}

.demo-tag::before {
  width: .45rem;
  height: .45rem;
  border-radius: 50%;
  background: #438762;
  content: "";
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(15.5rem, .34fr);
  gap: 1.1rem;
  align-items: start;
}

.panel {
  border: 1px solid #dfe6e0;
  border-radius: var(--radius);
  background: var(--paper);
  box-shadow: 0 9px 35px #203a2e0a, 0 1px 2px #203a2e05;
  overflow: hidden;
}

.chat { display: grid; grid-template-rows: auto clamp(24rem, 55vh, 42rem) auto; }
.section-heading { justify-content: space-between; gap: .65rem; padding: .85rem 1.4rem; border-bottom: 1px solid var(--line); }
.section-heading h2 { font-size: 1rem; }
.chat-controls { gap: .45rem; }

button, textarea { font: inherit; }

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .35rem;
  cursor: pointer;
  min-height: 2.45rem;
  padding: .45rem .7rem;
  border: 1px solid var(--line);
  border-radius: .65rem;
  color: var(--ink);
  background: var(--paper);
  font-size: .83rem;
  font-weight: 620;
  transition: background-color .18s, border-color .18s, color .18s;
}

button:hover:not(:disabled) { background: #edf5f0; border-color: #b4d0c2; }
button:disabled { opacity: .58; cursor: default; }
button:focus-visible, textarea:focus-visible, summary:focus-visible { outline: 2px solid #147460; outline-offset: 2px; }
#reset { background: #edf5ef; }
#reset svg { width: .95rem; height: .95rem; }

#messages {
  overflow: auto;
  overflow-wrap: anywhere;
  padding: 1.4rem;
  scrollbar-color: #c6d7cd transparent;
  scrollbar-width: thin;
}

.welcome {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 12.2rem;
  padding: 1.7rem clamp(1.2rem, 4vw, 2.2rem);
  isolation: isolate;
  overflow: hidden;
  border-radius: 1rem;
  color: #f3fff8;
  background:
    radial-gradient(ellipse at 87% 70%, #277765 0%, transparent 55%),
    linear-gradient(123deg, #102e31, #184b46 70%, #226454);
}

.welcome-copy { max-width: 23rem; width: 60%; }
.welcome h3 { margin-bottom: .46rem; font-size: clamp(1.5rem, 4vw, 2.3rem); line-height: 1.2; letter-spacing: -.055em; }
.welcome p { max-width: 20rem; color: #d0e5db; font-size: .87rem; line-height: 1.75; }

.welcome-art {
  position: absolute;
  z-index: -1;
  inset: 0 0 0 56%;
  pointer-events: none;
  background: radial-gradient(ellipse at 53% 51%, #a5f2ae42, transparent 52%);
}

.art-orbit {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15.5rem;
  height: 7.1rem;
  border: 1px solid #b2f7d647;
  border-radius: 50%;
  transform: translate(-50%, -50%) rotate(-22deg);
  box-shadow: 0 0 0 20px #b5f7d719, 0 0 0 42px #b5f7d70c;
}

.art-tile {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 5.7rem;
  height: 5.7rem;
  border: 1px solid #dbffe6a8;
  border-radius: 1.48rem;
}

.art-tile-back { transform: translate(-28%, -58%) rotate(16deg); background: linear-gradient(143deg, #b0f0d080, #7edcbd12); }

.art-tile-front {
  display: grid;
  place-items: center;
  color: #174d43;
  transform: translate(-62%, -41%) rotate(-8deg);
  background: linear-gradient(142deg, #e0ffda, #8de2bc);
  box-shadow: 0 10px 24px #062d2b75, inset 0 0 22px #eaffd466;
}

.art-tile-front svg { width: 2.65rem; height: 2.65rem; stroke-width: 2.35; }

.art-light {
  position: absolute;
  top: 24%;
  left: 74%;
  width: .5rem;
  height: .5rem;
  border-radius: 50%;
  background: #deffd7;
  box-shadow: 0 0 12px #bafabe;
}

#examples { margin-top: 1.15rem; }
#examples h3 { margin-bottom: .55rem; color: var(--muted); font-size: .75rem; font-weight: 650; }
.example-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .65rem; }
.example-grid button { position: relative; gap: .55rem; justify-content: flex-start; padding: .65rem .6rem; min-height: 4.3rem; text-align: left; }
.example-icon { display: grid; place-items: center; flex: none; width: 1.9rem; height: 1.9rem; border-radius: .55rem; color: #245d4e; }
.example-icon svg { width: 1.05rem; height: 1.05rem; }
.example-icon.mint { background: #e5f4e8; }
.example-icon.sky { background: #e7eef8; color: #3b597b; }
.example-icon.gold { background: #f8f0dc; color: #6e581b; }
.example-copy { display: grid; min-width: 0; gap: .05rem; }
.example-copy strong { font-size: .79rem; font-weight: 670; }
.example-copy span { color: var(--muted); font-size: .7rem; font-weight: 450; }
.example-arrow { margin-left: auto; color: #526e63; align-self: start; line-height: 1; }

.bubble {
  width: fit-content;
  max-width: min(88%, 40rem);
  margin-bottom: .75rem;
  padding: .7rem .9rem .8rem;
  border: 1px solid #e2ebe5;
  border-radius: 1rem 1rem 1rem .35rem;
  background: #f1f5f2;
  white-space: pre-wrap;
  font-size: .9rem;
  line-height: 1.75;
}

.bubble.user { margin-left: auto; border-color: #d0e9dd; border-radius: 1rem 1rem .35rem 1rem; background: #e5f4eb; }
.bubble small { display: block; margin-bottom: .12rem; color: var(--accent-dark); font-size: .68rem; font-weight: 700; }

#composer { padding: .9rem 1.4rem .8rem; border-top: 1px solid var(--line); }

.input-row {
  display: flex;
  align-items: flex-end;
  gap: .65rem;
  padding: .42rem;
  border: 1px solid #dce7de;
  border-radius: .9rem;
  background: #f7f9f6;
}

.input-row:focus-within { border-color: #8db9a6; }
textarea { display: block; flex: 1; min-width: 0; min-height: 2.65rem; max-height: 10rem; padding: .57rem .48rem; resize: vertical; border: 0; color: inherit; background: transparent; font-size: .88rem; }
textarea::placeholder { color: #61726c; }
textarea:focus-visible { outline-offset: -1px; border-radius: .4rem; }
#send { min-height: 2.6rem; min-width: 4.45rem; border-color: var(--accent); background: var(--accent); color: white; }
#send:hover:not(:disabled) { background: var(--accent-dark); border-color: var(--accent-dark); }
#send svg { width: .94rem; height: .94rem; }

.composer-footer { display: flex; flex-wrap: wrap; justify-content: space-between; column-gap: .8rem; margin-top: .48rem; }
.privacy, #status { color: var(--muted); font-size: .74rem; }
#status[data-error] { color: #a42a21; }
#actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-bottom: .55rem; }
#actions button:first-child { background: var(--accent); border-color: var(--accent); color: white; }
#actions button:first-child:hover:not(:disabled) { background: var(--accent-dark); }

.inspector summary {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: 1.02rem 1rem;
  cursor: pointer;
  list-style: none;
  font-size: .95rem;
  font-weight: 700;
}

.inspector summary::-webkit-details-marker { display: none; }
.inspector summary:focus-visible { outline-offset: -4px; border-radius: var(--radius); }
.inspector summary svg { color: var(--accent); }
.inspector summary::after {
  width: .43rem;
  height: .43rem;
  margin-left: auto;
  border: solid #617c72;
  border-width: 0 1.5px 1.5px 0;
  transform: rotate(-45deg);
  content: "";
}

.inspector details[open] > summary { border-bottom: 1px solid var(--line); }
.inspector details[open] > summary::after { transform: rotate(45deg); }

.trace-empty { padding: 1.25rem 1rem 1.4rem; }
.trace-empty-mark { display: grid; place-items: center; width: 2.15rem; height: 2.15rem; margin-bottom: .6rem; border-radius: .6rem; color: var(--accent); background: #edf5ef; }
.trace-empty p { margin-bottom: .23rem; font-size: .85rem; font-weight: 675; }
.trace-empty > span:last-child { display: block; max-width: 14rem; color: var(--muted); font-size: .78rem; line-height: 1.65; }

#trace:not(:empty) { padding: .38rem .95rem .55rem; }
.trace-step { position: relative; padding: .7rem 0 .7rem 1rem; overflow-wrap: anywhere; }
.trace-step + .trace-step { border-top: 1px solid var(--line); }
.trace-step::before { position: absolute; top: .98rem; left: 0; width: .43rem; height: .43rem; border-radius: 50%; background: #6bb49a; content: ""; }
.trace-step dt { margin-bottom: .16rem; font-size: .78rem; font-weight: 700; }
.trace-step dd { color: var(--muted); font-size: .75rem; line-height: 1.55; }
.trace-step .trace-model { color: var(--accent-dark); }
.trace-step .trace-duration { margin-top: .15rem; font-size: .68rem; font-variant-numeric: tabular-nums; }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

@media (max-width: 960px) {
  .shell { width: min(100% - 3rem, 75rem); }
  .example-arrow { display: none; }
  .example-grid button { gap: .4rem; }
}

@media (max-width: 760px) {
  .shell { width: min(100% - 2rem, 36rem); padding-top: 1.25rem; }
  .masthead { margin-bottom: 1rem; }
  .workspace { grid-template-columns: 1fr; gap: .8rem; }
  .chat { grid-template-rows: auto minmax(16rem, auto) auto; }
  #messages { max-height: 36rem; }
  .example-arrow { display: inline; }
}

@media (max-width: 480px) {
  .shell { width: calc(100% - 1.25rem); }
  .panel { border-radius: 1.05rem; }
  .brand-lockup { gap: .65rem; }
  .brand-mark { width: 2.8rem; height: 2.8rem; border-radius: .85rem; }
  .context { font-size: .65rem; }
  .demo-tag { padding-inline: .52rem; font-size: .68rem; }
  .section-heading, #messages, #composer { padding-inline: .8rem; }
  .welcome { min-height: 9.5rem; padding: .95rem; }
  .welcome-copy { width: 70%; }
  .welcome h3 { font-size: 1.48rem; }
  .welcome p { font-size: .77rem; }
  .welcome-art { left: 63%; scale: .7; }
  .example-grid { grid-template-columns: 1fr; gap: .38rem; }
  .example-grid button { min-height: 2.85rem; gap: .55rem; padding: .38rem .52rem; }
  .example-copy { width: 100%; grid-template-columns: auto 1fr; align-items: baseline; gap: .55rem; }
  .example-arrow { align-self: center; }
  .bubble { max-width: 94%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; }
}
