/* NGN Community — www.gogo only */
:root {
  --bg-deep: #0a0e12;
  --bg: #0f1419;
  --panel: #151d28;
  --panel-hover: #1a2433;
  --text: #eef2f7;
  --muted: #8b97a8;
  --muted2: #5c6a7a;
  --accent: #2ee6a8;
  --accent-dim: #22c090;
  --accent-glow: rgba(46, 230, 168, 0.12);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.12);
  --error: #ff7a7a;
  --ok: #5bd37a;
  --radius: 14px;
  --radius-sm: 10px;
  --font: "DM Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Outfit", var(--font);
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.45);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-l: env(safe-area-inset-left, 0px);
  --safe-r: env(safe-area-inset-right, 0px);
}

* {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  font-weight: 400;
  font-optical-sizing: auto;
  background: var(--bg-deep);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background-image:
    radial-gradient(ellipse 120% 80% at 50% -30%, rgba(46, 230, 168, 0.09), transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 0%, rgba(61, 158, 255, 0.06), transparent 45%),
    linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 38%, #0a1016 100%);
}

a {
  color: var(--accent);
  text-decoration: none;
  text-underline-offset: 0.15em;
}

a:hover {
  color: var(--accent-dim);
  text-decoration: underline;
}

.wrap {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 max(var(--safe-l), clamp(1rem, 4vw, 1.75rem)) 0 max(var(--safe-r), clamp(1rem, 4vw, 1.75rem));
}

.main {
  flex: 1;
  padding: 1.25rem 0 calc(2rem + var(--safe-b));
}

/* ——— Header ——— */
.top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(10, 14, 18, 0.82);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding-top: var(--safe-t);
}

.top__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem 1rem;
  padding: 0.65rem 0;
  min-height: 3.25rem;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.05rem, 3.5vw, 1.2rem);
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none !important;
}

.brand:hover {
  color: var(--accent);
}

.brand__mark {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #3d9eff);
  box-shadow: 0 0 18px var(--accent-glow);
  flex-shrink: 0;
}

.nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.35rem 0.65rem;
  flex-wrap: wrap;
}

.nav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 0.65rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
  font-size: 0.9rem;
  color: var(--text);
  text-decoration: none !important;
}

.nav__link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--accent);
  text-decoration: none !important;
}

.nav__link--primary {
  color: var(--accent);
}

