/* ---- Header / Nav ---- */

.site-header {
  border-bottom: 1px solid var(--border);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  position: sticky;
  top: 0;
  z-index: 20;
}

.site-header__inner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  column-gap: var(--space-5);
  height: var(--header-h);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 21px;
  letter-spacing: -0.02em;
  white-space: nowrap;
  justify-self: start;
}

.brand__icon {
  display: block;
  flex-shrink: 0;
}

.brand__dot {
  color: var(--accent);
}

.header-right {
  display: flex;
  align-items: center;
  gap: var(--space-5);
  justify-self: end;
  flex-shrink: 0;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 9px;
  width: clamp(160px, 26vw, 440px);
  height: 40px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--bg);
  color: var(--text-faint);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.header-search:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.header-search svg { flex-shrink: 0; }

.header-search input {
  border: none;
  background: transparent;
  padding: 0;
  height: 100%;
  font-size: 14.5px;
}

.header-search input:focus { box-shadow: none; }
.header-search--mobile { display: none; max-width: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 2px;
}

.nav-links a {
  color: var(--text-muted);
  font-size: 15px;
  font-weight: 600;
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease;
}

.nav-links a:hover { color: var(--text); background: var(--bg-muted); }
.nav-links a.active { color: var(--accent-strong); background: var(--accent-soft); }

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

.icon-btn {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: border-color 0.15s ease, color 0.15s ease, transform 0.15s ease;
}

.icon-btn:hover {
  border-color: var(--border-strong);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-btn:active { transform: scale(0.94); }

.nav-toggle { display: none; }

.cart-btn { position: relative; }

.cart-btn__badge {
  position: absolute;
  top: -5px;
  right: -5px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: #fff;
  font-size: 10px;
  font-weight: 750;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  border: 2px solid var(--bg-elevated);
}

#theme-toggle svg { transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.3, 1.1), opacity 0.2s ease; }
#theme-toggle .icon-moon { display: none; }
#theme-toggle.is-dark .icon-sun { display: none; }
#theme-toggle.is-dark .icon-moon { display: inline-flex; }
#theme-toggle:hover svg { transform: rotate(-14deg); }

/* ---- Generic dropdown menu (user account, language) ---- */

.menu {
  position: relative;
}

.menu__trigger { cursor: pointer; }

.user-chip {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 6px 12px 6px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  font-size: 14px;
  font-weight: 600;
  background: var(--bg-elevated);
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  max-width: 220px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.user-chip:hover { border-color: var(--border-strong); background: var(--bg-muted); }
.user-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.menu__chevron { color: var(--text-faint); flex-shrink: 0; transition: transform 0.15s ease; }
.menu.open .menu__chevron { transform: rotate(180deg); }

.user-chip img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.menu__dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 240px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: var(--space-2);
  z-index: 30;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px) scale(0.98);
  transform-origin: top right;
  transition: opacity 0.16s ease, transform 0.16s cubic-bezier(0.2, 0.8, 0.3, 1.1), visibility 0.16s;
  pointer-events: none;
}


.menu.open .menu__dropdown {
  opacity: 1;
  visibility: visible;
  transform: none;
  pointer-events: auto;
}

.menu__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text);
  transition: background 0.12s ease;
}

.menu__item svg { flex-shrink: 0; color: var(--text-faint); }
.menu__item:hover { background: var(--bg-muted); }
.menu__item--active { color: var(--accent-strong); background: var(--accent-soft); }
.menu__item--danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu__item--danger:hover svg { color: var(--danger); }

.menu__divider {
  border-top: 1px solid var(--border);
  margin: var(--space-2) 4px;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
  font-family: inherit;
  line-height: 1;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}

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

.btn-primary {
  background: var(--accent);
  color: #fff;
  box-shadow: var(--shadow-xs);
}
.btn-primary:hover { background: var(--accent-strong); box-shadow: var(--shadow-sm); transform: translateY(-1px); }

