/* ─── Browse tab overhaul ─── */
    .browse-header {
      display: flex;
      align-items: center;
      justify-content: space-between;
      margin-bottom: 6px;
    }

.browse-header-text { flex: 1; }

.browse-title {
      margin: 0;
      font-size: 22px;
      font-weight: 700;
      letter-spacing: -0.3px;
    }

.browse-subtitle {
      margin: 2px 0 0;
      font-size: 13px;
      color: var(--text-muted);
    }

/* Browse search */
    .browse-search {
      display: flex;
      gap: 6px;
      margin-bottom: 12px;
    }

.browse-search input {
      flex: 1;
      padding: 9px 12px;
    }

.browse-search button {
      background: none;
      border: 1px solid var(--outline-bright);
      border-radius: 10px;
      padding: 8px 14px;
      font-size: 12px;
      color: var(--text-secondary);
      cursor: pointer;
      flex-shrink: 0;
    }

/* 2-column grid */
    .browse-grid {
      display: grid;
      grid-template-columns: repeat(2, 1fr);
      gap: 10px;
    }

/* Character card */
    .character-card {
      position: relative;
      border-radius: 14px;
      overflow: hidden;
      background: var(--surface-1);
      cursor: pointer;
      transition: transform 0.15s ease;
      content-visibility: auto;
      contain-intrinsic-size: auto 280px;
    }

.character-card:active {
      transform: scale(0.97);
    }

.character-card.selected {
      outline: 2px solid var(--accent);
      outline-offset: -2px;
    }

/* P7 — browse grid entrance cascade (cssStagger), reusing reset.css's listItemRise keyframe. Search is
   Enter-triggered, so this fires on load / search / tab-switch, not per keystroke. `backwards` fill so
   the :active scale(0.97) tap feedback still works after entrance. content-visibility:auto means only
   on-screen cards visibly cascade. */
.character-card {
  animation: listItemRise var(--dur-standard, 0.28s) var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) backwards;
}
.character-card:nth-child(2) { animation-delay: calc(1 * var(--stagger-step, 0.028s)); }
.character-card:nth-child(3) { animation-delay: calc(2 * var(--stagger-step, 0.028s)); }
.character-card:nth-child(4) { animation-delay: calc(3 * var(--stagger-step, 0.028s)); }
.character-card:nth-child(5) { animation-delay: calc(4 * var(--stagger-step, 0.028s)); }
.character-card:nth-child(6) { animation-delay: calc(5 * var(--stagger-step, 0.028s)); }
.character-card:nth-child(7) { animation-delay: calc(6 * var(--stagger-step, 0.028s)); }
.character-card:nth-child(8) { animation-delay: calc(7 * var(--stagger-step, 0.028s)); }

.character-card .char-select-checkbox {
      position: absolute;
      top: 8px;
      right: 8px;
      z-index: 5;
      width: 22px;
      height: 22px;
      border-radius: 6px;
      border: 2px solid rgba(255,255,255,0.75);
      background: rgba(0,0,0,0.35);
      display: none;
      align-items: center;
      justify-content: center;
      pointer-events: none;
    }

.character-card.select-mode .char-select-checkbox {
      display: flex;
    }

.character-card.selected .char-select-checkbox {
      background: var(--accent);
      border-color: var(--accent);
    }

.character-card.selected .char-select-checkbox::after {
      content: "";
      width: 6px;
      height: 10px;
      border: solid #fff;
      border-width: 0 2px 2px 0;
      transform: rotate(45deg);
      margin-top: -2px;
    }

.character-card-image-wrap {
      position: relative;
      aspect-ratio: 1/1;
      overflow: hidden;
      background: var(--surface-3);
    }

.character-card-image-wrap img {
      width: 100%;
      height: 100%;
      object-fit: cover;
      display: block;
    }

.character-card-image-overlay {
      position: absolute;
      inset: 0;
      background: linear-gradient(to top, rgba(0,0,0,0.55) 0%, transparent 55%);
      pointer-events: none;
    }

/* Social signals on card image */
    .character-card-signals {
      position: absolute;
      bottom: 8px;
      left: 8px;
      right: 8px;
      display: flex;
      gap: 10px;
      font-size: 12px;
      color: var(--text-primary);
      font-weight: 600;
      pointer-events: none;
    }

.character-card-signals span {
      display: flex;
      align-items: center;
      gap: 3px;
    }

/* Heart button */
    .character-card-heart {
      position: absolute;
      top: 6px;
      right: 6px;
      z-index: 2;
      width: 30px;
      height: 30px;
      border-radius: 999px;
      background: rgba(0,0,0,0.35);
      border: none;
      cursor: pointer;
      display: flex;
      align-items: center;
      justify-content: center;
      padding: 0;
      line-height: 0;
      backdrop-filter: blur(4px);
      -webkit-backdrop-filter: blur(4px);
    }

