/* Final desktop polish for the local beta. Business-owned controls stay intact. */

html body .tko-popover.tko-mode-menu {
  width: 224px;
  padding: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  background: rgba(17, 18, 22, 0.98);
  box-shadow:
    0 18px 46px rgba(0, 0, 0, 0.5),
    inset 0 1px rgba(255, 255, 255, 0.035);
  backdrop-filter: blur(18px);
}

html body .tko-mode-menu > p {
  margin: 0;
  padding: 4px 9px 7px;
  color: #747b85;
  font-size: 10px;
  letter-spacing: 0;
}

html body .tko-mode-menu > button {
  width: 100%;
  min-height: 42px;
  height: 42px;
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) 15px;
  align-items: center;
  gap: 9px;
  margin: 2px 0 0;
  padding: 0 10px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #9aa0aa;
  text-align: left;
}

html body .tko-mode-menu > button:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background: rgba(255, 255, 255, 0.045);
  color: #f3f4f6;
}

html body .tko-mode-menu > button.is-selected {
  border-color: rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.085);
  color: #f7f8f9;
}

html body .tko-mode-menu > button > svg {
  justify-self: center;
}

html body .tko-mode-menu .tko-selected-check {
  opacity: 0;
}

html body .tko-mode-menu > button.is-selected .tko-selected-check {
  opacity: 1;
}

html body .tko-unified-composer .tko-settings {
  width: min(372px, calc(100vw - 32px));
  padding: 14px;
  border-radius: 16px;
}

html body .tko-unified-composer .tko-settings header {
  min-height: 24px;
  margin: 0 0 8px;
  padding: 0;
}

html body .tko-unified-composer .tko-settings header:not(:first-child) {
  margin-top: 13px;
}

html body .tko-unified-composer .tko-settings header strong {
  font-size: 12px;
}

html body .tko-unified-composer .tko-settings header span {
  color: #707780;
  font-size: 11px;
}

html body .tko-unified-composer .tko-ratio-grid {
  gap: 7px;
}

html body[data-creation-mode="video"] .tko-unified-composer .tko-ratio-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

html body[data-creation-mode="video"] .tko-unified-composer .tko-ratio-grid > button:disabled {
  display: none;
}

html body .tko-unified-composer .tko-ratio-grid > button {
  min-height: 72px;
  border-radius: 10px;
}

html body .tko-unified-composer .tko-count-row {
  width: max-content;
  max-width: 100%;
  gap: 5px;
}

html body .tko-unified-composer .tko-count-row button {
  width: 41px;
  min-width: 41px;
  height: 34px;
  min-height: 34px;
  border-radius: 9px;
}

html body #shortfilmView .tko-arrow {
  width: 38px !important;
  height: 38px !important;
  min-width: 38px !important;
  min-height: 38px !important;
  padding: 0 !important;
  display: grid !important;
  place-items: center !important;
  border: 1px solid rgba(255, 255, 255, 0.16) !important;
  border-radius: 50% !important;
  background: rgba(10, 11, 14, 0.88) !important;
  color: #f4f5f6 !important;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34) !important;
  backdrop-filter: blur(12px);
  transition:
    border-color 150ms ease,
    background-color 150ms ease,
    transform 150ms ease !important;
}

html body #shortfilmView .tko-arrow:hover:not(:disabled) {
  border-color: rgba(255, 255, 255, 0.3) !important;
  background: rgba(31, 33, 38, 0.96) !important;
}

html body #shortfilmView .tko-arrow:active:not(:disabled) {
  transform: scale(0.94) !important;
}

html body #shortfilmView .tko-arrow:disabled {
  opacity: 0.22 !important;
  box-shadow: none !important;
}

html body #shortfilmView .tko-arrow svg {
  width: 18px;
  height: 18px;
  display: block;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.85;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}

html body #homeView .pearl-cost {
  min-width: 34px !important;
  height: 30px !important;
  padding: 0 5px !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
  background: rgba(255, 255, 255, 0.025) !important;
  box-shadow: none !important;
  color: #858b94 !important;
  font-size: 11px !important;
  font-weight: 500 !important;
}

html body #homeView .pearl-cost::before {
  color: #9aa0aa !important;
  font-size: 9px !important;
}