.btn-secondary {
  background: var(--bg-elevated);
  border-color: var(--border);
  color: var(--text);
}
.btn-secondary:hover { border-color: var(--border-strong); background: var(--bg-muted); }

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.btn-danger:hover { filter: brightness(0.96); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
}
.btn-ghost:hover { color: var(--text); background: var(--bg-muted); }

.btn-lg { padding: 15px 28px; font-size: 16px; }
.btn-sm { padding: 8px 14px; font-size: 13.5px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

/* ---- Cards ---- */

.card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  overflow-wrap: anywhere;
}

.complaint-text { white-space: pre-wrap; }

.mod-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(268px, 1fr));
  gap: var(--space-5);
}

.mod-card {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
  animation: card-in 0.4s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.mod-card::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--brand-gradient);
  opacity: 0;
  transition: opacity 0.18s ease;
  z-index: 1;
}

.mod-card:hover::before { opacity: 1; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.mod-grid .mod-card:nth-child(1) { animation-delay: 0.02s; }
.mod-grid .mod-card:nth-child(2) { animation-delay: 0.06s; }
.mod-grid .mod-card:nth-child(3) { animation-delay: 0.10s; }
.mod-grid .mod-card:nth-child(4) { animation-delay: 0.14s; }
.mod-grid .mod-card:nth-child(5) { animation-delay: 0.18s; }
.mod-grid .mod-card:nth-child(6) { animation-delay: 0.22s; }
.mod-grid .mod-card:nth-child(n+7) { animation-delay: 0.24s; }

.mod-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-md);
  transform: translateY(-3px);
}

.mod-card__cover {
  position: relative;
  aspect-ratio: 16 / 10;
  background: linear-gradient(155deg, var(--bg-muted), var(--bg-sunken));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
  font-weight: 600;
}

.mod-card__cover img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.35s ease; }
.mod-card:hover .mod-card__cover img { transform: scale(1.045); }

.mod-card__category-badge {
  position: absolute;
  top: 10px;
  left: 10px;
  max-width: 65%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 4px 11px;
  border-radius: var(--radius-pill);
  font-size: 12px;
  font-weight: 650;
  background: rgba(15, 15, 12, 0.55);
  color: #fff;
  backdrop-filter: blur(4px);
}

.mod-card__new-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.03em;
  background: var(--accent);
  color: #fff;
}

.mod-card__body {
  padding: var(--space-4) var(--space-4) var(--space-5);
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}

.mod-card__title {
  font-weight: 650;
  font-size: 16.5px;
  line-height: 1.35;
}

.mod-card__meta {
  font-size: 13.5px;
  color: var(--text-muted);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: auto;
  padding-top: var(--space-2);
}

.price {
  font-family: var(--font-mono);
  font-weight: 700;
}

/* ---- Mod detail page ---- */

.mod-detail-main {
  flex: 1 1 420px;
  min-width: 0; /* let the column shrink below its cover image's intrinsic size instead of
                   overflowing and getting overlapped by the sticky .mod-buy-box beside it */
}

.mod-buy-box {
  width: 320px;
  max-width: 100%;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
}

.mod-buy-box::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--brand-gradient);
}

.mod-hero {
  position: relative;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-md);
  aspect-ratio: 21 / 7;
  max-height: 340px;
  min-height: 200px;
  background: var(--brand-gradient);
}

.mod-hero__img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  cursor: zoom-in;
  transition: transform 0.4s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.mod-hero:hover .mod-hero__img { transform: scale(1.03); }

.mod-hero__scrim {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(6, 12, 26, 0) 35%, rgba(6, 12, 26, 0.82) 100%);
}

.mod-hero--no-image .mod-hero__scrim {
  background: linear-gradient(180deg, rgba(6, 12, 26, 0.05) 0%, rgba(6, 12, 26, 0.55) 100%);
}

.mod-hero__content {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: var(--space-5);
}

