/* Catalog and design view page styles */

/* ── Catalog ──────────────────────────────────────────────────────────────── */

.catalog-body {
  font-family: 'Inter', sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background: #141414;
  color: #d8d8d8;
  min-height: 100vh;
  margin: 0;
}

/* Footer is hidden until all content is loaded (no more lazy pages) */
.catalog-page .landing-footer {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}

.catalog-page .landing-footer.footer-visible {
  opacity: 1;
  pointer-events: auto;
}

.catalog-main {
  padding: 2.5rem 2rem 5rem;
}

.catalog-inner {
  max-width: 900px;
  margin: 0 auto;
}

.catalog-header {
  margin-bottom: 2rem;
}

.catalog-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ebebeb;
  margin: 0 0 0.25rem;
}

.catalog-subtitle {
  font-size: 0.85rem;
  color: #555;
  margin: 0;
}

/* Filters */
.catalog-filters {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group-grow {
  flex: 1;
  min-width: 200px;
}

.filter-group label {
  font-size: 0.72rem;
  color: #444;
  font-weight: 500;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
}

.filter-select,
.filter-input {
  background: #1a1a1a;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  color: #d8d8d8;
  padding: 0.5rem 0.75rem;
  font-family: inherit;
  font-size: 0.85rem;
  transition: border-color 0.15s;
  min-width: 140px;
}

.filter-input {
  width: 100%;
  box-sizing: border-box;
}

.filter-select:focus,
.filter-input:focus {
  outline: none;
  border-color: #c8a96e;
}

/* Loading/empty states */
.catalog-loading {
  grid-column: 1 / -1;
  text-align: center;
  color: #444;
  padding: 3rem 0;
  font-size: 0.875rem;
}

/* Infinite scroll sentinel */
.catalog-sentinel {
  height: 1px;
  margin-top: 0.5rem;
}

/* End of catalog CTA */
.catalog-end-cta {
  text-align: center;
  padding: 4rem 1.5rem 4rem;
  margin-top: 1.5rem;
}

.catalog-end-ornament {
  width: 160px;
  height: 1px;
  background: linear-gradient(to right, transparent, #3d3428 30%, #3d3428 70%, transparent);
  margin: 0 auto 2.25rem;
}

.catalog-end-cta-heading {
  font-size: 0.95rem;
  font-weight: 500;
  color: #5a5248;
  margin: 0 0 1.75rem;
  letter-spacing: 0.01em;
}

.catalog-end-cta-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.55rem 1.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-family: inherit;
  background: transparent;
  border: 1px solid rgba(200, 169, 110, 0.2);
  color: #a08855;
  border-radius: 4px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.catalog-end-cta-btn:hover {
  background: rgba(200, 169, 110, 0.05);
  border-color: rgba(200, 169, 110, 0.4);
  color: #c8a96e;
}

.catalog-end-discord {
  margin-top: 1.25rem;
  font-size: 0.8rem;
  color: #3e3a35;
}

.catalog-end-discord a {
  color: #5a5248;
  text-decoration: none;
  transition: color 0.15s;
}

.catalog-end-discord a:hover {
  color: #c8a96e;
}


/* Inline upvote button on design cards */
.card-upvote-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  padding: 0.1rem 0.25rem;
  border-radius: 3px;
  color: #555;
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  transition: color 0.15s;
  margin: 0;
  line-height: 1;
}

.card-upvote-btn:hover { color: #888; }
.card-upvote-btn.is-upvoted { color: #c8a96e; }
.card-upvote-btn:disabled { cursor: default; opacity: 0.5; }

/* Pagination */
.catalog-pagination {
  display: flex;
  justify-content: center;
  gap: 0.4rem;
  margin-top: 2rem;
  flex-wrap: wrap;
}

.catalog-page-btn {
  padding: 0.4rem 0.8rem;
  background: #141414;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  color: #555;
  font-family: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.catalog-page-btn:hover,
.catalog-page-btn.active {
  border-color: #c8a96e;
  color: #c8a96e;
}

/* ── Design view ──────────────────────────────────────────────────────────── */

.design-body {
  font-family: 'Inter', sans-serif;
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  background: #141414;
  color: #d8d8d8;
  min-height: 100vh;
  margin: 0;
}

.design-main {
  width: 100%;
  padding: 2.5rem 2rem 5rem;
  max-width: 860px;
  margin: 0 auto;
}

.design-loading,
.design-error {
  text-align: center;
  padding: 4rem 0;
  color: #444;
  font-size: 0.875rem;
}

/* Design header */
.design-view-header {
  margin-bottom: 2rem;
}

/* Author line + actions on the same row */
.design-view-author-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.design-view-author-row .design-view-author {
  flex: 1;
  min-width: 0;
}

/* Post author avatar (header) */
.design-view-author-avatar-link {
  flex-shrink: 0;
  text-decoration: none;
  display: block;
}

.design-view-author-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid #3a2e1e;
}

.design-view-author-avatar-letter {
  background: #2a2318;
  border: 1px solid #3a2e1e;
  color: #c8a96e;
  font-size: 0.8rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

.design-view-author-row .design-view-actions {
  margin-left: auto;
  flex-shrink: 0;
}

.design-view-type-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.design-view-featured {
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #d4900a;
  background: rgba(210, 140, 40, 0.1);
  border: 1px solid rgba(210, 140, 40, 0.25);
  border-radius: 3px;
  padding: 0.15rem 0.45rem;
}

.design-view-title {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ebebeb;
  margin: 0 0 0.4rem;
  line-height: 1.2;
}

.design-card-type {
  font-size: 0.6rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.type-template {
  background: rgba(200, 169, 110, 0.08);
  color: #c8a96e;
}

.type-guide {
  background: rgba(100, 150, 200, 0.08);
  color: #7aabda;
}

.type-question {
  background: rgba(150, 120, 200, 0.08);
  color: #a88fd4;
}

.type-challenge {
  background: rgba(210, 140, 40, 0.1);
  color: #d4900a;
}

.design-view-author {
  font-size: 0.82rem;
  color: #444;
  margin: 0;
}

.design-card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.5rem;
}

.design-card-tag {
  font-size: 0.62rem;
  background: transparent;
  color: #666;
  border: 1px solid #2a2a2a;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
  cursor: pointer;
}

a.design-card-tag:hover {
  color: #c8a96e;
  border-color: rgba(200, 169, 110, 0.3);
}

.design-card-tag[data-tag="challenge"]     { color: #e8c060; border-color: rgba(232, 192, 96,  0.4);  }
.design-card-tag[data-tag="showcase"]      { color: #6bbf8a; border-color: rgba(107, 191, 138, 0.35); }
.design-card-tag[data-tag="rate my build"] { color: #6699cc; border-color: rgba(102, 153, 204, 0.35); }
.design-card-tag[data-tag="help wanted"]   { color: #cc7060; border-color: rgba(204, 112, 96,  0.35); }
.design-card-tag[data-tag="meta"]          { color: #9977bb; border-color: rgba(153, 119, 187, 0.35); }

/* Active tag filter row */
.catalog-active-tag {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.active-tag-label {
  font-size: 0.72rem;
  color: #444;
  font-weight: 500;
}

.active-tag-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: rgba(200, 169, 110, 0.08);
  border: 1px solid rgba(200, 169, 110, 0.25);
  border-radius: 3px;
  color: #c8a96e;
  font-family: inherit;
  font-size: 0.72rem;
  padding: 0.2rem 0.5rem;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.active-tag-chip:hover {
  background: rgba(200, 169, 110, 0.14);
  border-color: rgba(200, 169, 110, 0.4);
}

.active-tag-remove {
  font-size: 0.85rem;
  line-height: 1;
  opacity: 0.7;
}

.design-view-author a {
  color: #666;
  text-decoration: none;
  transition: color 0.15s;
}

.design-view-author a:hover {
  color: #c8a96e;
}

/* Actions */
.design-view-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-shrink: 0;
  flex-wrap: wrap;
}

.upvote-btn {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  background: #1a1a1a;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  color: #666;
  font-family: inherit;
  font-size: 0.825rem;
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s;
}

.upvote-btn:hover,
.upvote-btn.upvoted {
  border-color: #c8a96e;
  color: #c8a96e;
}

.btn-load-designer {
  display: inline-flex;
  align-items: center;
  padding: 0.45rem 1rem;
  background: #c8a96e;
  color: #141414;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  text-decoration: none;
}

.btn-load-designer:hover {
  opacity: 0.88;
}

.comment-preview-load-btn {
  margin-top: 0.75rem;
}

/* Description */
.design-description {
  background: #161616;
  border: 1px solid #242424;
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
  font-size: 0.9rem;
  line-height: 1.75;
  color: #b0b0b0;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Design sections */
.design-section {
  margin-bottom: 1.5rem;
}

.design-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #555;
  margin: 0 0 1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #181818;
}

/* Template viewer cards */
.design-template-card {
  background: #181818;
  border: 1px solid #2a2a2a;
  border-top: 2px solid #2e2e2e;
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 0.75rem;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.45);
}

.design-template-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 1.1rem;
  background: #141414;
  border-bottom: 1px solid #242424;
}

/* Production cost — pill tag below the grid */
.dt-pill-row {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.5rem;
  width: 100%;
}

.dt-production-cost {
  flex: 1;
  padding: 0.3rem 0.7rem;
  font-size: 11px;
  color: #5a5248;
  background: #141414;
  border-radius: 4px;
  white-space: nowrap;
  text-align: center;
}

.dt-prod-cost-value {
  font-family: 'Roboto Mono', 'Courier New', monospace;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: #b8b8b8;
}

.design-template-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  opacity: 0.85;
}

.design-template-name {
  font-weight: 600;
  color: #c8c8c8;
  font-size: 0.85rem;
  letter-spacing: -0.01em;
}

.dt-header-badges {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
}

.dt-header-badge {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 3px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.dt-header-badge-research {
  background: rgba(80, 120, 160, 0.15);
  border: 1px solid rgba(80, 120, 160, 0.3);
  color: #7aaac8;
}

.dt-header-badge-doctrine {
  background: rgba(200, 169, 110, 0.1);
  border: 1px solid rgba(200, 169, 110, 0.25);
  color: #c8a96e;
}

.dt-header-load-link {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.18rem 0.5rem;
  border-radius: 3px;
  white-space: nowrap;
  background: rgba(200, 169, 110, 0.1);
  border: 1px solid rgba(200, 169, 110, 0.25);
  color: #c8a96e;
  text-decoration: none;
  letter-spacing: 0.02em;
}

.dt-header-load-link:hover {
  background: rgba(200, 169, 110, 0.2);
  color: #d9be8a;
}

/* Body: grid on the left, stats panel on the right */
.design-template-body {
  display: flex;
  gap: 1rem;
  align-items: stretch;
  padding: 1rem 1.1rem;
}

/* Visual grid — flat 7-col layout so support rows align with combat rows */
.design-template-grid {
  display: grid;
  grid-template-columns: 1fr 6px repeat(5, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 2px;
  flex: 0 0 auto;
  width: 340px;
}

.dt-divider {
  grid-column: 2;
  grid-row: 1 / -1;
}

.dt-slot {
  aspect-ratio: 1;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  background: #111;
  border: 1px solid #1e1e1e;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.dt-slot-filled {
  background: #1a1f1e;
  border-color: #272e2c;
}

.dt-slot-lock {
  font-size: 10px;
  opacity: 0.2;
  line-height: 1;
  user-select: none;
}

.dt-slot img {
  width: 75%;
  height: 75%;
  object-fit: contain;
  display: block;
}

/* Stats panel */
.design-template-stats {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  padding-top: 2px;
}

.dt-stats-loading {
  font-size: 0.75rem;
  color: #5a5248;
}

.dt-stats-columns {
  display: flex;
  gap: 0;
}

.dt-stats-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.22rem;
  padding-right: 0.75rem;
}

.dt-stats-col:last-child {
  padding-right: 0;
}

.dt-stats-col-title {
  font-size: 0.65rem;
  font-weight: 700;
  color: #4a4540;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.3rem;
}

.dt-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.3rem;
}

.dt-stat-label {
  font-size: 0.7rem;
  color: #5a5248;
  white-space: nowrap;
}

.dt-stat-value {
  font-family: 'Roboto Mono', 'Courier New', monospace;
  font-size: 0.75rem;
  font-weight: 600;
  color: #c0bab5;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* Loading placeholder / N/A stat — shimmer while fetch is in flight */
.dt-val-loading {
  color: transparent;
  user-select: none;
  position: relative;
  border-radius: 2px;
}

.dt-val-loading::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(180, 160, 120, 0.18) 50%,
    transparent 100%
  );
  background-size: 200% 100%;
  animation: dt-val-shimmer 1.5s ease-in-out infinite;
  border-radius: 2px;
}

@keyframes dt-val-shimmer {
  0%   { background-position: -200% 0; }
  100% { background-position:  200% 0; }
}

/* Full-width terrain footer */
.design-template-terrain {
  background: #141414;
  border-top: 1px solid #222;
  padding: 0.65rem 1.1rem 0.75rem;
}

/* Terrain panel inside the footer */
.dt-terrain-panel {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
}

.dt-terrain-grid {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  row-gap: 0.75rem;
  margin-top: 0.5rem;
}

.dt-terrain-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
}

/* Icon + badge overlay container */
.dt-terrain-icon-wrap {
  position: relative;
  width: 26px;
  height: 26px;
}

.dt-terrain-icon {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #2a2a2a;
  display: block;
}

/* 3 pill badges sitting just below the icon, centred */
.dt-terrain-badges {
  position: absolute;
  bottom: -7px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 1px;
  white-space: nowrap;
}

.dt-badge {
  height: 10px;
  padding: 0 2px;
  border-radius: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 6.5px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  line-height: 1;
  letter-spacing: 0.01em;
  border: 1px solid rgba(0, 0, 0, 0.4);
  cursor: default;
}

.dt-badge-pos     { background: #2a5a2a; color: #7ec87e; }
.dt-badge-neg     { background: #5a2020; color: #c87e7e; }
.dt-badge-neutral { background: #1a1a1a; color: #383838; border-color: #252525; }

.dt-terrain-card-neutral .dt-terrain-icon {
  opacity: 0.35;
}

.dt-terrain-card-neutral .dt-terrain-name {
  color: #2e2e2e;
}

.dt-terrain-name {
  font-size: 0.52rem;
  color: #4a4540;
  text-align: center;
  white-space: nowrap;
  margin-top: 6px; /* clears the overflowing badges */
}

/* Research / doctrine containers */
.design-research,
.design-doctrine {
  background: #1a1a1a;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 1.1rem 1.25rem;
}

/* ── Research path ─────────────────────────────────────────────────────────── */

.path-groups {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.path-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.path-group-label {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #444;
}

.path-tiles {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.path-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.3rem;
  width: 68px;
  padding: 0.5rem 0.3rem 0.4rem;
  background: #111;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  transition: border-color 0.15s, background 0.15s;
  cursor: default;
}

.path-tile:hover {
  background: #161616;
  border-color: #2a2a2a;
}

.path-tile img {
  width: 34px;
  height: 34px;
  object-fit: contain;
}

.path-tile-name {
  font-size: 0.58rem;
  color: #666;
  text-align: center;
  line-height: 1.3;
  word-break: break-word;
  hyphens: auto;
}

/* ── Doctrine path ─────────────────────────────────────────────────────────── */

.doctrine-section {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.doctrine-grand {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1rem;
  background: #111;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
}

.doctrine-grand-img {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex-shrink: 0;
}

.doctrine-grand-info {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.doctrine-grand-name {
  font-size: 1rem;
  font-weight: 600;
  color: #d0d0d0;
  letter-spacing: -0.01em;
}

.doctrine-grand-desc {
  font-size: 0.78rem;
  color: #555;
  line-height: 1.5;
}

.doctrine-subs-label {
  font-size: 0.67rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: #444;
}

.doctrine-sub-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.doctrine-sub-chip {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.3rem 0.65rem 0.3rem 0.4rem;
  background: #111;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  font-size: 0.78rem;
  color: #888;
  transition: border-color 0.15s;
  cursor: default;
}

.doctrine-sub-chip:hover {
  border-color: #2a2a2a;
}

.doctrine-sub-chip img {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
}

/* Comments */
.comments-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 1.25rem;
  background: #181818;
  border: 1px solid #181818;
  border-radius: 6px;
  overflow: hidden;
}

.comment-item {
  background: #141414;
  padding: 1rem 1.25rem;
}

.comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.4rem;
}

.comment-header-left {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.comment-author {
  font-size: 0.82rem;
  font-weight: 600;
  color: #c8a96e;
  text-decoration: none;
}

.comment-date {
  font-size: 0.72rem;
  color: #333;
}

.comment-op-badge {
  font-size: 0.65rem;
  font-weight: 700;
  color: #c8a96e;
  border: 1px solid #c8a96e;
  border-radius: 3px;
  padding: 0 4px;
  line-height: 1.4;
  letter-spacing: 0.03em;
}

.comment-upvote-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  background: none;
  border: none;
  padding: 0.2rem 0.4rem;
  border-radius: 3px;
  color: #333;
  font-family: inherit;
  font-size: 0.72rem;
  cursor: pointer;
  transition: color 0.15s;
  flex-shrink: 0;
}

.comment-upvote-btn:hover { color: #666; }
.comment-upvote-btn.upvoted { color: #c8a96e; }

.comment-content {
  font-size: 0.85rem;
  color: #888;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-design-link {
  color: #c8a96e;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 500;
  border-bottom: 1px solid rgba(200, 169, 110, 0.3);
  transition: border-color 0.15s, color 0.15s;
}

.comment-design-link:hover {
  color: #d9be87;
  border-bottom-color: rgba(200, 169, 110, 0.7);
}

.comment-designer-link {
  color: #8eb8d4;
  border-bottom-color: rgba(142, 184, 212, 0.3);
}

.comment-designer-link:hover {
  color: #aacde6;
  border-bottom-color: rgba(142, 184, 212, 0.7);
}

.comment-design-link-active {
  color: #d9be87;
  border-bottom-color: rgba(200, 169, 110, 0.7);
  border-bottom-style: solid;
}

/* Inline design card preview below a comment */
.comment-card-preview {
  margin-top: 0.85rem;
  overflow-x: auto;
}

.comment-preview-loading,
.comment-preview-error {
  font-size: 0.75rem;
  color: #444;
  padding: 0.5rem 0;
}

/* Comment avatar + row layout */
.comment-row {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
}

.comment-avatar-link {
  flex-shrink: 0;
  text-decoration: none;
}

.comment-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  border: 1px solid #3a2e1e;
}

.comment-avatar-letter {
  background: #2a2318;
  border: 1px solid #3a2e1e;
  color: #c8a96e;
  font-size: 0.78rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.comment-body {
  flex: 1;
  min-width: 0;
}

/* Edit / Delete action buttons */
.comment-meta-btn {
  background: none;
  border: none;
  padding: 0 0.1rem;
  font-family: inherit;
  font-size: 0.7rem;
  color: #333;
  cursor: pointer;
  transition: color 0.15s;
}

.comment-meta-btn:hover {
  color: #888;
}

.comment-delete-btn:hover {
  color: #c0392b;
}

.comment-actions {
  margin-top: 0.35rem;
}

.comment-reply-btn:hover {
  color: #c8a96e;
}

/* Inline edit form */
.comment-edit-form {
  margin-top: 0.5rem;
}

.comment-edit-textarea {
  width: 100%;
  background: #1a1a1a;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  color: #a89880;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.65rem;
  resize: vertical;
  box-sizing: border-box;
}

.comment-edit-textarea:focus {
  outline: none;
  border-color: #3a2e1e;
}

.comment-edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.4rem;
}

.comment-save-btn,
.comment-cancel-btn {
  background: none;
  border: 1px solid #2a2218;
  border-radius: 4px;
  padding: 0.25rem 0.7rem;
  font-family: inherit;
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.comment-save-btn {
  color: #c8a96e;
  border-color: #3a2e1e;
}

.comment-save-btn:hover {
  background: #2a2318;
}

.comment-cancel-btn {
  color: #555;
}

.comment-cancel-btn:hover {
  color: #888;
}

/* Comment form */
.comment-form {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
}

.comment-textarea {
  width: 100%;
  box-sizing: border-box;
  background: #1a1a1a;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  color: #d8d8d8;
  padding: 0.6rem 0.75rem;
  font-family: inherit;
  font-size: 0.875rem;
  resize: vertical;
  min-height: 80px;
  transition: border-color 0.15s;
}

.comment-textarea:focus {
  outline: none;
  border-color: #c8a96e;
}

.comment-submit {
  align-self: flex-end;
  padding: 0.5rem 1.25rem;
  background: #c8a96e;
  color: #141414;
  border: none;
  border-radius: 4px;
  font-family: inherit;
  font-size: 0.825rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}

.comment-submit:hover {
  opacity: 0.88;
}

.comment-sign-in-prompt {
  font-size: 0.825rem;
  color: #444;
}

.comment-sign-in-prompt a {
  color: #c8a96e;
  text-decoration: none;
}

/* @mention links in comment content */
.comment-mention {
  color: rgba(52, 148, 124, 0.9);
  text-decoration: none;
  font-weight: 500;
  transition: color 0.12s;
}

.comment-mention:hover {
  color: rgb(52, 148, 124);
  text-decoration: underline;
}

/* @mention autocomplete dropdown */
.comment-input-wrap {
  position: relative;
}

.mention-list {
  position: absolute;
  bottom: calc(100% + 4px);
  left: 0;
  min-width: 180px;
  max-width: 280px;
  background: #1a1a1a;
  border: 1px solid #2a2a2a;
  border-radius: 6px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
  z-index: 100;
  list-style: none;
  margin: 0;
  padding: 0.25rem 0;
  overflow: hidden;
}

.mention-item {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.45rem 0.75rem;
  cursor: pointer;
  font-size: 0.82rem;
  color: #b0a898;
  transition: background 0.1s;
}

.mention-item:hover,
.mention-item.active {
  background: rgba(255, 255, 255, 0.05);
  color: #d8d8d8;
}

.mention-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.mention-avatar-letter {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #252525;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: #c8a96e;
  flex-shrink: 0;
}

.mention-username {
  font-weight: 500;
}

/* ── Profile page ─────────────────────────────────────────────────────────── */

.profile-main {
  width: 100%;
  padding: 2.5rem 2rem 5rem;
  max-width: 1100px;
  margin: 0 auto;
}

.profile-header {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid #181818;
}

.profile-avatar {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  object-fit: cover;
  border: 1px solid #222;
  flex-shrink: 0;
}

.profile-avatar-placeholder {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #1a1a1a;
  border: 1px solid #222;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: #c8a96e;
  flex-shrink: 0;
}

.profile-meta {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.profile-name-row {
  display: flex;
  align-items: center;
  gap: 0.5rem 1rem;
  flex-wrap: wrap;
}

.profile-display-name {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: #ebebeb;
  margin: 0;
  line-height: 1.2;
}

.profile-username {
  font-size: 0.85rem;
  color: #555;
}

.profile-joined {
  font-size: 0.8rem;
  color: #444;
}

/* Medals: upvote count + future special-occasion medals */
.profile-medals {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* Wrapper for ribbon + medal disc */
.medal-wrap {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}

/* Ribbon loop at top (like a real medal) */
.medal-wrap::before {
  content: '';
  position: absolute;
  top: -0.15rem;
  left: 50%;
  transform: translateX(-50%);
  width: 28%;
  height: 22%;
  min-width: 6px;
  min-height: 5px;
  border-radius: 2px 2px 0 0;
  background: linear-gradient(180deg, #d4b96a 0%, #a08040 50%, #8a7035 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 235, 200, 0.4),
    0 1px 1px rgba(0, 0, 0, 0.3);
  z-index: 1;
}

/* Slightly smaller in name row so they don’t overpower the name */
.profile-name-row .medal {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
}

.profile-name-row .medal-wrap::before {
  top: -0.12rem;
  width: 26%;
  height: 20%;
}

.profile-name-row .medal-upvotes .medal-icon {
  margin-top: 0.1rem;
}

.profile-name-row .medal-upvotes .medal-value {
  font-size: 0.6rem;
  margin-top: -0.12rem;
}

.profile-name-row .medal-upvotes.medal-large .medal-value {
  font-size: 0.52rem;
}

/* Medal disc: 3D metallic look with beveled rim and domed face */
.medal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 0;
  width: 2.5rem;
  height: 2.5rem;
  min-width: 2.5rem;
  min-height: 2.5rem;
  border-radius: 50%;
  /* Beveled metallic rim (lighter top-left, darker bottom-right) */
  border: 2px solid #b89850;
  box-shadow:
    inset 2px 2px 2px rgba(255, 235, 200, 0.25),
    inset -1px -1px 2px rgba(60, 45, 20, 0.5),
    inset 0 0 0 1px rgba(0, 0, 0, 0.2),
    0 2px 4px rgba(0, 0, 0, 0.4);
  /* Domed face: darker at bottom and edges */
  background: radial-gradient(
    ellipse 80% 70% at 50% 35%,
    #2a251c 0%,
    #1f1b14 40%,
    #181510 100%
  );
  color: #c8a96e;
}

.medal-upvotes .medal-icon {
  line-height: 0;
  margin-top: 0.12rem;
  opacity: 0.9;
}

.medal-upvotes .medal-value {
  font-size: 0.7rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: 0.02em;
  margin-top: -0.08rem;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.5);
}

/* Large counts: shrink text so 4+ digits fit */
.medal-upvotes.medal-large .medal-value {
  font-size: 0.58rem;
}

/* Site-granted medals (PNG badge images) */
.site-medal-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: default;
}

.site-medal-img {
  width: 4rem;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 1px 2px rgba(0,0,0,0.5));
}

.profile-bio {
  font-size: 0.85rem;
  color: #666;
  line-height: 1.55;
  max-width: 480px;
  margin: 0.25rem 0 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.profile-socials {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-top: 0.4rem;
}

.profile-social-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
  color: #555;
  text-decoration: none;
  transition: color 0.15s;
}

.profile-social-link:hover {
  color: #c8a96e;
}

.profile-social-nolink {
  cursor: default;
}

.profile-social-nolink:hover {
  color: #555;
}

.tier-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.45rem;
  border-radius: 3px;
  width: fit-content;
}

.tier-pro {
  background: rgba(200, 169, 110, 0.15);
  color: #c8a96e;
  border: 1px solid rgba(200, 169, 110, 0.3);
}

.profile-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #555;
  margin: 0 0 1.25rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid #181818;
}


/* Profile tabs */
.profile-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid #181818;
  margin-bottom: 1.75rem;
}

.profile-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #444;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 0.6rem 1.1rem;
  cursor: pointer;
  margin-bottom: -1px;
  transition: color 0.15s, border-color 0.15s;
}

.profile-tab:hover {
  color: #888;
}

.profile-tab.is-active {
  color: #c8a96e;
  border-bottom-color: #c8a96e;
}

/* Profile comment activity list */
.profile-comments-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem 0;
}

.profile-comment-item {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0.9rem 1.1rem;
  background: #161616;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
  transition: box-shadow 0.15s, border-color 0.15s;
}

.profile-comment-item:hover {
  border-color: #2a2a2a;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
}

.profile-comment-design {
  font-size: 0.78rem;
  font-weight: 600;
  color: #c8a96e;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-comment-content {
  font-size: 0.825rem;
  color: #666;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.profile-comment-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.1rem;
}

.profile-comment-date {
  font-size: 0.72rem;
  color: #333;
}

.profile-comment-upvotes {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.72rem;
  color: #c8a96e;
}

/* ── Owner controls ───────────────────────────────────────────────────────── */

.owner-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.owner-btn {
  background: none;
  border: 1px solid #1e1e1e;
  border-radius: 4px;
  color: #444;
  font-family: inherit;
  font-size: 0.78rem;
  padding: 0.3rem 0.65rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.owner-btn:hover {
  color: #888;
  border-color: #2a2a2a;
}

.owner-btn-danger:hover {
  color: #e07070;
  border-color: rgba(180, 60, 60, 0.4);
}

.owner-btn-save {
  background: #c8a96e;
  border-color: #c8a96e;
  color: #141414;
  font-weight: 600;
}

.owner-btn-save:hover {
  opacity: 0.88;
  color: #141414;
  border-color: #c8a96e;
}

.owner-confirm-text {
  font-size: 0.78rem;
  color: #555;
}

.owner-confirm-yes {
  color: #e07070;
  border-color: rgba(180, 60, 60, 0.4);
}

.owner-confirm-yes:hover {
  background: rgba(180, 60, 60, 0.08);
  color: #e07070;
  border-color: rgba(180, 60, 60, 0.5);
}

/* Edit panel */
.design-edit-panel {
  background: #1a1a1a;
  border: 1px solid #1e1e1e;
  border-radius: 6px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.design-edit-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.design-edit-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.design-edit-input,
.design-edit-textarea {
  background: #141414;
  border: 1px solid #222;
  border-radius: 4px;
  color: #d8d8d8;
  font-size: 0.875rem;
  padding: 0.55rem 0.75rem;
  width: 100%;
  box-sizing: border-box;
  font-family: inherit;
  transition: border-color 0.15s;
}

.design-edit-input:focus,
.design-edit-textarea:focus {
  outline: none;
  border-color: #c8a96e;
}

.design-edit-input::placeholder,
.design-edit-textarea::placeholder {
  color: #333;
}

.design-edit-textarea {
  resize: vertical;
  min-height: 90px;
}

.design-edit-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */

/* Stack grid above stats — kicks in at tablet width and below */
@media (max-width: 720px) {
  .design-main {
    padding: 1.5rem 1rem 4rem;
  }

  .design-view-title {
    font-size: 1.3rem;
  }

  .design-template-card {
    padding: 0.85rem 1rem;
  }

  .design-template-body {
    flex-direction: column;
    gap: 1rem;
    padding: 1rem 0rem;
  } 

  .design-template-grid {
    width: 100%;
  }

  .design-template-stats {
    width: 100%;
    padding-top: 0;
  }

  .dt-pill-row {
    margin-top: 0.5rem;
  }
}

/* Small mobile: 2-column stats */
@media (max-width: 400px) {
  .dt-stats-columns {
    flex-wrap: wrap;
  }

  .dt-stats-col {
    flex: 0 0 48%;
    padding-right: 0;
    margin:0 3px
  }

  .dt-stats-col:last-child {
    flex: 0 0 100%;
    margin-top: 0.8rem;
  }

  .dt-terrain-grid {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    row-gap: 0.9rem;
  }

  .dt-terrain-grid .dt-terrain-card {
    width: calc(100% / 6);
    align-items: center;
  }
}

/* ── Comment card preview: narrower context, 2+1 layout sooner ─────────────── */

@media (max-width: 560px) {
  .comment-card-preview .dt-stats-columns {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .comment-card-preview .dt-stats-col {
    min-width: 0;
    padding-right: 6px;
  }

  .comment-card-preview .dt-stats-col:last-child {
    grid-column: 1 / -1;
    padding-right: 0;
    margin-top: 0.8rem;
  }

  .comment-card-preview .dt-stats-col-title {
    font-size: 0.58rem;
  }

  .comment-card-preview .dt-stat-label {
    font-size: 0.62rem;
  }

  .comment-card-preview .dt-stat-value {
    font-size: 0.67rem;
  }
}

/* ── Settings page ─────────────────────────────────────────────────────────── */

.settings-main {
  width: 100%;
  max-width: 680px;
  margin: 0 auto;
  padding: 2.5rem 2rem 5rem;
}

.settings-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 0.8rem;
  color: #555;
  cursor: pointer;
  padding: 0;
  margin-bottom: 1.25rem;
  transition: color 0.15s;
}

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

.settings-back-btn:hover {
  color: #d8d8d8;
}

.settings-page-title {
  font-size: 1.5rem;
  font-weight: 700;
  color: #d8d8d8;
  margin: 0 0 2rem;
}

.settings-section {
  background: #111;
  border: 1px solid #1a1a1a;
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 1.25rem;
}

.settings-section-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0 0 1.25rem;
}

.settings-hint {
  font-size: 0.8rem;
  color: #5a5248;
  margin: -0.5rem 0 1rem;
}

.local-status {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.8rem;
  padding: 0.35rem 0.7rem;
  border-radius: 4px;
  border: 1px solid transparent;
  margin: 0.25rem 0 0;
  min-height: 1.2em;
}
.local-status::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.local-status-checking {
  color: #6b6054;
  background: rgba(255,255,255,0.04);
  border-color: #3a342e;
}
.local-status-checking::before { background: #6b6054; }
.local-status-none {
  color: #7a6e64;
  background: rgba(255,255,255,0.03);
  border-color: #3a342e;
}
.local-status-none::before { background: #4a4440; }
.local-status-ready {
  color: #c8aa6e;
  background: rgba(200,170,110,0.08);
  border-color: rgba(200,170,110,0.25);
}
.local-status-ready::before { background: #c8aa6e; }
.local-status-synced {
  color: #6abf69;
  background: rgba(106,191,105,0.07);
  border-color: rgba(106,191,105,0.2);
}
.local-status-synced::before { background: #6abf69; }

.settings-subsection-title {
  font-size: 0.78rem;
  font-weight: 600;
  color: #555;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 1.25rem 0 0.75rem;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.settings-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

.settings-row .settings-field {
  flex: 1 1 180px;
}

.settings-row-narrow .settings-field {
  flex: 1 1 140px;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.settings-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: #666;
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.settings-label-hint {
  font-weight: 400;
  color: #444;
}

.settings-input {
  background: #181818;
  border: 1px solid #1e1e1e;
  border-radius: 5px;
  color: #c8c0b8;
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.5rem 0.7rem;
  width: 100%;
  box-sizing: border-box;
  transition: border-color 0.15s;
}

.settings-input:focus {
  outline: none;
  border-color: #3a2e1e;
}

.settings-textarea {
  resize: vertical;
  min-height: 72px;
}

.settings-input-prefix-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.settings-input-prefix {
  position: absolute;
  left: 0.7rem;
  font-size: 0.8rem;
  color: #444;
  pointer-events: none;
  user-select: none;
}

.settings-input-prefixed {
  padding-left: 2rem;
}

.settings-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.25rem;
}

.settings-save-btn {
  background: #c8a96e;
  color: #141414;
  border: none;
  border-radius: 5px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.45rem 1.1rem;
  cursor: pointer;
  transition: opacity 0.15s;
}

.settings-save-btn:hover { opacity: 0.88; }
.settings-save-btn:disabled { opacity: 0.5; cursor: default; }

.settings-feedback {
  font-size: 0.8rem;
  color: transparent;
  transition: color 0.15s;
}

.settings-feedback-ok { color: #6abf69; }
.settings-feedback-error { color: #c0392b; }

.settings-danger-zone {
  border-color: #3a1a1a;
}

.settings-danger-zone .settings-section-title {
  color: #c0392b;
}

.settings-delete-btn {
  padding: 0.5rem 1.1rem;
  border-radius: 4px;
  border: 1px solid #c0392b;
  background: transparent;
  color: #c0392b;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.settings-delete-btn:hover {
  background: #c0392b;
  color: #fff;
}

.settings-delete-btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.settings-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

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

.settings-modal {
  background: #1a1a1a;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  padding: 1.75rem;
  max-width: 420px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.settings-modal-title {
  font-size: 1rem;
  font-weight: 600;
  color: #e8e8e8;
  margin: 0;
}

.settings-modal-body {
  font-size: 0.85rem;
  color: #888;
  margin: 0;
  line-height: 1.5;
}

.settings-modal-body strong {
  color: #ccc;
}

.settings-modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.5rem;
}

.settings-modal-cancel {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  border: 1px solid #2e2e2e;
  background: transparent;
  color: #888;
  font-size: 0.82rem;
  cursor: pointer;
}

.settings-modal-cancel:hover { color: #ccc; border-color: #444; }

/* ---- Library sub-tabs ---- */
.library-subtabs { display: flex; border-bottom: 1px solid #1e1e1e; margin-bottom: 1.5rem; }
.library-subtab { background: none; border: none; border-bottom: 2px solid transparent; color: #666; font-size: 0.825rem; font-weight: 500; padding: 0.5rem 1rem; cursor: pointer; transition: color 0.15s, border-color 0.15s; font-family: inherit; margin-bottom: -1px; }
.library-subtab:hover { color: #999; }
.library-subtab.is-active { color: #c8a96e; border-bottom-color: #c8a96e; }

/* ---- Local Data Migration UI ---- */
.local-migration { padding-top: 0.25rem; }
.local-group { margin-bottom: 2rem; }
.local-group-header { display: flex; align-items: center; gap: 0.625rem; margin-bottom: 0.625rem; flex-wrap: wrap; }
.local-select-all { display: flex; align-items: center; gap: 0.5rem; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: #ebebeb; user-select: none; }
.local-select-all input { accent-color: #c8a96e; width: 14px; height: 14px; cursor: pointer; flex-shrink: 0; }
.local-group-count { font-size: 0.75rem; color: #555; background: #161616; border: 1px solid #222; border-radius: 20px; padding: 0.1rem 0.5rem; }
.local-group-badge { font-size: 0.7rem; font-weight: 600; padding: 0.15rem 0.5rem; border-radius: 3px; letter-spacing: 0.02em; }
.local-badge-migratable { background: rgba(200,169,110,0.1); color: #c8a96e; border: 1px solid rgba(200,169,110,0.2); }
.local-badge-local { background: rgba(255,255,255,0.04); color: #444; border: 1px solid #222; }
.local-tmpl-card { cursor: pointer; user-select: none; }
.local-tmpl-card:hover { border-color: #2e2e2e; }
.local-tmpl-card.is-checked { border-color: rgba(200,169,110,0.45); background: rgba(200,169,110,0.04); }
.local-tmpl-card.is-synced { border-color: rgba(106,191,105,0.2); }
.local-synced-badge { font-size: 0.62rem; font-weight: 600; color: #6abf69; background: rgba(106,191,105,0.1); border: 1px solid rgba(106,191,105,0.25); border-radius: 3px; padding: 0.15rem 0.45rem; white-space: nowrap; }
.local-card-select { display: flex; align-items: center; flex-shrink: 0; }
.local-card-select input[type="checkbox"] { width: 16px; height: 16px; accent-color: #c8a96e; cursor: pointer; flex-shrink: 0; }
.local-tmpl-slim .design-card-body { padding: 0.125rem 0; }
.local-type-plain { background: rgba(255,255,255,0.04); color: #555; border: 1px solid #222; font-size: 0.6rem; font-weight: 600; padding: 0.15rem 0.45rem; border-radius: 3px; text-transform: uppercase; letter-spacing: 0.07em; }
.local-slim-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 0.375rem; }
.local-actions { padding-top: 1.25rem; margin-top: 0.5rem; border-top: 1px solid #1a1a1a; display: flex; flex-direction: column; gap: 0.75rem; }
.local-keep-toggle { display: flex; align-items: center; gap: 0.5rem; font-size: 0.8rem; color: #666; cursor: pointer; user-select: none; }
.local-keep-toggle input { accent-color: #c8a96e; cursor: pointer; }
.local-action-btns { display: flex; gap: 0.625rem; flex-wrap: wrap; }
.local-delete-btn { background: transparent; color: #a04040; border: 1px solid rgba(160,64,64,0.3); border-radius: 4px; padding: 0.5rem 1rem; font-size: 0.825rem; font-weight: 600; cursor: pointer; font-family: inherit; transition: background 0.15s, border-color 0.15s; }
.local-delete-btn:hover:not(:disabled) { background: rgba(160,64,64,0.1); border-color: rgba(160,64,64,0.5); }
.local-delete-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ── Settings avatar ───────────────────────────────────────────────────────── */
.settings-avatar-row {
  display: flex;
  align-items: flex-start;
  gap: 1.25rem;
  padding-bottom: 1.25rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid #1a1a1a;
}
.settings-avatar-username {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  padding-top: 0.25rem;
}
.settings-avatar-wrap {
  position: relative;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  overflow: hidden;
  cursor: pointer;
  flex-shrink: 0;
  border: 2px solid #2a2a2a;
  transition: border-color 0.15s;
}
.settings-avatar-wrap:hover { border-color: #c8a96e; }
.settings-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.settings-avatar-initials {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1e1c1a;
  color: #c8a96e;
  font-size: 2rem;
  font-weight: 700;
}
.settings-avatar-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s;
  color: #fff;
}
.settings-avatar-wrap:hover .settings-avatar-overlay { opacity: 1; }
.settings-avatar-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}
.settings-avatar-remove-btn {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: transparent;
  border: none;
  color: #4a4040;
  font-size: 0.68rem;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s;
  letter-spacing: 0.02em;
}
.settings-avatar-remove-btn svg { flex-shrink: 0; opacity: 0.7; }
.settings-avatar-remove-btn:hover:not(:disabled) { color: #b05050; }
.settings-avatar-remove-btn:hover:not(:disabled) svg { opacity: 1; }
.settings-avatar-remove-btn:disabled { opacity: 0.3; cursor: not-allowed; }

/* ── Catalog Publish (template picker + publish form) ─────────────────────── */

.catalog-header-with-action {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.catalog-header-content {
  min-width: 0;
}

.catalog-publish-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-top: 0.2rem;
}

/* Template picker modal sizing */
.cpub-modal {
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.cpub-picker-hint {
  font-size: 0.82rem;
  color: #444;
  margin: 0;
  padding: 0.5rem 1.5rem 0.75rem;
  border-bottom: 1px solid #1a1a1a;
}

.cpub-template-list {
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 120px;
  max-height: 340px;
}

.cpub-loading,
.cpub-empty {
  text-align: center;
  color: #444;
  font-size: 0.85rem;
  padding: 2rem 1.5rem;
  margin: 0;
}

.cpub-template-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  padding: 0.6rem 1.5rem;
  background: none;
  border: none;
  border-bottom: 1px solid #181818;
  color: #c0c0c0;
  font-family: inherit;
  font-size: 0.875rem;
  cursor: pointer;
  text-align: left;
  transition: background 0.12s;
}

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

.cpub-template-item:hover {
  background: #1a1a1a;
}

.cpub-template-icon {
  width: 28px;
  height: 28px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 3px;
}

.cpub-template-icon-empty {
  background: #1e1e1e;
  border: 1px solid #262626;
  border-radius: 3px;
}

.cpub-template-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cpub-template-arrow {
  color: #2e2e2e;
  flex-shrink: 0;
}

.cpub-template-item:hover .cpub-template-arrow {
  color: #555;
}

.cpub-designer-cta {
  padding: 0.85rem 1.5rem;
  border-top: 1px solid #1a1a1a;
}

.cpub-designer-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  width: 100%;
  text-decoration: none;
}

/* Selected template badge in publish form */
.cpub-selected-template {
  padding: 0.75rem 1.5rem 0;
}

.cpub-selected-info {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0.7rem;
  background: #1a1a1a;
  border: 1px solid #222;
  border-radius: 4px;
  max-width: 100%;
}

.cpub-selected-icon {
  width: 20px;
  height: 20px;
  object-fit: contain;
  flex-shrink: 0;
}

.cpub-selected-icon-empty {
  width: 20px;
  height: 20px;
  background: #242424;
  border-radius: 2px;
  flex-shrink: 0;
}

.cpub-selected-name {
  font-size: 0.78rem;
  color: #888;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Back button + title row in publish form header */
.cpub-form-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.cpub-back-btn {
  background: none;
  border: none;
  color: #555;
  cursor: pointer;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
  transition: color 0.12s;
  display: flex;
  align-items: center;
}

.cpub-back-btn:hover {
  color: #d8d8d8;
}
