/* 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;
}

/* Append / infinite-scroll fetch indicator */
.catalog-load-more {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  padding: 1.25rem 0 0.35rem;
  color: #555;
  font-size: 0.8rem;
  letter-spacing: 0.02em;
}

/* Author `display: flex` wins over the UA [hidden] rule - must hide explicitly */
.catalog-load-more[hidden] {
  display: none !important;
}

.catalog-load-more-spinner {
  width: 15px;
  height: 15px;
  border: 2px solid #2a2a2a;
  border-top-color: rgba(200, 169, 110, 0.65);
  border-radius: 50%;
  flex-shrink: 0;
  animation: catalog-load-more-spin 0.65s linear infinite;
}

@keyframes catalog-load-more-spin {
  to {
    transform: rotate(360deg);
  }
}

.catalog-load-more-label {
  color: #444;
}

/* 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;
}

/* Division/template share tank's green (land family). */
.type-template {
  background: rgba(120, 165, 130, 0.12);
  color: #8fbc8f;
}

.type-division {
  background: rgba(120, 165, 130, 0.12);
  color: #8fbc8f;
}

.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;
}

.type-tank {
  background: rgba(120, 165, 130, 0.12);
  color: #8fbc8f;
}

.type-ship {
  background: rgba(110, 145, 175, 0.14);
  color: #8fb0c8;
}

/* Match the Library page's Research / Doctrine tab accent colors. */
.type-research {
  background: rgba(100, 150, 200, 0.14);
  color: #78aadc;
}

.type-doctrine {
  background: rgba(150, 120, 200, 0.14);
  color: #aa8cd2;
}

/* Air designs get a dark-red / maroon accent (matches the air designer) - kept
   away from gold so it doesn't read like the gold/amber invalid hints. */
.type-air {
  background: rgba(150, 66, 66, 0.13);
  color: #cc9090;
}

/* Two-row module strip (top + bottom), aligned with tank designer rows */
.design-card-preview.design-card-preview--tank-modules {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  grid-template-rows: repeat(2, 1fr);
  row-gap: 4px;
  column-gap: 2px;
  margin: 0;
  padding: 0.65rem 0.5rem;
  /* Match division catalog preview (.design-card-preview width in landing.css) */
  width: 280px;
  max-width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(40, 44, 42, 0.35) 0%, rgba(28, 32, 30, 0.45) 100%);
  border-top: 1px solid rgba(120, 165, 130, 0.12);
}

/* Ship: custom row (7 cells) + fixed row (variable per archetype). Total
 * width scales with column count so each cell stays the same physical size
 * as a tank cell (tank = 280px / 6 cols), mirroring the library pattern.
 * Falls back to 100% on narrow viewports. */
.design-card-preview.design-card-preview--ship-modules {
  display: grid;
  grid-template-columns: repeat(var(--ship-preview-cols, 7), 1fr);
  grid-template-rows: repeat(2, 1fr);
  row-gap: 4px;
  column-gap: 2px;
  margin: 0;
  padding: 0.65rem 0.5rem;
  width: calc(280px * var(--ship-preview-cols, 7) / 6);
  max-width: 100%;
  flex-shrink: 0;
  box-sizing: border-box;
  background: linear-gradient(135deg, rgba(40, 50, 60, 0.35) 0%, rgba(28, 36, 44, 0.45) 100%);
  border-top: 1px solid rgba(110, 145, 175, 0.14);
}

/* Air designs reuse the ship module-grid layout but wear the air designer's
   dark-red / maroon theme instead of ship blue. Toned down (less saturated + lower
   alpha than the editor maroon) so the strip reads as a warm neutral hint rather
   than "too red". Shared by the catalog grid and the Library grid. */
.design-card-preview.design-card-preview--air-modules {
  background: linear-gradient(135deg, rgba(46, 37, 37, 0.09) 0%, rgba(36, 29, 29, 0.11) 100%);
  border-top: 1px solid rgba(128, 78, 78, 0.09);
}

@media (max-width: 560px) {
  .design-card-preview.design-card-preview--ship-modules {
    width: 100%;
    padding: 0.65rem 0.75rem;
    row-gap: 5px;
    column-gap: 3px;
  }
}

@media (max-width: 560px) {
  .design-card-preview.design-card-preview--tank-modules {
    width: 100%;
    padding: 0.65rem 0.75rem;
    row-gap: 5px;
    column-gap: 3px;
  }

  .design-card-preview--tank-modules .dc-upgrade-value {
    font-size: 0.65rem;
  }
}

.design-card-preview--tank-modules .dc-tank-cell-spacer {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
  pointer-events: none;
}

