/* ============================================================
   HUB PAGES — Lounge & Market (tab-switcher layouts)
   ============================================================ */

.lg-page {
  padding-bottom: 0;
}

/* ---------- segmented tab bar ---------- */

.lg-tabs {
  position: sticky; top: 0;
  z-index: 20;
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 6px;
  margin: 10px 12px;
  border-radius: 16px;
  background: var(--card, #1A1F2E);
  border: 1px solid var(--stroke, rgba(255,255,255,.1));
  box-shadow: 0 6px 18px rgba(0,0,0,.3);
}

.lg-tab {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 8px;
  border: none; border-radius: 12px;
  background: transparent;
  color: var(--text-muted, rgba(255,255,255,.55));
  font-family: Manrope, sans-serif;
  font-size: 12px; font-weight: 800; letter-spacing: 1.5px;
  cursor: pointer;
  transition: background .18s ease, color .18s ease, box-shadow .18s ease;
}

.lg-tab svg { width: 15px; height: 15px; }

.lg-tab.active {
  background: var(--lg-tab-active, var(--gradient));
  color: var(--on-accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.24),
    0 4px 14px -7px rgba(var(--accent-b-rgb), .55);
}

.lg-tab:active { transform: scale(.97); }

/* ---------- content host ---------- */

.lg-content {
  min-height: 60vh;
}

/* ============================================================
   MUSIC PLACEHOLDER (tab: coming soon)
   ============================================================ */

.lg-placeholder {
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  gap: 14px;
  padding: 60px 24px 40px;
  min-height: 70vh;
  text-align: center;
}

.lg-ph-art {
  position: relative;
  margin-bottom: 6px;
}

/* disc artwork (reused design) */
.lg-disc {
  position: relative;
  width: 96px; height: 96px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 50%, #1A382B 30%, #0D1F16 75%);
  border: 2px solid rgba(46,204,113,.4);
  display: grid; place-items: center;
  animation: lg-spin 9s linear infinite;
}
@keyframes lg-spin { to { transform: rotate(360deg); } }

.lg-disc-inner {
  width: 60px; height: 60px;
  border-radius: 50%;
  border: 1px dashed rgba(46,204,113,.35);
  display: flex; align-items: flex-end; justify-content: center;
  gap: 3px; padding-bottom: 14px;
  overflow: hidden;
}

.lg-disc-inner i {
  width: 4px; background: #2ECC71;
  border-radius: 2px;
  animation: lg-eq .9s ease-in-out infinite;
}
@keyframes lg-eq {
  0%, 100% { height: 5px; }
  50% { height: 20px; }
}

.lg-disc-dot {
  position: absolute;
  width: 12px; height: 12px; border-radius: 50%;
  background: #2ECC71;
  box-shadow: 0 0 12px rgba(46,204,113,.8);
}

.lg-ph-title {
  font-size: 24px; font-weight: 800; letter-spacing: 4px;
  color: var(--text);
}

.lg-ph-sub {
  font-size: 12px; font-weight: 600;
  color: var(--text-muted, rgba(255,255,255,.55));
  max-width: 260px;
  line-height: 1.5;
}

.lg-ph-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 18px;
  border-radius: 20px;
  background: rgba(46,204,113,.12);
  border: 1px solid rgba(46,204,113,.35);
  color: #2ECC71;
  font-size: 11px; font-weight: 800; letter-spacing: 2px;
}

/* ============================================================
   LIGHT THEME
   ============================================================ */

[data-theme="ivory"] .lg-tabs , [data-theme="soda"] .lg-tabs , [data-theme="light"] .lg-tabs {
  background:
    var(--sheen-soft),
    var(--card);
  border-color: var(--border);
  box-shadow: var(--rim-1), var(--elev-1);
}

[data-theme="ivory"] .lg-tab , [data-theme="soda"] .lg-tab , [data-theme="light"] .lg-tab {
  color: var(--text-muted);
}

[data-theme="ivory"] .lg-tab.active , [data-theme="soda"] .lg-tab.active , [data-theme="light"] .lg-tab.active {
  background:
    linear-gradient(180deg, rgba(255,255,255,.18), transparent 55%),
    var(--gradient);
  color: var(--on-accent);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.32),
    0 4px 12px -7px rgba(var(--accent-b-rgb), .45);
}

