/* ===== Base ===== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg: #0e1016;
  --bg-elevated: #161a24;
  --bg-card: #1a1f2b;
  --border: #2a3142;
  --border-light: #3a4358;
  --text: #eef0f5;
  --text-dim: #8b93a8;
  --accent: #5b8def;
  --accent-bright: #7aa2ff;
  --accent-glow: rgba(91, 141, 239, 0.4);
  --radius: 14px;
  --font: 'Segoe UI', system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.45;
  background-image:
    radial-gradient(ellipse 90% 60% at 50% -30%, rgba(91, 141, 239, 0.18), transparent 70%),
    radial-gradient(ellipse 50% 40% at 100% 100%, rgba(99, 102, 241, 0.07), transparent);
}

/* ===== Header ===== */
header {
  text-align: center;
  padding: 36px 20px 28px;
}

header h1 {
  font-size: 2.35rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  background: linear-gradient(135deg, #ffffff 20%, #93b8ff 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 8px;
}

header p {
  font-size: 1.1rem;
  color: var(--text-dim);
}

/* ===== Search ===== */
.search-wrap {
  max-width: 420px;
  margin: 0 auto 28px;
  padding: 0 16px;
  position: relative;
  z-index: 20;
}

.search-wrap input {
  width: 100%;
  padding: 14px 16px 14px 44px;
  background: var(--bg-card);
  border: 2px solid var(--border-light);
  border-radius: 14px;
  color: var(--text);
  font-size: 1.05rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
  position: relative;
  z-index: 21;
  pointer-events: auto;
  touch-action: manipulation;
}

.search-wrap input::placeholder {
  color: var(--text-dim);
}

.search-wrap input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(91, 141, 239, 0.25);
}

.search-wrap svg {
  position: absolute;
  left: 30px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--text-dim);
  pointer-events: none;
  z-index: 22;
}

/* ===== Grid (same density as original ~850px) ===== */
#mods {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  justify-content: center;
  max-width: 860px;
  margin: 0 auto;
  padding: 0 18px 50px;
}

/* ===== Card ===== */
.mod-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}

.mod-card:hover {
  transform: translateY(-5px) scale(1.015);
  border-color: var(--accent);
  box-shadow: 0 12px 32px var(--accent-glow);
}

.mod-card .img-wrap {
  width: 100%;
  aspect-ratio: 16 / 10;
  background: #0a0c10;
  overflow: hidden;
  border-radius: 12px 12px 0 0;
  line-height: 0;
  position: relative;
}

.mod-card .img-wrap img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  display: block;
  background: #0a0c10;
}

.mod-card:hover .img-wrap img {
  transform: scale(1.07);
}

.mod-card .body {
  padding: 12px 14px 15px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mod-card h3 {
  font-size: 1.02rem;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
  line-height: 1.3;
}

.mod-card p {
  font-size: 0.82rem;
  color: var(--text-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex: 1;
}

/* ===== Footer ===== */
footer {
  text-align: center;
  padding: 22px 16px 32px;
  color: var(--text-dim);
  font-size: 0.88rem;
  border-top: 1px solid var(--border);
  margin-top: 10px;
}

/* ===== Detail pages ===== */
.detail-page {
  max-width: 820px;
  margin: 0 auto;
  padding: 28px 20px 50px;
}

.back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-dim);
  text-decoration: none;
  font-size: 0.92rem;
  margin-bottom: 26px;
  transition: color 0.15s;
}

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

.detail-top {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 28px;
  margin-bottom: 28px;
  align-items: start;
}

.detail-img {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 8px 28px rgba(0,0,0,0.35);
}

.detail-img img {
  width: 100%;
  display: block;
  aspect-ratio: 1;
  object-fit: cover;
}

.detail-info h1 {
  font-size: 1.7rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.detail-info .lead {
  color: var(--text-dim);
  font-size: 0.98rem;
  margin-bottom: 18px;
  line-height: 1.55;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 22px;
}

.tag {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 5px 11px;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.tag strong {
  color: var(--text);
  font-weight: 600;
}

.btn-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #5b8def, #3b6fd9);
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 12px 22px;
  border-radius: 11px;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: 0 6px 18px var(--accent-glow);
  transition: transform 0.18s, box-shadow 0.18s;
}

.btn-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px var(--accent-glow);
}

.detail-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
}