.design-card-preview--tank-modules .dc-tank-upgrade-level {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  overflow: visible;
  gap: 0.1rem;
  padding: 0.2rem 0.15rem;
  box-sizing: border-box;
  font-variant-numeric: tabular-nums;
  line-height: 1;
  font-family: 'Roboto Mono', 'Courier New', monospace;
}

.design-card-preview--tank-modules .dc-upgrade-label {
  font-size: 0.45rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: #5a7a56;
  text-transform: uppercase;
}

.design-card-preview--tank-modules .dc-upgrade-value {
  font-size: 0.8rem;
  font-weight: 700;
  color: #9eb89a;
}

.design-card-preview--tank {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.65rem;
  min-height: 4.25rem;
  background: linear-gradient(135deg, rgba(40, 44, 42, 0.9) 0%, rgba(28, 32, 30, 0.95) 100%);
  border-top: 1px solid rgba(120, 165, 130, 0.15);
}

/* Air icon+label fallback (no-module designs): dark-red / maroon over the tank base. */
.design-card-preview--tank.design-card-preview--air {
  background: linear-gradient(135deg, rgba(52, 32, 32, 0.9) 0%, rgba(34, 22, 22, 0.95) 100%);
  border-top: 1px solid rgba(150, 66, 66, 0.22);
}

.design-card-preview--tank.design-card-preview--air .dc-tank-icon-fallback {
  color: rgba(204, 144, 144, 0.6);
}

.design-card-preview--tank .dc-tank-icon {
  width: 48px;
  height: 48px;
  object-fit: contain;
  flex-shrink: 0;
  border-radius: 4px;
  background: rgba(0, 0, 0, 0.25);
}

.design-card-preview--tank .dc-tank-icon-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  flex-shrink: 0;
  font-size: 1.35rem;
  color: rgba(143, 188, 143, 0.55);
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.design-card-preview--tank .dc-tank-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: #b8c4b8;
  line-height: 1.25;
  overflow: hidden;
  display: -webkit-box;
  line-clamp: 2;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.design-tank-catalog-block {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 0 0.5rem;
}

.design-tank-catalog-preview {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.design-tank-catalog-preview img {
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.2);
}

.design-tank-catalog-kicker {
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8fbc8f;
  margin: 0 0 0.25rem;
}

.design-tank-catalog-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: #ebebeb;
  margin: 0;
}

.design-tank-open-btn {
  text-decoration: none;
}

.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;
}

.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%;
}

/* New layout (post-cutoff regimental templates): push the pill row to the
   bottom of the stats panel so it aligns with the bottom of the slot grid.
   Both panels stretch to the same height via .design-template-body's flex. */
.dt-card-regimental .dt-pill-row {
  margin-top: auto;
  padding-top: 0.5rem;
}

.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;
  flex: 1 1 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dt-header-badges {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.35rem;
  margin-left: auto;
  flex-shrink: 0;
}

.dt-header-badges [data-save-library-slot] {
  display: inline-flex;
  align-items: center;
  line-height: 0;
}

.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 {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.22rem 0.55rem;
  min-height: 1.55rem;
  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:not(:disabled) {
  background: rgba(200, 169, 110, 0.2);
  color: #d9be8a;
}

/* Save to Library - icon-only bookmark button */
.dt-header-library-link {
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  padding: 0.25rem 0.38rem;
  min-height: 1.55rem;
  border-radius: 3px;
  text-decoration: none;
  background: rgba(72, 118, 160, 0.22);
  border: 1px solid rgba(100, 150, 195, 0.42);
  color: #9ec8ea;
}

.dt-header-library-link:hover:not(:disabled) {
  background: rgba(88, 135, 180, 0.32);
  border-color: rgba(120, 170, 210, 0.5);
  color: #c4e2fc;
}

button.dt-header-library-link {
  appearance: none;
  cursor: pointer;
  font-family: inherit;
  text-align: center;
}

button.dt-header-library-link:disabled {
  opacity: 0.55;
  cursor: default;
}

@keyframes dt-library-save-pending-breathe {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(120, 170, 210, 0.08);
    filter: brightness(1);
  }
  50% {
    box-shadow: 0 0 12px 2px rgba(120, 170, 210, 0.24);
    filter: brightness(1.1);
  }
}

@keyframes dt-library-save-pending-sweep {
  from {
    transform: translateX(-135%) skewX(-18deg);
  }
  to {
    transform: translateX(135%) skewX(-18deg);
  }
}

.dt-header-library-link.dt-header-library-link--saving,
.dt-header-library-link.dt-header-library-link--saving:disabled {
  position: relative;
  overflow: hidden;
  opacity: 0.68;
  background: rgba(72, 82, 92, 0.28);
  border-color: rgba(135, 150, 165, 0.36);
  color: #9daeba;
  animation: dt-library-save-pending-breathe 1.25s ease-in-out infinite;
}

