:root {
  color-scheme: dark;
  --bg: #050914;
  --panel: #0a1222;
  --panel-2: #0d192b;
  --line: rgba(118, 210, 255, 0.18);
  --line-strong: rgba(46, 232, 255, 0.42);
  --text: #eef8ff;
  --muted: #8aa6b9;
  --accent: #2ee8ff;
  --accent-2: #7cff9b;
  --active-rank-color: #df2a54;
  --active-rank-color-2: #df2a54;
  --active-rank-text: #df2a54;
  --warn: #ffb454;
  --error: #ff5f70;
  --radius: 8px;
  --shadow: 0 16px 60px rgba(0, 0, 0, 0.32);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(10, 18, 34, 0.95), rgba(5, 9, 20, 1) 420px),
    #050914;
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

img {
  display: block;
  max-width: 100%;
}

.app-shell {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 64px;
}

.app-header,
.section-heading,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.app-header {
  padding: 18px 0 28px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(2rem, 5vw, 4.4rem);
  line-height: 0.95;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: clamp(1.25rem, 2vw, 1.9rem);
}

h3 {
  margin: 0;
  font-size: 1rem;
}

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

.sync-pill,
.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 10px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.03);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  white-space: nowrap;
}

.badge.listed {
  color: #092415;
  border-color: rgba(124, 255, 155, 0.8);
  background: var(--accent-2);
}

.badge.warn {
  color: #211503;
  border-color: rgba(255, 180, 84, 0.8);
  background: var(--warn);
}

.badge.muted {
  color: var(--muted);
}

.button,
.icon-button {
  min-height: 40px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  color: var(--text);
  background: rgba(46, 232, 255, 0.08);
  font-weight: 800;
  transition:
    transform 120ms ease,
    border-color 120ms ease,
    background 120ms ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  text-decoration: none;
}

.button:hover,
.icon-button:hover,
.trait-card:hover,
.nft-card:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
}

.button.primary {
  color: #04131a;
  border-color: var(--accent);
  background: var(--accent);
}

.button.subtle {
  background: rgba(255, 255, 255, 0.04);
}

.button.full {
  width: 100%;
}

.button:disabled {
  cursor: progress;
  opacity: 0.7;
}

.status-panel,
.controls,
.trait-section,
.metric-card,
.empty-state {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(10, 18, 34, 0.72);
  box-shadow: var(--shadow);
}

.status-panel {
  min-height: 74px;
  padding: 16px;
}

.status-row strong {
  display: block;
  margin-bottom: 4px;
  font-size: 1rem;
}

.status-row span {
  color: var(--muted);
}

.status-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
  font-size: 0.85rem;
}

.alert {
  display: grid;
  gap: 3px;
  border: 1px solid rgba(255, 180, 84, 0.4);
  border-radius: var(--radius);
  margin-top: 12px;
  padding: 10px 12px;
  color: var(--warn);
  background: rgba(255, 180, 84, 0.09);
}

.alert.error {
  border-color: rgba(255, 95, 112, 0.45);
  color: var(--error);
  background: rgba(255, 95, 112, 0.09);
}

.view-switch {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 0;
  flex-wrap: wrap;
}

.view-tab {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 18px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.035);
  font-weight: 900;
}

.view-tab.active {
  color: #04131a;
  border-color: var(--accent);
  background: var(--accent);
}

.view-reset {
  margin-left: auto;
}

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

.controls {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin: 18px 0;
  padding: 14px;
}

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0 12px;
  color: var(--text);
  background: #07101f;
  outline: none;
}

.field input:focus,
.field select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(46, 232, 255, 0.14);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.metric-card {
  padding: 14px;
}

.metric-card span,
.metric-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  font-size: clamp(1.2rem, 2vw, 2rem);
}

.section-heading {
  margin: 26px 0 14px;
}

.result-count {
  color: var(--muted);
  font-weight: 800;
}

.trait-codex {
  display: grid;
  gap: 18px;
}

.trait-section {
  padding: 14px;
}

.category-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.category-heading span {
  color: var(--muted);
  font-size: 0.85rem;
}

.trait-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 12px;
}

.trait-card {
  display: grid;
  grid-template-columns: 74px minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
  color: inherit;
  text-align: left;
  background: rgba(255, 255, 255, 0.035);
}

.trait-card img,
.trait-modal-summary img,
.detail-image,
.nft-card img {
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #08101d;
}

.trait-card img {
  width: 74px;
  height: 74px;
  border-radius: 7px;
  border: 1px solid var(--line);
}

.trait-card-body {
  display: grid;
  gap: 5px;
  min-width: 0;
}

.trait-title,
.trait-meta,
.trait-footer {
  min-width: 0;
}

.trait-title {
  overflow: hidden;
  color: var(--text);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trait-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.trait-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--accent);
  font-size: 0.84rem;
  font-weight: 900;
}

.nft-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 14px;
}

.nft-card {
  position: relative;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: rgba(10, 18, 34, 0.82);
  transition:
    transform 120ms ease,
    border-color 120ms ease;
}

.nft-card:hover {
  border-color: var(--faction-color, var(--accent));
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--faction-color, var(--accent)) 60%, transparent),
    0 0 26px color-mix(in srgb, var(--faction-color, var(--accent)) 34%, transparent);
}

.image-button {
  position: relative;
  display: block;
  width: 100%;
  border: 0;
  padding: 0;
  background: transparent;
}

.nft-card img {
  width: 100%;
  height: auto;
}

.image-badge {
  position: absolute;
  top: 8px;
  right: 8px;
}

.nft-info {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 8px;
  padding: 10px;
}

.nft-info strong,
.nft-info span {
  display: block;
}

.nft-info span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.8rem;
}

.faction-line {
  display: flex !important;
  align-items: center;
  gap: 6px;
}

.nft-card .faction-logo {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: transparent;
}

.nft-side {
  display: grid;
  justify-items: end;
  align-content: start;
  gap: 8px;
  min-width: 76px;
}

.nft-price {
  color: var(--accent-2);
  font-size: 0.78rem;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.nft-price.not-listed {
  color: var(--accent-2);
}

.rank-box {
  display: grid;
  align-content: center;
  justify-items: center;
  width: 76px;
  min-height: 56px;
  border: 1px solid color-mix(in srgb, var(--rank-color, var(--active-rank-color)) 70%, transparent);
  border-top: 8px solid var(--rank-color-2, var(--active-rank-color-2));
  border-radius: 4px;
  color: var(--rank-text, var(--active-rank-text));
  background: rgba(0, 0, 0, 0.16);
  text-align: center;
}

.rank-box span {
  margin: 0;
  color: currentColor;
  font-size: 0.58rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

.rank-box strong {
  display: block;
  margin-top: 3px;
  color: currentColor;
  font-size: 1.55rem;
  line-height: 1;
}

.opensea-link {
  display: block;
  border-top: 1px solid var(--line);
  padding: 8px 10px 10px;
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 900;
  text-decoration: none;
}

.load-more-wrap {
  display: flex;
  justify-content: center;
  margin-top: 22px;
}

.empty-state {
  padding: 34px 18px;
  color: var(--muted);
  text-align: center;
}

.modal-root:empty {
  display: none;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  background: rgba(0, 0, 0, 0.72);
}

.modal {
  position: fixed;
  inset: 4vh 50%;
  z-index: 21;
  display: flex;
  flex-direction: column;
  width: min(1120px, calc(100% - 28px));
  max-height: 92vh;
  transform: translateX(-50%);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #07101f;
  box-shadow: var(--shadow);
}

.modal.compact {
  width: min(860px, calc(100% - 28px));
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 18px;
}

.modal-header p {
  margin-bottom: 0;
  color: var(--muted);
}

.icon-button {
  width: 40px;
  flex: 0 0 40px;
  padding: 0;
  font-size: 1.5rem;
  line-height: 1;
}

.modal-body {
  overflow: auto;
  padding: 18px;
}

.trait-modal-summary {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: center;
  margin-bottom: 18px;
}

.trait-modal-summary img,
.detail-image {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.modal-grid {
  grid-template-columns: repeat(auto-fill, minmax(142px, 1fr));
}

.nft-detail {
  display: grid;
  grid-template-columns: minmax(220px, 0.9fr) minmax(260px, 1.1fr);
  gap: 18px;
  align-items: start;
}

.trait-list {
  display: grid;
  gap: 10px;
}

.trait-list button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
}

.trait-list button span {
  color: var(--muted);
}

.skeleton,
.skeleton-card {
  position: relative;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.08);
}

.skeleton::after,
.skeleton-card::after {
  position: absolute;
  inset: 0;
  content: "";
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.12), transparent);
  animation: shimmer 1.3s infinite;
}

