:root {
  color-scheme: light;
  --paper: #f8f7f0;
  --card: #fffefa;
  --ink: #172c25;
  --muted: #55645c;
  --green: #103e32;
  --line: #d5d9cf;
  --accent: #b14818;
  font:
    16px/1.5 "Inter",
    system-ui,
    sans-serif;
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}
button,
select {
  cursor: pointer;
}
button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.4rem 0.8rem;
  background: var(--card);
  font-size: 0.88rem;
  font-weight: 600;
}
button:hover {
  border-color: var(--green);
}
button:disabled {
  opacity: 0.55;
  cursor: default;
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible {
  outline: 3px solid #b45e29;
  outline-offset: 2px;
}
.primary {
  color: white;
  background: var(--green);
  border-color: var(--green);
  padding: 0.64rem 1.3rem;
}
.quiet {
  background: transparent;
}
.masthead {
  background: var(--green);
  color: var(--card);
  padding-top: env(safe-area-inset-top);
}
.bar,
.room-head,
#composer,
.signin {
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
}
.bar {
  max-width: 58rem;
  width: 100%;
  height: 60px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.wordmark {
  display: flex;
  align-items: center;
  font-family: Georgia, serif;
  font-size: 1.6rem;
  letter-spacing: -0.055em;
  font-weight: bold;
}
.wordmark img {
  margin-right: 0.35rem;
}
.wordmark span {
  font: 500 0.85rem/1 system-ui;
  letter-spacing: 0.03em;
  margin-left: 0.6rem;
  border-left: 1px solid #668877;
  padding-left: 0.6rem;
}
.bar button {
  color: white;
  border-color: #5b7d70;
  background: transparent;
}
#status {
  min-height: 24px;
  color: var(--green);
  background: #e3e9dc;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.15rem 0.7rem;
}
#status.warn {
  background: #ffead4;
  color: #68300f;
}
main {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
}
.signin {
  margin: auto auto;
  max-width: 28rem;
  width: 100%;
  overflow: auto;
  max-height: 100%;
  padding-top: 1rem;
  padding-bottom: 2rem;
}
.login-mark img {
  border-radius: 16px;
}
h1,
h2 {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: -0.045em;
  line-height: 1.15;
  margin: 0;
  font-weight: 600;
}
.signin h1 {
  font-size: clamp(2.3rem, 8vw, 3.1rem);
  margin-top: 1.1rem;
}
p {
  margin: 0.7rem 0 1rem;
  color: var(--muted);
}
form {
  display: grid;
  gap: 0.65rem;
}
label,
.minor {
  font-size: 0.8rem;
  font-weight: 650;
}
input,
select,
textarea {
  border: 1px solid #aeb9ad;
  border-radius: 8px;
  padding: 0.65rem;
  background: white;
  max-width: 100%;
  min-width: 0;
}
input {
  width: 100%;
}
#code-step input {
  letter-spacing: 0.3em;
}
.room {
  width: 100%;
  max-width: 58rem;
  background: var(--card);
  border-inline: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.room-head {
  display: flex;
  align-items: center;
  gap: 1rem;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
  padding-block: 0.9rem;
  flex-wrap: wrap;
}
.minor {
  color: var(--muted);
}
.room-head h1 {
  font-size: clamp(1.55rem, 5vw, 2.4rem);
  overflow-wrap: anywhere;
}
.room-tools {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.room-tools select {
  font-size: 0.85rem;
  max-width: 9rem;
  min-height: 40px;
}
#stream {
  overflow: auto;
  overscroll-behavior: contain;
  flex: 1;
  min-height: 0;
  padding: 1rem max(16px, 3%);
  scrollbar-gutter: stable;
}
#messages,
.results {
  list-style: none;
  padding: 0;
  margin: 0;
}
.entry {
  padding: 0.7rem 0;
  border-bottom: 1px solid #edf0e8;
  overflow-wrap: anywhere;
}
.entry:last-child {
  border-bottom: 0;
}
.meta {
  display: flex;
  align-items: baseline;
  gap: 0.65rem;
  flex-wrap: wrap;
}
.who {
  font-size: 0.88rem;
  font-weight: 700;
}
.stamp {
  font-size: 0.7rem;
  color: var(--muted);
}
.entry p {
  white-space: pre-wrap;
  color: var(--ink);
  margin: 0.2rem 0;
}
.entry .reply-action,
.entry .link-button {
  min-height: 28px;
  padding: 0 0.12rem;
  border: 0;
  background: transparent;
  font-size: 0.76rem;
  color: var(--muted);
  text-decoration: underline;
}
.entry.robot,
.entry.selection,
.entry.correction {
  margin: 0.6rem 0;
  padding: 0.85rem 1rem;
  border-radius: 9px;
  background: #edf1ec;
  border: 1px solid #d3ded2;
}
.entry.selection,
.entry.correction {
  background: #f8f1de;
  border-color: #decda1;
  border-left: 4px solid #ad6224;
}
.kind {
  font-size: 0.72rem;
  color: #774519;
  font-weight: bold;
}
.robot .kind {
  color: var(--green);
}
#composer {
  border-top: 1px solid var(--line);
  padding-block: 0.75rem max(0.7rem, env(safe-area-inset-bottom));
  background: var(--paper);
}
#send-form {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
}
textarea {
  flex: 1;
  resize: vertical;
  max-height: 20dvh;
  min-height: 44px;
  line-height: 1.4;
}
#compose-help {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.35rem;
}
#reply-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem;
  margin-bottom: 0.4rem;
  border-left: 3px solid var(--green);
  font-size: 0.8rem;
}
#reply-bar button,
#discard {
  font-size: 0.72rem;
  min-height: 32px;
}
dialog {
  width: min(32rem, calc(100% - 1.4rem));
  max-height: 85dvh;
  overflow: auto;
  color: var(--ink);
  background: var(--card);
  padding: 1.15rem;
  border: 1px solid var(--line);
  border-radius: 12px;
}
dialog::backdrop {
  background: #112d24a6;
}
.dialog-head,
.setting,
.session,
.action-row {
  display: flex;
  gap: 0.65rem;
  align-items: center;
  justify-content: space-between;
}
.dialog-head {
  margin-bottom: 1rem;
}
h2 {
  font-size: 1.65rem;
}
.setting,
.session {
  padding: 0.65rem 0;
  border-top: 1px solid var(--line);
}
.setting input {
  width: 1.3rem;
  height: 1.3rem;
  accent-color: var(--green);
}
#dialog-content section {
  margin: 1rem 0;
}
#dialog-content h3 {
  font-size: 1rem;
  margin: 0.7rem 0 0.35rem;
}
.stack {
  display: grid;
  gap: 0.55rem;
}
.results button {
  text-align: left;
  max-width: 100%;
  overflow-wrap: anywhere;
}
.sr {
  position: absolute;
  clip: rect(0, 0, 0, 0);
  width: 1px;
  height: 1px;
  overflow: hidden;
}
@media (max-width: 540px) {
  .bar {
    height: 48px;
  }
  .room-head {
    padding-block: 0.55rem;
    gap: 0.45rem;
  }
  .room-tools {
    gap: 0.3rem;
  }
  .room-tools button {
    font-size: 0.76rem;
    padding: 0.32rem 0.5rem;
  }
  .room-tools select {
    max-width: 7rem;
  }
  .entry {
    padding: 0.58rem 0;
  }
  #stream {
    padding-top: 0.6rem;
  }
}

#privacy {
  border-top: 1px solid var(--line);
  margin-top: 1.5rem;
  padding-top: 0.75rem;
  color: var(--muted);
  font-size: 0.85rem;
}
summary {
  cursor: pointer;
  font-weight: 650;
  color: var(--ink);
}