.dt-header-library-link.dt-header-library-link--saving::after {
  content: "";
  position: absolute;
  inset: -30% auto -30% 0;
  width: 55%;
  background: linear-gradient(90deg, transparent, rgba(210, 230, 245, 0.18), transparent);
  pointer-events: none;
  animation: dt-library-save-pending-sweep 1.1s ease-in-out infinite;
}

/* Success pulse after saving a catalog post / share to Library */
@keyframes dt-library-save-success-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(120, 210, 170, 0);
    filter: brightness(1);
  }
  45% {
    transform: scale(1.06);
    box-shadow: 0 0 18px 4px rgba(100, 210, 160, 0.55);
    filter: brightness(1.14) saturate(1.12);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(120, 210, 170, 0);
    filter: brightness(1);
  }
}

@keyframes dt-library-save-success-subtle {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.72;
  }
}

.dt-header-library-link.dt-library-save-success-flash {
  animation: dt-library-save-success-pulse 0.75s cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .dt-header-library-link.dt-header-library-link--saving,
  .dt-header-library-link.dt-header-library-link--saving::after {
    animation: none;
  }

  .dt-header-library-link.dt-header-library-link--saving::after {
    display: none;
  }

  .dt-header-library-link.dt-library-save-success-flash {
    animation: dt-library-save-success-subtle 0.35s ease;
  }
}

/* After save - stays until navigation / reload */
.dt-header-library-link.dt-header-library-link--saved,
.dt-header-library-link.dt-header-library-link--saved:disabled {
  opacity: 1;
  cursor: default;
  background: rgba(72, 118, 100, 0.26);
  border-color: rgba(100, 165, 130, 0.42);
  color: #b5e8ca;
}

.dt-header-library-link.dt-header-library-link--saved:hover {
  background: rgba(72, 118, 100, 0.26);
  border-color: rgba(100, 165, 130, 0.42);
  color: #b5e8ca;
}

/* 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 - mirrors the new in-game layout:
   - rows 1-5: combat slots (cols 1-5) + divider (col 6) + support slots (col 7, narrower)
   - row 6: regimental support placeholder row (cols 1-5)
   Support column is narrower than combat (0.85fr vs 1fr) so support cells read as
   secondary to the battalion grid, mirroring the in-game hierarchy. */
.design-template-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr) 6px 0.85fr;
  grid-template-rows: repeat(5, 1fr) auto;
  gap: 2px;
  flex: 0 0 auto;
  width: 340px;
}

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

/* New layout (post-cutoff): support slots wrapped in a flex column spanning
   all grid rows. Custom gap is independent of the main grid's 2px row gap and
   the column auto-centers with the combat + regimental rows. */
.dt-support-column {
  grid-column: 7;
  grid-row: 1 / -1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 6px;
  min-width: 0;
}

/* Support cell: shrink inside its grid area to read as secondary to combat.
   justify-self/align-self center the cell when placed directly in the grid
   (legacy pre-cutoff layout); inside .dt-support-column they're no-ops on
   justify-self and align-self handles horizontal centering on the flex item. */
.dt-slot.dt-slot-support {
  width: 88%;
  justify-self: center;
  align-self: center;
}

.dt-slot.dt-slot-regimental {
  aspect-ratio: auto;
  height: 38px;
  width: 90%;
  justify-self: center;
  align-self: center;
  background: #0e0e0e;
  border-color: #1a1a1a;
  opacity: 0.65;
}

/* Filled regimental cell: match the combat/support filled treatment and drop
   the dim opacity so the unit reads as active. */
.dt-slot.dt-slot-regimental.dt-slot-filled {
  background: #1a1f1e;
  border-color: #272e2c;
  opacity: 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;
  background: rgba(120, 100, 70, 0.15);
  min-width: 2.5rem;
  min-height: 0.85em;
  display: inline-block;
  vertical-align: middle;
}

.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;
  transition: background 0.3s, color 0.3s, border-color 0.3s;
}

.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; }

/* Static upvote count on SSR comments (non-interactive until JS hydrates) */
.comment-upvote-ssr {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #333;
  font-size: 0.72rem;
  flex-shrink: 0;
}

.comment-avatar-link--static {
  cursor: default;
  text-decoration: none;
}

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

.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-tank-designer-link {
  color: #8fbc8f;
  border-bottom-color: rgba(143, 188, 143, 0.35);
}

.comment-tank-designer-link:hover {
  color: #a8d4a8;
  border-bottom-color: rgba(143, 188, 143, 0.65);
}

.comment-ship-designer-link {
  color: #7aa8c8;
  border-bottom-color: rgba(122, 168, 200, 0.35);
}

.comment-ship-designer-link:hover {
  color: #9ec0e0;
  border-bottom-color: rgba(122, 168, 200, 0.65);
}

