/* ---------- PROFILE PAGE SHARED CHROME ---------- */

.me-panel,
.player-panel {
  /* Visual shell — layout is handled by .panel-zoom-shell inside */
  min-height: 0;
  overflow: hidden;
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  border: 2px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.24);
  border-radius: var(--profile-radius-lg, 22px);
  background:
    linear-gradient(135deg, rgba(var(--profile-panel-custom-rgb, 255, 220, 187), 0.12), transparent 28%),
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0))),
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-base-rgb, 21, 14, 55), var(--profile-panel-base-opacity, 0.96)), rgba(var(--profile-panel-base-rgb-2, 7, 7, 22), var(--profile-panel-base-opacity, 0.96)));
  box-shadow:
    0 24px 48px rgba(0, 0, 0, 0.28),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset,
    0 0 24px rgba(255, 121, 183, 0.08);
}

/* Inner zoom shell — wraps all panel content; zoom is set by apply-scale.mjs */
.profile-composition-surface--hidden {
  border-color: transparent !important;
  background: transparent !important;
  box-shadow: none !important;
}

.profile-composition-child--hidden {
  display: none !important;
}

.profile-composition-hero > [data-profile-composition-id] {
  position: absolute;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  grid-column: auto !important;
  grid-row: auto !important;
}

.profile-composition-overlay {
  position: absolute;
  z-index: 8;
  min-width: 0;
  min-height: 0;
  box-sizing: border-box;
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  pointer-events: none;
}

.profile-composition-overlay--surface {
  z-index: 3;
}

.profile-composition-overlay--text {
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.12);
}

.profile-composition-overlay--badges {
  z-index: 7;
  display: grid;
  place-items: center;
  padding: 14px 16px;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.12);
}

.profile-composition-overlay--friend-code {
  z-index: 7;
  display: grid;
  align-content: center;
  justify-items: stretch;
  gap: 12px;
  padding: 16px;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.profile-composition-overlay--gallery-grid {
  z-index: 7;
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 10px;
  padding: 10px 12px;
  overflow: hidden auto;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.profile-composition-overlay--gallery-grid .gallery-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(3px, 1.3%, 8px);
  padding: clamp(4px, 1.8%, 10px);
  align-content: start;
  justify-content: start;
  box-sizing: border-box;
}

.profile-composition-overlay--gallery-grid .gallery-item {
  min-width: 0;
  gap: 2px;
}

.profile-composition-overlay--gallery-grid .gallery-item__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.profile-composition-overlay--gallery-grid .gallery-item__counts {
  gap: 3px;
  padding: 2px 3px;
}

.profile-composition-overlay--gallery-grid .gallery-item__count {
  font-size: clamp(0.42rem, 1.5cqw, 0.62rem);
}

.profile-composition-overlay--gallery-grid .gallery-item__img-frame {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 214, 189), 0.24);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 214, 189), 0.08), rgba(0, 0, 0, 0.18)),
    rgba(9, 8, 22, 0.42);
}

.profile-composition-overlay--gallery-grid .gallery-item__caption,
.profile-composition-overlay--gallery-grid .me-panel__empty,
.profile-composition-overlay--gallery-grid .player-panel__empty {
  color: rgba(var(--profile-panel-text-rgb, 255, 248, 255), 0.84);
}

.profile-composition-overlay--gallery-grid .gallery-item__caption {
  font-size: clamp(0.42rem, 1.7cqw, 0.68rem);
  line-height: 1.15;
}

.profile-composition-overlay--gallery-link {
  z-index: 8;
  display: grid;
  place-items: center;
  padding: 4px 10px;
  border: 1px solid rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.3);
  border-radius: var(--profile-radius-pill, 999px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.86)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.86))),
    rgba(9, 8, 22, 0.72);
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  text-align: center;
  text-decoration: none;
  pointer-events: auto;
}

.profile-composition-overlay--gallery-photo {
  z-index: 8;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  padding: 4px;
  overflow: hidden;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.2)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.2))),
    rgba(9, 8, 22, 0.18);
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  pointer-events: auto;
}

.profile-composition-overlay--gallery-photo .gallery-item__img-frame {
  width: 100%;
  border-color: rgba(var(--profile-panel-element-rgb, 255, 214, 189), 0.24);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 214, 189), 0.08), rgba(0, 0, 0, 0.18)),
    rgba(9, 8, 22, 0.42);
}

.profile-composition-overlay--gallery-photo .gallery-item__img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.profile-composition-overlay--gallery-photo .gallery-item__caption {
  margin: 0;
  color: rgba(var(--profile-panel-text-rgb, 255, 248, 255), 0.84);
  font-size: clamp(0.42rem, 1.8cqw, 0.68rem);
  line-height: 1.15;
}

