:root {
  --bg: #ffffff;
  --bg-elevated: #f5f5f6;
  --bg-elevated-2: #ececee;
  --card-bg: #ffffff;
  --card-border: #e7e7e9;
  --border-strong: #dcdce0;
  --text: #0a0a0a;
  --text-muted: #6b6b70;
  --placeholder: #a8a8ae;
  --accent: #0a0a0a;
  --accent-2: #0a0a0a;
  --gradient: #0a0a0a;
  --on-accent: #ffffff;
  /* The one accent color in the whole palette — #1 on the leaderboard, the
     liked-heart state, gold headings/highlights. Everything else stays
     black/white/grey; red is reserved for errors and destructive actions
     (see --danger) only. */
  --accent-color: #f5c400;
  --gold: #f5c400;
  --gold-text: #9a7400; /* readable on white, passes WCAG AA for normal text */
  --silver: #9ca3af;
  --silver-text: #6b7280;
  --bronze: #c17a3f;
  --bronze-text: #9a5a28;
  --diamond: #5ec8e0;
  --diamond-text: #1a7f96; /* readable on white, passes WCAG AA for normal text */
  --tier-color: var(--text-muted);
  --radius: 16px;
  --danger: #dc2626;
  --positive: #16a34a;
}

* {
  box-sizing: border-box;
}

html {
  color-scheme: light;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  position: relative;
  overflow-x: hidden;
}

h1, h2, h3 {
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.bg-glow {
  display: none;
}

/* One consistent line-icon set (Lucide) instead of emoji for persistent UI
   chrome. lucide.createIcons() replaces the <i data-lucide> placeholder with
   its own fresh <svg class="lucide lucide-{name}">, discarding whatever
   class/width/height sat on the placeholder — so sizing targets the *svg
   inside* these wrapper spans (or an existing named parent), never a class
   on the icon element itself. Default size is for inline text-adjacent
   icons; .lucide-icon-sm is for compact contexts like badges and tags. */
.lucide-icon svg {
  width: 16px;
  height: 16px;
  vertical-align: -3px;
  stroke-width: 2px;
}

.lucide-icon-sm svg {
  width: 14px;
  height: 14px;
  vertical-align: -2px;
}

.site-header {
  text-align: center;
  padding: 56px 20px 32px;
}

.header-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn-ghost {
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  color: var(--text);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: border-color 0.15s, color 0.15s;
}

.btn-ghost:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

.btn-small {
  padding: 8px 14px;
  font-size: 0.85rem;
}

/* Account bar */
.account-bar {
  position: fixed;
  top: calc(16px + var(--config-banner-h, 0px));
  left: 16px;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 8px;
}

.account-admin-btn {
  position: relative;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  width: 34px;
  height: 34px;
  font-size: 0.95rem;
  cursor: pointer;
  border: 1px solid var(--card-border);
}

.admin-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 16px;
  height: 16px;
  padding: 0 3px;
  border-radius: 999px;
  background: var(--danger);
  color: #ffffff;
  font-size: 0.62rem;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.account-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--card-border);
  cursor: pointer;
  transition: border-color 0.15s;
}

.account-chip:hover {
  border-color: var(--border-strong);
}

