:root {
  --ink: #fff8f6;
  --muted: rgba(255, 255, 255, 0.68);
  --paper: rgba(255, 255, 255, 0.085);
  --panel: rgba(255, 255, 255, 0.12);
  --panel-2: rgba(255, 255, 255, 0.16);
  --line: rgba(255, 255, 255, 0.28);
  --blue: #47d9ff;
  --blue-2: #7e6cff;
  --red: #ff69b5;
  --green: #8af6d7;
  --deep: #151326;
  --night: #24205a;
  --lemon: #ffe56c;
  --shadow: 0 24px 64px rgba(17, 13, 58, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Trebuchet MS", "Microsoft YaHei", "PingFang SC", sans-serif;
  letter-spacing: 0;
  background:
    radial-gradient(circle at 14% 18%, rgba(255, 105, 181, 0.23), transparent 25%),
    radial-gradient(circle at 86% 20%, rgba(71, 217, 255, 0.18), transparent 25%),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(180deg, #1c1a4c 0%, #34236f 48%, #151326 100%);
  background-size: auto, auto, 34px 34px, 34px 34px, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: url("assets/sprites/sparkle-blue.png") right 7vw top 5vh / 120px auto no-repeat;
  opacity: 0.16;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
textarea {
  font: inherit;
}

.wrap {
  width: min(1040px, calc(100% - 24px));
  margin: 0 auto;
  padding: 14px 0 38px;
}

.board-header,
.shortcut-modules,
.board-panel,
.postbox,
.thread-shell {
  border: 1px solid var(--line);
  background: rgba(21, 19, 70, 0.76);
  box-shadow: var(--shadow);
}

.brand-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 12px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(255,255,255,.08), transparent 38%),
    linear-gradient(135deg, #171a42, #24205a 62%, #4d237b);
}

.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.stamp {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: 4px;
  color: #142b69;
  background: linear-gradient(135deg, #fff7db, #ffd5eb 58%, #bdf3ff);
  box-shadow: 5px 5px 0 rgba(71, 217, 255, 0.36), 0 14px 30px rgba(0, 0, 0, 0.24);
  font-size: 22px;
  font-weight: 1000;
}

.brand strong {
  display: block;
  font-size: clamp(27px, 5vw, 44px);
  line-height: 0.96;
}

.brand small {
  display: block;
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  line-height: 1.2;
}

.quick-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.quick-nav a,
.shortcut-links a,
.back-link,
.postbox button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.5);
  border-radius: 3px;
  padding: 0 10px;
  color: #fff;
  background: rgba(255, 255, 255, 0.13);
  font-weight: 900;
}

.quick-nav a:hover,
.shortcut-links a:hover,
.back-link:hover,
.thread-item:hover {
  filter: brightness(1.04);
}

.board-notice {
  display: flex;
  gap: 10px;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
  padding: 9px 12px;
  background: linear-gradient(90deg, rgba(255, 229, 108, 0.92), rgba(126, 234, 255, 0.82));
  color: #20183a;
  font-size: 13px;
  line-height: 1.45;
}

.board-notice b {
  color: var(--red);
}

.board-panel,
.shortcut-modules,
.postbox,
.thread-shell {
  margin-top: 12px;
}

.shortcut-modules {
  display: grid;
  grid-template-columns: 1.15fr 1fr 0.85fr;
  gap: 0;
  overflow: hidden;
}

.shortcut-module {
  min-width: 0;
  border-right: 1px solid var(--line);
  padding: 11px 12px 12px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06)),
    rgba(21, 19, 70, 0.78);
}

.shortcut-module:last-child {
  border-right: 0;
}

.shortcut-module h2 {
  margin: 0 0 9px;
  color: var(--lemon);
  font-size: 18px;
  line-height: 1.2;
}

.shortcut-links {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.shortcut-links a {
  min-height: 32px;
  border-color: rgba(255, 255, 255, 0.36);
  color: #211741;
  background: linear-gradient(135deg, rgba(255, 241, 125, 0.96), rgba(255, 142, 208, 0.9) 60%, rgba(126, 234, 255, 0.9));
}

.board-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  background: linear-gradient(90deg, rgba(255, 105, 181, 0.28), rgba(71, 217, 255, 0.2));
}

.board-title h1,
.board-title h2 {
  margin: 0;
  font-size: 21px;
  line-height: 1.15;
}

.board-title span {
  color: var(--muted);
  font-size: 12px;
}

.thread-table {
  display: grid;
}

.thread-item {
  display: grid;
  grid-template-columns: 78px minmax(0, 1fr) 70px;
  gap: 10px;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  padding: 13px 12px;
  background: rgba(21, 19, 70, 0.76);
}

.thread-item:nth-child(even) {
  background: rgba(25, 21, 78, 0.66);
}

.thread-item:last-child {
  border-bottom: 0;
}

.thread-item.pinned {
  box-shadow: inset 4px 0 0 var(--red);
}

.thread-no {
  color: var(--red);
  font-weight: 1000;
}