/* Card body (below image) */
    .character-card-body {
      padding: 10px;
    }

.character-card-name {
      font-size: 15px;
      font-weight: 700;
      color: var(--text-primary);
      line-height: 1.2;
      margin-bottom: 2px;
    }

.character-card-type {
      font-size: 12px;
      color: var(--accent);
      font-weight: 500;
      margin-bottom: 4px;
    }

.character-card-preview {
      font-size: 12px;
      color: var(--text-secondary);
      line-height: 1.35;
      display: -webkit-box;
      -webkit-line-clamp: 2;
      -webkit-box-orient: vertical;
      overflow: hidden;
    }

/* Tag chips on card */
    .character-card-tags {
      display: flex;
      gap: 4px;
      flex-wrap: wrap;
      margin-top: 6px;
    }

.character-card-tag {
      padding: 3px 8px;
      border-radius: 999px;
      background: var(--surface-3);
      border: 1px solid var(--outline-bright);
      font-size: 10px;
      color: var(--text-muted);
      font-weight: 500;
    }

.shelf-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
      margin-bottom: 8px;
    }

.shelf-header h3 {
      font-size: 14px;
      font-weight: 700;
      color: var(--text-primary);
      margin: 0;
    }

.shelf-view-all {
      background: none;
      border: none;
      color: var(--accent);
      font-size: 12px;
      font-weight: 600;
      cursor: pointer;
      padding: 0;
    }

.shelf-row {
      display: flex;
      gap: 10px;
      overflow-x: auto;
      scrollbar-width: none;
      -webkit-overflow-scrolling: touch;
      padding-bottom: 4px;
    }

.shelf-row::-webkit-scrollbar { display: none; }

/* Character shelf card */
    .shelf-char-card {
      flex-shrink: 0;
      width: 110px;
      border-radius: 12px;
      overflow: hidden;
      background: var(--surface-1);
      border: 1px solid var(--outline-color);
      cursor: pointer;
    }

.shelf-char-card-img {
      width: 100%;
      aspect-ratio: 1;
      object-fit: cover;
      background: var(--surface-3);
    }

.shelf-char-card-body {
      padding: 8px;
    }

.shelf-char-card-name {
      font-size: 12px;
      font-weight: 600;
      color: var(--text-primary);
      overflow: hidden;
      text-overflow: ellipsis;
      white-space: nowrap;
    }

.shelf-char-card-stat {
      font-size: 10px;
      color: var(--text-secondary);
      margin-top: 2px;
    }

/* Chat shelf card */

/* Empty state for shelves */
    .shelf-empty {
      padding: 20px;
      text-align: center;
      color: var(--text-muted);
      font-size: 13px;
      background: var(--surface-3);
      border-radius: 12px;
      border: 1px dashed var(--outline-bright);
    }

/* Create new card */
    .shelf-create-card {
      flex-shrink: 0;
      width: 110px;
      border-radius: 12px;
      border: 2px dashed var(--outline-bright);
      background: var(--surface-3);
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      gap: 6px;
      cursor: pointer;
      color: var(--accent);
      font-size: 12px;
      font-weight: 600;
      padding: 16px 8px;
    }

.shelf-create-card svg { opacity: 0.6; }

.creator-card {
      display: flex;
      align-items: center;
      gap: 10px;
      padding: 12px;
      background: var(--surface-1);
      border: 1px solid var(--outline-color);
      border-radius: 14px;
      cursor: pointer;
      margin-bottom: 8px;
    }

.creator-card-avatar {
      width: 44px;
      height: 44px;
      border-radius: 999px;
      background: #333;
      overflow: hidden;
      flex-shrink: 0;
      display: grid;
      place-items: center;
      font-weight: 700;
      color: var(--text-muted);
      font-size: 18px;
    }

.creator-card-avatar img {
      width: 100%;
      height: 100%;
      object-fit: cover;
    }

.creator-card-body {
      flex: 1;
      min-width: 0;
    }

.creator-card-name {
      font-size: 14px;
      font-weight: 600;
      color: var(--text-primary);
    }

.creator-card-username {
      font-size: 12px;
      color: var(--text-secondary);
    }

.creator-card-bio {
      font-size: 12px;
      color: var(--text-muted);
      margin-top: 2px;
      white-space: nowrap;
      overflow: hidden;
      text-overflow: ellipsis;
    }

.creator-card-stats {
      font-size: 11px;
      color: var(--text-muted);
      text-align: right;
    }