.account-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gradient);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.account-name {
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.founder-badge {
  font-size: 0.85em;
}

.logo {
  font-size: 2.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.logo span {
  background: var(--gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logo em {
  font-style: normal;
}

.tagline {
  margin: 10px 0 24px;
  color: var(--text-muted);
  font-size: 1rem;
}

main {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px 60px;
  position: relative;
}

.board-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 18px;
}

.champion-promo-line {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.82rem;
  margin: -6px 0 20px;
}

.search-bar-wrap {
  margin-bottom: 16px;
}

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 10px 14px;
}

.search-bar-icon {
  flex: none;
  display: flex;
  color: var(--text-muted);
}

.search-bar-input {
  flex: 1;
  min-width: 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.92rem;
  color: var(--text);
  outline: none;
}

.search-bar-input::placeholder {
  color: var(--placeholder);
}

.search-bar-clear {
  flex: none;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: none;
  background: var(--bg-elevated-2);
  color: var(--text-muted);
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-bar-clear[hidden] {
  display: none;
}

.search-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.search-filter-chip {
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  font-size: 0.78rem;
  padding: 6px 12px;
}

.search-filter-chip.active {
  background: #0a0a0a;
  color: #ffffff;
  border-color: #0a0a0a;
}

.search-filter-chip.active .tabler-icon,
.search-filter-chip.active .brand-icon {
  color: #ffffff;
}

.search-empty-mascot {
  width: 96px;
  margin: 0 auto 10px;
}

.search-empty-mascot img {
  width: 100%;
  height: auto;
  display: block;
}

.board-toggle {
  display: inline-flex;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}

.toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.toggle-btn .tabler-icon,
.toggle-btn .brand-icon,
.toggle-btn .tool-monogram {
  width: 16px;
  height: 16px;
  flex: none;
}

.toggle-btn.active {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.toggle-btn:not(.active):hover {
  color: var(--text);
}

.countdown {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 8px 16px;
}

.countdown-value {
  font-weight: 800;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.page-title {
  font-size: 1.6rem;
  font-weight: 800;
  margin: 20px 0 20px;
}

.leaderboard {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-card {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  backdrop-filter: blur(12px);
  animation: fadeInUp 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.app-card:hover {
  border-color: rgba(10, 10, 10, 0.18);
  transform: translateY(-2px);
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Accent border is driven by explicit classes set in script.js, not
   :nth-child — the pinned champion card sits at DOM position 1 without being
   rank #1, so position alone can't be trusted here. Only #1 (and the pinned
   champion) get special treatment; #2/#3 look like every other card. A
   subtle 1px border, not a glow. */
.app-card.rank-gold,
.app-card.pinned-champion {
  border-color: var(--accent-color);
}

.app-card.rank-silver {
  border-color: var(--silver);
}

.app-card.rank-bronze {
  border-color: var(--bronze);
}

.rank {
  flex: 0 0 32px;
  text-align: center;
  font-weight: 800;
  font-size: 1.5rem;
  letter-spacing: -0.02em;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.rank-gold .rank,
.pinned-champion .rank { color: var(--accent-color); }
.rank-silver .rank { color: var(--silver-text); }
.rank-bronze .rank { color: var(--bronze-text); }

.champion-pin-label {
  position: absolute;
  top: -11px;
  left: 16px;
  background: var(--gradient);
  color: var(--on-accent);
  font-size: 0.68rem;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 999px;
}

.card-menu-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.card-menu-btn:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.card-menu {
  position: absolute;
  top: 38px;
  right: 8px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  min-width: 140px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.card-menu[hidden] {
  display: none;
}

.card-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  border-radius: 8px;
  padding: 9px 10px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.card-menu-item:hover {
  background: var(--bg-elevated);
}

/* Notifications dropdown — a static, always-in-the-DOM panel (not
   regenerated by renderAccountBar() on every refresh) so a periodic
   background notification check never yanks it shut while someone's reading
   it; only its open/closed state and its list content change. */
.notifications-panel {
  position: fixed;
  top: calc(60px + var(--config-banner-h, 0px));
  left: 16px;
  z-index: 35;
  width: 320px;
  max-width: calc(100vw - 32px);
  max-height: 70vh;
  overflow-y: auto;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 14px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.notifications-panel[hidden] {
  display: none;
}

.notifications-panel-header {
  font-size: 0.85rem;
  font-weight: 800;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--card-border);
}

.notifications-list {
  display: flex;
  flex-direction: column;
}

.notification-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--card-border);
  cursor: pointer;
  text-align: left;
  background: none;
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  font-family: inherit;
  transition: background 0.15s;
}

.notification-item:last-child {
  border-bottom: none;
}

.notification-item:hover {
  background: var(--bg-elevated);
}

.notification-item.unread {
  background: var(--bg-elevated);
}

.notification-icon {
  flex: 0 0 auto;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #0a0a0a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* A rank-up notification's badge art already has its own shape/color —
   drop the circular black backdrop every other type gets. */
.notification-icon-badge {
  background: none;
}

.notification-text {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  color: var(--text);
}

.notification-time {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.notification-share-btn {
  flex: none;
  align-self: center;
  white-space: nowrap;
}

.app-icon-link {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  display: block;
}

.app-icon {
  width: 100%;
  height: 100%;
  border-radius: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  overflow: hidden;
}

.app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Fallback for any app icon container (leaderboard card, detail page, admin
   row, champion card, onboarding preview) when no real icon was found or
   uploaded — a black rounded square with the app's first letter, never the
   generic 📱 emoji. Uses !important because it's mixed onto several
   differently-styled containers (.app-icon, .detail-icon, .onboard-preview-icon,
   etc.) that each set their own default background/color. */
.icon-letter-fallback {
  background: #0a0a0a !important;
  color: #ffffff !important;
  font-weight: 800;
}

/* Maker avatars — composes with each spot's own size class
   (.account-avatar, .profile-avatar, .maker-avatar, .comment-avatar,
   .notification-icon) rather than replacing it. */
.avatar-circle {
  overflow: hidden;
  position: relative;
  flex: none;
}

.avatar-circle img,
.avatar-circle svg {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.avatar-circle.avatar-preset img {
  background: #f5f0e6;
}

.avatar-circle.avatar-letter-fallback {
  background: var(--gradient);
  color: var(--on-accent);
}

.maker-avatar {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 800;
  flex: none;
}

.app-info {
  flex: 1;
  min-width: 0;
}

.app-name-row {
  display: block;
}

.app-name {
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
}

/* Mobile-only "rank badge" (really the maker's tier badge, at 16px) next to
   the app name, and the whole compact 3rd meta line below — both hidden on
   desktop by default; see the max-width:767px rules for where they turn on. */
.card-name-tier-badge {
  display: none;
}

.app-card-mobile-meta {
  display: none;
}

.app-name:hover {
  color: var(--text-muted);
}

.maker-link {
  display: flex;
  align-items: center;
  gap: 5px;
  width: 100%;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-family: inherit;
  cursor: pointer;
  padding: 2px 0;
  margin-top: 1px;
}

.maker-link:hover {
  color: var(--accent-2);
}

.maker-name-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.maker-tier-icon {
  flex: 0 0 auto;
  font-size: 0.85rem;
}

.app-description {
  margin: 4px 0 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.tier-progress-tag {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.detail-tier-progress {
  font-size: 0.82rem;
  margin: -6px 0 14px;
}

.build-time-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  white-space: nowrap;
}

.build-time-tag[hidden] {
  display: none;
}

.detail-build-time-tag {
  margin: 8px 0 0;
}

.btn {
  cursor: pointer;
  border: none;
  font-family: inherit;
}

.btn-primary {
  background: var(--gradient);
  color: var(--on-accent);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: transform 0.15s;
}

.btn-primary:hover {
  transform: translateY(-1px);
}

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

.btn-danger {
  background: var(--danger);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  transition: transform 0.15s;
}

.btn-danger:hover {
  transform: translateY(-1px);
}

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

.btn-upvote {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 10px 16px;
  color: var(--text);
  font-weight: 800;
  min-width: 56px;
  transition: background 0.15s, border-color 0.15s, color 0.15s, transform 0.1s;
}

.btn-upvote .heart-icon {
  font-size: 1rem;
  line-height: 1;
  transition: transform 0.15s;
}

.btn-upvote:hover {
  border-color: var(--accent);
  color: var(--accent-2);
}

.btn-upvote:hover .heart-icon {
  transform: scale(1.1);
}

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

.btn-upvote.voted {
  background: var(--gradient);
  border-color: transparent;
  color: var(--on-accent);
}

.btn-upvote.voted .heart-icon {
  transform: scale(1.05);
}

.btn-upvote.voted .heart-icon svg {
  fill: currentColor;
}

.report-btn {
  flex: 0 0 auto;
  background: none;
  border: none;
  font-size: 1.1rem;
  line-height: 1;
  padding: 4px;
  opacity: 0.55;
  cursor: pointer;
  transition: opacity 0.15s;
}

.report-btn:hover {
  opacity: 1;
}

.detail-report-btn {
  margin-left: auto;
}

.vote-count {
  display: inline-block;
}

.vote-count.pop {
  animation: pop 0.3s ease;
}

.heart-icon.pop {
  animation: pop 0.3s ease;
}

@keyframes pop {
  0% { transform: scale(1); }
  40% { transform: scale(1.5); }
  100% { transform: scale(1); }
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 70px 20px;
  font-size: 1.05rem;
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 20;
  animation: fadeIn 0.2s ease both;
}

.modal-overlay[hidden] {
  display: none;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 30px;
  width: 100%;
  max-width: 440px;
  position: relative;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
  animation: scaleIn 0.25s cubic-bezier(0.2, 0.8, 0.2, 1) both;
  max-height: 88vh;
  overflow-y: auto;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.94) translateY(8px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal h2 {
  margin: 0 0 20px;
  font-size: 1.3rem;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  padding: 0;
  font-size: 1.5rem;
  color: var(--text-muted);
  line-height: 1;
  cursor: pointer;
}

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

.profile-drag-handle {
  display: none;
}

#app-form {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

#app-form label {
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 12px;
  color: var(--text-muted);
}

#app-form input:not([type="checkbox"]),
#app-form textarea {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 11px 13px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  resize: vertical;
  background: var(--bg-elevated);
  color: var(--text);
}

#app-form input::placeholder,
#app-form textarea::placeholder {
  color: var(--placeholder);
}

#app-form input:not([type="checkbox"]):focus,
#app-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.1);
}

#app-form .checkbox-row {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  cursor: pointer;
}

#app-form .btn-primary {
  margin-top: 22px;
  width: 100%;
}

#app-form .btn-primary.loading {
  opacity: 0.7;
  pointer-events: none;
}

.form-hint {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin: 6px 0 0;
}

.form-error {
  color: var(--danger);
  font-size: 0.85rem;
  margin: 12px 0 0;
  background: rgba(248, 113, 113, 0.1);
  border: 1px solid rgba(248, 113, 113, 0.3);
  border-radius: 8px;
  padding: 10px 12px;
}

/* Profile modal */
.profile-modal {
  max-width: 460px;
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--card-border);
}

.profile-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: 800;
  background: var(--gradient);
  color: var(--on-accent);
}

.profile-avatar-btn {
  position: relative;
  padding: 0;
  border: none;
  background: none;
  border-radius: 50%;
  cursor: default;
}

.profile-avatar-btn.editable {
  cursor: pointer;
}

.profile-avatar-btn:disabled {
  cursor: default;
}

.profile-avatar-edit-badge {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #0a0a0a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 2px var(--bg);
}

.profile-edit-btn {
  margin-top: -2px;
}

/* ---------- Edit profile modal ---------- */
.edit-profile-modal h2 {
  margin-bottom: 16px;
}

.edit-profile-section-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 18px 0 8px;
}

.edit-profile-section-label:first-of-type {
  margin-top: 0;
}

.avatar-preset-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
}

.avatar-preset-option {
  aspect-ratio: 1;
  padding: 2px;
  border: 2px solid transparent;
  border-radius: 50%;
  background: none;
  cursor: pointer;
}

.avatar-preset-option .avatar-circle {
  width: 100%;
  height: 100%;
}

.avatar-preset-option.selected {
  border-color: var(--gold);
}

.edit-profile-upload-row {
  margin-top: 10px;
}

.edit-profile-tip {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 6px 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.edit-profile-tip[hidden] {
  display: none;
}

.edit-profile-pending-note {
  font-size: 0.78rem;
  color: var(--gold-text);
  margin: 8px 0 0;
  display: flex;
  align-items: center;
  gap: 5px;
}

.edit-profile-pending-note[hidden] {
  display: none;
}

.edit-username-row {
  position: relative;
  display: flex;
  align-items: center;
}

.edit-username-row .onboard-input {
  margin-bottom: 0;
  padding-right: 80px;
}

.edit-username-status {
  position: absolute;
  right: 14px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
}

.edit-username-status.available {
  color: var(--positive);
}

.edit-username-status.taken {
  color: var(--danger);
}

#edit-profile-overlay .confirm-actions {
  margin-top: 20px;
}

@media (max-width: 480px) {
  .avatar-preset-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.profile-name {
  font-size: 1.25rem;
  font-weight: 800;
}

.tier-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
  font-size: 1.05rem;
}

/* Every tier badge image, at whatever size a caller requests via the
   width/height attributes on the <img> itself (tierBadgeHtml in script.js)
   — this class only carries shared, size-independent styling. */
.tier-badge-img {
  display: inline-block;
  vertical-align: middle;
  flex: none;
  object-fit: contain;
}

.tier-badge-inline {
  vertical-align: -5px;
}

.tier-badge-greyed {
  filter: grayscale(1) opacity(0.45);
}

.profile-progress-row {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.progress-track-wrap {
  flex: 1;
  min-width: 0;
}

.next-tier-badge-wrap {
  flex: none;
}

.maker-level-badge {
  display: inline-flex;
  align-items: center;
  margin-top: 4px;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--bg-elevated-2);
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 700;
}

.progress-track {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  background: var(--bg-elevated-2);
  overflow: hidden;
  margin-top: 6px;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--gradient);
  transition: width 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.progress-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 6px;
}

