/**
 * share-template-dialog.css — 「X に投稿」の文面のテンプレートの編集画面
 * (share-template-dialog.js が作る DOM。docs/46)。
 *
 * 切り抜きランキング (clips.html) とショート (shorts.html) が link する。白地・濃い文字を
 * 明示する (ショートは黒い全画面なので、継承に任せると暗転する。qr-dialog.css と同じ理由)。
 * 押せる大きさは --tap (mobile.css。ショートは自前の :root に同じ定義がある)。
 */

/* padding を持たせないこと (背景クリックで閉じる判定がダイアログ自身の領域のため) */
.share-template-dialog {
    padding: 0;
    border: 0;
    border-radius: 8px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, .3);
    background: #fff;
    color: #333;
    width: min(560px, calc(100vw - 24px));
    max-height: calc(100dvh - 24px);
}

.share-template-dialog::backdrop { background: rgba(0, 0, 0, .5); }

.stpl-body { padding: 12px 16px 16px; font-size: 14px; }

.stpl-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 6px;
}

.stpl-title { font-size: 16px; font-weight: bold; }

.stpl-close {
    flex: none;
    box-sizing: border-box;
    width: var(--tap, 44px);
    height: var(--tap, 44px);
    margin: -6px -12px -6px 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: #666;
    background: none;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
}

.stpl-close svg { width: 22px; height: 22px; display: block; }

.stpl-note { margin: 0 0 8px; color: #666; font-size: 12px; line-height: 1.5; }

/* iOS は 16px 未満の入力欄に触ると画面を拡大するので 16px */
.stpl-text {
    display: block;
    box-sizing: border-box;
    width: 100%;
    font: inherit;
    font-size: 16px;
    line-height: 1.4;
    padding: 6px 8px;
    border: 1px solid #bbb;
    border-radius: 6px;
    resize: vertical;
    color: #333;
    background: #fff;
}

.stpl-chips { display: flex; flex-wrap: wrap; gap: 4px; margin: 8px 0 10px; }

.stpl-chip {
    min-height: 32px;
    padding: 2px 8px;
    font: inherit;
    font-size: 13px;
    color: #06c;
    background: #f3f7fc;
    border: 1px solid #c8d8ec;
    border-radius: 999px;
    cursor: pointer;
}

.stpl-preview-head { font-size: 12px; color: #666; display: flex; justify-content: space-between; }

.stpl-count.over { color: #c00; font-weight: bold; }

.stpl-preview {
    margin: 4px 0 10px;
    padding: 8px;
    max-height: 30vh;
    overflow: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    font: inherit;
    font-size: 13px;
    background: #f6f6f6;
    border-radius: 6px;
}

.stpl-actions { display: flex; align-items: center; gap: 8px; }

.stpl-spacer { flex: 1; }

.stpl-actions button {
    min-height: var(--tap, 44px);
    padding: 0 14px;
    font: inherit;
    font-size: 14px;
    border: 1px solid #bbb;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
}

.stpl-actions .stpl-save { background: #333; border-color: #333; color: #fff; }

.stpl-error { margin: 8px 0 0; color: #c00; font-size: 12px; }

/* 切り抜きランキングの知らせ (clip-share.js の showShareToast) */
.share-toast {
    position: fixed;
    left: 50%;
    bottom: calc(24px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 100;
    max-width: calc(100vw - 32px);
    padding: 8px 16px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .8);
    color: #fff;
    font-size: 14px;
    overflow-wrap: anywhere;
}
