.soudaMemoryShare-backdrop {
  position: fixed;
  inset: 0;
  /* 固定ヘッダー（9999）とハンバーガーメニュー（10500）より前面へ表示します。 */
  z-index: 11000;
  display: grid;
  place-items: center;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  overflow-y: auto;
  box-sizing: border-box;
  background: rgb(20 24 28 / 72%);
}

.soudaMemoryShare-backdrop[hidden] {
  display: none;
}

.soudaMemoryShare-dialog {
  width: calc(100vw - 32px);
  max-width: 620px;
  min-width: 0;
  max-height: calc(100dvh - 32px);
  padding: 20px;
  overflow-y: auto;
  box-sizing: border-box;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 18px 50px rgb(0 0 0 / 32%);
  color: #2d2520;
  text-align: center;
}

.soudaMemoryShare-title {
  margin: 0;
  font-size: clamp(1.35rem, 5vw, 1.8rem);
}

.soudaMemoryShare-description {
  margin: 8px 0 14px;
  line-height: 1.6;
}

.soudaMemoryShare-previewFrame {
  width: min(100%, 500px);
  margin: 0 auto;
  border-radius: 12px;
  overflow: hidden;
  background: #e7f5e9;
  box-shadow: inset 0 0 0 1px rgb(45 37 32 / 15%);
}

.soudaMemoryShare-preview {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: contain;
  -webkit-touch-callout: default;
}

.soudaMemoryShare-status {
  min-height: 1.5em;
  margin: 10px 0 0;
  color: #5d5149;
  line-height: 1.5;
}

.soudaMemoryShare-status.is-warning {
  color: #9b3a12;
  font-weight: 700;
}

.soudaMemoryShare-downloadToast {
  position: fixed;
  z-index: 11100;
  left: 50%;
  bottom: max(24px, calc(env(safe-area-inset-bottom) + 24px));
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  box-sizing: border-box;
  background: rgb(45 37 32 / 94%);
  box-shadow: 0 8px 24px rgb(0 0 0 / 28%);
  color: #fff;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  white-space: pre-line;
  pointer-events: none;
  transform: translateX(-50%);
}

.soudaMemoryShare-downloadToast[hidden] {
  display: none;
}

.soudaMemoryShare-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 14px;
}

.soudaMemoryShare-actions button {
  flex: 1 1 140px;
  min-width: 0;
  min-height: 44px;
  padding: 10px 18px;
  border: 0;
  border-radius: 9px;
  background: #edf1f3;
  color: #242424;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.soudaMemoryShare-actions button:first-child {
  background: #e1306c;
  color: #fff;
}

.soudaMemoryShare-actions button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.soudaMemoryShare-actions button:focus-visible,
.soudaMemoryShare-dialog:focus-visible {
  outline: 3px solid #1d70b8;
  outline-offset: 3px;
}

body.soudaMemoryShare-isModalOpen {
  overflow: hidden;
}

.soudaMemoryShare-helper {
  margin: 8px 0 0;
  color: #5d5149;
  font-size: 0.9rem;
  line-height: 1.4;
}

#souda-memory-share-button:not(:disabled) {
  background: #bd561b;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 3px 0 #7c4e0c;
}

#souda-memory-share-button:not(:disabled):hover {
  background: #9d4514;
}

#souda-memory-share-button:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: 0 1px 0 #7c4e0c;
}

#souda-memory-share-button:disabled {
  cursor: not-allowed;
  border: 1px solid #c4ccd1;
  background: #eef1f3;
  color: #59636a;
  font-weight: 700;
  opacity: 1;
}

@media (max-width: 420px) {
  .soudaMemoryShare-downloadToast {
    bottom: calc(env(safe-area-inset-bottom) + 128px);
  }

  .soudaMemoryShare-dialog {
    padding: 16px 12px;
  }

  .soudaMemoryShare-actions button {
    flex-basis: calc(50% - 10px);
  }

  .soudaMemoryShare-actions button:last-child {
    flex-basis: 100%;
  }
}
