:root {
  color-scheme: dark;
  font-family: Inter, "Noto Sans JP", system-ui, sans-serif;
  background: #070611;
  color: #f3f0ff;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 20% 0, #241058 0, transparent 38%),
    radial-gradient(circle at 90% 20%, #004d59 0, transparent 32%), #070611;
}
main {
  max-width: 1180px;
  margin: auto;
  padding: 28px;
}
header {
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid #634ec0;
  padding-bottom: 20px;
}
.sigil {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  flex: none;
  clip-path: polygon(
    30% 0,
    70% 0,
    100% 30%,
    100% 70%,
    70% 100%,
    30% 100%,
    0 70%,
    0 30%
  );
  background: linear-gradient(135deg, #8e5bff, #16d9d0);
  font-weight: 900;
  color: #090615;
}
h1,
h2,
h3,
p {
  margin: 0.2rem 0;
}
header p,
.hint,
small {
  color: #bcb5d7;
}
.lock {
  margin-left: auto;
  color: #45e6dc;
  border: 1px solid #247f83;
  border-radius: 999px;
  padding: 8px 12px;
  white-space: nowrap;
}
.auth {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  padding: 70px 0;
}
.auth > div,
.chat,
aside {
  padding: 24px;
  border: 1px solid #453878;
  border-radius: 18px;
  background: #100d20db;
}
form {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}
label {
  display: grid;
  gap: 7px;
  color: #d9d3ee;
  font-size: 0.9rem;
}
input,
textarea {
  width: 100%;
  border: 1px solid #4e4277;
  border-radius: 10px;
  background: #090713;
  color: #fff;
  padding: 13px;
  font: inherit;
}
input:focus,
textarea:focus,
button:focus-visible {
  outline: 2px solid #4cf1e5;
  outline-offset: 2px;
}
button {
  min-height: 44px;
  padding: 10px 16px;
  border: 1px solid #6753a7;
  border-radius: 10px;
  background: #271c4b;
  color: #eee;
  font: inherit;
  cursor: pointer;
}
button:hover {
  border-color: #4cf1e5;
}
button:disabled,
textarea:disabled,
.attachButton:has(+ input:disabled) {
  opacity: 0.45;
  cursor: not-allowed;
}
.primary {
  background: linear-gradient(135deg, #6235c8, #087f83);
  border-color: #8d68e9;
}
.logout {
  margin-left: auto;
}
nav {
  display: flex;
  gap: 10px;
  padding: 18px 0;
}
.messenger {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  min-height: 620px;
}
aside button {
  display: block;
  width: 100%;
  margin: 8px 0;
  text-align: left;
}
.room.active {
  border-color: #4cf1e5;
  background: #32245d;
}
.chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}
.chat #messages {
  overflow: auto;
  max-height: 480px;
  padding: 18px 0;
}
.message {
  max-width: 74%;
  margin: 8px 0;
  padding: 12px 15px;
  border-radius: 15px;
  background: #1c1832;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.message.mine {
  margin-left: auto;
  background: linear-gradient(135deg, #5c32bc, #087f83);
}
.empty {
  color: #9189aa;
  text-align: center;
  padding: 28px 8px;
}
#composer {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}
#composer button {
  min-width: 80px;
}
#status {
  display: none;
  position: fixed;
  z-index: 20;
  right: 20px;
  bottom: 20px;
  max-width: min(420px, calc(100vw - 40px));
  background: #133b39;
  padding: 12px 18px;
  border-radius: 10px;
  box-shadow: 0 8px 30px #0008;
}
#status:not(:empty) {
  display: block;
}
.bad {
  background: #631f35 !important;
}
dialog {
  border: 1px solid #765ae0;
  border-radius: 16px;
  background: #120e24;
  color: #fff;
  max-width: min(600px, calc(100vw - 28px));
  overflow-wrap: anywhere;
}
dialog::backdrop {
  background: #05030ccc;
  backdrop-filter: blur(3px);
}
dialog form {
  min-width: min(420px, calc(100vw - 76px));
}
#memberChoices {
  display: grid;
  gap: 8px;
  max-height: 45vh;
  overflow: auto;
}
.memberChoice {
  display: flex;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #453878;
  border-radius: 10px;
}
.memberChoice input {
  width: 20px;
  height: 20px;
}
.dialogActions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 8px;
}
footer {
  padding: 35px 0;
  color: #77708e;
}
.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: 700px) {
  main {
    padding: 12px;
  }
  header {
    gap: 10px;
  }
  .sigil {
    width: 46px;
    height: 46px;
  }
  .lock {
    font-size: 0.65rem;
    padding: 6px 8px;
  }
  .auth {
    grid-template-columns: 1fr;
    padding: 28px 0;
  }
  .auth > div,
  .chat,
  aside {
    padding: 16px;
  }
  .messenger {
    grid-template-columns: 1fr;
    min-height: 0;
  }
  aside {
    max-height: 190px;
    overflow: auto;
  }
  .chat {
    min-height: calc(100vh - 340px);
  }
  .chat #messages {
    max-height: none;
    min-height: 220px;
  }
  .message {
    max-width: 88%;
  }
  nav {
    overflow-x: auto;
  }
  .logout {
    margin-left: 0;
  }
  nav button {
    white-space: nowrap;
  }
  #composer {
    position: relative;
    background: #100d20;
    padding-top: 8px;
  }
  footer {
    padding: 20px 0;
  }
}
.messageActions {
  display: flex;
  gap: 6px;
  margin-top: 7px;
  opacity: 0.82;
}
.messageActions button {
  min-height: 32px;
  padding: 3px 8px;
  font-size: 0.75rem;
  background: #0b0917aa;
}
.quoted {
  font-size: 0.78rem;
  color: #c9c1e8;
  border-left: 2px solid #62e8dc;
  padding-left: 8px;
  margin-bottom: 7px;
}
.reactions {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #090713;
  color: #ff9ab7;
  font-size: 0.78rem;
}
.seen {
  display: block;
  text-align: right;
  color: #b6f2eb;
  font-size: 0.68rem;
  margin-top: 4px;
}
#replyBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 13px;
  background: #17112c;
  border-left: 3px solid #53efe1;
  color: #cfc7e5;
}
#replyBar button {
  min-height: 32px;
  padding: 3px 9px;
}
.attachButton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid #6753a7;
  border-radius: 10px;
  background: #271c4b;
  cursor: pointer;
}
.attachButton:hover {
  border-color: #4cf1e5;
}
.attachmentCard {
  display: grid;
  gap: 7px;
}
.attachmentCard img {
  display: block;
  max-width: 100%;
  max-height: 260px;
  border-radius: 10px;
}
.attachmentCard a {
  color: #77f5eb;
  overflow-wrap: anywhere;
}
.attachmentMeta {
  font-size: 0.75rem;
  color: #c9c1e8;
}
@media (max-width: 700px) {
  .attachButton span {
    display: none;
  }
  #composer {
    grid-template-columns: minmax(0, 1fr) auto auto;
  }
  .chat #messages {
    max-height: 52vh;
    padding-bottom: 12px;
  }
}
[hidden] {
  display: none !important;
}
@media (max-width: 700px) {
  nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    overflow: visible;
  }
  #newRoom {
    grid-column: 1/-1;
  }
}
