/* Explore (community.html) — immersive public feed, profiles, hall of fame.
   Brand: monochrome graphite, flat depth (hairlines + surface steps, no blur
   shadows), tokens from css/index.css. Motion per DESIGN.md: 120/180/260ms,
   --ease-out default, --ease-spring only for playful moments (the like). */

/* Many elements here (and .btn in index.css) set their own display, which
   beats the UA's [hidden] rule — without this, hidden modals render open. */
.community-body [hidden] {
  display: none !important;
}

.community-body {
  margin: 0;
  background: var(--bg-app);
  color: var(--text);
  font-family: var(--font-main);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  /* Ink that sits on a dark media scrim: white in both themes. */
  --cx-on-media: var(--text-accent);
}

html[data-theme="light"] .community-body {
  --cx-on-media: var(--on-accent);
}

.community-body :focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}

/* ── Top bar ──
   One row on desktop: wordmark, text tabs with an underline, quiet actions.
   Below 900px the tabs drop into their own strip instead of wrapping as pills. */
.cx-topbar {
  position: sticky;
  top: 0;
  z-index: var(--z-nav);
  background: var(--bg-app);
  border-bottom: 1px solid var(--line);
}

.cx-topbar-bar {
  display: flex;
  align-items: stretch;
  gap: var(--space-4);
  min-height: 60px;
  padding: 0 var(--space-5);
}

.cx-brand {
  display: inline-flex;
  align-items: center;
  flex: none;
  color: var(--text);
  text-decoration: none;
  border-radius: var(--radius-sm);
}

.cx-brand .brand-logo {
  display: block;
  height: 22px;
  width: auto;
}

.cx-tabs {
  display: flex;
  align-items: stretch;
  gap: 2px;
  min-width: 0;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}

.cx-tabs::-webkit-scrollbar { display: none; }

.cx-tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  padding: 0 14px;
  min-height: 44px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  letter-spacing: -0.01em;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cx-tab:hover { color: var(--text); }
}

.cx-tab.active { color: var(--text); }

.cx-tab.active::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--text);
}

.cx-topbar-right {
  position: relative;
  display: flex;
  align-items: center;
  gap: var(--space-1);
  flex: none;
  margin-left: auto;
}

.cx-guidelines {
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  transition: color var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cx-guidelines:hover { color: var(--text); }
}

.cx-bell {
  position: relative;
  width: 40px;
  height: 40px;
}

.cx-bell .material-symbols-rounded { font-size: 22px; }

.cx-bell-badge {
  position: absolute;
  top: 4px;
  right: 2px;
  min-width: 20px;
  height: 20px;
  padding: 0 var(--space-1);
  border-radius: var(--radius-pill);
  background: var(--danger);
  color: var(--bg-app);
  font-size: 14px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  box-sizing: border-box;
}

.cx-notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(400px, calc(100vw - 32px));
  max-height: min(540px, 74vh);
  overflow-y: auto;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  z-index: var(--z-dropdown);
  animation: cx-modal-in var(--dur-base) var(--ease-out) both;
  transform-origin: top right;
  overscroll-behavior: contain;
}

.cx-notif-head {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: var(--space-3) var(--space-4);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}

.cx-notif-sec {
  padding: var(--space-3) var(--space-4) var(--space-1);
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-faint);
}

.cx-notif-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  min-height: 56px;
  color: var(--text);
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out);
  box-sizing: border-box;
}

@media (hover: hover) and (pointer: fine) {
  .cx-notif-row:hover { background: var(--surface-soft); }
}

.cx-notif-row.unread { background: var(--surface-2); }

.cx-notif-row .cx-avatar { width: 40px; height: 40px; font-size: 15px; }

/* Actor avatar with the action badge on its corner (like/comment/follow/remix). */
.cx-notif-ava { position: relative; flex: none; display: inline-flex; }

