:root {
  --app-bg: #0b0d12;
  --app-surface: #151923;
  --app-surface-hover: #1c2230;
  --app-border: #262c3a;
  --app-accent: #ffc107;
  --app-muted: #8b93a7;
  --app-sidebar-width: 250px;
}

body {
  background: var(--app-bg);
  color: #e6e8ee;
}

a {
  color: var(--app-accent);
}

/* Layout */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.app-main {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
}

/* Grows so the footer stays at the bottom on short pages */
.app-content {
  flex: 1;
  padding: 2rem;
  max-width: 1400px;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 1020;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--app-surface);
  border-bottom: 1px solid var(--app-border);
}

/* Sidebar */
.app-sidebar {
  background: var(--app-surface);
  border-right: 1px solid var(--app-border);
}

@media (min-width: 992px) {
  .app-sidebar {
    position: sticky;
    top: 0;
    width: var(--app-sidebar-width);
    height: 100vh;
    flex-shrink: 0;
  }

  /* Bootstrap hides .offcanvas-header from lg up; keep the logo visible */
  .app-sidebar .offcanvas-header {
    display: flex;
  }

  .app-sidebar .offcanvas-body {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 72px);
  }
}

.app-sidebar .offcanvas-header {
  padding: 1.25rem;
}

.app-sidebar .offcanvas-body {
  flex-direction: column;
  padding: 0 0.75rem 1rem;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--app-accent);
  text-decoration: none;
  font-size: 1.1rem;
}

/* The logo file has wide black margins: crop them and blend the black into the sidebar */
.app-brand-logo {
  display: block;
  width: 200px;
  max-width: 100%;
  aspect-ratio: 7 / 1;
  object-fit: cover;
  mix-blend-mode: lighten;
}

.app-brand-text {
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.app-nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.6rem 0.85rem;
  border-radius: 0.5rem;
  color: #c9cedb;
  text-decoration: none;
}

.app-nav-link:hover {
  background: var(--app-surface-hover);
  color: #fff;
}

.app-nav-link.active {
  background: rgba(255, 193, 7, 0.12);
  color: var(--app-accent);
  font-weight: 600;
}

.app-nav-button {
  border: 0;
  background: none;
  text-align: left;
}

.app-sidebar-footer {
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--app-border);
}

.bounty-share-link {
  flex: 1 1 18rem;
  width: auto;
}

.app-language {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0 0.85rem 0.5rem;
  color: var(--app-muted);
}

.app-user {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.85rem;
  color: var(--app-muted);
}

/* Page header */
.page-header {
  margin-bottom: 1.75rem;
}

.page-title {
  margin: 0;
  font-size: 1.85rem;
  font-weight: 700;
}

.page-subtitle {
  margin: 0.25rem 0 0;
  color: var(--app-muted);
}

.breadcrumb {
  margin-bottom: 0.5rem;
  font-size: 0.9rem;
}

.section-title {
  margin-bottom: 1rem;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--app-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Cards */
.app-card {
  padding: 1.25rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.collection-card {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

.collection-card:hover {
  border-color: var(--app-accent);
  transform: translateY(-2px);
}

.collection-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.collection-description {
  margin: 0;
  color: var(--app-muted);
}

.collection-card .badge {
  align-self: flex-start;
}

.progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--app-muted);
}

.progress {
  height: 0.5rem;
  background: var(--app-border);
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin: 0;
  text-align: center;
}

.mini-stats dt {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--app-muted);
  text-transform: uppercase;
}

.mini-stats dd {
  margin: 0;
  font-size: 1.1rem;
  font-weight: 600;
}

.login-card {
  max-width: 420px;
}

/* Standalone login page */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, rgba(255, 193, 7, 0.08), transparent 60%),
    var(--app-bg);
}

.login-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  min-height: 100vh;
  padding: 2rem 1rem;
}

.login-logo .app-brand-logo {
  width: 320px;
}

.login-wrapper .login-card {
  width: 100%;
  padding: 2rem;
}

.login-title {
  margin-bottom: 0.25rem;
  font-size: 1.5rem;
  font-weight: 700;
}

.login-subtitle {
  margin-bottom: 1.5rem;
  color: var(--app-muted);
}

.login-switch {
  margin: 1.5rem 0 0;
  text-align: center;
  color: var(--app-muted);
}

.login-back {
  color: var(--app-muted);
  text-decoration: none;
}

.login-back:hover {
  color: var(--app-accent);
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  color: var(--app-muted);
}

.empty-state i {
  font-size: 2.5rem;
}

/* Stats */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.stat-card {
  display: flex;
  flex-direction: column;
  padding: 1.25rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
  color: inherit;
  text-decoration: none;
}

