:root {
  --bg: #110c16;
  --bg-soft: #1a1122;
  --surface: rgba(28, 18, 37, 0.9);
  --surface-strong: rgba(38, 23, 51, 0.96);
  --surface-bright: rgba(71, 35, 70, 0.96);
  --ink: #f6ecf2;
  --muted: #cdb9c7;
  --accent: #d86f4b;
  --accent-strong: #f0b15f;
  --accent-dark: #7e3026;
  --accent-soft: rgba(216, 111, 75, 0.18);
  --line: rgba(243, 214, 230, 0.14);
  --shadow: 0 24px 80px rgba(4, 0, 11, 0.42);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(216, 111, 75, 0.16), transparent 22%),
    radial-gradient(circle at 84% 14%, rgba(122, 63, 104, 0.26), transparent 18%),
    radial-gradient(circle at bottom right, rgba(240, 177, 95, 0.09), transparent 20%),
    linear-gradient(180deg, #0c0810 0%, #140d1a 38%, #110c16 100%);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(255, 255, 255, 0.02) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.02) 1px, transparent 1px);
  background-size: 26px 26px;
  mask-image: radial-gradient(circle at center, black, transparent 82%);
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
.shell { width: min(1200px, calc(100% - 32px)); margin: 0 auto; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 18px 0;
  backdrop-filter: blur(18px);
  background: linear-gradient(180deg, rgba(9, 6, 13, 0.88), rgba(9, 6, 13, 0.44));
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.topbar-inner, .section-head, .comment-meta, .thread-meta, .message-header, .split-intro {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff8f2;
  font-weight: 700;
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, #f0b15f, #c84f38 55%, #5b274b);
  box-shadow: var(--shadow);
}
.brand-copy h1, .brand-copy p, .section-head h3, .section-head p, .hero-copy h2, .page-hero h2 {
  margin: 0;
}
.brand-copy h1 {
  font-size: 1rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.brand-copy p, .muted, .thread p, .card p, .page-hero p {
  color: var(--muted);
}

.nav, .hero-actions, .stack-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.nav a, .nav button, .button {
  border: 1px solid var(--line);
  background: rgba(64, 41, 80, 0.42);
  color: var(--ink);
  border-radius: 999px;
  padding: 12px 18px;
  font: inherit;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, color 160ms ease;
}
.nav a:hover, .nav button:hover, .button:hover {
  transform: translateY(-1px);
  border-color: rgba(240, 177, 95, 0.35);
}
.nav .is-active {
  background: rgba(240, 177, 95, 0.16);
  border-color: rgba(240, 177, 95, 0.26);
}
.nav .accent, .button.accent {
  color: #fff7f0;
  background: linear-gradient(135deg, var(--accent), #b64631 58%, #7b3142);
}
.button.subtle {
  background: rgba(240, 177, 95, 0.08);
}
.text-link {
  color: var(--accent-strong);
  font-weight: 700;
}

.hero {
  padding: 42px 0 36px;
}
.hero-grid, .two-up, .dashboard, .story-grid, .detail-grid {
  display: grid;
  gap: 24px;
}
.hero-grid {
  grid-template-columns: 1.1fr 0.9fr;
}
.hero-copy, .hero-panel, .section-card, .card, .thread, .auth-card, .feature-card {
  background: linear-gradient(180deg, rgba(41, 24, 52, 0.96), rgba(20, 13, 28, 0.96));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.hero-copy, .section-card, .card, .thread, .auth-card, .feature-card {
  padding: 26px;
}
.hero-copy {
  position: relative;
  overflow: hidden;
}
.hero-copy::after {
  content: "";
  position: absolute;
  inset: auto -80px -90px auto;
  width: 280px;
  height: 280px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(240, 177, 95, 0.16), transparent 66%);
}
.hero-home .hero-copy {
  background:
    linear-gradient(180deg, rgba(45, 22, 51, 0.98), rgba(18, 11, 26, 0.96)),
    radial-gradient(circle at top right, rgba(216, 111, 75, 0.2), transparent 30%);
}
.hero-panel {
  padding: 18px;
  display: grid;
  gap: 14px;
  background: linear-gradient(180deg, rgba(53, 25, 49, 0.98), rgba(18, 11, 26, 0.96));
}
.hero-panel img, .image-stage img {
  width: 100%;
  border-radius: 18px;
  object-fit: cover;
}
.hero-panel img { min-height: 470px; }
.panel-note {
  padding: 18px;
  border-radius: 18px;
  background: linear-gradient(135deg, rgba(240, 177, 95, 0.15), rgba(97, 43, 72, 0.35));
  border: 1px solid rgba(240, 177, 95, 0.18);
}
.panel-note strong { display: block; margin-bottom: 6px; font-size: 1.05rem; }
.eyebrow {
  display: inline-block;
  margin-bottom: 16px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(240, 177, 95, 0.2);
  background: rgba(240, 177, 95, 0.1);
  color: #f0c98b;
  font-size: 0.88rem;
  letter-spacing: 0.04em;
}
.hero-copy h2 {
  max-width: 11ch;
  font-size: clamp(2.7rem, 5vw, 5.4rem);
  line-height: 0.92;
}
.hero-copy p {
  max-width: 58ch;
  font-size: 1.06rem;
}
.hero-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 28px;
}
.hero-stat {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(69, 35, 64, 0.75), rgba(28, 17, 36, 0.9));
}
.hero-stat strong {
  display: block;
  font-size: 1.6rem;
  margin-bottom: 6px;
}

.page-shell, .page-section, .feature-grid, .main-grid, .comment-list, .review-list, .thread-list, .message-stream, form, .sidebar-stack, .mini-list {
  display: grid;
  gap: 14px;
}
.page-shell, .page-section { padding-bottom: 28px; }
.page-hero {
  padding: 32px 0 8px;
}
.page-hero h2 {
  font-size: clamp(2rem, 4vw, 4rem);
  line-height: 0.95;
  max-width: 12ch;
  margin-bottom: 10px;
}
.split-intro {
  margin-bottom: 20px;
}
.split-intro h3 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.5rem);
  max-width: 15ch;
}
.feature-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.feature-card h4 {
  margin: 0 0 8px;
  font-size: 1.18rem;
}

.gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
}
.gallery-grid-large {
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
}
.gallery-card figure {
  margin: 0;
  min-height: 260px;
  overflow: hidden;
  position: relative;
  border-radius: 20px;
  background: #1b1323;
  border: 1px solid var(--line);
}
.gallery-card img {
  width: 100%;
  height: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  transition: transform 220ms ease, filter 220ms ease;
}
.gallery-card:hover img {
  transform: scale(1.04);
  filter: saturate(1.05);
}
.gallery-card figcaption {
  position: absolute;
  inset: auto 0 0 0;
  padding: 38px 14px 14px;
  display: grid;
  gap: 4px;
  color: #fff4ef;
  background: linear-gradient(180deg, transparent, rgba(8, 5, 12, 0.96));
}
.gallery-card figcaption strong { font-size: 0.98rem; }
.gallery-card figcaption span { color: #d9c4d2; font-size: 0.88rem; }

.two-up, .story-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.detail-grid {
  grid-template-columns: minmax(0, 1.2fr) 380px;
  margin-bottom: 24px;
}
.image-stage img {
  margin-top: 18px;
  min-height: 520px;
}
.compact-gallery {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.mini-list div {
  padding: 14px 16px;
  border-radius: 18px;
  background: rgba(47, 28, 58, 0.72);
  border: 1px solid var(--line);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
label {
  display: grid;
  gap: 8px;
  font-size: 0.95rem;
}
input, textarea, select {
  width: 100%;
  padding: 13px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(17, 10, 23, 0.82);
  color: var(--ink);
  font: inherit;
}
input::placeholder, textarea::placeholder { color: rgba(205, 185, 199, 0.72); }
textarea { min-height: 130px; resize: vertical; }

.flash-wrap { padding: 8px 0 0; }
.flash {
  margin-bottom: 12px;
  padding: 14px 16px;
  border-radius: 16px;
}
.flash.error {
  background: #fde6e1;
  color: #7c2316;
}
.flash.success {
  background: #e6f5e8;
  color: #1c5c2c;
}

.dashboard {
  grid-template-columns: 360px 1fr;
  padding: 28px 0 56px;
}
.thread.active {
  border-color: rgba(240, 177, 95, 0.5);
  background: linear-gradient(180deg, rgba(77, 37, 69, 0.98), rgba(34, 19, 40, 0.98));
}
.message-bubble {
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: rgba(22, 13, 30, 0.88);
}
.message-bubble.admin {
  background: rgba(79, 35, 49, 0.8);
}
.message-header {
  margin-bottom: 8px;
  font-size: 0.88rem;
  color: var(--muted);
}
.pill, .stars {
  display: inline-block;
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.8rem;
}
.pill {
  background: var(--accent-soft);
  color: #ffd9c8;
}
.stars {
  padding: 0;
  letter-spacing: 2px;
  color: var(--accent-strong);
}

.auth-shell {
  min-height: calc(100vh - 80px);
  display: grid;
  place-items: center;
  padding: 28px 0 56px;
}
.auth-card {
  width: min(560px, 100%);
}

.footer {
  padding: 0 0 40px;
  color: var(--muted);
}
.footer p {
  margin: 0;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.assistant-widget {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 40;
  width: min(360px, calc(100vw - 24px));
}
.assistant-toggle {
  width: 100%;
  border: 1px solid rgba(240, 177, 95, 0.28);
  border-radius: 18px;
  padding: 14px 16px;
  background: linear-gradient(135deg, rgba(216, 111, 75, 0.95), rgba(123, 49, 66, 0.96));
  color: #fff7f0;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.assistant-panel {
  margin-top: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(38, 23, 51, 0.98), rgba(16, 10, 22, 0.98));
  box-shadow: var(--shadow);
}
.assistant-panel[hidden] {
  display: none;
}
.assistant-panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
}
.assistant-messages {
  display: grid;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
  margin: 14px 0;
}
.assistant-message {
  padding: 12px 14px;
  border-radius: 16px;
  border: 1px solid var(--line);
}
.assistant-message-bot {
  background: rgba(30, 18, 40, 0.92);
}
.assistant-message-user {
  background: rgba(92, 42, 48, 0.84);
}
.assistant-form {
  display: grid;
  gap: 10px;
}
.assistant-label {
  display: grid;
  gap: 8px;
}
.assistant-label span {
  font-size: 0.9rem;
}

@media (max-width: 1080px) {
  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 960px) {
  .hero-grid, .two-up, .dashboard, .story-grid, .feature-grid {
    grid-template-columns: 1fr;
  }
  .hero-panel img {
    min-height: 340px;
  }
}

@media (max-width: 720px) {
  .topbar-inner, .section-head, .comment-meta, .thread-meta, .message-header, .split-intro {
    align-items: flex-start;
    flex-direction: column;
  }
  .nav {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .shell { width: min(100% - 20px, 1200px); }
  .form-grid, .hero-stats, .compact-gallery {
    grid-template-columns: 1fr;
  }
  .hero-copy, .section-card, .card, .thread, .auth-card, .feature-card {
    padding: 20px;
  }
  .hero-copy h2, .page-hero h2, .split-intro h3 {
    max-width: none;
  }
  .assistant-widget {
    right: 10px;
    bottom: 10px;
    width: min(100vw - 20px, 360px);
  }
}