.mod-hero__content h1 {
  color: #fff;
  font-size: 30px;
  margin-bottom: var(--space-2);
  text-shadow: 0 1px 12px rgba(0, 0, 0, 0.25);
}

.mod-hero__breadcrumb a { color: rgba(255, 255, 255, 0.72); }
.mod-hero__breadcrumb a:hover { color: #fff; }
.mod-hero__breadcrumb span { color: rgba(255, 255, 255, 0.4); }

.mod-hero__meta { color: rgba(255, 255, 255, 0.88); font-size: 13px; }
.mod-hero__meta .rating-stars { color: #ffce58; }

@media (max-width: 640px) {
  .mod-hero { aspect-ratio: 4 / 3; max-height: 280px; }
  .mod-hero__content h1 { font-size: 22px; }
}

.mod-detail-gallery img {
  width: 140px;
  height: 90px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: zoom-in;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.mod-detail-gallery img:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-sm);
}

.section-heading {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.section-heading svg { color: var(--accent); flex-shrink: 0; }

.version-chip {
  display: inline-flex;
  padding: 3px 10px;
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 650;
}

.review-card__avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  flex-shrink: 0;
  object-fit: cover;
}

.review-card__avatar--fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 700;
}

@media (max-width: 900px) {
  .mod-buy-box { position: static !important; width: 100%; }
}

@media (max-width: 480px) {
  .mod-detail-gallery img { width: calc(50% - 4px); height: auto; aspect-ratio: 16/10; }
}

/* ---- Hero ---- */

.hero {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(1100px 320px at 12% -20%, var(--accent-soft), transparent 60%),
    var(--bg-elevated);
  padding: var(--space-7) var(--space-6);
  margin-bottom: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.hero__eyebrow {
  display: inline-flex;
  align-items: center;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--accent-strong);
  background: var(--accent-soft);
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  margin-bottom: var(--space-4);
}

.hero h1 {
  font-size: 44px;
  max-width: 20ch;
  margin-bottom: var(--space-3);
}

.hero__stats {
  display: flex;
  gap: var(--space-6);
  margin-top: var(--space-6);
  flex-wrap: wrap;
}

.hero__stat-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 700;
}

.hero__stat-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 720px) {
  .hero { padding: var(--space-5); }
  .hero h1 { font-size: 32px; }
}

/* ---- Badges ---- */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  font-size: 12.5px;
  font-weight: 650;
}

.badge-accent { background: var(--accent-soft); color: var(--accent-strong); }
.badge-success { background: var(--success-soft); color: var(--success); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-warning { background: var(--warning-soft); color: var(--warning); }
.badge-muted { background: var(--bg-muted); color: var(--text-muted); }

/* ---- Profile / settings page ---- */

.settings-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: var(--space-5);
  align-items: start;
}

.profile-sidebar { text-align: center; position: sticky; top: calc(72px + var(--space-5)); }

.profile-avatar__img-wrap {
  position: relative;
  width: 104px;
  height: 104px;
  margin: 0 auto var(--space-3);
}

.profile-avatar__img {
  width: 104px;
  height: 104px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: var(--bg-muted);
}

.profile-avatar__fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--brand-gradient);
  color: #fff;
  font-size: 38px;
  font-weight: 700;
}

.profile-avatar__edit {
  position: absolute;
  right: -2px;
  bottom: -2px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 3px solid var(--bg-elevated);
  transition: background 0.15s ease, transform 0.1s ease;
}

.profile-avatar__edit:hover { background: var(--accent-strong); transform: scale(1.06); }

.profile-name-form { display: flex; gap: var(--space-2); margin-top: var(--space-4); }
.profile-name-form input { text-align: center; }

.profile-remove-avatar {
  background: none;
  border: none;
  padding: 0;
  margin-top: var(--space-2);
  font-size: 12.5px;
  color: var(--text-faint);
  cursor: pointer;
  text-decoration: underline;
}
.profile-remove-avatar:hover { color: var(--danger); }

