:root {
  color-scheme: dark;
  --bg: #111b21;
  --panel: #202c33;
  --line: #2a3942;
  --muted: #a0b2b9;
  --green: #28d3a3;
  --text: #edf3f4;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--bg);
  font:
    16px/1.35 -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  color: var(--text);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}
button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
  border: none;
  outline-offset: 2px;
  border-radius: 13px;
}
button {
  background: var(--panel);
  padding: 10px 13px;
  cursor: pointer;
  min-height: 42px;
}
button:active {
  filter: brightness(1.35);
}
button:disabled {
  opacity: 0.45;
}
input,
textarea,
select {
  background: var(--panel);
  width: 100%;
  padding: 12px 14px;
  min-width: 0;
}
button.primary {
  background: var(--green);
  color: #06261d;
  font-weight: 700;
}
small,
p {
  color: var(--muted);
}
h1,
h2,
h3,
p {
  margin: 0;
}
h1 {
  letter-spacing: -1px;
  font-size: 34px;
}
h2 {
  font-size: 27px;
  letter-spacing: -0.7px;
}
h3 {
  font-size: 17px;
}
#login {
  height: 100%;
  display: grid;
  place-items: center;
  overflow: auto;
}
#auth {
  display: grid;
  gap: 12px;
  width: min(410px, 100%);
  padding: 32px;
  text-align: center;
}
#extra {
  display: grid;
  gap: 10px;
  text-align: left;
}
#extra label {
  color: var(--muted);
  font-size: 14px;
}
.logo {
  margin: auto;
  width: 78px;
}
#auth p {
  margin: -6px 0 14px;
}
#auth small {
  margin-top: 20px;
}
main {
  display: grid;
  grid-template-columns: minmax(290px, 32%) 1fr;
  height: 100%;
  padding-top: env(safe-area-inset-top);
}
aside,
section {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
  position: relative;
}
aside {
  border-right: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
header,
#controls,
.line {
  display: flex;
  align-items: center;
  gap: 8px;
}
header {
  padding: 12px 14px;
  min-height: 66px;
  background: var(--bg);
}
.stretch {
  flex: 1;
  min-width: 0;
}
h3,
.ellipsis,
.person strong,
.person small,
.quote strong,
.quote span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
header small {
  display: block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search {
  padding: 3px 13px 10px;
}
.search input {
  font-size: 15px;
}
#people {
  overflow: auto;
  flex: 1;
}
.person {
  display: flex;
  width: 100%;
  align-items: center;
  text-align: left;
  gap: 12px;
  padding: 12px 14px;
  background: none;
  border-radius: 0;
  border-bottom: 1px solid #1b292f;
}
.person.active {
  background: #213a3a;
}
.person small {
  margin-top: 3px;
}
.person strong {
  font-weight: 600;
}
.avatar,
#profile {
  background: #164d42;
  color: #8decce;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-weight: bold;
  width: 46px;
  height: 46px;
  flex: none;
  overflow: hidden;
  padding: 0;
}
.avatar img,
#profile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.unread {
  background: var(--green);
  color: #06251d;
  padding: 3px 8px;
  border-radius: 14px;
  font-size: 13px;
}
#empty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: #101618;
  color: var(--muted);
  z-index: 2;
}
#back {
  display: none;
}
#messages {
  flex: 1;
  overflow: auto;
  overscroll-behavior: contain;
  background: #101010;
  padding: 8px 13px;
  scrollbar-width: thin;
}
.day {
  margin: 12px auto;
  width: max-content;
  background: #202020;
  color: #bdc9c9;
  border-radius: 10px;
  padding: 3px 10px;
  font-size: 12px;
}
.bubble {
  background: #262626;
  padding: 6px 9px;
  max-width: 84%;
  width: fit-content;
  border-radius: 15px 15px 15px 4px;
  margin: 5px 0;
  overflow-wrap: anywhere;
  cursor: pointer;
}
.mine {
  margin-left: auto;
  background: #144d39;
  border-radius: 15px 15px 4px 15px;
}
.body {
  white-space: pre-wrap;
}
.meta {
  display: block;
  text-align: right;
  color: #a8bbb6;
  font-size: 11.5px;
  padding: 1px 0 0 8px;
}
.read {
  color: #66ccf0;
}
.bubble .name {
  color: #79cfed;
  font-size: 13px;
  font-weight: bold;
}
.bubble .forward {
  font-size: 13px;
  color: #b5d6cc;
  font-style: italic;
}
.picture {
  display: block;
  max-width: 100%;
  width: 340px;
  max-height: 380px;
  object-fit: cover;
  border-radius: 10px;
  margin: 3px 0;
}
.reactions {
  font-size: 14px;
  padding-top: 2px;
}
.quote {
  display: flex;
  align-items: center;
  min-width: 140px;
  gap: 9px;
  background: #191b1c;
  border-radius: 10px;
  border-left: 4px solid currentColor;
  overflow: hidden;
  color: #73d5ff;
  margin: 0 -4px 4px;
  cursor: pointer;
}
.quote.self {
  color: #ffd279;
}
.mine .quote {
  background: #103b2e;
}
.quote div {
  flex: 1;
  min-width: 0;
  padding: 8px 10px;
}
.quote span {
  font-size: 14px;
  color: #d1dcdb;
  margin-top: 3px;
}
.quote img {
  width: 52px;
  height: 58px;
  object-fit: cover;
}
#draft .quote {
  flex: 1;
  min-width: 0;
  background: #101010;
  margin: 0;
  border-radius: 0;
}
#draft .line {
  margin-bottom: 7px;
}
footer {
  padding: 8px 10px max(10px, env(safe-area-inset-bottom));
  background: var(--bg);
}
#text {
  resize: none;
  border-radius: 21px;
  max-height: 110px;
  line-height: 22px;
  flex: 1;
}
#controls button,
#dismiss,
#back {
  border-radius: 50%;
  width: 42px;
  height: 42px;
  padding: 0;
  font-size: 24px;
}
#send {
  font-size: 19px !important;
}
#emojis {
  display: grid;
  grid-template-rows: repeat(6, 38px);
  grid-auto-flow: column;
  grid-auto-columns: 38px;
  gap: 1px;
  overflow: auto;
  margin-top: 8px;
  justify-content: safe center;
}
#emojis button {
  font-size: 30px;
  height: 38px;
  min-height: 38px;
  padding: 0;
  background: none;
}
dialog {
  background: var(--bg);
  border: 1px solid var(--line);
  color: inherit;
  border-radius: 19px;
  padding: 0;
  width: min(450px, 96vw);
  max-height: 88dvh;
}
dialog::backdrop {
  background: #000a;
}
dialog header {
  position: sticky;
  top: 0;
  z-index: 1;
}
article {
  padding: 4px 14px 16px;
  display: grid;
  gap: 9px;
  overflow-wrap: anywhere;
}
article label {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 7px;
}
input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--green);
}
article img {
  max-width: 100%;
  max-height: 62dvh;
  display: block;
  margin: auto;
}
article p {
  font-size: 14px;
  white-space: pre-line;
}
#toast {
  position: fixed;
  bottom: 12%;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 16px;
  border-radius: 10px;
  background: #e7f6f0;
  color: #11302b;
  z-index: 10;
  max-width: 92%;
  box-shadow: 0 4px 20px #0004;
}
.warn {
  color: #ff9c9c;
}
.flash {
  animation: flash 1.5s;
}
@keyframes flash {
  0%,
  50% {
    box-shadow: 0 0 0 3px var(--green);
  }
}
@media (max-width: 740px) {
  main {
    display: block;
  }
  aside,
  section {
    width: 100%;
    height: 100%;
  }
  main.chat aside,
  main:not(.chat) section {
    display: none;
  }
  #back {
    display: block;
    font-size: 32px;
  }
  header {
    padding: 10px;
  }
  #controls {
    gap: 5px;
  }
  #messages {
    padding: 7px 10px;
  }
  #controls button {
    width: 37px;
    height: 37px;
    min-height: 37px;
  }
  #text {
    padding: 9px 12px;
  }
  .bubble {
    max-width: 86%;
  }
}

.file-name {
  display: block;
  font-size: 15px;
  margin: 2px 0 4px;
}
.bubble button {
  margin: 4px 0;
  background: #0003;
  color: #7ce0c4;
  font-size: 14px;
  min-height: 35px;
  padding: 7px 12px;
}
textarea:focus,
input:focus {
  outline: 1px solid #388d78;
}
