:root {
  --bg: #eef3ff;
  --bg-secondary: #f8fbff;
  --panel: rgba(255, 255, 255, 0.8);
  --panel-strong: rgba(255, 255, 255, 0.92);
  --line: rgba(104, 129, 255, 0.16);
  --line-strong: rgba(104, 129, 255, 0.28);
  --text: #172033;
  --muted: #65708a;
  --accent: #3f6df6;
  --accent-dark: #2448bf;
  --accent-soft: rgba(63, 109, 246, 0.1);
  --danger: #c23b50;
  --shadow: 0 28px 70px rgba(24, 44, 95, 0.12);
  --wallpaper-image: none;
  --wallpaper-overlay: linear-gradient(180deg, rgba(255, 255, 255, 0), rgba(255, 255, 255, 0));
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Aptos", "Segoe UI", "Hiragino Sans", sans-serif;
  color: var(--text);
  background-image:
    var(--wallpaper-overlay),
    var(--wallpaper-image),
    radial-gradient(circle at top left, rgba(81, 123, 255, 0.22), transparent 30%),
    radial-gradient(circle at top right, rgba(73, 214, 255, 0.18), transparent 24%),
    linear-gradient(180deg, #f5f8ff 0%, #eef3ff 52%, #f8fbff 100%);
  background-position: center, center, top left, top right, center;
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat;
  background-size: cover, cover, auto, auto, auto;
  background-attachment: fixed, fixed, scroll, scroll, scroll;
}

body::before,
body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
  z-index: 0;
}

body.effect-aurora::before {
  opacity: 1;
  background:
    radial-gradient(circle at 20% 20%, rgba(0, 255, 170, 0.12), transparent 28%),
    radial-gradient(circle at 80% 0%, rgba(103, 135, 255, 0.16), transparent 30%),
    radial-gradient(circle at 60% 70%, rgba(255, 0, 153, 0.12), transparent 26%);
  animation: auroraMove 16s linear infinite alternate;
}

body.effect-scanlines::after {
  opacity: 0.3;
  background: repeating-linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.05),
    rgba(255, 255, 255, 0.05) 2px,
    transparent 2px,
    transparent 4px
  );
}

body.effect-sparkle::after {
  opacity: 0.5;
  background-image:
    radial-gradient(circle at 15% 20%, rgba(255, 255, 255, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 35% 65%, rgba(255, 255, 255, 0.9) 0 1px, transparent 2px),
    radial-gradient(circle at 75% 15%, rgba(255, 255, 255, 0.85) 0 1px, transparent 2px),
    radial-gradient(circle at 85% 80%, rgba(255, 255, 255, 0.9) 0 1px, transparent 2px);
  animation: sparklePulse 2.8s ease-in-out infinite alternate;
}

body.has-wallpaper .hero,
body.has-wallpaper .card,
body.has-wallpaper .thread-item,
body.has-wallpaper .reply-item,
body.has-wallpaper .main-post,
body.has-wallpaper .global-announcement__inner {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.46), rgba(248, 251, 255, 0.34)),
    rgba(255, 255, 255, 0.18);
  backdrop-filter: blur(16px);
}