html body .pearl-curated-grid.curated-fallback {
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 18px !important;
  align-items: start !important;
}

html body .curated-card {
  position: relative !important;
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  color: #f2f4f7 !important;
  text-align: left !important;
}

html body .curated-card .communityMedia {
  position: relative !important;
  inset: auto !important;
  width: 100% !important;
  height: auto !important;
  min-height: 0 !important;
  padding: 0 !important;
  aspect-ratio: 16 / 9 !important;
  overflow: hidden !important;
  border: 1px solid rgba(255, 255, 255, 0.12) !important;
  border-radius: 12px !important;
  background: #0b0c0e !important;
  box-shadow: none !important;
  transform: translateZ(0);
}

html body .curated-card .communityMedia img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition:
    transform 420ms cubic-bezier(0.22, 1, 0.36, 1),
    filter 220ms ease;
}

html body #homeView #pearlCuratedGrid .curated-card .communityMedia::after,
html body #exploreView #pearlExploreGrid .curated-card .communityMedia::after {
  content: none !important;
  display: none !important;
}

html body .curated-card .curated-play {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.38);
  border-radius: 50%;
  background: rgba(10, 11, 14, 0.7);
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -46%) scale(0.92);
  transition:
    opacity 160ms ease,
    transform 160ms ease;
  backdrop-filter: blur(10px);
}

html body .curated-card .curated-play svg {
  width: 14px;
  height: 14px;
  margin-left: 1px;
  fill: currentColor;
  stroke: none;
}

html body .curated-card:hover .curated-play,
html body .curated-card:focus-visible .curated-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

html body .curated-card:hover .communityMedia img {
  transform: scale(1.025);
  filter: brightness(0.9);
}

html body .curated-card .communityBody {
  position: static !important;
  inset: auto !important;
  min-height: 0 !important;
  padding: 0 2px !important;
  display: flex !important;
  align-items: flex-start !important;
  gap: 2px !important;
  background: transparent !important;
}

html body .curated-card .communityBody > strong {
  overflow: hidden;
  max-width: 100%;
  color: #e8eaee !important;
  font-size: 13px !important;
  font-weight: 580 !important;
  line-height: 1.45 !important;
  text-align: left !important;
  text-overflow: ellipsis;
  white-space: nowrap;
}

html body .curated-card .communityMeta {
  width: 100%;
  justify-content: space-between !important;
  margin: 0 !important;
  color: #7f858e !important;
  font-size: 11px !important;
  line-height: 1.4 !important;
}

html body .curated-card .communityMeta > span:last-child {
  color: #6f757e;
  font-variant-numeric: tabular-nums;
}

html body .curated-card .curated-index {
  position: absolute;
  z-index: 2;
  top: 9px;
  left: 9px;
  min-width: 25px;
  padding: 3px 6px;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 999px;
  background: rgba(10, 11, 14, 0.66);
  color: rgba(255, 255, 255, 0.82);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
  text-align: center;
  backdrop-filter: blur(9px);
}

html body .curated-card .featuredPill {
  top: 9px !important;
  left: 9px !important;
  padding: 3px 7px !important;
  border: 1px solid rgba(255, 255, 255, 0.14) !important;
  border-radius: 999px !important;
  background: rgba(11, 12, 15, 0.72) !important;
  color: #e7e9ed !important;
  font-size: 8px !important;
  backdrop-filter: blur(10px);
}

html body .curated-card .curated-duration {
  position: absolute;
  right: 9px;
  bottom: 9px;
  padding: 3px 6px;
  border-radius: 6px;
  background: rgba(8, 9, 11, 0.74);
  color: rgba(255, 255, 255, 0.88);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  backdrop-filter: blur(8px);
}

html body .curated-card:focus-visible {
  outline: 2px solid rgba(208, 216, 234, 0.8) !important;
  outline-offset: 5px !important;
}

html body .curated-work-dialog {
  width: min(900px, calc(100vw - 48px));
  max-height: min(760px, calc(100dvh - 48px));
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 18px;
  background: #111216;
  color: #f0f2f5;
  box-shadow: 0 40px 110px rgba(0, 0, 0, 0.62);
}

