/* Product polish: category identities are inherited from styles.css.
   One surface, spacing and motion vocabulary across discovery and your space. */
:root {
  --bg-card: #151c28;
  --bg-deep: #0e141e;
  --border-subtle: #ffffff12;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --ease-out: cubic-bezier(.2, .8, .2, 1);
  --surface-raised: color-mix(in srgb, var(--bg-card) 88%, var(--text-primary) 12%);
}
:root[data-theme="light"] {
  --bg-base: #f5f6fa;
  --bg-card: #fff;
  --bg-deep: #f0f2f7;
  --border-subtle: #26364d1c;
}
body { line-height: 1.55; }
.container { max-width: 1440px; }
button, input, select, textarea { font-family: var(--font-body); }
button, a { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 3px solid var(--accent-light); outline-offset: 4px; }
.eyebrow { margin: 0 0 10px; color: var(--text-muted); font-size: .7rem; font-weight: 800; letter-spacing: .15em; text-transform: uppercase; }
.section-hint, .library-guide { color: var(--text-muted); font-size: .88rem; line-height: 1.65; }
.section-hint { margin: 7px 0 0; max-width: 56ch; }
.library-guide { margin: -6px 0 22px; }
.library-guide strong { color: var(--text-secondary); font-weight: 600; }

/* Navigation: category tabs remain concise beside profile actions. */
.navbar { padding: 12px 18px; gap: 14px; margin-bottom: 32px; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 18px; }
.nav-brand { color: var(--text-primary); letter-spacing: -.045em; }
.nav-brand::before { content: ''; display: inline-block; width: 9px; height: 20px; border-radius: 3px; margin-right: 10px; vertical-align: -3px; background: var(--cat-movie-light); box-shadow: 4px -4px 0 var(--cat-series-light), 8px -8px 0 var(--cat-anime-light); transform: rotate(-12deg); }
.nav-tab { border-radius: 10px; transition: background-color .2s, color .2s; }
.nav-menu-pop { padding: 8px; border-radius: 16px; box-shadow: var(--shadow-modal); }
.nav-menu-item { border-radius: 9px; min-height: 44px; }
.mobile-dock { display: none; }

