/* ==========================================================================
   IG／Threads 影片工具（template-tool.php，_ch_tool = instagram-video / threads-video）
   沿用 style.css 的 .tool-ui、.tool-out、.form-grid、.field、.pills、.btn、.notice、.badge
   ========================================================================== */

.sv { display: grid; gap: clamp(20px, 3vw, 32px); }
.sv h2, .sv p, .sv li, .sv dd, .sv-status { word-break: keep-all; overflow-wrap: anywhere; line-break: strict; }

/* 區塊標題 */
.sv-head { display: flex; gap: 16px; align-items: flex-start; margin-bottom: clamp(20px, 3vw, 32px); }
.sv-step {
	flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
	background: var(--ink); color: var(--on-ink); font-family: var(--f-display); font-weight: 600; font-size: 18px; letter-spacing: .04em; line-height: 1;
}
.sv-own .sv-step { background: var(--accent); }
.sv-head h2 { font-size: clamp(20px, 2.2vw, 26px); margin: 0 0 4px; line-height: 1.35; }
.sv-head p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.7; }
@media (max-width: 559px) {
	.sv-head { flex-direction: column; gap: 12px; }
	.sv-step { width: 36px; height: 36px; border-radius: 10px; font-size: 15px; }
}

/* 01 連結檢查 */
.sv-form { align-content: start; }
.sv-form .btn { width: 100%; }
@media (min-width: 560px) { .sv-form .btn { width: auto; } }
.sv-formats { margin: 0; font-size: 13px; line-height: 1.7; color: var(--muted); }

.sv-out { gap: 16px; min-height: 260px; }
.sv-out .tool-out__url { min-height: 0; padding: 12px 14px; font-size: 13px; }
.sv-out .tool-out__hint { margin: auto 0 0; font-size: 13px; }
.sv-out .btn-row { gap: 10px; }
.sv-out dl { grid-template-columns: auto 1fr; }
.sv-out dd { overflow-wrap: anywhere; }

