:root {
  font-family: "Segoe UI", "Yu Gothic UI", Meiryo, sans-serif;
  color: #172525;
  background: #f8faf8;
  --muted: #4c6362;
  --line: #ccd9d5;
  --accent: #0f6759;
}
* { box-sizing: border-box; }
body { margin: 0; }
[hidden] { display: none !important; }
.frame { max-width: 880px; margin-inline: auto; padding-inline: clamp(15px, 4vw, 32px); }
.top { border-bottom: 1px solid var(--line); background: #eef5f1; }
.top-inner, .controls, .compose-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
}
.top-inner { padding-block: 13px; }
.brand { color: var(--accent); font-weight: 800; text-decoration: none; }
.brand span { color: #172525; font-weight: 600; margin-inline-start: 8px; }
.status, .meta { color: var(--muted); font-size: .86rem; }
.status::before { content: ""; display: inline-block; width: .55em; height: .55em;
  border-radius: 50%; background: #a46b2c; margin-inline-end: .5em; }
.status[data-ready="true"]::before { background: var(--accent); }
.layout { display: flex; flex-direction: column; min-height: calc(100dvh - 72px); }
h1 { font-size: clamp(1.75rem, 6vw, 3rem); line-height: 1.2; margin: clamp(25px, 10vh, 120px) 0 8px; letter-spacing: -.025em; }
#model { color: var(--muted); margin: 0 0 22px; }
.messages { display: grid; gap: 14px; }
.turn { min-width: 0; border: 1px solid var(--line); padding: 13px 16px;
  border-radius: 14px; background: white; overflow-wrap: anywhere; }
.turn.user { background: #eaf5ef; justify-self: end; max-width: 88%; }
.turn .label { font-weight: 700; font-size: .82rem; color: var(--accent); }
.body { line-height: 1.65; }
.body > :first-child { margin-top: 7px; }
.body > :last-child { margin-bottom: 7px; }
.user .body { white-space: pre-wrap; }
.body pre { overflow: auto; padding: 12px; background: #eaf0ef; border-radius: 8px; }
.body img { display: none; }
.body table { border-collapse: collapse; display: block; overflow: auto; }
.body :is(td, th) { padding: 3px 8px; border: 1px solid var(--line); }
.turn footer { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.notice { color: #a12a29; padding-block: 5px; }
.compose { position: sticky; bottom: 0; margin-top: auto; padding: 16px 0 max(15px, env(safe-area-inset-bottom)); background: #f8faf8; }
textarea, input, button { font: inherit; }
textarea, input { background: #fff; color: inherit; border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px; }
textarea { width: 100%; min-height: 66px; max-height: 34vh; resize: vertical; }
input { width: min(34vw, 205px); min-width: 115px; }
.compose-actions { justify-content: flex-end; margin-top: 7px; }
.compose-actions label { margin-inline-end: auto; color: var(--muted); font-size: .85rem; }
button { border: 1px solid var(--line); border-radius: 9px; background: white;
  color: inherit; padding: 7px 12px; cursor: pointer; }
button:disabled { cursor: default; opacity: .53; }
button.primary { background: var(--accent); color: white; border-color: var(--accent); font-weight: 700; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; clip-path: inset(50%); overflow: hidden; }
@media (max-width: 420px) {
  .controls, .compose-actions { gap: 6px; }
  button { padding-inline: 8px; }
  .top-inner { align-items: flex-start; }
}
