.ml-main.mc-main .mc-header {
  margin-bottom: 0.5rem;
}

/**
 * MeDia Locker page — bridges locker layout with legacy mc-* components.
 */

.ml-main.mc-main {
  max-width: 1200px;
  padding-top: calc(52px + env(safe-area-inset-top) + 0.75rem);
  padding-bottom: 3rem;
}

.ml-main.mc-main .mc-kicker {
  color: #6b7a94;
  text-shadow: none;
  font-family: "DM Sans", system-ui, sans-serif;
  font-weight: 600;
  letter-spacing: 0.22em;
}

.ml-main.mc-main .mc-title {
  font-family: Syne, system-ui, sans-serif;
}

.ml-main.mc-main .mc-page-subtitle {
  color: #aab6ca;
  text-shadow: none;
  font-size: 1rem;
}

.ml-main.mc-main .mc-back-link {
  color: #8de8a8;
  border-bottom-color: rgba(0, 245, 42, 0.25);
}

.ml-main.mc-main .mc-sub {
  color: #9aa7bc;
}

/* Activity feed stays list style */
#mcNotificationFeed.mc-grid.mc-grid--list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Library: large square tiles */
#mcGrid.ml-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
}

@media (min-width: 520px) {
  #mcGrid.ml-grid {
    grid-template-columns: repeat(3, 1fr);
    gap: 0.85rem;
  }
}

@media (min-width: 900px) {
  #mcGrid.ml-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

#mcGrid.ml-grid .mc-card {
  flex-direction: column;
  align-items: stretch;
  padding: 0;
  gap: 0;
  border-radius: 1.1rem;
  background: #0c0e14;
  border-color: rgba(255, 255, 255, 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#mcGrid.ml-grid .mc-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45);
}

#mcGrid.ml-grid .mc-card-thumb {
  flex: none;
  width: 100%;
  align-self: stretch;
  height: auto;
  aspect-ratio: 1;
  border-radius: 0;
}

#mcGrid.ml-grid .mc-card-body {
  padding: 0.5rem 0.65rem 0.65rem;
  gap: 0.35rem;
}

#mcGrid.ml-grid .mc-card-meta {
  padding: 0;
}

#mcGrid.ml-grid .mc-card-title {
  font-size: 0.78rem;
  color: #aab6ca;
}

#mcGrid.ml-grid .mc-tag {
  top: 0.45rem;
  left: 0.45rem;
  bottom: auto;
}

#mcGrid.ml-grid .mc-card-play {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 2.5rem;
  height: 2.5rem;
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.45);
  border-color: rgba(255, 255, 255, 0.25);
  color: rgba(255, 255, 255, 0.9);
}

#mcGrid.ml-grid .mc-card-duration {
  font-size: 0.72rem;
  right: 0.45rem;
  bottom: 0.45rem;
  padding: 3px 7px;
  border-radius: 6px;
}

#mcGrid.ml-grid .mc-card-thumb--video {
  display: block;
}

.mc-fav-badge {
  position: absolute;
  top: 0.45rem;
  right: 0.45rem;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  border: none;
  background: rgba(0, 0, 0, 0.45);
  color: #ffd36a;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  pointer-events: auto;
  box-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
  transition: transform 0.12s ease;
}

/* Grid tiles: keep star above play overlay / video layers (some browsers stack oddly). */
#mcGrid.ml-grid .mc-card-thumb {
  position: relative;
  isolation: isolate;
}

#mcGrid.ml-grid .mc-card-thumb .mc-fav-badge {
  z-index: 12;
}

/* Recents strip: star sits on .ml-strip-thumb (valid markup — strip row is a div, not a nested button). */
.ml-strip-thumb .mc-fav-badge--strip {
  top: 0.35rem;
  right: 0.35rem;
  z-index: 8;
}

.mc-fav-badge:hover {
  transform: scale(1.08);
}

.mc-fav-badge[aria-pressed="true"] {
  color: #ffcc33;
  background: rgba(255, 200, 50, 0.2);
}