.sv-status { position: relative; margin: 0; padding-left: 22px; font-size: 16px; line-height: 1.7; font-weight: 500; color: rgba(200, 212, 242, .84); }
.sv-status::before {
	content: ""; position: absolute; left: 0; top: .62em; width: 10px; height: 10px; border-radius: 50%;
	background: var(--on-dark-muted); box-shadow: 0 0 0 4px rgba(154, 160, 174, .18);
}
.sv-status[data-state="ok"] { color: #fff; }
.sv-status[data-state="ok"]::before { background: #3ddc84; box-shadow: 0 0 0 4px rgba(61, 220, 132, .2); }
.sv-status[data-state="err"] { color: #ffd2cc; }
.sv-status[data-state="err"]::before { background: #ff6b5a; box-shadow: 0 0 0 4px rgba(255, 107, 90, .2); }
.sv-status__link { display: inline-block; margin-top: 4px; color: var(--ice); font-weight: 700; border-bottom: 1px solid currentColor; }
.sv-status__link:hover { color: #fff; }

/* 官方嵌入預覽 */
.sv-embed {
	margin-top: clamp(20px, 3vw, 32px); padding: clamp(16px, 3vw, 28px); border: 1px dashed var(--line-strong); border-radius: var(--radius);
	background: var(--bg); display: grid; justify-items: center; gap: 14px;
}
.sv-embed blockquote { margin: 0 !important; width: 100%; max-width: 540px; min-width: 0 !important; }
.sv-embed blockquote > a { display: block; padding: 18px; border-radius: 12px; background: #fff; border: 1px solid var(--line); text-align: center; font-size: 15px; font-weight: 700; color: var(--accent-ink); }
.sv-embed iframe { max-width: 100% !important; }
.sv-embed__note { margin: 0; max-width: 540px; font-size: 14px; line-height: 1.7; color: var(--muted); text-align: center; }

/* 權利說明 */
.sv-rights {
	margin-top: clamp(20px, 3vw, 28px); padding: 16px 18px 16px 46px; position: relative; border-radius: var(--radius-sm);
	background: var(--accent-soft); border: 1px solid rgba(45, 78, 140, .28); font-size: 14px; line-height: 1.75; color: var(--ink-2);
}
.sv-rights::before {
	content: "!"; position: absolute; left: 16px; top: 17px; width: 20px; height: 20px; border-radius: 50%;
	display: grid; place-items: center; background: var(--steel); color: #fff; font-family: var(--f-display); font-weight: 700; font-size: 13px; line-height: 1;
}
.sv-rights p { margin: 0; }
.sv-rights p:first-child { font-weight: 700; color: var(--ink); }
.sv-rights__local { margin-top: 4px !important; color: var(--muted); }

/* 02 自己的影片 */
.sv-own .notice { margin-bottom: 20px; }
.sv-connect { display: grid; gap: 24px; }
.sv-facts { list-style: none; display: grid; gap: 10px; }
@media (min-width: 760px) { .sv-facts { grid-template-columns: 1fr 1fr; gap: 12px 28px; } }
.sv-facts li { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; line-height: 1.7; color: var(--ink-2); }
.sv-facts svg { flex: none; width: 20px; height: 20px; margin-top: 3px; padding: 3px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-ink); stroke-width: 2.4; }

.sv-account {
	display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; padding: 14px 16px 14px 20px;
	border: 1px solid var(--line); border-radius: var(--radius); background: var(--bg);
}
.sv-account__who { display: flex; align-items: center; gap: 8px; font-size: 15px; color: var(--ink-2); margin-right: auto; }
.sv-account__who::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: #1fae5b; box-shadow: 0 0 0 4px rgba(31, 174, 91, .16); }
.sv-account__who b { color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.sv-filter .pills span { padding: 7px 14px; font-size: 14px; }
.sv-account .btn-row { gap: 8px; }
.sv-account .btn svg { width: 16px; height: 16px; }
.sv-account .btn:hover svg { transform: rotate(-30deg); }

.sv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 210px), 1fr)); gap: 16px; margin-top: 20px; }
@media (max-width: 559px) { .sv-grid { grid-template-columns: 1fr 1fr; gap: 12px; } }
.sv-item { display: flex; flex-direction: column; min-width: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; overflow: hidden; }
.sv-item__media { position: relative; aspect-ratio: 4 / 5; background: linear-gradient(135deg, #e9e9e2, #d9dae0); overflow: hidden; }
.sv-item__media img { width: 100%; height: 100%; object-fit: cover; }
.sv-item__play {
	position: absolute; left: 50%; top: 50%; translate: -50% -50%; width: 46px; height: 46px; border-radius: 50%;
	display: grid; place-items: center; background: rgba(7, 8, 12, .55); color: #fff; -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px);
}
.sv-item__play svg { width: 20px; height: 20px; margin-left: 2px; }
.sv-item__type { position: absolute; left: 8px; top: 8px; padding: 2px 9px; border-radius: 999px; background: rgba(7, 8, 12, .7); color: #fff; font-size: 12px; font-weight: 700; letter-spacing: .04em; line-height: 1.7; }
.sv-item__body { padding: 12px 12px 0; display: grid; gap: 2px; }
.sv-item__date { font-family: var(--f-display); font-size: 13px; letter-spacing: .04em; color: var(--muted); }
.sv-item__text { margin: 0; font-size: 13px; line-height: 1.6; color: var(--ink-2); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sv-item__acts { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px; margin-top: auto; }
.sv-dl, .sv-item__link {
	display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: 999px;
	font-size: 13px; font-weight: 700; line-height: 1; white-space: nowrap; transition: background .2s, color .2s, border-color .2s;
}
.sv-dl { background: var(--ink); color: #fff; }
.sv-dl:hover { background: var(--accent); color: #fff; }
.sv-item__link { border: 1px solid var(--line-strong); color: var(--ink); }
.sv-item__link:hover { border-color: var(--ink); color: var(--ink); }
.sv-dl svg, .sv-item__link svg { width: 15px; height: 15px; flex: none; }
.sv-item__na { display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; border-radius: 999px; background: rgba(12, 13, 16, .06); color: var(--muted); font-size: 13px; cursor: help; }
@media (max-width: 559px) {
	.sv-item__body { padding: 10px 10px 0; }
	.sv-item__acts { padding: 10px; }
	.sv-dl, .sv-item__link { flex: 1 1 100%; justify-content: center; }
}
.sv-empty { grid-column: 1 / -1; margin: 0; padding: 28px 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); text-align: center; color: var(--muted); font-size: 15px; }
.sv-more { display: flex; justify-content: center; margin-top: 20px; }
.sv-save { margin: 18px 0 0; font-size: 13px; line-height: 1.75; color: var(--muted); }

/* 載入中 */
.sv.is-loading .sv-grid { opacity: .45; pointer-events: none; transition: opacity .2s; }
.sv.is-loading [data-sv="reload"] svg { animation: sv-spin 1s linear infinite; }
.sv.is-loading [data-sv="more"] { animation: sv-pulse 1s ease-in-out infinite; }
@keyframes sv-spin { to { transform: rotate(360deg); } }
@keyframes sv-pulse { 50% { opacity: .5; } }

/* 尚未開放 */
.sv-soon { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; padding: 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius); }
.sv-soon p { margin: 0; flex: 1 1 260px; font-size: 15px; line-height: 1.75; color: var(--ink-2); }

@media (prefers-reduced-motion: reduce) {
	.sv.is-loading [data-sv="reload"] svg, .sv.is-loading [data-sv="more"] { animation: none; }
}