a.stat-card:hover {
  border-color: var(--app-accent);
}

.stat-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--app-accent);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  color: var(--app-muted);
}

/* Toolbar */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.app-search {
  flex: 1 1 320px;
  max-width: 480px;
}

.filter-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Figures */
.figure-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1rem;
}

.figure-card {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

.figure-image {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 5;
  background: #0f1219;
  color: var(--app-border);
  font-size: 3.5rem;
}

.figure-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.figure-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.9rem;
}

.figure-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  color: var(--app-muted);
}

.figure-number {
  font-weight: 600;
  color: var(--app-accent);
  font-variant-numeric: tabular-nums;
}

.figure-name {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.3;
}

.figure-name a {
  color: inherit;
  text-decoration: none;
}

.figure-card:hover {
  border-color: var(--app-accent);
}

.figure-body .badge {
  align-self: flex-start;
}

.figure-source {
  margin: 0;
  font-size: 0.8rem;
  color: var(--app-muted);
}

.figure-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-top: auto;
  padding-top: 0.5rem;
}

.figure-link {
  position: relative;
  z-index: 2; /* stay clickable above the card's stretched link */
  margin-left: auto;
  color: var(--app-muted);
}

.figure-link:hover {
  color: var(--app-accent);
}

.figure-price {
  margin-left: auto;
  font-size: 0.85rem;
  color: var(--app-muted);
}

/* Figure detail */
.detail-subtitle {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.35rem;
}

.detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 380px) minmax(0, 1fr);
  gap: 2rem;
  align-items: start;
}

.detail-main-image {
  display: flex;
  align-items: center;
  justify-content: center;
  aspect-ratio: 4 / 5;
  overflow: hidden;
  background: #0f1219;
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

.detail-main-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.image-credit {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  width: fit-content;
  margin: 0.5rem 0 0;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  color: var(--app-muted);
  background: #0f1219;
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
}

.image-credit[hidden] {
  display: none;
}

.image-credit strong {
  color: var(--app-accent);
  font-weight: 500;
}

.image-credit a {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: var(--app-accent);
  text-decoration: none;
}

.image-credit a:hover strong {
  text-decoration: underline;
}

.detail-thumbs {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
  gap: 0.5rem;
  margin-top: 0.75rem;
}

.detail-thumb {
  padding: 0;
  aspect-ratio: 1;
  overflow: hidden;
  background: #0f1219;
  border: 2px solid var(--app-border);
  border-radius: 0.5rem;
}

.detail-thumb.active,
.detail-thumb:hover {
  border-color: var(--app-accent);
}

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

.detail-fields {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 0.5rem 1.5rem;
  margin: 0 0 1rem;
}

.detail-fields dt {
  font-weight: 400;
  color: var(--app-muted);
}

.detail-fields dd {
  margin: 0;
}

.accessory-list {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0;
  list-style: none;
}

.accessory-list li {
  padding: 0.3rem 0.75rem;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 999px;
  font-size: 0.9rem;
}

.active-version {
  border-left: 3px solid var(--app-accent);
  font-weight: 600;
}

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

/* Forms */
.form-card {
  max-width: 640px;
}

.choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.choice-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 0.9rem;
  border: 1px solid var(--app-border);
  border-radius: 0.5rem;
  cursor: pointer;
}

.choice-option:has(input:checked) {
  border-color: var(--app-accent);
  background: rgba(255, 193, 7, 0.1);
}

.choice-option input {
  accent-color: var(--app-accent);
}

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

  .detail-gallery {
    max-width: 420px;
  }
}

@media (max-width: 575.98px) {
  .app-content {
    padding: 1.25rem 1rem;
  }

  .figure-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
  }

  .mini-stats {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* Community submissions */
.submission-form {
  max-width: 900px;
}

.form-section {
  margin-bottom: 1.5rem;
}

.form-section .section-title {
  font-size: 0.95rem;
}

.form-section .mb-3 {
  margin-bottom: 0 !important;
}

.changes-table th[scope="row"] {
  width: 12rem;
  color: var(--app-muted);
  font-weight: 500;
}

.changes-table td.is-proposed {
  color: var(--app-accent);
  font-weight: 600;
}

.submission-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
}

.submission-image {
  position: relative;
  display: flex;
  flex-direction: column;
  margin: 0;
  overflow: hidden;
  background: var(--app-surface);
  border: 1px solid var(--app-border);
  border-radius: 0.75rem;
}

.submission-image img {
  width: 100%;
  aspect-ratio: 4 / 5;
  object-fit: contain;
  background: #0f1219;
}

.submission-image figcaption,
.submission-image .figcaption {
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  color: var(--app-muted);
}

.submission-image.is-selectable {
  cursor: pointer;
}