.profile-section-title {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 22px 0 10px;
  font-weight: 700;
}

.profile-apps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.profile-logout-row {
  margin-top: 26px;
  padding-top: 20px;
  border-top: 1px solid var(--card-border);
}

.profile-logout-row .btn {
  width: 100%;
}

.profile-admin-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin-bottom: 10px;
}

.admin-badge.inline {
  position: static;
  box-shadow: none;
}

/* Desktop keeps the 🛠️ button in the top-left account bar (unchanged) — the
   "Admin" row inside the profile page is only needed on mobile, where that
   bar is hidden (see the max-width: 767px block below). */
@media (min-width: 768px) {
  .profile-admin-btn {
    display: none;
  }
}

.profile-app-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  background: var(--bg-elevated);
  border-radius: 10px;
  font-size: 0.9rem;
}

.profile-app-row .votes {
  color: var(--accent-2);
  font-weight: 700;
}

/* Toasts */
.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 50;
  /* Toasts are purely informational (they auto-dismiss, no buttons to press),
     so a stack of them must never be able to block clicks to real controls
     underneath, no matter how tall it grows. */
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  border-radius: 12px;
  padding: 14px 18px;
  min-width: 240px;
  max-width: 300px;
  animation: toastIn 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.toast.leaving {
  animation: toastOut 0.3s ease both;
}

@keyframes toastIn {
  from { opacity: 0; transform: translateX(30px) scale(0.95); }
  to { opacity: 1; transform: translateX(0) scale(1); }
}

@keyframes toastOut {
  to { opacity: 0; transform: translateX(30px) scale(0.95); }
}

.toast-icon {
  font-size: 1.6rem;
  flex: 0 0 auto;
}

.toast-icon img {
  display: block;
}

.toast-title {
  font-weight: 800;
  font-size: 0.9rem;
}

.toast-subtitle {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.confetti-piece {
  position: fixed;
  width: 7px;
  height: 7px;
  border-radius: 2px;
  pointer-events: none;
  z-index: 60;
  animation: confettiBurst 0.9s ease-out forwards;
}

@keyframes confettiBurst {
  to {
    transform: translate(var(--dx), var(--dy)) rotate(var(--rot));
    opacity: 0;
  }
}

/* Detail page */
#detail-view {
  animation: fadeInUp 0.35s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.back-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  padding: 4px 0;
  margin: 20px 0 18px;
}

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

.detail-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 28px;
  backdrop-filter: blur(12px);
}

.detail-top {
  display: flex;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 18px;
}

.detail-icon {
  flex: 0 0 84px;
  width: 84px;
  height: 84px;
  border-radius: 20px;
  overflow: hidden;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
}

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

.detail-heading {
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.detail-name {
  margin: 0 0 8px;
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.25;
}

.detail-rank-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--gradient);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 0.8rem;
  padding: 5px 12px;
  border-radius: 999px;
}

.detail-rank-pill.status-pending,
.detail-rank-pill.status-rejected {
  background: var(--bg-elevated-2);
  color: var(--text);
}

.app-status-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--bg-elevated-2);
  color: var(--text-muted);
  margin-left: 4px;
}

.detail-meta-row {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
  margin-bottom: 22px;
  padding: 16px 0;
  border-top: 1px solid var(--card-border);
  border-bottom: 1px solid var(--card-border);
}

.meta-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.meta-value {
  font-weight: 700;
  font-size: 0.92rem;
}

.detail-meta-item .maker-link {
  padding: 0;
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--text);
}