[data-theme="ivory"] .lg-disc , [data-theme="soda"] .lg-disc , [data-theme="light"] .lg-disc {
  background: radial-gradient(circle at 50% 50%, #C9E8D8 30%, #A8D8C0 75%);
  border-color: rgba(39,145,90,.4);
}

[data-theme="ivory"] .lg-disc-inner , [data-theme="soda"] .lg-disc-inner , [data-theme="light"] .lg-disc-inner { border-color: rgba(39,145,90,.3); }
[data-theme="ivory"] .lg-disc-inner i , [data-theme="soda"] .lg-disc-inner i , [data-theme="light"] .lg-disc-inner i { background: #1E8449; }
[data-theme="ivory"] .lg-disc-dot , [data-theme="soda"] .lg-disc-dot , [data-theme="light"] .lg-disc-dot { background: #1E8449; box-shadow: none; }

[data-theme="ivory"] .lg-ph-sub , [data-theme="soda"] .lg-ph-sub , [data-theme="light"] .lg-ph-sub { color: rgba(70,55,90,.6); }

[data-theme="ivory"] .lg-ph-badge , [data-theme="soda"] .lg-ph-badge , [data-theme="light"] .lg-ph-badge {
  background: rgba(46,204,113,.1);
  border-color: rgba(39,145,90,.35);
  color: #1E8449;
}

/* ============================================================
   MARKET — HAREM (big-collection browser)
   ============================================================ */

.hm-page { position: relative; }

/* sticky toolbar */
.hm-toolbar {
  position: sticky; top: 0; z-index: 18;
  margin: 0 -16px;
  padding: 8px 16px 7px;
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.market-page .hm-toolbar { top: var(--market-tabs-height, 52px); }

.hm-searchrow { display: flex; align-items: center; gap: 6px; }
.search-bar.hm-search { flex: 1; min-width: 0; margin: 0; }
.hm-search input {
  width: 100%; height: 38px;
  padding: 0 34px 0 38px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 11.5px; font-weight: 600;
}
.hm-search svg {
  left: 13px; width: 15px; height: 15px;
}
.hm-clear, .au-clear, .ca-clear {
  position: absolute; right: 7px; top: 50%;
  transform: translateY(-50%);
  width: 25px; height: 25px;
  display: grid; place-items: center;
  z-index: 2;
  border-radius: 50%;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.hm-clear[hidden], .au-clear[hidden], .ca-clear[hidden] { display: none; }
.hm-clear svg, .au-clear svg, .ca-clear svg { width: 11px; height: 11px; }

.hm-icon-btn {
  flex: 0 0 38px; width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  transition: color .16s ease, background .16s ease, border-color .16s ease;
}
.hm-icon-btn svg { width: 17px; height: 17px; }
.hm-icon-btn.active {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 38%, transparent);
}
.hm-view {
  flex: 0 0 auto;
  display: flex; gap: 2px;
  padding: 2px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.hm-view-btn {
  width: 30px; height: 32px;
  display: grid; place-items: center;
  border-radius: 9px;
  color: var(--text-muted);
  transition: background .16s ease, color .16s ease, box-shadow .16s ease;
}
.hm-view-btn svg { width: 15px; height: 15px; }
.hm-view-btn.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 2px 7px rgba(0,0,0,.16);
}

.hm-scopes {
  display: flex; gap: 6px;
  overflow-x: auto; scrollbar-width: none;
  padding: 8px 0 2px;
  margin: 0;
}
.hm-scopes::-webkit-scrollbar { display: none; }
.hm-scope {
  padding: 6px 11px;
  font-size: 10.5px; font-weight: 800;
}
.hm-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding-top: 4px;
}
.hm-count {
  min-width: 0;
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm-sort {
  flex: 0 0 auto;
  max-width: 124px;
  padding: 4px 25px 4px 9px;
  font-size: 10px; font-weight: 800;
  background-position: calc(100% - 14px) 55%, calc(100% - 9px) 55%;
  background-size: 5px 5px;
}

/* results */
.hm-results { padding-top: 12px; scroll-margin-top: 170px; }
.market-page .hm-results { scroll-margin-top: 188px; }

/* Long collections: skip rendering offscreen rows and don't animate pages
   that arrive from infinite scroll (the first 30 still animate once). */
.hm-results > .char-card,
.hm-list > .hm-row,
.au-list > .au-row {
  content-visibility: auto;
  contain-intrinsic-size: auto 280px;
}
.hm-list > .hm-row { contain-intrinsic-size: auto 80px; }
.au-list > .au-row { contain-intrinsic-size: auto 112px; }
.hm-results > .char-card:nth-child(n+31) { animation: none; }

/* Fixed dock over long lists: drop the per-frame backdrop blur. */
body.perf-list-page .tabbar {
  background: var(--bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}
.hm-list { display: flex; flex-direction: column; gap: 7px; padding-top: 12px; }
.hm-row {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 7px;
  border-radius: 15px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  transition: transform .14s ease, border-color .16s ease;
}
.hm-row:active { transform: scale(.985); }
.hm-row-art {
  position: relative;
  flex: 0 0 54px; width: 54px; height: 64px;
  border-radius: 11px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1.5px var(--rc, transparent);
}
.hm-row-art img { width: 100%; height: 100%; object-fit: cover; }
.hm-row-art .af-glyph { font-size: 22px; }
.hm-row-art .af-name, .hm-row-art .af-anime { display: none; }
.hm-row-body { flex: 1; min-width: 0; }
.hm-row-top { display: flex; align-items: center; gap: 6px; }
.hm-row-name {
  flex: 1; min-width: 0;
  font-size: 12.5px; font-weight: 800; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm-row-state {
  flex: 0 0 auto;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 8px; font-weight: 800; line-height: 1.2;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
}
.hm-row-state.locked {
  color: var(--text-muted);
  background: var(--chip-bg);
  border-color: var(--border);
}
.hm-row-sub {
  margin-top: 2px;
  font-size: 9.5px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm-row-meta {
  display: flex; align-items: center; gap: 6px;
  margin-top: 4px;
  font-size: 8px; font-weight: 700; color: var(--text-muted);
  white-space: nowrap; overflow: hidden;
}
.hm-mini-rarity {
  padding: 1.5px 6px;
  border-radius: 999px;
  color: var(--rc);
  background: color-mix(in srgb, var(--rc) 10%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc) 26%, transparent);
  font-weight: 800;
}
.hm-row-chev {
  flex: 0 0 20px;
  display: grid; place-items: center;
  color: var(--text-muted);
  opacity: .6;
}
.hm-row-chev svg { width: 14px; height: 14px; }

.hm-state-chip {
  position: absolute; left: 6px; bottom: 6px;
  z-index: 2;
  display: inline-flex; align-items: center; gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  background: rgba(12,10,20,.58);
  border: 1px solid rgba(255,255,255,.16);
  font-size: 8px; font-weight: 800; line-height: 1.2;
}
.hm-state-chip.locked { color: #FFC2D2; }
.hm-state-chip svg { width: 9px; height: 9px; }

.hm-row-skel { pointer-events: none; }
.hm-skel-art { flex: 0 0 54px; width: 54px; height: 64px; border-radius: 11px; }
.hm-skel-line { height: 10px; border-radius: 6px; margin-top: 6px; }

.hm-sentinel, .au-sentinel {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 34px; padding: 14px 0 4px;
  font-size: 10px; font-weight: 700; color: var(--text-muted);
}
.hm-sentinel[hidden], .au-sentinel[hidden] { display: none; }
.hm-spinner, .au-spinner, .ca-spinner {
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--accent) 22%, transparent);
  border-top-color: var(--accent);
  animation: marketSpin .8s linear infinite;
}
.hm-sentinel:not(.loading) .hm-spinner,
.au-sentinel:not(.loading) .au-spinner { display: none; }
@keyframes marketSpin { to { transform: rotate(360deg); } }

/* rarity filter sheet */
.hm-filter-sheet-wrap { max-height: 72dvh; }
.hm-filter-sheet .sheet-title { margin-bottom: 4px; }
.hm-filter-sheet .sheet-sub { margin-bottom: 14px; }
.hm-rarity-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.hm-rarity-option {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 11px;
  border-radius: 13px;
  text-align: left;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 11.5px; font-weight: 800;
}
.hm-rarity-option.active {
  border-color: color-mix(in srgb, var(--rc) 60%, transparent);
  background: color-mix(in srgb, var(--rc) 10%, var(--surface-2));
}
.hm-rarity-dot {
  flex: 0 0 8px; width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--rc);
  box-shadow: 0 0 8px color-mix(in srgb, var(--rc) 70%, transparent);
}
.hm-rarity-name { flex: 1; min-width: 0; }
.hm-rarity-check { display: grid; place-items: center; color: var(--rc); }
.hm-rarity-check svg { width: 14px; height: 14px; }

/* ============================================================
   MARKET — AUCTION HOUSE
   ============================================================ */

.au-page { position: relative; }

.au-tabs {
  display: flex; gap: 3px;
  padding: 4px;
  border-radius: 15px;
  background: var(--card);
  border: 1px solid var(--border);
  margin-bottom: 0;
}
.au-tab {
  flex: 1; min-width: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 4px;
  padding: 8px 3px;
  border-radius: 11px;
  color: var(--text-muted);
  font-size: 10.5px; font-weight: 800; line-height: 1;
  white-space: nowrap;
  transition: color .16s ease, background .16s ease, box-shadow .16s ease;
}
.au-tab.active {
  color: var(--on-accent);
  background: var(--gradient);
  box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 26%, transparent);
}
.au-tab-count {
  min-width: 14px;
  padding: 1px 4px;
  border-radius: 999px;
  background: var(--chip-bg);
  color: var(--text-muted);
  font-size: 8px; line-height: 1.25; font-weight: 800;
}
.au-tab-count[hidden] { display: none; }
.au-tab.active .au-tab-count {
  background: rgba(255,255,255,.18);
  color: inherit;
}

/* sticky search/filter bar */
.au-toolbar {
  position: sticky; top: 0; z-index: 18;
  margin: 10px -16px 0;
  padding: 8px 16px 7px;
  background: var(--bg);
  border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent);
}
.market-page .au-toolbar { top: var(--market-tabs-height, 52px); }
.search-bar.au-search { margin: 0; }
.au-search input {
  width: 100%; height: 38px;
  padding: 0 34px 0 38px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 11.5px; font-weight: 600;
}
.au-search svg { left: 13px; width: 15px; height: 15px; }
.au-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding-top: 6px;
}
.au-count {
  min-width: 0;
  font-size: 10px; font-weight: 700; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.au-sort {
  flex: 0 0 auto;
  max-width: 112px;
  padding: 4px 24px 4px 9px;
  font-size: 10px; font-weight: 800;
  background-position: calc(100% - 13px) 55%, calc(100% - 8px) 55%;
  background-size: 5px 5px;
}
.au-rarity-row {
  margin: 6px 0 0;
  padding: 1px 0 2px;
}
.au-rarity {
  padding: 5px 10px;
  font-size: 10px; font-weight: 800;
}

/* rows */
.au-list {
  display: flex; flex-direction: column; gap: 7px;
  padding-top: 11px;
  scroll-margin-top: 176px;
}
.market-page .au-list { scroll-margin-top: 198px; }
.au-row {
  display: flex; align-items: stretch; gap: 9px;
  width: 100%; padding: 7px;
  border-radius: 16px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  transition: transform .14s ease, border-color .16s ease, box-shadow .16s ease;
}
.au-row:active { transform: scale(.985); }
.au-row.is-winning {
  border-color: color-mix(in srgb, var(--success) 40%, var(--border));
}
.au-row.is-mine {
  border-color: color-mix(in srgb, var(--accent) 32%, var(--border));
}
.au-art {
  position: relative;
  flex: 0 0 78px; width: 78px; min-height: 96px;
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1.5px var(--rc, transparent);
}
.au-art img { width: 100%; height: 100%; object-fit: cover; }
.au-art .af-glyph { font-size: 28px; }
.au-art .af-name, .au-art .af-anime { display: none; }
.au-own-chip {
  position: absolute; left: 5px; bottom: 5px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #fff;
  background: rgba(12,10,20,.6);
  border: 1px solid rgba(255,255,255,.16);
  font-size: 8px; font-weight: 800; line-height: 1.2;
}
.au-body {
  flex: 1; min-width: 0;
  display: flex; flex-direction: column;
  padding: 1px 2px 1px 0;
}
.au-row-top { display: flex; align-items: flex-start; gap: 6px; }
.au-name {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 800; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.au-time {
  flex: 0 0 auto;
  display: inline-flex; align-items: center;
  padding: 2px 6px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
  font-size: 8px; font-weight: 800; line-height: 1.3;
  white-space: nowrap;
}
.au-time.hot {
  color: var(--danger);
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
}
.au-time.ended {
  color: var(--text-muted);
  background: var(--chip-bg);
  border-color: var(--border);
}
.au-row .status-pill {
  flex: 0 0 auto;
  font-size: 8px; padding: 2px 6px; line-height: 1.3;
}
.au-row-sub {
  margin-top: 2px;
  font-size: 9px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.au-tags {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 4px; margin-top: 5px;
}
.au-rarity-pill {
  padding: 1.5px 6px;
  border-radius: 999px;
  color: var(--rc);
  background: color-mix(in srgb, var(--rc) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc) 24%, transparent);
  font-size: 8px; font-weight: 800; line-height: 1.35;
  white-space: nowrap;
}
.au-flag {
  padding: 1.5px 6px;
  border-radius: 999px;
  font-size: 8px; font-weight: 800; line-height: 1.35;
  white-space: nowrap;
  border: 1px solid var(--border);
  color: var(--text-muted);
  background: var(--chip-bg);
}
.au-flag.own {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
}
.au-flag.win {
  color: var(--success);
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 26%, transparent);
}
.au-flag.buy {
  color: var(--gold);
  background: var(--gold-soft);
  border-color: var(--gold-border);
}
.au-bidcount {
  font-size: 8px; font-weight: 700; color: var(--text-muted);
  white-space: nowrap;
}
.au-row-bottom {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 6px; margin-top: auto; padding-top: 6px;
}
.au-pricebox { min-width: 0; display: flex; flex-direction: column; }
.au-price-label {
  font-size: 8px; font-weight: 800; letter-spacing: .5px;
  text-transform: uppercase; color: var(--text-muted);
  line-height: 1.2;
}
.au-price {
  display: inline-flex; align-items: center; gap: 4px;
  margin-top: 1px;
  font-size: 14px; font-weight: 800; line-height: 1.2;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
}
.au-cta {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; gap: 1px;
  color: var(--accent);
  font-size: 9.5px; font-weight: 800;
}
.au-cta svg { width: 12px; height: 12px; }

.au-row-skel { pointer-events: none; }
.au-skel-art {
  flex: 0 0 78px; width: 78px; min-height: 96px;
  border-radius: 12px;
}
.au-skel-line { height: 9px; border-radius: 5px; margin-top: 7px; }

/* ============================================================
   CREATE AUCTION — focused builder + searchable picker
   ============================================================ */

.ca-page { position: relative; padding-bottom: 12px; }
.ca-top {
  display: flex; align-items: center; gap: 11px;
  margin: 2px 0 14px;
}
.ca-back {
  flex: 0 0 38px; width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
}
.ca-back svg { width: 17px; height: 17px; }
.ca-head-copy { flex: 1; min-width: 0; }
.ca-title {
  font-family: var(--font-display);
  font-size: clamp(21px, 6.2vw, 25px);
  line-height: 1.05; font-weight: 800;
}
.ca-sub {
  margin-top: 3px;
  font-size: 10px; line-height: 1.35; font-weight: 600;
  color: var(--text-muted);
}

.ca-card {
  position: relative;
  margin-bottom: 11px;
  padding: 14px;
  border-radius: 18px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.05);
  scroll-margin-top: 14px;
}
.ca-step-head {
  display: flex; align-items: flex-start; gap: 9px;
  margin-bottom: 11px;
}
.ca-step-title {
  font-size: 14px; line-height: 1.2; font-weight: 800;
}
.ca-step-sub {
  margin-top: 2px;
  font-size: 9.5px; line-height: 1.35; font-weight: 600;
  color: var(--text-muted);
}

.ca-choose {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 11px;
  border-radius: 14px;
  text-align: left;
  color: var(--text);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--accent) 5%, transparent), transparent),
    var(--surface-2);
  border: 1px dashed color-mix(in srgb, var(--accent) 36%, var(--border));
  transition: transform .14s ease, border-color .16s ease;
}
.ca-choose:active { transform: scale(.986); }
.ca-choose-ic {
  flex: 0 0 38px; width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 24%, transparent);
}
.ca-choose-ic svg { width: 18px; height: 18px; }
.ca-choose-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.ca-choose-body b { font-size: 12.5px; font-weight: 800; }
.ca-choose-sub {
  font-size: 9.5px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ca-choose-arrow {
  flex: 0 0 auto; color: var(--text-muted);
  display: grid; place-items: center;
}
.ca-choose-arrow svg { width: 16px; height: 16px; }

.ca-selected {
  display: flex; align-items: center; gap: 10px;
  padding: 8px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.ca-selected-loading {
  justify-content: center;
  min-height: 78px;
  color: var(--text-muted);
  font-size: 11px; font-weight: 700;
  gap: 9px;
}
.ca-loading-text { font-size: 11px; font-weight: 700; }
.ca-sel-art.char-art {
  flex: 0 0 64px; width: 64px; height: 78px;
  aspect-ratio: auto;
  border-radius: 11px;
  overflow: hidden;
}
.ca-sel-art .af-glyph { font-size: 26px; }
.ca-sel-art .af-name, .ca-sel-art .af-anime { display: none; }
.ca-sel-body { flex: 1; min-width: 0; }
.ca-sel-name {
  font-size: 13px; font-weight: 800; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ca-sel-sub {
  margin-top: 2px;
  font-size: 9.5px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ca-sel-meta {
  display: flex; align-items: center; flex-wrap: wrap;
  gap: 4px; margin-top: 5px;
}
.ca-rarity-pill {
  padding: 1.5px 6px;
  border-radius: 999px;
  color: var(--rc);
  background: color-mix(in srgb, var(--rc) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--rc) 24%, transparent);
  font-size: 8px; font-weight: 800; line-height: 1.35;
  white-space: nowrap;
}
.ca-avail-pill, .ca-id-pill {
  padding: 1.5px 6px;
  border-radius: 999px;
  font-size: 8px; font-weight: 800; line-height: 1.35;
  white-space: nowrap;
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 24%, transparent);
}
.ca-id-pill {
  color: var(--text-muted);
  background: var(--chip-bg);
  border-color: var(--border);
}
.ca-change {
  flex: 0 0 auto;
  align-self: flex-start;
  padding: 5px 7px;
  border-radius: 9px;
  color: var(--accent);
  font-size: 9.5px; font-weight: 800;
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
}
.ca-change:active { transform: scale(.94); }

.ca-card .form-label { margin-top: 11px; font-size: 10px; }
.ca-input input {
  height: 41px;
  font-size: 13px; font-weight: 700;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 12px;
}
.ca-value-hint {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-top: 6px;
  min-height: 0;
  font-size: 9.5px; font-weight: 600; color: var(--text-muted);
}
.ca-value-hint:empty { display: none; }
.ca-use-value {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 8px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent);
  font-size: 9px; font-weight: 800;
}
.ca-durations {
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
}
.ca-duration {
  padding: 10px 2px;
  border-radius: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 11.5px; font-weight: 800;
  transition: all .15s ease;
}
.ca-duration.active {
  color: var(--text);
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 20%, transparent);
}
.ca-duration-preview {
  margin-top: 8px;
  font-size: 9.5px; font-weight: 600; color: var(--text-muted);
}