body.theme-dark {
  --text: #eff4ff;
  --muted: #b6c1d8;
  --panel: rgba(23, 27, 36, 0.45);
  --panel-strong: rgba(37, 44, 58, 0.42);
  --line: rgba(138, 162, 255, 0.18);
  --line-strong: rgba(138, 162, 255, 0.34);
  --accent: #7da2ff;
  --accent-dark: #5a7be6;
  --accent-soft: rgba(125, 162, 255, 0.16);
  --shadow: 0 30px 80px rgba(3, 8, 22, 0.35);
  background-image:
    var(--wallpaper-overlay),
    var(--wallpaper-image),
    radial-gradient(circle at top left, rgba(66, 95, 196, 0.32), transparent 28%),
    radial-gradient(circle at top right, rgba(63, 132, 227, 0.2), transparent 22%),
    linear-gradient(180deg, #0d1324 0%, #121a2f 52%, #0b1120 100%);
}

body.theme-dark .hero,
body.theme-dark .card,
body.theme-dark .thread-item,
body.theme-dark .reply-item,
body.theme-dark .main-post,
body.theme-dark .global-announcement__inner {
  border-color: rgba(160, 176, 218, 0.14);
  background:
    linear-gradient(180deg, rgba(36, 42, 56, 0.42), rgba(20, 24, 34, 0.34)),
    rgba(16, 20, 28, 0.28);
}

body.theme-retro {
  --text: #2f220f;
  --muted: #6f5734;
  --panel: rgba(255, 246, 222, 0.82);
  --panel-strong: rgba(255, 243, 207, 0.88);
  --line: rgba(143, 93, 38, 0.18);
  --line-strong: rgba(143, 93, 38, 0.34);
  --accent: #ca6c1d;
  --accent-dark: #8b4318;
  --accent-soft: rgba(202, 108, 29, 0.12);
  --shadow: 0 24px 60px rgba(92, 54, 12, 0.16);
  font-family: "Courier New", "Consolas", monospace;
  background-image:
    var(--wallpaper-overlay),
    var(--wallpaper-image),
    linear-gradient(180deg, rgba(255, 237, 188, 0.46), rgba(255, 237, 188, 0.46)),
    repeating-linear-gradient(0deg, rgba(112, 73, 18, 0.035), rgba(112, 73, 18, 0.035) 2px, transparent 2px, transparent 4px),
    linear-gradient(180deg, #f9ebbf 0%, #f1d99f 52%, #f7e8bf 100%);
}

body.theme-seasonal {
  --text: #173123;
  --muted: #587566;
  --panel: rgba(247, 255, 251, 0.86);
  --panel-strong: rgba(251, 255, 248, 0.92);
  --line: rgba(65, 143, 101, 0.16);
  --line-strong: rgba(65, 143, 101, 0.32);
  --accent: #2caa68;
  --accent-dark: #1f7b4b;
  --accent-soft: rgba(44, 170, 104, 0.12);
  --shadow: 0 30px 68px rgba(27, 84, 53, 0.14);
  background-image:
    var(--wallpaper-overlay),
    var(--wallpaper-image),
    radial-gradient(circle at top left, rgba(244, 115, 182, 0.18), transparent 22%),
    radial-gradient(circle at top right, rgba(255, 183, 77, 0.18), transparent 20%),
    linear-gradient(180deg, #f6fff8 0%, #ecfff1 52%, #fff7ec 100%);
}

body.theme-rainbow {
  --text: #0f1016;
  --muted: rgba(15, 16, 22, 0.76);
  --panel: rgba(18, 18, 28, 0.24);
  --panel-strong: rgba(20, 20, 30, 0.32);
  --line: rgba(15, 16, 22, 0.18);
  --line-strong: rgba(15, 16, 22, 0.34);
  --accent: #ff5bbd;
  --accent-dark: #7f5bff;
  --accent-soft: rgba(15, 16, 22, 0.08);
  --shadow: 0 26px 80px rgba(35, 0, 66, 0.24);
  background-image:
    var(--wallpaper-overlay),
    var(--wallpaper-image),
    linear-gradient(
      115deg,
      rgba(255, 0, 64, 0.72) 0%,
      rgba(255, 136, 0, 0.64) 16%,
      rgba(252, 234, 0, 0.58) 32%,
      rgba(0, 214, 97, 0.56) 48%,
      rgba(0, 195, 255, 0.6) 64%,
      rgba(40, 120, 255, 0.62) 80%,
      rgba(141, 72, 255, 0.68) 100%
    );
  background-size: cover, cover, 280% 280%;
  animation: rainbowWave 14s ease-in-out infinite;
}

body.theme-rainbow .hero-kicker,
body.theme-rainbow .section-tag,
body.theme-rainbow .post-chip,
body.theme-rainbow .global-announcement__label {
  color: #111111;
}

body.theme-midnight {
  --text: #edf4ff;
  --muted: #b4c0dd;
  --panel: rgba(6, 18, 36, 0.46);
  --panel-strong: rgba(10, 22, 42, 0.56);
  --line: rgba(140, 176, 255, 0.18);
  --line-strong: rgba(140, 176, 255, 0.34);
  --accent: #67b9ff;
  --accent-dark: #2c6fff;
  --accent-soft: rgba(103, 185, 255, 0.14);
  --shadow: 0 30px 82px rgba(3, 8, 30, 0.36);
  background-image:
    var(--wallpaper-overlay),
    var(--wallpaper-image),
    radial-gradient(circle at 50% 0%, rgba(131, 170, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #050914 0%, #091225 55%, #040811 100%);
}

body.theme-glass {
  --text: #132039;
  --muted: #53617d;
  --panel: rgba(255, 255, 255, 0.18);
  --panel-strong: rgba(255, 255, 255, 0.22);
  --line: rgba(255, 255, 255, 0.24);
  --line-strong: rgba(255, 255, 255, 0.44);
  --accent: #2e86ff;
  --accent-dark: #1565f8;
  --accent-soft: rgba(46, 134, 255, 0.12);
  --shadow: 0 26px 74px rgba(33, 58, 116, 0.18);
}

a {
  color: inherit;
}

button,
input,
textarea,
select {
  font: inherit;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1160px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero {
  position: relative;
  overflow: hidden;
  padding: 38px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 32px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.72), rgba(244, 248, 255, 0.54)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -80px -80px auto;
  width: 220px;
  height: 220px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(63, 109, 246, 0.22), transparent 68%);
  pointer-events: none;
}

.hero.compact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 32px;
}

.hero-kicker,
.section-tag,
.eyebrow,
.post-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.post-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.hero h1 {
  margin: 14px 0 0;
  font-size: clamp(3.1rem, 8vw, 5.4rem);
  line-height: 0.92;
  letter-spacing: -0.06em;
}

.compact-title {
  font-size: clamp(2rem, 5vw, 3rem);
}

.hero-copy {
  width: min(100%, 620px);
  margin: 16px 0 0;
  font-size: 1.05rem;
  line-height: 1.75;
  color: var(--muted);
}

.hero-links,
.admin-action-row,
.admin-button-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.admin-button-stack {
  flex-direction: column;
  align-items: stretch;
}

.grid,
.thread-layout,
.admin-layout {
  display: grid;
  gap: 22px;
  margin-top: 24px;
}

.grid {
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
}

.thread-layout,
.admin-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
}

.admin-layout {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
}

.card {
  padding: 24px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 28px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.74), rgba(248, 251, 255, 0.52)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.composer-card {
  position: sticky;
  top: 20px;
}

.section-head {
  margin-bottom: 18px;
}

.section-head h2,
.thread-title {
  margin: 12px 0 0;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
}

.section-head p,
.meta,
.form-message,
.empty,
.field-note {
  color: var(--muted);
}

.stack {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 8px;
}

label span {
  font-size: 0.95rem;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.84);
  color: var(--text);
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background 160ms ease;
}

body.theme-dark input,
body.theme-dark textarea,
body.theme-dark select,
body.theme-midnight input,
body.theme-midnight textarea,
body.theme-midnight select,
body.theme-rainbow input,
body.theme-rainbow textarea,
body.theme-rainbow select {
  background: rgba(16, 20, 28, 0.46);
  color: var(--text);
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--line-strong);
  box-shadow: 0 0 0 5px rgba(63, 109, 246, 0.08);
}

