:root {
  --bg: #050509;
  --bg-elevated: #101018;
  --bg-elevated-soft: #161624;
  --text: #f7f7ff;
  --muted: #a5a5c4;
  --accent: #ff4f8b;
  --accent-soft: rgba(255, 79, 139, 0.12);
  --border-subtle: #26263a;
  --danger: #ff4b6a;
  --shadow-soft: 0 18px 45px rgba(0, 0, 0, 0.65);
  --radius-lg: 18px;
  --radius-pill: 999px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #18182a 0, #050509 55%) fixed;
  color: var(--text);
}

body {
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  background: linear-gradient(90deg, #070712, #121222);
  position: sticky;
  top: 0;
  z-index: 10;
}

.header-inner {
  max-width: 100%;
  margin: 0;
  padding: 12px 32px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-area {
  display: flex;
  flex-direction: column;
}

.logo {
  font-weight: 700;
  font-size: 1.1rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #fff;
}

.tagline {
  font-size: 0.7rem;
  color: var(--muted);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 24px;
  flex-wrap: wrap;
}

.main-nav a {
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid transparent;
  color: var(--muted);
}

.main-nav a:hover {
  border-color: rgba(255, 255, 255, 0.12);
  text-decoration: none;
  color: #fff;
}

.account-nav {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.account-nav a {
  font-size: 0.85rem;
}

.primary-link {
  padding: 6px 12px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-weight: 500;
}

.primary-link:hover {
  text-decoration: none;
  filter: brightness(1.05);
}

.user-pill {
  display: inline-flex;
  align-items: center;
  padding: 5px 10px;
  border-radius: var(--radius-pill);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-name {
  font-size: 0.85rem;
  color: #fff;
}

.inline-form {
  display: inline-block;
  margin: 0;
}

.inline-form button {
  border: none;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 5px 12px;
  font-size: 0.8rem;
  cursor: pointer;
}

.inline-form button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.page {
  flex: 1;
  max-width: 100%;
  margin: 24px 0 40px 0;
  padding: 0 32px 40px;
}

.home-reminder {
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.16);
  font-size: 0.85rem;
  color: var(--muted);
}

.site-footer {
  padding: 12px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  font-size: 0.75rem;
  color: var(--muted);
  text-align: center;
  background: #050509;
}

/* Generic components */

.page-header {
  margin-bottom: 18px;
}

.page-header h1 {
  margin: 0 0 6px;
  font-size: 1.6rem;
}

.page-header p {
  margin: 0;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 0.8rem;
}

.error {
  background: rgba(255, 90, 90, 0.18);
  border: 1px solid rgba(255, 90, 90, 0.5);
  color: #ffb3b3;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.success {
  background: rgba(67, 181, 129, 0.16);
  border: 1px solid rgba(67, 181, 129, 0.6);
  color: #b8fadd;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 12px;
}

.btn-primary {
  border: none;
  border-radius: var(--radius-pill);
  backgroun
d: var(--accent);
  color: #fff;
  padding: 8px 18px;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
  box-shadow: 0 0 0 1px rgba(255, 79, 139, 0.4);
}

.btn-primary:hover {
  filter: brightness(1.05);
}

.btn-secondary {
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
}

.btn-sm {
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: #fff;
  font-size: 0.75rem;
  cursor: pointer;
}

.btn-sm.danger {
  border-color: rgba(255, 75, 106, 0.7);
  color: #ffd4df;
}

.btn-sm:hover {
  background: rgba(255, 255, 255, 0.12);
}

.btn-like {
  border-radius: var(--radius-pill);
  padding: 4px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.04);
  color: #fff;
  font-size: 0.8rem;
  cursor: pointer;
}

.btn-like.liked {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #fff;
}

.section-header {
  margin-bottom: 14px;
}

.section-header h1,
.section-header h2 {
  margin: 0 0 4px;
}

/* Cards & grids */

.thread-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.thread-card {
  background: radial-gradient(circle at top left, #1d1d2e, #101018);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(255, 255, 255, 0.06);
  display: flex;
  flex-direction: column;
}

.thumb-link {
  display: block;
  overflow: hidden;
  max-height: 180px;
}

.thumb-link img {
  display: block;
  width: 100%;
  height: 180px;
  object-fit: cover;
  transition: transform 0.25s ease-out;
}

.thumb-link:hover img {
  transform: scale(1.05);
}

.thumb-placeholder {
  height: 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  background: #181828;
  font-size: 0.85rem;
}

.thumb-placeholder.small {
  height: 60px;
  border-radius: 12px;
}

.thread-info {
  padding: 10px 12px 12px;
}

.thread-title {
  margin: 4px 0 4px;
  font-size: 1rem;
}

.thread-meta-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.thread-meta-bottom {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 4px;
}

.meta-item {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.badge {
  display: inline-flex;
  font-size: 0.75rem;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

.badge-category {
  background: rgba(255, 255, 255, 0.04);
}

.badge-admin {
  border-color: rgba(255, 183, 0, 0.9);
  color: #ffe9a3;
}

.badge-top {
  border-color: rgba(135, 206, 250, 0.8);
  color: #bde6ff;
}

/* Category page layout */

.category-page {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-header {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.category-header .btn-primary {
  margin-top: 8px;
  align-self: flex-start;
}

.category-layout {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1fr);
  gap: 18px;
}

.category-sidebar {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.category-panel {
  background: rgba(10, 10, 20, 0.9);
  border-radius: var(--radius-lg);
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.category-panel h2 {
  margin: 0 0 6px;
  font-size: 0.9rem;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font-size: 0.8rem;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: var(--muted);
}

.pill-active,
.pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}

.simple-list {
  list-style: none;
  padding: 0;
  margin: 4px 0 0;
}

.simple-list li {
  margin-bottom: 6px;
  font-size: 0.85rem;
}

.simple-list li .small {
  display: block;
}

/* Pagination */

.pagination {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.page-link {
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.8rem;
  color: var(--muted);
}

.page-link:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: #fff;
}

.page-active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #fff;
}

/* Forms */

.form-card {
  background: rgba(10, 10, 20, 0.9);
  border-radius: var(--radius-lg);
  padding: 16px 16px 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  max-width: 540px;
}

.form-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.form-row label {
  font-size: 0.9rem;
  margin-bottom: 4px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #050509;
  padding: 8px 10px;
  color: var(--text);
  font-size: 0.9rem;
  outline: none;
}

input[type="file"] {
  color: var(--muted);
  font-size: 0.85rem;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--accent);
}

.help-text {
  margin: 4px 0 0;
  font-size: 0.75rem;
  color: var(--muted);
}

/* Threads */

.thread-page .breadcrumb {
  font-size: 0.75rem;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

.thread-page h1 {
  margin: 0 0 6px;
}

.thread-meta-main {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  font-size: 0.85rem;
  color: var(--muted);
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.tag-row.inline {
  margin-top: 0;
}

.tag-pill {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 0.75rem;
  color: var(--muted);
}

.tag-pill:hover {
  text-decoration: none;
  border-color: var(--accent);
  color: #fff;
}

.posts {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.post {
  background: rgba(10, 10, 20, 0.9);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 10px 12px;
}

.post-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  margin-bottom: 6px;
}

.post-author {
  font-weight: 500;
}

.post-timestamp {
  color: var(--muted);
}

.post-body p {
  margin: 0 0 6px;
  font-size: 0.95rem;
}

/* Bigger images inside threads */
.post-images {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 6px;
}

.post-images img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* On small screens, stack images in a single column */
@media (max-width: 720px) {
  .post-images {
    grid-template-columns: minmax(0, 1fr);
  }
}

.post-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* Activity list */

.activity-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.activity-item {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 10px;
  padding: 8px 10px;
  border-radius: 14px;
  background: rgba(10, 10, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 8px;
}

.activity-thumb img {
  width: 70px;
  height: 70px;
  border-radius: 12px;
  object-fit: cover;
}

.activity-body {
  font-size: 0.85rem;
}

.activity-topline {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 2px;
}

.activity-title {
  font-weight: 500;
  margin-bottom: 2px;
}

.activity-meta {
  margin-top: 2px;
  font-size: 0.8rem;
  color: var(--muted);
}

/* Profile */

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

.profile-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 6px;
}

/* Category grid */

.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.category-card {
  background: rgba(10, 10, 20, 0.9);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-soft);
}

.category-card h3 {
  margin: 0 0 4px;
}

.btn-sm {
  margin-top: 6px;
}

/* Search */

.search-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

/* Auth */

.auth-page {
  max-width: 520px;
}

/* Responsiveness */

@media (max-width: 800px) {
  .header-inner {
    flex-wrap: wrap;
  }
  .main-nav {
    order: 3;
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
  .account-nav {
    margin-left: 0;
  }
  .category-layout,
  .profile-layout {
    grid-template-columns: minmax(0, 1fr);
  }
}

.user-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.user-table th,
.user-table td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.user-table th {
  text-align: left;
  font-weight: 500;
  color: var(--muted);
}

.user-table tr:hover {
  background: rgba(255, 255, 255, 0.03);
}


.account-link {
  font-size: 0.8rem;
  margin: 0 10px;
  color: var(--muted);
}

.account-link:hover {
  color: #ffffff;
}


.home-layout {
  display: grid;
  grid-template-columns: minmax(0, 5fr) minmax(260px, 280px);
  gap: 28px;
  align-items: flex-start;
}

.home-main {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.home-sidebar {
  background: rgba(10, 10, 20, 0.96);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  box-shadow: var(--shadow-soft);
}

.home-sidebar h2 {
  font-size: 1rem;
  margin: 0 0 4px 0;
}

.sidebar-thread-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

/* Featured sidebar card layout - bigger thumbnail */
.sidebar-thread a {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr); /* wider thumb column */
  gap: 10px;
  align-items: flex-start; /* text starts at top, not vertically centered */
  text-decoration: none;
  color: inherit;
}

.sidebar-thumb {
  width: 96px;
  height: 96px;
  border-radius: 14px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.02);
}

.sidebar-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-placeholder.small {
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.sidebar-thread-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.sidebar-thread-title {
  font-size: 0.9rem;
  margin: 0;
}

.meta-line.small {
  font-size: 0.75rem;
  color: var(--muted);
}

.meta-line.tiny {
  font-size: 0.7rem;
  color: var(--muted);
}

@media (max-width: 720px) {
  .home-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .home-sidebar {
    order: 2;
  }

  .home-main {
    order: 1;
  }
}


.threads-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}

.thread-sort-row {
  justify-content: flex-end;
}


body.lightbox-open {
  overflow: hidden;
}

.lightbox {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.lightbox.is-open {
  display: flex;
}

.lightbox-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.9);
}

.lightbox-image {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: var(--shadow-soft);
}

.lightbox-close,
.lightbox-prev,
.lightbox-next {
  position: absolute;
  border: none;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border-radius: var(--radius-pill);
  padding: 8px 14px;
  font-size: 1.2rem;
  cursor: pointer;
}

.lightbox-close {
  top: 16px;
  right: 18px;
  font-size: 1.6rem;
}

.lightbox-prev {
  left: 20px;
}

.lightbox-next {
  right: 20px;
}

.lightbox-prev,
.lightbox-next {
  transform: translateY(-50%);
  top: 50%;
}

.lightbox-close:hover,
.lightbox-prev:hover,
.lightbox-next:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Home spacing tweaks: reduce vertical gap between sections */
.home-layout {
  row-gap: 14px; /* keep column gap but tighten rows */
}

.home-main {
  gap: 10px; /* was 14px - brings Featured threads closer to categories */
}