.profile-composition-overlay--identity-field,
.profile-composition-overlay--player-action {
  z-index: 7;
  box-sizing: border-box;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.profile-composition-overlay--identity-field {
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.profile-composition-overlay--player-action {
  display: grid;
  align-content: center;
  justify-items: stretch;
  gap: 10px;
  padding: 10px 12px;
}

.profile-composition-overlay--player-action[data-profile-child-id="gestureActions"] {
  overflow: visible;
  z-index: 24;
}

.profile-composition-overlay--player-action .player-hero-card__gesture-buttons {
  justify-content: center;
}

.profile-composition-overlay--player-action .player-hero-card__challenge-picker {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 2;
  max-height: 220px;
  overflow: auto;
}

.profile-composition-overlay--player-action .player-hero-card__friend-action,
.profile-composition-overlay--player-action .player-hero-card__gesture-btn {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.3);
}

.profile-composition-overlay--thoughts-composer,
.profile-composition-overlay--thoughts-feed {
  z-index: 7;
  box-sizing: border-box;
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.12);
  pointer-events: auto;
}

.profile-composition-overlay--thoughts-feed {
  display: grid;
  align-content: start;
  gap: 16px;
  max-height: none !important;
  overflow-y: auto !important;
  padding: 10px 12px;
  scrollbar-color: rgba(255, 124, 190, 0.72) rgba(12, 8, 30, 0.42);
  scrollbar-width: thin;
}

.profile-composition-overlay--thoughts-feed .thought-card {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.28);
  background:
    linear-gradient(135deg, rgba(var(--profile-panel-button-rgb, 255, 197, 228), 0.1), transparent 30%),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 33, 14, 60), 0.92), rgba(var(--profile-panel-element-rgb, 10, 8, 26), 0.72)),
    rgba(10, 8, 26, 0.94);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-composition-overlay--thoughts-composer .thought-composer,
[data-profile-child-id="composer"].thought-composer {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.22);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 14, 10, 30), var(--profile-panel-custom-opacity, 0.94)), rgba(var(--profile-panel-custom-rgb-2, 19, 10, 35), var(--profile-panel-custom-opacity, 0.94))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.08), rgba(0, 0, 0, 0.18)),
    rgba(14, 10, 30, 0.94);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-composition-overlay--thoughts-composer .thought-composer__subject,
.profile-composition-overlay--thoughts-composer .thought-composer__body,
.profile-composition-overlay--thoughts-composer .thought-composer__field-input,
[data-profile-child-id="composer"].thought-composer .thought-composer__subject,
[data-profile-child-id="composer"].thought-composer .thought-composer__body,
[data-profile-child-id="composer"].thought-composer .thought-composer__field-input,
.profile-composition-overlay--thoughts-feed .thought-card__share-input {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.34);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 6, 4, 18), 0.24), rgba(0, 0, 0, 0.3)),
    rgba(var(--profile-panel-element-rgb, 6, 4, 18), 0.5);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-composition-overlay--thoughts-composer .thought-composer__subject::placeholder,
.profile-composition-overlay--thoughts-composer .thought-composer__body::placeholder,
.profile-composition-overlay--thoughts-composer .thought-composer__field-input::placeholder,
[data-profile-child-id="composer"].thought-composer .thought-composer__subject::placeholder,
[data-profile-child-id="composer"].thought-composer .thought-composer__body::placeholder,
[data-profile-child-id="composer"].thought-composer .thought-composer__field-input::placeholder,
.profile-composition-overlay--thoughts-feed .thought-card__share-input::placeholder {
  color: rgba(var(--profile-panel-text-rgb, 255, 247, 252), 0.5);
}

.profile-composition-overlay--thoughts-composer .thought-composer__submit,
.profile-composition-overlay--thoughts-composer .thought-composer__attach-label,
.profile-composition-overlay--thoughts-composer .thought-composer__photo-clear,
[data-profile-child-id="composer"].thought-composer .thought-composer__submit,
[data-profile-child-id="composer"].thought-composer .thought-composer__attach-label,
[data-profile-child-id="composer"].thought-composer .thought-composer__photo-clear,
.profile-composition-overlay--thoughts-feed .thought-card__action,
.profile-composition-overlay--thoughts-feed .thought-card__share-button,
.profile-composition-overlay--thoughts-feed .thought-card__reaction-chip,
.profile-composition-overlay--thoughts-feed .thought-card__comment-dismiss {
  border-color: rgba(var(--profile-panel-button-rgb, 255, 197, 228), 0.42);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-button-rgb, 255, 197, 228), 0.18), rgba(var(--profile-panel-button-rgb, 255, 121, 183), 0.08)),
    rgba(9, 8, 22, 0.76);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-composition-overlay--thoughts-composer .thought-composer__photo-card,
[data-profile-child-id="composer"].thought-composer .thought-composer__photo-card,
.profile-composition-overlay--thoughts-feed .thought-card__comment,
.profile-composition-overlay--thoughts-feed .thought-card__quoted-thought {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.24);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.08), rgba(0, 0, 0, 0.24)),
    rgba(var(--profile-panel-element-rgb, 10, 8, 26), 0.42);
  color: rgb(var(--profile-panel-text-rgb, 255, 247, 252));
}