.ca-summary-body { display: flex; flex-direction: column; }
.ca-rv-row {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; padding: 6px 0;
  border-bottom: 1px dashed color-mix(in srgb, var(--border) 80%, transparent);
}
.ca-rv-row:last-of-type { border-bottom: none; }
.ca-rv-k { font-size: 10.5px; font-weight: 600; color: var(--text-muted); }
.ca-rv-v {
  font-size: 11.5px; font-weight: 800; text-align: right;
  overflow-wrap: anywhere;
}
.ca-reserve-note {
  display: flex; align-items: flex-start; gap: 6px;
  margin-top: 8px; padding: 8px 9px;
  border-radius: 10px;
  background: var(--chip-bg);
  color: var(--text-muted);
  font-size: 9px; line-height: 1.4; font-weight: 600;
}
.ca-reserve-note svg { flex: 0 0 12px; width: 12px; height: 12px; margin-top: 1px; }

/* fixed action bar (tabbar is hidden on this page) */
.ca-submitbar {
  position: fixed;
  left: 50%; bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 55;
  width: min(calc(100% - 24px), 496px);
  display: flex; align-items: center; gap: 10px;
  padding: 9px 10px;
  border-radius: 17px;
  background: color-mix(in srgb, var(--card) 94%, transparent);
  border: 1px solid var(--border-strong);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.08),
    0 14px 34px rgba(0,0,0,.38);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
  backdrop-filter: blur(16px) saturate(1.15);
}
.ca-bar-info { flex: 1; min-width: 0; }
.ca-bar-name {
  font-size: 11.5px; font-weight: 800; line-height: 1.25;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ca-bar-meta {
  margin-top: 1px;
  font-size: 9px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ca-submit-btn {
  flex: 0 0 auto;
  min-height: 41px;
  padding: 0 14px;
  border-radius: 12px;
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  font-size: 11.5px; font-weight: 800;
  white-space: nowrap;
}
.ca-submit-btn svg { width: 15px; height: 15px; }
.ca-submit-btn:disabled { opacity: .45; }

/* full-height character picker */
.sheet.ca-picker-sheet {
  height: 92vh;
  height: 92dvh;
  max-height: 92dvh;
  padding: 10px 0 0;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.ca-picker {
  flex: 1; min-height: 0;
  display: flex; flex-direction: column;
}
.ca-picker .grabber { flex: 0 0 auto; margin-bottom: 12px; }
.ca-picker-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 9px;
  padding: 0 15px 8px;
}
.ca-picker-title-wrap { flex: 1; min-width: 0; }
.ca-picker-title {
  font-family: var(--font-display);
  font-size: 19px; line-height: 1.1; font-weight: 800;
}
.ca-picker-ready {
  display: block; margin-top: 2px;
  font-size: 9.5px; font-weight: 600; color: var(--text-muted);
}
.ca-picker-close {
  flex: 0 0 32px; width: 32px; height: 32px;
  display: grid; place-items: center;
  border-radius: 10px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
}
.ca-picker-close svg { width: 14px; height: 14px; }
.ca-picker-tools {
  flex: 0 0 auto;
  padding: 0 14px 6px;
}
.search-bar.ca-picker-search { margin: 0 0 7px; }
.ca-picker-search input {
  height: 38px;
  padding: 0 34px 0 38px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--border);
  font-size: 11.5px; font-weight: 600;
}
.ca-picker-search svg { left: 13px; width: 15px; height: 15px; }
.ca-picker-meta {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; padding-top: 2px;
}
.ca-picker-count {
  font-size: 9.5px; font-weight: 700; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ca-pick-sort {
  flex: 0 0 auto;
  max-width: 104px;
  padding: 4px 23px 4px 9px;
  font-size: 10px; font-weight: 800;
  background-position: calc(100% - 12px) 55%, calc(100% - 7px) 55%;
  background-size: 5px 5px;
}
.ca-pick-rarities {
  margin: 6px 0 0;
  padding: 1px 0 2px;
}
.ca-pick-rarity { padding: 5px 10px; font-size: 9.5px; font-weight: 800; }
.ca-picker-list {
  flex: 1; min-height: 0;
  overflow-y: auto;
  padding: 3px 12px calc(18px + env(safe-area-inset-bottom, 0px));
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.ca-picker-list::-webkit-scrollbar { display: none; }
.ca-pick-row {
  display: flex; align-items: center; gap: 9px;
  width: 100%;
  padding: 7px;
  margin-bottom: 6px;
  border-radius: 13px;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--border);
  transition: transform .13s ease, border-color .16s ease, background .16s ease;
}
.ca-pick-row:active { transform: scale(.988); }
.ca-pick-row.selected {
  background: color-mix(in srgb, var(--accent) 7%, var(--card));
  border-color: color-mix(in srgb, var(--accent) 50%, var(--border));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--accent) 16%, transparent);
}
.ca-pick-art {
  position: relative;
  flex: 0 0 48px; width: 48px; height: 58px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  box-shadow: inset 0 0 0 1.5px var(--rc, transparent);
}
.ca-pick-art img { width: 100%; height: 100%; object-fit: cover; }
.ca-pick-art .af-glyph { font-size: 20px; }
.ca-pick-art .af-name, .ca-pick-art .af-anime { display: none; }
.ca-pick-body { flex: 1; min-width: 0; }
.ca-pick-top { display: flex; align-items: center; gap: 6px; }
.ca-pick-name {
  flex: 1; min-width: 0;
  font-size: 12px; font-weight: 800; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ca-pick-avail {
  flex: 0 0 auto;
  padding: 1.5px 5px;
  border-radius: 999px;
  font-size: 7.5px; font-weight: 800; line-height: 1.3;
  color: var(--success); background: var(--success-soft);
  border: 1px solid color-mix(in srgb, var(--success) 24%, transparent);
}
.ca-pick-avail.none {
  color: var(--text-muted); background: var(--chip-bg); border-color: var(--border);
}
.ca-pick-sub {
  margin-top: 2px;
  font-size: 9px; font-weight: 600; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.ca-pick-meta {
  display: flex; align-items: center; gap: 5px;
  margin-top: 4px;
  font-size: 7.5px; font-weight: 700; color: var(--text-muted);
  white-space: nowrap; overflow: hidden;
}
.ca-pick-check {
  flex: 0 0 24px; width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: var(--text-muted);
  background: var(--chip-bg);
  border: 1px solid var(--border);
}
.ca-pick-check svg { width: 12px; height: 12px; }
.ca-pick-row.selected .ca-pick-check {
  color: var(--on-accent);
  background: var(--gradient);
  border-color: transparent;
}
.ca-pick-row-skel { pointer-events: none; }
.ca-pick-skel-art { flex: 0 0 48px; width: 48px; height: 58px; border-radius: 10px; }
.ca-pick-skel-line { height: 9px; border-radius: 5px; margin-top: 6px; }
.ca-pick-sentinel {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 30px; padding: 10px 0;
  font-size: 9.5px; font-weight: 700; color: var(--text-muted);
}
.ca-pick-sentinel[hidden] { display: none; }
.ca-pick-sentinel .ca-spinner { display: none; }
.ca-pick-sentinel.loading .ca-spinner { display: inline-block; }
.ca-picker-list .empty-state { padding: 32px 16px; }

/* ============================================================
   CHARACTER DETAIL — clean collection summary
   ============================================================ */

.cd-hero {
  position: relative;
  border-radius: 24px;
  overflow: hidden;
  background: var(--surface-2);
  border: 1px solid var(--stroke);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.06),
    0 22px 44px -26px rgba(0,0,0,.72);
}
.cd-hero-btn {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  cursor: zoom-in;
}
.cd-hero-img {
  display: block;
  width: 100%;
  height: auto;
  object-fit: contain;
  background: var(--surface-2);
}
.cd-hero .art-fallback.cd-hero-img { aspect-ratio: 577 / 800; }
.cd-hero .back-btn { top: 12px; left: 12px; }

.cd-head { margin-top: 15px; padding: 0 2px; }
.cd-name-row {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 10px;
}
.cd-name {
  min-width: 0;
  font-size: clamp(22px, 6.4vw, 27px);
  line-height: 1.12; font-weight: 800;
  overflow-wrap: anywhere;
}
.cd-owned-pill {
  flex: 0 0 auto;
  margin-top: 3px;
  padding: 5px 9px;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  font-size: 9.5px; font-weight: 800; line-height: 1;
  white-space: nowrap;
}
.cd-badges {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  margin-top: 9px;
}
.cd-meta {
  display: flex; align-items: center; gap: 6px;
  min-width: 0;
  margin-top: 8px;
  font-size: 11px; line-height: 1.3; font-weight: 600;
  color: var(--muted);
}
.cd-meta-series {
  min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cd-meta-dot { flex: 0 0 auto; opacity: .5; }
.cd-meta > span:last-child { flex: 0 0 auto; }

.cd-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 8px;
  margin-top: 16px;
}
.cd-stats.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.cd-stat {
  min-width: 0;
  padding: 11px 12px;
  border-radius: 15px;
  background: var(--card);
  border: 1px solid var(--stroke);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04);
}
.cd-stat b {
  display: block;
  font-family: var(--font-display);
  font-size: 22px; line-height: 1.05; font-weight: 800;
  font-variant-numeric: tabular-nums;
}
.cd-stat span {
  display: block; margin-top: 3px;
  font-size: 8px; font-weight: 800; letter-spacing: .8px;
  text-transform: uppercase; color: var(--muted);
}
.cd-stat.is-zero b { color: var(--muted); }
.cd-stat.is-locked { border-color: var(--gold-border); }
.cd-stat.is-locked b { color: var(--gold); }
.cd-locked-note {
  display: flex; align-items: flex-start; gap: 9px;
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 13px;
  background: var(--gold-soft);
  border: 1px solid var(--gold-border);
}
.cd-locked-ic {
  flex: 0 0 20px; width: 20px; height: 20px;
  display: grid; place-items: center;
  border-radius: 7px;
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 12%, transparent);
}
.cd-locked-ic svg { width: 12px; height: 12px; }
.cd-locked-note b {
  display: block;
  font-size: 11px; font-weight: 800; line-height: 1.25;
}
.cd-locked-note span {
  display: block; margin-top: 2px;
  font-size: 10px; line-height: 1.35; font-weight: 600;
  color: var(--muted);
}
.cd-back-harem { color: var(--muted); }

