:root {
  font:
    16px/1.45 system-ui,
    sans-serif;
  color: #173b34;
  background: #f6f8f5;
  --accent: #147563;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
[hidden] {
  display: none !important;
}
button,
input,
textarea,
select {
  font: inherit;
}
button {
  border: 0;
  background: #e8f0eb;
  color: #19483d;
  border-radius: 12px;
  padding: 0.58em 0.85em;
  cursor: pointer;
}
button:disabled {
  opacity: 0.5;
}
button:hover {
  filter: brightness(0.96);
}
button:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 3px solid #e3a236;
}
.primary {
  background: var(--accent);
  color: white;
  font-weight: 650;
}
input,
textarea,
select {
  width: 100%;
  border: 1px solid #c5d6cd;
  border-radius: 12px;
  padding: 11px;
  background: white;
}
label {
  display: grid;
  gap: 4px;
  font-weight: 550;
}
form,
.stack {
  display: grid;
  gap: 12px;
}
h1,
h2,
p {
  margin: 0.35em 0;
}
.brand {
  background: #f1bb61;
  color: #163a32;
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  font-size: 19px;
  letter-spacing: -2px;
}
#login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: linear-gradient(145deg, #e0eee6, #faf6ec);
}
.auth {
  width: min(370px, 100%);
  padding: 27px;
  background: #fff;
  border-radius: 23px;
  box-shadow: 0 12px 50px #123d3614;
}
.auth form {
  margin: 20px 0 12px;
}
.auth p,
small {
  color: #56746b;
}
#workspace {
  height: 100dvh;
  display: grid;
  grid-template-columns: 300px 1fr;
}
aside {
  background: #fff;
  border-right: 1px solid #d7e1da;
  overflow: auto;
}
header,
.title,
#compose {
  display: flex;
  align-items: center;
  gap: 8px;
}
header {
  padding: 10px 14px;
  background: #123d36;
  color: #fff;
  min-height: 64px;
}
header button {
  background: #ffffff16;
  color: white;
}
.right,
.title button:last-child {
  margin-left: auto;
}
.side {
  padding: 15px;
}
.side input {
  margin: 8px 0 13px;
}
.room {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  text-align: left;
  background: transparent;
  margin: 3px 0;
}
.room.current {
  background: #dcefe5;
}
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 39px;
  height: 39px;
  object-fit: cover;
  background: #d5e7dc;
  color: #18513d;
  border-radius: 14px;
  font-weight: 700;
}
.headname {
  min-width: 0;
  flex: 1;
}
.headname strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.headname small {
  display: block;
  color: #b7d3c8;
}
article,
#thread,
#history {
  min-height: 0;
  min-width: 0;
}
#empty {
  display: grid;
  height: 100%;
  place-items: center;
  color: #6a8077;
}
#thread {
  height: 100%;
  display: flex;
  flex-direction: column;
}
#history {
  flex: 1;
  overflow: auto;
  padding: 15px;
  overscroll-behavior: contain;
}
#older {
  display: block;
  margin: auto;
}
.msg {
  display: table;
  max-width: 83%;
  margin: 9px 0;
  padding: 9px 12px;
  background: #fff;
  border: 1px solid #d9e6dd;
  border-radius: 15px;
  overflow-wrap: anywhere;
}
.msg.mine {
  margin-left: auto;
  background: color-mix(in srgb, var(--accent) 12%, white);
}
.msg small,
.msg footer {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #526e64;
}
.msg footer {
  justify-content: flex-end;
}
.msg button {
  padding: 3px 8px;
  margin: 2px;
}
.msg p {
  white-space: pre-wrap;
}
.msg img,
.msg video,
.album img {
  max-width: 100%;
  max-height: 235px;
  border-radius: 10px;
}
.msg audio {
  width: min(245px, 64vw);
}
blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 7px;
  margin: 4px 0;
  color: #54766a;
}
.choices {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
  margin: 8px 0;
}
#compose {
  background: white;
  padding: 9px;
  border-top: 1px solid #dae4dd;
}
#body {
  resize: none;
  min-width: 0;
}
#context {
  padding: 7px 15px;
  background: #fff0c9;
}
#back {
  display: none;
}
dialog {
  border: 0;
  border-radius: 19px;
  width: min(440px, 95vw);
  max-height: 85dvh;
  overflow: auto;
  color: inherit;
  box-shadow: 0 15px 60px #071c3240;
}
dialog::backdrop {
  background: #082b2466;
}
#mc {
  margin-top: 12px;
}
#mc button {
  margin: 3px;
}
#mc img {
  max-width: 100%;
}
#mc canvas {
  max-width: 100%;
}
#notice {
  position: fixed;
  bottom: 76px;
  left: 50%;
  transform: translateX(-50%);
  padding: 9px 15px;
  border-radius: 12px;
  background: #213e36;
  color: #fff;
  z-index: 10;
  pointer-events: none;
}
#notice:empty {
  display: none;
}
#calling {
  position: fixed;
  inset: 0;
  background: #0d2924;
  color: white;
  padding: 14px;
  z-index: 5;
  overflow: auto;
}
#tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(135px, 1fr));
  gap: 8px;
}
#tiles video {
  width: 100%;
  max-height: 48vh;
  border-radius: 15px;
  background: #25453c;
}
#tiles figure {
  margin: 0;
}
#controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
a {
  color: #00685b;
}
.danger {
  background: #ac3339;
  color: white;
}
@media (max-width: 720px) {
  #workspace {
    display: block;
  }
  aside,
  article {
    height: 100%;
  }
  article {
    display: none;
  }
  body.inroom aside {
    display: none;
  }
  body.inroom article {
    display: block;
  }
  #back {
    display: block;
  }
  header {
    padding: 8px;
    gap: 5px;
  }
  .msg {
    max-width: 88%;
  }
  #compose {
    gap: 4px;
    padding: 6px;
  }
  #compose button {
    padding: 9px;
  }
}
.msg:has(.sticker) p,
.msg[data-kind="sticker"] p {
  font-size: 52px;
  animation: bounce 0.8s ease infinite alternate;
}
@keyframes bounce {
  to {
    transform: translateY(-4px) rotate(5deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .msg[data-kind="sticker"] p {
    animation: none;
  }
}
.stickergrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
}
.stickergrid button {
  padding: 4px;
}
.stickergrid img {
  width: 65px;
  display: block;
}
.msg[data-kind="sticker"] p:has(img) {
  animation: none;
  font-size: 1em;
}