.cx-notif-kind {
  position: absolute;
  right: -4px;
  bottom: -4px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 2px solid var(--panel);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.cx-notif-kind .material-symbols-rounded {
  font-size: 12px;
  font-variation-settings: "FILL" 1;
}

.cx-notif-kind.kind-like { background: var(--danger); color: var(--bg-app); }
.cx-notif-kind.kind-comment { background: var(--surface-soft); color: var(--text); }
.cx-notif-kind.kind-follow { background: var(--accent); color: var(--on-accent); }
.cx-notif-kind.kind-remix { background: var(--accent-warm); color: var(--bg-app); }
.cx-notif-kind.kind-comment_like { background: var(--danger); color: var(--bg-app); }
.cx-notif-kind.kind-reply { background: var(--surface-soft); color: var(--text); }

.cx-notif-snippet { color: var(--text-muted); font-style: italic; }

.cx-notif-thumb {
  width: 44px;
  height: 44px;
  flex: none;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  object-fit: cover;
  object-position: top;
  background: var(--surface);
}

.cx-notif-row .cx-follow-btn { flex: none; }

.cx-notif-text {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  line-height: 1.45;
  color: var(--text-soft);
}

.cx-notif-text strong { color: var(--text); }

.cx-notif-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-6) var(--space-4);
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
}

.cx-notif-empty .material-symbols-rounded { font-size: 32px; color: var(--text-faint); }

.cx-me-btn {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface-soft) center/cover no-repeat;
  color: var(--text);
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  transition: transform var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cx-me-btn:hover { border-color: var(--line-accent); transform: scale(1.05); }
}

.cx-me-btn:active { transform: scale(0.95); }

/* ── Main area ── */
/* index.css locks html/body to overflow:hidden (the app pages are
   full-viewport), so this is the page's real scroll container: profile,
   project, creators and hall views all scroll here. */
.cx-main {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.cx-loading,
.cx-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-8) var(--space-4);
  color: var(--text-muted);
  text-align: center;
  flex-direction: column;
}

.cx-empty .material-symbols-rounded {
  font-size: 44px;
  color: var(--text-faint);
}

.cx-spin { animation: cx-rotate 0.9s linear infinite; }

@keyframes cx-rotate { to { transform: rotate(360deg); } }

/* ── Skeletons (perceived speed: content shape appears instantly) ── */
.cx-skel {
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  border: 1px solid var(--line);
  animation: cx-pulse 1.4s var(--ease-in-out) infinite;
}

@keyframes cx-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.cx-skel-card {
  width: min(880px, 100%);
  aspect-ratio: 16 / 10;
  max-height: 70vh;
  margin: var(--space-4) auto;
}

.cx-skel-tile { aspect-ratio: 16 / 12; }

/* ── Entrances ── */
@keyframes cx-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.cx-enter { animation: cx-rise var(--dur-slow) var(--ease-out) both; }

/* Feed cards keep animating transform/opacity via the is-active transition
   after entry — a `both` fill would pin the keyframe's end state forever. */
.cx-card-inner.cx-enter { animation-fill-mode: backwards; }

.cx-grid > .cx-enter:nth-child(1) { animation-delay: 0ms; }
.cx-grid > .cx-enter:nth-child(2) { animation-delay: 45ms; }
.cx-grid > .cx-enter:nth-child(3) { animation-delay: 90ms; }
.cx-grid > .cx-enter:nth-child(4) { animation-delay: 135ms; }
.cx-grid > .cx-enter:nth-child(5) { animation-delay: 180ms; }
.cx-grid > .cx-enter:nth-child(6) { animation-delay: 225ms; }
.cx-grid > .cx-enter:nth-child(n + 7) { animation-delay: 260ms; }

/* ── Reels feed ── */
.cx-feed {
  height: 100%;
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  overscroll-behavior: contain;
  scrollbar-width: none;
}

.cx-feed::-webkit-scrollbar { display: none; }

.cx-card {
  scroll-snap-align: start;
  scroll-snap-stop: always;
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  box-sizing: border-box;
}

/* Stage + meta share a grid cell: the meta floats on the artwork over a
   scrim, TikTok-style, so the work itself is the whole card. */
.cx-card-inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 68px;
  gap: var(--space-4);
  align-items: end;
  width: min(960px, 100%);
  max-height: 100%;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-slow) var(--ease-out);
}

/* Focus physics: the watched card is full presence, neighbors recede. */
.cx-card:not(.is-active) .cx-card-inner {
  transform: scale(0.975);
  opacity: 0.55;
}