.detail-meta-item .maker-link:hover {
  color: var(--text-muted);
}

.detail-vote-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.detail-vote-label {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.detail-description {
  white-space: pre-line;
  color: var(--text);
  line-height: 1.6;
  font-size: 0.94rem;
  margin-bottom: 26px;
}

.trophy-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.trophy-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 999px;
}

/* Comments */
.comments-section {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 24px 28px 28px;
  margin-top: 16px;
  backdrop-filter: blur(12px);
}

/* Vote-history graph (maker profile + app detail pages) */
.history-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.history-total {
  font-size: 2.1rem;
  font-weight: 800;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.history-change {
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 2px;
}

.history-change.up {
  color: var(--positive);
}

.history-change.down {
  color: var(--danger);
}

.history-ranges {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  padding: 4px;
  border-radius: 999px;
  height: fit-content;
}

.history-range-btn {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  color: var(--text-muted);
  padding: 6px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.history-range-btn.active {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--border-strong);
}

.history-chart-wrap {
  width: 100%;
  margin-top: 18px;
}

.history-svg {
  width: 100%;
  height: 180px;
  display: block;
  overflow: visible;
}

.history-chart-labels {
  display: flex;
  margin-top: 4px;
}

.history-chart-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.history-privacy-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--card-border);
  font-size: 0.88rem;
  color: var(--text-muted);
  cursor: pointer;
}

/* Vote rank chart (per-app, App Store tracker style) */
.rank-chart-card {
  background: var(--accent);
  border-radius: 16px;
  padding: 14px 14px 6px;
}

.rank-chart-card-empty {
  padding: 34px 20px;
  text-align: center;
}

.rank-chart-empty-text {
  margin: 0;
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.92rem;
}

.rank-chart-tabs {
  display: inline-flex;
  gap: 2px;
  background: rgba(255, 255, 255, 0.1);
  padding: 4px;
  border-radius: 999px;
  margin: 2px 0 12px;
}

.rank-chart-tab {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.62);
  padding: 6px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.rank-chart-tab.active {
  background: #ffffff;
  color: #0a0a0a;
}

.rank-chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 200px;
}

.switch {
  position: relative;
  display: inline-block;
  width: 40px;
  height: 22px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  position: absolute;
  inset: 0;
  background: #d6d6da;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 16px;
  width: 16px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}

.switch input:checked + .switch-slider {
  background: var(--gradient);
}

.switch input:checked + .switch-slider::before {
  transform: translateX(18px);
}

.comment-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.comment-form textarea {
  font-family: inherit;
  font-size: 0.92rem;
  padding: 11px 13px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  resize: vertical;
  background: var(--bg-elevated);
  color: var(--text);
}

.comment-form textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.1);
}

.comment-form .btn-primary {
  align-self: flex-end;
  padding: 10px 18px;
}

.comment-login-prompt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 10px;
  padding: 14px 16px;
  margin-bottom: 20px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

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

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.comment {
  padding-bottom: 14px;
  border-bottom: 1px solid var(--card-border);
}

.comment:last-child {
  border-bottom: none;
  padding-bottom: 0;
}

.comment-reply {
  margin: 12px 0 0 24px;
  padding: 12px 0 0 16px;
  border-left: 2px solid var(--card-border);
  border-bottom: none;
}

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

.comment-author-row {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.comment-author {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 700;
  font-size: 0.9rem;
}

.maker-tag {
  background: var(--gradient);
  color: var(--on-accent);
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 7px;
  border-radius: 999px;
}

.comment-time {
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.comment-body {
  margin: 0;
  color: var(--text);
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-line;
}

.comment-reply-btn {
  background: none;
  border: none;
  color: var(--accent-2);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  padding: 6px 0 0;
}

.comment-reply-btn:hover {
  text-decoration: underline;
}

.comment-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 4px;
}

.comment-actions .comment-reply-btn {
  padding: 6px 0;
  margin-right: auto;
}

.comment-action-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  background: none;
  border: none;
  border-radius: 7px;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.comment-action-btn:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.comment-reply-form-slot:not(:empty) {
  margin-top: 10px;
}

.reply-form textarea {
  font-size: 0.88rem;
}

/* Config warning banner (shown when supabase-config.js still has placeholders) */
.config-banner {
  position: sticky;
  top: 0;
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: rgba(248, 113, 113, 0.12);
  border-bottom: 1px solid rgba(248, 113, 113, 0.35);
  color: var(--text);
  font-size: 0.88rem;
  text-align: center;
}

.config-banner strong {
  color: var(--danger);
}

.config-banner code {
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 0.85em;
}

/* Auth modal */
.auth-modal {
  max-width: 400px;
  padding: 36px 32px;
}

.auth-view[hidden] {
  display: none;
}

.auth-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin: 0 0 6px;
  text-align: center;
}

.auth-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
  margin: 0 0 26px;
}

.oauth-buttons {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 22px;
}

.oauth-buttons[hidden] {
  display: none;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 16px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: var(--bg-elevated);
  color: var(--text);
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 0.15s, border-color 0.15s, transform 0.15s;
}

.btn-oauth:hover {
  background: var(--bg-elevated-2);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.btn-oauth svg {
  flex-shrink: 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px;
  color: var(--text-muted);
  font-size: 0.8rem;
}

.auth-divider[hidden] {
  display: none;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--card-border);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form[hidden] {
  display: none;
}

.auth-form label {
  font-size: 0.85rem;
  font-weight: 700;
  margin-top: 10px;
  color: var(--text-muted);
}

.auth-form label:first-child {
  margin-top: 0;
}

.auth-form input {
  font-family: inherit;
  font-size: 0.95rem;
  padding: 13px 15px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--bg-elevated);
  color: var(--text);
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.1);
}

.btn-large {
  width: 100%;
  padding: 14px 20px;
  font-size: 1rem;
  border-radius: 12px;
}

.detail-open-app-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  margin: 16px 0;
}

.detail-edit-btn {
  flex: 0 0 auto;
}

/* Links grid — 2 columns of outlined buttons below the primary "Open app"
   button, each with a real brand icon (Tabler, not Lucide — see
   tablerIcon() in script.js) plus a small grey line and a bold line. */
.app-links-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 0 0 16px;
}

.app-link-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--card-border);
  border-radius: 12px;
  background: var(--card-bg);
  color: var(--text);
  text-decoration: none;
  transition: border-color 0.15s, transform 0.15s;
}

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

.app-link-btn .tabler-icon {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
}

.app-link-btn-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.app-link-btn-prefix {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.app-link-btn-label {
  font-size: 0.88rem;
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 420px) {
  .app-links-grid {
    grid-template-columns: 1fr;
  }
}

/* "What's New" changelog on the app page */
.app-updates-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app-update-item {
  display: flex;
  gap: 10px;
  font-size: 0.88rem;
  line-height: 1.4;
}

.app-update-date {
  flex: 0 0 auto;
  color: var(--text-muted);
  font-size: 0.78rem;
  white-space: nowrap;
  padding-top: 1px;
}

.app-update-note {
  color: var(--text);
}

/* Edit App modal — reuses .onboard-input for its fields, but labels there
   are styled scoped to #onboard-slide-details, which this modal isn't
   inside, so it needs its own (identical) label rule. */
.edit-app-modal {
  text-align: left;
}

.edit-app-modal label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.edit-app-icon-row {
  margin-bottom: 16px;
}

.edit-toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 16px;
}

