/* ==========================================================================
   NDTZ — site chrome: header, footer, landing, legal/contact, leaderboard.
   Dashboard styles live in dash.css.
   ========================================================================== */

/* --------------------------------------------------------------- header -- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  background: color-mix(in srgb, var(--n-1) 78%, transparent);
  backdrop-filter: blur(16px) saturate(160%);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 18px;
  height: 100%;
  max-width: none;
  padding-inline: 22px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 620;
  font-size: 1.02rem;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

.brand .mark {
  transition: transform var(--d-base) var(--ease-spring);
}

@media (hover: hover) and (pointer: fine) {
  .brand:hover .mark {
    transform: rotate(-6deg) scale(1.06);
  }
}

.brand .sub {
  font-size: var(--t-xs);
  font-weight: 450;
  color: var(--text-3);
  padding-left: 9px;
  margin-left: 2px;
  border-left: 1px solid var(--line-hi);
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-left: 8px;
}

.site-nav a {
  padding: 7px 11px;
  border-radius: var(--r-xs);
  font-size: var(--t-sm);
  font-weight: 480;
  color: var(--text-3);
  transition:
    color var(--d-fast) ease,
    background-color var(--d-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .site-nav a:hover {
    color: var(--text);
    background: var(--surface-2);
  }
}

.site-nav a[aria-current='page'] {
  color: var(--text);
}

/* User chip: avatar + name + logout, collapsing to just the avatar on
   narrow screens. */
.userchip {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 34px;
  padding: 0 4px 0 4px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line);
}

.userchip img,
.userchip .noimg {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: var(--t-xs);
}

.userchip .nm {
  font-size: var(--t-sm);
  font-weight: 520;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.userchip .out {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  color: var(--text-3);
  transition:
    color var(--d-fast) ease,
    background-color var(--d-fast) ease,
    transform var(--d-press) var(--ease-out);
}

.userchip .out:hover {
  color: var(--text);
  background: var(--surface-3);
}

.userchip .out:active {
  transform: scale(0.9);
}

/* --------------------------------------------------------------- footer -- */

.site-footer {
  margin-top: auto;
  border-top: 1px solid var(--line);
  background: var(--bg-raised);
}

.footer-grid {
  display: grid;
  grid-template-columns: 1.6fr repeat(3, 1fr);
  gap: 40px;
  padding: 48px 0 36px;
}

.footer-brand p {
  margin-top: 12px;
  font-size: var(--t-sm);
  color: var(--text-3);
  max-width: 34ch;
  line-height: 1.6;
}

.footer-col h4 {
  font-size: var(--t-micro);
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 14px;
}

.footer-col a {
  display: block;
  padding: 4px 0;
  font-size: var(--t-sm);
  color: var(--text-2);
  transition: color var(--d-fast) ease;
}

.footer-col a:hover {
  color: var(--text);
}

.lang-picker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 20px;
}

.lang-picker .select {
  width: auto;
  padding-block: 6px;
  font-size: var(--t-xs);
}

.footer-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 16px 0 22px;
  border-top: 1px solid var(--line);
  font-size: var(--t-xs);
  color: var(--text-3);
}

/* -------------------------------------------------------------- landing -- */

main {
  position: relative;
  z-index: 1;
  flex: 1;
}

/* The brand glow lives on the hero only, not fixed behind the whole site.
   Ambience everywhere means the red stops signalling anything. */
.hero {
  position: relative;
  overflow: hidden;
  padding: 92px 0 76px;
  text-align: center;
  isolation: isolate;
}

.hero::before {
  content: '';
  position: absolute;
  z-index: -1;
  top: -340px;
  left: 50%;
  width: 1100px;
  height: 700px;
  transform: translateX(-50%);
  background: radial-gradient(closest-side, var(--brand-a16), transparent 72%);
  pointer-events: none;
}

/* A faint grid, masked to fade out — gives the dark field some texture
   without being a visible pattern. Pure CSS, no image. */
