:root {
  color-scheme: light;
  font-family: "Inter", system-ui, sans-serif;
  color: #182623;
  background: #f3f6f5;
  --primary: #205a4f;
  --primary-hover: #16463d;
  --muted: #4c615b;
  --line: #ccd9d4;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; }
button, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .65; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid #247e6e; outline-offset: 3px; }

.layout {
  width: min(100% - 3rem, 72rem);
  margin: clamp(1.5rem, 6vw, 5rem) auto;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr);
  align-items: start;
  gap: 1.25rem;
}

.panel {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 1.125rem;
  box-shadow: 0 12px 30px #263d3210;
}

.panel-header, .chat-content, .embed-panel { padding: 1.3rem; }
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: .65rem;
  border-bottom: 1px solid var(--line);
}

h1, h2, p { margin: 0; }
h1, h2 { font-size: clamp(1.12rem, 3.1vw, 1.4rem); line-height: 1.24; }
.muted, .privacy, .footnote { color: var(--muted); line-height: 1.5; }
.muted { margin-top: .35rem; font-size: .91rem; }

.chat-content { min-height: 0; }
.messages {
  min-height: 13rem;
  max-height: 22rem;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: .75rem;
  padding: .28rem .32rem .6rem;
  overscroll-behavior: contain;
}

.message {
  align-self: flex-start;
  max-width: min(94%, 38rem);
  padding: .75rem .85rem;
  background: #f0f4f2;
  border-radius: .85rem;
  line-height: 1.48;
  overflow-wrap: anywhere;
}
.message.user { align-self: flex-end; background: #ddefe9; }
.message p { white-space: pre-wrap; }
.speaker {
  display: block;
  margin-bottom: .16rem;
  color: var(--muted);
  font-size: .76rem;
  font-weight: 700;
}

.examples, .copy-controls { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.primary, .example-button, .text-button {
  border-radius: .62rem;
  min-height: 2.65rem;
  padding: .5rem .75rem;
  font-weight: 650;
}
.primary { background: var(--primary); border: 1px solid var(--primary); color: #fff; }
.primary:hover:not(:disabled) { background: var(--primary-hover); }
.example-button { color: var(--primary); border: 1px solid var(--line); background: #fff; font-size: .84rem; }
.example-button:hover:not(:disabled) { background: #eff7f4; }
.text-button {
  display: inline-flex;
  align-items: center;
  color: var(--primary);
  font-size: .86rem;
  border: 1px solid transparent;
  background: transparent;
  text-decoration: underline;
  text-underline-offset: .2em;
}
.text-button:hover { background: #eff7f4; }

label { display: block; margin-bottom: .38rem; font-size: .86rem; font-weight: 660; }
.composer { display: flex; align-items: end; gap: .55rem; }
textarea {
  display: block;
  min-width: 0;
  width: 100%;
  padding: .64rem .73rem;
  border: 1px solid #acbfb6;
  border-radius: .62rem;
  background: #fff;
  color: inherit;
  resize: vertical;
  line-height: 1.42;
}
.notice { min-height: 1.55rem; color: var(--muted); font-size: .84rem; }
.notice[data-error] { color: #8c2f22; }
.privacy, .footnote { font-size: .78rem; }
.privacy { margin-top: .7rem; }

.embed-panel label { margin-top: 1.25rem; }
.code { background: #f4f7f6; font: .8rem/1.55 "IBM Plex Mono", Consolas, monospace; }
.copy-controls { margin: .85rem 0 .42rem; }
.embed-panel .footnote { border-top: 1px solid var(--line); padding-top: .8rem; }

.embedded { background: #fff; }
.embedded .layout { display: block; width: 100%; margin: 0; }
.embedded .panel { box-shadow: none; }
.embedded .chat-panel { min-height: 100dvh; display: flex; flex-direction: column; }
.embedded .chat-content { flex: 1; display: flex; flex-direction: column; }
.embedded .messages { flex: 1; min-height: 8rem; max-height: max(12rem, calc(100dvh - 15.4rem)); }

@media (max-width: 49rem) {
  .layout { width: min(100% - 1.5rem, 38rem); grid-template-columns: 1fr; gap: .8rem; }
}

@media (max-width: 30rem) {
  .panel-header, .chat-content, .embed-panel { padding: .9rem; }
  .messages { max-height: 17rem; }
  .example-button { min-height: 2.3rem; }
}