.edit-toggle-group .toggle-btn {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--card-border);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 0.85rem;
}

.edit-toggle-group .toggle-btn.active {
  background: #0a0a0a;
  color: #ffffff;
  border-color: #0a0a0a;
}

.edit-app-links-section {
  margin-bottom: 4px;
}

/* "Built with" custom-tool sub-section (shown once "Other" is toggled on) */
.built-with-custom {
  margin: 4px 0 16px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border-radius: 12px;
}

.built-with-custom-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 8px;
}

.built-with-custom-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.built-with-custom-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #0a0a0a;
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 6px 4px 10px;
  border-radius: 999px;
}

.built-with-remove-tag {
  background: none;
  border: none;
  color: #ffffff;
  opacity: 0.7;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px;
}

.built-with-remove-tag:hover {
  opacity: 1;
}

.built-with-custom-input-row {
  display: flex;
  gap: 8px;
}

.built-with-custom-input-row .onboard-input {
  flex: 1;
  margin-bottom: 0;
}

/* "Built in" Custom number + unit, and the generic "Other" text input used
   by discoverySource/goal/makerLevel. */
.build-time-custom {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.build-time-custom-number {
  flex: 0 0 90px;
  margin-bottom: 0;
}

.build-time-custom-unit {
  flex: 1;
  margin-bottom: 0;
  cursor: pointer;
}

.onboard-other-input-wrap {
  margin-top: 4px;
}

.onboard-other-input {
  margin-bottom: 0;
}

/* The builtWith question's options container is display:flex (.onboard-
   options, for the normal chip-row questions) — force these two onto their
   own full-width rows so the picker and the Continue button stack instead
   of sitting side by side. */
#onboard-built-with-mount,
.onboard-built-with-continue-btn {
  flex: 1 1 100%;
}

.onboard-built-with-continue-btn {
  margin-top: 14px;
}

/* Small tags on the app card / app page / onboarding preview — compact
   since several tools can be selected at once, unlike the single pill
   build-time-tag uses. */
.built-with-tags {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 4px 4px 0 0;
}

.built-with-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated-2);
  color: var(--text-muted);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
}

.built-with-tag .tabler-icon,
.built-with-tag .brand-icon,
.built-with-tag .tool-monogram {
  width: 13px;
  height: 13px;
  flex: none;
}

/* Brand/Tabler tool icons: monochrome black everywhere, 20px by default
   (callers shrink them with the rules above when used inside a chip/tag). */
.tabler-icon,
.brand-icon {
  color: #0a0a0a;
  flex: none;
}

.tool-monogram {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 6px;
  background: #0a0a0a;
  color: #ffffff;
  font-size: 0.65rem;
  font-weight: 800;
  flex: none;
}

.tier-medal-icon {
  display: inline-flex;
  align-items: center;
  vertical-align: -3px;
}

.tier-medal-icon .tabler-icon {
  width: 15px;
  height: 15px;
}

.edit-app-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 4px 0 16px;
}

.auth-form .btn-large {
  margin-top: 20px;
}

.auth-switch {
  text-align: center;
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 24px 0 0;
}

.auth-switch-link {
  background: none;
  border: none;
  color: var(--accent-2);
  font-family: inherit;
  font-size: inherit;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.auth-switch-link:hover {
  text-decoration: underline;
}

/* Founder-spots banner (shown above the sign-up form) */
.founder-spots-banner {
  background: var(--accent);
  color: var(--on-accent);
  font-size: 0.85rem;
  font-weight: 700;
  text-align: center;
  padding: 10px 14px;
  border-radius: 10px;
  margin: 0 0 20px;
}

.founder-spots-banner[hidden] {
  display: none;
}

/* Back button shown at the top of an onboarding slide, or on the auth modal
   when it was reached from the onboarding flow. */
.onboard-back-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
  margin: 0 0 16px;
  display: block;
}

.onboard-back-btn:hover {
  color: var(--text);
}

.onboard-back-btn[hidden] {
  display: none;
}

/* Onboarding flow — full-screen on mobile, a centered phone-width column on
   desktop. Soft off-white with a faint warm gold glow at the top, same
   family as the welcome screen that leads into it. */
.onboard-overlay {
  background: transparent;
  padding: 0;
  align-items: stretch;
  justify-content: stretch;
}

.onboard-modal {
  max-width: 100%;
  width: 100%;
  height: 100%;
  max-height: 100%;
  margin: 0;
  border-radius: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 560px 320px at 50% -6%, rgba(245, 196, 0, 0.16), transparent 70%),
    #faf9f5;
  overflow: hidden;
}

@media (min-width: 480px) {
  .onboard-overlay {
    align-items: center;
    justify-content: center;
    padding: 24px 0;
  }
  .onboard-modal {
    max-width: 420px;
    height: min(100%, 860px);
    border-radius: 24px;
    box-shadow: 0 24px 60px -20px rgba(10, 10, 10, 0.35);
  }
}

.onboard-topbar {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: 34px 1fr 34px;
  align-items: center;
  padding: 16px 18px 0;
}

.onboard-topbar-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text);
}

.onboard-topbar-logo svg {
  width: 16px;
  height: 16px;
}

.onboard-topbar-logo em {
  font-style: normal;
}

.onboard-round-btn {
  flex: 0 0 auto;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: #ffffff;
  color: #0a0a0a;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 1px solid var(--card-border);
  transition: transform 0.1s;
}

.onboard-round-btn:hover {
  transform: scale(1.06);
}

.onboard-round-btn[hidden] {
  visibility: hidden;
}

/* Segmented progress bar: one filled-black segment per step (an uppercase
   phase label on the left, the % on the right), not a single sliding fill. */
.onboard-progress-wrap {
  flex: 0 0 auto;
  padding: 14px 18px 0;
}

.onboard-progress-labels {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.onboard-progress-phase {
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text);
}

.onboard-progress-pct {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
}

.onboard-progress-segments {
  display: flex;
  gap: 4px;
}

.onboard-progress-segment {
  flex: 1;
  height: 5px;
  border-radius: 999px;
  background: rgba(10, 10, 10, 0.1);
}

.onboard-progress-segment.filled {
  background: #0a0a0a;
}

.onboard-step-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 0 24px 24px;
  -webkit-overflow-scrolling: touch;
}

.onboard-mascot {
  display: flex;
  justify-content: flex-end;
  margin: 8px 0 4px;
}

.onboard-mascot-img {
  width: auto;
  height: 72px;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}

.onboard-step-heading {
  text-align: left;
  margin-bottom: 20px;
}