.hero::after {
  content: '';
  position: absolute;
  z-index: -2;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(255, 255, 255, 0.028) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.028) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 30%, #000 20%, transparent 75%);
  pointer-events: none;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  background: var(--surface);
  border: 1px solid var(--line-hi);
  box-shadow: var(--hairline);
  font-size: var(--t-xs);
  color: var(--text-2);
}

.hero h1 {
  margin: 22px auto 0;
  max-width: 16ch;
}

/* Gradient headline: white falling to a soft grey, so the red CTA below is
   the brightest thing on screen. */
.hero h1 .grad {
  background: linear-gradient(178deg, #ffffff 30%, #9a9aad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.hero .t-lead {
  margin: 20px auto 0;
  max-width: 56ch;
}

.hero-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 32px;
}

.hero-note {
  margin-top: 16px;
  font-size: var(--t-xs);
  color: var(--text-3);
}

/* — live stats strip — */
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: 640px;
  margin: 56px auto 0;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: var(--sh-md), var(--hairline);
  overflow: hidden;
}

.stat {
  padding: 20px 12px;
  border-right: 1px solid var(--line);
}

.stat:last-child {
  border-right: 0;
}

.stat .num {
  display: block;
  font-size: 1.75rem;
  font-weight: 620;
  letter-spacing: -0.035em;
  font-variant-numeric: tabular-nums;
}

.stat .lbl {
  display: block;
  margin-top: 2px;
  font-size: var(--t-xs);
  color: var(--text-3);
}

/* — sections — */
.section {
  padding: 76px 0;
}

.section-head {
  max-width: 620px;
  margin-bottom: 40px;
}

.section-head.center {
  margin-inline: auto;
  text-align: center;
}

.section-head h2 {
  margin-top: 12px;
}

.section-head p {
  margin-top: 12px;
  color: var(--text-2);
  text-wrap: pretty;
}

/* — feature bento —
   Deliberately uneven: two wide cards anchor the grid, four small ones fill
   it. A uniform 3×2 of identical boxes is what the old panel had, and it
   reads as a list rather than a composition. */
.bento {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 16px;
}

.f-card {
  position: relative;
  overflow: hidden;
  grid-column: span 2;
  padding: 24px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--hairline);
  transition:
    border-color var(--d-base) ease,
    transform var(--d-base) var(--ease-out),
    background-color var(--d-base) ease;
}

.f-card.wide {
  grid-column: span 3;
}

@media (hover: hover) and (pointer: fine) {
  .f-card:hover {
    border-color: var(--line-brand);
    background: var(--surface-2);
    transform: translateY(-2px);
  }
}

.f-card .f-ico {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  margin-bottom: 16px;
  border-radius: var(--r-sm);
  background: var(--brand-a08);
  border: 1px solid var(--brand-a16);
  color: var(--brand-hi);
}

.f-card h3 {
  font-size: var(--t-h3);
}

.f-card p {
  margin-top: 8px;
  font-size: var(--t-sm);
  color: var(--text-3);
  line-height: 1.6;
  text-wrap: pretty;
}

.f-card .f-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 16px;
}

/* — closing CTA — */
.cta {
  position: relative;
  overflow: hidden;
  padding: 56px 32px;
  border-radius: var(--r-xl);
  border: 1px solid var(--line-brand);
  background:
    radial-gradient(120% 130% at 50% -20%, var(--brand-a16), transparent 62%),
    var(--surface);
  text-align: center;
  box-shadow: var(--sh-lg), var(--hairline);
}

.cta p {
  margin: 12px auto 0;
  max-width: 48ch;
  color: var(--text-2);
}

/* --------------------------------------------------------- prose pages -- */

.page-head {
  padding: 56px 0 28px;
  border-bottom: 1px solid var(--line);
}

.page-head h1 {
  margin-top: 10px;
}