textarea {
  resize: vertical;
}

button {
  border: 0;
  border-radius: 999px;
  padding: 13px 18px;
  color: white;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  box-shadow: 0 16px 30px rgba(36, 72, 191, 0.22);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease, opacity 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.secondary-button,
.like-button,
.back-link {
  color: var(--text);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid var(--line);
  box-shadow: none;
}

.danger-button {
  background: linear-gradient(135deg, var(--danger), #8f1f3d);
  box-shadow: none;
}

.thread-list,
.reply-list,
.user-rule-list,
.admin-panels {
  display: grid;
  gap: 16px;
}

.thread-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-top: 14px;
}

.thread-item,
.reply-item,
.main-post {
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.72), rgba(248, 251, 255, 0.52)),
    var(--panel-strong);
}

.thread-item-pinned {
  box-shadow: inset 0 0 0 1px rgba(255, 196, 0, 0.32);
}

.main-post {
  margin-bottom: 18px;
}

.thread-item h3,
.main-post h2 {
  margin: 0 0 12px;
  font-size: 1.2rem;
  line-height: 1.4;
}

.thread-item p,
.reply-item p,
.main-post p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.7;
}

.upload-preview,
.file-preview,
.unlock-form {
  border: 1px dashed var(--line-strong);
  border-radius: 18px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.32);
}