.detail-block h2 {
  font-size: 1.1rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.detail-block p,
.detail-block li {
  color: var(--text-dim);
  font-size: 0.92rem;
  line-height: 1.65;
}

.detail-block ul {
  padding-left: 18px;
}

.detail-block li + li {
  margin-top: 4px;
}

.no-results {
  display: none;
  text-align: center;
  padding: 50px 16px;
  color: var(--text-dim);
  grid-column: 1 / -1;
}

.no-results.show {
  display: block;
}

/* ===== Responsive ===== */
@media (max-width: 560px) {
  header h1 {
    font-size: 1.85rem;
  }

  #mods {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 14px;
    padding: 0 14px 40px;
  }

  .mod-card .img-wrap {
    height: 110px;
  }

  .detail-top {
    grid-template-columns: 1fr;
  }

  .detail-img {
    max-width: 220px;
    margin: 0 auto;
  }
}

/* ===== Top bar (auth) ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 10px;
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 18px;
  position: relative;
  z-index: 10;
  border-bottom: 1px solid var(--border);
}

.topbar-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 0.88rem;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.topbar-btn:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
}

.topbar-btn.primary {
  background: linear-gradient(135deg, #5b8def, #3b6fd9);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

.topbar-btn.primary:hover {
  box-shadow: 0 4px 14px var(--accent-glow);
}

.user-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 6px 12px 6px 8px;
  border-radius: 20px;
  font-size: 0.88rem;
}

.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b8def, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 700;
  color: #fff;
}

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  padding: 28px 24px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  position: relative;
}

.modal h2 {
  font-size: 1.35rem;
  margin-bottom: 6px;
}

.modal .sub {
  color: var(--text-dim);
  font-size: 0.9rem;
  margin-bottom: 20px;
}

.modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 1.4rem;
  cursor: pointer;
  line-height: 1;
  padding: 4px 8px;
}

.modal-close:hover { color: var(--text); }

.form-group {
  margin-bottom: 14px;
}

.form-group label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 5px;
}

.form-group input,
.form-group textarea {
  width: 100%;
  padding: 11px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.form-group input:focus,
.form-group textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.18);
}

.form-error {
  color: #f87171;
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: none;
}

.form-error.show { display: block; }

.form-success {
  color: #4ade80;
  font-size: 0.85rem;
  margin-bottom: 12px;
  display: none;
}

.form-success.show { display: block; }

.btn-submit {
  width: 100%;
  padding: 12px;
  background: linear-gradient(135deg, #5b8def, #3b6fd9);
  border: none;
  border-radius: 11px;
  color: #fff;
  font-weight: 600;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 6px;
  transition: transform 0.15s, box-shadow 0.15s;
}

.btn-submit:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px var(--accent-glow);
}

.modal-switch {
  text-align: center;
  margin-top: 16px;
  font-size: 0.88rem;
  color: var(--text-dim);
}

.modal-switch a {
  color: var(--accent-bright);
  cursor: pointer;
  text-decoration: none;
}

.modal-switch a:hover { text-decoration: underline; }

/* ===== Profile page ===== */
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  max-width: 480px;
  margin: 0 auto 30px;
}

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

.profile-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: linear-gradient(135deg, #5b8def, #6366f1);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}

.profile-header h1 {
  font-size: 1.4rem;
  margin-bottom: 4px;
}

.profile-header .email {
  color: var(--text-dim);
  font-size: 0.9rem;
}

/* ===== Comments ===== */
.comments-section {
  margin-top: 8px;
}

.comments-section h2 {
  font-size: 1.1rem;
  margin-bottom: 14px;
}

.comment-form {
  margin-bottom: 20px;
}

.comment-form textarea {
  width: 100%;
  min-height: 80px;
  resize: vertical;
  padding: 12px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  margin-bottom: 10px;
}

.comment-form textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 141, 239, 0.18);
}

.comment-form .btn-submit {
  width: auto;
  padding: 10px 20px;
}

.comment-login-hint {
  background: var(--bg-elevated);
  border: 1px dashed var(--border);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.92rem;
  margin-bottom: 20px;
}

.comment-login-hint a {
  color: var(--accent-bright);
  cursor: pointer;
  text-decoration: none;
}

.comment-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.comment-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px 16px;
}

.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  gap: 10px;
}