.profile-composition-overlay--thoughts-feed .thought-card__author,
.profile-composition-overlay--thoughts-feed .thought-card__meta,
.profile-composition-overlay--thoughts-feed .thought-card__topic-kicker,
.profile-composition-overlay--thoughts-feed .thought-card__reactions,
.profile-composition-overlay--thoughts-feed .thought-card__share-label,
.profile-composition-overlay--thoughts-feed .thought-card__quoted-kicker,
.profile-composition-overlay--thoughts-feed .thought-card__quoted-author,
.profile-composition-overlay--thoughts-feed .thought-card__quoted-date,
.profile-composition-overlay--thoughts-composer .thought-composer__photo-name,
.profile-composition-overlay--thoughts-composer .thought-composer__field-label,
.profile-composition-overlay--thoughts-composer .thought-composer__toggle-copy,
[data-profile-child-id="composer"].thought-composer .thought-composer__photo-name,
[data-profile-child-id="composer"].thought-composer .thought-composer__field-label,
[data-profile-child-id="composer"].thought-composer .thought-composer__toggle-copy {
  color: rgba(var(--profile-panel-text-rgb, 255, 247, 252), 0.88);
}

.profile-composition-overlay--thoughts-feed .thought-card__summary,
.profile-composition-overlay--thoughts-feed .thought-card__date,
.profile-composition-overlay--thoughts-feed .thought-card__comment-body,
.profile-composition-overlay--thoughts-feed .thought-card__comment-empty,
.profile-composition-overlay--thoughts-feed .thought-card__quoted-summary {
  color: rgba(var(--profile-panel-text-rgb, 255, 247, 252), 0.82);
}

.profile-composition-overlay--thoughts-feed::-webkit-scrollbar {
  width: 10px;
}

.profile-composition-overlay--thoughts-feed::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 197, 228, 0.78), rgba(255, 124, 190, 0.54));
  border: 2px solid rgba(18, 9, 31, 0.9);
}

.profile-composition-overlay--thoughts-feed::-webkit-scrollbar-track {
  background: rgba(12, 8, 30, 0.42);
}

.profile-composition-overlay--title {
  z-index: 8;
}