.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-card-preview .td-share-card {
  width: 100%;
  max-width: min(860px, 100%);
  margin: 0;
  box-sizing: border-box;
}

.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-block {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  flex-shrink: 0;
}

.profile-tier-below-avatar {
  display: flex;
  justify-content: center;
  width: 100%;
  max-width: 11rem;
}

/* 64×64 anchor for avatar + absolutely positioned Supporter teaser pin (pin does not affect flex layout of the photo/letter) */
.profile-avatar-wrap {
  position: relative;
  width: 64px;
  flex-shrink: 0;
}

/* Only the <img> is block; placeholder must stay flex for centered letter (don’t override display:flex here) */
.profile-avatar-wrap .profile-avatar {
  display: block;
  margin: 0;
}

.profile-avatar-wrap .profile-avatar-placeholder {
  margin: 0;
}

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

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

/* Blue avatar ring - applied to all Supporter tier users across catalog, design view, comments, and profile. */
.design-card-author-avatar.user-avatar--supporter,
.design-card-author-avatar-letter.user-avatar--supporter,
.design-view-author-avatar.user-avatar--supporter,
.design-view-author-avatar-letter.user-avatar--supporter,
.comment-avatar.user-avatar--supporter,
.profile-avatar.user-avatar--supporter,
.profile-avatar-placeholder.user-avatar--supporter,
.settings-avatar-wrap.user-avatar--supporter {
  border: 1px solid rgba(100, 190, 255, 0.5);
  box-shadow:
    0 0 0 1px rgba(8, 20, 36, 0.75) inset,
    0 0 22px rgba(45, 150, 255, 0.2),
    0 0 1px rgba(160, 220, 255, 0.4);
}

/* Magenta avatar ring - applied to all Pro tier users across catalog, design view, comments, and profile. */
.design-card-author-avatar.user-avatar--pro,
.design-card-author-avatar-letter.user-avatar--pro,
.design-view-author-avatar.user-avatar--pro,
.design-view-author-avatar-letter.user-avatar--pro,
.comment-avatar.user-avatar--pro,
.settings-avatar-wrap.user-avatar--pro {
  border: 1px solid rgba(210, 90, 195, 0.55);
  box-shadow:
    0 0 0 1px rgba(40, 8, 22, 0.78) inset,
    0 0 22px rgba(205, 75, 185, 0.22),
    0 0 1px rgba(255, 180, 245, 0.35);
}

.design-card-author-avatar-letter.user-avatar--pro,
.design-view-author-avatar-letter.user-avatar--pro,
.comment-avatar.comment-avatar-letter.user-avatar--pro {
  background: linear-gradient(160deg, #310d30 0%, #1c0a1a 100%);
  color: #ecc5dc;
  text-shadow: 0 0 12px rgba(255, 140, 190, 0.35);
}

@media (prefers-reduced-motion: no-preference) {
  .design-card-author-avatar.user-avatar--pro,
  .design-card-author-avatar-letter.user-avatar--pro,
  .design-view-author-avatar.user-avatar--pro,
  .design-view-author-avatar-letter.user-avatar--pro,
  .comment-avatar.user-avatar--pro {
    transition: border-color 0.2s ease, box-shadow 0.25s ease;
  }
}

.settings-avatar-wrap.user-avatar--supporter:hover,
.settings-avatar-wrap.user-avatar--pro:hover {
  /* Keep the glow under the hover state instead of swapping to the gold ring. */
  border-color: inherit;
}

.settings-avatar-wrap.user-avatar--supporter .settings-avatar-initials {
  background: linear-gradient(160deg, #1f3045 0%, #162536 100%);
  color: #8ec8f0;
}

.settings-avatar-wrap.user-avatar--pro .settings-avatar-initials {
  background: linear-gradient(160deg, #310d30 0%, #1c0a1a 100%);
  color: #ecc5dc;
}

.design-card-author-avatar-letter.user-avatar--supporter,
.design-view-author-avatar-letter.user-avatar--supporter,
.comment-avatar.comment-avatar-letter.user-avatar--supporter,
.profile-avatar-placeholder.user-avatar--supporter {
  background: linear-gradient(160deg, #1a2838 0%, #142030 100%);
  color: #8ec8f0;
  text-shadow: 0 0 12px rgba(100, 190, 255, 0.35);
}

@media (prefers-reduced-motion: no-preference) {
  .design-card-author-avatar.user-avatar--supporter,
  .design-card-author-avatar-letter.user-avatar--supporter,
  .design-view-author-avatar.user-avatar--supporter,
  .design-view-author-avatar-letter.user-avatar--supporter,
  .comment-avatar.user-avatar--supporter,
  .profile-avatar.user-avatar--supporter,
  .profile-avatar-placeholder.user-avatar--supporter {
    transition: border-color 0.2s ease, box-shadow 0.25s ease;
  }
}

.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;
}

/* Pro - magenta "power mode" badge with shine. Distinct from the Supporter
   blue crest above, distinct from the gold accents used everywhere else. */
@keyframes tier-pro-shine {
  0%, 15% {
    transform: translateX(-160%) skewX(-12deg);
  }
  65%, 100% {
    transform: translateX(320%) skewX(-12deg);
  }
}

.tier-badge.tier-pro {
  position: relative;
  display: inline-block;
  padding: 0.18rem 0.42rem 0.2rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  line-height: 1;
  color: #f2cae8;
  text-shadow:
    0 0 14px rgba(210, 90, 195, 0.5),
    0 1px 0 rgba(20, 4, 12, 0.85);
  background:
    linear-gradient(165deg,
      rgba(255, 255, 255, 0.16) 0%,
      rgba(255, 255, 255, 0) 42%),
    linear-gradient(145deg,
      #3c1640 0%,
      #62205a 28%,
      #4a1746 55%,
      #310d30 100%);
  border: 1px solid rgba(210, 90, 195, 0.5);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45) inset,
    0 1px 2px rgba(0, 0, 0, 0.45),
    0 0 22px rgba(205, 75, 185, 0.22),
    0 0 1px rgba(255, 180, 245, 0.4);
  overflow: hidden;
  vertical-align: middle;
}

.tier-badge.tier-pro::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 45%;
  height: 100%;
  z-index: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.13) 50%,
    transparent 100%
  );
  transform: translateX(-160%) skewX(-12deg);
  pointer-events: none;
}