.comment-author {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--accent-bright);
}

.comment-date {
  font-size: 0.78rem;
  color: var(--text-dim);
}

.comment-text {
  font-size: 0.92rem;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-delete {
  background: none;
  border: none;
  color: #f87171;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  opacity: 0.7;
}

.comment-delete:hover { opacity: 1; }

.comments-empty {
  color: var(--text-dim);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

/* ===== Social links ===== */
.social-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.social-link {
  display: block;
  text-align: center;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 11px;
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  transition: border-color 0.15s, background 0.15s, transform 0.15s;
}

.social-link:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  transform: translateY(-1px);
  color: var(--accent-bright);
}

.is-hidden { display: none !important; }

/* ===== Categories ===== */
.cat-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  max-width: 860px;
  margin: 0 auto 18px;
  padding: 0 16px;
}
.cat-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-dim);
  font-size: 0.85rem;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  transition: 0.15s;
}
.cat-btn:hover { border-color: var(--accent); color: var(--text); }
.cat-btn.active {
  background: linear-gradient(135deg, #5b8def, #3b6fd9);
  border-color: transparent;
  color: #fff;
  font-weight: 600;
}

/* ===== Avatars ===== */
.avatar-img {
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.profile-avatar-lg.avatar-img,
img.profile-avatar-lg {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
}
.user-avatar.avatar-img,
img.user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
}

/* ===== Admin ===== */
.admin-stats {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  text-align: center;
}
.stat-num {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--accent-bright);
}
.stat-label {
  font-size: 0.82rem;
  color: var(--text-dim);
  margin-top: 4px;
}
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}
.admin-table th { color: var(--text-dim); font-weight: 600; }

.user-chip-link {
  text-decoration: none;
  color: inherit;
  cursor: pointer;
}
.user-chip-link:hover {
  border-color: var(--accent);
}
.form-suggest {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 12px;
  line-height: 1.45;
}
.form-suggest strong {
  color: var(--accent-bright);
  cursor: pointer;
}

.pending-banner {
  background: rgba(248, 113, 113, 0.15);
  border-bottom: 1px solid rgba(248, 113, 113, 0.4);
  color: #fecaca;
  text-align: center;
  padding: 12px 16px;
  font-size: 0.92rem;
}
.pending-note {
  margin-top: 8px;
  color: #fca5a5;
  font-size: 0.88rem;
}
.mute-banner {
  background: rgba(251, 191, 36, 0.12);
  border: 1px solid rgba(251, 191, 36, 0.35);
  color: #fde68a;
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  font-size: 0.9rem;
}
.mute-banner a { color: var(--accent-bright); }

.pending-code-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
}
.pending-code-row input {
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  min-width: 220px;
}

.cloud-status-banner {
  text-align: center;
  padding: 10px 14px;
  font-size: 0.88rem;
  font-weight: 600;
  background: rgba(248, 113, 113, 0.15);
  color: #fecaca;
  border-bottom: 1px solid rgba(248,113,113,0.35);
}
.cloud-status-banner.ok {
  background: rgba(52, 211, 153, 0.15);
  color: #6ee7b7;
  border-bottom-color: rgba(52, 211, 153, 0.35);
}
.cloud-status-banner code {
  background: rgba(0,0,0,0.25);
  padding: 2px 6px;
  border-radius: 4px;
}

.social-link.social-btn {
  width: 100%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font: inherit;
  text-align: center;
}
.social-link.social-btn:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
}
.social-back {
  opacity: 0.85;
  margin-top: 6px;
}

/* ===== Brand + hamburger ===== */
.site-brandbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px 6px;
  max-width: 1100px;
  margin: 0 auto;
}
.hamburger {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  cursor: pointer;
  flex-shrink: 0;
}
.hamburger span {
  display: block;
  width: 18px;
  height: 2px;
  background: var(--text);
  border-radius: 2px;
}
.hamburger:hover { border-color: var(--accent); }
.brand-logo-link { display: flex; align-items: center; }
.brand-logo {
  height: 36px;
  width: auto;
  max-width: 200px;
  object-fit: contain;
  display: block;
}
.brand-logo-sm {
  height: 28px;
  width: auto;
  max-width: 160px;
  object-fit: contain;
}