.profile-composition-overlay--title .me-panel__title {
  width: 100%;
  height: 100%;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

.profile-composition-overlay--text .me-about-copy,
.profile-composition-overlay--text .player-about-copy {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  overflow-wrap: anywhere;
}

.profile-composition-overlay--badges .me-badge-list,
.profile-composition-overlay--badges .player-badge-list {
  justify-content: center;
}

.profile-composition-overlay--friend-code .friend-code-card__label,
.profile-composition-overlay--friend-code .friend-code-form__label,
.profile-composition-overlay--friend-code .friend-code-card__helper,
.profile-composition-overlay--friend-code .friend-code-form__flash {
  color: rgba(var(--profile-panel-text-rgb, 255, 247, 252), 0.84);
}

.profile-composition-overlay--friend-code .friend-code-form__input,
.profile-composition-overlay--friend-code .friend-code-form__submit {
  border-color: rgba(var(--profile-panel-element-rgb, 255, 197, 228), 0.28);
}

.panel-zoom-shell {
  position: relative;
  display: grid;
  box-sizing: border-box;
  align-content: start;
  gap: 14px;
  padding: 20px;
  overflow: hidden;
  container-type: size;
  container-name: panel;
  /* width/height are set inline by JS so the scaled content fills the panel. */
}

.me-hero-card > .panel-zoom-shell,
.player-hero-card > .panel-zoom-shell {
  justify-content: center;
  justify-items: stretch;
  text-align: center;
}

.profile-child-zoom-shell {
  display: grid;
  box-sizing: border-box;
  justify-items: center;
  align-content: center;
  gap: inherit;
  overflow: hidden;
}

.me-hero-card > .panel-zoom-shell > [data-profile-child-id],
.player-hero-card > .panel-zoom-shell > [data-profile-child-id],
.me-panel > .panel-zoom-shell > [data-profile-child-id],
.player-panel > .panel-zoom-shell > [data-profile-child-id],
.profile-layout-tile__live-panel.me-panel > .panel-zoom-shell > [data-profile-child-id],
.profile-layout-tile__live-panel.player-panel > .panel-zoom-shell > [data-profile-child-id],
.profile-layout-tile__live-panel.me-hero-card > .panel-zoom-shell > [data-profile-child-id] {
  position: absolute;
  box-sizing: border-box;
  min-width: 0;
  min-height: 0;
  grid-column: auto !important;
  grid-row: auto !important;
  padding: 0 !important;
  container-type: size;
  container-name: profile-child;
}

.me-hero-card > .panel-zoom-shell > [data-profile-child-id="portrait"] > .profile-child-zoom-shell,
.player-hero-card > .panel-zoom-shell > [data-profile-child-id="portrait"] > .profile-child-zoom-shell,
.profile-layout-tile__live-panel.me-hero-card > .panel-zoom-shell > [data-profile-child-id="portrait"] > .profile-child-zoom-shell {
  padding: 18px 12px;
}

.me-hero-card > .panel-zoom-shell > [data-profile-child-id="metrics"] > .profile-child-zoom-shell,
.player-hero-card > .panel-zoom-shell > [data-profile-child-id="metrics"] > .profile-child-zoom-shell,
.profile-layout-tile__live-panel.me-hero-card > .panel-zoom-shell > [data-profile-child-id="metrics"] > .profile-child-zoom-shell {
  align-content: start;
  gap: 10px;
  padding: 12px;
}

.me-panel > .panel-zoom-shell > [data-profile-child-id="title"] > .profile-child-zoom-shell,
.player-panel > .panel-zoom-shell > [data-profile-child-id="title"] > .profile-child-zoom-shell,
.profile-layout-tile__live-panel.me-panel > .panel-zoom-shell > [data-profile-child-id="title"] > .profile-child-zoom-shell,
.profile-layout-tile__live-panel.player-panel > .panel-zoom-shell > [data-profile-child-id="title"] > .profile-child-zoom-shell {
  align-content: stretch;
  justify-items: stretch;
}

[data-profile-child-id="title"] .me-panel__title,
[data-profile-child-id="title"] .player-panel__title,
[data-profile-child-id="title"] .gallery-panel__title {
  width: 100%;
  height: 100%;
  justify-content: center;
  text-align: center;
  box-sizing: border-box;
}

.me-panel > .panel-zoom-shell > [data-profile-child-id="content"] > .profile-child-zoom-shell,
.player-panel > .panel-zoom-shell > [data-profile-child-id="content"] > .profile-child-zoom-shell,
.profile-layout-tile__live-panel.me-panel > .panel-zoom-shell > [data-profile-child-id="content"] > .profile-child-zoom-shell,
.profile-layout-tile__live-panel.player-panel > .panel-zoom-shell > [data-profile-child-id="content"] > .profile-child-zoom-shell {
  align-content: stretch;
  justify-items: stretch;
}

[data-profile-child-id="content"] .me-featured-cabinet,
[data-profile-child-id="content"] .player-featured-cabinet,
[data-profile-child-id="content"] .me-featured-cabinet__card,
[data-profile-child-id="content"] .player-featured-cabinet__card {
  width: 100%;
  height: 100%;
  max-width: none;
  aspect-ratio: auto;
  box-sizing: border-box;
}

[data-profile-child-id="content"] .me-badge-box,
[data-profile-child-id="content"] .player-badge-box {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid rgba(255, 214, 189, 0.14);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(255, 255, 255, 0.035);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.12);
}

[data-profile-child-id="content"].gallery-panel__content {
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 10px;
  width: 100%;
  height: 100%;
  max-width: none;
  box-sizing: border-box;
  padding: 10px 12px;
  overflow: hidden auto;
}

[data-profile-child-id="content"].gallery-panel__content > .profile-child-zoom-shell {
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 10px 12px;
}

[data-profile-child-id="content"] .gallery-grid {
  width: 100%;
  box-sizing: border-box;
}

[data-profile-child-id="content"].gallery-panel__content > .gallery-grid {
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: clamp(3px, 1.3%, 8px);
  padding: clamp(4px, 1.8%, 10px);
}

[data-profile-child-id="content"].gallery-panel__content .gallery-item__caption {
  font-size: clamp(0.42rem, 1.7cqw, 0.68rem);
  line-height: 1.15;
}

[data-profile-child-id="content"].gallery-panel__content > .gallery-view-all {
  margin-top: 4px;
  font-size: 0.92rem;
  justify-self: start;
}

[data-profile-child-id="navigatorSurface"].me-friends-navigator,
[data-profile-child-id="toggle"].me-friends-navigator__toggle,
[data-profile-child-id="search"].me-friends-navigator__search,
[data-profile-child-id="list"].me-friends-navigator__dropdown {
  width: 100%;
  height: 100%;
  max-width: none;
  box-sizing: border-box;
}

[data-profile-child-id="navigatorSurface"].me-friends-navigator {
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.16);
  border-radius: var(--profile-radius-md, 16px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.35)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.35))),
    rgba(9, 8, 22, 0.32);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}

[data-profile-child-id="toggle"].me-friends-navigator__toggle > .profile-child-zoom-shell,
[data-profile-child-id="search"].me-friends-navigator__search > .profile-child-zoom-shell {
  display: grid;
  align-content: start;
  justify-items: stretch;
  width: 100%;
  height: 100%;
}

[data-profile-child-id="toggle"].me-friends-navigator__toggle > .profile-child-zoom-shell {
  gap: 6px;
  padding: 12px 14px;
}

[data-profile-child-id="search"].me-friends-navigator__search > .profile-child-zoom-shell {
  gap: 6px;
  padding: 8px 10px;
}