.page-head .updated {
  margin-top: 12px;
  font-size: var(--t-xs);
  color: var(--text-3);
}

.prose {
  padding: 36px 0 76px;
  font-size: var(--t-body);
  color: var(--text-2);
  line-height: 1.72;
}

.prose h2 {
  margin: 40px 0 12px;
  font-size: 1.25rem;
  color: var(--text);
}

.prose h2:first-child {
  margin-top: 0;
}

.prose h3 {
  margin: 26px 0 8px;
  font-size: 1rem;
  color: var(--text);
}

.prose p {
  margin-bottom: 14px;
  text-wrap: pretty;
}

.prose ul,
.prose ol {
  margin: 0 0 16px 20px;
}

.prose li {
  margin-bottom: 7px;
}

.prose a {
  color: var(--brand-hi);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  text-decoration-color: var(--brand-a48);
  transition: text-decoration-color var(--d-fast) ease;
}

.prose a:hover {
  text-decoration-color: var(--brand-hi);
}

.prose strong {
  color: var(--text);
  font-weight: 580;
}

.prose code {
  font-family: var(--font-mono);
  font-size: 0.86em;
  padding: 2px 5px;
  border-radius: var(--r-xs);
  background: var(--surface-2);
  border: 1px solid var(--line);
}

/* Callout for the load-bearing statements on the legal pages. */
.callout {
  display: flex;
  gap: 12px;
  padding: 16px 18px;
  margin: 20px 0;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 2px solid var(--brand);
}

.callout .ico {
  color: var(--brand-hi);
  margin-top: 3px;
  flex: none;
}

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

/* -------------------------------------------------------------- contact -- */

.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 28px 0;
}

.contact-card {
  padding: 22px;
  border-radius: var(--r-lg);
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--hairline);
  transition: border-color var(--d-base) ease;
}

.contact-card:hover {
  border-color: var(--line-hi);
}

.contact-card .f-ico {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  margin-bottom: 14px;
  border-radius: var(--r-sm);
  background: var(--brand-a08);
  border: 1px solid var(--brand-a16);
  color: var(--brand-hi);
}

.contact-card h3 {
  font-size: var(--t-h3);
}

.contact-card p {
  margin: 7px 0 14px;
  font-size: var(--t-sm);
  color: var(--text-3);
}

/* ---------------------------------------------------------- leaderboard -- */

.lb-head {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 40px 0 24px;
}

.lb-head img,
.lb-head .noimg {
  width: 60px;
  height: 60px;
  border-radius: 30%;
  font-size: 1.4rem;
}

.lb-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-bottom: 76px;
}