.tier-badge.tier-pro::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38%;
  z-index: 0;
  background: linear-gradient(to top, rgba(225, 145, 210, 0.14), transparent);
  border-radius: 0 0 3px 3px;
  pointer-events: none;
}

.tier-badge.tier-pro > * {
  position: relative;
  z-index: 1;
}

.tier-badge.tier-pro:hover {
  border-color: rgba(225, 145, 210, 0.65);
  color: #f2cae8;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4) inset,
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 0 28px rgba(210, 90, 195, 0.32),
    0 0 1px rgba(255, 200, 245, 0.5);
}

@media (prefers-reduced-motion: no-preference) {
  .tier-badge.tier-pro {
    transition:
      border-color 0.2s ease,
      color 0.2s ease,
      box-shadow 0.2s ease;
  }
  .tier-badge.tier-pro::before {
    animation: tier-pro-shine 5.5s ease-in-out infinite;
  }
}

/* Founding Supporter - cool blue “crest” badge (distinct from gold Pro) */
@keyframes tier-supporter-shine {
  0%, 15% {
    transform: translateX(-160%) skewX(-12deg);
  }
  65%, 100% {
    transform: translateX(320%) skewX(-12deg);
  }
}

.tier-supporter-wrap {
  position: relative;
  display: inline-block;
  padding-bottom: 0.75rem;
}

.tier-badge.tier-supporter {
  position: relative;
  display: inline-block;
  padding: 0.22rem 0.65rem 0.24rem;
  border-radius: 4px;
  font-size: 0.6rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  line-height: 1;
  color: #c8e8ff;
  text-shadow:
    0 0 14px rgba(80, 170, 255, 0.45),
    0 1px 0 rgba(0, 20, 40, 0.85);
  background:
    linear-gradient(165deg,
      rgba(255, 255, 255, 0.14) 0%,
      rgba(255, 255, 255, 0) 42%),
    linear-gradient(145deg,
      #152a42 0%,
      #1c3d5e 28%,
      #143552 55%,
      #0f2840 100%);
  border: 1px solid rgba(100, 190, 255, 0.42);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.45) inset,
    0 1px 2px rgba(0, 0, 0, 0.45),
    0 0 20px rgba(40, 140, 255, 0.18),
    0 0 1px rgba(160, 220, 255, 0.35);
  overflow: hidden;
  vertical-align: middle;
}

.tier-badge.tier-supporter .tier-supporter-label {
  position: relative;
  z-index: 1;
}

.tier-supporter-since {
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Sarina', cursive;
  font-weight: 400;
  font-size: 0.5rem;
  line-height: 1;
  white-space: nowrap;
  color: rgba(210, 232, 250, 0.85);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
  pointer-events: none;
  user-select: none;
  z-index: 2;
}

.tier-badge.tier-supporter::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 45%;
  height: 100%;
  z-index: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.11) 50%,
    transparent 100%
  );
  transform: translateX(-160%) skewX(-12deg);
  pointer-events: none;
}