.cx-stage {
  grid-column: 1;
  grid-row: 1;
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% 0%, var(--bg-850) 0%, var(--bg-950) 70%);
  aspect-ratio: 16 / 10;
  max-height: calc(100vh - 160px);
  width: 100%;
}

/* Poster paints instantly; the live iframe mounts above it and fades in. */
.cx-poster {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
}

.cx-stage iframe {
  position: relative;
  z-index: 1;
  width: 100%;
  height: 100%;
  border: 0;
  background: var(--surface);
  display: block;
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
}

.cx-stage iframe.ready { opacity: 1; }

.cx-stage iframe.inert { pointer-events: none; }

.cx-stage-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  /* Without this, a double-tap zooms the page instead of liking. */
  touch-action: manipulation;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  cursor: pointer;
  border: 0;
  color: var(--cx-on-media);
  font: inherit;
  padding: 0;
}

.cx-stage-overlay span.hint {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity var(--dur-base) var(--ease-out), transform var(--dur-base) var(--ease-out);
}

.cx-card:hover .cx-stage-overlay span.hint,
.cx-stage-overlay:focus-visible span.hint {
  opacity: 1;
  transform: translateY(0);
}

@media (hover: none) {
  .cx-stage-overlay span.hint { opacity: 1; transform: none; }
}

/* Double-tap heart burst */
.cx-heart-burst {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  font-size: 84px;
  line-height: 1;
  color: var(--danger);
  font-variation-settings: "FILL" 1;
  transform: translate(-50%, -50%) scale(0.3);
  animation: cx-heart 700ms var(--ease-spring) both;
}

@keyframes cx-heart {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.3) rotate(-8deg); }
  22% { opacity: 1; transform: translate(-50%, -50%) scale(1.12) rotate(3deg); }
  55% { opacity: 1; transform: translate(-50%, -60%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -110%) scale(0.92); }
}

.cx-heart-mini {
  position: absolute;
  z-index: 3;
  pointer-events: none;
  font-size: 22px;
  color: var(--cx-on-media);
  font-variation-settings: "FILL" 1;
  transform: translate(-50%, -50%);
  opacity: 0;
  animation: cx-heart-drift 900ms var(--ease-out) both;
}

@keyframes cx-heart-drift {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.5); }
  25% { opacity: 0.95; transform: translate(-50%, -90%) scale(1) rotate(-6deg); }
  100% { opacity: 0; transform: translate(-50%, -240%) scale(0.8) rotate(8deg); }
}

/* Meta overlaid on the stage bottom */
.cx-card-meta {
  grid-column: 1;
  grid-row: 1;
  z-index: 2;
  align-self: end;
  min-width: 0;
  padding: var(--space-6) var(--space-4) var(--space-4);
  border-radius: 0 0 var(--radius-xl) var(--radius-xl);
  background: linear-gradient(transparent, var(--scrim) 46%, var(--scrim));
  color: var(--cx-on-media);
  pointer-events: none;
}

.cx-card-meta a,
.cx-card-meta button {
  pointer-events: auto;
}

.cx-creator-row {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
}

.cx-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface-soft) center/cover no-repeat;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  text-decoration: none;
  flex: none;
  transition: transform var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cx-avatar:hover { transform: scale(1.06); }
}

.cx-card-meta .cx-avatar {
  border-color: color-mix(in srgb, var(--cx-on-media) 35%, transparent);
  color: var(--cx-on-media);
}

.cx-handle {
  font-weight: 700;
  color: inherit;
  text-decoration: none;
  font-size: 14.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 18ch;
}

.cx-time {
  opacity: 0.65;
  font-size: 14px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

.cx-handle:hover { text-decoration: underline; }

.cx-follow-btn {
  padding: var(--space-1) var(--space-4);
  min-height: 32px;
  border-radius: var(--radius-pill);
  border: 1px solid var(--line-strong);
  background: none;
  color: inherit;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition:
    background var(--dur-fast) var(--ease-out),
    color var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-fast) var(--ease-out);
}

.cx-card-meta .cx-follow-btn { border-color: color-mix(in srgb, var(--cx-on-media) 40%, transparent); }