html body .curated-work-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(9px);
}

html body .curated-work-dialog__layout {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.75fr);
  min-height: 440px;
}

html body .curated-work-dialog__media {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #07080a;
}

html body .curated-work-dialog__media video {
  display: block;
  width: 100%;
  max-height: 680px;
  object-fit: contain;
  background: #000;
}

html body .curated-work-dialog__copy {
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 34px 30px 28px;
  border-left: 1px solid rgba(255, 255, 255, 0.08);
}

html body .curated-work-dialog__copy h2 {
  margin: 0;
  color: #f7f8fa;
  font-size: 24px;
  line-height: 1.3;
  letter-spacing: -0.025em;
}

html body .curated-work-dialog__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

html body .curated-work-dialog__meta span {
  padding: 4px 8px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 999px;
  color: #9ca2ab;
  font-size: 11px;
}

html body .curated-work-dialog__prompt {
  margin: 0;
  color: #aeb3bb;
  font-size: 13px;
  line-height: 1.8;
}

html body .curated-work-dialog__actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
}

html body .curated-work-dialog__actions button,
html body .curated-work-dialog__close {
  min-height: 40px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.055);
  color: #e4e7eb;
  padding: 0 14px;
}

html body .curated-work-dialog__actions .primary {
  border-color: rgba(255, 255, 255, 0.82);
  background: #f0f1f3;
  color: #15161a;
  font-weight: 650;
}

html body .curated-work-dialog__close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 14px;
  width: 38px;
  min-width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 50%;
  background: rgba(17, 18, 22, 0.82);
  backdrop-filter: blur(12px);
}

@media (max-width: 980px) {
  html body .pearl-curated-grid.curated-fallback {
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  }
}

@media (max-width: 720px) {
  html body .pearl-curated-grid.curated-fallback {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 12px !important;
  }

  html body .curated-work-dialog {
    width: calc(100vw - 24px);
    max-height: calc(100dvh - 24px);
  }

  html body .curated-work-dialog__layout {
    grid-template-columns: 1fr;
    overflow: auto;
  }

  html body .curated-work-dialog__copy {
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    border-left: 0;
    padding: 24px 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  html body .curated-card .communityMedia img,
  html body #shortfilmView .tko-arrow {
    transition: none !important;
  }
}

/* The V23 home shell carries an ID-specific legacy card reset. Keep the
   approved 4-column photographic wall above that legacy selector. */
html body #homeView #pearlCuratedGrid.curated-fallback .curated-card,
html body #homeView #homeCommunityGrid.curated-fallback .curated-card,
html body #exploreView #communityGrid.curated-fallback .curated-card,
html body #exploreView #pearlExploreGrid.curated-fallback .curated-card {
  display: flex !important;
  width: 100% !important;
  min-width: 0 !important;
  flex-direction: column !important;
  gap: 10px !important;
  text-align: left !important;
}

html body #homeView #pearlCuratedGrid.curated-fallback .curated-card .communityMedia,
html body #homeView #homeCommunityGrid.curated-fallback .curated-card .communityMedia,
html body #exploreView #communityGrid.curated-fallback .curated-card .communityMedia,
html body #exploreView #pearlExploreGrid.curated-fallback .curated-card .communityMedia {
  display: block !important;
  width: 100% !important;
  height: auto !important;
  padding: 0 !important;
  aspect-ratio: 16 / 9 !important;
}

html body #homeView #pearlCuratedGrid.curated-fallback .curated-card .communityBody,
html body #homeView #homeCommunityGrid.curated-fallback .curated-card .communityBody,
html body #exploreView #communityGrid.curated-fallback .curated-card .communityBody,
html body #exploreView #pearlExploreGrid.curated-fallback .curated-card .communityBody {
  position: static !important;
  display: flex !important;
  align-items: flex-start !important;
  padding: 0 2px !important;
  text-align: left !important;
}

/* UI3 handoff: compact iOS-like two-option switcher and tighter sheets. */
html body .tko-unified-composer .tko-mode-menu {
  display: grid !important;
  width: 260px !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 3px !important;
  padding: 5px !important;
  border-radius: 12px !important;
  background: #23252a !important;
}