.tier-badge.tier-supporter::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 38%;
  z-index: 0;
  background: linear-gradient(to top, rgba(120, 200, 255, 0.12), transparent);
  border-radius: 0 0 3px 3px;
  pointer-events: none;
}

.tier-badge.tier-supporter:hover {
  border-color: rgba(140, 210, 255, 0.55);
  color: #dff4ff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.4) inset,
    0 1px 2px rgba(0, 0, 0, 0.4),
    0 0 26px rgba(60, 160, 255, 0.28),
    0 0 1px rgba(180, 230, 255, 0.45);
}

@media (prefers-reduced-motion: no-preference) {
  .tier-badge.tier-supporter {
    transition:
      border-color 0.2s ease,
      color 0.2s ease,
      box-shadow 0.25s ease;
  }

  .tier-badge.tier-supporter::before {
    animation: tier-supporter-shine 5.5s ease-in-out 1.5s infinite;
  }
}

/* Profile: supporter badge links to /supporter */
a.tier-badge.tier-supporter.profile-tier-supporter-link,
a.tier-badge.tier-supporter.profile-tier-supporter-link:visited {
  text-decoration: none;
  color: #c8e8ff;
}

a.tier-badge.tier-supporter.profile-tier-supporter-link:focus-visible {
  outline: 2px solid rgba(140, 210, 255, 0.85);
  outline-offset: 3px;
}

/* Profile: pro badge links to /pro */
a.tier-badge.tier-pro.profile-tier-pro-link,
a.tier-badge.tier-pro.profile-tier-pro-link:visited {
  text-decoration: none;
  color: #ffd8e8;
}

a.tier-badge.tier-pro.profile-tier-pro-link:focus-visible {
  outline: 2px solid rgba(225, 145, 210, 0.85);
  outline-offset: 3px;
}

/* Magenta avatar ring for Pro profile avatars (matches Supporter blue ring). */
.profile-avatar.user-avatar--pro,
.profile-avatar-placeholder.user-avatar--pro {
  border: 1px solid rgba(210, 90, 195, 0.55);
  box-shadow:
    0 0 0 1px rgba(40, 8, 22, 0.78) inset,
    0 0 22px rgba(205, 75, 185, 0.22),
    0 0 1px rgba(255, 180, 245, 0.35);
}

.profile-avatar-placeholder.user-avatar--pro {
  background: linear-gradient(160deg, #310d30 0%, #1c0a1a 100%);
  color: #ecc5dc;
  text-shadow: 0 0 12px rgba(255, 140, 190, 0.35);
}

@media (prefers-reduced-motion: no-preference) {
  .profile-avatar.user-avatar--pro,
  .profile-avatar-placeholder.user-avatar--pro {
    transition: border-color 0.2s ease, box-shadow 0.25s ease;
  }
}

.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;
  }

  .dt-slot-regimental {
    height: 30px;
  }

  .dt-support-column {
    gap: 4px;
  }
}

/* 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; }

/* ---- Membership section ---- */
.settings-membership-loading {
  font-size: 0.82rem;
  color: #5a5248;
  padding: 0.5rem 0;
}

.membership-grid {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 640px) {
  .membership-grid {
    grid-template-columns: 1fr;
  }
}

.membership-badge-wrap {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  padding: 1.6rem 1.25rem 1.25rem;
  border-radius: 8px;
  text-align: center;
  overflow: hidden;
  isolation: isolate;
  background:
    radial-gradient(ellipse at top, rgba(255,255,255,0.02) 0%, transparent 65%),
    linear-gradient(180deg, #161416 0%, #131113 100%);
  border: 1px solid rgba(140, 70, 120, 0.12);
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.3);
}

/* Tier-themed halo - kept restrained (low opacity, soft) to match the
   toned-down pro-close treatment rather than a flashy glow. */
.membership-badge-wrap::before {
  content: '';
  position: absolute;
  top: -40%;
  left: 50%;
  transform: translateX(-50%);
  width: 220%;
  height: 90%;
  border-radius: 50%;
  filter: blur(44px);
  opacity: 0.22;
  z-index: -1;
  pointer-events: none;
}

.membership-badge-wrap--pro::before {
  background: radial-gradient(circle, rgba(205, 75, 185, 0.2) 0%, transparent 70%);
}
.membership-badge-wrap--supporter::before {
  background: radial-gradient(circle, rgba(45, 150, 255, 0.16) 0%, transparent 70%);
}
.membership-badge-wrap--free::before {
  background: radial-gradient(circle, rgba(200, 169, 110, 0.06) 0%, transparent 70%);
}
.membership-badge-wrap--dual::before {
  background:
    radial-gradient(circle at 30% 50%, rgba(45, 150, 255, 0.15) 0%, transparent 60%),
    radial-gradient(circle at 70% 50%, rgba(205, 75, 185, 0.16) 0%, transparent 60%);
  opacity: 0.3;
}