.onboard-step-heading h2 {
  margin: 0 0 8px;
  font-size: 1.6rem;
  font-weight: 800;
  line-height: 1.22;
}

.onboard-gold {
  color: var(--gold-text);
}

.onboard-slide[hidden] {
  display: none;
}

.onboard-slide {
  animation: onboardSlideIn 0.32s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

@keyframes onboardSlideIn {
  from { opacity: 0; transform: translateY(16px); filter: blur(3px); }
  to { opacity: 1; transform: translateY(0); filter: blur(0); }
}

@media (prefers-reduced-motion: reduce) {
  .onboard-slide { animation: none; }
  .admin-app-row { transition: none; }
  .notifications-panel { transition: none; }
  .profile-modal, .edit-profile-modal { animation: none; }
}

.onboard-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: left;
  margin: 0 0 20px;
}

.onboard-input {
  display: block;
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 13px 15px;
  border: 1px solid var(--card-border);
  border-radius: 14px;
  background: #ffffff;
  color: var(--text);
  resize: vertical;
  margin-bottom: 14px;
}

.onboard-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.1);
}

.onboard-input-center {
  text-align: center;
  font-size: 1.1rem;
  font-weight: 700;
}

.onboard-cta {
  border-radius: 999px;
}

#onboard-slide-details label {
  display: block;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.onboard-optional-label {
  font-weight: 400;
  text-transform: none;
}

.onboard-char-count {
  text-align: right;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: -8px 0 14px;
}

.onboard-icon-upload-row {
  margin-bottom: 14px;
}

.onboard-icon-upload {
  display: flex;
  align-items: center;
  gap: 14px;
}

.onboard-icon-preview {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  overflow: hidden;
}

.onboard-icon-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Full-width option cards — icon left, bold title, a circle on the right
   that fills in black with a check once selected. Selected = black border. */
.onboard-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin: 4px 0 18px;
}

.onboard-option-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 14px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--card-border);
  background: #ffffff;
  color: var(--text);
  font-family: inherit;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.1s;
}

.onboard-option-card:active {
  transform: scale(0.98);
}

.onboard-option-card.selected {
  border-color: #0a0a0a;
}

.onboard-option-card-icon {
  flex: 0 0 auto;
  font-size: 1.3rem;
  line-height: 1;
  width: 28px;
  text-align: center;
}

.onboard-option-card-title {
  flex: 1;
  min-width: 0;
  font-size: 0.95rem;
  font-weight: 700;
}

.onboard-option-card-check {
  flex: 0 0 auto;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--card-border);
  position: relative;
}

.onboard-option-card.selected .onboard-option-card-check {
  background: #0a0a0a;
  border-color: #0a0a0a;
}

.onboard-option-card.selected .onboard-option-card-check::after {
  content: "";
  position: absolute;
  top: 45%;
  left: 50%;
  width: 5px;
  height: 9px;
  border: solid #ffffff;
  border-width: 0 2px 2px 0;
  transform: translate(-50%, -60%) rotate(45deg);
}

.onboard-skip-btn {
  display: block;
  width: 100%;
  text-align: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  padding: 4px 0 0;
}

.onboard-skip-btn:hover {
  color: var(--text);
}

.onboard-skip-btn[hidden] {
  display: none;
}

/* Sticky bottom CTA — one full-width black button, grey + disabled until
   the step is answered, with a tiny hint line underneath. */
.onboard-sticky-footer {
  flex: 0 0 auto;
  padding: 10px 24px 20px;
  background: linear-gradient(to top, #faf9f5 60%, rgba(250, 249, 245, 0));
}

.onboard-step-cta[hidden] {
  display: none;
}

.onboard-step-cta:disabled {
  background: var(--bg-elevated-2);
  color: var(--placeholder);
  cursor: not-allowed;
  transform: none;
}

.onboard-cta-hint {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 10px 0 0;
}

.onboard-cta-hint[hidden] {
  display: none;
}

.onboard-preview-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 20px;
}

.onboard-preview-icon {
  flex: 0 0 56px;
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  overflow: hidden;
}

.onboard-preview-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.onboard-preview-info {
  flex: 1;
  min-width: 0;
}

.onboard-preview-name {
  font-weight: 800;
  font-size: 1rem;
  margin-bottom: 2px;
}