.provider-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border);
}
.provider-row:last-child { border-bottom: none; padding-bottom: 0; }
.provider-row:first-child { padding-top: 0; }
.provider-row__label { font-weight: 650; flex: 1; }

.provider-dot { flex-shrink: 0; width: 16px; height: 16px; border-radius: 50%; }
.provider-dot--google { background: linear-gradient(135deg, #4285f4, #34a853 50%, #fbbc05 75%, #ea4335); }
.provider-dot--telegram { background: #26a5e4; }

@media (max-width: 760px) {
  .settings-layout { grid-template-columns: 1fr; }
  .profile-sidebar { position: static; text-align: left; }
  .profile-avatar__img-wrap { margin: 0 0 var(--space-3); }
}

/* ---- Forms ---- */

label {
  display: block;
  font-size: 13.5px;
  font-weight: 650;
  margin-bottom: 6px;
  color: var(--text-muted);
}

input, textarea, select {
  display: block;
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.table-wrap input[type="text"] {
  padding: 9px 10px;
  border-color: transparent;
  background: transparent;
}
.table-wrap input[type="text"]:hover { border-color: var(--border); background: var(--bg); }
.table-wrap input[type="text"]:focus { border-color: var(--accent); background: var(--bg); }

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea {
  resize: none;
  overflow: hidden;
  min-height: 90px;
  line-height: 1.5;
}

.field { margin-bottom: var(--space-4); }

/* Custom-styled <select> replacement - the native dropdown popup can't be restyled
   (no border-radius/shadow control across browsers), so JS builds this markup next to
   a visually-hidden but still-functional <select> and keeps them in sync. Reuses the
   .menu/.menu__trigger/.menu__dropdown/.menu__item component so open/close/outside-click/
   Escape all come for free from the existing generic menu logic in main.js. */
.select-menu__trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  width: 100%;
  min-width: 88px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 15px;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.select-menu__trigger:hover { border-color: var(--border-strong); }
.select-menu__trigger:disabled { opacity: 0.55; cursor: not-allowed; }

.select-menu.open .select-menu__trigger,
.select-menu__trigger:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.select-menu__value {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.select-menu__dropdown {
  left: 0;
  right: auto;
  width: max-content;
  min-width: 100%;
  max-width: min(360px, 90vw);
  max-height: 280px;
  overflow-y: auto;
  overflow-x: hidden;
}

.select-menu__option {
  display: block;
  width: 100%;
  border: none;
  background: none;
  font: inherit;
  text-align: left;
  cursor: pointer;
  white-space: nowrap;
}

.select-menu__option--active { color: var(--accent-strong); background: var(--accent-soft); }

.select-menu--sm .select-menu__trigger { padding: 9px 10px; font-size: 14px; }

.select-native-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}
.field-hint { font-size: 12.5px; color: var(--text-faint); margin-top: 6px; }

/* ---- Structured form sections (mod create/edit, etc.) ---- */

.form-sections {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  max-width: 760px;
}

.form-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
}

.form-section__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 2px;
}

.form-section__hint {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: var(--space-4);
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-4);
}

.form-grid-2 .field:last-child,
.form-grid-3 > .field:last-child { margin-bottom: 0; }

.form-grid-3 {
  display: grid;
  grid-template-columns: 1.6fr 1fr 1fr;
  gap: var(--space-4);
}

@media (max-width: 600px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

.mod-form-layout {
  display: grid;
  grid-template-columns: minmax(0, 760px) 1fr;
  align-items: start;
  gap: var(--space-5);
}

.mod-form-layout .form-sections { max-width: none; }

.mod-form-aside {
  position: sticky;
  top: calc(var(--header-h) + var(--space-5));
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.mod-form-aside .card { padding: var(--space-5); }

.mod-form-aside__title {
  font-size: 14px;
  font-weight: 700;
  margin-bottom: var(--space-3);
}

.mod-form-tips {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  font-size: 13.5px;
  color: var(--text-muted);
}

.mod-form-tips li { display: flex; gap: 9px; align-items: flex-start; }
.mod-form-tips li svg { flex-shrink: 0; margin-top: 2px; color: var(--accent); }

.mod-form-preview {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--bg-muted);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-faint);
  font-size: 13px;
}

.mod-form-preview img { width: 100%; height: 100%; object-fit: cover; }

@media (max-width: 1100px) {
  .mod-form-layout { grid-template-columns: 1fr; }
  .mod-form-aside { position: static; }
}

/* ---- Screenshot management grid ---- */

.shot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
  margin-bottom: var(--space-4);
}