.skeleton.line {
  width: min(520px, 100%);
  height: 16px;
  border-radius: 999px;
}

.skeleton.line.short {
  width: min(240px, 65%);
  margin-top: 12px;
}

.skeleton-card {
  min-height: 98px;
}

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(5, 19, 26, 0.25);
  border-top-color: #04131a;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@media (max-width: 1080px) {
  .search-field {
    grid-column: 1 / -1;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1480px);
    padding-top: 14px;
  }

  .app-header,
  .section-heading,
  .status-row,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .header-actions {
    justify-content: flex-start;
  }

  .controls,
  .summary-grid,
  .nft-detail {
    grid-template-columns: 1fr;
  }

  .view-reset {
    width: 100%;
    margin-left: 0;
  }

  .trait-grid {
    grid-template-columns: 1fr;
  }

  .nft-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .modal {
    inset: 10px 50%;
    max-height: calc(100vh - 20px);
    width: calc(100% - 20px);
  }

  .trait-modal-summary {
    grid-template-columns: 92px minmax(0, 1fr);
  }
}

/* Factory Hunt Protocol redesign */
:root {
  --bg: #07090a;
  --panel: #151719;
  --panel-2: #1d2023;
  --panel-3: #101214;
  --line: rgba(255, 255, 255, 0.13);
  --line-strong: rgba(255, 255, 255, 0.28);
  --text: #f2f2f2;
  --muted: #9fa3a7;
  --accent: #ff3036;
  --accent-2: #d62d34;
  --active-rank-color: #df2a54;
  --active-rank-color-2: #df2a54;
  --active-rank-text: #df2a54;
  --warn: #ffb454;
  --error: #ff3b45;
  --radius: 8px;
  --rail-width: 184px;
  --shadow: 0 18px 70px rgba(0, 0, 0, 0.44);
}

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 72% 12%, rgba(255, 255, 255, 0.075), transparent 28%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.035) 0 1px, transparent 1px 14px),
    linear-gradient(180deg, #101214 0%, #060708 100%);
  color: var(--text);
  font-family: "Arial Narrow", "Roboto Condensed", Inter, ui-sans-serif, system-ui, sans-serif;
  overflow-x: hidden;
}

body::after {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  content: "";
  background-image: linear-gradient(rgba(255, 255, 255, 0.025) 1px, transparent 1px);
  background-size: 100% 3px;
  opacity: 0.22;
}

.factory-rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: var(--rail-width);
  padding: 26px 16px 24px;
  border-right: 1px solid #303439;
  background:
    linear-gradient(90deg, rgba(255, 255, 255, 0.08), transparent 18%, transparent 82%, rgba(255, 255, 255, 0.07)),
    linear-gradient(180deg, #222629, #08090a 54%, #191b1e);
  box-shadow: inset -10px 0 30px rgba(0, 0, 0, 0.55), 12px 0 30px rgba(0, 0, 0, 0.35);
}

.factory-rail::before,
.factory-rail::after {
  position: absolute;
  left: 12px;
  right: 12px;
  height: 190px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 14px;
  content: "";
  pointer-events: none;
}

.factory-rail::before { top: 14px; }
.factory-rail::after { bottom: 14px; }

.factory-brand {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 2px;
  margin: 24px 0 62px;
  text-align: center;
}

.factory-brand strong {
  color: #e8e8e8;
  font-size: 3.35rem;
  font-weight: 1000;
  line-height: 0.78;
  letter-spacing: -0.08em;
  text-shadow: 0 4px 0 #050505, 0 0 16px rgba(255, 255, 255, 0.18);
}

.factory-brand span {
  color: #f5f5f5;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.02em;
}

.factory-nav {
  position: relative;
  display: grid;
  align-content: start;
  gap: 8px;
}

.rail-item {
  display: grid;
  justify-items: center;
  gap: 8px;
  min-height: 76px;
  border: 1px solid transparent;
  border-radius: 7px;
  padding: 12px 8px;
  color: #f0f0f0;
  background: rgba(10, 11, 12, 0.3);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
  white-space: nowrap;
}

.rail-item.active,
.rail-item:hover {
  border-color: rgba(255, 48, 54, 0.7);
  color: var(--accent);
  background: linear-gradient(180deg, rgba(255, 48, 54, 0.15), rgba(0, 0, 0, 0.24));
  box-shadow: inset 0 0 18px rgba(255, 48, 54, 0.12), 0 0 20px rgba(255, 48, 54, 0.12);
}

.rail-item.muted {
  color: #9a9a9a;
}

.rail-icon {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: currentColor;
  font-size: 1.35rem;
  line-height: 1;
}

.rail-core {
  display: grid;
  gap: 7px;
  justify-self: center;
  width: 72px;
  margin-bottom: 28px;
  border: 1px solid rgba(255, 48, 54, 0.35);
  border-radius: 10px;
  padding: 12px;
  background: #070707;
  box-shadow: inset 0 0 18px rgba(255, 48, 54, 0.16), 0 0 16px rgba(255, 48, 54, 0.2);
}

.rail-core span {
  height: 7px;
  border-radius: 999px;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}

.app-shell {
  width: auto;
  min-height: 100vh;
  margin: 0 0 0 var(--rail-width);
  padding: 14px 32px 38px;
  border-left: 1px solid rgba(255, 255, 255, 0.05);
}

.system-bar,
.app-header,
.status-panel,
.view-switch,
.controls,
.metric-card,
.trait-section,
.modal,
.factory-footer {
  border: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.018)),
    rgba(18, 20, 22, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), var(--shadow);
}

.system-bar {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(190px, 1fr) minmax(140px, 1fr) minmax(220px, 1.3fr) auto;
  align-items: center;
  min-height: 74px;
  border-radius: 16px 16px 0 0;
  padding: 0 22px;
}

.system-stat {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  border-right: 1px solid rgba(255, 255, 255, 0.16);
  padding-right: 22px;
}