.lb-row {
  display: grid;
  grid-template-columns: 44px 40px 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-radius: var(--r-md);
  background: var(--surface);
  border: 1px solid var(--line);
  transition:
    border-color var(--d-fast) ease,
    background-color var(--d-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .lb-row:hover {
    background: var(--surface-2);
    border-color: var(--line-hi);
  }
}

.lb-rank {
  font-size: var(--t-body);
  font-weight: 620;
  color: var(--text-3);
  font-variant-numeric: tabular-nums;
  text-align: center;
}

/* Top three get metal, not more red — red is the product's colour, and
   using it for rank would compete with the CTA language everywhere else. */
.lb-row.top1 {
  border-color: rgba(240, 190, 80, 0.35);
  background: linear-gradient(90deg, rgba(240, 190, 80, 0.09), var(--surface) 40%);
}
.lb-row.top1 .lb-rank {
  color: #f0be50;
}
.lb-row.top2 {
  border-color: rgba(200, 205, 215, 0.28);
}
.lb-row.top2 .lb-rank {
  color: #c8cdd7;
}
.lb-row.top3 {
  border-color: rgba(205, 140, 90, 0.28);
}
.lb-row.top3 .lb-rank {
  color: #cd8c5a;
}

.lb-row .avatar {
  width: 40px;
  height: 40px;
}

.lb-name {
  min-width: 0;
  font-weight: 520;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lb-meta {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-size: var(--t-sm);
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

.lb-meta .lvl {
  font-weight: 600;
  color: var(--text);
}

/* -------------------------------------------------------- responsive ---- */

@media (max-width: 1000px) {
  .bento {
    grid-template-columns: repeat(4, 1fr);
  }
  .f-card,
  .f-card.wide {
    grid-column: span 2;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 32px;
  }
}

@media (max-width: 760px) {
  :root {
    --t-display: 2.35rem;
    --t-h1: 1.85rem;
    --t-h2: 1.4rem;
    --gutter: 18px;
  }

  .site-nav {
    display: none;
  }

  .brand .sub {
    display: none;
  }

  .userchip .nm {
    display: none;
  }

  .hero {
    padding: 60px 0 52px;
  }

  .section {
    padding: 52px 0;
  }

  .bento {
    grid-template-columns: 1fr;
  }

  .f-card,
  .f-card.wide {
    grid-column: span 1;
  }

  .footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
    padding-top: 36px;
  }

  .stats {
    margin-top: 40px;
  }

  .stat .num {
    font-size: 1.4rem;
  }

  .cta {
    padding: 40px 20px;
  }

  .hero-cta .btn {
    width: 100%;
  }

  .lb-row {
    grid-template-columns: 34px 34px 1fr;
    row-gap: 6px;
  }

  .lb-meta {
    grid-column: 2 / -1;
  }
}

/* ------------------------------------------------------- features page --- */

/* Section spine: sticky jump links, so a long reference page stays navigable
   without a table of contents nobody reads. */
/* Full-bleed sticky bar. It is a direct child of <main> on purpose: sticky
   positioning is relative to the containing block, so a wrapper that holds
   only the bar would let it scroll straight out of view. */
.jumpbar {
  position: sticky;
  top: var(--header-h);
  z-index: 40;
  padding: 10px 0;
  margin-bottom: 8px;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.jumpbar-inner {
  display: flex;
  gap: 4px;
  overflow-x: auto;
  scrollbar-width: none;
}

.jumpbar-inner::-webkit-scrollbar {
  display: none;
}

.jumpbar-inner a {
  flex: none;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  font-size: var(--t-sm);
  font-weight: 490;
  color: var(--text-3);
  white-space: nowrap;
  transition:
    color var(--d-fast) ease,
    background-color var(--d-fast) ease;
}

@media (hover: hover) and (pointer: fine) {
  .jumpbar-inner a:hover {
    color: var(--text);
    background: var(--surface-2);
  }
}

.fsec {
  padding: 56px 0;
  border-top: 1px solid var(--line);
}

.fsec:first-of-type {
  border-top: 0;
}

.fsec-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 28px;
}

.fsec-head p {
  margin-top: 8px;
  color: var(--text-2);
  max-width: 66ch;
  text-wrap: pretty;
}

.f-ico.lg {
  width: 46px;
  height: 46px;
  border-radius: var(--r-md);
  margin-bottom: 0;
}

/* A wall of small chips — reads as "there are a lot of these" faster than a
   list does, which is the whole point for the games section. */
.chip-wall {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-wall .badge {
  height: 30px;
  padding: 0 13px;
  font-size: var(--t-sm);
  font-weight: 480;
  letter-spacing: 0;
}

/* — command reference — */

.cmd-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
  gap: 20px;
  align-items: start;
}

.cmd-group h3 {
  margin-bottom: 12px;
}

.cmd-group .list-row {
  align-items: flex-start;
  gap: 14px;
}

.cmd-name {
  flex: none;
  min-width: 96px;
  font-family: var(--font-mono);
  font-size: var(--t-sm);
  color: var(--brand-hi);
}

.cmd-desc {
  color: var(--text-3);
  line-height: 1.5;
}

@media (max-width: 760px) {
  .fsec {
    padding: 40px 0;
  }

  .fsec-head {
    gap: 12px;
  }

  .cmd-group .list-row {
    flex-direction: column;
    gap: 4px;
  }

  .cmd-name {
    min-width: 0;
  }
}

/* — leaderboard paging — */

.lb-pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 0 76px;
}

.lb-pager .btn.is-disabled {
  opacity: 0.4;
  pointer-events: none;
}

.lb-head .badge {
  margin-left: auto;
  align-self: flex-start;
}

/* --------------------------------------------------- card editor page --- */

.ce {
  padding: 36px 0 120px;
}

.ce-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}

