:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #4C9141;
  color: #10210e;
  line-height: 1.5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: #4C9141;
}

button, textarea { font: inherit; }

button {
  border: 0;
  border-radius: .55rem;
  padding: .65rem .9rem;
  color: #fff;
  background: #245b27;
  cursor: pointer;
  font-weight: 700;
}

button:hover { background: #173f1a; }
button:focus-visible, textarea:focus-visible { outline: 3px solid #f5d547; outline-offset: 2px; }
button:disabled { cursor: not-allowed; opacity: .55; }
button.secondary { background: #49634a; }
button.danger { background: #833d38; }

.site-header, main, footer {
  width: min(1180px, calc(100% - 2rem));
  margin-inline: auto;
}

.site-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 2rem;
  padding: 2rem 0 1.25rem;
  color: #fff;
}

.eyebrow { margin: 0 0 .25rem; font-size: .8rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
h1 { margin: 0; font-size: clamp(2.2rem, 6vw, 4.5rem); line-height: .95; }
h2 { margin-top: 0; }

.live-status {
  display: grid;
  grid-template-columns: repeat(3, auto);
  gap: .5rem;
  font-size: .9rem;
}

.live-status span {
  padding: .45rem .65rem;
  border: 1px solid rgba(255,255,255,.38);
  border-radius: 999px;
  background: rgba(15,49,16,.38);
}

.information {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(270px, .75fr);
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.public-copy, .server-card, .chat-app {
  border: 1px solid rgba(16,33,14,.18);
  border-radius: 1rem;
  background: #f7fbf5;
  box-shadow: 0 .7rem 2rem rgba(17,54,16,.18);
}

.public-copy { padding: 1.35rem 1.5rem; }
.public-copy p { margin: .75rem 0; }
.exact-copy { white-space: pre-wrap; }
.notice { border-left: .3rem solid #d69d15; padding-left: .85rem; font-weight: 650; }
.terms { border-left: .3rem solid #4C9141; padding-left: .85rem; }

.server-card {
  align-self: start;
  padding: 1.25rem;
  background: #173f1a;
  color: #f6fff3;
  box-shadow: inset 0 0 0 3px rgba(255,255,255,.09), 0 .7rem 2rem rgba(17,54,16,.2);
}

.server-card dl { margin: 0; }
.server-card dl div { display: grid; grid-template-columns: 7.6rem 1fr; gap: .6rem; padding: .48rem 0; border-bottom: 1px solid rgba(255,255,255,.13); }
.server-card dt { font-weight: 800; color: #bee8b5; }
.server-card dd { margin: 0; }
.server-card p { margin-bottom: 0; color: #dcf1d8; font-size: .9rem; }

.chat-app {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 640px;
  overflow: hidden;
}

.chat-sidebar { padding: 1rem; background: #e5f1e1; border-right: 1px solid #cadac6; }
.sidebar-actions { display: grid; gap: .5rem; }
.expiry-note { font-size: .78rem; color: #445543; }
#chat-list { display: grid; gap: .35rem; margin-top: .8rem; }
.chat-link { width: 100%; text-align: left; color: #193a1c; background: transparent; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-link:hover, .chat-link.active { color: #fff; background: #4C9141; }

.conversation-panel { min-width: 0; display: grid; grid-template-rows: auto 1fr auto; background: #fff; }
.conversation-heading { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; border-bottom: 1px solid #dce5da; }
.conversation-heading h2, .conversation-heading p { margin: 0; }
#request-status { color: #49634a; font-size: .9rem; text-align: right; }

.messages { min-height: 300px; overflow-y: auto; padding: 1.25rem; }
.message { min-width: 0; max-width: min(84%, 760px); margin-bottom: .9rem; padding: .8rem 1rem; border-radius: .8rem; overflow-wrap: anywhere; }
.message.user { margin-left: auto; color: #fff; background: #357a38; border-bottom-right-radius: .2rem; }
.message.assistant { color: #172016; background: #edf2eb; border-bottom-left-radius: .2rem; }
.message .role { display: block; margin-bottom: .2rem; font-size: .7rem; font-weight: 800; letter-spacing: .08em; opacity: .7; text-transform: uppercase; }
.message-content { min-width: 0; }
.message.user .message-content { white-space: pre-wrap; }
.message.assistant .message-content { line-height: 1.5; }
.message.assistant .message-content > :first-child { margin-top: 0; }
.message.assistant .message-content > :last-child { margin-bottom: 0; }
.message.assistant .message-content p { margin: .55em 0; }
.message.assistant .message-content h1,
.message.assistant .message-content h2,
.message.assistant .message-content h3,
.message.assistant .message-content h4,
.message.assistant .message-content h5,
.message.assistant .message-content h6 { margin: .8em 0 .35em; line-height: 1.25; }
.message.assistant .message-content h1 { font-size: 1.35rem; }
.message.assistant .message-content h2 { font-size: 1.22rem; }
.message.assistant .message-content h3 { font-size: 1.12rem; }
.message.assistant .message-content h4,
.message.assistant .message-content h5,
.message.assistant .message-content h6 { font-size: 1rem; }
.message.assistant .message-content ul,
.message.assistant .message-content ol { margin: .55em 0; padding-left: 1.5em; }
.message.assistant .message-content li + li { margin-top: .2em; }
.message.assistant .message-content blockquote { margin: .65em 0; padding-left: .8em; color: #405340; border-left: .22rem solid #91aa8e; }
.message.assistant .message-content a { color: #246b2c; text-decoration-thickness: .08em; text-underline-offset: .12em; }
.message.assistant .message-content code { padding: .08em .28em; border-radius: .25rem; color: #203020; background: #dfe8dc; font: .9em/1.45 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace; white-space: break-spaces; }
.message.assistant .code-block { min-width: 0; margin: .65em 0; }
.message.assistant .code-language { display: block; margin-bottom: .2rem; color: #526452; font-size: .7rem; font-weight: 700; text-transform: lowercase; }
.message.assistant .message-content pre { max-width: 100%; margin: 0; padding: .75rem; overflow-x: auto; border-radius: .45rem; background: #dfe8dc; }
.message.assistant .message-content pre code { display: block; min-width: max-content; padding: 0; border-radius: 0; background: transparent; overflow-wrap: normal; white-space: pre; word-break: normal; }
.empty-chat { color: #60705f; text-align: center; margin-top: 4rem; }

#chat-form { padding: 1rem 1.25rem; border-top: 1px solid #dce5da; }
#chat-form > label:first-child { display: block; margin-bottom: .35rem; font-weight: 750; }
textarea { display: block; width: 100%; resize: vertical; border: 1px solid #9caf98; border-radius: .65rem; padding: .75rem; color: #172016; background: #fbfdfb; }
.composer-footer { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-top: .6rem; color: #566455; font-size: .8rem; }
.honeypot { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; }

footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.25rem 0 2rem; color: #f2faef; font-size: .85rem; }

@media (max-width: 820px) {
  .site-header { align-items: start; flex-direction: column; }
  .live-status { grid-template-columns: 1fr; }
  .information { grid-template-columns: 1fr; }
  .chat-app { grid-template-columns: 1fr; }
  .chat-sidebar { border-right: 0; border-bottom: 1px solid #cadac6; }
  #chat-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
  .site-header, main, footer { width: min(100% - 1rem, 1180px); }
  .live-status { width: 100%; }
  .information { gap: .65rem; }
  .public-copy, .server-card { border-radius: .7rem; }
  .chat-app { border-radius: .7rem; }
  .conversation-heading, .composer-footer, footer { align-items: stretch; flex-direction: column; }
  .message { max-width: 94%; }
}