@media (hover: hover) and (pointer: fine) {
  .cx-follow-btn:hover { border-color: var(--line-accent); }
  .cx-card-meta .cx-follow-btn:hover { background: color-mix(in srgb, var(--cx-on-media) 14%, transparent); }
}

.cx-follow-btn:active { transform: scale(0.96); }

.cx-follow-btn.following {
  background: var(--surface-soft);
  color: var(--text-muted);
  border-color: transparent;
}

.cx-card-meta .cx-follow-btn.following {
  background: color-mix(in srgb, var(--cx-on-media) 16%, transparent);
  color: color-mix(in srgb, var(--cx-on-media) 75%, transparent);
}

.cx-title {
  margin: var(--space-2) 0 0;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.01em;
  text-wrap: balance;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cx-card-meta .cx-title,
.cx-card-meta .cx-title a,
.cx-card-meta .cx-desc,
.cx-card-meta .cx-handle {
  color: var(--cx-on-media);
}

.cx-title a { pointer-events: auto; }

.cx-desc {
  margin: 0;
  color: inherit;
  opacity: 0.82;
  font-size: 14px;
  text-wrap: pretty;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.cx-attrib {
  margin-top: var(--space-1);
  font-size: 14px;
  opacity: 0.75;
}

.cx-attrib a { color: inherit; }

.cx-badges {
  display: inline-flex;
  gap: var(--space-2);
  margin-left: var(--space-2);
  vertical-align: middle;
}

.cx-badge {
  font-size: 14px;
  font-weight: 600;
  padding: var(--space-1) var(--space-2);
  border-radius: var(--radius-pill);
  border: 1px solid currentColor;
  opacity: 0.7;
}

/* ── Action rail ── */
.cx-rail {
  grid-column: 2;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  align-items: center;
  padding-bottom: var(--space-2);
}

.cx-rail-btn {
  position: relative;
  touch-action: manipulation;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--text-soft);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
  padding: 0;
}

.cx-rail-btn .material-symbols-rounded {
  font-size: 24px;
  width: 48px;
  height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition:
    transform var(--dur-fast) var(--ease-out),
    border-color var(--dur-fast) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cx-rail-btn:hover .material-symbols-rounded {
    transform: scale(1.08);
    border-color: var(--line-strong);
    background: var(--surface-soft);
  }
}

.cx-rail-btn:active .material-symbols-rounded { transform: scale(0.9); }

.cx-rail-btn.liked { color: var(--danger); }

.cx-rail-btn.liked .material-symbols-rounded {
  font-variation-settings: "FILL" 1;
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 45%, transparent);
}

/* Springy pop when a like lands */
.cx-rail-btn.pop .material-symbols-rounded {
  animation: cx-pop var(--dur-slow) var(--ease-spring);
}

@keyframes cx-pop {
  0% { transform: scale(0.7); }
  55% { transform: scale(1.22); }
  100% { transform: scale(1); }
}

.cx-rail-btn [data-zero="1"] {
  opacity: 0.45;
  color: var(--text-faint);
}

.cx-rail-btn [data-count] {
  transition: transform var(--dur-fast) var(--ease-out);
}

.cx-rail-btn.pop [data-count] { transform: scale(1.15); }

/* ── Grids (creators, profile, hall) ── */
.cx-page {
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: var(--space-5) var(--space-4) var(--space-8);
  box-sizing: border-box;
}

.cx-page h1 {
  font-size: 26px;
  margin: 0 0 var(--space-5);
  letter-spacing: -0.02em;
  text-wrap: balance;
}

.cx-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

.cx-tile {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  overflow: hidden;
  cursor: pointer;
  transition:
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-base) var(--ease-out),
    background var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cx-tile:hover {
    border-color: var(--line-strong);
    transform: translateY(-3px);
    background: var(--surface-soft);
  }
  .cx-tile:hover .cx-tile-thumb iframe { transform: scale(0.52) translateY(-6px); }
}

.cx-tile:active { transform: translateY(-1px) scale(0.99); }

.cx-tile-thumb {
  aspect-ratio: 16 / 10;
  background: var(--surface);
  position: relative;
  overflow: hidden;
  border-bottom: 1px solid var(--line);
}