/* Modal: title + action row */
.mc-modal-bar {
  flex-shrink: 0;
  width: 100%;
  max-width: min(96vw, 720px);
  margin-top: 0.75rem;
  padding-bottom: env(safe-area-inset-bottom);
  position: relative;
  z-index: 25;
}

.mc-modal-title {
  margin: 0 0 0.5rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: rgba(234, 240, 255, 0.95);
  text-align: center;
  padding: 0 2.5rem;
  line-height: 1.35;
}

.mc-modal-actions.mc-modal-actions--row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  justify-content: center;
  margin-top: 0;
}

.mc-modal-actions.mc-modal-actions--row .mc-btn {
  font-size: 0.8rem;
  padding: 0.5rem 0.85rem;
  border-radius: 999px;
}

.mc-modal-actions.mc-modal-actions--row .mc-btn-ghost {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

/* Full-height modal layout with bottom action bar */
.mc-modal {
  justify-content: flex-start;
  align-items: stretch;
  padding-left: max(0.75rem, env(safe-area-inset-left));
  padding-right: max(0.75rem, env(safe-area-inset-right));
}

.mc-modal-body {
  flex: 1;
  min-height: 0;
  max-height: none;
  padding-top: 2.75rem;
  box-sizing: border-box;
  z-index: 0;
}

.mc-modal-media {
  max-height: min(72vh, 100%);
}

.mc-modal-mux {
  max-height: min(72vh, 100%);
}

/* Photos-first opening: thumbnails before tools & card promo */
.ml-section--library-opening {
  margin-top: 0.35rem;
}

.ml-section-head--tight {
  margin-bottom: 0.45rem;
}

.ml-strip--hero.ml-strip {
  padding-top: 0.1rem;
  gap: 0.75rem;
}

.ml-strip--hero .ml-strip-item {
  flex: 0 0 52vw;
  max-width: 280px;
}

@media (min-width: 480px) {
  .ml-strip--hero .ml-strip-item {
    flex-basis: 44vw;
    max-width: 260px;
  }
}

@media (min-width: 720px) {
  .ml-strip--hero .ml-strip-item {
    flex-basis: 220px;
    max-width: 240px;
  }
}

.mc-section--library-grid {
  margin-top: 1.15rem;
}

/* ── Phase 1: premium hero + direct uploads ── */
.ml-locker-hero {
  margin: 0 0 1.25rem;
  padding: 1.25rem 1.1rem 1.35rem;
  border-radius: 1.25rem;
  border: 1px solid rgba(0, 245, 42, 0.22);
  background:
    radial-gradient(120% 90% at 10% 0%, rgba(0, 245, 42, 0.12) 0%, transparent 55%),
    linear-gradient(165deg, #0e1218 0%, #070a0f 100%);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
}

.ml-locker-hero__inner {
  max-width: 36rem;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.ml-locker-hero__title {
  margin: 0;
  font-family: Syne, system-ui, sans-serif;
  font-size: clamp(1.35rem, 4.2vw, 1.75rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: #f4f8fb;
}

.ml-locker-hero__sub {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  line-height: 1.5;
  color: rgba(200, 212, 230, 0.88);
}

.ml-locker-hero__cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  align-items: center;
}

.ml-btn-upload-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  min-height: 52px;
  padding: 0 1.35rem;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  font-family: Outfit, system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: none;
  color: #020403;
  background: linear-gradient(145deg, #2cff5a 0%, #00f52a 45%, #00c922 100%);
  border: 1px solid rgba(0, 255, 80, 0.45);
  box-shadow: 0 0 28px rgba(0, 245, 42, 0.35), 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: transform 0.18s ease, box-shadow 0.18s ease, filter 0.18s ease;
}

.ml-btn-upload-primary:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: 0 0 36px rgba(0, 245, 42, 0.45), 0 10px 28px rgba(0, 0, 0, 0.4);
}

.ml-btn-upload-primary:active {
  transform: translateY(1px) scale(0.99);
}

.ml-btn-upload-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  filter: grayscale(0.2);
}

.ml-locker-hero__folder {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding-top: 0.15rem;
}

.ml-folder-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(0, 245, 42, 0.75);
}