.system-stat > span:not(.eth-mark),
.system-stat div span {
  display: block;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-stat strong {
  display: block;
  margin-top: 5px;
  color: #f7f7f7;
  font-size: 0.95rem;
  font-weight: 900;
}

.system-stat em {
  color: var(--accent);
  font-style: normal;
}

.eth-mark {
  color: #9eb7ff;
  font-size: 1.85rem;
}

.sync-stat {
  justify-content: center;
  border-right: 0;
}

.operator-avatar {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 38%, #41454b, #0a0b0c 62%);
}

.operator-avatar span {
  width: 22px;
  height: 28px;
  border-radius: 50% 50% 45% 45%;
  background: linear-gradient(180deg, #b8b8b8, #050505 45%);
}

.app-header {
  align-items: end;
  margin-bottom: 18px;
  border-top: 0;
  border-radius: 0 0 16px 16px;
  padding: 26px 34px 22px;
  background:
    radial-gradient(circle at 28% 0%, rgba(255, 255, 255, 0.1), transparent 40%),
    linear-gradient(180deg, rgba(0, 0, 0, 0.28), rgba(0, 0, 0, 0.08));
}

.eyebrow {
  color: var(--accent);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
}

h1 {
  max-width: 980px;
  font-size: clamp(2.3rem, 4.8vw, 4.4rem);
  font-weight: 1000;
  letter-spacing: 0.035em;
  text-transform: uppercase;
  color: #eeeeee;
  text-shadow: 0 5px 0 #050505, 0 0 18px rgba(255, 255, 255, 0.18);
}

@media (max-width: 1500px) {
  h1 {
    max-width: 720px;
    font-size: clamp(2.15rem, 3.6vw, 3.25rem);
  }
}

.header-actions {
  align-items: center;
}

.button,
.icon-button,
.view-tab,
.rail-item {
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

.button {
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.18);
  border-radius: 7px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.025));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 8px 24px rgba(0, 0, 0, 0.25);
  text-transform: none;
}