.shot-thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius-sm);
  overflow: hidden;
  border: 1px solid var(--border);
}

.shot-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }

.shot-thumb__remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease;
}

.shot-thumb__remove:hover { background: var(--danger); }

/* ---- File drop input ---- */

.file-drop {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.file-drop:hover, .file-drop.is-drag { border-color: var(--accent); background: var(--accent-soft); }

.file-drop input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.file-drop__icon { color: var(--text-faint); margin: 0 auto var(--space-2); }
.file-drop__text { font-size: 14px; font-weight: 650; color: var(--text); }
.file-drop__hint { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

.file-drop__files {
  margin-top: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
}

.file-drop__chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: var(--radius-pill);
  background: var(--bg-muted);
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 600;
}

.file-drop__previews {
  margin-top: var(--space-3);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.file-drop__previews img {
  width: 76px;
  height: 76px;
  object-fit: cover;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

/* ---- Charts ---- */

.chart-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: var(--space-5);
  transition: box-shadow 0.18s ease, border-color 0.18s ease;
}

.chart-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }

.chart-card__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
  flex-wrap: wrap;
}

.chart-card__title { font-size: 15px; font-weight: 700; }
.chart-card__subvalue { font-family: var(--font-mono); font-size: 22px; font-weight: 700; }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

/* Ranked bar list (magnitude comparison) */

.bar-list { display: flex; flex-direction: column; gap: var(--space-3); }

.bar-list__row {
  display: grid;
  grid-template-columns: minmax(90px, 140px) 1fr auto;
  align-items: center;
  gap: var(--space-3);
}

.bar-list__label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bar-list__track {
  height: 10px;
  background: var(--accent-soft);
  border-radius: 0 4px 4px 0;
  overflow: hidden;
}

.bar-list__fill {
  display: block;
  height: 100%;
  min-width: 3px;
  background: var(--accent);
  border-radius: 0 4px 4px 0;
}

.bar-list__value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  text-align: right;
  min-width: 2.5ch;
}

/* Status split bar (part-to-whole) */

.status-bar {
  display: flex;
  gap: 2px;
  height: 20px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-muted);
}

.status-bar__seg { height: 100%; }

.status-legend {
  display: flex;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-top: var(--space-3);
  font-size: 13px;
}

.status-legend__item { display: flex; align-items: center; gap: 7px; color: var(--text-muted); }

.status-legend__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-legend__value { font-family: var(--font-mono); font-weight: 700; color: var(--text); }

/* Line / trend chart */

.chart-line { position: relative; width: 100%; }
.chart-line svg { display: block; width: 100%; height: auto; overflow: visible; }

