.theme-hub { display: flex; flex-direction: column; gap: 12px; }
.theme-hub-intro { display: flex; align-items: end; justify-content: space-between; gap: 12px; }
.theme-hub-intro span { color: var(--accent-hi); font-size: 10px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.theme-hub-intro h3 { margin: 3px 0 0; color: var(--text); font: 800 19px/1.05 var(--font-display); letter-spacing: -.035em; }
.theme-hub-intro strong { color: var(--text-mute); font-size: 11px; white-space: nowrap; }
.theme-hub-controls { display: flex; flex-direction: column; gap: 9px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--bg-card); }
.theme-hub-search { display: grid; gap: 5px; color: var(--text-mute); font-size: 10px; font-weight: 700; }
.theme-hub-search input, .theme-hub-sort select { min-height: 40px; width: 100%; border: 1px solid var(--border); border-radius: var(--radius-chip); background: var(--bg-card-2); color: var(--text); font: 600 13px var(--font-body); outline: none; }
.theme-hub-search input { padding: 0 12px; }
.theme-hub-search input::placeholder { color: var(--text-mute); }
.theme-hub-search input:focus, .theme-hub-sort select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.theme-hub-control-row { display: grid; grid-template-columns: minmax(0, 1fr) 118px; gap: 8px; align-items: end; }
.theme-hub-segments { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; padding: 3px; border-radius: var(--radius-chip); background: var(--bg-card-2); }
.theme-hub-segment, .theme-hub-scope-btn { min-width: 0; border: 0; background: transparent; color: var(--text-mute); font: 700 10px var(--font-body); cursor: pointer; }
.theme-hub-segment { min-height: 34px; border-radius: 9px; }
.theme-hub-segment.is-selected { background: var(--accent); color: #17120a; }
.theme-hub-sort { display: grid; gap: 5px; color: var(--text-mute); font-size: 10px; font-weight: 700; }
.theme-hub-sort select { padding: 0 27px 0 9px; font-size: 11px; }
.theme-hub-scope { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.theme-hub-scope::-webkit-scrollbar { display: none; }
.theme-hub-scope-btn { flex: 0 0 auto; min-height: 32px; padding: 0 11px; border: 1px solid var(--border); border-radius: var(--radius-chip); }
.theme-hub-scope-btn.is-selected { border-color: var(--border-hot); background: var(--accent-dim); color: var(--accent-hi); }
.theme-hub-results { display: flex; flex-direction: column; gap: 10px; }
.theme-hub-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.theme-hub-grid > :only-child { grid-column: 1 / -1; min-height: 244px; }

/* Card shell: flex column keeps CTA inside bounds on all widths */
.theme-hub-card {
  position: relative;
  min-height: 184px;
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--bg-card);
  isolation: isolate;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  box-sizing: border-box;
}
.theme-hub-card.is-featured { min-height: 244px; }
.theme-hub-card.is-current { border-color: var(--border-hot); box-shadow: inset 0 0 0 1px var(--accent-soft); }
.theme-hub-media, .theme-hub-media > * { position: absolute !important; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.theme-hub-shade {
  position: absolute;
  inset: 0;
  z-index: 1;
  background: linear-gradient(180deg, transparent 18%, rgba(7,8,10,.26) 43%, rgba(7,8,10,.94) 100%);
  pointer-events: none;
}
.theme-hub-card-copy {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
  padding: 12px;
  color: #fff;
}
.theme-hub-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}
.theme-hub-card-top > div { min-width: 0; flex: 1 1 auto; }
.theme-hub-card-foot {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 8px;
  min-width: 0;
  width: 100%;
}
.theme-hub-card h3 {
  margin: 0;
  overflow: hidden;
  color: #fff;
  font: 800 14px/1.1 var(--font-display);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-hub-card p {
  margin: 3px 0 0;
  overflow: hidden;
  color: rgba(255,255,255,.66);
  font-size: 10px;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.theme-hub-current {
  flex: 0 0 auto;
  color: var(--accent-hi);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}
.theme-hub-sales {
  color: rgba(255,255,255,.58);
  font-size: 9px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.theme-hub-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: var(--radius-chip);
  font: 800 11px/1.1 var(--font-body);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.theme-hub-action.is-buy { background: var(--accent); color: #17120a; }
.theme-hub-action.is-apply { border-color: rgba(255,255,255,.22); background: rgba(12,13,15,.64); color: #fff; }
.theme-hub-action.is-active { border-color: rgba(255,255,255,.12); background: rgba(255,255,255,.08); color: rgba(255,255,255,.62); cursor: default; }
.theme-hub-card:active .theme-hub-action:not(:disabled),
.theme-hub-segment:active,
.theme-hub-scope-btn:active { transform: scale(.97); }

.theme-hub-notice { padding: 9px 11px; border-left: 2px solid var(--accent); background: var(--accent-dim); color: var(--text-sub); font-size: 11px; }
.theme-hub-state { display: grid; justify-items: start; gap: 6px; min-height: 170px; align-content: center; padding: 20px; border: 1px dashed var(--border); border-radius: var(--radius-card); background: var(--bg-card); }
.theme-hub-state-mark { display: grid; width: 30px; height: 30px; place-items: center; border-radius: 10px; background: var(--accent-dim); color: var(--accent-hi); font-weight: 900; }
.theme-hub-state h3 { margin: 2px 0 0; color: var(--text); font: 800 16px var(--font-display); }
.theme-hub-state p { margin: 0; color: var(--text-mute); font-size: 12px; }
.theme-hub-retry, .theme-hub-reset-theme { min-height: 38px; border: 1px solid var(--border-hot); border-radius: var(--radius-chip); background: var(--accent-dim); color: var(--accent-hi); font: 800 11px var(--font-body); cursor: pointer; }
.theme-hub-retry { margin-top: 5px; padding: 0 14px; }
.theme-hub-reset-theme { width: 100%; }
.theme-hub-skeleton { min-height: 184px; border-radius: var(--radius-card); background: linear-gradient(100deg, var(--bg-card) 20%, var(--bg-card-2) 45%, var(--bg-card) 70%); background-size: 220% 100%; animation: theme-hub-shimmer 1.2s linear infinite; }
.theme-hub-skeleton-featured { min-height: 244px; }
@keyframes theme-hub-shimmer { to { background-position: -220% 0; } }

@media (max-width: 390px) {
  .theme-hub-control-row { grid-template-columns: 1fr; }
  .theme-hub-sort { grid-template-columns: 70px 1fr; align-items: center; }
  .theme-hub-action { font-size: 10px; min-height: 32px; padding: 0 10px; }
  .theme-hub-card-copy { padding: 10px; gap: 8px; }
}
@media (min-width: 720px) {
  .theme-hub-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .theme-hub-card { min-height: 200px; }
}
@media (prefers-reduced-motion: reduce) {
  .theme-hub-skeleton { animation: none; }
}