.thread-main strong {
  display: block;
  color: #fff;
  font-size: 17px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.thread-main em {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.thread-main {
  min-width: 0;
}

.thread-count {
  justify-self: end;
  min-width: 54px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--red);
  background: rgba(255, 255, 255, 0.1);
  font-size: 12px;
  font-weight: 1000;
  text-align: center;
}

.postbox form {
  display: grid;
  grid-template-columns: 150px minmax(180px, 1fr) 180px 120px;
  gap: 8px;
  padding: 12px;
  background: rgba(21, 19, 70, 0.58);
}

.postbox input,
.postbox textarea {
  width: 100%;
  border: 1px solid #cdb386;
  border-radius: 3px;
  padding: 9px;
  color: var(--ink);
  background: rgba(21, 19, 70, 0.45);
}

.postbox input::placeholder,
.postbox textarea::placeholder,
.reply-composer input::placeholder,
.reply-composer textarea::placeholder {
  color: rgba(255, 255, 255, 0.56);
}

.postbox textarea {
  grid-column: 1 / -1;
  min-height: 92px;
  resize: vertical;
}

.postbox button {
  border-color: #9f1e38;
  color: #fff;
  background: var(--red);
}

.attachment-input {
  display: grid;
  gap: 5px;
  align-content: start;
  border: 1px dashed rgba(255, 255, 255, 0.32);
  border-radius: 3px;
  padding: 7px 8px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  font-weight: 900;
}

.attachment-input input {
  width: 100%;
  border: 0;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 12px;
}

.image-preview,
.form-note {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.image-preview:empty,
.form-note:empty {
  display: none;
}

.preview-chip,
.attachment-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 999px;
  padding: 5px 9px;
  background: rgba(255, 255, 255, 0.1);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.attached-image {
  display: block;
  max-width: min(100%, 520px);
  max-height: 360px;
  margin-top: 12px;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  object-fit: contain;
}

.user-thread-marker {
  color: var(--green);
}

.reply-composer {
  border-top: 1px solid var(--line);
  padding: 12px;
  background: rgba(21, 19, 70, 0.45);
}

.reply-composer h2 {
  margin: 0 0 9px;
  font-size: 18px;
}

.reply-composer form {
  display: grid;
  grid-template-columns: 160px 180px 120px;
  gap: 8px;
}

.reply-composer input,
.reply-composer textarea {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 3px;
  padding: 9px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.1);
}

.reply-composer textarea {
  grid-column: 1 / -1;
  min-height: 92px;
  resize: vertical;
}

.reply-composer button {
  border: 1px solid #9f1e38;
  border-radius: 3px;
  color: #fff;
  background: var(--red);
  font-weight: 900;
}

.local-replies {
  display: contents;
}

.thread-shell {
  overflow: hidden;
}

.thread-head {
  padding: 13px 14px;
  color: #fff;
  background:
    linear-gradient(90deg, rgba(255, 105, 181, 0.16), transparent 45%),
    linear-gradient(135deg, #171a42, #24205a 64%, #4d237b);
}

.thread-head h1 {
  margin: 10px 0 6px;
  font-size: clamp(25px, 5vw, 40px);
  line-height: 1.08;
}

.thread-head p {
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
}

.thread-controls,
.thread-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
  padding: 10px 12px;
  background:
    linear-gradient(90deg, rgba(255, 105, 181, 0.18), rgba(71, 217, 255, 0.12)),
    rgba(21, 19, 70, 0.66);
}

.thread-control-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.thread-controls button,
.thread-pager button {
  min-height: 32px;
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 3px;
  padding: 0 10px;
  color: #211741;
  background: linear-gradient(135deg, rgba(255, 241, 125, 0.96), rgba(255, 142, 208, 0.9) 62%, rgba(126, 234, 255, 0.9));
  font-weight: 900;
  cursor: pointer;
}

.thread-controls button.is-active {
  color: #fff;
  background: var(--red);
}

.thread-pager button:disabled {
  cursor: not-allowed;
  opacity: 0.44;
}

#threadViewSummary,
#threadPageLabel {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.thread-body {
  display: grid;
  gap: 0;
  background: var(--panel);
}

.post {
  display: grid;
  grid-template-columns: 150px minmax(0, 1fr);
  border-bottom: 1px solid rgba(255, 255, 255, 0.18);
}

.post.is-hidden {
  display: none !important;
}

.post:last-child {
  border-bottom: 0;
}

.post-meta {
  border-right: 1px solid rgba(255, 255, 255, 0.18);
  padding: 12px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
}

.post-meta b {
  display: block;
  color: var(--red);
  font-size: 14px;
}

.post-content {
  min-height: 120px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.06);
  line-height: 1.72;
}

.post-content p {
  margin: 0;
}

.post-content p + p {
  margin-top: 10px;
}

.thread-foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 8px;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.08);
}

.back-link {
  border-color: rgba(255, 255, 255, 0.3);
  color: #211741;
  background: linear-gradient(135deg, rgba(255, 241, 125, 0.96), rgba(255, 142, 208, 0.9) 60%, rgba(126, 234, 255, 0.9));
}

.foot {
  margin-top: 14px;
  color: var(--muted);
  font-size: 12px;
  text-align: center;
}

@media (max-width: 780px) {
  .brand-row,
  .postbox form,
  .reply-composer form {
    grid-template-columns: 1fr;
  }

  .shortcut-modules {
    grid-template-columns: 1fr;
  }

  .shortcut-module {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .shortcut-module:last-child {
    border-bottom: 0;
  }

  .quick-nav {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: stretch;
  }

  .thread-item {
    grid-template-columns: 62px minmax(0, 1fr);
  }

  .thread-count {
    grid-column: 2;
    justify-self: start;
  }

  .post {
    grid-template-columns: 1fr;
  }

  .post-meta {
    border-right: 0;
    border-bottom: 1px solid #dcc69d;
  }
}

@media (max-width: 460px) {
  .wrap {
    width: min(100% - 14px, 1040px);
    padding-top: 7px;
  }

  .quick-nav {
    grid-template-columns: 1fr;
  }

  .board-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .board-title span {
    overflow-wrap: anywhere;
  }
}