.ce-head .avatar.big,
.ce-head .noimg.avatar {
  width: 56px;
  height: 56px;
  font-size: 1.3rem;
}

/* The preview is the point of the page, so it leads and it is big. 3:1 is the
   card's real aspect ratio — reserving it stops the layout jumping when a
   render swaps in. */
.ce-preview {
  margin-bottom: 24px;
}

.ce-preview img {
  width: 100%;
  aspect-ratio: 3 / 1;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--sh-lg), var(--hairline);
  object-fit: cover;
  transition: opacity var(--d-base) var(--ease-out);
}

/* Dim rather than blank while a new render is in flight: replacing the card
   with a spinner on every keystroke would flicker far more than this. */
.ce-preview img.loading {
  opacity: 0.55;
}

.ce-preview-note {
  margin-top: 10px;
  text-align: center;
}

.ce-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}

.ce-foot {
  margin-top: 20px;
}

/* — theme swatches — */

.swatches {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
  gap: 10px;
}

.swatch {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 7px;
  padding: 7px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--n-1);
  text-align: left;
  transition:
    border-color var(--d-fast) ease,
    transform var(--d-press) var(--ease-out);
}

.swatch .sw-fill {
  display: block;
  height: 46px;
  border-radius: var(--r-sm);
  background: var(--sw);
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.swatch .sw-name {
  font-size: var(--t-xs);
  font-weight: 520;
  padding-left: 2px;
}

.swatch .sw-note {
  position: absolute;
  top: 12px;
  right: 12px;
  padding: 1px 6px;
  border-radius: var(--r-pill);
  background: rgba(0, 0, 0, 0.55);
  font-size: var(--t-micro);
  color: rgba(255, 255, 255, 0.8);
}

@media (hover: hover) and (pointer: fine) {
  .swatch:hover {
    border-color: var(--line-hi);
  }
}

.swatch:active {
  transform: scale(0.97);
}

.swatch.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-a16);
}

/* — colour well — */

.colorwell {
  width: 44px;
  height: 38px;
  padding: 3px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-hi);
  background: var(--n-1);
  cursor: pointer;
}

.colorwell::-webkit-color-swatch-wrapper {
  padding: 0;
}
.colorwell::-webkit-color-swatch {
  border: 0;
  border-radius: 5px;
}
.colorwell::-moz-color-swatch {
  border: 0;
  border-radius: 5px;
}

@media (max-width: 760px) {
  .ce {
    padding-top: 24px;
  }

  .ce-head .avatar.big,
  .ce-head .noimg.avatar {
    width: 44px;
    height: 44px;
  }

  .swatches {
    grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  }
}

/* — font picker — */

.fontlist {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 8px;
}

.fontopt {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--n-1);
  text-align: left;
  transition:
    border-color var(--d-fast) ease,
    background-color var(--d-fast) ease,
    transform var(--d-press) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .fontopt:hover {
    border-color: var(--line-hi);
    background: var(--surface-2);
  }
}

.fontopt:active {
  transform: scale(0.98);
}

.fontopt.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-a16);
}

.fontopt .fo-name {
  font-size: var(--t-sm);
  font-weight: 560;
}

.fontopt .fo-note {
  font-size: var(--t-xs);
  color: var(--text-3);
}