.chart-line__grid { stroke: var(--border); stroke-width: 1; shape-rendering: crispEdges; }
.chart-line__tick { fill: var(--text-faint); font-size: 10px; font-family: var(--font-mono); }
.chart-line__area { fill: var(--accent); opacity: 0.1; }
.chart-line__path { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart-line__dot { fill: var(--accent); stroke: var(--bg-elevated); stroke-width: 2; }
.chart-line__crosshair { stroke: var(--border-strong); stroke-width: 1; opacity: 0; pointer-events: none; }
.chart-line__hit { fill: transparent; }

.chart-tooltip {
  position: absolute;
  display: none;
  pointer-events: none;
  background: var(--text);
  color: var(--bg);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  white-space: nowrap;
  transform: translate(-50%, -115%);
  z-index: 10;
  box-shadow: var(--shadow-sm);
}

.chart-tooltip strong { font-family: var(--font-mono); font-size: 13px; }

@media (max-width: 720px) {
  .chart-grid { grid-template-columns: 1fr; }
  .bar-list__row { grid-template-columns: 74px 1fr auto; }
}

/* ---- Lightbox ---- */

.lightbox-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 100;
  align-items: center;
  justify-content: center;
  background: rgba(8, 8, 6, 0.92);
  padding: var(--space-6);
}

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

.lightbox-overlay__img {
  max-width: 100%;
  max-height: 100%;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
}

.lightbox-btn {
  position: fixed;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  transition: background 0.15s ease;
}

.lightbox-btn:hover { background: rgba(255, 255, 255, 0.18); }
.lightbox-close { top: var(--space-4); right: var(--space-4); }
.lightbox-prev { left: var(--space-4); top: 50%; transform: translateY(-50%); }
.lightbox-next { right: var(--space-4); top: 50%; transform: translateY(-50%); }

@media (max-width: 600px) {
  .lightbox-overlay { padding: var(--space-3); }
  .lightbox-btn { width: 38px; height: 38px; }
}

/* ---- Tables ---- */

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  color: var(--text-muted);
  font-weight: 650;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: var(--bg-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tbody tr { transition: background 0.12s ease; }
tbody tr:hover { background: var(--bg-muted); }
td a:not(.btn) { color: var(--accent-strong); font-weight: 600; }
.link-accent { color: var(--accent-strong); font-weight: 600; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xs);
}
.table-wrap table { border: none; }

/* Plain table flowing on the page background - no card border/shadow framing,
   so long lists (e.g. admin users) don't read as a separate boxed/scrollable widget. */
.table-flow { max-width: 100%; overflow-x: auto; }

/* ---- Toast notifications (flash messages) ---- */

.toast-stack {
  position: fixed;
  top: calc(var(--header-h) + var(--space-3));
  right: var(--space-4);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-width: min(380px, calc(100vw - 2 * var(--space-4)));
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  font-size: 14.5px;
  font-weight: 550;
  border: 1px solid transparent;
  box-shadow: var(--shadow-lg);
  background: var(--bg-elevated);
  animation: toast-in 0.28s cubic-bezier(0.2, 0.8, 0.3, 1.1) both;
}

.toast--leaving { animation: toast-out 0.22s ease both; }

.toast__icon { flex-shrink: 0; margin-top: 1px; }
.toast__text { flex: 1; line-height: 1.4; }

.toast__close {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: inherit;
  opacity: 0.55;
  cursor: pointer;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s ease, background 0.15s ease;
}
.toast__close:hover { opacity: 1; background: rgba(127, 127, 127, 0.14); }

.toast-success { color: var(--success); border-color: var(--success); }
.toast-success .toast__icon { color: var(--success); }
.toast-error { color: var(--danger); border-color: var(--danger); }
.toast-error .toast__icon { color: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateX(24px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  from { opacity: 1; transform: none; }
  to { opacity: 0; transform: translateX(24px) scale(0.97); }
}

@media (max-width: 480px) {
  .toast-stack { left: var(--space-3); right: var(--space-3); max-width: none; }
}

/* ---- Confirm modal ---- */

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  background: rgba(10, 10, 12, 0.5);
  backdrop-filter: blur(2px);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.18s ease, visibility 0.18s;
}

.modal-overlay.open { opacity: 1; visibility: visible; }

.modal-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  padding: var(--space-5);
  text-align: center;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.2s cubic-bezier(0.2, 0.8, 0.3, 1.1);
}

.modal-overlay.open .modal-card { transform: none; }