/* The friend list scrolls instead of shrink-to-fit scaling, so its rows stay
   legible no matter how short the child box is (see apply-scale.mjs). */
[data-profile-child-id="list"].me-friends-navigator__dropdown {
  overflow: hidden auto;
  align-content: start;
  gap: 8px;
}

/* The inner list must size to its rows so the child box above can scroll it. */
[data-profile-child-id="list"].me-friends-navigator__dropdown > .me-friends-navigator__list {
  overflow: visible;
  height: max-content;
}

[data-profile-child-id="composer"].thought-composer,
[data-profile-child-id="feed"].thoughts-feed {
  width: 100%;
  height: 100%;
  max-width: none;
  box-sizing: border-box;
}

[data-profile-child-id="composer"].thought-composer > .profile-child-zoom-shell {
  display: grid;
  align-content: start;
  justify-items: stretch;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 18px;
}

[data-profile-child-id="feed"].thoughts-feed {
  align-content: start;
  gap: 16px;
  max-height: none !important;
  overflow-y: auto !important;
  padding: 10px 12px;
}

.me-panel > .panel-zoom-shell > [data-profile-child-id="text"] > .profile-child-zoom-shell,
.player-panel > .panel-zoom-shell > [data-profile-child-id="text"] > .profile-child-zoom-shell,
.profile-layout-tile__live-panel.me-panel > .panel-zoom-shell > [data-profile-child-id="text"] > .profile-child-zoom-shell,
.profile-layout-tile__live-panel.player-panel > .panel-zoom-shell > [data-profile-child-id="text"] > .profile-child-zoom-shell {
  align-content: stretch;
  justify-items: stretch;
  padding: 10px 12px;
}

[data-profile-child-id="text"] {
  border: 1px solid rgba(var(--profile-panel-custom-rgb, 255, 214, 189), 0.22);
  border-radius: var(--profile-radius-sm, 12px);
  background:
    linear-gradient(var(--profile-panel-gradient-angle, 180deg), rgba(var(--profile-panel-custom-rgb, 21, 14, 55), var(--profile-panel-custom-opacity, 0.96)), rgba(var(--profile-panel-custom-rgb-2, 7, 7, 22), var(--profile-panel-custom-opacity, 0.96))),
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(9, 8, 22, 0.9);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, 0.035),
    0 8px 18px rgba(0, 0, 0, 0.12);
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
}

[data-profile-child-id="text"] .me-about-copy,
[data-profile-child-id="text"] .player-about-copy {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  box-sizing: border-box;
  overflow-wrap: anywhere;
}

[data-profile-child-id="mainSqueeze"].me-hero-card__friend-card,
[data-profile-child-id="friend2"].me-hero-card__friend-card,
[data-profile-child-id="friend3"].me-hero-card__friend-card,
[data-profile-child-id="friend4"].me-hero-card__friend-card,
[data-profile-child-id="friend5"].me-hero-card__friend-card {
  width: 100%;
  height: 100%;
  max-width: none;
  box-sizing: border-box;
}

[data-profile-child-id="mainSqueeze"].me-hero-card__friend-card > .profile-child-zoom-shell,
[data-profile-child-id="friend2"].me-hero-card__friend-card > .profile-child-zoom-shell,
[data-profile-child-id="friend3"].me-hero-card__friend-card > .profile-child-zoom-shell,
[data-profile-child-id="friend4"].me-hero-card__friend-card > .profile-child-zoom-shell,
[data-profile-child-id="friend5"].me-hero-card__friend-card > .profile-child-zoom-shell {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr);
  align-items: center;
  align-content: center;
  justify-items: stretch;
  gap: 10px;
  width: 100%;
  height: 100%;
  padding: 10px 12px;
}

[data-profile-child-id="ranking1"].me-hero-card__rail-item,
[data-profile-child-id="ranking2"].me-hero-card__rail-item,
[data-profile-child-id="ranking3"].me-hero-card__rail-item {
  width: 100%;
  height: 100%;
  max-width: none;
  box-sizing: border-box;
}

[data-profile-child-id="ranking1"].me-hero-card__rail-item > .profile-child-zoom-shell,
[data-profile-child-id="ranking2"].me-hero-card__rail-item > .profile-child-zoom-shell,
[data-profile-child-id="ranking3"].me-hero-card__rail-item > .profile-child-zoom-shell {
  display: grid;
  align-content: center;
  justify-items: stretch;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 10px 12px;
}

[data-profile-child-id="code"].friend-code-card {
  width: 100%;
  height: 100%;
  max-width: none;
  box-sizing: border-box;
}

[data-profile-child-id="code"].friend-code-card > .profile-child-zoom-shell {
  display: grid;
  align-content: center;
  justify-items: stretch;
  gap: 12px;
  width: 100%;
  height: 100%;
  padding: 14px;
}