/* Side drawer */
.side-drawer-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 90;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.side-drawer-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.side-drawer {
  position: fixed;
  top: 0;
  left: 0;
  width: min(300px, 86vw);
  height: 100%;
  background: var(--bg-elevated, #12151c);
  border-right: 1px solid var(--border);
  z-index: 100;
  transform: translateX(-105%);
  transition: transform 0.25s ease;
  padding: 16px;
  box-shadow: 8px 0 30px rgba(0,0,0,0.35);
}
.side-drawer.open { transform: translateX(0); }
.side-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}
.drawer-close {
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
}
.side-drawer-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.drawer-link {
  display: block;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  background: var(--bg-card);
  font-weight: 600;
}
.drawer-link:hover {
  border-color: var(--accent);
  color: var(--accent-bright, var(--accent));
}
body.drawer-open { overflow: hidden; }

/* ===== Aspects ===== */
.aspect-page { max-width: 800px; margin: 0 auto; padding: 12px 16px 60px; }
.aspect-hero { text-align: center; margin-bottom: 24px; }
.aspect-hero-img {
  width: min(100%, 420px);
  max-height: 160px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 12px;
  border-radius: 14px;
}
.aspect-hero-img-x {
  width: 120px; height: 120px; margin: 0 auto 14px;
  border-radius: 24px;
  background: linear-gradient(135deg, #1a1f2e, #2a1840);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  font-size: 3rem; color: #c4b5fd;
}
.aspect-balance-line {
  margin-top: 10px; padding: 10px 14px; border-radius: 10px;
  background: rgba(167, 139, 250, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.35);
  display: inline-block;
  color: #ddd6fe;
}
.aspect-packages {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}
.aspect-pack {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  background: var(--bg-card);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.aspect-pack-amount { font-size: 1.15rem; font-weight: 700; }
.aspect-pack-price { color: var(--text-dim); font-size: 0.9rem; margin-bottom: 4px; }
.aspect-buy-btn { margin-top: auto; }
.purchase-row {
  display: flex; justify-content: space-between; align-items: center;
  gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border);
}
.form-success {
  background: rgba(52, 211, 153, 0.12);
  border: 1px solid rgba(52, 211, 153, 0.35);
  color: #6ee7b7;
  padding: 10px 12px;
  border-radius: 10px;
  margin-bottom: 10px;
  white-space: pre-line;
}
.price-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 8px;
  background: rgba(167, 139, 250, 0.15);
  color: #c4b5fd;
  font-weight: 600;
  font-size: 0.9rem;
}

.aspect-pack-img {
  width: 96px;
  height: 96px;
  object-fit: contain;
  margin: 0 auto 8px;
  display: block;
}
.aspect-pack { text-align: center; }