.membership-badge-wrap--pro { border-color: rgba(205, 75, 185, 0.18); }
.membership-badge-wrap--supporter { border-color: rgba(45, 150, 255, 0.18); }
.membership-badge-wrap--dual { border-color: rgba(180, 120, 200, 0.18); }

.membership-badge-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #5a5248;
}

.membership-badge-wrap--pro .membership-badge-eyebrow { color: #c8567a; }
.membership-badge-wrap--supporter .membership-badge-eyebrow { color: #6ba5d8; }
.membership-badge-wrap--dual .membership-badge-eyebrow { color: #b78ec8; }

/* Holds the badge(s) — pad so badge has breathing room and looks intentional. */
.membership-badge-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.85rem;
  margin: 0.15rem 0;
  min-height: 38px;
}

.membership-badge-stage--dual {
  flex-direction: column;
  gap: 0.4rem;
}

.membership-badge-stage--dual .membership-badge-stage-sep {
  font-size: 0.75rem;
  line-height: 1;
}

.membership-badge-stage-sep {
  font-size: 0.85rem;
  font-weight: 700;
  color: #3e3a35;
  user-select: none;
}

.membership-badge-caption {
  font-size: 0.78rem;
  color: #8a8278;
  margin-top: 0.15rem;
  line-height: 1.4;
}

.membership-badge-caption-strong {
  color: #c8c0b8;
  font-weight: 600;
}

/* Free-tier badge: refined plate, not a hollow pill. */
.membership-badge-free {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.95rem;
  border-radius: 4px;
  background: linear-gradient(160deg, #1c1a17 0%, #15130f 100%);
  border: 1px solid #2c2620;
  color: #a89a82;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.membership-badge-free-glyph {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #6b6054;
  display: inline-block;
}

.membership-badge-link {
  text-decoration: none;
}

.membership-detail {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-width: 0;
}

.membership-lead {
  font-size: 0.86rem;
  line-height: 1.55;
  color: #999;
  margin: 0;
}

.membership-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.membership-cta {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  text-decoration: none;
  padding: 0.55rem 0.95rem;
  border-radius: 5px;
  font-size: 0.8rem;
  font-weight: 600;
  line-height: 1.25;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.15s ease,
    transform 0.15s ease;
}

.membership-cta--pro {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(145deg, rgba(122, 29, 112, 0.52) 0%, rgba(72, 16, 74, 0.42) 100%);
  color: #f2cae8;
  border: 1px solid rgba(210, 90, 195, 0.55);
  text-shadow: 0 0 12px rgba(210, 90, 195, 0.45);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.22) inset,
    0 0 22px rgba(210, 90, 195, 0.18);
}

.membership-cta--pro:hover {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(145deg, rgba(122, 29, 112, 0.66) 0%, rgba(90, 21, 86, 0.54) 100%);
  border-color: rgba(210, 90, 195, 0.72);
  color: #ffe8f8;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.22) inset,
    0 0 30px rgba(210, 90, 195, 0.3);
  transform: translateY(-1px);
}

.membership-cta--ghost {
  background: transparent;
  border: 1px solid #2a2a2a;
  color: #c8a96e;
}

.membership-cta--ghost:hover {
  border-color: #c8a96e;
}

.membership-cta--supporter {
  align-items: center;
  justify-content: center;
  text-align: center;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(145deg, rgba(28, 61, 94, 0.52) 0%, rgba(15, 40, 64, 0.42) 100%);
  color: #c8e8ff;
  border: 1px solid rgba(100, 190, 255, 0.5);
  text-shadow: 0 0 12px rgba(80, 170, 255, 0.4);
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.22) inset,
    0 0 22px rgba(40, 140, 255, 0.16);
}

.membership-cta--supporter:hover {
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0) 42%),
    linear-gradient(145deg, rgba(28, 61, 94, 0.66) 0%, rgba(20, 53, 82, 0.54) 100%);
  border-color: rgba(120, 205, 255, 0.72);
  color: #e6f5ff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.22) inset,
    0 0 30px rgba(40, 140, 255, 0.28);
  transform: translateY(-1px);
}

.membership-cta-sub {
  font-size: 0.7rem;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 0.1rem;
}

/* Pro trial claim CTA - a one-time "claim your free Pro" offer that sits in
   the same slot (and at the same size) as the Upgrade to Pro CTA. It reuses
   .membership-cta / .membership-cta--pro for all styling; these are just the
   <button> resets the shared link styling doesn't cover. */
.membership-claim-btn {
  cursor: pointer;
  font-family: inherit;
  text-align: left;
}

.membership-claim-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