.submission-image.is-selectable .form-check-input {
  position: absolute;
  top: 0.6rem;
  left: 0.6rem;
  width: 1.3rem;
  height: 1.3rem;
  margin: 0;
}

.submission-image.is-selectable:has(.form-check-input:checked) {
  border-color: var(--app-accent);
}

.submission-image.is-selectable:has(.form-check-input:not(:checked)) img {
  opacity: 0.35;
}

.review-edit summary {
  cursor: pointer;
  font-weight: 600;
}

/* News */
.news-list {
  display: grid;
  gap: 1rem;
  max-width: 820px;
}

.news-card {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.news-card-image {
  display: block;
  margin: -1.25rem -1.25rem 0.5rem;
  aspect-ratio: 16 / 7;
  overflow: hidden;
  border-radius: 0.75rem 0.75rem 0 0;
}

.news-card-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.news-card-title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.news-card-title a {
  color: inherit;
  text-decoration: none;
}

.news-card-title a:hover {
  color: var(--app-accent);
}

.news-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.875rem;
  color: var(--app-muted);
}

.news-article {
  max-width: 820px;
}

.news-article-image {
  display: block;
  width: 100%;
  max-height: 420px;
  margin-bottom: 1.25rem;
  object-fit: cover;
  border-radius: 0.5rem;
}

.news-body {
  line-height: 1.7;
  overflow-wrap: anywhere;
}

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

.news-form {
  max-width: 820px;
}

/* Featured contributors */
.contributor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.contributor-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.contributor-avatar {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 112px;
  height: 112px;
  overflow: hidden;
  font-size: 2.5rem;
  font-weight: 600;
  color: var(--app-accent);
  background: #0f1219;
  border: 2px solid var(--app-accent);
  border-radius: 50%;
}

.contributor-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.contributor-name {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 600;
}

.contributor-description {
  color: var(--app-muted);
}

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

.contributor-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.5rem;
  margin: auto 0 0;
  padding: 0;
  list-style: none;
}

.contributor-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.85rem;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--app-border);
  border-radius: 999px;
}

.contributor-links a:hover {
  color: var(--app-accent);
  border-color: var(--app-accent);
}

/* Collection Excel export */
.export-columns {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
}

/* Landing */
.landing {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at top, rgba(255, 193, 7, 0.12), transparent 60%),
    radial-gradient(1px 1px at 20% 30%, #fff, transparent),
    radial-gradient(1px 1px at 70% 15%, #fff, transparent),
    radial-gradient(1px 1px at 85% 60%, #fff, transparent),
    radial-gradient(1px 1px at 35% 80%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 55% 45%, #fff, transparent),
    radial-gradient(1px 1px at 10% 70%, #fff, transparent),
    var(--app-bg);
}

.landing-header {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  padding: 1rem 1.5rem;
}

.landing-header .app-language {
  padding: 0;
}

.landing-hero {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem 4rem;
  text-align: center;
}

.landing-logo {
  width: min(460px, 85vw);
  height: auto;
  margin-bottom: 2rem;
  /* The logo has a black background; blend it into the page */
  mix-blend-mode: lighten;
}

.landing-title {
  max-width: 720px;
  margin: 0 0 1rem;
  font-size: clamp(1.6rem, 4vw, 2.5rem);
  font-weight: 700;
}

.landing-subtitle {
  max-width: 560px;
  margin: 0 0 2rem;
  color: var(--app-muted);
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1rem;
}

.landing-stats {
  margin: 2rem 0 0;
  font-size: 0.9rem;
  color: var(--app-muted);
}

/* Footer */

.app-footer {
  padding: 1.5rem 2rem;
  border-top: 1px solid var(--app-border);
  font-size: 0.8rem;
  color: var(--app-muted);
}

.app-footer-disclaimer {
  max-width: 900px;
  margin: 0 0 0.5rem;
}

.app-footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
}

.app-footer-links a {
  color: var(--app-muted);
}

.app-footer-links a:hover {
  color: var(--app-accent);
}

.landing .app-footer,
.login-page .app-footer {
  text-align: center;
}

.landing .app-footer-disclaimer,
.login-page .app-footer-disclaimer {
  margin-inline: auto;
}

.landing .app-footer-links,
.login-page .app-footer-links {
  justify-content: center;
}

.login-legal {
  margin: 0.5rem 0 0;
  font-size: 0.8rem;
  color: var(--app-muted);
}

/* Legal pages */

.legal-page {
  max-width: 820px;
}

.legal-page h2 {
  margin: 2rem 0 0.75rem;
  font-size: 1.15rem;
  font-weight: 700;
}

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

.legal-page li {
  margin-bottom: 0.35rem;
}