[data-profile-child-id="name"].me-hero-card__identity-field,
[data-profile-child-id="pageViews"].me-hero-card__identity-field,
[data-profile-child-id="factoryId"].me-hero-card__identity-field,
[data-profile-child-id="socialLinks"].me-hero-card__identity-field {
  width: 100%;
  height: 100%;
  max-width: none;
  box-sizing: border-box;
}

[data-profile-child-id="name"].me-hero-card__identity-field > .profile-child-zoom-shell,
[data-profile-child-id="pageViews"].me-hero-card__identity-field > .profile-child-zoom-shell,
[data-profile-child-id="factoryId"].me-hero-card__identity-field > .profile-child-zoom-shell,
[data-profile-child-id="socialLinks"].me-hero-card__identity-field > .profile-child-zoom-shell {
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 6px;
  width: 100%;
  height: 100%;
  padding: 10px 12px;
  text-align: center;
}

[data-profile-child-id="socialLinks"].me-hero-card__identity-field > .profile-child-zoom-shell {
  align-content: start;
  justify-items: stretch;
}

[data-profile-child-id="playerSurface"].cassette-player,
[data-profile-child-id="playerSurface"].cassette-empty,
[data-profile-child-id="deck"].cassette-player__viewport,
[data-profile-child-id="trackLabel"].cassette-player__label,
[data-profile-child-id="controls"].cassette-player__controls {
  width: 100%;
  height: 100%;
  max-width: none;
  box-sizing: border-box;
}

[data-profile-child-id="playerSurface"].cassette-player > .profile-child-zoom-shell,
[data-profile-child-id="playerSurface"].cassette-empty > .profile-child-zoom-shell {
  display: grid;
  align-content: center;
  justify-items: stretch;
  width: 100%;
  height: 100%;
}

[data-profile-child-id="deck"].cassette-player__viewport > .profile-child-zoom-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
  padding: 0.35rem 0.55rem;
}

[data-profile-child-id="trackLabel"].cassette-player__label > .profile-child-zoom-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.1rem;
  width: 100%;
  height: 100%;
  padding: 0.35rem 0.55rem;
  text-align: center;
}

[data-profile-child-id="controls"].cassette-player__controls > .profile-child-zoom-shell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  width: 100%;
  height: 100%;
  padding: 0.25rem 0.35rem;
  box-sizing: border-box;
}

@container profile-child (max-height: 130px) {
  [data-profile-child-id="metrics"] > .profile-child-zoom-shell {
    gap: 6px;
    padding: 8px;
  }

  [data-profile-child-id="metrics"] .me-hero-card__metrics-grid,
  [data-profile-child-id="metrics"] .player-hero-card__metrics-grid {
    gap: 5px;
  }

  [data-profile-child-id="metrics"] .me-hero-card__metrics-stat,
  [data-profile-child-id="metrics"] .player-hero-card__metrics-stat {
    gap: 2px;
    padding: 6px 8px;
  }
}

@container profile-child (max-height: 92px) {
  [data-profile-child-id="metrics"] .me-hero-card__section-topline,
  [data-profile-child-id="metrics"] .player-hero-card__section-topline {
    display: none;
  }
}

/* --- Container query compact rules — content scales before overflow occurs --- */
/* Note: only descendant selectors work inside @container — the container itself cannot be targeted */

@container panel (max-height: 220px) {
  .me-panel__header,
  .player-panel__header {
    display: none;
  }
  .me-meta-block,
  .player-meta-block {
    padding: 6px 10px;
    gap: 4px;
  }
  .me-meta-block__label,
  .player-meta-block__label {
    font-size: 0.62rem;
  }
  .me-meta-block__value,
  .player-meta-block__value {
    font-size: 0.82rem;
  }
  .me-card-item,
  .me-link,
  .player-card-item,
  .player-link {
    padding: 8px 10px;
    gap: 4px;
  }
}

@container panel (max-height: 160px) {
  .me-meta-block,
  .player-meta-block {
    padding: 4px 8px;
    gap: 2px;
  }
  .me-card-item,
  .me-link,
  .player-card-item,
  .player-link {
    padding: 6px 8px;
    gap: 2px;
  }
}

@container panel (max-width: 260px) {
  .me-panel__title,
  .player-panel__title {
    font-size: 0.92rem;
    min-height: 28px;
    padding: 0 8px;
  }
  .me-card-item,
  .me-link,
  .player-card-item,
  .player-link {
    padding: 8px;
  }
}


.me-panel__topline,
.player-panel__topline {
  display: grid;
  gap: 6px;
}

.me-panel__header,
.player-panel__header,
.gallery-panel__header {
  display: flex;
  align-items: center;
  justify-content: center;
}