/* Pro subscription details */
.membership-pro-details {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.membership-dl {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin: 0;
}

.membership-dl-row {
  display: grid;
  grid-template-columns: minmax(80px, 110px) 1fr;
  gap: 1rem;
  align-items: baseline;
  font-size: 0.83rem;
}

.membership-dl-row dt {
  color: #5a5248;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.7rem;
  font-weight: 600;
  margin: 0;
}

.membership-dl-row dd {
  margin: 0;
  color: #c8c0b8;
}

.membership-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
}

.membership-status::before {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  display: inline-block;
}

.membership-status--ok { color: #6abf69; }
.membership-status--ok::before { background: #6abf69; }
.membership-status--ending { color: #c8a96e; }
.membership-status--ending::before { background: #c8a96e; }

.membership-cancel-btn {
  align-self: flex-start;
  background: transparent;
  border: 1px solid #3a2a2a;
  color: #a35454;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.95rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.membership-cancel-btn:hover {
  background: rgba(160, 60, 60, 0.1);
  border-color: #a35454;
  color: #c0392b;
}

.membership-cancel-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.membership-pro-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  align-items: center;
}

.membership-portal-btn {
  align-self: flex-start;
  background: transparent;
  border: 1px solid #3a3530;
  color: #c8a96e;
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.4rem 0.95rem;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.membership-portal-btn:hover {
  background: rgba(200, 169, 110, 0.1);
  border-color: #c8a96e;
  color: #d9be8a;
}

.membership-portal-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.membership-action-note {
  font-size: 0.78rem;
  color: #6b6054;
  margin: 0;
  line-height: 1.5;
}

.membership-sub-empty {
  font-size: 0.82rem;
  color: #5a5248;
  margin: 0;
}

/* Pro + Supporter badge picker */
.membership-badge-picker {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  padding: 0.9rem;
  background: #0d0d0d;
  border: 1px solid #1a1a1a;
  border-radius: 6px;
}

.membership-picker-title {
  font-size: 0.78rem;
  color: #999;
  margin: 0;
  line-height: 1.5;
}

.membership-picker-row {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.membership-picker-option {
  flex: 1 1 160px;
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid #1f1f1f;
  border-radius: 5px;
  cursor: pointer;
  background: #111;
  transition: border-color 0.15s, background 0.15s;
}

.membership-picker-option input[type="radio"] {
  margin: 0;
  accent-color: #c8a96e;
  cursor: pointer;
}

.membership-picker-option:hover {
  border-color: #2e2e2e;
}

.membership-picker-option.is-selected {
  border-color: #c8a96e;
  background: rgba(200, 169, 110, 0.05);
}

.membership-picker-badge {
  display: inline-flex;
  align-items: center;
}

.membership-picker-label {
  font-size: 0.8rem;
  color: #c8c0b8;
  font-weight: 500;
}

/* ---- 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-step:not([hidden]),
#cpub-form-step:not([hidden]) {
  display: flex;
  flex-direction: column;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

/* Tabs */
.cpub-tabs {
  display: flex;
  border-bottom: 1px solid #1e1e1e;
  padding: 0 1.5rem;
  gap: 0;
}

.cpub-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: #555;
  cursor: pointer;
  font-size: 0.82rem;
  padding: 0.5rem 0.75rem;
  margin-bottom: -1px;
  transition: color 0.12s, border-color 0.12s;
}

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

.cpub-tab--active {
  color: #c8a86e;
  border-bottom-color: #c8a86e;
}

.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-template-name-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  overflow: hidden;
}

.cpub-template-meta {
  font-size: 0.72rem;
  color: #555;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cpub-selected-meta {
  font-size: 0.72rem;
  color: #666;
  margin-left: 0.25rem;
}

.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;
}

/* ── Settings notification toggle ──────────────────────────────────────────── */

.settings-toggle-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1.5rem;
}

.settings-toggle {
  position: relative;
  display: inline-flex;
  flex-shrink: 0;
  width: 36px;
  height: 20px;
  margin-top: 2px;
}

.settings-toggle input {
  opacity: 0;
  width: 0;
  height: 0;
  position: absolute;
}

.settings-toggle-slider {
  position: absolute;
  inset: 0;
  background: #2a2a2a;
  border: 1px solid #333;
  border-radius: 20px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.settings-toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px;
  height: 14px;
  left: 2px;
  top: 2px;
  background: #555;
  border-radius: 50%;
  transition: transform 0.15s, background 0.15s;
}

.settings-toggle input:checked + .settings-toggle-slider {
  background: rgba(200, 169, 110, 0.15);
  border-color: rgba(200, 169, 110, 0.4);
}

.settings-toggle input:checked + .settings-toggle-slider::before {
  transform: translateX(16px);
  background: #c8a96e;
}