.cx-tile-thumb iframe {
  width: 200%;
  height: 200%;
  transform: scale(0.5);
  transform-origin: top left;
  border: 0;
  pointer-events: none;
  background: var(--surface);
  opacity: 0;
  transition: transform var(--dur-slow) var(--ease-out), opacity var(--dur-slow) var(--ease-out);
}

.cx-tile-thumb iframe.ready { opacity: 1; }

.cx-tile-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
  transition: transform var(--dur-slow) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cx-tile:hover .cx-tile-img { transform: scale(1.04); }
}

.cx-tile-body { padding: var(--space-3) var(--space-4); }

.cx-tile-title {
  font-weight: 700;
  font-size: 15px;
  margin: 0 0 4px;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-tile-sub {
  color: var(--text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  margin: 0;
  display: flex;
  gap: var(--space-3);
  flex-wrap: wrap;
}

.cx-creator-card {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  padding: var(--space-3) var(--space-4);
  transition:
    border-color var(--dur-fast) var(--ease-out),
    transform var(--dur-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cx-creator-card:hover { border-color: var(--line-strong); transform: translateY(-2px); }
}

.cx-creator-card .cx-avatar { width: 48px; height: 48px; font-size: 18px; }

.cx-creator-card-info { flex: 1; min-width: 0; }

.cx-creator-card-info .name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-creator-card-info .stats {
  color: var(--text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}

/* ── Hall of fame ── */
.cx-hall {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: var(--space-5);
  align-items: start;
}

.cx-board {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface-2);
  overflow: hidden;
}

.cx-board h2 {
  margin: 0;
  padding: var(--space-3) var(--space-4);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: var(--space-2);
  color: var(--text-soft);
}

.cx-board h2 .material-symbols-rounded { font-size: 19px; }

.cx-board-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  color: inherit;
  text-decoration: none;
  transition: background var(--dur-fast) var(--ease-out);
}

.cx-board-row:last-child { border-bottom: 0; }

@media (hover: hover) and (pointer: fine) {
  .cx-board-row:hover { background: var(--surface-soft); }
}

.cx-rank {
  width: 30px;
  font-weight: 800;
  font-size: 15px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  flex: none;
}

/* Podium: only the top three get a color voice — sparing, per the brand. */
.cx-board-row:nth-of-type(1) .cx-rank { color: var(--warn-text); font-size: 18px; }
.cx-board-row:nth-of-type(2) .cx-rank { color: var(--text-soft); font-size: 16px; }
.cx-board-row:nth-of-type(3) .cx-rank { color: var(--accent-warm); }

.cx-board-row .info { flex: 1; min-width: 0; }

.cx-board-row .info .t {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-board-row .info .s {
  color: var(--text-muted);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

/* ── Profile header ── */
.cx-profile-head {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  margin-bottom: var(--space-5);
  flex-wrap: wrap;
}

.cx-profile-head .cx-avatar { width: 84px; height: 84px; font-size: 30px; }

.cx-profile-head h1 { margin: 0 0 2px; }

.cx-profile-head .handle { color: var(--text-muted); }

.cx-profile-head .bio {
  margin: var(--space-1) 0 0;
  color: var(--text-soft);
  max-width: 60ch;
  text-wrap: pretty;
}

.cx-profile-stats {
  display: flex;
  gap: var(--space-4);
  margin-top: var(--space-2);
  font-size: 14px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.cx-profile-stats strong { color: var(--text); }

/* ── Project page ── */
.cx-post-stage { max-width: 100%; margin-bottom: var(--space-4); }

.cx-post-stage .cx-stage {
  aspect-ratio: 16 / 9;
  max-height: 74vh;
  border-radius: var(--radius-xl);
}

.cx-post-cols {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: var(--space-6);
}

.cx-lineage {
  border-left: 2px solid var(--line-strong);
  padding-left: var(--space-3);
  margin: var(--space-3) 0;
  font-size: 14px;
  color: var(--text-muted);
}

.cx-lineage a { color: var(--text-soft); }

.cx-license-note {
  font-size: 14px;
  color: var(--text-faint);
  border-top: 1px solid var(--line);
  margin-top: var(--space-5);
  padding-top: var(--space-3);
  max-width: 65ch;
  text-wrap: pretty;
}

/* ── Comments drawer ── */
.cx-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 92vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  z-index: var(--z-modal);
  display: flex;
  flex-direction: column;
  animation: cx-drawer-in 260ms cubic-bezier(0.32, 0.72, 0, 1) both;
}

@keyframes cx-drawer-in {
  from { transform: translateX(24px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

.cx-drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}

.cx-drawer-head strong {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cx-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: var(--space-3) var(--space-4);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.cx-comment { display: flex; gap: var(--space-2); align-items: flex-start; }

/* Replies indent under their parent, Instagram-style. */
.cx-comment.cx-reply { margin-left: 38px; }

.cx-comment.cx-reply .cx-avatar { width: 24px; height: 24px; font-size: 12px; }

/* Comment heart: its own right-hand column, small and quiet until liked. */
.cx-cmt-like {
  flex: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  border: 0;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  padding: 4px 2px;
  font: inherit;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  touch-action: manipulation;
}

.cx-cmt-like .material-symbols-rounded {
  font-size: 16px;
  transition: transform var(--dur-fast) var(--ease-spring);
}

.cx-cmt-like:active .material-symbols-rounded { transform: scale(1.3); }

.cx-cmt-like.liked {
  color: var(--danger);
}

.cx-cmt-like.liked .material-symbols-rounded { font-variation-settings: "FILL" 1; }

.cx-cmt-actions { display: flex; gap: var(--space-3); margin-top: 2px; }

.cx-cmt-act {
  border: 0;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 2px 0;
}

.cx-cmt-act:hover { color: var(--text-soft); }

.cx-view-replies {
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  padding: 0 0 0 46px;
  text-align: left;
  margin-top: -4px;
}

.cx-view-replies:hover { color: var(--text-soft); }

/* Best / Recent sort pills in the drawer head */
.cx-sort {
  display: inline-flex;
  gap: 2px;
  background: var(--surface-soft);
  border-radius: var(--radius-pill);
  padding: 2px;
  margin-left: auto;
}

.cx-sort button {
  border: 0;
  background: none;
  color: var(--text-muted);
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  padding: var(--space-1) var(--space-3);
  border-radius: var(--radius-pill);
  cursor: pointer;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

.cx-sort button.active { background: var(--accent); color: var(--on-accent); }

/* "Replying to @x" chip above the composer */
.cx-reply-chip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 14px;
}

.cx-comment.cx-enter { animation-duration: var(--dur-base); }

.cx-comment .cx-avatar { width: 32px; height: 32px; font-size: 14px; }

.cx-comment-body { flex: 1; min-width: 0; }

.cx-comment-body .who { font-size: 14px; color: var(--text-muted); }

.cx-comment-body .who a { color: var(--text-soft); font-weight: 700; text-decoration: none; }

.cx-comment-body .txt {
  margin: 2px 0 0;
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  text-wrap: pretty;
}

.cx-comment-del {
  border: 0;
  background: none;
  color: var(--text-faint);
  cursor: pointer;
  font-size: 14px;
  padding: 4px 0;
}

.cx-comment-del:hover { color: var(--error-text); }

.cx-comment-form {
  display: flex;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--line);
}

.cx-comment-form input {
  flex: 1;
  min-width: 0;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: var(--space-2) var(--space-4);
  transition: border-color var(--dur-fast) var(--ease-out);
}

.cx-comment-form input:focus-visible {
  border-color: var(--line-accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ── Modals / toast ── */
.cx-modal-scrim {
  position: fixed;
  inset: 0;
  background: var(--scrim);
  z-index: var(--z-modal-top);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
  animation: cx-fade 180ms var(--ease-out) both;
}

@keyframes cx-fade { from { opacity: 0; } to { opacity: 1; } }

.cx-modal {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  padding: var(--space-5);
  box-sizing: border-box;
  animation: cx-modal-in var(--dur-base) var(--ease-out) both;
}

@keyframes cx-modal-in {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

.cx-modal h2 { margin: 0 0 var(--space-3); font-size: 18px; letter-spacing: -0.01em; }

.cx-modal-copy { color: var(--text-muted); font-size: 14px; margin: 0 0 var(--space-3); text-wrap: pretty; }

.cx-field { display: block; margin-bottom: var(--space-3); }

.cx-field span { display: block; font-size: 14px; color: var(--text-muted); margin-bottom: var(--space-1); }

.cx-field input,
.cx-field textarea,
.cx-field select {
  width: 100%;
  box-sizing: border-box;
  background: var(--surface-soft);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  padding: var(--space-2) var(--space-3);
  transition: border-color var(--dur-fast) var(--ease-out);
}

.cx-field input:focus-visible,
.cx-field textarea:focus-visible,
.cx-field select:focus-visible {
  border-color: var(--line-accent);
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.cx-modal-error { color: var(--error-text); font-size: 14px; }

.cx-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-4);
}

.cx-icon-btn {
  border: 0;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  .cx-icon-btn:hover { background: var(--surface-soft); color: var(--text); }
}

.cx-toast {
  position: fixed;
  bottom: var(--space-5);
  left: 50%;
  background: var(--panel);
  border: 1px solid var(--line-strong);
  color: var(--text);
  border-radius: var(--radius-pill);
  padding: var(--space-2) var(--space-5);
  font-size: 14px;
  z-index: var(--z-toast);
  animation: cx-toast-in 260ms var(--ease-spring) both;
}

@keyframes cx-toast-in {
  from { opacity: 0; transform: translate(-50%, 12px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

/* ── Phone: full-bleed immersion, rail floats over the artwork ── */
@media (max-width: 900px) {
  .cx-topbar-bar {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "brand actions"
      "tabs tabs";
    align-items: center;
    gap: 0;
    min-height: 0;
    padding: 0;
  }

  .cx-brand {
    grid-area: brand;
    height: 56px;
    padding-left: var(--space-4);
  }

  .cx-topbar-right {
    grid-area: actions;
    height: 56px;
    margin-left: 0;
    padding-right: var(--space-2);
  }

  .cx-tabs {
    grid-area: tabs;
    flex: none;
    width: auto;
    height: 44px;
    border-top: 1px solid var(--line);
    padding: 0 var(--space-2);
    scroll-padding-inline: var(--space-4);
  }

  /* The row scrolls once the labels no longer fit. Fade the edge so a cut-off
     word reads as "more this way" rather than a broken label. */
  @media (max-width: 640px) {
    .cx-tabs {
      -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
      mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
    }
  }

  .cx-card { padding: var(--space-2); }

  .cx-card-inner {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
  }

  .cx-stage {
    aspect-ratio: auto;
    height: calc(100vh - 112px);
    max-height: none;
    border-radius: var(--radius-lg);
  }

  .cx-card-meta {
    padding-right: 76px;
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  }

  .cx-rail {
    grid-column: 1;
    grid-row: 1;
    z-index: 3;
    justify-self: end;
    align-self: end;
    padding: 0 var(--space-2) var(--space-3) 0;
    gap: var(--space-3);
  }

  .cx-rail-btn { color: var(--cx-on-media); }

  .cx-rail-btn .material-symbols-rounded {
    width: 46px;
    height: 46px;
    background: var(--scrim);
    border-color: color-mix(in srgb, var(--cx-on-media) 16%, transparent);
  }

  .cx-hall,
  .cx-post-cols { grid-template-columns: 1fr; }

  /* Notifications take the full screen, like the app it's imitating. */
  .cx-notif-panel {
    position: fixed;
    top: 56px;
    left: var(--space-2);
    right: var(--space-2);
    bottom: var(--space-2);
    width: auto;
    max-height: none;
    border-radius: var(--radius-lg);
  }

  /* Comments become an Instagram-style bottom sheet. */
  .cx-drawer {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 68vh;
    border-left: 0;
    border-top: 1px solid var(--line-strong);
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: cx-sheet-in 260ms cubic-bezier(0.32, 0.72, 0, 1) both;
  }

  .cx-drawer::before {
    content: "";
    position: absolute;
    top: 8px;
    left: 50%;
    transform: translateX(-50%);
    width: 36px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--line-strong);
  }

  .cx-drawer-head { padding-top: var(--space-4); }
}

@keyframes cx-sheet-in {
  from { transform: translateY(48px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  .community-body *,
  .community-body *::before,
  .community-body *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .cx-feed { scroll-behavior: auto; }
}

/* ══ Touch ergonomics ══════════════════════════════════════════════════════
   For tired thumbs: visuals stay compact, but every control hits a ≥44px
   zone — extended invisibly (Instagram-style), never by inflating the UI.
   Later rules override earlier ones in this file by cascade order. */

.community-body a,
.community-body button,
.community-body input,
.community-body select,
.community-body textarea {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

/* Invisible hit-area extension for compact controls. Adjacent targets get
   real gaps below so the extended zones don't fight each other. */
.cx-brand,
.cx-handle,
.cx-me-btn,
.cx-follow-btn,
.cx-cmt-act,
.cx-view-replies,
.cx-sort button,
.cx-attrib a {
  position: relative;
}

.cx-brand::after,
.cx-handle::after,
.cx-me-btn::after,
.cx-follow-btn::after,
.cx-cmt-act::after,
.cx-view-replies::after,
.cx-sort button::after,
.cx-attrib a::after {
  content: "";
  position: absolute;
  inset: -8px;
}

/* Icon buttons (drawer close, reply cancel, bell) are honest 44px squares. */
.cx-icon-btn {
  width: 44px;
  height: 44px;
}

.cx-bell {
  width: 44px;
  height: 44px;
}

/* Tabs: taller tap zone, same visual weight. */
.cx-tab {
  min-height: 44px;
}

/* Comment controls: the heart gets a padded zone around its small icon, and
   Reply/Delete become legible 13px with breathing room between them. */
.cx-cmt-like {
  padding: 10px 10px 10px 12px;
  margin: -6px -6px -6px 0;
}

.cx-cmt-actions {
  gap: var(--space-5);
  margin-top: 4px;
}

.cx-cmt-act {
  font-size: 14px;
  padding: var(--space-2) 0;
}

.cx-cmt-act.confirming {
  color: var(--error-text);
  font-weight: 700;
}

.cx-view-replies {
  padding: 10px 12px 10px 46px;
}

.cx-sort button {
  min-height: 44px;
}

/* Composer: 44px input and a square send target. */
.cx-comment-form input {
  min-height: 44px;
  box-sizing: border-box;
}

.cx-comment-form button[type="submit"] {
  min-width: 48px;
  min-height: 44px;
}

/* First-visit swipe hint */
.cx-swipe-hint {
  position: absolute;
  left: 50%;
  top: 38%;
  bottom: auto;
  transform: translateX(-50%);
  z-index: 3;
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-pill);
  background: var(--surface-strong);
  border: 1px solid var(--line-strong);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
  animation: cx-hint-float 1.6s var(--ease-in-out) infinite;
}

.cx-swipe-hint .material-symbols-rounded { font-size: 18px; }

@keyframes cx-hint-float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(-8px); }
}

/* Phones and tablets: sub-16px inputs make iOS zoom the whole page on
   focus — the single most disorienting thing for a tired user. */
@media (pointer: coarse) {
  .cx-comment-form input,
  .cx-field input,
  .cx-field textarea,
  .cx-field select {
    font-size: 16px;
  }

  .cx-tab { min-height: 44px; }

  .cx-follow-btn {
    min-height: 32px;
    padding: var(--space-2) var(--space-4);
  }

  /* Primary action rows on post/profile pages reach full thumb size. */
  .cx-page .btn { min-height: 44px; }

  .cx-notif-row { min-height: 64px; }
}


.cx-self-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}

/* ── Anchors: UI, not prose ───────────────────────────────────────────────
   index.css ships a global `a:hover { text-decoration: underline }` for app
   pages. Explore is made of anchors that ARE interface (brand, pill buttons,
   board rows, notification rows, tiles) — underline on hover reads as a bug.
   Default everything to none; opt back in only where a link sits in prose. */
.community-body a,
.community-body a:hover {
  text-decoration: none;
}

.community-body .cx-handle:hover,
.community-body .cx-attrib a:hover,
.community-body .cx-lineage a:hover,
.community-body .cx-modal-copy a,
.community-body .cx-license-note a:hover,
.community-body .cx-plan-panel a:hover,
.community-body .cx-empty a:not(.btn) {
  text-decoration: underline;
}