.modal-card__icon {
  width: 46px;
  height: 46px;
  margin: 0 auto var(--space-3);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--danger-soft);
  color: var(--danger);
}

.modal-card__title { font-size: 17px; font-weight: 750; margin-bottom: 6px; }
.modal-card__body { font-size: 14.5px; color: var(--text-muted); margin-bottom: var(--space-4); line-height: 1.5; }
.modal-card__actions { display: flex; gap: var(--space-2); justify-content: center; }
.modal-card__actions .btn { flex: 1; }

/* ---- Shop layout (catalog) ---- */

.shop-layout {
  display: grid;
  grid-template-columns: 248px 1fr;
  gap: var(--space-6);
  align-items: start;
}

.shop-sidebar {
  position: sticky;
  top: calc(var(--header-h) + var(--space-5));
  display: flex;
  flex-direction: column;
  gap: var(--space-5);
}

.shop-sidebar__title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-faint);
  margin-bottom: var(--space-2);
}

.shop-sidebar__list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.shop-sidebar__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--text-faint);
  transition: background 0.15s ease, color 0.15s ease;
}

.shop-sidebar__link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: 9px 11px;
  border-radius: var(--radius-sm);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease;
}

.shop-sidebar__link:hover { background: var(--bg-muted); color: var(--text); }
.shop-sidebar__link.active { background: var(--accent-soft); color: var(--accent-strong); }
.shop-sidebar__link.active .shop-sidebar__icon { background: var(--bg-elevated); color: var(--accent-strong); }

.shop-sidebar__count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
}

.shop-sidebar__link.active .shop-sidebar__count { color: var(--accent-strong); }

.shop-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

@media (max-width: 900px) {
  .shop-layout { grid-template-columns: 1fr; }
  .shop-sidebar {
    position: static;
    flex-direction: row;
    flex-wrap: wrap;
    gap: var(--space-4);
  }
  .shop-sidebar__section { flex: 1; min-width: 220px; }
}

@media (max-width: 640px) {
  .shop-sidebar { flex-direction: column; }
  .shop-sidebar__section { min-width: 0; }
  .shop-sidebar__list { flex-direction: row; flex-wrap: wrap; gap: 6px; }
  .shop-sidebar__link { flex: 0 0 auto; }
}

/* ---- Tabs / admin sidebar ---- */

.admin-layout {
  display: grid;
  grid-template-columns: 232px 1fr;
  gap: var(--space-6);
  align-items: start;
}

.admin-nav {
  display: flex;
  flex-direction: column;
  gap: 3px;
  position: sticky;
  top: calc(var(--header-h) + var(--space-5));
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-2);
  box-shadow: var(--shadow-xs);
}

.admin-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 9px 14px;
  border-radius: var(--radius-sm);
  border-left: 3px solid transparent;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.admin-nav__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: var(--radius-sm);
  background: var(--bg-muted);
  color: var(--text-faint);
  transition: background 0.15s ease, color 0.15s ease;
}

.admin-nav a:hover { background: var(--bg-muted); color: var(--text); }
.admin-nav a:hover .admin-nav__icon { color: var(--text); }
.admin-nav a.active { background: var(--accent-soft); color: var(--accent-strong); border-left-color: var(--accent); }
.admin-nav a.active .admin-nav__icon { background: var(--accent); color: #fff; }

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: var(--space-4);
}

.stat-tile {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  background: var(--bg-elevated);
  box-shadow: var(--shadow-xs);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, transform 0.18s ease;
}

.stat-tile::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 3px;
  background: var(--stat-color, var(--accent));
  opacity: 0;
  transition: opacity 0.18s ease;
}

.stat-tile:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-2px);
}

.stat-tile:hover::before { opacity: 1; }

.stat-tile__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--stat-color-soft, var(--accent-soft));
  color: var(--stat-color, var(--accent-strong));
  margin-bottom: var(--space-3);
}

