.moments-shell {
  width: min(720px, 100%);
  margin: auto;
  padding: 28px 20px 56px;
}

.moments-heading {
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.moments-heading h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.moments-heading p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.moment-composer {
  padding: 20px 0 18px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.moment-composer > label {
  font-size: 14px;
  font-weight: 700;
}

.moment-composer textarea {
  width: 100%;
  min-height: 108px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 11px 12px;
  background: var(--surface);
  color: var(--ink);
}

.moment-composer-actions {
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.moment-composer-actions > .button {
  min-width: 96px;
}

.moment-photo-control {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.moment-photo-picker {
  cursor: pointer;
}

.moment-photo-input:disabled + .moment-photo-picker {
  cursor: not-allowed;
  opacity: .55;
}

.moment-photo-count {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

.moment-preview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.moment-preview-grid[hidden] {
  display: none;
}

.moment-preview {
  position: relative;
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 6px;
  background: var(--surface-muted);
}

.moment-preview img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.moment-preview .icon-command {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 36px;
  height: 36px;
  background: rgb(32 37 33 / .78);
  color: white;
}

.moments-timeline {
  border-top: 0;
}

.moment-item {
  min-width: 0;
  padding: 20px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  align-items: start;
  gap: 12px;
}

.moment-author-marker {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  background: var(--surface-muted);
  color: var(--green-dark);
  font-size: 13px;
  font-weight: 800;
}

.moment-body {
  min-width: 0;
}

.moment-meta {
  min-height: 44px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 8px;
}

.moment-meta > div {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.moment-meta strong {
  overflow-wrap: anywhere;
  font-size: 14px;
}

.moment-meta time {
  color: var(--muted);
  font-size: 12px;
}

.moment-text {
  margin: 8px 0 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.moment-photo-grid {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.moment-photo-grid[data-count="1"] {
  grid-template-columns: minmax(0, 420px);
}

.moment-photo-grid[data-count="2"] {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.moment-photo-grid button {
  min-width: 0;
  aspect-ratio: 1;
  overflow: hidden;
  border: 0;
  border-radius: 4px;
  padding: 0;
  background: var(--surface-muted);
  cursor: pointer;
}

.moment-photo-grid img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.moments-empty {
  padding: 44px 0;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  text-align: center;
}

.moments-more {
  width: 100%;
  margin-top: 16px;
}

.moment-viewer {
  width: 100vw;
  max-width: 100vw;
  height: 100dvh;
  max-height: 100dvh;
  margin: 0;
  border: 0;
  padding: 0;
  overflow: hidden;
  background: #171a18;
  color: white;
}

.moment-viewer::backdrop {
  background: #171a18;
}

.moment-viewer-toolbar {
  position: absolute;
  inset: 0 0 auto;
  z-index: 2;
  min-height: 56px;
  padding: 6px 10px 6px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgb(23 26 24 / .84);
}

.moment-viewer-toolbar .icon-command,
.moment-viewer-previous,
.moment-viewer-next {
  color: white;
}

.moment-viewer-stage {
  width: 100%;
  height: 100%;
  padding: 64px 56px 28px;
  display: grid;
  place-items: center;
}

.moment-viewer-stage img {
  max-width: 100%;
  max-height: 100%;
  display: block;
  object-fit: contain;
}

.moment-viewer-previous,
.moment-viewer-next {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgb(255 255 255 / .1);
}

.moment-viewer-previous { left: 8px; }
.moment-viewer-next { right: 8px; }
.moment-viewer-previous:disabled,
.moment-viewer-next:disabled { opacity: .35; }

@media (max-width: 560px) {
  .moments-shell {
    padding: 20px 14px 40px;
  }

  .moment-composer-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .moment-composer-actions > .button {
    width: 100%;
  }

  .moment-photo-control {
    justify-content: space-between;
  }

  .moment-item {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 10px;
  }

  .moment-author-marker {
    width: 38px;
    height: 38px;
  }

  .moment-viewer-stage {
    padding: 64px 44px 20px;
  }

  .moment-viewer-previous { left: 2px; }
  .moment-viewer-next { right: 2px; }
}
