:root {
  color-scheme: light;
  --ink: #102033;
  --blue: #2563eb;
  --line: rgba(111, 130, 151, 0.24);
  --paper: #eef4f8;
  font-family: 'Plus Jakarta Sans', 'Segoe UI', sans-serif;
  color: var(--ink);
  background: linear-gradient(130deg, #eef7f6, #eff3fa 65%, #fbf8ef);
}
* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
}
main {
  max-width: 1080px;
  height: 100dvh;
  margin: auto;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-inline: 1px solid var(--line);
}
header {
  display: flex;
  align-items: center;
  gap: 14px;
  background: rgba(255, 255, 255, 0.9);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  padding: 16px 24px;
  position: relative;
  z-index: 2;
}
header h1 {
  font:
    800 1.4rem 'Bricolage Grotesque',
    'Segoe UI',
    sans-serif;
  margin: 0;
}
header p {
  margin: 2px 0 0;
  color: #52657a;
  font-size: 0.88rem;
}
.mark {
  font-weight: 800;
  color: white;
  background: linear-gradient(135deg, #2563eb, #0f9f8f);
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
}
button,
summary,
#owner {
  font: inherit;
  cursor: pointer;
  color: var(--blue);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 13px;
}
button:hover,
summary:hover {
  filter: brightness(0.95);
}
:focus-visible {
  outline: 3px solid #2563eb;
  outline-offset: 2px;
}
button:disabled {
  opacity: 0.55;
}
details {
  margin-left: auto;
}
details section {
  position: absolute;
  right: 14px;
  top: calc(100% - 5px);
  width: min(310px, 95vw);
  background: white;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--ink);
  box-shadow: 0 6px 25px #19332a22;
  display: grid;
  gap: 10px;
}
details label {
  font-size: 0.85rem;
}
details input {
  width: 100%;
  margin: 5px 0;
  padding: 7px;
}
.danger {
  color: #aa193b;
}
#gate,
#boot {
  margin: auto;
  padding: 32px;
  text-align: center;
}
#owner {
  display: inline-block;
  text-decoration: none;
}
#chat {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}
#thread {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 18px 24px;
  background:
    radial-gradient(at 15% 15%, #dcefeb, transparent 52%), linear-gradient(135deg, #f6f9fc, #eaf0fb);
}
#older,
#empty {
  display: block;
  margin: 10px auto;
  text-align: center;
}
#messages {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.msg {
  max-width: 88%;
  align-self: flex-start;
  border-radius: 8px;
  line-height: 1.55;
  background: #fff;
  padding: 10px 14px;
  border: 1px solid var(--line);
  overflow-wrap: anywhere;
  min-width: 5.5em;
}
.msg.mine {
  align-self: flex-end;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  color: #fff;
  border-color: transparent;
}
.msg p {
  white-space: pre-wrap;
  margin: 0;
}
.msg time {
  display: block;
  font-size: 0.72rem;
  color: #52657a;
  margin-top: 5px;
}
.msg a {
  display: block;
  color: #1e55aa;
  margin-top: 5px;
}
.msg img {
  display: block;
  max-height: 230px;
  max-width: 100%;
  object-fit: contain;
  border-radius: 6px;
}
#compose {
  border-top: 1px solid var(--line);
  padding: 12px 20px max(12px, env(safe-area-inset-bottom));
  background: #fbfdff;
}
.composer,
.foot,
#selection {
  display: flex;
  gap: 8px;
  align-items: center;
}
.composer textarea {
  flex: 1;
  min-width: 0;
  field-sizing: content;
  resize: none;
  min-height: 44px;
  max-height: min(45dvh, 28rem);
  padding: 10px;
  font: inherit;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
}
#send,
#join {
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #0b7a73);
  border-color: transparent;
}
.clip {
  position: relative;
  display: grid;
  place-items: center;
  cursor: pointer;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: 1.55rem;
  width: 40px;
  height: 40px;
}
.clip input {
  opacity: 0;
  position: absolute;
  inset: 0;
  width: 100%;
  cursor: pointer;
}
.clip:focus-within {
  outline: 2px solid #2563eb;
}
.foot {
  justify-content: space-between;
  color: #52657a;
  margin-top: 5px;
}
.foot small:last-child {
  white-space: nowrap;
}
#selection {
  margin-bottom: 8px;
  font-size: 0.9rem;
  overflow-wrap: anywhere;
}
#remove {
  padding: 2px 7px;
}
@media (max-width: 520px) {
  header {
    padding: 12px 14px;
  }
  #thread {
    padding: 12px;
  }
  #compose {
    padding-inline: 10px;
  }
  .msg {
    max-width: 92%;
  }
  .composer {
    gap: 5px;
  }
  #send {
    padding: 10px 7px;
  }
}

.sender {
  display: block;
  font-size: 0.78rem;
  margin-bottom: 3px;
}
.msg.mine time,
.msg.mine a {
  color: white;
}
.msg time {
  text-align: right;
}
.msg {
  box-shadow: 0 6px 18px #2532420d;
}
.composer button,
summary,
.clip {
  font-weight: 700;
}
.clip {
  height: 44px;
  width: 44px;
}
.foot {
  min-height: 22px;
}