.unlock-form {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.unlock-form input {
  flex: 1;
}

.preview-image,
.attachment-image {
  display: block;
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  border-radius: 16px;
}

.attachment-stack {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.attachment-file {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: 16px;
  background: rgba(63, 109, 246, 0.08);
  text-decoration: none;
  word-break: break-all;
}

.attachment-image-wrap {
  overflow: hidden;
  border-radius: 18px;
}

.thread-item a {
  display: block;
  text-decoration: none;
}

.thread-item:hover {
  transform: translateY(-2px);
  border-color: var(--line-strong);
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}

.meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.92rem;
}

.back-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 16px;
  border-radius: 999px;
  text-decoration: none;
}

.admin-name {
  font-weight: 800;
  background: linear-gradient(90deg, #ff003c, #ff9a00, #f8e71c, #00c853, #00b0ff, #7c4dff, #ff003c);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: rainbowShift 6s linear infinite;
}

.admin-badge {
  margin-left: 4px;
  font-size: 0.95em;
}

.post-id {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid var(--line);
  font-size: 0.82rem;
}

.admin-like-box {
  display: grid;
  gap: 8px;
}

.like-editor {
  display: flex;
  gap: 8px;
}

.like-editor input {
  width: 96px;
  padding: 10px 12px;
}

.id-editor {
  display: flex;
  gap: 8px;
}

.id-editor input {
  width: 132px;
  padding: 10px 12px;
}

.admin-row,
.wallpaper-preview-head,
.user-rule-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.admin-content {
  min-width: 0;
  flex: 1;
}

.admin-reply {
  padding: 16px;
}

.admin-title {
  font-size: clamp(2.1rem, 5vw, 3.6rem);
}

.global-announcement {
  margin-top: 18px;
}

.global-announcement__inner {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.76), rgba(248, 251, 255, 0.54)),
    var(--panel);
  box-shadow: var(--shadow);
}

.global-announcement__label {
  flex: none;
}

.global-announcement__text {
  margin: 0;
  line-height: 1.7;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.wallpaper-preview-card {
  display: grid;
  gap: 12px;
  margin-top: 8px;
}

.wallpaper-status {
  font-size: 0.85rem;
  color: var(--muted);
}

.wallpaper-preview-surface {
  min-height: 180px;
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.12), rgba(7, 16, 40, 0.24)),
    radial-gradient(circle at top left, rgba(81, 123, 255, 0.3), transparent 28%),
    linear-gradient(180deg, #f5f8ff 0%, #eef3ff 52%, #f8fbff 100%);
  background-size: cover;
  background-position: center;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.34);
}

.wallpaper-preview-overlay {
  display: flex;
  align-items: end;
  justify-content: start;
  min-height: 180px;
  padding: 16px;
  color: white;
  font-weight: 700;
  letter-spacing: 0.04em;
}

@keyframes auroraMove {
  0% {
    transform: translate3d(0, 0, 0) scale(1);
  }
  100% {
    transform: translate3d(0, 24px, 0) scale(1.08);
  }
}

@keyframes sparklePulse {
  from {
    opacity: 0.18;
  }
  to {
    opacity: 0.42;
  }
}

@keyframes rainbowShift {
  0% {
    background-position: 0% 50%;
  }
  100% {
    background-position: 100% 50%;
  }
}

@keyframes rainbowWave {
  0% {
    background-position: 0% 45%, 0% 45%, 0% 45%;
    transform: translateY(0);
  }
  25% {
    background-position: 0% 45%, 0% 45%, 30% 55%;
  }
  50% {
    background-position: 0% 45%, 0% 45%, 60% 40%;
  }
  75% {
    background-position: 0% 45%, 0% 45%, 85% 58%;
  }
  100% {
    background-position: 0% 45%, 0% 45%, 100% 45%;
    transform: translateY(0);
  }
}

@media (max-width: 860px) {
  .grid,
  .thread-layout,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .hero.compact,
  .admin-row,
  .meta,
  .thread-footer,
  .wallpaper-preview-head,
  .user-rule-item,
  .unlock-form {
    flex-direction: column;
    align-items: flex-start;
  }

  .composer-card {
    position: static;
  }
}