.nav__user {
  color: var(--muted);
  font-size: 0.82rem;
  max-width: 42vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav__logout {
  display: inline;
  margin: 0;
}

.linkbtn {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font: inherit;
  font-size: 0.9rem;
  padding: 0.5rem 0.65rem;
  min-height: 44px;
  border-radius: var(--radius-sm);
  touch-action: manipulation;
}

.linkbtn:hover {
  color: var(--accent);
  text-decoration: underline;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  background: linear-gradient(145deg, var(--accent), #1fc98f);
  color: #04120e !important;
  border: none;
  cursor: pointer;
  text-decoration: none !important;
  box-shadow: 0 4px 20px rgba(46, 230, 168, 0.22);
  touch-action: manipulation;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn:hover {
  filter: brightness(1.06);
  text-decoration: none !important;
  transform: translateY(-1px);
}

.btn:active {
  transform: translateY(0);
}

.btn--small {
  font-size: 0.88rem;
  padding: 0.45rem 0.95rem;
  min-height: 40px;
}

.btn--danger {
  background: linear-gradient(145deg, #e85555, #b83838);
  color: #fff !important;
  box-shadow: 0 4px 16px rgba(232, 85, 85, 0.25);
}

.btn--block {
  width: 100%;
}

.auth-shell {
  max-width: 440px;
  margin: 0 auto;
}

.auth-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 4vw, 1.75rem);
  box-shadow: var(--shadow);
}

.auth-card__title {
  margin-top: 0;
}

.content-card {
  max-width: 720px;
  margin: 0 auto;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: clamp(1.15rem, 3.5vw, 1.6rem);
  box-shadow: var(--shadow);
}

.content-card .page-title:first-child {
  margin-top: 0;
}

.content-card--wide {
  max-width: 900px;
}

.content-card--narrow {
  max-width: 420px;
  text-align: center;
}

.content-card--narrow .lede {
  margin-bottom: 1rem;
}

.content-card--thread {
  max-width: 100%;
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

.subhead {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  margin: 1.25rem 0 0.5rem;
}

.back-link {
  margin-top: 1.25rem;
}

/* ——— Home hero + category grid ——— */
.hero {
  margin-bottom: 1.75rem;
}

.hero__eyebrow {
  margin: 0 0 0.4rem;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.95;
}

.hero__title {
  margin: 0 0 0.5rem;
  font-family: var(--font-display);
  font-size: clamp(1.65rem, 5vw, 2.15rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.15;
}

.hero__lede {
  margin: 0;
  max-width: 42rem;
  color: var(--muted);
  font-size: clamp(0.95rem, 2.8vw, 1.05rem);
}

.hero__lede a {
  font-weight: 500;
}

.catgrid {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.85rem;
}

@media (min-width: 520px) {
  .catgrid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
}

@media (min-width: 900px) {
  .catgrid {
    grid-template-columns: repeat(3, 1fr);
    gap: 1.1rem;
  }
}

.catcard {
  margin: 0;
}

.catcard__link {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  height: 100%;
  padding: 1.1rem 1.15rem;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: inherit !important;
  text-decoration: none !important;
  box-shadow: var(--shadow);
  transition: border-color 0.2s, background 0.2s, transform 0.2s;
}

.catcard__link:hover {
  background: var(--panel-hover);
  border-color: rgba(46, 230, 168, 0.25);
  transform: translateY(-2px);
  text-decoration: none !important;
}

.catcard__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.catcard__name {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  line-height: 1.3;
  color: var(--text);
}

.catcard__badge {
  flex-shrink: 0;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted2);
  background: rgba(255, 255, 255, 0.05);
  padding: 0.25rem 0.5rem;
  border-radius: 999px;
}

.catcard__desc {
  font-size: 0.88rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ——— Section / typography ——— */
.section-head {
  margin-bottom: 1rem;
}

.page-title {
  font-family: var(--font-display);
  font-size: clamp(1.35rem, 4vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 0.35rem;
}

.lede {
  color: var(--muted);
  margin: 0;
  font-size: 0.98rem;
}

.crumb {
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 0.75rem;
}

.crumb__sep {
  margin: 0 0.25rem;
  opacity: 0.5;
}

.actions-bar {
  margin: 0 0 1rem;
}

.thread-head__title {
  margin-bottom: 0.35rem;
}

.thread-head__meta {
  color: var(--muted);
  margin: 0 0 0.75rem;
  font-size: 0.9rem;
}

.danger-form {
  margin: 0.5rem 0 0;
}

/* ——— Topic table (desktop) ——— */
.table-scroll {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.topic-table {
  width: 100%;
  min-width: 520px;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.94rem;
}

.topic-table thead th {
  text-align: left;
  padding: 0.55rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted2);
  border-bottom: 1px solid var(--border-strong);
}

.topic-table tbody td {
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.topic-table tbody tr:last-child td {
  border-bottom: none;
}

.topic-title {
  font-weight: 600;
  color: var(--text) !important;
  text-decoration: none !important;
}

.topic-title:hover {
  color: var(--accent) !important;
  text-decoration: none !important;
}

.topic-table .num,
.topic-table .time {
  white-space: nowrap;
  color: var(--muted);
  font-size: 0.85rem;
  font-variant-numeric: tabular-nums;
}

.topic-table .sub {
  font-size: 0.8rem;
  color: var(--muted2);
  margin-top: 0.25rem;
}

.topic-table .empty {
  color: var(--muted);
  padding: 1.5rem 0.75rem !important;
  text-align: center;
}

/* ——— Topic list: mobile cards ——— */
@media (max-width: 640px) {
  .table-scroll {
    overflow: visible;
    margin: 0;
    padding: 0;
  }

  .topic-table {
    min-width: 0;
  }

  .topic-table thead {
    display: none;
  }

  .topic-table tbody {
    display: block;
  }

  .topic-table .topic-row {
    display: block;
    margin-bottom: 0.85rem;
    padding: 0;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: 0 8px 28px rgba(0, 0, 0, 0.35);
  }

  .topic-table .topic-row--empty td {
    display: block;
    border: none;
    padding: 1.25rem !important;
  }

  .topic-table .topic-row td {
    display: grid;
    grid-template-columns: minmax(5rem, 38%) 1fr;
    align-items: start;
    gap: 0.35rem 0.75rem;
    padding: 0.65rem 0.85rem;
    border: none;
    border-bottom: 1px solid var(--border);
    font-size: 0.92rem;
  }

  .topic-table .topic-row td:last-child {
    border-bottom: none;
  }

  .topic-table .topic-row td::before {
    content: attr(data-label);
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--muted2);
    padding-top: 0.15rem;
  }

  .topic-table .topic-row td[data-label="Topic"] {
    display: block;
    padding: 1rem 0.85rem 0.65rem;
  }

  .topic-table .topic-row td[data-label="Topic"]::before {
    display: block;
    margin-bottom: 0.35rem;
  }
}

.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-top: 1.35rem;
  font-size: 0.92rem;
}

.pager__btn {
  display: inline-flex;
  min-height: 44px;
  align-items: center;
  padding: 0 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text) !important;
  font-weight: 500;
  text-decoration: none !important;
}

.pager__btn:hover {
  border-color: rgba(46, 230, 168, 0.35);
  color: var(--accent) !important;
}

.pager__info {
  color: var(--muted);
  font-size: 0.88rem;
}

/* ——— Posts ——— */
.posts {
  margin: 1.25rem 0;
}

.post {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.05rem;
  margin-bottom: 0.85rem;
  background: rgba(21, 29, 40, 0.65);
  backdrop-filter: blur(6px);
}

.post__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  font-size: 0.86rem;
  color: var(--muted);
  margin-bottom: 0.65rem;
}

.post__head time {
  font-variant-numeric: tabular-nums;
  font-size: 0.82rem;
  flex-shrink: 0;
}

.post__body {
  font-size: 0.96rem;
}

.markdown {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.markdown pre {
  background: #070a0e;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  overflow: auto;
  max-width: 100%;
  border: 1px solid var(--border);
  font-size: 0.86rem;
}

.markdown code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 0.88em;
}

.markdown p:first-child {
  margin-top: 0;
}

.markdown p:last-child {
  margin-bottom: 0;
}

.reply {
  margin-top: 1.75rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.reply h2 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 0.75rem;
}

.reply textarea {
  width: 100%;
  padding: 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #070a0e;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  line-height: 1.5;
  min-height: 9rem;
  resize: vertical;
}

.boxform label {
  display: block;
  margin-bottom: 0.85rem;
  font-weight: 500;
  font-size: 0.92rem;
}

.boxform input[type="email"],
.boxform input[type="password"],
.boxform input[type="text"],
.boxform select,
.boxform textarea {
  display: block;
  width: 100%;
  max-width: 420px;
  margin-top: 0.35rem;
  padding: 0.7rem 0.85rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: #070a0e;
  color: var(--text);
  font: inherit;
  font-size: 1rem;
  min-height: 44px;
}

.boxform textarea {
  min-height: 7rem;
}

.boxform--wide input,
.boxform--wide select,
.boxform--wide textarea {
  max-width: none;
}

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

.success {
  color: var(--ok);
}

.hint {
  color: var(--muted);
  font-size: 0.95rem;
}

.foot {
  border-top: 1px solid var(--border);
  margin-top: auto;
}

.foot__inner {
  padding: 1.25rem 0 calc(1.25rem + var(--safe-b));
  font-size: 0.8rem;
  color: var(--muted2);
  text-align: center;
  line-height: 1.5;
}

.foot p {
  margin: 0;
}

.admin-list {
  padding-left: 1.25rem;
}

.admin-list code {
  font-size: 0.85em;
  color: var(--muted);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 400px) {
  .nav__user {
    max-width: 100%;
    flex-basis: 100%;
    order: 3;
    text-align: right;
  }
}

@media (prefers-reduced-motion: reduce) {
  .btn,
  .catcard__link {
    transition: none !important;
    transform: none !important;
  }
}
