/* Temporary: keep view/react markup and JS, but hide them from the 2D footer. */
.post-2d-stats > span,
.post-2d-react-btn {
  display: none !important;
}

.memory-share-open-btn {
  display: inline-flex;
  align-items: center;
  position: relative;
  margin: 0;
  padding: 0 0 2px;
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  opacity: 0.74;
  white-space: nowrap;
  transition: transform 0.12s ease-out, opacity 0.2s ease, color 0.2s ease;
}

.memory-share-open-btn::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 1px;
  background: currentColor;
  opacity: 0.28;
  box-shadow: 0 0 8px rgba(143, 199, 255, 0.34);
  transform: scaleX(0.72);
  transform-origin: center;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.memory-share-open-btn:hover {
  opacity: 1;
  transform: translateY(-0.5px);
}

.memory-share-open-btn:hover::after {
  opacity: 0.62;
  transform: scaleX(1);
}

.memory-share-open-btn:active {
  transform: translateY(0.5px) scale(0.98);
}

.memory-share-sheet {
  position: fixed;
  inset: 0;
  z-index: 1000002;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  background: rgba(0, 0, 0, 0.74);
}

.memory-share-sheet.is-open {
  display: flex;
}

.memory-share-panel {
  width: min(920px, 100%);
  max-height: min(720px, 92vh);
  display: grid;
  grid-template-columns: minmax(260px, 390px) minmax(260px, 1fr);
  gap: 18px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: #08090d;
  box-shadow: 0 20px 64px rgba(0, 0, 0, 0.55);
  box-sizing: border-box;
  color: #f0f0f0;
}

.memory-share-preview {
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.02)),
    #11131a;
}

.memory-share-preview canvas {
  display: block;
  max-width: 100%;
  max-height: 66vh;
  width: auto;
  height: auto;
}

.memory-share-controls {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.memory-share-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.memory-share-title {
  margin: 0;
  color: #f4f4f4;
  font-size: 18px;
  font-weight: 400;
  line-height: 1.25;
}

.memory-share-close {
  width: 32px;
  height: 32px;
  border: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  cursor: pointer;
  font-size: 22px;
  line-height: 30px;
}

.memory-share-close:hover {
  background: rgba(255, 255, 255, 0.16);
}

.memory-share-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.memory-share-action {
  position: relative;
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
  color: #efefef;
  cursor: pointer;
  font-size: 13px;
  line-height: 1;
}

.memory-share-action:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.32);
}

.memory-share-action::after {
  content: "";
  position: absolute;
  left: -10px;
  right: -10px;
  top: -8px;
  bottom: -8px;
  border-radius: 999px;
  border: 1px solid currentColor;
  opacity: 0;
  transform: scale(0.86);
  pointer-events: none;
}

.memory-share-action.is-feedback::after {
  animation: memory-share-action-pulse 0.72s ease-out;
}

@keyframes memory-share-action-pulse {
  0% {
    opacity: 0.5;
    transform: scale(0.86);
    box-shadow: 0 0 0 rgba(255, 255, 255, 0),
      0 0 0 rgba(143, 199, 255, 0);
  }
  100% {
    opacity: 0;
    transform: scale(1.22);
    box-shadow: 0 0 18px rgba(255, 255, 255, 0.2),
      0 0 34px rgba(143, 199, 255, 0.22);
  }
}

@media (min-width: 801px) {
  .memory-share-sheet {
    padding: 34px;
    background: rgba(0, 0, 0, 0.84);
  }

  .memory-share-panel {
    position: relative;
    width: auto;
    max-height: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
  }

  .memory-share-preview {
    max-height: calc(100vh - 128px);
    min-height: 0;
    padding: 1px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 2px;
    background: transparent;
    box-shadow: 0 22px 72px rgba(0, 0, 0, 0.62),
      0 0 26px rgba(143, 199, 255, 0.12);
  }

  .memory-share-preview canvas {
    max-height: calc(100vh - 128px);
    max-width: min(48vw, 430px);
  }

  .memory-share-controls {
    width: 100%;
    align-items: center;
    gap: 12px;
  }

  .memory-share-header {
    position: absolute;
    top: -13px;
    right: -13px;
    z-index: 2;
  }

  .memory-share-title {
    display: none;
  }

  .memory-share-close {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.62);
    color: rgba(255, 255, 255, 0.8);
    font-size: 20px;
    line-height: 24px;
    transition: background 0.2s ease, border-color 0.2s ease,
      color 0.2s ease, transform 0.12s ease-out;
  }

  .memory-share-close:hover {
    background: rgba(0, 0, 0, 0.82);
    border-color: rgba(255, 255, 255, 0.36);
    color: #fff;
    transform: translateY(-0.5px);
  }

  .memory-share-actions {
    justify-content: center;
    gap: 24px;
  }

  .memory-share-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(230, 230, 230, 0.72);
    font: inherit;
    font-size: 13px;
    line-height: 1;
    opacity: 0.86;
    transition: transform 0.12s ease-out, opacity 0.2s ease, color 0.2s ease;
  }

  .memory-share-action::before {
    content: "";
    width: 6px;
    height: 6px;
    border: 1px solid currentColor;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3),
      0 0 12px rgba(143, 199, 255, 0.24);
    flex: 0 0 auto;
  }

  .memory-share-action:hover {
    background: transparent;
    border-color: transparent;
    color: #fff;
    opacity: 1;
    transform: translateY(-0.5px);
  }
}

@media (max-width: 800px) {
  .memory-share-open-btn {
    font-size: 14px;
  }

  .memory-share-sheet {
    align-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, 0.86);
  }

  .memory-share-panel {
    position: relative;
    width: auto;
    max-height: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    overflow: visible;
  }

  .memory-share-preview {
    min-height: 0;
    max-height: calc(100vh - 140px);
    padding: 1px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 2px;
    background: transparent;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.68),
      0 0 24px rgba(143, 199, 255, 0.12);
  }

  .memory-share-preview canvas {
    max-height: calc(100vh - 140px);
    max-width: min(74vw, 390px);
  }

  .memory-share-title {
    display: none;
  }

  .memory-share-controls {
    width: 100%;
    align-items: center;
    gap: 12px;
  }

  .memory-share-header {
    position: absolute;
    top: -13px;
    right: -13px;
    z-index: 2;
  }

  .memory-share-close {
    width: 28px;
    height: 28px;
    border: 1px solid rgba(255, 255, 255, 0.18);
    background: rgba(0, 0, 0, 0.66);
    color: rgba(255, 255, 255, 0.82);
    font-size: 20px;
    line-height: 24px;
  }

  .memory-share-close:hover {
    background: rgba(0, 0, 0, 0.82);
    border-color: rgba(255, 255, 255, 0.36);
    color: #fff;
  }

  .memory-share-actions {
    justify-content: center;
    gap: 18px;
  }

  .memory-share-action {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 0;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    color: rgba(230, 230, 230, 0.76);
    font: inherit;
    font-size: 13px;
    line-height: 1;
    opacity: 0.9;
  }

  .memory-share-action::before {
    content: "";
    width: 6px;
    height: 6px;
    border: 1px solid currentColor;
    border-radius: 50%;
    box-shadow: 0 0 6px rgba(255, 255, 255, 0.3),
      0 0 12px rgba(143, 199, 255, 0.24);
    flex: 0 0 auto;
  }

  .memory-share-action:hover {
    background: transparent;
    border-color: transparent;
    color: #fff;
  }
}