.onboard-preview-tier {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.onboard-preview-desc {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.onboard-preview-votes {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-weight: 800;
  color: var(--text-muted);
}

/* Final screen: crown Ranky + a big check + the answers summary card */
.onboard-success-heading {
  text-align: center;
}

.onboard-success-check {
  width: 56px;
  height: 56px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: #0a0a0a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.onboard-success-check svg {
  width: 28px;
  height: 28px;
}

.onboard-success-heading h2 {
  text-align: center;
}

.onboard-success-heading .onboard-subtitle {
  text-align: center;
}

.onboard-summary-card {
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 6px 16px;
  margin: 4px 0 20px;
}

.onboard-summary-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 0;
}

.onboard-summary-row + .onboard-summary-row {
  border-top: 1px solid var(--card-border);
}

.onboard-summary-icon {
  flex: 0 0 auto;
  color: var(--text-muted);
}

.onboard-summary-label {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.onboard-summary-value {
  flex: 0 0 auto;
  font-size: 0.9rem;
  font-weight: 700;
  max-width: 55%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Share modal */
.share-modal {
  max-width: 400px;
  text-align: center;
}

/* Badge modal */
.badge-modal {
  max-width: 420px;
  text-align: center;
}

.badge-modal-subtitle {
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: -4px 0 16px;
}

.badge-preview-wrap {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 54px;
  margin-bottom: 18px;
  padding: 20px;
  border-radius: 12px;
  background: var(--bg-elevated);
}

.badge-preview-img {
  display: block;
  width: 230px;
  height: 54px;
}

.badge-code-label {
  display: block;
  text-align: left;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 6px;
}

.badge-embed-code {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.8rem;
  padding: 11px 13px;
  border: 1px solid var(--card-border);
  border-radius: 10px;
  resize: vertical;
  background: var(--bg-elevated);
  color: var(--text);
  margin-bottom: 16px;
  box-sizing: border-box;
}

.badge-embed-code:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(10, 10, 10, 0.1);
}

/* Month-end recap */
.month-recap-modal {
  max-width: 440px;
  text-align: center;
  overflow: hidden;
  position: relative;
}

.month-recap-confetti {
  position: absolute;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
}

.confetti-piece {
  position: absolute;
  top: -14px;
  width: 8px;
  height: 14px;
  border-radius: 2px;
  animation: confettiFall 1.8s ease-in forwards;
}

@keyframes confettiFall {
  from { transform: translateY(0) rotate(0deg); opacity: 1; }
  to { transform: translateY(340px) rotate(360deg); opacity: 0; }
}

.month-recap-title {
  font-size: 1.3rem;
  font-weight: 800;
  margin: 4px 0 22px;
}

.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.podium-place {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  border-radius: 12px 12px 4px 4px;
  padding: 14px 8px 12px;
  animation: podiumPop 0.5s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

@keyframes podiumPop {
  from { opacity: 0; transform: translateY(20px) scale(0.85); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.podium-place.place-1 {
  order: 2;
  padding-top: 22px;
  border-color: var(--accent-color);
}

.podium-place.place-2 { order: 1; }
.podium-place.place-3 { order: 3; }

.podium-medal {
  font-size: 1.7rem;
  line-height: 1;
}

.podium-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  margin: 8px 0 6px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  overflow: hidden;
}

.podium-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.podium-name {
  font-weight: 700;
  font-size: 0.85rem;
  text-align: center;
  word-break: break-word;
}

.podium-maker {
  font-size: 0.7rem;
  color: var(--text-muted);
  margin-top: 2px;
}

.podium-votes {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--accent-2);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 3px;
}

.month-recap-mine {
  font-size: 0.88rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 18px;
}

.confirm-modal {
  max-width: 360px;
  text-align: center;
}

.confirm-modal h2 {
  margin-bottom: 10px;
}

.confirm-text {
  color: var(--text-muted);
  font-size: 0.92rem;
  margin: 0 0 24px;
}

.confirm-actions {
  display: flex;
  gap: 10px;
}

.confirm-actions .btn {
  flex: 1;
}

.share-format-toggle {
  display: flex;
  justify-content: center;
  margin: 4px auto 16px;
}

.share-canvas-wrap {
  border-radius: 16px;
  overflow: hidden;
  margin: 4px 0 20px;
  border: 1px solid var(--card-border);
  max-height: 60vh;
  display: flex;
  justify-content: center;
}

#share-canvas {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  width: auto;
  height: auto;
}

.share-actions {
  display: flex;
  gap: 10px;
}

.share-actions .btn {
  flex: 1;
}

/* Past Champions page */
.champion-card {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s;
}

.champion-card:hover {
  border-color: var(--border-strong);
  transform: translateY(-2px);
}

.champion-week {
  flex: 0 0 auto;
  background: var(--gradient);
  color: var(--on-accent);
  font-weight: 800;
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

.champion-month-group {
  margin-bottom: 20px;
}

.champion-week-heading {
  font-size: 0.78rem;
  font-weight: 800;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
}

.champion-medal {
  flex: 0 0 auto;
  font-size: 1.6rem;
  line-height: 1;
  width: 32px;
  text-align: center;
}

.champion-icon {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  overflow: hidden;
}

.champion-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.champion-info {
  flex: 1;
  min-width: 0;
}

.champion-app-name {
  font-weight: 700;
  font-size: 1rem;
}

.champion-maker {
  color: var(--text-muted);
  font-size: 0.82rem;
  display: flex;
  align-items: center;
  gap: 4px;
}

.champion-votes {
  flex: 0 0 auto;
  color: var(--accent-2);
  font-weight: 800;
}

.profile-app-row.champion-row {
  cursor: pointer;
  transition: background 0.15s;
}

.profile-app-row.champion-row:hover {
  background: var(--bg-elevated-2);
}

/* Teams */
.team-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: var(--bg-elevated-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}

.team-badge:hover {
  background: #e2e2e5;
}

.team-badge.compact {
  padding: 1px 5px;
  font-size: 0.8rem;
}

.profile-header .team-badge {
  margin: -2px 0 4px;
}

.team-row {
  cursor: pointer;
}

.team-app-maker {
  color: var(--text-muted);
  font-weight: 400;
  font-size: 0.85em;
}

.team-member-row,
.team-request-row {
  gap: 10px;
}

.team-member-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.link-btn {
  background: none;
  border: none;
  color: var(--danger);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  padding: 0;
}

.link-btn:hover {
  text-decoration: underline;
}

.btn.btn-small {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.invite-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  padding: 14px 18px;
  margin-bottom: 16px;
  font-size: 0.9rem;
}

/* First-visit welcome screen — soft off-white with a warm gold glow from the
   top, same palette as the onboarding flow it leads into. */
.welcome-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background:
    radial-gradient(ellipse 640px 420px at 50% -8%, rgba(245, 196, 0, 0.16), transparent 70%),
    #faf9f5;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.welcome-screen[hidden] {
  display: none;
}

.welcome-content {
  max-width: 380px;
  width: 100%;
  text-align: center;
}

.welcome-pill {
  display: inline-block;
  background: rgba(245, 196, 0, 0.16);
  color: var(--gold-text);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 18px;
}

.welcome-heading {
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 32px;
}

.welcome-preview-wrap {
  position: relative;
  margin: 0 0 36px;
  padding: 16px 0;
}

.welcome-preview-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #ffffff;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 16px 32px -12px rgba(10, 10, 10, 0.18);
  transform: rotate(-3.5deg);
  text-align: left;
}

.welcome-preview-rank {
  flex: 0 0 auto;
  font-size: 1.3rem;
  font-weight: 800;
  color: var(--gold-text);
}

.welcome-preview-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #0a0a0a;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
}

.welcome-preview-info {
  flex: 1;
  min-width: 0;
}

.welcome-preview-name {
  font-weight: 800;
  font-size: 0.95rem;
}

.welcome-preview-likes {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 2px 0 6px;
}

.welcome-preview-progress-track {
  height: 5px;
  border-radius: 999px;
  background: var(--bg-elevated-2);
  overflow: hidden;
}

.welcome-preview-progress-fill {
  width: 55%;
  height: 100%;
  background: var(--gold);
  border-radius: 999px;
}

.welcome-preview-progress-label {
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.welcome-founder-tag {
  position: absolute;
  top: -2px;
  right: 6%;
  background: #0a0a0a;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  transform: rotate(5deg);
  box-shadow: 0 8px 16px -6px rgba(10, 10, 10, 0.3);
}

.welcome-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.welcome-actions .btn {
  width: 100%;
}

/* Moderation (admin) page */
.admin-app-row {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
  overflow: hidden;
  max-height: 400px;
  opacity: 1;
  transform: scale(1);
  transition: opacity 0.22s ease, transform 0.22s ease, max-height 0.25s ease 0.05s, margin 0.25s ease 0.05s, padding 0.25s ease 0.05s;
}

.admin-app-row.admin-row-removing {
  opacity: 0;
  transform: scale(0.97);
  max-height: 0;
  margin-bottom: 0;
  padding-top: 0;
  padding-bottom: 0;
  border-width: 0;
}

.admin-history-section {
  margin-top: 4px;
}

.admin-history-summary {
  cursor: pointer;
  list-style: none;
}

.admin-history-summary::-webkit-details-marker {
  display: none;
}

.admin-history-row {
  opacity: 0.85;
}

.admin-avatar-compare {
  display: flex;
  gap: 10px;
  flex: none;
}

.avatar-compare-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.admin-avatar-compare-label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.admin-user-manage-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 10px;
}

.admin-user-search-row .onboard-input {
  margin-bottom: 0;
}

#admin-user-search-result {
  margin-top: 10px;
}

#admin-user-search-result .admin-app-row {
  margin-bottom: 8px;
}

