/* 結果の面の「シェア」と、その面（ui/share-sheet.js が遊技頁でだけ読む）。設計稿 シェアカード 2c。
   カードの絵はサーバーが描く（lib/share/）。PC はまん中の窓（幅 480px まで）、手機（560px 以下）は下から出る板。器の作りは news-popup.css と同じ
   （dialog を画面いっぱいの透明な器にして、その中にカードを置く）。色は tokens.css、送り先の色だけは各社の色 */

/* 結果の面：「もう一度あそぶ」と「シェア」を横に並べる（縦に 1 段足すと、背の低い手機で面からはみ出す）*/
.share-row { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: nowrap; }
.share-row > button { white-space: nowrap; }
.share-open { display: inline-flex; align-items: center; justify-content: center; gap: 6px; }
.share-open svg { flex: none; }
.share-open[hidden] { display: none; }

dialog.share {
  --x: #0F1419; --line-green: #06C755; --whatsapp: #25D366;
  position: fixed; inset: 0; width: 100%; height: 100%; max-width: none; max-height: none;
  margin: 0; padding: 28px 16px; box-sizing: border-box;
  background: transparent; border: 0; overflow: auto; overscroll-behavior: contain;
  color: var(--ink); font-family: inherit;
}
dialog.share[open] { display: flex; }
dialog.share::backdrop { background: rgb(20 20 20 / .45); }
html:has(dialog.share[open]) { overflow: hidden; }

.share-card {
  position: relative; margin: auto; width: 100%; max-width: 480px; box-sizing: border-box;
  padding: 26px 20px 18px; display: flex; flex-direction: column; gap: 12px;
  background: var(--surface); border: var(--stroke-w) solid var(--stroke); border-radius: 22px;
  box-shadow: 0 6px 0 var(--stroke);
}
.share-title {
  position: absolute; top: -16px; left: 18px; padding: 3px 16px;
  background: var(--mino-z); border: var(--stroke-w) solid var(--stroke); border-radius: var(--radius-pill);
  font-size: 15px; font-weight: 900; line-height: 1.6; white-space: nowrap;
}
.share-close {
  position: absolute; top: -14px; right: -14px; width: 34px; height: 34px; display: grid; place-items: center;
  background: var(--surface); border: var(--stroke-w) solid var(--stroke); border-radius: 50%;
  font: inherit; font-size: 20px; font-weight: 900; line-height: 1; color: var(--ink); cursor: pointer;
}
.share-preview { position: relative; margin: 0; border: var(--stroke-w) solid var(--stroke); border-radius: 12px; overflow: hidden; background: var(--page); line-height: 0; }
.share-preview img { display: block; width: 100%; height: auto; }
.share-preview img:not([src]) { aspect-ratio: 1200 / 630; }
.share-wait {
  position: absolute; inset: 0; display: grid; place-items: center; background: rgb(251 246 232 / .85);
  font-size: 13px; font-weight: 800; line-height: 1.6; color: var(--muted);
}
.share-wait[hidden] { display: none; }
.share-note { font-size: 12px; font-weight: 700; line-height: 1.5; color: var(--muted); }
.share-note:empty { display: none; }
.share-text {
  width: 100%; box-sizing: border-box; resize: none; padding: 10px 12px;
  background: var(--page); border: var(--stroke-w) solid var(--line); border-radius: 12px;
  font: inherit; font-size: 13px; font-weight: 700; line-height: 1.6; color: var(--sub);
}
.share-actions { display: flex; flex-direction: column; gap: 10px; }
.share-targets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.share-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.share-btn {
  min-height: 44px; padding: 8px 10px; box-sizing: border-box;
  background: var(--surface); color: var(--ink); border: var(--stroke-w) solid var(--stroke); border-radius: var(--radius-pill);
  box-shadow: 0 3px 0 var(--stroke); font: inherit; font-size: 13px; font-weight: 900; line-height: 1.3; cursor: pointer;
}
.share-btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--stroke); }
.share-btn.is-x { background: var(--x); color: #fff; }
.share-btn.is-whatsapp { background: var(--whatsapp); color: #fff; }
.share-btn.is-line { background: var(--line-green); color: #fff; }
.share-btn.is-main { min-height: 50px; background: var(--cta); color: var(--brand-body); font-size: 15px; }
.share-more {
  align-self: center; padding: 2px 4px; background: none; border: 0; cursor: pointer;
  font: inherit; font-size: 12px; font-weight: 800; color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}
.share-toast {
  margin: 0; padding: 6px 12px; align-self: center; text-align: center;
  background: var(--ink); color: var(--surface); border-radius: 12px;
  font-size: 12px; font-weight: 800; line-height: 1.5;
}
.share-toast[hidden] { display: none; }

/* 手機：下から出る板。幅いっぱい・上の角だけ丸く・つまみ付き */
@media (max-width: 560px) {
  /* 手機の面は狭い（360px 幅で中身 232px）。2 つ並べても 1 行に収まるよう左右を詰める */
  .share-row > .secondary-dark-button { padding-inline: 14px; }
  dialog.share { padding: 0; }
  dialog.share[open] { align-items: flex-end; }
  .share-card {
    margin: auto 0 0; max-width: none; max-height: 94dvh; overflow: auto;
    padding: 30px 16px calc(16px + env(safe-area-inset-bottom)); border-width: 2px 0 0;
    border-radius: 22px 22px 0 0; box-shadow: none; gap: 10px;
  }
  .share-card::before { content: ''; position: absolute; top: 9px; left: 50%; width: 44px; height: 5px; margin-left: -22px; border-radius: 3px; background: var(--line); }
  .share-title { position: static; align-self: flex-start; padding: 0; background: none; border: 0; font-size: 16px; }
  .share-close { top: 14px; right: 12px; width: 32px; height: 32px; }
  .share-text { font-size: 12.5px; }
}