.stat-tile--blue { --stat-color: #1e6fe0; --stat-color-soft: #e5f1fd; }
.stat-tile--green { --stat-color: #1f8a52; --stat-color-soft: #e4f5ea; }
.stat-tile--violet { --stat-color: #7c3aed; --stat-color-soft: #f1e9fe; }
.stat-tile--teal { --stat-color: #0e9488; --stat-color-soft: #dff7f4; }
.stat-tile--amber { --stat-color: #b4790a; --stat-color-soft: #fbf0dc; }
.stat-tile--pink { --stat-color: #c0267a; --stat-color-soft: #fce6f1; }
.stat-tile--red { --stat-color: #d1403a; --stat-color-soft: #fbe7e6; }

.stat-tile__value {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.stat-tile__label {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
  font-weight: 500;
}

.empty-state {
  text-align: center;
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  font-size: 15px;
}

.shop-main .empty-state { max-width: 520px; margin: 0 auto; }

.footer {
  border-top: 1px solid var(--border);
  padding: var(--space-6) 0;
  color: var(--text-faint);
  font-size: 13.5px;
}

.chip-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }

.chip {
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--border);
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-elevated);
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.chip:hover { border-color: var(--border-strong); color: var(--text); }
.chip.active { border-color: var(--accent); color: var(--accent-strong); background: var(--accent-soft); }

.rating-stars { color: var(--warning); font-family: var(--font-mono); letter-spacing: 1px; }

.divider { border: none; border-top: 1px solid var(--border); margin: var(--space-5) 0; }

@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { position: static; flex-direction: row; overflow-x: auto; }
}

/* ---- Responsive: header / mobile nav ---- */

@media (max-width: 860px) {
  :root { --header-h: 64px; }

  .brand { font-size: 18px; }
  .brand__icon { width: 24px; height: 24px; }
  .site-header__inner { position: relative; gap: var(--space-2); }

  .nav-toggle { display: inline-flex; }

  .nav-links {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    background: var(--bg-elevated);
    border: 1px solid var(--border);
    border-top: none;
    box-shadow: var(--shadow-md);
    padding: var(--space-2);
    gap: 2px;
    border-radius: 0 0 var(--radius-md) var(--radius-md);
  }

  .nav-links.open { display: flex; }
  .nav-links a { padding: 13px 14px; }

  .header-search:not(.header-search--mobile) { display: none; }
  .header-search--mobile { display: flex; margin-bottom: var(--space-1); }

  /* .header-search is removed from grid flow above, so with only 2 items left,
     grid auto-placement would put .header-right into the middle (auto) track
     instead of the right one - pin it explicitly. */
  .header-right { grid-column: 3; }

  .header-actions { gap: 6px; }
  .icon-btn { width: 36px; height: 36px; }
  .user-chip { padding: 4px 10px 4px 4px; }
}

@media (max-width: 480px) {
  .user-chip span { display: none; }
  .user-chip { padding: 4px; }
  .container { padding: 0 var(--space-3); }
}

/* ---- Responsive: general layout / typography ---- */

@media (max-width: 720px) {
  .page { padding: var(--space-5) 0 var(--space-7); }
  .mod-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: var(--space-3); }
  .mod-card__body { padding: var(--space-3) var(--space-3) var(--space-4); gap: 6px; }
  .mod-card__title { font-size: 14.5px; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-tile { padding: var(--space-4); }
  .stat-tile__value { font-size: 24px; }
  .card { padding: var(--space-4); }
  .btn-lg { padding: 13px 22px; font-size: 15px; }
  th, td { padding: var(--space-2) var(--space-3); }
}

@media (max-width: 520px) {
  h1 { font-size: 26px; }
  .mod-grid { grid-template-columns: repeat(2, 1fr); gap: var(--space-2); }
  .mod-card__category-badge, .mod-card__new-badge { font-size: 10.5px; padding: 3px 8px; }
}