/* ===== PM / Chat ===== */
.pm-page { max-width: 720px; margin: 0 auto; padding: 12px 16px 60px; }
.pm-dialog-row {
  display: flex; justify-content: space-between; gap: 12px;
  padding: 12px; border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 8px; text-decoration: none; color: inherit;
  background: var(--bg-card);
}
.pm-dialog-row:hover { border-color: var(--accent); }
.pm-dialog-name { font-weight: 700; margin-bottom: 4px; }
.pm-dialog-preview { color: var(--text-dim); font-size: 0.9rem; }
.pm-dialog-time { color: var(--text-dim); font-size: 0.8rem; white-space: nowrap; }
.pm-unread {
  display: inline-block; margin-left: 8px; background: #7c3aed; color: #fff;
  border-radius: 999px; padding: 1px 8px; font-size: 0.75rem;
}
.pm-found { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.chat-page { max-width: 720px; margin: 0 auto; padding: 12px 16px 40px; display: flex; flex-direction: column; min-height: 70vh; }
.chat-head { margin-bottom: 12px; font-size: 1.15rem; }
.chat-warn {
  background: rgba(251, 191, 36, 0.12); border: 1px solid rgba(251, 191, 36, 0.4);
  border-radius: 12px; padding: 16px; margin-bottom: 12px;
}
.chat-log {
  flex: 1; overflow-y: auto; max-height: 55vh; padding: 8px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--bg-card);
  margin-bottom: 12px;
}
.chat-bubble { max-width: 85%; margin: 8px 0; padding: 10px 12px; border-radius: 12px; }
.chat-bubble.mine { margin-left: auto; background: rgba(124, 58, 237, 0.25); }
.chat-bubble.theirs { margin-right: auto; background: rgba(255,255,255,0.06); }
.chat-meta { font-size: 0.75rem; color: var(--text-dim); margin-bottom: 4px; }
.chat-text { white-space: pre-wrap; word-break: break-word; }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; }
.chat-compose textarea {
  flex: 1; border-radius: 10px; border: 1px solid var(--border);
  background: var(--bg-card); color: var(--text); padding: 10px; resize: vertical;
}
.pm-del {
  background: none; border: none; color: #f87171; cursor: pointer; font-size: 0.75rem;
  text-decoration: underline;
}
.aspect-hero-img.placeholder-box {
  width: 140px; height: 140px; margin: 0 auto 14px;
  border-radius: 20px; border: 2px dashed var(--border);
  background: repeating-linear-gradient(45deg, #1a1f2e, #1a1f2e 10px, #12151c 10px, #12151c 20px);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-dim); font-size: 0.85rem; text-align: center; padding: 8px;
}

.pm-badge-red {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1;
}

/* ===== Main nav ===== */
.main-nav {
  display: flex;
  gap: 2px;
  flex-wrap: nowrap;
  justify-content: space-around;
  align-items: center;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
  background: rgba(10,12,18,0.75);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 40;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.main-nav-link {
  color: var(--text-dim);
  text-decoration: none;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}
.main-nav-link:hover, .main-nav-link.active { color: var(--text); background: rgba(124,58,237,0.2); }

/* ===== Roles ===== */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--role-color, #94a3b8) 22%, transparent);
  color: var(--role-color, #94a3b8);
  border: 1px solid color-mix(in srgb, var(--role-color, #94a3b8) 40%, transparent);
  vertical-align: middle;
  white-space: nowrap;
}
.role-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--role-color, #94a3b8);
}
.role-none { opacity: 0.55; font-weight: 500; }

/* ===== Profile platform style ===== */
.profile-banner {
  height: 110px;
  border-radius: 14px;
  background: linear-gradient(135deg, #4c1d95, #1e1b4b 50%, #0f172a);
  position: relative;
  background-size: cover !important;
  background-position: center !important;
  overflow: hidden;
}
.profile-banner.banner-purple { background: linear-gradient(135deg, #7c3aed, #4c1d95); }
.profile-banner.banner-default { background: linear-gradient(135deg, #334155, #0f172a); }
.profile-hero {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  margin-top: -48px;
  padding: 0 12px 10px;
  flex-wrap: wrap;
  position: relative;
  z-index: 2;
}
.profile-avatar-wrap {
  width: 64px; height: 64px;
  border-radius: 50%;
  border: 3px solid var(--bg-card, #12151c);
  overflow: hidden;
  background: #1e293b;
  flex-shrink: 0;
  position: relative;
}
.profile-avatar-wrap img,
.profile-avatar-wrap .user-avatar,
.profile-avatar-wrap .avatar-img,
.profile-avatar-wrap .profile-avatar-lg {
  width: 100% !important;
  height: 100% !important;
  max-width: none !important;
  max-height: none !important;
  object-fit: cover;
  border-radius: 50%;
  display: block;
  margin: 0 !important;
}
.profile-avatar-wrap > div.avatar-fallback {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin: 0 !important;
}



.profile-avatar-wrap img, .profile-avatar-wrap .avatar-fallback {
  width: 100%; height: 100%; object-fit: cover;
}
.profile-name-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.profile-name-row h1 { margin: 0; font-size: 1.1rem; }
.profile-handle { color: var(--text-dim); font-size: 0.95rem; }
.profile-tabs {
  display: flex; gap: 4px; border-bottom: 1px solid var(--border);
  margin: 12px 0; flex-wrap: wrap;
}
.profile-tab {
  background: none; border: none; color: var(--text-dim);
  padding: 10px 14px; cursor: pointer; font-weight: 600;
  border-bottom: 2px solid transparent;
}
.profile-tab.active { color: var(--text); border-bottom-color: #7c3aed; }

.profile-dock {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around; flex-wrap: wrap;
  gap: 4px; padding: 10px 8px;
  background: rgba(10,12,18,0.95);
  border-top: 1px solid var(--border);
  z-index: 50;
  backdrop-filter: blur(8px);
}
.profile-dock a {
  color: var(--text-dim); text-decoration: none; font-size: 0.78rem;
  font-weight: 600; padding: 6px 8px;
}
.profile-dock a:hover { color: var(--text); }
body.has-profile-dock { padding-bottom: 64px; }

/* ===== Notifications ===== */
.notif-wrap { position: relative; display: inline-block; }
.notif-btn { position: relative; }
.notif-dropdown {
  position: absolute; right: 0; top: 110%;
  width: min(320px, 90vw);
  max-height: 360px; overflow-y: auto;
  background: var(--bg-card, #151922);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0,0,0,0.45);
  z-index: 60;
}
.notif-item {
  display: block; padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  text-decoration: none; color: inherit;
}
.notif-item:hover { background: rgba(124,58,237,0.12); }
.notif-time { color: var(--text-dim); font-size: 0.75rem; margin-top: 4px; }
.notif-empty { padding: 16px; color: var(--text-dim); text-align: center; }

/* ===== Comments thread ===== */
.comment-item {
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment-avatar {
  width: 40px; height: 40px; border-radius: 50%;
  overflow: hidden; background: #1e293b;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; }
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.comment-reply-btn {
  background: none; border: none; color: #a78bfa;
  cursor: pointer; font-size: 0.8rem; padding: 0; margin-top: 6px;
}
.comment-replies { margin-left: 20px; border-left: 2px solid var(--border); padding-left: 12px; margin-top: 8px; }

/* ===== News ===== */
.news-card {
  display: block; text-decoration: none; color: inherit;
  border: 1px solid var(--border); border-radius: 14px;
  overflow: hidden; background: var(--bg-card);
  margin-bottom: 14px;
}
.news-card img { width: 100%; max-height: 200px; object-fit: cover; display: block; }
.news-card-body { padding: 14px; }
.news-meta { color: var(--text-dim); font-size: 0.85rem; margin-top: 6px; }

/* ===== Shop ===== */
.shop-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}
.shop-card {
  border: 1px solid var(--border); border-radius: 12px;
  padding: 14px; background: var(--bg-card);
}
.shop-preview {
  height: 64px; border-radius: 10px; margin-bottom: 10px;
  background: #1e293b; display: flex; align-items: center; justify-content: center;
  font-size: 0.8rem; color: var(--text-dim);
}

/* ===== User list LS ===== */
.user-pick-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px; border: 1px solid var(--border); border-radius: 10px;
  margin-bottom: 8px; cursor: pointer; background: var(--bg-card);
}
.user-pick-row:hover { border-color: #7c3aed; }

/* light theme */
body.theme-light {
  --bg: #f1f5f9;
  --bg-card: #ffffff;
  --text: #0f172a;
  --text-dim: #64748b;
  --border: #e2e8f0;
  background: #f1f5f9;
  color: #0f172a;
}

.shop-preview-avatar {
  width: 56px; height: 56px; border-radius: 50%;
  margin: 0 auto 8px; overflow: hidden; background: #1e293b;
  display: flex; align-items: center; justify-content: center;
}
.shop-preview-avatar img { width: 100%; height: 100%; object-fit: cover; }




.price-tag { display: inline-block; margin-top: 6px; padding: 4px 10px; border-radius: 999px; background: rgba(99,102,241,0.25); font-size: 0.8rem; font-weight: 600; }

/* profile edit moved to settings */
#prof-nickname, #prof-save, #avatar-file, #avatar-upload, #avatar-clear,
label[for="prof-nickname"] { display: none !important; }
.profile-card label { }

/* Avatar frame textures (swap PNGs in assets/textures/frames/) */
.profile-avatar-wrap {
  position: relative;
}
.profile-avatar-wrap .frame-overlay {
  position: absolute;
  inset: -10%;
  width: 120%;
  height: 120%;
  left: -10%;
  top: -10%;
  pointer-events: none;
  object-fit: contain;
  z-index: 2;
}
.profile-avatar-wrap img.avatar-core,
.profile-avatar-wrap .avatar-core {
  position: relative;
  z-index: 1;
  width: 100% !important;
  height: 100% !important;
  object-fit: cover;
  border-radius: 50%;
}
.shop-preview-avatar {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 10px;
  overflow: visible;
  background: #1e293b;
}
.shop-preview-avatar .avatar-core {
  width: 100%; height: 100%; border-radius: 50%; object-fit: cover;
  display: block;
}
.shop-preview-avatar .frame-overlay {
  position: absolute;
  inset: -12%;
  width: 124%;
  height: 124%;
  left: -12%;
  top: -12%;
  pointer-events: none;
  object-fit: contain;
  z-index: 2;
}
.shop-preview-banner {
  width: 100%;
  height: 48px;
  border-radius: 8px;
  background-size: cover;
  background-position: center;
  margin-bottom: 10px;
}
.shop-preview-badge {
  width: 48px; height: 48px; margin: 0 auto 10px; display: block; object-fit: contain;
}

/* Clean profile layout */
.profile-card-clean { overflow: visible; padding: 0 0 16px; }
.profile-card-clean .profile-banner {
  height: 120px;
  width: calc(100% - 20px);
  margin: 10px auto 0;
  border-radius: 14px;
  max-width: 100%;
  overflow: hidden;
  background-size: cover !important;
  background-position: center !important;
  background-repeat: no-repeat !important;
  background-color: #1e1b4b;
  flex-shrink: 0;
}
.profile-card-clean .profile-hero {
  margin-top: -36px;
  padding: 0 16px 12px;
  align-items: flex-end;
  gap: 12px;
  position: relative;
  z-index: 2;
  flex-wrap: nowrap;
}
.profile-card-clean .profile-hero-text {
  flex: 1;
  min-width: 0;
  padding-top: 40px; /* text below banner overlap, not on top of it */
  overflow: hidden;
}
.profile-card-clean .profile-hero-text h1,
.profile-card-clean .profile-name-row h1 {
  font-size: 1.05rem;
  line-height: 1.25;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.profile-card-clean .profile-handle,
.profile-card-clean .email,
.profile-card-clean .profile-meta-line {
  font-size: 0.82rem;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.profile-card-clean .profile-avatar-wrap {
  width: 80px;
  height: 80px;
  border: none;
  background: transparent;
  flex-shrink: 0;
  overflow: visible;
  margin-bottom: 4px;
}
.profile-card-clean .profile-avatar-wrap .avatar-core {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50%;
  object-fit: cover;
  overflow: hidden;
}
.profile-card-clean .profile-avatar-wrap {
  border-radius: 50%;
}
.profile-card-clean .profile-avatar-wrap .avatar-core {
  border-radius: 50%;
  display: block;
}
.profile-card-clean .frame-overlay {
  position: absolute;
  inset: -14%;
  width: 128%;
  height: 128%;
  left: -14%;
  top: -14%;
  z-index: 2;
  pointer-events: none;
  object-fit: contain;
}
.profile-hero-text { flex: 1; min-width: 0; padding-bottom: 4px; }
.profile-meta-line { color: var(--text-dim); font-size: 0.8rem; margin-top: 4px; }
.profile-card-clean .profile-name-row h1 { font-size: 1.15rem; margin: 0; }
.profile-card-clean hr + h2,
.profile-card-clean .form-group,
.profile-card-clean .btn-submit,
.profile-card-clean .topbar-btn,
.profile-card-clean .pending-note,
.profile-card-clean .aspect-balance-line,
.profile-card-clean .detail-block {
  margin-left: 16px;
  margin-right: 16px;
}
.profile-card-clean .form-group { padding: 0; }
.profile-card-clean > .form-error,
.profile-card-clean > .form-success { margin-left: 16px; margin-right: 16px; }
.frame-dmf { /* marker class */ }
.comment-item {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.comment-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  overflow: hidden; background: #1e293b; flex-shrink: 0;
}
.comment-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.c-av-letter {
  width: 100%; height: 100%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; color: #94a3b8; font-size: 1rem;
}
.comment-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 4px; }
.comment-nick { font-weight: 700; color: inherit; text-decoration: none; }
.comment-nick:hover { text-decoration: underline; }
.comment-date { color: var(--text-dim); font-size: 0.75rem; }
.comment-text { white-space: pre-wrap; word-break: break-word; }
.comment-reply-btn {
  background: none; border: none; color: #a78bfa; cursor: pointer;
  font-size: 0.8rem; padding: 0; margin-top: 6px;
}
.comment-replies { margin-left: 8px; border-left: 2px solid var(--border); padding-left: 12px; margin-top: 8px; }
.comment-empty { color: var(--text-dim); }


/* Avatar: photo + optional PNG frame, no CSS green ring */
.profile-avatar-wrap {
  position: relative !important;
  width: 72px !important;
  height: 72px !important;
  border-radius: 50% !important;
  border: none !important;
  box-shadow: none !important;
  background: transparent !important;
  overflow: visible !important;
  flex-shrink: 0;
}
.profile-avatar-wrap .avatar-core {
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  object-fit: cover !important;
  background: #1e293b;
  font-size: 1.4rem;
  color: #94a3b8;
  overflow: hidden;
}
.profile-avatar-wrap img.avatar-core {
  display: block !important;
}
.profile-avatar-wrap .avatar-core.avatar-fallback {
  display: flex !important;
  align-items: center;
  justify-content: center;
}
.profile-avatar-wrap .frame-overlay {
  position: absolute !important;
  left: -16% !important;
  top: -16% !important;
  width: 132% !important;
  height: 132% !important;
  pointer-events: none !important;
  object-fit: contain !important;
  z-index: 2 !important;
}
.user-chip img,
.user-chip .user-avatar,
.user-chip .avatar-img {
  width: 28px !important;
  height: 28px !important;
  border-radius: 50% !important;
  object-fit: cover !important;
}
.aspect-hero-img {
  width: min(100%, 420px);
  max-height: 160px;
  height: auto;
  object-fit: contain;
  display: block;
  margin: 0 auto 12px;
  border-radius: 14px;
}
.placeholder-box { display: none !important; }

/* unified comment form */
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: rgba(0,0,0,0.2);
}
.comment-form textarea {
  width: 100%;
  min-height: 88px;
  resize: vertical;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg-card, #151922);
  color: var(--text);
  padding: 12px 14px;
  font: inherit;
  line-height: 1.4;
}
.comment-form textarea:focus {
  outline: none;
  border-color: #7c3aed;
  box-shadow: 0 0 0 3px rgba(124,58,237,0.2);
}
.comment-form .btn-submit {
  align-self: flex-start;
}

/* Guest on profile: hide settings / confirmation / admin */
html.guest-profile [data-guest-hide],
html.guest-profile #settings-link,
html.guest-profile a[href*="settings"],
html.guest-profile .pending-note,
html.guest-profile #pending-code,
html.guest-profile #pending-code-btn,
html.guest-profile .admin-unlock-block,
html.guest-profile #admin-code,
html.guest-profile #admin-unlock-btn {
  display: none !important;
}

/* Ratings */
.rate-widget {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,0.2);
}
.rate-like-btn {
  border: none;
  background: rgba(239,68,68,0.12);
  color: #f87171;
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 1rem;
  cursor: pointer;
  font-weight: 600;
}
.rate-like-btn.is-liked { background: rgba(239,68,68,0.28); }
.rate-like-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.rate-stars { display: flex; gap: 2px; }
.rate-star {
  border: none;
  background: transparent;
  color: #475569;
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0 2px;
  line-height: 1;
}
.rate-star.on { color: #fbbf24; }
.rate-star:disabled { cursor: not-allowed; opacity: 0.6; }
.rate-avg { color: var(--text-dim); font-size: 0.9rem; }
.rate-hint { color: var(--text-dim); font-size: 0.85rem; margin: 0 0 8px; }
.support-ask-btn {
  width: 100%;
  margin-bottom: 14px;
}

/* Presence */
.presence-online { color: #4ade80; font-size: 0.88rem; display: inline-flex; align-items: center; gap: 6px; }
.presence-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: #22c55e; box-shadow: 0 0 0 3px rgba(34,197,94,0.25);
  display: inline-block;
}
.presence-offline { color: var(--text-dim); font-size: 0.88rem; }

/* Force no green CSS ring on avatars */
.profile-avatar-wrap,
.profile-card-clean .profile-avatar-wrap {
  box-shadow: none !important;
  border: none !important;
  background: transparent !important;
}
.profile-avatar-wrap.frame-mc,
.profile-avatar-wrap.frame-gold,
.profile-avatar-wrap.frame-neon {
  box-shadow: none !important;
}
.user-admin-table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
.user-admin-table th, .user-admin-table td {
  padding: 8px 6px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top;
}
.user-admin-table th { color: var(--text-dim); font-weight: 600; }


.profile-banner-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: inherit;
}
.profile-banner { position: relative; }