.button.primary {
  color: #170405;
  border-color: rgba(255, 68, 74, 0.8);
  background: linear-gradient(180deg, #ff474f, #bb2229);
}

.button.subtle {
  background: rgba(255, 255, 255, 0.035);
}

.sync-pill,
.badge {
  border-color: rgba(255, 255, 255, 0.17);
  background: rgba(255, 255, 255, 0.04);
}

.status-panel {
  min-height: 96px;
  margin-bottom: 18px;
  border-radius: 8px;
  padding: 14px 18px;
}

.status-row {
  height: 100%;
}

.project-chip {
  display: flex;
  align-items: center;
  gap: 16px;
}

.project-emblem {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  flex: 0 0 64px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  color: var(--accent);
  background: radial-gradient(circle, rgba(255, 48, 54, 0.28), rgba(255, 255, 255, 0.06) 32%, rgba(0, 0, 0, 0.2));
  font-size: 2rem;
}

.project-label {
  display: block;
  margin-bottom: 4px;
  color: var(--accent) !important;
  font-size: 0.7rem;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-row strong {
  color: #f7f7f7;
  font-size: 1.05rem;
}

.status-meta .badge.listed {
  color: #ffffff;
  background: rgba(255, 48, 54, 0.16);
}

.view-switch {
  position: relative;
  align-items: stretch;
  gap: 8px;
  margin: 0;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
  padding: 0 0 0 0;
  background: rgba(16, 18, 20, 0.82);
}

.view-tab {
  min-width: 156px;
  min-height: 54px;
  border: 0;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 7px 7px 0 0;
  padding: 0 20px;
  color: var(--muted);
  background: transparent;
  font-size: 0.94rem;
  text-transform: uppercase;
}

.view-tab.active {
  color: #ffffff;
  border-top: 2px solid var(--accent);
  background: linear-gradient(180deg, rgba(255, 48, 54, 0.12), rgba(255, 255, 255, 0.02));
}

.view-tab.active::before {
  content: "▦";
  margin-right: 9px;
  color: var(--accent);
}

#codexViewButton.active::before { content: "▱"; }

.view-reset {
  align-self: center;
  margin: 8px 8px 8px auto;
}

.controls {
  grid-template-columns: minmax(210px, 1.45fr) repeat(7, minmax(132px, 1fr));
  margin: 0 0 18px;
  border-radius: 0 0 8px 8px;
  padding: 18px;
  background: rgba(17, 19, 21, 0.88);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 14px 44px rgba(0, 0, 0, 0.24);
}

.field span {
  color: #a9adb1;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
}

.field input,
.field select {
  min-height: 44px;
  border-color: rgba(255, 255, 255, 0.16);
  color: #f2f2f2;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.12)),
    #121416;
  box-shadow: inset 0 0 12px rgba(0, 0, 0, 0.28);
}

.field input:focus,
.field select:focus {
  border-color: rgba(255, 48, 54, 0.75);
  box-shadow: 0 0 0 3px rgba(255, 48, 54, 0.16);
}

.summary-grid {
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.metric-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 92px;
  padding: 18px;
}

.metric-card span,
.metric-label {
  color: #a6a8ab;
  letter-spacing: 0.06em;
}

.metric-card strong {
  color: #f2f2f2;
  font-size: clamp(1.35rem, 2.2vw, 2.1rem);
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.44);
}

.metric-card em {
  color: #bfb8ac;
  font-size: 1.55rem;
  font-style: normal;
  opacity: 0.8;
}

.section-heading {
  margin: 10px 0 10px;
}

.section-heading .eyebrow {
  margin-bottom: 3px;
}

.section-heading h2 {
  color: #d8d8d8;
  font-size: 1.5rem;
}

.result-count {
  color: #b9b9b9;
  font-weight: 700;
}

.nft-grid {
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
  gap: 14px;
}

.nft-card {
  border-color: rgba(255, 255, 255, 0.17);
  border-radius: 5px;
  background: linear-gradient(180deg, #202326, #101214);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.nft-card:hover {
  transform: translateY(-2px);
}

.image-button img {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.badge.listed,
.image-badge {
  color: #0b1c10;
  background: #7cff9b;
}

.nft-info {
  padding: 10px 10px 8px;
}

.nft-info strong {
  color: #ffffff;
  font-size: 0.95rem;
}

.nft-info span {
  color: #a6a8ab;
}

.nft-price {
  color: var(--accent);
  font-size: 0.72rem;
  text-transform: none;
}

.rank-box {
  width: 66px;
  min-height: 50px;
  border: 0;
  border-radius: 0;
  border-top: 0;
  background: transparent;
  color: var(--rank-text, var(--active-rank-text));
}

.rank-box span {
  font-size: 0.58rem;
}

.rank-box strong {
  font-size: 1.5rem;
}

.opensea-link {
  color: #32eaff;
  border-top-color: rgba(255, 255, 255, 0.12);
  font-size: 0.78rem;
}

.trait-section {
  background: rgba(17, 19, 21, 0.86);
}

.trait-card {
  border-color: rgba(255, 255, 255, 0.15);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(0, 0, 0, 0.18));
}

.trait-card:hover {
  border-color: rgba(255, 48, 54, 0.6);
  box-shadow: 0 0 24px rgba(255, 48, 54, 0.12);
}

.trait-footer {
  color: var(--accent);
}

.modal {
  background: #111315;
}

.factory-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: fit-content;
  min-width: 260px;
  min-height: 34px;
  margin: 18px auto 0;
  border-radius: 7px;
  color: #8f9295;
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.factory-footer strong {
  color: #606367;
  font-size: 1rem;
}

@media (max-width: 1280px) {
  .controls {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .search-field {
    grid-column: span 2;
  }

  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  :root {
    --rail-width: 0px;
  }

  .factory-rail {
    position: static;
    display: block;
    width: auto;
    min-height: auto;
    margin: 10px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: 12px;
  }

  .factory-rail::before,
  .factory-rail::after,
  .rail-core {
    display: none;
  }

  .factory-brand {
    margin: 0 0 10px;
  }

  .factory-nav {
    display: flex;
    overflow-x: auto;
  }

  .rail-item {
    min-width: 116px;
    min-height: 58px;
  }

  .app-shell {
    margin: 0;
    padding: 10px;
  }

  .system-bar {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    padding: 14px;
  }

  .system-stat {
    border-right: 0;
    padding-right: 0;
  }

  .operator-avatar {
    display: none;
  }

  .app-header {
    align-items: stretch;
    flex-direction: column;
    padding: 20px;
  }

  h1 {
    font-size: clamp(2rem, 11vw, 3.4rem);
  }

  .controls,
  .summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .search-field {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .system-bar,
  .controls,
  .summary-grid,
  .nft-detail {
    grid-template-columns: 1fr;
  }

  .view-switch {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .view-reset {
    grid-column: 1 / -1;
    width: auto;
    margin: 0 8px 8px;
  }

  .nft-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Exact sidebar image layer: visual rail comes from frontend/assets/factory-sidebar-reference.png. */
@media (min-width: 901px) {
  :root {
    --rail-width: clamp(140px, 19.52vh, 190px);
  }

  .factory-rail {
    display: block;
    width: var(--rail-width);
    padding: 0;
    border-right: 0;
    background: #050607 url("../assets/factory-sidebar-reference.png") center top / 100% 100% no-repeat;
    box-shadow: 12px 0 32px rgba(0, 0, 0, 0.42);
  }

  .factory-rail::before,
  .factory-rail::after,
  .factory-brand,
  .rail-core {
    display: none;
  }

  .factory-nav {
    position: absolute;
    inset: 0;
    display: block;
  }

  .rail-item {
    position: absolute;
    left: 17.5%;
    width: 49.5%;
    min-height: 0;
    border: 0;
    border-radius: 8px;
    padding: 0;
    color: transparent;
    background: transparent;
    box-shadow: none;
    overflow: hidden;
    white-space: nowrap;
  }

  .rail-item .rail-icon,
  .rail-item::before,
  .rail-item::after {
    display: none;
  }

  .rail-item:nth-child(1) {
    top: 25.1%;
    height: 7.5%;
  }

  .rail-item:nth-child(2) {
    top: 35.0%;
    height: 7.6%;
  }

  .rail-item:nth-child(3) {
    top: 44.8%;
    height: 7.6%;
  }

  .rail-item:nth-child(4) {
    top: 54.6%;
    height: 7.6%;
  }

  .rail-item:nth-child(5) {
    top: 64.4%;
    height: 7.6%;
  }

  .rail-item:nth-child(6) {
    top: 74.1%;
    height: 7.6%;
  }

  .rail-item:hover,
  .rail-item.active {
    background: rgba(255, 48, 54, 0.07);
    box-shadow: 0 0 24px rgba(255, 48, 54, 0.14), inset 0 0 14px rgba(255, 48, 54, 0.1);
    transform: none;
  }
}

@media (min-width: 901px) {
  .factory-rail .rail-item,
  .factory-rail .rail-item.active,
  .factory-rail .rail-item:hover,
  .factory-rail .rail-item.muted {
    color: transparent !important;
    font-size: 0 !important;
    text-shadow: none !important;
  }

  .factory-rail .rail-item .rail-icon {
    display: none !important;
  }
}

/* HD panel sidebar with real overlay logos */
@media (min-width: 901px) {
  :root {
    --rail-width: clamp(190px, 33.35vh, 280px);
  }

  .factory-rail {
    display: block;
    width: var(--rail-width);
    padding: 0;
    border-right: 0;
    background: #050607 url("../assets/factory-panel-hd.png") center top / 100% 100% no-repeat;
    box-shadow: 14px 0 38px rgba(0, 0, 0, 0.44);
  }

  .factory-rail::before,
  .factory-rail::after,
  .rail-core {
    display: none;
  }

  .factory-brand {
    position: absolute;
    top: 5.4%;
    left: 28%;
    display: block;
    width: 44%;
    margin: 0;
    pointer-events: none;
  }

  .factory-brand img {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.65));
  }

  .factory-nav {
    position: absolute;
    inset: 0;
    display: block;
  }

  .factory-rail .rail-item,
  .factory-rail .rail-item.active,
  .factory-rail .rail-item:hover,
  .factory-rail .rail-item.muted {
    position: absolute;
    left: 36.4%;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 7px;
    width: 27.2%;
    min-height: 0;
    height: 6.1%;
    border: 0;
    border-radius: 8px;
    padding: 0;
    color: #e9e9e9 !important;
    background: transparent;
    box-shadow: none;
    font-size: clamp(0.5rem, 1.36vh, 0.82rem) !important;
    font-weight: 1000;
    letter-spacing: 0.02em;
    line-height: 1;
    text-align: center;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.8);
    text-transform: uppercase;
    white-space: nowrap;
    overflow: visible;
  }

  .factory-rail .rail-item .rail-icon {
    display: block !important;
    width: clamp(21px, 3.45vh, 34px);
    height: clamp(21px, 3.45vh, 34px);
    object-fit: contain;
    filter: drop-shadow(0 0 8px rgba(255, 255, 255, 0.14));
  }

  .factory-rail .rail-item:nth-child(1) {
    top: 23.6%;
  }

  .factory-rail .rail-item:nth-child(2) {
    top: 31.1%;
  }

  .factory-rail .rail-item:nth-child(3) {
    top: 38.6%;
  }

  .factory-rail .rail-item:nth-child(4) {
    top: 46.0%;
    color: #9a9a9a !important;
  }

  .factory-rail .rail-item.active,
  .factory-rail .rail-item:hover {
    color: var(--accent) !important;
    background: radial-gradient(circle at 50% 50%, rgba(255, 48, 54, 0.1), transparent 62%);
    box-shadow: 0 0 26px rgba(255, 48, 54, 0.16), inset 0 0 12px rgba(255, 48, 54, 0.08);
    transform: none;
  }

  .factory-rail .rail-item.active .rail-icon,
  .factory-rail .rail-item:hover .rail-icon {
    filter: drop-shadow(0 0 8px rgba(255, 48, 54, 0.8));
  }

  .factory-rail .future-slot {
    color: transparent !important;
    opacity: 1;
  }

  .factory-rail .future-slot .rail-icon,
  .factory-rail .future-slot span {
    display: none !important;
  }

  .factory-rail .future-slot:hover {
    background: rgba(255, 255, 255, 0.025);
    box-shadow: inset 0 0 12px rgba(255, 255, 255, 0.035);
  }
}

/* Official HD panel and bitmap menu marks */
.factory-brand img {
  width: min(160px, 72vw);
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.project-emblem img {
  width: 92%;
  height: 92%;
  object-fit: contain;
  filter: drop-shadow(0 0 8px rgba(223, 42, 84, 0.28));
}

@media (min-width: 901px) {
  :root {
    --rail-width: clamp(150px, 19.06vh, 210px);
  }

  .factory-rail {
    display: block;
    width: var(--rail-width);
    height: 100vh;
    padding: 0;
    border-right: 0;
    background: #050607 url("../assets/factory-panel.png?v=20260531-1") center top / 100% 100% no-repeat;
    box-shadow: 14px 0 38px rgba(0, 0, 0, 0.44);
  }

  .factory-rail::before,
  .factory-rail::after,
  .rail-core {
    display: none !important;
  }

  .factory-brand {
    position: absolute;
    top: 7.1%;
    left: 20.6%;
    display: block !important;
    width: 58.8%;
    margin: 0;
    pointer-events: none;
  }

  .factory-brand img {
    width: 100%;
    max-width: none;
    filter: drop-shadow(0 3px 4px rgba(0, 0, 0, 0.65));
  }

  .factory-nav {
    position: absolute;
    inset: 0;
    display: block;
  }

  .factory-rail .rail-item,
  .factory-rail .rail-item.active,
  .factory-rail .rail-item:hover,
  .factory-rail .rail-item.muted {
    position: absolute;
    left: 24.4%;
    display: grid;
    place-items: center;
    width: 51.2%;
    min-height: 0;
    height: 9.5%;
    border: 0;
    border-radius: 10px;
    padding: 0;
    color: transparent !important;
    background: transparent;
    box-shadow: none;
    font-size: 0 !important;
    letter-spacing: 0;
    overflow: visible;
    text-shadow: none;
    transform: none;
  }

  .factory-rail .rail-label {
    display: none !important;
  }

  .factory-rail .rail-item .rail-icon {
    display: block !important;
    width: 60%;
    height: 76%;
    max-width: 72px;
    max-height: 72px;
    object-fit: contain;
    opacity: 0.92;
    filter: drop-shadow(0 0 7px rgba(255, 255, 255, 0.12));
  }

  .factory-rail .rail-item:nth-child(1) {
    top: 23.5%;
  }

  .factory-rail .rail-item:nth-child(2) {
    top: 34.0%;
  }

  .factory-rail .rail-item:nth-child(3) {
    top: 45.0%;
  }

  .factory-rail .rail-item:nth-child(4) {
    top: 55.8%;
  }

  .factory-rail .rail-item.active,
  .factory-rail .rail-item:hover {
    background: radial-gradient(circle at 50% 50%, rgba(223, 42, 84, 0.13), transparent 62%);
    box-shadow: 0 0 26px rgba(223, 42, 84, 0.18), inset 0 0 16px rgba(223, 42, 84, 0.08);
  }

  .factory-rail .rail-item.active .rail-icon,
  .factory-rail .rail-item:hover .rail-icon {
    opacity: 1;
    filter: drop-shadow(0 0 9px rgba(223, 42, 84, 0.72));
  }

  .factory-rail .future-slot,
  .factory-rail .future-slot:hover {
    background: transparent;
    box-shadow: none;
  }
}

/* Update 18: typography, layout breathing room, grid density and official ranking buttons */
@font-face {
  font-family: "Akira Expanded";
  src: url("../assets/fonts/akira-expanded-demo.otf") format("opentype");
  font-display: swap;
}

:root {
  --display-font: "Akira Expanded", "Arial Narrow", "Roboto Condensed", Inter, ui-sans-serif, system-ui, sans-serif;
}

.system-bar {
  display: none !important;
}

.app-shell {
  padding-top: 18px;
}

.app-header {
  margin-bottom: 18px;
}

.app-header h1,
.project-label,
.project-chip strong,
.view-tab,
.button,
.section-heading .eyebrow,
.section-heading h2,
.grid-density-button,
.result-count,
.rank-box span,
.rank-box strong {
  font-family: var(--display-font);
}

.app-header h1 {
  letter-spacing: 0.025em;
}

.button,
.view-tab,
.grid-density-button {
  letter-spacing: 0.02em;
}

.section-heading {
  justify-content: flex-start;
}

.section-heading > div {
  min-width: 0;
}

.result-count {
  margin-left: auto;
}

.grid-density-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 44px;
  border: 1px solid rgba(255, 48, 54, 0.5);
  border-radius: 7px;
  padding: 0 14px;
  color: #f2f2f2;
  background:
    linear-gradient(180deg, rgba(255, 48, 54, 0.14), rgba(255, 255, 255, 0.025)),
    rgba(10, 10, 10, 0.75);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 0 18px rgba(255, 48, 54, 0.12);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.grid-density-button:hover {
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 22px rgba(255, 48, 54, 0.2), inset 0 0 12px rgba(255, 48, 54, 0.08);
}

.grid-density-icon {
  color: var(--accent);
  font-size: 1rem;
  line-height: 1;
}

.nft-grid.grid-dense {
  grid-template-columns: repeat(auto-fill, minmax(154px, 1fr));
}

.nft-grid.grid-large {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 18px;
}

.nft-card {
  overflow: hidden;
}

.nft-card[data-rank-mode="general"]:hover {
  border-color: #ff1636;
  box-shadow:
    0 0 0 1px rgba(255, 22, 54, 0.78),
    0 0 22px rgba(255, 22, 54, 0.78),
    0 0 48px rgba(255, 22, 54, 0.46),
    inset 0 0 22px rgba(255, 22, 54, 0.12);
}

.nft-card[data-rank-mode="faction"]:hover {
  border-color: var(--rank-color);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--rank-color) 72%, transparent),
    0 0 28px color-mix(in srgb, var(--rank-color) 52%, transparent),
    inset 0 0 18px color-mix(in srgb, var(--rank-color) 14%, transparent);
}

.image-button > img {
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.rank-box {
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  align-content: center;
  width: 76px;
  min-height: 0;
  aspect-ratio: 1 / 1;
  overflow: visible;
  background: transparent;
}

.rank-box .rank-frame {
  position: absolute;
  inset: -25%;
  z-index: 0;
  width: 150%;
  max-width: none;
  height: 150%;
  aspect-ratio: auto;
  object-fit: contain;
  background: transparent;
  pointer-events: none;
}

.rank-box span {
  position: relative;
  z-index: 1;
  margin-top: 10%;
  color: var(--rank-text, var(--active-rank-text));
  font-size: 0.58rem;
  line-height: 1;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.85);
}

.rank-box strong {
  position: relative;
  z-index: 1;
  margin: 2px 0 0;
  color: var(--rank-text, var(--active-rank-text));
  font-size: 1.72rem;
  line-height: 0.86;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.9), 0 0 10px color-mix(in srgb, var(--rank-text, #df2a54) 55%, transparent);
}

.rank-box strong.one-of-one {
  font-size: 1.08rem;
  line-height: 0.98;
}

.opensea-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  width: fit-content;
  min-height: 30px;
  margin: 0 10px 10px;
  border: 0;
  border-radius: 3px;
  padding: 0 10px;
  color: #05131f;
  background: #ffffff;
  font-family: var(--display-font);
  font-size: 0.68rem;
  line-height: 1;
  text-transform: none;
  box-shadow: 0 0 16px rgba(255, 255, 255, 0.08);
}

.opensea-link:hover {
  color: #071827;
  background: #dff3ff;
}

.opensea-link img {
  width: 16px;
  height: 16px;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  background: transparent;
}

.nft-grid.grid-large .nft-info {
  padding: 13px 14px 10px;
}

.nft-grid.grid-large .nft-info strong {
  font-size: 1.12rem;
}

.nft-grid.grid-large .nft-side {
  min-width: 96px;
}

.nft-grid.grid-large .rank-box {
  width: 96px;
}

.nft-grid.grid-large .rank-box span {
  font-size: 0.72rem;
}

.nft-grid.grid-large .rank-box strong {
  font-size: 2.2rem;
}

.nft-grid.grid-large .rank-box strong.one-of-one {
  font-size: 1.34rem;
}

.nft-grid.grid-large .opensea-link {
  min-height: 34px;
  margin: 0 14px 14px;
  padding: 0 12px;
  font-size: 0.78rem;
}

@media (max-width: 1500px) {
  .nft-grid.grid-large {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 1180px) {
  .nft-grid.grid-large {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .section-heading {
    flex-wrap: wrap;
  }

  .result-count {
    margin-left: 0;
  }

  .nft-grid.grid-large {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  .grid-density-button {
    width: 100%;
  }

  .nft-grid.grid-large,
  .nft-grid.grid-dense {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Update 20: cleaner card labels, tiny Open y link, adaptive rank typography */
.nft-info {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(76px, 33%, 98px);
  align-items: end;
  gap: 8px;
  padding: 10px;
}

.nft-main {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 6px;
}

.nft-token-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  min-width: 0;
  gap: 2px;
}

.nft-token-row strong {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.05;
  white-space: nowrap;
}

.nft-token-row .nft-price {
  justify-self: start;
  max-width: 100%;
  overflow: hidden;
  color: #ff3d4d;
  font-size: 0.58rem;
  line-height: 1.05;
  text-align: left;
  text-overflow: clip;
  white-space: nowrap;
}

.nft-token-row .nft-price:not(.not-listed) {
  color: #ff4a55;
  font-size: 0.6rem;
}

.faction-line {
  display: inline-grid !important;
  width: fit-content;
  max-width: min(78px, 100%);
  align-items: center;
  justify-items: center;
  gap: 3px;
}

.faction-line .faction-logo {
  width: 19px;
  height: 19px;
  margin: 0;
}

.faction-line .faction-name {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  color: #b8bdc3;
  font-size: 0.72rem;
  line-height: 1.02;
  text-align: center;
  white-space: normal;
}

.nft-side {
  display: grid;
  width: 100%;
  min-width: 0;
  justify-items: center;
  align-content: end;
}

.rank-box {
  width: clamp(72px, 100%, 88px);
  margin: 0 auto;
}

.rank-box span {
  margin: 13% 0 4px;
  font-size: 0.54rem;
  letter-spacing: 0.08em;
}

.rank-box strong {
  display: block;
  max-width: 68%;
  margin: 0;
  overflow: hidden;
  font-size: 1.42rem;
  letter-spacing: 0;
  line-height: 1;
  text-align: center;
  text-overflow: clip;
  white-space: nowrap;
}

.rank-box strong.one-of-one {
  font-size: 0.74rem;
  letter-spacing: 0;
  line-height: 1.1;
  white-space: nowrap;
}

.rank-box strong.rank-digits-3 {
  font-size: 1.1rem;
}

.rank-box strong.rank-digits-4 {
  font-size: 0.82rem;
}

.opensea-link {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  width: fit-content;
  min-height: 18px;
  margin: 2px 0 0;
  border: 0;
  border-radius: 0;
  padding: 0;
  color: #ffffff;
  background: transparent;
  box-shadow: none;
  font-family: Inter, ui-sans-serif, system-ui, sans-serif;
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1;
  opacity: 0.92;
}

.opensea-link:hover {
  color: #ffffff;
  background: transparent;
  opacity: 1;
}

.opensea-link img {
  display: none;
}

.opensea-link span {
  color: currentColor;
  font-size: inherit;
  line-height: inherit;
}

.nft-grid.grid-large .nft-info {
  grid-template-columns: minmax(0, 1fr) 96px;
  padding: 12px 14px 13px;
}

.nft-grid.grid-large .faction-line {
  max-width: 92px;
}

.nft-grid.grid-large .faction-line .faction-name {
  font-size: 0.82rem;
}

.nft-grid.grid-large .rank-box {
  width: 90px;
}

.nft-grid.grid-large .rank-box span {
  font-size: 0.66rem;
}

.nft-grid.grid-large .rank-box strong {
  font-size: 1.74rem;
}

.nft-grid.grid-large .rank-box strong.one-of-one {
  font-size: 0.88rem;
}

.nft-grid.grid-large .rank-box strong.rank-digits-3 {
  font-size: 1.3rem;
}

.nft-grid.grid-large .rank-box strong.rank-digits-4 {
  font-size: 0.98rem;
}

.nft-grid.grid-large .opensea-link {
  min-height: 20px;
  margin: 4px 0 0;
  padding: 0;
  font-size: 0.72rem;
}

@media (max-width: 620px) {
  .nft-info {
    grid-template-columns: minmax(0, 1fr) 74px;
    gap: 6px;
    padding: 8px;
  }

  .nft-grid.grid-large .nft-info {
    grid-template-columns: minmax(0, 1fr) 78px;
    padding: 9px;
  }

  .rank-box,
  .nft-grid.grid-large .rank-box {
    width: 74px;
  }
}

/* Update 21: final NFT card layout and compact category codex */
.app-header {
  margin-bottom: 12px;
  padding: 16px 28px 14px;
}

.app-header h1 {
  max-width: 760px;
  font-size: clamp(1.9rem, 3.1vw, 3.35rem);
}

.app-header .eyebrow {
  margin-bottom: 4px;
  font-size: 0.68rem;
}

.nft-info {
  grid-template-columns: minmax(68px, 1fr) clamp(74px, 40%, 90px);
  grid-template-rows: auto 1fr;
  align-items: start;
  gap: 5px 8px;
  padding: 10px 12px 12px;
}

.nft-topline {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: minmax(0, 1fr) clamp(74px, 40%, 90px);
  align-items: start;
  gap: 8px;
  min-width: 0;
}

.nft-topline strong {
  min-width: 0;
  overflow: hidden;
  color: #ffffff;
  line-height: 1.02;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nft-topline .nft-price {
  justify-self: center;
  max-width: 100%;
  overflow: hidden;
  color: #ff3b4d;
  font-family: var(--display-font);
  font-size: 0.54rem;
  font-weight: 1000;
  line-height: 1.05;
  text-align: center;
  text-overflow: clip;
  text-transform: uppercase;
  white-space: nowrap;
}

.nft-topline .nft-price:not(.not-listed) {
  color: #ff3b4d;
  font-size: 0.52rem;
}

.nft-main {
  grid-column: 1;
  grid-row: 2;
  align-content: start;
  justify-items: center;
  gap: 7px;
  min-width: 0;
  padding-top: 3px;
}

.nft-side {
  grid-column: 2;
  grid-row: 2;
  justify-items: center;
  align-content: start;
  min-width: 0;
  padding-top: 1px;
}

.faction-line {
  display: grid !important;
  width: min(78px, 100%);
  min-height: 52px;
  border-radius: 2px;
  padding: 5px 4px;
  place-items: center;
  gap: 3px;
  background: rgba(0, 0, 0, 0.68);
}

.faction-line .faction-logo {
  width: 28px;
  height: 28px;
  margin: 0;
  object-fit: contain;
}

.faction-line .faction-name {
  max-width: 100%;
  margin: 0;
  overflow-wrap: anywhere;
  color: #d7dce1;
  font-size: 0.76rem;
  font-weight: 800;
  line-height: 1;
  text-align: center;
  white-space: normal;
}

.opensea-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-width: 72px;
  min-height: 25px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  padding: 0 12px;
  color: #ffffff;
  background: #1f9cff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 0 10px rgba(31, 156, 255, 0.16);
  font-family: var(--display-font);
  font-size: 0.48rem;
  font-weight: 1000;
  letter-spacing: 0;
  line-height: 1;
  opacity: 1;
  text-transform: uppercase;
}

.opensea-link:hover {
  color: #ffffff;
  background: #36a9ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.34), 0 0 14px rgba(31, 156, 255, 0.26);
}

.rank-box {
  width: clamp(72px, 100%, 86px);
}

.rank-box span {
  margin: 13% 0 4px;
  font-size: 0.52rem;
}

.rank-box strong {
  max-width: 70%;
  font-size: 1.4rem;
}

.rank-box strong.one-of-one {
  font-size: 0.74rem;
}

.rank-box strong.rank-digits-3 {
  font-size: 1.08rem;
}

.rank-box strong.rank-digits-4 {
  font-size: 0.82rem;
}

.nft-grid.grid-large .nft-info {
  grid-template-columns: minmax(82px, 1fr) 96px;
  padding: 13px 16px 14px;
}

.nft-grid.grid-large .nft-topline {
  grid-template-columns: minmax(0, 1fr) 96px;
}

.nft-grid.grid-large .nft-topline .nft-price {
  font-size: 0.62rem;
}

.nft-grid.grid-large .faction-line {
  width: 92px;
  min-height: 62px;
}

.nft-grid.grid-large .faction-line .faction-logo {
  width: 34px;
  height: 34px;
}

.nft-grid.grid-large .faction-line .faction-name {
  font-size: 0.86rem;
}

.nft-grid.grid-large .opensea-link {
  min-width: 86px;
  min-height: 30px;
  margin: 0;
  padding: 0 14px;
  font-size: 0.56rem;
}

.nft-grid.grid-large .rank-box {
  width: 94px;
}

.nft-grid.grid-large .rank-box strong {
  font-size: 1.72rem;
}

.nft-grid.grid-large .rank-box strong.one-of-one {
  font-size: 0.9rem;
}

.nft-grid.grid-large .rank-box strong.rank-digits-3 {
  font-size: 1.3rem;
}

.nft-grid.grid-large .rank-box strong.rank-digits-4 {
  font-size: 1rem;
}

.field.is-disabled {
  opacity: 0.42;
}

.field.is-disabled select,
.field.is-disabled input {
  cursor: not-allowed;
  color: #7b8085;
  border-color: rgba(255, 255, 255, 0.09);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.025), rgba(0, 0, 0, 0.16)), #101113;
}

.trait-codex {
  gap: 10px;
}

.trait-section {
  overflow: hidden;
  padding: 0;
}

.category-heading {
  appearance: none;
  display: grid;
  grid-template-columns: 104px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  width: 100%;
  min-height: 126px;
  margin: 0;
  border: 0;
  padding: 14px 16px;
  color: inherit;
  cursor: pointer;
  font: inherit;
  background:
    radial-gradient(circle at 8% 16%, color-mix(in srgb, var(--accent) 18%, transparent), transparent 26%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.1));
  text-align: left;
}

.category-heading:hover {
  background:
    radial-gradient(circle at 8% 16%, color-mix(in srgb, var(--accent) 24%, transparent), transparent 28%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.05), rgba(0, 0, 0, 0.08));
}

.category-heading img {
  width: 104px;
  height: 104px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 6px;
  object-fit: cover;
}

.category-copy {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.category-kicker {
  color: var(--accent) !important;
  font-family: var(--display-font);
  font-size: 0.58rem !important;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.category-copy strong {
  overflow: hidden;
  color: #f1f1f1;
  font-family: var(--display-font);
  font-size: clamp(1.05rem, 2vw, 1.8rem);
  line-height: 1.05;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.category-copy span:last-child {
  color: #aeb3b8;
  font-size: 0.9rem;
}

.category-toggle {
  min-width: 92px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 9px 14px;
  color: #ffffff !important;
  background: rgba(255, 48, 54, 0.16);
  font-family: var(--display-font);
  font-size: 0.58rem !important;
  text-align: center;
  text-transform: uppercase;
}

.trait-section.expanded .category-heading {
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.trait-section.expanded .trait-grid {
  padding: 14px;
}

@media (max-width: 720px) {
  .app-header {
    padding: 16px;
  }

  .category-heading {
    grid-template-columns: 78px minmax(0, 1fr);
    min-height: 98px;
  }

  .category-heading img {
    width: 78px;
    height: 78px;
  }

  .category-toggle {
    grid-column: 1 / -1;
    width: 100%;
  }

  .opensea-link {
    min-width: 58px;
    min-height: 22px;
    padding: 0 8px;
    font-size: 0.42rem;
  }
}

/* Update 22: richer trait modal, 1:1 bitmap rank, clearer rail labels */
.nft-topline .nft-price {
  font-size: 0.62rem;
  font-weight: 1000;
}

.nft-topline .nft-price:not(.not-listed) {
  font-size: 0.6rem;
}

.nft-grid.grid-large .nft-topline .nft-price {
  font-size: 0.68rem;
}

.nft-grid.grid-large .nft-topline .nft-price:not(.not-listed) {
  font-size: 0.66rem;
}

.rank-value-image {
  position: relative;
  z-index: 1;
  display: block;
  width: min(50px, 68%) !important;
  height: auto !important;
  aspect-ratio: 191 / 64 !important;
  margin: 2px auto 0;
  object-fit: contain;
  background: transparent !important;
  filter: drop-shadow(0 2px 0 rgba(0, 0, 0, 0.9));
}

.nft-grid.grid-large .rank-value-image {
  width: min(61px, 70%) !important;
}

.trait-list button {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 64px;
}

.modal-trait-main {
  display: grid;
  min-width: 0;
  gap: 5px;
}

.modal-trait-category {
  color: var(--muted) !important;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  line-height: 1;
  text-transform: uppercase;
}

.modal-trait-main strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 1rem;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal-trait-stats {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  min-width: 0;
  color: #c5c9ce !important;
  font-size: 0.72rem !important;
  font-weight: 800;
  line-height: 1;
  white-space: nowrap;
}

.rarity-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 22px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 0 9px;
  font-family: var(--display-font);
  font-size: 0.48rem;
  font-style: normal;
  font-weight: 1000;
  line-height: 1;
  text-transform: uppercase;
}

.rarity-grail {
  color: #08100b;
  border-color: rgba(255, 236, 92, 0.78);
  background: linear-gradient(180deg, #fff15c, #ffb300);
  box-shadow: 0 0 14px rgba(255, 211, 47, 0.28);
}

.rarity-legendary {
  color: #fff5fb;
  border-color: rgba(244, 174, 217, 0.72);
  background: rgba(244, 174, 217, 0.22);
}

.rarity-rare {
  color: #d7f7ff;
  border-color: rgba(46, 232, 255, 0.62);
  background: rgba(46, 232, 255, 0.16);
}

.rarity-common {
  color: #c7cbd0;
  background: rgba(255, 255, 255, 0.06);
}

@media (min-width: 901px) {
  .factory-rail .rail-item,
  .factory-rail .rail-item.active,
  .factory-rail .rail-item:hover,
  .factory-rail .rail-item.muted {
    grid-template-rows: minmax(0, 1fr) auto;
    align-content: center;
    justify-items: center;
    gap: 3px;
    padding: 7px 4px 6px;
    color: #9ca0a5 !important;
    font-size: clamp(0.38rem, 0.78vh, 0.58rem) !important;
    line-height: 1.05;
  }

  .factory-rail .rail-label {
    display: block !important;
    width: 100%;
    max-width: 100%;
    overflow: hidden;
    color: #9ca0a5;
    font-family: var(--display-font);
    font-size: inherit;
    line-height: 1.05;
    text-align: center;
    text-overflow: clip;
    text-shadow: 0 2px 2px rgba(0, 0, 0, 0.82);
    text-transform: uppercase;
    white-space: normal;
  }

  .factory-rail .rail-item .rail-icon {
    width: 54%;
    height: 56%;
    max-width: 54px;
    max-height: 50px;
    justify-self: center;
    align-self: end;
    opacity: 0.84;
    filter: grayscale(1) brightness(1.18) drop-shadow(0 0 7px rgba(255, 255, 255, 0.12));
  }

  .factory-rail .rail-item.active,
  .factory-rail .rail-item:hover {
    color: var(--accent) !important;
  }

  .factory-rail .rail-item.active .rail-label,
  .factory-rail .rail-item:hover .rail-label {
    color: var(--accent);
  }

  .factory-rail .rail-item.active .rail-icon,
  .factory-rail .rail-item:hover .rail-icon {
    opacity: 1;
    filter: grayscale(0) drop-shadow(0 0 8px rgba(223, 42, 84, 0.72));
  }

  .factory-rail .future-slot .rail-label {
    display: none !important;
  }
}

@media (max-width: 720px) {
  .trait-list button {
    grid-template-columns: 1fr;
  }

  .modal-trait-stats {
    justify-content: flex-start;
    flex-wrap: wrap;
    white-space: normal;
  }
}

/* Update 23: denser card status fit and brighter modal trait stats */
.nft-grid:not(.grid-large) .nft-topline {
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px;
}

.nft-grid:not(.grid-large) .nft-topline .nft-price {
  justify-self: center;
  width: auto;
  max-width: 100%;
  color: #ff3b4d;
  font-size: 0.7rem;
  font-weight: 1000;
  line-height: 1.05;
  text-align: center;
  transform: none;
}

.nft-grid:not(.grid-large) .nft-topline .nft-price:not(.not-listed) {
  font-size: 0.74rem;
}

.nft-grid.grid-large .nft-topline .nft-price {
  justify-self: center;
  width: auto;
  max-width: 100%;
  text-align: center;
  transform: none;
}

.modal-trait-stats {
  color: #ffffff !important;
  font-size: 0.86rem !important;
  font-weight: 1000;
}

.modal-trait-stats > span {
  color: #ffffff !important;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.65);
}

@media (max-width: 640px) {
  .nft-grid:not(.grid-large) .nft-topline {
    grid-template-columns: minmax(46px, 1fr) minmax(92px, 92px);
  }

  .nft-grid:not(.grid-large) .nft-topline .nft-price {
    width: 92px;
    max-width: 92px;
    font-size: 0.62rem;
    transform: translateX(-3px);
  }

  .nft-grid:not(.grid-large) .nft-topline .nft-price:not(.not-listed) {
    font-size: 0.64rem;
  }
}

/* Update 27: Alpha Chaser protocol */
#alphaViewButton.active::before {
  content: "⌖";
}

.alpha-field {
  border-color: rgba(255, 48, 63, 0.74) !important;
  background:
    radial-gradient(circle at 18% 0%, rgba(255, 48, 63, 0.2), transparent 36%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(0, 0, 0, 0.2)) !important;
  box-shadow: 0 0 0 1px rgba(255, 48, 63, 0.18), 0 0 18px rgba(255, 48, 63, 0.08);
}

.alpha-field[hidden] {
  display: none !important;
}

.alpha-field span {
  color: var(--accent) !important;
}

.alpha-field select {
  border-color: rgba(255, 48, 63, 0.4) !important;
}

.alpha-protocol {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 16px;
  border: 1px solid rgba(255, 48, 63, 0.22);
  border-radius: 8px;
  padding: 18px 20px;
  background:
    radial-gradient(circle at 8% 20%, rgba(255, 48, 63, 0.18), transparent 32%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055), 0 16px 36px rgba(0, 0, 0, 0.28);
}

.alpha-protocol h2 {
  margin: 3px 0 6px;
  color: #f4f4f4;
  font-family: var(--display-font);
  font-size: clamp(1.15rem, 2.2vw, 2rem);
  line-height: 1.05;
  text-transform: uppercase;
}

.alpha-protocol p:not(.eyebrow) {
  max-width: 680px;
  margin: 0;
  color: #aeb4ba;
  font-size: 0.92rem;
  line-height: 1.4;
}

.alpha-scan-button {
  flex: 0 0 auto;
}

.alpha-summary-grid .metric-card {
  border-color: rgba(255, 48, 63, 0.2);
}

.alpha-card-tags {
  display: grid !important;
  width: min(92px, 100%);
  gap: 3px;
  margin: 0;
}

.alpha-card-tags span {
  overflow: hidden;
  border: 1px solid rgba(255, 48, 63, 0.32);
  border-radius: 999px;
  padding: 3px 7px;
  color: #ffffff !important;
  background: rgba(255, 48, 63, 0.13);
  font-family: var(--display-font);
  font-size: 0.42rem !important;
  line-height: 1;
  text-align: center;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.nft-grid.grid-large .alpha-card-tags {
  width: min(108px, 100%);
}

.nft-grid.grid-large .alpha-card-tags span {
  font-size: 0.48rem !important;
}

@media (max-width: 720px) {
  .alpha-protocol {
    display: grid;
    padding: 16px;
  }

  .alpha-scan-button {
    width: 100%;
  }
}

/* Update 19: wallet scanner view */
.controls[hidden],
.view-reset[hidden] {
  display: none !important;
}

.wallet-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1.1fr);
  align-items: end;
  gap: 18px;
  margin-bottom: 18px;
  border: 1px solid rgba(255, 48, 63, 0.24);
  border-radius: 8px;
  padding: 18px 20px;
  background:
    radial-gradient(circle at 8% 20%, rgba(255, 48, 63, 0.16), transparent 34%),
    linear-gradient(135deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.012));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055), 0 16px 36px rgba(0, 0, 0, 0.28);
}

.wallet-panel h2 {
  margin: 3px 0 0;
  color: #f4f4f4;
  font-family: var(--display-font);
  font-size: clamp(1.15rem, 2.2vw, 2rem);
  line-height: 1.05;
  text-transform: uppercase;
}

.wallet-lookup {
  display: grid;
  gap: 10px;
}

.wallet-address-field input {
  min-height: 46px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
}

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

.wallet-actions .button {
  min-width: 136px;
}

.wallet-error {
  border: 1px solid rgba(255, 95, 112, 0.45);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--error);
  background: rgba(255, 95, 112, 0.09);
  font-size: 0.88rem;
  font-weight: 800;
}

.wallet-summary-grid .metric-card {
  border-color: rgba(255, 48, 63, 0.2);
}

.wallet-state {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  grid-column: 1 / -1;
}

.wallet-breakdown {
  display: grid;
  gap: 14px;
  margin-top: 22px;
  border: 1px solid rgba(255, 48, 63, 0.2);
  border-radius: 8px;
  padding: 16px;
  background: rgba(10, 18, 34, 0.72);
  box-shadow: var(--shadow);
}

.wallet-breakdown:empty {
  display: none;
}

.wallet-breakdown-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.wallet-breakdown-header h3 {
  color: #f4f4f4;
  font-family: var(--display-font);
  font-size: 1.1rem;
  text-transform: uppercase;
}

.wallet-breakdown-chips {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.wallet-breakdown-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid rgba(255, 48, 63, 0.26);
  border-radius: 999px;
  padding: 5px 9px;
  color: #ffffff;
  background: rgba(255, 48, 63, 0.1);
  font-size: 0.76rem;
  font-weight: 900;
  text-transform: uppercase;
}

.wallet-breakdown-chip span {
  color: var(--muted);
}

.wallet-trait-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.wallet-trait-row {
  display: flex;
  align-items: stretch;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  border: 1px solid rgba(118, 210, 255, 0.16);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.035);
  text-align: left;
}

.wallet-trait-row:hover {
  border-color: rgba(255, 48, 63, 0.42);
  background: rgba(255, 48, 63, 0.08);
}

.wallet-trait-main,
.wallet-trait-stats {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.wallet-trait-main span,
.wallet-trait-stats span {
  overflow: hidden;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.wallet-trait-main strong {
  overflow: hidden;
  color: #ffffff;
  font-size: 0.94rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wallet-trait-stats {
  justify-items: end;
  flex: 0 0 auto;
  text-align: right;
}

@media (max-width: 900px) {
  .wallet-panel,
  .wallet-breakdown-header {
    display: grid;
  }

  .wallet-panel {
    grid-template-columns: 1fr;
  }

  .wallet-actions .button {
    flex: 1 1 150px;
  }

  .wallet-breakdown-chips {
    justify-content: flex-start;
  }
}

@media (max-width: 620px) {
  .wallet-panel,
  .wallet-breakdown {
    padding: 14px;
  }

  .wallet-trait-row {
    display: grid;
  }

  .wallet-trait-stats {
    justify-items: start;
    text-align: left;
  }
}