.me-panel__title,
.player-panel__title,
.gallery-panel__title {
  margin: 0;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(var(--profile-panel-title-rgb, 255, 214, 189), 0.36);
  border-radius: var(--profile-radius-pill, 999px);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-title-rgb, 255, 220, 187), 0.52), rgba(var(--profile-panel-title-rgb, 255, 121, 183), 0.22)),
    linear-gradient(180deg, rgba(var(--profile-panel-title-rgb, 255, 220, 187), 0.18), rgba(var(--profile-panel-title-rgb, 255, 121, 183), 0.08)),
    rgba(9, 8, 22, 0.92);
  box-shadow:
    inset 0 0 0 1px rgba(var(--profile-panel-title-rgb, 255, 255, 255), 0.1),
    0 6px 12px rgba(var(--profile-panel-title-rgb, 0, 0, 0), 0.14);
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  font-size: 1.08rem;
  line-height: 1.1;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.me-link,
.me-card-item,
.player-link,
.player-card-item {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(255, 214, 189, 0.12);
  border-radius: var(--profile-radius-sm, 12px);
  background: rgba(255, 255, 255, 0.04);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    rgba(255, 255, 255, 0.04);
}

.me-link--placeholder,
.me-card-item--placeholder,
.player-link--placeholder,
.player-card-item--placeholder {
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 140, 246, 212), 0.08), rgba(var(--profile-panel-element-rgb, 255, 255, 255), 0.03)),
    linear-gradient(180deg, rgba(140, 246, 212, 0.05), rgba(255, 255, 255, 0.03)),
    rgba(255, 255, 255, 0.03);
}

.me-link__topline,
.player-link__topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.me-link__url,
.me-card-item__value,
.player-link__url,
.player-card-item__value {
  margin: 0;
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.me-link__url,
.me-card-item__link,
.player-link__url,
.player-card-item__link {
  text-decoration: none;
}

.me-link__url:hover,
.me-link__url:focus-visible,
.me-card-item__link:hover,
.me-card-item__link:focus-visible,
.player-link__url:hover,
.player-link__url:focus-visible,
.player-card-item__link:hover,
.player-card-item__link:focus-visible {
  color: #99ffff;
}

.me-card-item__title,
.player-card-item__title {
  margin: 0;
  color: rgba(var(--profile-panel-text-rgb, 255, 215, 185), 0.88);
  font-size: 0.76rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.me-card-item__link,
.me-card-item__meta,
.player-card-item__link,
.player-card-item__meta {
  margin: 0;
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.me-card-item__meta,
.player-card-item__meta {
  color: rgba(var(--profile-panel-text-rgb, 255, 248, 255), 0.68);
  font-size: 0.76rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

#meThoughtsPanel .thoughts-feed,
#meLayoutThoughtsPreview .thoughts-feed,
#playerThoughtsPanel .thoughts-feed {
  grid-auto-rows: max-content;
  align-content: start;
  max-height: calc(100cqh - 60px);
  overflow-y: auto;
  padding-right: 8px;
}

#meThoughtsPanel .thoughts-feed::-webkit-scrollbar,
#meLayoutThoughtsPreview .thoughts-feed::-webkit-scrollbar,
#playerThoughtsPanel .thoughts-feed::-webkit-scrollbar {
  width: 10px;
}

#meThoughtsPanel .thoughts-feed::-webkit-scrollbar-thumb,
#meLayoutThoughtsPreview .thoughts-feed::-webkit-scrollbar-thumb,
#playerThoughtsPanel .thoughts-feed::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, rgba(255, 197, 228, 0.78), rgba(255, 124, 190, 0.54));
  border: 2px solid rgba(18, 9, 31, 0.9);
}

#meThoughtsPanel .thoughts-feed::-webkit-scrollbar-track,
#meLayoutThoughtsPreview .thoughts-feed::-webkit-scrollbar-track,
#playerThoughtsPanel .thoughts-feed::-webkit-scrollbar-track {
  background: rgba(12, 8, 30, 0.42);
}

.me-about-copy,
.me-badge-empty,
.player-about-copy,
.player-badge-empty {
  margin: 0;
  color: rgba(var(--profile-panel-text-rgb, 255, 248, 255), 0.84);
  line-height: 1.7;
  text-align: center;
}