.admin-app-icon {
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  overflow: hidden;
}

.admin-app-icon img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.admin-app-info {
  flex: 1;
  min-width: 0;
}

.admin-app-name {
  font-weight: 700;
  font-size: 0.95rem;
}

.admin-app-meta {
  color: var(--text-muted);
  font-size: 0.78rem;
  margin-top: 2px;
}

.admin-app-desc {
  margin: 6px 0 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.admin-app-actions {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-app-actions .btn {
  white-space: nowrap;
  text-align: center;
}

/* Bottom tab bar — mobile only (see the max-width: 767px media query below) */
.bottom-nav {
  display: none;
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  height: calc(80px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: var(--accent);
  align-items: center;
  justify-content: space-around;
  padding: 0 6px env(safe-area-inset-bottom);
}

.bottom-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 48px;
  min-height: 48px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.6);
  padding: 6px 4px;
  cursor: pointer;
  transition: color 0.15s;
}

.bottom-nav-item.active {
  color: #ffffff;
}

#bottom-nav-profile {
  position: relative;
}

.bottom-nav-notif-dot {
  position: absolute;
  top: 2px;
  right: 18px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent-color);
  border: 2px solid #0a0a0a;
}

.bottom-nav-notif-dot[hidden] {
  display: none;
}

.bottom-nav-submit {
  flex: 0 0 auto;
  width: 64px;
  height: 64px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  background: #ffffff;
  color: #0a0a0a;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transform: translateY(-18px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
  transition: transform 0.15s;
}

.bottom-nav-submit:active {
  transform: translateY(-18px) scale(0.92);
}

.mobile-notif-btn {
  display: none;
}

@media (max-width: 767px) {
  .header-actions {
    display: none;
  }

  /* Compact App-Store-chart-row leaderboard cards: rank number, 48px icon,
     a 3-line text block, like button — around 88px tall. Desktop keeps the
     existing roomier card (avatar row, tag pills, tier-progress line)
     untouched; only this breakpoint swaps to the compact version. */
  .app-card {
    padding: 10px 12px;
    gap: 10px;
  }

  .rank {
    flex-basis: 24px;
    font-size: 1.1rem;
  }

  .app-icon-link {
    flex-basis: 48px;
    width: 48px;
    height: 48px;
  }

  .app-icon {
    border-radius: 11px;
  }

  .app-name-row {
    display: flex;
    align-items: center;
    gap: 5px;
  }

  .app-name {
    font-size: 0.95rem;
  }

  .card-name-tier-badge {
    display: inline-flex;
    flex: none;
  }

  .app-description {
    margin-top: 2px;
    font-size: 0.82rem;
    -webkit-line-clamp: 1;
  }

  /* The roomier desktop identity row (avatar + tier icon + name + badges)
     and the separate tag pills both give way to the one compact meta line
     below. */
  .app-card .maker-link,
  .app-card .tier-progress-tag,
  .app-card .build-time-tag,
  .app-card .built-with-tags-mount {
    display: none;
  }

  .app-card-mobile-meta {
    display: flex;
    align-items: center;
    margin: 2px 0 0;
    font-size: 0.74rem;
    color: var(--text-muted);
  }

  /* The username (plus its founder/team badges) never truncates — it's the
     trailing tool/build-time text that gives way first if space is tight. */
  .mobile-meta-identity {
    flex: none;
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
  }

  .mobile-meta-identity .founder-badge,
  .mobile-meta-identity .team-badge {
    flex: none;
  }

  .mobile-meta-extra {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Tool filter chips: one scrolling row instead of wrapping to 3, with a
     fade hinting there's more to scroll to on the right. */
  .search-filter-chips {
    flex-wrap: nowrap;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    padding-right: 24px;
    mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
    -webkit-mask-image: linear-gradient(to right, black calc(100% - 28px), transparent 100%);
  }

  .search-filter-chips::-webkit-scrollbar {
    display: none;
  }

  .search-filter-chip {
    flex: none;
  }

  .mobile-notif-btn {
    display: flex;
    position: fixed;
    top: calc(16px + var(--config-banner-h, 0px));
    right: 16px;
    z-index: 30;
  }

  .mobile-notif-btn[hidden] {
    display: none;
  }

  .notifications-panel {
    left: 0;
    right: 0;
    top: 0;
    width: 100%;
    max-width: 100%;
    max-height: 80vh;
    border-radius: 0 0 18px 18px;
    border-top: none;
    transform: translateY(-100%);
    transition: transform 0.22s ease;
  }

  .notifications-panel.panel-open {
    transform: translateY(0);
  }

  /* Profile: full-screen sheet sliding up, not a small centered popup. */
  #profile-overlay,
  #edit-profile-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .profile-modal,
  .edit-profile-modal {
    width: 100%;
    max-width: 100%;
    height: 92vh;
    max-height: 92vh;
    border-radius: 20px 20px 0 0;
    padding-top: 22px;
    animation: profileSheetUp 0.28s cubic-bezier(0.2, 0.8, 0.2, 1) both;
    overflow-y: auto;
  }

  @keyframes profileSheetUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
  }

  /* Tighter section spacing on mobile, where every pixel of a full-screen
     profile sheet counts more than it does in a wide centered desktop modal. */
  .profile-section-title {
    margin: 16px 0 8px;
  }

  /* 1D/1W/1M/1Y/All chart-range buttons — at least a 36px tap target. */
  .history-range-btn {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  /* Like History chart: shorter, with less empty space above it. */
  .history-chart-wrap {
    margin-top: 6px;
  }

  .history-svg {
    height: 160px;
  }

  .rank-chart-canvas-wrap {
    height: 160px;
  }

  .profile-drag-handle {
    display: block;
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 5px;
    border-radius: 999px;
    background: var(--border-strong);
    border: none;
    padding: 0;
    cursor: pointer;
  }

  .search-bar-wrap {
    position: sticky;
    top: 0;
    z-index: 15;
    background: var(--bg);
    padding: 8px 0;
    margin: 0 0 8px;
  }

  /* The bottom nav's Profile tab already opens this (or Log In / Sign Up
     when logged out) — the top-left account bar would just be a redundant
     second way to get there. The admin button that lived here moves into
     the profile page itself (see the "Admin" row in openProfile()). */
  .account-bar {
    display: none;
  }

  .bottom-nav {
    display: flex;
  }

  body {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 480px) {
  .welcome-tagline {
    font-size: 0.95rem;
    white-space: nowrap;
  }
  .champion-promo-line {
    font-size: 0.72rem;
    white-space: nowrap;
  }
  .detail-top {
    flex-direction: column;
    align-items: center;
    text-align: center;
  }
  .detail-meta-row {
    justify-content: center;
    text-align: center;
  }
  .site-header {
    padding-top: 64px;
  }
  .board-controls {
    justify-content: center;
  }
  .comment-reply {
    margin-left: 10px;
    padding-left: 10px;
  }
  .detail-vote-row {
    flex-wrap: wrap;
  }
}
