﻿  /* v10.507 / v10.515: page-surface color parity. The shelf / My List
     page uses `#0E0E0E` as its canonical Editorial-Dark base (defined
     at 06-profile.css:1569 under `body.true-dark-mode #mylist-view`).
     Apply the same exact color to the Friends page (`#community-view`),
     the Discovery page (`#discover-view`), and the standalone Activity
     page (`.activity-page`).
     v10.515: escalated to `!important` with maximum-specificity body
     prefixes after a user report that the previous unconditional rule
     wasn't taking effect on the iOS app. Triple-up: cover the bare
     selectors, the active-state selectors, and the body-themed
     selectors so nothing else in the cascade can repaint these
     containers a different color regardless of theme class / load
     order / cached older patch CSS. The `#0E0E0E` hex MUST exactly
     match the shelf's body.true-dark-mode background at 06-profile.css
     line 1566 â€” if that ever changes, this block needs to track it. */
  #community-view,
  #discover-view,
  .activity-page,
  .activity-page.active {
    background-color: #0E0E0E !important;
    background-image: none !important;
  }
  body #community-view,
  body #discover-view,
  body .activity-page,
  body .activity-page.active,
  body.true-dark-mode #community-view,
  body.true-dark-mode #discover-view,
  body.true-dark-mode .activity-page,
  body.true-dark-mode .activity-page.active {
    background-color: #0E0E0E !important;
    background-image: none !important;
  }

  /* v10.222: IG-style friends list remodel. Wrapped in .shelfd-friends-vstack
     so the existing #friends-grid CSS grid (community-grid) doesn't fight the
     new vertical layout. v10.224: also apply this layout reset to the
     requests grid surfaces so the new row design stretches correctly. */
  #friends-grid:has(.shelfd-friends-vstack) {
    display: block !important;
    grid-template-columns: none !important;
    gap: 0 !important;
    padding: 0 !important;
  }
  #incoming-grid:has(.shelfd-friend-req-row),
  #outgoing-grid:has(.shelfd-friend-req-row) {
    display: block !important;
    grid-template-columns: none !important;
    gap: 0 !important;
    padding: 0 14px !important;
  }

  /* v10.224: the friends-tabs header strip blends with the page background
     so the tabs sit flat instead of inside a chip. Used across the whole
     community/friends view (Activity / Friends / Requests / Add a Friend). */
  #community-view .friends-tabs {
    background: transparent !important;
    border: 0 !important;
    border-bottom: 1px solid rgba(255,255,255,0.06) !important;
    border-radius: 0 !important;
    padding: 0 !important;
    width: 100% !important;
    margin: 0 0 16px !important;
    gap: 0 !important;
  }
  #community-view .friends-tab-btn {
    background: transparent !important;
    border-radius: 0 !important;
  }
  #community-view .friends-tab-btn.active {
    background: transparent !important;
  }

  /* v10.224: request rows reuse the .shelfd-friend-row shell; just style the
     trailing action buttons and section headings. */
  #incoming-section h3,
  #outgoing-section h3 {
    color: #ffffff;
    font: 500 18px/1.2 'Sohne', 'DM Sans', sans-serif;
    margin: 16px 14px 8px;
  }
  .shelfd-friend-req-row { padding: 10px 0; }
  .shelfd-friend-req-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
  }
  .shelfd-friend-req-btn {
    appearance: none;
    -webkit-appearance: none;
    border: 0;
    padding: 7px 12px;
    border-radius: 8px;
    font: 500 13px/1 'Sohne', 'DM Sans', sans-serif;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: opacity 120ms ease, transform 120ms ease, background 140ms ease;
  }
  .shelfd-friend-req-btn.primary {
    background: #4b6bff;
    color: #ffffff;
  }
  .shelfd-friend-req-btn.primary:active { opacity: 0.85; transform: scale(0.96); }
  .shelfd-friend-req-btn.secondary {
    background: rgba(255,255,255,0.08);
    color: #f8f4ff;
  }
  .shelfd-friend-req-btn.secondary:active { background: rgba(255,255,255,0.14); transform: scale(0.96); }
  .shelfd-friends-vstack {
    display: flex;
    flex-direction: column;
    gap: 18px;
    padding: 8px 14px 24px;
    font-family: 'Sohne', 'DM Sans', sans-serif;
    color: #f8f4ff;
  }

  /* Search */
  .shelfd-friends-search-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 12px;
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.06);
  }
  .shelfd-friends-search-icon {
    width: 18px;
    height: 18px;
    color: rgba(216,208,233,0.62);
    flex-shrink: 0;
  }
  .shelfd-friends-search-input {
    flex: 1;
    background: transparent;
    border: 0;
    outline: none;
    color: #f8f4ff;
    font: 400 15px/1.2 'Sohne', 'DM Sans', sans-serif;
    min-width: 0;
  }
  .shelfd-friends-search-input::placeholder { color: rgba(216,208,233,0.5); }

  /* Follow requests preview row */
  .shelfd-friends-followreq-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 10px 0;
    background: transparent;
    border: 0;
    width: 100%;
    cursor: pointer;
    text-align: left;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
  }
  .shelfd-friends-followreq-avatar {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    overflow: hidden;
    background: #1c1535;
    flex-shrink: 0;
  }
  .shelfd-friends-followreq-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .shelfd-friends-followreq-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .shelfd-friends-followreq-text strong {
    color: #f8f4ff;
    font: 500 16px/1.25 'Sohne', 'DM Sans', sans-serif;
  }
  .shelfd-friends-followreq-text span {
    color: rgba(216,208,233,0.55);
    font: 400 13px/1.3 'Sohne', 'DM Sans', sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .shelfd-friends-followreq-indicator {
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: #4b6bff;
    flex-shrink: 0;
  }
  .shelfd-friends-followreq-chevron {
    width: 18px;
    height: 18px;
    color: rgba(216,208,233,0.55);
    flex-shrink: 0;
  }

  /* Categories */
  .shelfd-friends-cat-block { display: flex; flex-direction: column; gap: 4px; }
  .shelfd-friends-cat-heading {
    color: #ffffff;
    font: 500 18px/1.2 'Sohne', 'DM Sans', sans-serif;
    margin-bottom: 4px;
  }
  .shelfd-friends-cat-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    background: transparent;
    border: 0;
    width: 100%;
    text-align: left;
    cursor: pointer;
    color: inherit;
    -webkit-tap-highlight-color: transparent;
  }
  .shelfd-friends-cat-avatar {
    width: 56px;
    height: 56px;
    border-radius: 999px;
    overflow: hidden;
    background: #1c1535;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    color: rgba(216,208,233,0.5);
  }
  .shelfd-friends-cat-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
  .shelfd-friends-cat-avatar.is-empty svg { width: 30px; height: 30px; }
  .shelfd-friends-cat-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 2px;
  }
  .shelfd-friends-cat-text strong {
    color: #f8f4ff;
    font: 500 15px/1.25 'Sohne', 'DM Sans', sans-serif;
  }
  .shelfd-friends-cat-text span {
    color: rgba(216,208,233,0.5);
    font: 400 13px/1.3 'Sohne', 'DM Sans', sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Sort header.
     v10.226: full-bleed divider. The parent (.shelfd-friends-vstack +
     container.main-content) has horizontal padding, so a plain border-top
     gets inset on both sides. We render the divider as an absolutely
     positioned pseudo-element pinned to 100vw via `left: 50%; translateX(-50%)`
     so it spans the entire screen edge-to-edge regardless of ancestor padding. */
  .shelfd-friends-sort-row {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 0;
    margin-top: 4px;
    border-top: 0;
  }
  .shelfd-friends-sort-row::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100vw;
    height: 1px;
    background: rgba(255,255,255,0.08);
    pointer-events: none;
  }
  .shelfd-friends-sort-label {
    color: rgba(216,208,233,0.7);
    font: 400 14px/1.2 'Sohne', 'DM Sans', sans-serif;
  }
  .shelfd-friends-sort-label strong {
    color: #ffffff;
    font-weight: 500;
  }
  .shelfd-friends-sort-btn {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    color: #f8f4ff;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .shelfd-friends-sort-btn svg { width: 20px; height: 20px; }
  .shelfd-friends-sort-btn:active { background: rgba(255,255,255,0.05); }

  /* Friend rows */
  .shelfd-friends-userlist { display: flex; flex-direction: column; gap: 4px; }
  .shelfd-friend-row {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 8px 0;
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }
  .shelfd-friend-avatar {
    width: 48px;
    height: 48px;
    border-radius: 999px;
    object-fit: cover;
    background: #1c1535;
    flex-shrink: 0;
  }
  .shelfd-friend-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
  }
  .shelfd-friend-handle {
    color: #f8f4ff;
    font: 500 15px/1.25 'Sohne', 'DM Sans', sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .shelfd-friend-name {
    color: rgba(216,208,233,0.55);
    font: 400 13px/1.3 'Sohne', 'DM Sans', sans-serif;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
  .shelfd-friend-x {
    appearance: none;
    -webkit-appearance: none;
    background: transparent;
    border: 0;
    color: rgba(216,208,233,0.72);
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    -webkit-tap-highlight-color: transparent;
  }
  .shelfd-friend-x svg { width: 20px; height: 20px; }
  .shelfd-friend-x:active { background: rgba(255,255,255,0.05); transform: scale(0.94); }

  .shelfd-friends-empty {
    padding: 48px 16px;
    text-align: center;
    color: rgba(216,208,233,0.55);
  }
  .shelfd-friends-empty .friends-empty-icon { font-size: 32px; margin-bottom: 8px; }

  /* Friends */
  .friends-tabs { display: flex; gap: 0; margin-bottom: 20px; border-bottom: 1px solid #2a2248; }
  .friends-tab-btn {
    padding: 10px 22px; background: none; border: none; border-bottom: 2px solid transparent;
    color: #ffffff; font-size: 14px; font-weight: 500; cursor: pointer;
    font-family: 'DM Sans', sans-serif; transition: all 0.2s;
  }
  .friends-tab-btn.active { color: #a78bfa; border-bottom-color: #a78bfa; }
  .friends-tab-btn:hover { color: #9990b3; }
  .friend-action-btn {
    padding: 5px 14px; border-radius: 4px; border: 1px solid; font-size: 12px;
    cursor: pointer; font-family: 'DM Sans', sans-serif; transition: all 0.2s;
    font-weight: 600; flex-shrink: 0;
  }
  .friend-add-btn { background: transparent; border-color: #7c3aed; color: #a78bfa; }
  .friend-add-btn:hover { background: #2a1f5e; }
  .friend-remove-btn { background: transparent; border-color: #3d3466; color: #a99dc6; }
  .friend-remove-btn:hover { border-color: #ef4444; color: #ef4444; }
  /* v925: "Requested" state â€” lavender-filled to confirm the request was sent */
  .friend-pending-btn {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    border-color: rgba(196,181,253,0.42);
    color: #ffffff;
    cursor: pointer;
    box-shadow: 0 4px 14px rgba(139,92,246,0.28);
  }
  .friend-pending-btn:hover { filter: brightness(1.08); }
  .friend-accept-btn { background: linear-gradient(135deg, #059669, #10b981); border-color: #10b981; color: #fff; }
  .friend-accept-btn:hover { filter: brightness(1.1); }
  .friend-friends-badge { background: rgba(34,197,94,0.1); border-color: #16a34a; color: #4ade80; cursor: default; }
  .friend-actions-group { display: flex; gap: 6px; flex-shrink: 0; }
  .requests-badge {
    background: #ef4444; color: #fff; font-size: 10px; font-weight: 700;
    padding: 1px 7px; border-radius: 4px; min-width: 18px; text-align: center;
    display: inline-block; margin-left: 4px;
  }
  .nav-badge {
    background: #ef4444; color: #fff; font-size: 9px; font-weight: 700;
    padding: 1px 6px; border-radius: 4px; margin-left: 6px; vertical-align: middle;
  }
  .user-card.locked { cursor: default; }
  .user-card.locked .user-card-stats::before { content: "ðŸ”’ "; }
  .find-search { width: 100%; max-width: 320px; margin-bottom: 16px; }
  .friends-empty {
    text-align: center; padding: 48px 20px; color: #b8afd1;
    border: 1px dashed #2a2248; border-radius: 6px;
  }
  .friends-empty-icon { font-size: 36px; margin-bottom: 10px; }
  .friends-empty-sub { font-size: 12px; color: #3d3466; margin-top: 6px; }


  /* Discover */
  .discover-head {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 14px; margin-bottom: 20px;
  }
  .discover-title {
    font-size: 24px; font-weight: 700; color: #e8e3f3;
    font-family: 'Sora', sans-serif;
  }
  .discover-subtitle {
    margin-top: 4px; font-size: 13px; color: #b8afd1;
  }
  .discover-hub-toggle {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    margin: 0 0 18px;
    padding: 4px;
    border: 1px solid rgba(196, 181, 253, 0.12);
    border-radius: 999px;
    background: rgba(255,255,255,0.03);
  }
  .discover-hub-btn {
    min-height: 34px;
    padding: 7px 16px;
    border: none;
    border-radius: 999px;
    background: transparent;
    color: #d8cff3;
    font-size: 12px;
    font-weight: 800;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0.01em;
    cursor: pointer;
    touch-action: manipulation;
    -webkit-tap-highlight-color: transparent;
    transition: background 90ms linear, color 90ms linear, box-shadow 90ms linear, transform 90ms linear;
  }
  .discover-hub-btn.active {
    background: rgba(139, 92, 246, 0.16);
    color: #ffffff;
    box-shadow: inset 0 0 0 1px rgba(196, 181, 253, 0.12);
  }
  .discover-hub-btn:active { transform: scale(0.985); }
  #discover-view,
  #anime-discover-view,
  #games-discover-view {
    transform: translate3d(0, 0, 0);
    transform-origin: top center;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    contain: layout paint style;
  }
  .discover-hub-transitioning {
    pointer-events: none;
  }
  .discover-hub-enter,
  .discover-hub-exit {
    animation: none !important;
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
  }
  .discover-search-row {
    display: flex; align-items: center; gap: 8px; margin: 0 0 22px;
    max-width: 620px;
  }
  .discover-search-input {
    flex: 1; width: 100%; min-width: 0; padding: 12px 14px !important;
    border-radius: 10px !important; font-size: 16px !important;
  }
  .discover-search-section { display: none; }
  .discover-search-section.active { display: block; }
  @media (max-width: 600px) {
    .discover-search-row { flex-wrap: nowrap; }
    .discover-search-input { flex-basis: 100%; }
  }
  .discover-section { margin-bottom: 28px; }
  /* NOTE: the movies/TV (#discover-view) inter-category gap is set in
     14-live-update-discover-controls.css with !important (v792 / v11.113) — that
     rule loads later and wins, so the authoritative value lives there, NOT here.
     A plain rule here would be silently overridden. */
  .discover-section-top {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; margin-bottom: 12px;
  }
  .discover-section-title {
    font-size: 22px; font-weight: 800; color: #ffffff;
    letter-spacing: 0; line-height: 1.15;
    font-family: 'Sora', sans-serif;
    margin: 0;
  }
  .discover-section-desc {
    max-width: 760px;
    margin: 10px 0 16px;
    color: #ffffff;
    font-size: 13px;
    line-height: 1.55;
  }
  .discover-filter-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 16px;
  }
  .discover-filter-btn {
    min-height: 34px;
    padding: 7px 14px;
    border: 1px solid rgba(196, 181, 253, 0.18);
    border-radius: 999px;
    background: rgba(255,255,255,0.04);
    color: #f7f3ff;
    font-size: 12px;
    font-weight: 800;
    font-family: 'DM Sans', sans-serif;
    letter-spacing: 0;
    cursor: pointer;
  }
  .discover-filter-btn.active {
    background: rgba(139, 92, 246, 0.28);
    border-color: rgba(196, 181, 253, 0.34);
    color: #ffffff;
  }
  .activity-feed { display: grid; grid-template-columns: 1fr; gap: 10px; }
  @media (min-width: 700px) { .activity-feed { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
  .activity-item {
    display: flex; align-items: center; gap: 12px; padding: 12px;
    background: rgba(11,8,26,0.88); border: 1px solid #3d3466; border-radius: 8px;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.04);
    cursor: pointer; transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
  }
  .activity-item:hover { border-color: #7c3aed; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0,0,0,0.32); }
  .activity-avatar,
  .activity-avatar-placeholder {
    width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0; object-fit: cover;
    background: #1e2028; border: 1px solid #3d3466;
  }
  .activity-avatar-placeholder { display: flex; align-items: center; justify-content: center; color: #a78bfa; font-size: 14px; }
  .activity-text { min-width: 0; flex: 1; font-size: 13px; color: #e8e3f3; line-height: 1.35; }
  .activity-name { color: #fff; font-weight: 700; }
  .activity-action { color: #bdb4d8; }
  .activity-title { color: #67e8f9; font-weight: 700; }
  .activity-time { color: #a99dc6; font-size: 11px; margin-top: 4px; }
  .activity-rating { color: #f59e0b; font-weight: 700; }
  .activity-title-link {
    cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
    transition: color 0.15s ease;
  }
  .activity-title-link:hover { color: #a78bfa; }
  .activity-title-chevron { font-style: normal; opacity: 0.7; font-size: 0.9em; }
  .activity-page { display: none; }
  .activity-page.active { display: block; }


  .activity-page.active {
    position: fixed;
    inset: 0;
    z-index: 1500;
    overflow-y: auto;
    /* v10.507: matched to the shelf / My List page background `#0E0E0E`
       (the canonical Editorial-Dark page surface defined by
       `body.true-dark-mode #mylist-view` at 06-profile.css:1569). The old
       purple linear-gradient was the legacy non-mode-gated background
       that made the standalone Activity page feel visually disconnected
       from the rest of the app. */
    background: #0E0E0E;
    padding-top: var(--shelfd-safe-top, 0px);
  }
  .activity-page-opening {
    will-change: clip-path, opacity;
    backface-visibility: hidden;
    transform: translateZ(0);
    contain: paint;
  }
  .activity-page.active .main-content {
    max-width: 860px;
    padding-top: 76px;
    padding-bottom: calc(34px + env(safe-area-inset-bottom, 0px));
  }
  .activity-page-back-floating {
    position: fixed !important;
    top: calc(var(--shelfd-safe-top, 0px) + 14px) !important;
    right: 16px !important;
    z-index: 1600 !important;
    width: auto !important;
    margin: 0 !important;
    border-radius: 999px !important;
    background: rgba(26, 20, 48, 0.82) !important;
    border: 1px solid rgba(167, 139, 250, 0.35) !important;
    box-shadow: 0 14px 34px rgba(0, 0, 0, 0.26) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }
  body.light-mode .activity-page.active {
    background: #f4f1fb;
  }
  body.light-mode .activity-page-back-floating {
    background: rgba(237, 233, 254, 0.86) !important;
    border-color: rgba(124, 58, 237, 0.24) !important;
    color: #12082e !important;
  }
  .activity-page-header { margin-bottom: 20px; }
  .activity-page-title {
    font-size: 22px; font-weight: 700; color: #e8e3f3;
    font-family: 'Sora', sans-serif; margin-bottom: 4px;
  }
  .activity-page-subtitle { font-size: 13px; color: #9a90b5; }
  .activity-cover,
  .activity-cover-placeholder {
    width: 34px; height: 50px; border-radius: 5px; object-fit: cover; flex-shrink: 0;
    background: #171226; border: 1px solid #3d3466;
  }