/* full-screen artwork viewer */
.cd-lightbox {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(6,5,12,.94);
  animation: fadeIn .16s ease both;
}
.cd-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,.75);
}
.cd-lightbox-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 40px; height: 40px;
  display: grid; place-items: center;
  border-radius: 50%;
  color: #fff;
  background: rgba(11,10,20,.72);
  border: 1px solid rgba(255,255,255,.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1;
}
.cd-lightbox-close svg { width: 18px; height: 18px; }

/* ============================================================
   MARKET / CREATE — compact-screen tuning
   ============================================================ */

@media (max-width: 350px) {
  .au-tab { font-size: 9.5px; padding: 8px 2px; gap: 2px; }
  .au-tab-count { font-size: 7px; padding: 1px 3px; }

  .hm-view-btn { width: 28px; height: 30px; }
  .hm-icon-btn { flex-basis: 36px; width: 36px; height: 36px; }
  .hm-search input, .au-search input { height: 36px; font-size: 10.5px; }
  .hm-scope { padding: 5px 9px; font-size: 9.5px; }
  .hm-sort, .au-sort { font-size: 9px; max-width: 99px; }

  .au-art, .au-skel-art { flex-basis: 68px; width: 68px; min-height: 87px; }
  .au-name { font-size: 12px; }
  .au-price { font-size: 13px; }
  .au-cta { font-size: 9px; }
  .au-time { font-size: 7.5px; padding: 1.5px 5px; }
  .au-row .status-pill { font-size: 7px; }
  .au-row-sub { font-size: 8.5px; }
  .au-rarity, .au-rarity-row .chip { font-size: 9px; padding: 4.5px 8px; }

  .ca-card { padding: 12px; border-radius: 16px; }
  .ca-step-title { font-size: 13px; }
  .ca-step-sub { font-size: 9px; }
  .ca-selected { gap: 8px; padding: 7px; }
  .ca-sel-art.char-art { flex-basis: 58px; width: 58px; height: 70px; }
  .ca-sel-name { font-size: 12px; }
  .ca-change { padding: 4px 6px; font-size: 9px; }
  .ca-durations { gap: 5px; }
  .ca-duration { padding: 9px 1px; font-size: 10.5px; }
  .ca-submitbar { padding: 8px; gap: 8px; }
  .ca-submit-btn { padding: 0 11px; font-size: 10.5px; min-height: 39px; }
  .ca-bar-name { font-size: 10.5px; }
  .ca-bar-meta { font-size: 8.5px; }

  .ca-picker-title { font-size: 17px; }
  .ca-pick-art, .ca-pick-skel-art { flex-basis: 43px; width: 43px; height: 53px; }
  .ca-pick-name { font-size: 11px; }
  .ca-pick-meta { font-size: 7px; gap: 4px; }
  .ca-pick-avail { font-size: 7px; }
  .ca-picker-list { padding-left: 10px; padding-right: 10px; }
}

@media (max-height: 660px) {
  .ca-picker-sheet { height: 94vh; height: 94dvh; max-height: 94dvh; }
  .ca-picker .grabber { margin-bottom: 8px; }
  .ca-picker-head { padding-bottom: 6px; }
  .ca-picker-tools { padding-bottom: 4px; }
}
