:root {
  color-scheme: dark;
  --ink: #f1ede4;
  --muted: #afa9a0;
  --edge: #3b3a37;
  --amber: #edc080;
  --teal: #a6d3bd;
  font-family: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
  font-size: 16px;
  background: #171919;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
button, textarea { font: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--amber); outline-offset: 3px; }
button:disabled, textarea:disabled { cursor: default; }
.masthead {
  border-bottom: 1px solid var(--edge);
  background: #1c1e1e;
}
.masthead-inner, main {
  width: min(100% - 3rem, 54rem);
  margin-inline: auto;
}
.masthead-inner {
  min-height: 4.3rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: .75rem;
  font: 1.95rem/1 "Hedvig Letters Serif", Georgia, serif;
  letter-spacing: -.05em;
}
.lamp {
  position: relative;
  display: inline-block;
  width: .96rem;
  height: 1.12rem;
  border: 1.5px solid var(--amber);
  border-radius: 3px 3px 5px 5px;
  background: radial-gradient(ellipse at 50% 75%, #f5ce88 9%, #b77839 19%, #674932 40%, transparent 66%);
  box-shadow: 0 0 11px #eab16423;
}
.lamp::before {
  content: "";
  position: absolute;
  width: .37rem;
  height: .32rem;
  left: calc(50% - .25rem);
  top: -.48rem;
  border: 1.3px solid var(--amber);
  border-bottom: none;
  border-radius: .3rem .3rem 0 0;
}
.lamp::after {
  content: "";
  position: absolute;
  inset: auto -.16rem -.16rem;
  height: 2px;
  background: var(--amber);
}
.connection, .worker, time, .older, #jump, .send-row { font-size: .82rem; }
.connection {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  color: var(--muted);
}
.connection i { width: .48rem; height: .48rem; border-radius: 50%; background: currentColor; }
.room-actions { display: flex; align-items: center; gap: clamp(.55rem, 3vw, 1.15rem); }
#sign-out {
  font-size: .86rem; padding: .45rem .7rem; color: var(--ink);
  border: 1px solid var(--edge); border-radius: .45rem; background: transparent;
}
#sign-out:hover { border-color: var(--muted); }
.sign-in { justify-content: flex-start; padding-top: clamp(2.5rem, 12vh, 7rem); }
.sign-in-card {
  width: min(100%, 24rem); margin-inline: auto;
  padding: clamp(1.2rem, 4vw, 2rem); border: 1px solid var(--edge);
  border-radius: .85rem; background: #202222;
}
.sign-in-card h1 { margin-bottom: 1.5rem; }
.sign-in-card label { display: block; margin-bottom: .45rem; font-size: .93rem; }
.sign-in-card input {
  width: 100%; padding: .65rem .75rem; color: var(--ink); border: 1px solid #625f59;
  border-radius: .45rem; background: #171919; font: inherit;
}
.sign-in-card button {
  width: 100%; margin-top: 1.15rem; padding: .65rem; border: 0; border-radius: .45rem;
  color: #302313; background: var(--amber); font-weight: 650;
}
.sign-in-card button:disabled { opacity: .65; }
#login-error { margin: .8rem 0 0; color: #f2b2a1; font-size: .9rem; }
#login-error:empty { margin: 0; }
.connection[data-state="live"] i { background: var(--teal); }
.connection[data-state="offline"], .connection[data-state="locked"] { color: #edbb99; }
main { display: flex; flex: 1; min-height: 0; flex-direction: column; padding-bottom: max(1.15rem, env(safe-area-inset-bottom)); }
.room-heading { display: flex; align-items: baseline; gap: .8rem; justify-content: space-between; padding: 1.45rem 0 1rem; border-bottom: 1px solid var(--edge); }
h1 { margin: 0; font: normal clamp(1.6rem, 4vw, 2rem)/1.2 "Hedvig Letters Serif", Georgia, serif; letter-spacing: -.035em; }
.worker { text-align: right; color: var(--muted); }
.worker[data-state="working"] { color: var(--amber); }
#review-inbox, .review-buttons button {
  color: var(--amber); background: #2b2924; border: 1px solid #756248;
  border-radius: .43rem; padding: .4rem .7rem; font-weight: 600;
}
#review-inbox { margin-left: auto; font-size: .84rem; }
#review-notice { margin: 0; color: var(--muted); font-size: .85rem; }
#review-notice:not(:empty) { margin-top: .5rem; }
#review-dialog {
  width: min(32rem, calc(100% - 2rem)); max-height: calc(100dvh - 2rem);
  padding: 1.25rem; border: 1px solid #756248; border-radius: .8rem;
  background: #242625; color: var(--ink); box-shadow: 0 .8rem 4rem #0007;
}
#review-dialog::backdrop { background: #080b0bc9; }
#review-title { margin: 0; font: normal 1.6rem/1.2 "Hedvig Letters Serif", Georgia, serif; }
#review-about { margin: .5rem 0 1rem; color: var(--muted); }
.review-details { padding: .8rem; margin-bottom: 1rem; border-left: 2px solid var(--amber); background: #1d201f; overflow-wrap: anywhere; }
.review-meta { display: flex; flex-wrap: wrap; justify-content: space-between; gap: .5rem; align-items: baseline; margin-bottom: .55rem; color: var(--muted); font-size: .78rem; }
.review-details strong, #review-form label { font-size: .82rem; }
#review-action { display: block; margin-top: .25rem; color: var(--muted); white-space: pre-wrap; }
#review-evidence { margin-top: .7rem; }
#review-excerpt { margin: .25rem 0 0; line-height: 1.4; white-space: pre-wrap; font-size: .92rem; }
#review-question { line-height: 1.45; white-space: pre-wrap; margin: .65rem 0 0; }
#review-answer { min-height: 4rem; margin: .35rem 0 .6rem; padding: .55rem; border: 1px solid var(--edge); border-radius: .4rem; background: #191c1b; }
#review-error { margin: 0; color: #fac3a3; font-size: .85rem; }
.review-buttons { display: flex; justify-content: flex-end; gap: .55rem; margin-top: .4rem; }
#review-next { margin-right: auto; color: var(--muted); background: transparent; border-color: var(--edge); }
#review-submit { color: #282018; background: var(--amber); border-color: transparent; }
#review-submit:disabled { color: #b8b0a3; background: #514b40; }
.history { flex: 1; min-height: 0; overflow: auto; scrollbar-color: #595b57 transparent; scrollbar-width: thin; padding: 1.2rem .7rem 1rem .15rem; overflow-anchor: none; }
.empty { margin: 3rem auto; text-align: center; color: var(--muted); }
.older, #jump {
  display: block;
  color: var(--amber);
  background: #242624;
  border: 1px solid #51483b;
  border-radius: 2rem;
  padding: .42rem .9rem;
}
.older { margin: 0 auto 1.5rem; }
.jump-wrap { position: relative; height: 0; }
#jump { position: absolute; bottom: .65rem; left: 50%; transform: translateX(-50%); white-space: nowrap; box-shadow: 0 3px 14px #141414; }
.older:hover, #jump:hover { background: #37342e; }
.message { max-width: min(94%, 44rem); margin: 0 0 1rem; }
.message header { display: flex; align-items: baseline; gap: .65rem; padding-bottom: .3rem; }
.speaker { font-size: .84rem; font-weight: 650; color: var(--amber); }
time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: .74rem; }
.message .body { overflow-wrap: anywhere; white-space: pre-wrap; line-height: 1.55; }
.message.operator { margin-left: auto; width: fit-content; max-width: 88%; padding: .75rem 1rem .85rem; border: 1px solid #35433e; border-radius: .8rem .2rem .8rem .8rem; background: #202b27; }
.operator .speaker { color: var(--teal); }
.message.system { border-left: 2px solid #696356; padding-left: .9rem; color: var(--muted); font-size: .87rem; }
.system .speaker { color: var(--muted); }
.body pre { tab-size: 4; overflow: auto; padding: .8rem; margin: .5rem 0; background: #111414; border: 1px solid var(--edge); white-space: pre; border-radius: .4rem; }
.body code { font: .88em/1.5 "IBM Plex Mono", Consolas, monospace; }
.lantern .body { white-space: normal; }
.lantern .body :where(p, ul, ol, blockquote, pre, h1, h2, h3, h4, h5, h6, hr) { margin: 0; }
.lantern .body > * + *,
.lantern .body blockquote > * + * { margin-top: .45rem; }
.lantern .body :is(h1, h2, h3, h4, h5, h6) { font-family: inherit; font-size: 1.06em; font-weight: 650; line-height: 1.35; letter-spacing: normal; }
.lantern .body :is(h1, h2) { font-size: 1.18em; }
.lantern .body :is(ol, ul) { padding-inline-start: 1.75em; }
.lantern .body li + li { margin-top: .15em; }
.lantern .body blockquote { padding-inline-start: .85em; border-inline-start: 2px solid #726451; color: #d0c9bc; }
.lantern .body hr { border: 0; border-top: 1px solid var(--edge); }
.lantern .body a { color: var(--amber); text-underline-offset: .13em; }
.lantern .body :not(pre) > code { padding: .05em .28em; border-radius: .25em; background: #2b2d2b; color: #e6d4b8; }
.lantern .table-scroll { max-width: 100%; overflow-x: auto; }
.lantern table { border-collapse: collapse; font-size: .94em; }
.lantern :is(th, td) { padding: .25em .65em; border: 1px solid var(--edge); text-align: start; }
.lantern th { background: #242624; }
#composer { flex: none; margin-top: .35rem; padding: .8rem .95rem .65rem; background: #252726; border: 1px solid #514c43; border-radius: .8rem; }
#composer:focus-within { border-color: #a88653; }
#composer label { font-size: .83rem; font-weight: 600; }
.image-draft { display: flex; align-items: center; gap: .6rem; width: fit-content; max-width: 100%; margin: .45rem 0 .1rem; padding: .25rem .4rem .25rem .25rem; background: #1c211f; border: 1px solid #46524b; border-radius: .45rem; }
#image-preview { height: 2.7rem; width: 3.5rem; object-fit: contain; background: #151817; border-radius: .25rem; }
.image-details { min-width: 0; font-size: .8rem; line-height: 1.35; }
.image-details strong, .image-details span { display: block; }
.image-details strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.image-details span { color: var(--muted); }
#image-remove, #attach, #image-close { flex: none; border: 1px solid var(--edge); background: #262b28; color: var(--teal); border-radius: .43rem; }
#image-remove { border: 0; background: transparent; font-size: 1.25rem; padding: .25rem .45rem; color: var(--muted); }
#attach { width: 2.25rem; height: 2.15rem; padding: 0; font-size: 1.35rem; line-height: 1; }
#attach:hover:enabled, #image-close:hover { border-color: var(--teal); }
#attach:disabled, #image-remove:disabled { opacity: .5; }
#send-state { flex: 1; }
.message-image { display: block; max-width: 100%; margin: .25rem 0 .35rem; padding: 0; border: 1px solid #46524b; background: #181c1a; color: var(--muted); border-radius: .4rem; overflow: hidden; cursor: zoom-in; }
.message-image img { display: block; max-width: 100%; object-fit: contain; }
.message-image span { display: block; padding: .55rem .8rem; font-size: .8rem; }
#image-dialog { max-width: calc(100vw - 2rem); max-height: calc(100dvh - 2rem); margin: auto; padding: .65rem; background: #1c201e; border: 1px solid #516057; border-radius: .65rem; }
#image-dialog::backdrop { background: #0a0c0bea; }
#image-close { display: block; margin: 0 0 .5rem auto; padding: .3rem .65rem; font-size: .85rem; }
#image-full { display: block; max-width: 100%; max-height: calc(100dvh - 7rem); object-fit: contain; margin: auto; }
textarea { width: 100%; border: none; outline: none; background: transparent; color: var(--ink); resize: vertical; min-height: 2.8rem; max-height: 18vh; padding: .45rem 0; }
textarea::placeholder { color: #a09e96; }
.send-row { display: flex; justify-content: space-between; align-items: center; gap: .6rem; color: var(--muted); min-height: 2.12rem; }
#send-state[data-error="true"] { color: #fac3a3; }
#send { flex: none; color: #282018; border: 1px solid transparent; background: var(--amber); border-radius: .43rem; padding: .38rem .85rem; font-weight: 650; }
#send span { margin-left: .3rem; }
#send:hover:enabled { background: #fbd293; }
#send:disabled { background: #514b40; color: #b8b0a3; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
@media (max-width: 600px) {
  .masthead-inner, main { width: calc(100% - 1.7rem); }
  .masthead-inner { min-height: 3.4rem; }
  .brand { font-size: 1.66rem; }
  .room-heading { padding: .95rem 0 .65rem; }
  .history { padding-top: .9rem; padding-right: .2rem; }
  .message { max-width: 97%; }
  main { padding-bottom: max(.65rem, env(safe-area-inset-bottom)); }
  #composer { padding: .6rem .75rem; }
}
@media (max-height: 520px) {
  .masthead-inner { min-height: 2.5rem; }
  .room-heading { padding-block: .4rem; }
  h1 { font-size: 1.3rem; }
  textarea { height: 2.3rem; min-height: 2.3rem; }
}
