:root {
  color-scheme: dark;
  --bg: #0f0d14;
  --bg-panel: rgba(24, 18, 30, 0.88);
  --bg-panel-strong: rgba(37, 27, 44, 0.96);
  --line: rgba(255, 236, 197, 0.13);
  --line-strong: rgba(255, 197, 116, 0.32);
  --text: #f8f1e8;
  --muted: #ccbfb3;
  --gold: #f0b561;
  --peach: #ff9170;
  --mint: #90e2d6;
  --shadow: 0 28px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--text);
  font-family: "Segoe UI Variable Text", "Trebuchet MS", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(255, 145, 112, 0.18), transparent 24%),
    radial-gradient(circle at top right, rgba(144, 226, 214, 0.14), transparent 20%),
    linear-gradient(180deg, #18111b 0%, #0d0b11 100%);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.75), transparent 96%);
}

.site-shell {
  width: min(1400px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 36px;
}

.site-footer {
  display: grid;
  justify-items: center;
  gap: 12px;
  margin-top: 22px;
  padding: 18px 20px 0;
  text-align: center;
}

.site-footer__copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.site-seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 236, 197, 0.1);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.03);
}

.topbar,
.card {
  backdrop-filter: blur(18px);
}

.topbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 22px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(19, 14, 22, 0.82);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand__mark {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--gold), var(--peach));
  color: #2e1b12;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand h1,
.splash h2,
.section-heading h3,
.chat-room-title,
.post-card h4 {
  margin: 0;
  font-family: Georgia, "Palatino Linotype", serif;
}

.eyebrow {
  margin: 0 0 6px;
  color: #f7d49e;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.topbar__nav {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
}

.topbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.topbar__nav a,
.topbar__status,
.badge,
.room {
  border: 1px solid rgba(255, 236, 197, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
}

.topbar__nav a {
  padding: 0.8rem 1rem;
  text-decoration: none;
}

.topbar__status,
.badge {
  padding: 0.55rem 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar__status {
  display: inline-flex;
  align-items: center;
}

.home-layout,
.posts-layout {
  display: grid;
  gap: 22px;
  margin-top: 22px;
}

.posts-layout {
  grid-template-columns: minmax(0, 1fr) 360px;
  align-items: start;
}

.main-column,
.posts-list,
.hero-points,
.stack,
.chat-messages {
  display: grid;
  gap: 18px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 30px;
  background: var(--bg-panel);
  box-shadow: var(--shadow);
}

.splash,
.feature-strip,
.page-summary,
.channel,
.feed,
.chat-card {
  padding: 26px;
}

.splash,
.home-hero {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  background:
    radial-gradient(circle at top right, rgba(144, 226, 214, 0.12), transparent 30%),
    radial-gradient(circle at bottom left, rgba(255, 145, 112, 0.13), transparent 34%),
    rgba(23, 17, 28, 0.9);
}

.feature-strip,
.page-summary {
  background: rgba(23, 17, 28, 0.9);
}

.splash h2 {
  font-size: clamp(2.1rem, 3.6vw, 3.6rem);
  line-height: 1.05;
  max-width: 11ch;
}

.lead,
.support-copy,
.post-card p,
.message p {
  margin: 0;
  color: var(--muted);
  line-height: 1.65;
}

.support-copy--small {
  font-size: 0.88rem;
  opacity: 0.92;
}

.hero-points {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.hero-points article,
.feature-card,
.channel-banner,
.post-card,
.message {
  border: 1px solid rgba(255, 236, 197, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
}

.hero-points article {
  padding: 16px;
}

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.feature-card {
  display: grid;
  gap: 8px;
  padding: 18px;
  color: var(--muted);
}

.feature-card strong {
  color: var(--gold);
}

.hero-points strong,
.channel-banner strong {
  display: block;
  margin-bottom: 6px;
  color: var(--gold);
}

.login-panel {
  padding: 22px;
  border: 1px solid rgba(255, 236, 197, 0.09);
  border-radius: 26px;
  background: var(--bg-panel-strong);
}

.auth-mode-switch,
.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.auth-mode-switch {
  margin-bottom: 18px;
}

.auth-mode-button {
  border: 1px solid rgba(255, 236, 197, 0.12);
  border-radius: 999px;
  padding: 0.8rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.auth-mode-button--active {
  border-color: rgba(255, 197, 116, 0.35);
  background: linear-gradient(135deg, rgba(240, 181, 97, 0.22), rgba(255, 145, 112, 0.16));
  color: #fff4e4;
}

.auth-actions {
  margin-top: 14px;
}

.form-field--hidden {
  display: none;
}

.section-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 0.92rem;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid rgba(255, 236, 197, 0.12);
  border-radius: 18px;
  padding: 0.95rem 1rem;
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  outline: none;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--line-strong);
  box-shadow: 0 0 0 3px rgba(240, 181, 97, 0.12);
}

textarea {
  resize: vertical;
  min-height: 128px;
}

.upload-field input[type="file"] {
  padding: 0.8rem 0.9rem;
  cursor: pointer;
}

.upload-field input[type="file"]::file-selector-button {
  margin-right: 12px;
  border: 1px solid rgba(255, 236, 197, 0.12);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  background: linear-gradient(135deg, rgba(240, 181, 97, 0.18), rgba(255, 145, 112, 0.14));
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.95rem 1.25rem;
  font-weight: 800;
  cursor: pointer;
  transition:
    transform 140ms ease,
    border-color 140ms ease,
    box-shadow 140ms ease;
}

.button:hover,
.room:hover,
.topbar__nav a:hover {
  transform: translateY(-1px);
}

.button--primary {
  background: linear-gradient(135deg, var(--gold), var(--peach));
  color: #2f1d14;
}

.button--secondary {
  background: linear-gradient(135deg, var(--mint), #caf8ef);
  color: #11322c;
}

.button--ghost {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border-color: rgba(255, 236, 197, 0.12);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.channel-banner {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 18px;
  margin-bottom: 18px;
}

.channel-banner__label {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.composer__row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 16px;
}

.post-card {
  padding: 20px;
}

.image-preview,
.post-image-frame {
  border: 1px solid rgba(255, 236, 197, 0.08);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.04);
}

.image-preview {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.image-preview--empty {
  align-items: center;
}

.image-preview__copy,
.image-preview__meta span {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.image-preview__image,
.post-image {
  display: block;
  width: auto;
  max-width: 100%;
  height: auto;
  border-radius: 18px;
}

.image-preview__image {
  max-height: 320px;
  margin: 0 auto;
  object-fit: contain;
}

.image-preview__meta {
  display: grid;
  gap: 4px;
}

.image-preview__meta strong {
  color: var(--gold);
}

.post-meta,
.post-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.post-meta {
  margin-bottom: 12px;
}

.post-footer {
  margin-top: 14px;
}

.post-image-frame {
  display: grid;
  place-items: center;
  margin: 16px 0 14px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.post-image {
  max-height: min(70vh, 760px);
  margin: 0 auto;
  object-fit: contain;
}

.post-type {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.75rem;
  border-radius: 999px;
  color: #211511;
  font-weight: 800;
}

.post-type--fan-art {
  background: var(--mint);
}

.post-type--fan-lore {
  background: var(--gold);
}

.post-type--fan-story {
  background: var(--peach);
}

.empty-state {
  padding: 24px;
  border: 1px dashed rgba(255, 236, 197, 0.18);
  border-radius: 22px;
  color: var(--muted);
  text-align: center;
}

#composer-feedback,
#chat-room-copy {
  margin-top: 14px;
}

.chat-column {
  position: sticky;
  top: 24px;
}

.rooms {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 18px;
}

.room {
  padding: 0.75rem 0.95rem;
  cursor: pointer;
}

.room--active {
  border-color: rgba(144, 226, 214, 0.36);
  background: linear-gradient(135deg, rgba(144, 226, 214, 0.18), rgba(255, 145, 112, 0.1));
}

.chat-room-title {
  margin-bottom: 14px;
  font-size: 1.3rem;
}

.chat-messages {
  min-height: 420px;
  max-height: 420px;
  overflow-y: auto;
  margin-bottom: 16px;
}

.message {
  padding: 14px 16px;
}

.message__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  color: #f3cf96;
  font-size: 0.84rem;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

@media (max-width: 1120px) {
  .posts-layout,
  .splash {
    grid-template-columns: 1fr;
  }

  .chat-column {
    position: static;
  }
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100% - 20px, 1400px);
    padding-top: 14px;
  }

  .topbar,
  .splash,
  .channel,
  .feed,
  .chat-card {
    padding: 18px;
    border-radius: 24px;
  }

  .hero-points,
  .feature-grid,
  .composer__row,
  .channel-banner,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .topbar__actions {
    justify-content: flex-start;
  }

  .splash h2 {
    max-width: none;
  }
}
