:root {
  color-scheme: light;
  font-family: system-ui, "Microsoft YaHei", sans-serif;
  color: #211b2c;
  background: #211c2d;
  --ink: #211b2c;
  --muted: #51475a;
  --paper: #fffdf6;
  --yellow: #ffde71;
  --pixel: "Courier New", "Microsoft YaHei", monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body { margin: 0; min-height: 100vh; overflow-wrap: anywhere; }
button, input, textarea { font: inherit; }
button { color: inherit; cursor: pointer; }
button:disabled { cursor: wait; opacity: .68; }
:focus-visible { outline: 3px solid #6035a6; outline-offset: 4px; }

.book {
  position: relative;
  z-index: 1;
  width: min(100% - 3rem, 78rem);
  margin-inline: auto;
  padding: 2.15rem 0 3rem;
}

.home-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  margin-bottom: .9rem;
  padding: .42rem .85rem;
  color: #fffdf6;
  border: 1px solid #ffffff6b;
  border-radius: .55rem;
  background: #211b2cd9;
  text-decoration: none;
  font-size: .875rem;
  font-weight: 650;
}

.home-link:hover { background: #3d2b55; }
.home-link:focus-visible { outline-color: var(--yellow); }

.board {
  position: relative;
  overflow: hidden;
  padding: 2.35rem 2.6rem 2.5rem;
  border: 1px solid #fff9;
  border-radius: 1.65rem;
  background: #f9f0f5df;
  backdrop-filter: blur(16px);
  box-shadow: 0 1.1rem 4rem #150d2061;
}

.board-header {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0 0 1.45rem;
  border-bottom: 2px solid var(--ink);
}

.board-header::before {
  position: absolute;
  z-index: -1;
  inset: -2.35rem -2.6rem 0 42%;
  content: "";
  pointer-events: none;
  background: radial-gradient(circle, #534268 1px, transparent 1.3px) 0 0 / 6px 6px;
  opacity: .16;
  mask-image: linear-gradient(110deg, transparent, black);
}

.board-heading { display: flex; align-items: center; gap: .9rem; }

h1, h2 { margin: 0; line-height: 1.2; }
h1 {
  font-size: 3.15rem;
  font-weight: 900;
  letter-spacing: .035em;
  text-shadow: 2px 2px var(--yellow);
}
h2 { font-size: 1.25rem; font-weight: 850; }

.pixel-bubble {
  position: relative;
  display: grid;
  width: 3rem;
  height: 2.75rem;
  flex: 0 0 auto;
  place-items: center;
  background: var(--ink);
  clip-path: polygon(0 9%, 9% 9%, 9% 0, 91% 0, 91% 9%, 100% 9%, 100% 73%, 91% 73%, 91% 82%, 46% 82%, 28% 100%, 19% 100%, 19% 82%, 9% 82%, 9% 73%, 0 73%);
}

.pixel-bubble::before {
  position: absolute;
  inset: 2px;
  content: "";
  background: var(--yellow);
  clip-path: inherit;
}

.pixel-bubble i {
  position: relative;
  width: .29rem;
  height: .29rem;
  margin-top: -.45rem;
  background: var(--ink);
  box-shadow: -.55rem 0 var(--ink), .55rem 0 var(--ink);
}

.account { display: flex; align-items: center; justify-content: end; gap: .75rem; min-width: 0; font-weight: 700; }
.account span { min-width: 0; }
.text-button { flex: 0 0 auto; border: 0; background: transparent; padding: .55rem .35rem; text-decoration: underline; text-underline-offset: .2em; }

.board-layout {
  display: grid;
  grid-template-columns: minmax(0, 22rem) minmax(0, 1fr);
  align-items: start;
  gap: 2.25rem;
  margin-top: 1.65rem;
}

.side h2 { margin: .5rem 0 .85rem; }

.paper, .message {
  color: var(--ink);
  border: 2px solid var(--ink);
  background: var(--paper);
  box-shadow: 3px 3px 0 var(--ink);
}

.compose-paper { padding: 1.05rem; border-radius: .35rem; }

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-bottom: 1rem;
  overflow: hidden;
  border: 2px solid var(--ink);
  border-radius: .25rem;
}

.auth-switch button {
  min-height: 2.5rem;
  padding: .35rem;
  border: 0;
  background: #f4eaf4;
  font-size: .875rem;
  font-weight: 750;
}

.auth-switch button + button { border-left: 2px solid var(--ink); }
.auth-switch button[aria-pressed="true"] { background: var(--yellow); }
.auth-switch button:hover:not([aria-pressed="true"]) { background: #ede0f5; }
.auth-switch button:focus-visible { outline-offset: -4px; }

form { display: grid; gap: .48rem; }
label { font-size: .875rem; font-weight: 750; }
label + input { margin-bottom: .42rem; }

input, textarea {
  width: 100%;
  min-width: 0;
  padding: .62rem .67rem;
  border: 1.5px solid #6c5873;
  border-radius: .25rem;
  color: var(--ink);
  background: #fff;
}

input { min-height: 2.75rem; }
textarea { min-height: 7rem; resize: vertical; line-height: 1.6; }
input::placeholder, textarea::placeholder { color: #6e6273; }

.action, .refresh {
  min-height: 2.65rem;
  padding: .39rem .75rem;
  border: 2px solid var(--ink);
  border-radius: .25rem;
  background: var(--yellow);
  box-shadow: 2px 2px 0 var(--ink);
  font-weight: 800;
}

.action { margin-top: .32rem; }
.action:hover:not(:disabled) { background: #ffce4e; }
.action:active:not(:disabled), .refresh:active:not(:disabled) { transform: translate(2px, 2px); box-shadow: none; }

.compose-actions { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.compose-actions span, .count, time { color: var(--muted); font-family: var(--pixel); font-size: .78rem; }
.status { margin: .68rem 0 0; color: var(--muted); line-height: 1.55; font-size: .875rem; }
.status:empty { display: none; }
.status[data-kind="error"] { color: #8c244d; }
.status[data-kind="success"] { color: #23513d; }

.stream { min-width: 0; }
.stream-head { display: flex; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: .75rem; }
.count { display: inline-block; margin-left: .3rem; }
.refresh { background: #fff8fc; min-height: 2.25rem; font-size: .8125rem; }
.refresh:hover:not(:disabled) { background: #efddfa; }

.messages { display: grid; gap: 1rem; }

.empty {
  min-height: 7rem;
  display: grid;
  place-content: center;
  margin: 0;
  padding: 1rem;
  border: 2px dashed #786085;
  border-radius: .4rem;
  background: #fffdf6b3;
  color: var(--muted);
  font-size: .9375rem;
  text-align: center;
}

.message { position: relative; padding: .9rem 1rem .95rem; border-radius: .35rem; margin-left: .45rem; }
.message::before {
  position: absolute;
  top: 1.1rem;
  left: -.42rem;
  width: .63rem;
  height: .63rem;
  content: "";
  transform: rotate(45deg);
  border-left: 2px solid var(--ink);
  border-bottom: 2px solid var(--ink);
  background: var(--paper);
}

.message-head { position: relative; display: flex; align-items: center; gap: .65rem; }
.avatar {
  display: grid;
  flex: 0 0 2.25rem;
  height: 2.25rem;
  place-items: center;
  border: 2px solid var(--ink);
  background: var(--avatar, #d7bbff);
  font: 800 .85rem/1 var(--pixel);
}
.message-person { min-width: 0; display: grid; gap: .15rem; }
.message-person b { font-size: .9375rem; }
.message-body { margin: .68rem 0 0; line-height: 1.68; white-space: pre-wrap; }

@media (max-width: 700px) {
  .book { width: calc(100% - 1.5rem); padding-top: 1rem; }
  .board { padding: 1.15rem; border-radius: 1.1rem; }
  .board-header { padding-bottom: 1rem; }
  .board-header::before { inset: -1.15rem -1.15rem 0 42%; }
  .board-layout { grid-template-columns: minmax(0, 1fr); gap: 1.35rem; margin-top: 1rem; }
  h1 { font-size: 2rem; }
  .pixel-bubble { width: 2.35rem; height: 2.14rem; }
  .board-heading { gap: .55rem; }
  .account { gap: .25rem; font-size: .8rem; }
}