.ml-folder-input {
  width: 100%;
  max-width: 20rem;
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(0, 0, 0, 0.35);
  color: #eef1f7;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.ml-folder-input:focus {
  border-color: rgba(0, 245, 42, 0.55);
  box-shadow: 0 0 0 3px rgba(0, 245, 42, 0.12);
}

.ml-folder-hint {
  margin: 0;
  font-size: 0.78rem;
  line-height: 1.45;
  color: rgba(160, 176, 198, 0.9);
}

.ml-folder-hint code {
  font-size: 0.85em;
  color: rgba(0, 245, 42, 0.85);
}

.mc-sub--after-hero {
  margin: 0 0 1rem;
  font-size: 0.88rem;
  color: rgba(180, 192, 210, 0.88);
}

/* Upload queue */
.ml-upload-queue {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin: 0 0 1.1rem;
}

.ml-upload-queue[hidden] {
  display: none !important;
}

.ml-upload-job {
  display: grid;
  grid-template-columns: 3.25rem 1fr;
  gap: 0.65rem;
  align-items: start;
  padding: 0.65rem 0.75rem;
  border-radius: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: linear-gradient(145deg, #12161f 0%, #0c0e14 100%);
  animation: ml-job-in 0.35s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes ml-job-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ml-upload-job__thumb {
  width: 3.25rem;
  height: 3.25rem;
  border-radius: 10px;
  overflow: hidden;
  background: #080b10;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ml-upload-job__thumb img,
.ml-upload-job__thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.ml-upload-job__body {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.ml-upload-job__name {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 600;
  color: #eef1f7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ml-upload-job__meta {
  margin: 0;
  font-size: 0.72rem;
  color: rgba(160, 176, 198, 0.88);
}

.ml-upload-job__bar {
  position: relative;
  height: 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.ml-upload-job__bar > i {
  display: block;
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, #00c922, #00f52a, #5dffbd);
  transition: width 0.12s ease-out;
}

.ml-upload-job__bar.is-indeterminate > i {
  width: 35% !important;
  animation: ml-bar-pulse 1.1s ease-in-out infinite;
}

@keyframes ml-bar-pulse {
  0% {
    transform: translateX(-30%);
    opacity: 0.65;
  }
  50% {
    transform: translateX(120%);
    opacity: 1;
  }
  100% {
    transform: translateX(280%);
    opacity: 0.65;
  }
}

.ml-upload-job__status {
  margin: 0;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: rgba(0, 245, 42, 0.85);
}

.ml-upload-job--err .ml-upload-job__status {
  color: #ff6b8a;
}

.ml-upload-job--done .ml-upload-job__status {
  color: rgba(0, 245, 42, 0.95);
}

/* Toasts */
.ml-toast-region {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 9500;
  display: flex;
  flex-direction: column-reverse;
  align-items: center;
  gap: 0.45rem;
  width: min(92vw, 22rem);
  pointer-events: none;
}

.ml-toast {
  pointer-events: none;
  width: 100%;
  padding: 0.65rem 0.85rem;
  border-radius: 12px;
  border: 1px solid rgba(0, 245, 42, 0.35);
  background: rgba(6, 10, 14, 0.94);
  color: #eef1f7;
  font-size: 0.84rem;
  line-height: 1.4;
  text-align: center;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 0 28px rgba(0, 245, 42, 0.18);
  animation: ml-toast-in 0.32s cubic-bezier(0.22, 1, 0.36, 1);
}

.ml-toast--err {
  border-color: rgba(255, 90, 120, 0.45);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.55), 0 0 24px rgba(255, 60, 100, 0.12);
}

@keyframes ml-toast-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* Library skeleton */
.ml-grid-skel {
  aspect-ratio: 1;
  border-radius: 1.1rem;
  background: linear-gradient(110deg, #12161f 0%, #1a2130 40%, #12161f 80%);
  background-size: 200% 100%;
  animation: ml-skel-shimmer 1.2s ease-in-out infinite;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

@keyframes ml-skel-shimmer {
  0% {
    background-position: 100% 0;
  }
  100% {
    background-position: -100% 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  .ml-upload-job,
  .ml-toast,
  .ml-grid-skel {
    animation: none;
  }

  .ml-upload-job__bar.is-indeterminate > i {
    animation: none;
    width: 60% !important;
  }
}

/* ── Polish v2: top bar, events, layout ── */
.ml-main.mc-main {
  padding-top: calc(52px + env(safe-area-inset-top) + 0.35rem);
}

.ml-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.85rem;
  padding: 0.15rem 0;
}

.ml-topbar__start {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.ml-topbar__back {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.04);
  color: #c8ffd4;
  text-decoration: none;
  font-size: 1.15rem;
  flex-shrink: 0;
}

.ml-topbar__back:hover {
  border-color: rgba(0, 245, 42, 0.35);
  background: rgba(0, 245, 42, 0.08);
}

.ml-topbar__brand {
  min-width: 0;
}

.ml-topbar__kicker {
  margin: 0;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(0, 245, 42, 0.7);
}

.ml-topbar__title {
  margin: 0.1rem 0 0;
  font-family: Syne, system-ui, sans-serif;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: #f4f8fb;
  line-height: 1.1;
}

.ml-btn-upload-primary--compact {
  min-height: 44px;
  padding: 0 1.1rem;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.ml-account-strip {
  margin: 0 0 0.75rem;
  padding: 0.45rem 0.75rem;
  border-radius: 10px;
  background: rgba(0, 245, 42, 0.06);
  border: 1px solid rgba(0, 245, 42, 0.15);
}

.ml-account-strip__name {
  font-family: Syne, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1rem;
  color: #d4ffe0;
}

.ml-locker-hero {
  margin-bottom: 0.85rem;
  padding: 1rem 1rem 1.1rem;
}

.ml-locker-hero__inner {
  gap: 0.85rem;
}

.ml-event-row {
  display: flex;
  gap: 0.5rem;
  align-items: stretch;
}

.ml-folder-input {
  max-width: none;
  flex: 1;
}

.ml-event-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 1rem;
  padding: 0.15rem 0;
}

.ml-chip--event {
  text-transform: capitalize;
  max-width: 12rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ml-library-hint {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.8rem;
  color: rgba(170, 182, 202, 0.85);
}

.mc-section-head--library {
  margin-bottom: 0.35rem;
}

.ml-more-fold {
  margin-top: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.2);
  overflow: hidden;
}

.ml-more-fold > summary {
  cursor: pointer;
  padding: 0.75rem 1rem;
  font-size: 0.85rem;
  font-weight: 600;
  color: #aab6ca;
  list-style: none;
}

.ml-more-fold > summary::-webkit-details-marker {
  display: none;
}

.ml-more-fold[open] > summary {
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.ml-more-fold .mc-section,
.ml-more-fold .mc-admin__body {
  padding: 0.75rem 1rem 1rem;
}

.mc-tag--event {
  top: auto;
  bottom: 0.45rem;
  left: 0.45rem;
  right: auto;
  max-width: calc(100% - 0.9rem);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(8, 12, 18, 0.75);
  color: #d8e4f8;
  border-color: rgba(255, 255, 255, 0.12);
}

#mcModalShare {
  font-weight: 700;
}

.ml-find-clip {
  margin: 0 0 1rem;
  padding: 0.85rem 1rem 1rem;
  border-radius: 12px;
  background: rgba(12, 18, 28, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

.ml-find-clip__title {
  margin: 0 0 0.25rem;
  font-family: Syne, system-ui, sans-serif;
  font-size: 1rem;
  font-weight: 800;
  color: #f4f8fb;
}

.ml-find-clip__sub {
  margin: 0 0 0.65rem;
  font-size: 0.8125rem;
  color: rgba(212, 228, 248, 0.72);
}

.ml-find-clip__row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: stretch;
}

.ml-find-clip__row .ml-folder-input {
  flex: 1 1 12rem;
  min-width: 0;
}

.ml-find-clip__hint {
  margin: 0.55rem 0 0;
  font-size: 0.8125rem;
  color: rgba(0, 245, 42, 0.85);
}

.ml-find-clip__hint--err {
  color: #f87171;
}