/* Editorial headers without obscuring the media. */
.page-header { padding: 12px 0 18px; margin: 0 0 22px; border-bottom: 1px solid var(--border-subtle); }
.page-header-title { font-size: clamp(1.8rem, 3.4vw, 2.65rem); letter-spacing: -.045em; line-height: 1.15; }
.page-header-sub { margin-top: 10px; max-width: 64ch; font-size: .96rem; }
.dash-hero { margin: 0 0 38px; padding: clamp(24px, 4vw, 54px); border: 1px solid var(--border-subtle); border-radius: 24px; position: relative; overflow: hidden; background: var(--bg-card); }
.dash-hero::before { content: ''; position: absolute; inset: 0 0 auto; height: 3px; background: linear-gradient(90deg, var(--cat-movie) 0% 25%, var(--cat-series) 25% 50%, var(--cat-anime) 50% 75%, var(--cat-game) 75%); }
.dash-hero-inner { text-align: left; padding: 0; position: relative; z-index: 1; }
.dash-hero-title { max-width: 24ch; font-size: clamp(1.9rem, 3.7vw, 3.25rem); line-height: 1.12; letter-spacing: -.045em; text-wrap: balance; }
.dash-hero-sub { margin: 16px 0 0; max-width: 56ch; line-height: 1.65; }
.dash-hero-counts, .dash-hero-cta { justify-content: flex-start; margin-top: 24px; gap: 10px; }
.dash-hero-counts .cat-stat { background: var(--bg-deep); padding: 9px 14px; border-radius: 12px; }
.dash-row { margin: 36px 0 44px; }
.dash-row-title { font-size: 1.35rem; letter-spacing: -.025em; }
.dash-section-head { align-items: center; }
.dash-row-link { font-size: .86rem; gap: 7px; color: var(--text-secondary); }
.dash-row-link::after { content: '↗'; }
.dash-upnext-card { border-radius: 16px; padding: 16px; border: 1px solid var(--border-subtle); transition: transform .25s var(--ease-out), border-color .2s; }
.dash-upnext-poster { border-radius: 9px; }
.dash-scroller { scroll-snap-type: x proximity; scroll-padding-inline: 6px; padding: 8px 2px 14px; }
.dash-card { scroll-snap-align: start; }
.dash-card-poster { aspect-ratio: 2 / 3; overflow: hidden; box-shadow: 0 6px 18px #0002; }
.dash-card-name { margin-top: 10px; font-size: .85rem; line-height: 1.4; }

/* Buttons, fields, cards and notifications share a restrained spring. */
.btn { border-radius: 11px; font-weight: 650; transition: transform .18s var(--ease-out), background-color .18s, border-color .18s, box-shadow .18s; }
.btn-primary { border: 1px solid color-mix(in srgb, var(--accent-light) 55%, transparent); }
.btn-secondary { background: var(--bg-deep); border-color: var(--border-subtle); }
.btn:active:not(:disabled), .card-quick-add:active { transform: scale(.96); }
.btn:disabled { cursor: wait; }
.search-input, .filter-select, .form-input, .cl-form-input, .cl-form-textarea { border-radius: 12px; border-color: var(--border-subtle); background-color: var(--bg-deep); transition: border-color .18s, box-shadow .18s; }
.search-input:focus, .form-input:focus, .cl-form-input:focus, .cl-form-textarea:focus { border-color: var(--accent-light); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-bar { gap: 10px; }
.game-image-wrapper { border: 1px solid var(--border-subtle); transition: transform .3s var(--ease-out), box-shadow .3s; }
.game-image-wrapper { z-index: 2; pointer-events: none; }
.game-image-wrapper .card-quick-add { pointer-events: auto; }
.game-image, .dash-card-poster img { transition: transform .45s var(--ease-out); }
.game-title { line-height: 1.4; }
.card-quick-add { border-radius: 50%; box-shadow: 0 4px 14px #0005; transition: transform .2s, background-color .2s; }
.card-rating { border-radius: 8px; }
.filter-section, .stats-dashboard, .my-games-section, .friends-section, .profile-section, .pf-section { border-color: var(--border-subtle); box-shadow: none; }
.cl-modal-box, .update-modal-content, .remove-modal-content, .quick-add-panel, .gsearch-box { border-radius: 22px; border: 1px solid var(--border-subtle); box-shadow: var(--shadow-modal); }
.cl-modal-close, .cl-game-modal-close-btn { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; font-size: 1.5rem; }
.empty-state, .coll-empty-state, .pf-empty { border-radius: 16px; background: var(--bg-deep); }
.coll-empty-state { margin: 16px; border: 1px dashed var(--border); padding: 44px 22px; }
.coll-empty-icon { color: var(--text-primary); font-family: var(--font-display); font-size: 1.35rem; }

/* Library and collections: track in one place, curate in the other. */
.page-tabs { background: var(--bg-deep); border: 1px solid var(--border-subtle); padding: 5px; border-radius: 14px; max-width: 540px; margin-bottom: 18px; box-shadow: none; }
.page-tab { min-height: 46px; border-radius: 10px; font-weight: 650; }
.page-tab.active { background: var(--surface-raised); color: var(--text-primary); box-shadow: 0 2px 5px #0001; }
.media-tabs { gap: 8px; }
.media-tab { border-radius: 12px; }
.stats-dashboard { padding: 22px; border-radius: 18px; }
#collectionOverview .stats-title { text-align: left; font-size: 1rem; margin-bottom: 18px; }
.overview-split { gap: 28px; }
.overview-pie-col { width: 150px; }
.overview-pie-col .pie-chart-container { width: 120px; height: 120px; }
.list-header { padding: 22px 24px; gap: 18px; }
.list-header h2 { font-size: 1.3rem; letter-spacing: -.02em; }
.list-header .eyebrow { margin-bottom: 5px; }
.list-header-actions { flex-wrap: wrap; }
.coll-item.list-item, .coll-item.cl-list-item { padding: 16px 24px; }
.coll-item.list-item .coll-item-img, .coll-item.cl-list-item .coll-item-img { height: 78px; width: 52px; border-radius: 8px; }
#clAccordion { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; padding: 20px; align-items: start; }
.cl-acc-row { min-width: 0; margin: 0; background: var(--bg-card); border: 1px solid var(--border-subtle); border-radius: 18px; overflow: hidden; }
.cl-acc-row.expanded { grid-column: 1 / -1; border-color: var(--accent-border); }
.cl-acc-header { padding: 0; display: flex; flex-direction: column; align-items: stretch; gap: 0; }
.cl-collection-toggle { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 22px; gap: 16px; padding: 20px; text-align: left; border: 0; background: transparent; color: var(--text-primary); cursor: pointer; font: inherit; }
.cl-collection-toggle:focus-visible { outline-offset: -5px; }
.collection-cover { grid-column: 1 / -1; display: flex; align-items: center; justify-content: center; gap: 0; height: 144px; overflow: hidden; border-radius: 12px; background: var(--bg-deep); }
.collection-cover img { height: 120px; width: 80px; object-fit: cover; border-radius: 7px; box-shadow: 0 5px 15px #0004; transform: rotate(-9deg); }
.collection-cover img:nth-child(2) { transform: translateY(-4px) rotate(0); z-index: 1; margin: 0 -7px; }
.collection-cover img:nth-child(3) { transform: rotate(9deg); }
.collection-cover-mark { font-size: 56px; color: var(--text-muted); }
.cl-acc-chevron { grid-column: 2; grid-row: 2; align-self: center; color: var(--text-muted); }
.cl-acc-title-group { grid-column: 1; grid-row: 2; min-width: 0; }
.cl-acc-title-row { gap: 8px; }
.cl-acc-name { flex-basis: 100%; font-size: 1.15rem; font-family: var(--font-display); overflow-wrap: anywhere; }
.cl-acc-desc { margin-top: 10px; line-height: 1.6; font-size: .85rem; color: var(--text-muted); }
.up-acc-header .cl-acc-title-group, .up-acc-header .cl-acc-chevron { grid-row: 1; }
.cl-acc-header-right { padding: 0 20px 18px; gap: 8px; justify-content: flex-end; }
.cl-acc-header-right .btn-danger { background: transparent; color: var(--red-light); border: 1px solid var(--border-subtle); }
.cl-acc-body { border-top: 1px solid var(--border-subtle); }
.cl-acc-row.expanded .collection-cover { height: 108px; }
.cl-acc-row.expanded .collection-cover img { height: 92px; width: 62px; }
.cl-acc-row[data-cat="movie"] .collection-cover { background: var(--cat-movie-dim); }
.cl-acc-row[data-cat="series"] .collection-cover { background: var(--cat-series-dim); }
.cl-acc-row[data-cat="anime"] .collection-cover { background: var(--cat-anime-dim); }
.cl-acc-row[data-cat="game"] .collection-cover { background: var(--cat-game-dim); }
.collection-add-hint { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; padding: 18px 22px; font-size: .85rem; color: var(--text-muted); border-bottom: 1px solid var(--border-subtle); }
.collection-add-hint > span { flex: 1 1 220px; }

/* Profiles lead with identity, followed by taste and useful account tools. */
.profile-intro { padding: 0 0 26px; margin-bottom: 24px; border-bottom: 1px solid var(--border-subtle); position: relative; }
.profile-intro h2 { font-family: var(--font-display); font-size: clamp(1.9rem, 4vw, 3rem); letter-spacing: -.04em; line-height: 1.15; overflow-wrap: anywhere; }
.profile-intro .eyebrow { color: var(--pf-accent); }
.profile-public-link { display: inline-flex; align-items: center; min-height: 44px; color: var(--text-secondary); font-size: .86rem; text-decoration: none; margin-top: 8px; }
.profile-public-link:hover { color: var(--pf-accent); }
#profileDisplay { border-top: 3px solid var(--pf-accent); background: radial-gradient(ellipse at 100% 0, var(--pf-accent-dim), transparent 50%); }
.profile-avatar { border: 3px solid var(--bg-card); outline: 1px solid var(--border-subtle); box-shadow: 0 8px 25px #0002; }
.profile-avatar-section { flex-wrap: wrap; gap: 24px; }
.profile-stats { gap: 10px; flex-wrap: wrap; }
.profile-stats .stat-item { min-width: 92px; padding: 12px 16px; background: var(--bg-deep); border-radius: 14px; border: 1px solid var(--border-subtle); }
.connection-stat { color: inherit; font: inherit; cursor: pointer; display: flex; flex-direction: column; align-items: center; transition: background-color .2s, transform .2s; }
.connection-stat .stat-label::after { content: ' ↗'; font-size: .75em; }
.connection-stat:hover { background: var(--surface-raised); }
.profile-stats .stat-value { font-size: 1.8rem; font-family: var(--font-display); line-height: 1.2; }
  .profile-stats .stat-label { margin-top: 5px; font-size: .76rem; }
.profile-details { gap: 20px; }
.profile-details .detail-item { border-bottom-color: var(--border-subtle); }
.profile-details .detail-item label { font-size: .73rem; text-transform: uppercase; letter-spacing: .07em; }
.profile-actions { justify-content: flex-start; }
.data-tools { border-top-color: var(--border-subtle); margin-top: 20px; padding-top: 0; }
.data-tools > summary { cursor: pointer; padding: 18px 0; font-weight: 650; color: var(--text-secondary); }
.data-tools > summary span { font-weight: 400; font-size: .82rem; color: var(--text-muted); margin-left: 12px; }
.data-tools[open] > summary { margin-bottom: 4px; }
.pf-banner { height: 150px; }
.pf-section-head { gap: 18px; }
.pf-showcase { padding-bottom: 12px; }
.pf-bio { max-width: 62ch; margin: 12px 0; line-height: 1.7; }
.connections-box { max-width: 520px; }
.connections-box h2 { margin: 0 0 20px; font-family: var(--font-display); font-size: 1.8rem; }
#connectionsSearch { width: 100%; margin-bottom: 16px; }
#connectionsResults { max-height: 48dvh; overflow-y: auto; overscroll-behavior: contain; }
.connection-person { display: flex; align-items: center; gap: 14px; padding: 13px 8px; border-bottom: 1px solid var(--border-subtle); color: var(--text-primary); text-decoration: none; border-radius: 10px; }
.connection-person:hover { background: var(--bg-deep); }
.connection-person > span:nth-child(2) { min-width: 0; overflow-wrap: anywhere; }
.connection-person strong, .connection-person small { display: block; }
.connection-person small { color: var(--text-muted); margin-top: 3px; }
.connection-avatar { display: grid; place-items: center; flex-shrink: 0; width: 44px; height: 44px; border-radius: 50%; background: var(--surface-raised); font-weight: 700; }
.connection-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.connection-arrow { margin-left: auto; color: var(--text-muted); }
.connection-empty { padding: 24px 8px; color: var(--text-muted); text-align: center; }
.connection-empty .btn { margin-top: 16px; }

/* Social discovery uses the same quiet surfaces as the personal library. */
.social-welcome { display: flex; align-items: center; gap: 22px; padding: 26px; border: 1px solid var(--border-subtle); border-radius: 20px; margin-bottom: 22px; background: var(--bg-card); }
.social-orbit { font-size: 2.5rem; color: var(--cat-anime-light); }
.social-welcome h2 { font-size: 1.2rem; letter-spacing: -.02em; }
.social-welcome p { color: var(--text-muted); font-size: .9rem; margin-top: 6px; }
.social-welcome .btn { margin-left: auto; flex-shrink: 0; }
.friend-item { border-radius: 16px; padding: 20px; gap: 16px; background: var(--bg-card); border-color: var(--border-subtle); transition: border-color .2s, transform .2s; }
.friend-avatar { width: 56px; height: 56px; border-radius: 18px; }
.friend-name { text-decoration: none; color: var(--text-primary); font-weight: 700; }
a.friend-name:hover { text-decoration: underline; text-underline-offset: 4px; }
.friend-actions { gap: 8px; }
.is-following { color: var(--cat-series-light); border-color: var(--cat-series-border); background: var(--cat-series-dim); }
.activity-item { border-color: var(--border-subtle); border-radius: 14px; }
.site-footer { margin-top: 64px; }

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  .btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 4px 14px #0002; }
  .game-card:hover .game-image-wrapper { transform: translateY(-5px); box-shadow: 0 14px 30px #0004; }
  .game-card:hover .game-image, .dash-card:hover img { transform: scale(1.035); }
  .dash-upnext-card:hover, .friend-item:hover { transform: translateY(-3px); border-color: var(--accent-border); }
  .cl-collection-toggle:hover .collection-cover img:first-child { transform: rotate(-13deg) translateX(-5px); }
  .cl-collection-toggle:hover .collection-cover img:last-child { transform: rotate(13deg) translateX(5px); }
  .collection-cover img { transition: transform .3s var(--ease-out); }
}
@media (prefers-reduced-motion: no-preference) {
  .page-header, .dash-hero, .profile-intro, .social-welcome { animation: story-arrive .45s var(--ease-out) both; }
  .tab-panel.active, .cl-acc-row.expanded .cl-acc-body { animation: story-arrive .25s var(--ease-out) both; }
  .is-following { animation: story-confirm .3s var(--ease-out); }
  @keyframes story-arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }
  @keyframes story-confirm { 50% { transform: scale(1.04); } }
}
@media (max-width: 900px) {
  .navbar { gap: 8px; }
  .nav-primary { justify-content: center; }
  #clAccordion { gap: 12px; padding: 14px; }
}
@media (max-width: 700px) {
  body.has-mobile-dock { padding-bottom: calc(80px + env(safe-area-inset-bottom)); }
  .mobile-dock { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); position: fixed; inset: auto 0 0; z-index: 90; padding: 8px 8px max(8px, env(safe-area-inset-bottom)); background: var(--bg-card); border-top: 1px solid var(--border-subtle); box-shadow: 0 -8px 25px #0002; }
  .mobile-dock a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; min-height: 52px; padding: 4px 0; border-radius: 12px; color: var(--text-muted); text-decoration: none; font-size: .65rem; font-weight: 650; }
  .mobile-dock svg { width: 21px; height: 21px; }
  .mobile-dock a[aria-current] { color: var(--text-primary); background: var(--surface-raised); }
  .dash-hero { padding: 26px 22px; margin-bottom: 28px; }
  .dash-hero-title { font-size: 2rem; }
  .dash-hero-sub { font-size: .92rem; }
  .dash-hero-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dash-hero-counts .cat-stat { justify-content: center; padding: 8px; }
  .dash-hero-cta .btn { flex: 1; font-size: .83rem; padding-inline: 12px; }
  .dash-row { margin-block: 28px; }
  .dash-row-title { font-size: 1.2rem; }
  .dash-card { width: 132px; }
  .dash-card-poster { height: auto; }
  .dash-upnext-card { padding: 12px; }
  .page-header { padding: 3px 0 18px; }
  .page-header-title { font-size: 2rem; }
  .page-tabs { max-width: none; }
  .library-guide { font-size: .79rem; margin-bottom: 18px; }
  #clAccordion { grid-template-columns: minmax(0, 1fr); padding: 12px; }
  .cl-collection-toggle { padding: 16px; }
  .collection-cover { height: 120px; }
  .collection-cover img { height: 100px; width: 67px; }
  .list-header { padding: 18px 16px; }
  .list-header-actions { width: 100%; }
  .list-header-actions .search-input { flex: 1 1 100%; width: 100%; min-width: 0; }
  .list-header-actions .filter-select { flex: 1; min-width: 0; }
  .coll-item.list-item, .coll-item.cl-list-item { padding: 14px; }
  .profile-content { padding: 20px; }
  .profile-intro { padding-bottom: 18px; }
  .profile-avatar-section { gap: 18px; }
  #profileDisplay .profile-avatar-section { grid-template-columns: minmax(0, 1fr); }
  #profileDisplay .cat-breakdown, #upMediaBreakdown { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-column: 1 / -1; }
  #profileDisplay .cat-breakdown .cat-stat, #upMediaBreakdown .cat-stat { justify-content: center; }
  .profile-stats { gap: 6px; width: 100%; }
  .profile-stats .stat-item { flex: 1; min-width: 0; padding: 12px 8px; }
  .profile-avatar { width: 84px; height: 84px; }
  .data-tools > summary span { display: block; margin: 4px 0 0; }
  .social-welcome { flex-wrap: wrap; padding: 20px; gap: 12px; }
  .social-orbit { display: none; }
  .social-welcome .btn { margin-left: 0; }
  .friend-item { padding: 16px; flex-wrap: wrap; }
  .friend-info { min-width: 0; flex: 1; }
  .friend-name { overflow-wrap: anywhere; }
  .friend-actions { width: 100%; display: flex; }
  .friend-actions .btn { flex: 1; padding-inline: 10px; font-size: .83rem; }
  .connections-box { padding: 24px 18px; }
  .cl-toast, .toast-host { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (max-width: 360px) {
  .nav-brand::before { display: none; }
  .dash-hero { padding: 22px 16px; }
  .dash-hero-title { font-size: 1.8rem; }
  .mobile-dock a { font-size: .59rem; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  ::view-transition-old(root), ::view-transition-new(root) { animation: none !important; }
}