.me-badge-list,
.player-badge-list {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.me-badge-chip,
.player-badge-chip {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid rgba(255, 214, 189, 0.18);
  border-radius: var(--profile-radius-pill, 999px);
  background:
    linear-gradient(180deg, rgba(var(--profile-panel-element-rgb, 255, 220, 187), 0.14), rgba(var(--profile-panel-element-rgb, 255, 121, 183), 0.08)),
    linear-gradient(180deg, rgba(255, 220, 187, 0.1), rgba(255, 121, 183, 0.08)),
    rgba(255, 255, 255, 0.04);
  color: rgb(var(--profile-panel-text-rgb, 255, 248, 255));
  font-size: 0.76rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.me-stage__header,
.player-stage__header {
  gap: 10px;
  width: min(92vw, 980px);
}

.me-stage__title,
.me-stage__subtitle,
.player-stage__title,
.player-stage__subtitle {
  position: relative;
  display: grid;
  justify-items: center;
  width: min(82vw, 760px);
  padding: 16px 18px;
  border: 2px solid rgba(255, 214, 189, 0.28);
  border-radius: var(--profile-radius-md, 16px);
  background:
    linear-gradient(180deg, rgba(255, 220, 187, 0.12), rgba(12, 9, 30, 0.92) 34%, rgba(7, 6, 20, 0.96)),
    rgba(9, 8, 22, 0.92);
  box-shadow:
    0 16px 32px rgba(0, 0, 0, 0.24),
    0 0 18px rgba(255, 121, 183, 0.14);
}

.me-stage__subtitle,
.player-stage__subtitle {
  width: min(76vw, 560px);
  color: #fff8ff;
  font-size: clamp(0.95rem, 1.8vw, 1.2rem);
  line-height: 1.3;
  text-shadow: 0 2px 0 rgba(0, 0, 0, 0.34);
}

/* ---------- SHARED PROFILE LAYOUT — 12-column grid ---------- */

.me-layout,
.player-layout {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  grid-auto-rows: var(--profile-layout-row-height);
  gap: var(--profile-layout-gap);
  width: min(94vw, 1380px);
}

/* ---------- DEFAULT FLOW MODE (untouched profiles) ----------
   When a profile has never been customized, panels render at natural content
   height in three independent columns instead of the rigid fixed-row grid. */
.me-layout.layout--flow,
.player-layout.layout--flow {
  display: flex;
  align-items: flex-start;
  grid-template-columns: none;
  grid-auto-rows: auto;
}

.layout-flow-col {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--profile-layout-gap);
}

/* Panels have no padding of their own (the zoom shell normally supplies it), so
   flow mode restores comfortable internal padding and stacking. */
.layout--flow .me-panel,
.layout--flow .player-panel {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  overflow: visible;
}

.layout--flow .me-hero-card,
.layout--flow .player-hero-card {
  display: flex;
  flex-direction: column;
  gap: 18px;
  grid-template-columns: none;
  grid-template-rows: none;
  grid-auto-rows: auto;
  overflow: visible;
  container-type: normal;
}

/* Children flow naturally rather than being absolutely positioned by percent. */
.layout--flow [data-profile-child-id] {
  position: static;
  width: auto;
  height: auto;
  min-height: 0;
}

.layout--flow .player-hero-card__child,
.layout--flow .me-hero-card__child {
  width: 100%;
}

/* A panel hidden by JS (e.g. an empty music player) must stay hidden in flow. */
.layout--flow .me-panel[hidden],
.layout--flow .player-panel[hidden] {
  display: none;
}

/* ---------- FIXED MOBILE STACK ----------
   Phones ignore the saved composition layout entirely (see apply-layout.mjs) and
   render one full-width column. This is a plain class rather than a media query
   because the JS branch that builds the single column and the CSS that styles it
   must agree — a media query could style a stack the JS never built. */
.me-layout.layout--mobile-stack,
.player-layout.layout--mobile-stack {
  flex-direction: column;
  width: min(100%, 620px);
  margin-inline: auto;
}

.layout--mobile-stack .layout-flow-col {
  width: 100%;
  flex: 0 0 auto;
}

/* Panels sized off the desktop grid can leave fixed heights behind; on mobile
   every panel is content-height. */
.layout--mobile-stack .me-panel,
.layout--mobile-stack .player-panel,
.layout--mobile-stack .me-hero-card,
.layout--mobile-stack .player-hero-card {
  width: 100%;
  height: auto;
  min-height: 0;
  padding: 16px;
}

/* Scrollable children (thoughts feed) would otherwise inherit a percentage height
   from the composition pass and collapse to nothing. */
.layout--mobile-stack [data-profile-child-scroll] {
  max-height: 60vh;
  overflow-y: auto;
}

/* The featured-cabinet card normally sizes off the zoom-shell's container height
   (100cqh); flow mode has no size container, so pin it to a natural square. */
.layout--flow .me-featured-cabinet,
.layout--flow .player-featured-cabinet {
  height: auto;
}

.layout--flow .me-featured-cabinet__card,
.layout--flow .player-featured-cabinet__card {
  width: min(100%, 288px);
  height: auto;
  aspect-ratio: 1 / 1;
}

@media (max-width: 980px) {
  .me-layout.layout--flow,
  .player-layout.layout--flow {
    flex-direction: column;
  }

  .layout-flow-col {
    width: 100%;
  }
}

/* Hidden panels */
.layout-panel--hidden {
  display: none !important;
}

/* Mobile: collapse all panels to single-column flow.
   !important overrides the inline grid-column/grid-row set by apply-layout.mjs. */
@media (max-width: 980px) {
  .me-layout,
  .player-layout {
    grid-template-columns: 1fr;
    grid-auto-rows: auto;
  }

  .me-layout > *,
  .player-layout > * {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
  }
}

@media (max-width: 640px) {
  .me-layout,
  .player-layout {
    gap: 12px;
  }
}