html body .tko-unified-composer .tko-mode-menu[hidden] {
  display: none !important;
}

html body .tko-unified-composer .tko-mode-menu > p,
html body .tko-unified-composer .tko-mode-menu .tko-selected-check {
  display: none !important;
}

html body .tko-unified-composer .tko-mode-menu > button {
  width: auto !important;
  min-height: 42px !important;
  height: 42px !important;
  display: flex !important;
  justify-content: center !important;
  gap: 6px !important;
  padding: 0 8px !important;
  border: 0 !important;
  border-radius: 8px !important;
  color: #858b95 !important;
  font-size: 11px !important;
  text-align: center !important;
}

html body .tko-unified-composer .tko-mode-menu > button:hover,
html body .tko-unified-composer .tko-mode-menu > button.is-selected {
  background: rgba(255, 255, 255, 0.085) !important;
  color: #eef0f3 !important;
}

/* Keep the bottom command row on one optical grid. */
html body .tko-unified-composer .tko-creator-toolbar {
  align-items: center !important;
  gap: 6px !important;
}

html body .tko-unified-composer .tko-creator-toolbar .tko-tool-button {
  min-height: 32px !important;
  height: 32px !important;
  padding: 0 8px !important;
  gap: 6px !important;
}

html body .tko-unified-composer .tko-creator-toolbar .tko-tool-button > svg {
  display: block !important;
  width: 13px !important;
  height: 13px !important;
  flex: 0 0 13px !important;
  opacity: 0.78;
}

html body .tko-unified-composer .tko-creator-toolbar .tko-mode-button {
  width: 112px !important;
  justify-content: flex-start !important;
}

html body .tko-unified-composer .tko-creator-toolbar .tko-settings-button {
  width: 78px !important;
  justify-content: flex-start !important;
}

html body .tko-unified-composer .tko-creator-toolbar .tko-mention-button {
  width: 32px !important;
  min-width: 32px !important;
  justify-content: center !important;
  padding: 0 7px !important;
}

html body .tko-unified-composer .tko-creator-toolbar .tko-submit-button {
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
}

html body #workspace#workspace.pearl-workspace.pearl-shell > nav#primaryNavigation#primaryNavigation .txNavSecondary button {
  height: 43px !important;
  min-height: 43px !important;
  justify-content: flex-start !important;
  gap: 11px !important;
  padding: 0 14px !important;
}

html body #workspace#workspace.pearl-workspace.pearl-shell > nav#primaryNavigation#primaryNavigation .txNavSecondary button > svg {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  flex: 0 0 18px !important;
  opacity: 0.72;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}

html body .tko-unified-composer .tko-mode-menu > button > svg:not(.tko-selected-check) {
  width: 14px !important;
  height: 14px !important;
  flex: 0 0 14px !important;
}

html body .tko-unified-composer .tko-mode-menu > button > span {
  width: auto !important;
  flex: 0 0 auto !important;
  white-space: nowrap !important;
}

html body .tko-unified-composer .tko-settings {
  width: 370px !important;
  padding: 13px !important;
  border-radius: 12px !important;
  background: #222429 !important;
}

html body .tko-unified-composer .tko-ratio-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 6px !important;
}

html body .tko-unified-composer .tko-ratio-grid > button {
  min-height: 62px !important;
}

html body[data-creation-mode="image"] .tko-unified-composer .tko-ratio-grid {
  grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
}

html body[data-creation-mode="image"] .tko-unified-composer .tko-count-row {
  display: grid !important;
  grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
  width: 100% !important;
}

html body #homeView .pearl-count-options {
  min-height: 32px !important;
  gap: 1px !important;
  padding: 2px !important;
  border-radius: 8px !important;
}

html body #homeView .pearl-count-option {
  width: 28px !important;
  min-width: 28px !important;
  min-height: 26px !important;
  border-radius: 6px !important;
  font-size: 11px !important;
}

html body #shortfilmView .txMasterBMedia > img,
html body #shortfilmView .txMasterBMedia > video,
html body #shortfilmView .sfResultPoster {
  filter: none !important;
  image-rendering: auto !important;
  object-fit: contain !important;
  background: #050608 !important;
}
