main {
  max-width: 48rem;
  margin: 0 auto;
  padding: 3.5rem 1rem 2.5rem;
  display: grid;
  gap: 1rem;
}

label {
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
}

label .muted {
  font-weight: 400;
}

.wordmark {
  font-size: 1.375rem;
  font-weight: 650;
  letter-spacing: -0.02em;
}

.field {
  width: 100%;
  border: 1px solid var(--hairline);
  border-radius: 0.75rem;
  background: var(--canvas);
  color: var(--ink);
  padding: 0.625rem 0.875rem;
  font: inherit;
  resize: vertical;
}

.mono,
code,
.text {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
}

.field.mono {
  font-size: 0.8125rem;
}

code {
  font-size: 0.85em;
}

.composer {
  gap: 0.625rem;
}

fieldset {
  margin: 0;
  padding: 0;
  border: 0;
  display: grid;
  gap: 0.5rem;
}

legend {
  padding: 0;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.chip {
  border: 1px solid var(--hairline);
  border-radius: 999px;
  padding: 0.3rem 0.875rem;
  background: none;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.chip:hover {
  background: var(--surface);
}

fieldset:disabled .chip {
  cursor: not-allowed;
  opacity: 0.5;
}

.composer .row {
  justify-content: flex-start;
}

.dot {
  display: inline-block;
  width: 0.5rem;
  height: 0.5rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: currentColor;
  vertical-align: 0.1em;
}

.composer[data-phase="replying"] .dot {
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  50% {
    opacity: 0.3;
  }
}

.metrics {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(7.75rem, 1fr));
  gap: 0.625rem;
}

.metrics > div {
  background: var(--surface);
  border-radius: 0.875rem;
  padding: 0.75rem 0.875rem;
  display: grid;
  gap: 0.125rem;
  align-content: start;
}

.metrics dt {
  font-size: 0.75rem;
  font-weight: 550;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.metrics dd {
  margin: 0;
}

.metrics dd:not(.muted) {
  font-size: 1.5rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.metrics dd.muted {
  font-size: 0.75rem;
  line-height: 1.35;
}

.placeholder {
  margin: 0;
}

/* The conversation: the user's messages to the right, the model's replies to the left. */
.conversation {
  display: grid;
  gap: 0.875rem;
}

.conversation:empty {
  display: none;
}

.message {
  display: grid;
  gap: 0.5rem;
  max-width: 85%;
}

.message[data-role="user"] {
  justify-self: end;
  justify-items: end;
}

.message[data-role="user"] .said {
  background: var(--surface);
  border-radius: 1rem 1rem 0.25rem 1rem;
  padding: 0.625rem 0.875rem;
}

.message[data-role="user"] .said:empty {
  display: none;
}

.said {
  margin: 0;
  overflow-wrap: anywhere;
}

p.said {
  white-space: pre-wrap;
}

.message[data-role="model"] .said:not(:has(.block))::before {
  content: "…";
  color: var(--ink-faint);
}

/* A reply's Markdown. */
.said .block {
  white-space: pre-wrap;
}

.said .block + .block {
  margin-top: 0.625rem;
}

.block[data-kind="heading"] {
  font-weight: 650;
}

.block[data-kind="item"] {
  padding-left: 1.25rem;
  position: relative;
}

.block[data-kind="item"]::before {
  content: "•";
  position: absolute;
  left: 0.375rem;
  color: var(--ink-faint);
}

.block[data-kind="item"] + .block[data-kind="item"] {
  margin-top: 0.25rem;
}

.block[data-kind="code"] {
  background: var(--surface);
  border-radius: 0.625rem;
  padding: 0.625rem 0.875rem;
  overflow-x: auto;
}

.block[data-kind="rule"] {
  border-top: 1px solid var(--hairline);
}

[data-style="strong"] {
  font-weight: 650;
}

[data-style="emphasis"] {
  font-style: italic;
}

[data-style="code"],
.block[data-kind="code"] {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 0.875em;
}

.reasoning summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
}

.thought {
  margin: 0.375rem 0 0;
  padding-left: 0.75rem;
  border-left: 2px solid var(--hairline);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.875rem;
  color: var(--ink-faint);
}

/* How the next reply is written. */
.settings {
  display: grid;
  gap: 0.5rem;
}

.toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.sampling summary {
  cursor: pointer;
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--ink-soft);
}

.sampling {
  display: grid;
  gap: 0.5rem;
}

.sampling[open] {
  padding-bottom: 0.25rem;
}

.sampling > label,
.fields {
  margin-top: 0.5rem;
}

.fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr));
  gap: 0.5rem;
}

.fields[data-disabled="true"] {
  opacity: 0.5;
}

.sampling label .field {
  margin-top: 0.25rem;
}

/* The models of the collection, the one loaded marked. */
.models {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.models .chip {
  text-decoration: none;
}

.models .chip[data-current="true"] {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--canvas);
}

/* The images and clips of the next message, for a model that reads or hears them. */
.media {
  display: grid;
  gap: 0.5rem;
}

.drop {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 4.5rem;
  border: 1px dashed var(--hairline);
  border-radius: 0.875rem;
  background: var(--surface);
  cursor: pointer;
}

.drop[data-disabled="true"] {
  cursor: not-allowed;
}

.drop:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.hint {
  color: var(--ink-faint);
  font-size: 0.9rem;
  font-weight: 400;
}

.thumbs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.625rem;
}

.thumbs:empty {
  display: none;
}

.clips {
  margin: 0;
  padding: 0;
  list-style: none;
}

.clips:empty {
  display: none;
}

#record[data-recording="true"] {
  border-color: var(--accent);
  color: var(--accent);
}

.thumb {
  margin: 0;
  display: grid;
  gap: 0.25rem;
}

.thumb canvas {
  display: block;
  height: 6rem;
  border-radius: 0.5rem;
  background: var(--surface);
}

.thumb figcaption {
  font-size: 0.75rem;
}

.message .images:empty {
  display: none;
}

/* A decision model's answers: one card per question, every box drawn over the picture. */
.answers {
  display: grid;
  gap: 0.625rem;
}

.answers:empty {
  display: none;
}

.answer {
  background: var(--surface);
  border-radius: 0.875rem;
  padding: 0.75rem 0.875rem;
  display: grid;
  gap: 0.375rem;
}

.answer p {
  margin: 0;
  overflow-wrap: anywhere;
}

.answer p:empty {
  display: none;
}

.headline {
  font-size: 1.125rem;
  font-weight: 650;
}

.bars {
  display: grid;
  gap: 0.25rem;
}

.bars:empty {
  display: none;
}

.bar {
  display: grid;
  grid-template-columns: minmax(0, 12rem) 1fr 3rem;
  align-items: center;
  gap: 0.625rem;
  font-size: 0.875rem;
}

.bar .muted {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.picture {
  position: relative;
  justify-self: start;
  width: fit-content;
  max-width: 100%;
  margin: 1.25rem 0 0;
}

.picture canvas {
  display: block;
  max-width: 100%;
  max-height: 30rem;
  border-radius: 0.5rem;
}

.regions {
  position: absolute;
  inset: 0;
}

.region {
  position: absolute;
  border: 2px solid var(--accent);
  border-radius: 0.25rem;
}

.region span {
  position: absolute;
  bottom: 100%;
  left: -2px;
  padding: 0 0.375rem;
  border-radius: 0.25rem;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.75rem;
  font-weight: 550;
  white-space: nowrap;
}
