/* Tool panel: input bar, status, errors and result "clips". */
.tool { position: relative; min-width: 0; padding: 28px clamp(16px, 4vw, 30px) clamp(18px, 4vw, 28px); border: 1px solid var(--line); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); }
.tool::before { position: absolute; inset-block-start: -1px; inset-inline-start: 50%; width: 72px; height: 10px; border-radius: 0 0 10px 10px; background: var(--aqua); content: ""; transform: translateX(-50%); }
.tool-label { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; font-size: 1rem; font-weight: 800; }
.tool-label .i { color: var(--brand-deep); }
.tool-note { margin: 0 0 12px; color: var(--muted); font-size: 0.92rem; }

.getbar { display: grid; gap: 10px; }
.field { display: flex; min-width: 0; align-items: center; gap: 4px; padding: 4px; border: 2px solid var(--muted); border-radius: 999px; background: var(--bg); }
.field:focus-within { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(71, 54, 245, 0.2); }
.field:has([aria-invalid="true"]) { border-color: var(--danger); }
.field-icon { margin-inline-start: 12px; color: var(--muted); }
.field input { min-width: 0; flex: 1; min-height: 48px; padding: 8px 6px; border: 0; background: transparent; color: var(--ink); text-align: left; direction: ltr; }
.field input:focus-visible { outline: none; }
.field input::placeholder { color: var(--muted); opacity: 0.85; }
.field-btn { display: inline-flex; min-height: 44px; align-items: center; gap: 6px; padding: 6px 14px; border: 0; border-radius: 999px; background: var(--surface-2); color: var(--ink); cursor: pointer; font-size: 0.9rem; font-weight: 750; }
.field-btn:hover { background: var(--line); }
.field-btn[hidden] { display: none; }
.field-btn.is-icon { width: 44px; padding: 0; justify-content: center; background: transparent; }
.submit-button { width: 100%; min-height: 56px; font-size: 1.05rem; }
.rights-note { margin: 14px 0 0; color: var(--muted); font-size: 0.82rem; line-height: 1.5; }

.tool-status { min-height: 1.7em; margin: 14px 0 0; color: var(--muted); font-size: 0.92rem; }
.tool-status[aria-busy="true"]::before { display: inline-block; width: 0.8em; height: 0.8em; margin-inline-end: 8px; border: 2px solid var(--line); border-top-color: var(--brand); border-radius: 50%; content: ""; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(1turn); } }
.alert { padding: 12px 14px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); }

.tool-error { margin-top: 16px; padding: 18px; border: 1px solid var(--danger); border-radius: 18px; background: var(--danger-soft); }
.tool-error[hidden] { display: none; }
.tool-error:focus-visible { outline-color: var(--danger); }
.tool-error h3 { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; color: var(--danger); }
.tool-error p { margin-bottom: 10px; }
.tool-error ol { margin: 0 0 14px; padding-inline-start: 22px; }
.tool-error li + li { margin-top: 4px; }
.error-actions { display: flex; flex-wrap: wrap; gap: 10px; }

.result { margin-top: 20px; padding-top: 22px; border-top: 2px dashed var(--line); }
.result[hidden] { display: none; }
.result:focus-visible { outline-offset: 6px; }
.result-heading { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 8px; margin-bottom: 16px; }
.result-heading h2 { margin: 0; font-size: clamp(1.3rem, 4vw, 1.7rem); }
.result-heading .eyebrow { margin-bottom: 4px; }
.source-chip { display: inline-flex; max-width: 100%; align-items: center; gap: 6px; padding: 4px 12px; border-radius: 999px; background: var(--aqua-soft); color: var(--aqua); font-size: 0.86rem; font-weight: 750; }
.caption-details { margin: 0 0 14px; color: var(--muted); font-size: 0.92rem; }
.caption-details summary { min-height: 44px; display: flex; align-items: center; cursor: pointer; color: var(--brand-deep); font-weight: 700; }
.caption-details p { margin: 0; white-space: pre-wrap; }

.media-list, .picker { display: grid; gap: 16px; margin: 0; padding: 0; list-style: none; }
.clip { display: grid; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 22px; background: var(--bg); }
.clip-poster { position: relative; display: grid; width: min(220px, 100%); aspect-ratio: 9 / 16; margin-inline: auto; overflow: hidden; place-items: center; border-radius: 18px; background: linear-gradient(160deg, var(--hero-a), var(--hero-b)); color: #dcd9ff; text-align: center; font-size: 0.85rem; }
.clip-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.badge { position: absolute; inset-block-end: 8px; inset-inline-end: 8px; padding: 2px 9px; border-radius: 999px; background: rgba(10, 12, 29, 0.82); color: #fff; font-size: 0.8rem; font-weight: 750; }
.clip-body { min-width: 0; align-self: center; }
.clip-body h3 { margin-bottom: 8px; }
.media-meta { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 14px; padding: 0; list-style: none; }
.media-meta li { padding: 2px 11px; border-radius: 999px; background: var(--surface-2); color: var(--muted); font-size: 0.84rem; font-weight: 650; }
.save-button { width: 100%; min-height: 56px; font-size: 1.05rem; }
.save-progress { display: block; width: 100%; height: 10px; margin-top: 12px; appearance: none; border: 0; border-radius: 99px; overflow: hidden; background: var(--surface-2); accent-color: var(--brand); }
.save-progress[hidden] { display: none; }
.save-progress::-webkit-progress-bar { background: var(--surface-2); }
.save-progress::-webkit-progress-value { background: var(--brand); }
.save-progress::-moz-progress-bar { background: var(--brand); }
.save-status { min-height: 1.5em; margin-top: 10px; color: var(--muted); font-size: 0.92rem; }
.save-status.is-error { color: var(--danger); font-weight: 650; }
.fallback { margin-top: 12px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 16px; background: var(--surface); font-size: 0.92rem; }
.fallback h4 { margin: 0 0 6px; font-size: 1rem; }
.fallback ol { margin: 8px 0 12px; padding-inline-start: 22px; color: var(--muted); }
.fallback[hidden] { display: none; }

.picker-lead { margin: 0 0 14px; color: var(--muted); }
.picker { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.picker-card { display: block; width: 100%; padding: 8px; border: 2px solid var(--line); border-radius: 18px; background: var(--bg); color: var(--ink); cursor: pointer; text-align: start; }
.picker-card:hover { border-color: var(--brand); }
.picker-card .clip-poster { width: 100%; margin-bottom: 8px; }
.picker-card strong { display: block; padding-inline: 4px; font-size: 0.92rem; }
.picker-card span.pick { display: flex; min-height: 44px; align-items: center; gap: 6px; padding-inline: 4px; color: var(--brand-deep); font-weight: 750; font-size: 0.9rem; }
.back-link { display: inline-flex; margin-bottom: 14px; }

.dp-card { display: grid; grid-template-columns: 72px 1fr; gap: 14px; align-items: center; margin-top: 16px; padding: 14px; border: 1px solid var(--line); border-radius: 20px; background: var(--bg); }
.dp-card[hidden] { display: none; }
.dp-card img { width: 72px; height: 72px; border-radius: 50%; object-fit: cover; background: var(--surface-2); }
.dp-placeholder { display: grid; width: 72px; height: 72px; place-items: center; border-radius: 50%; background: var(--surface-2); color: var(--brand-deep); }
.clip-title { margin: 0 0 10px; color: var(--muted); font-size: 0.92rem; }
.button[aria-disabled="true"] { opacity: 0.6; pointer-events: none; }
.dp-card h3 { margin-bottom: 2px; font-size: 1rem; }
.dp-card p { margin: 0 0 8px; color: var(--muted); font-size: 0.86rem; }
.dp-card .button { min-height: 44px; font-size: 0.92rem; }
.result-again { margin-top: 18px; width: 100%; }

@media (min-width: 720px) {
  .getbar { grid-template-columns: 1fr auto; align-items: stretch; }
  .submit-button { width: auto; min-width: 190px; min-height: 64px; }
  .field { padding: 6px; }
  .field input { min-height: 50px; font-size: 1.05rem; }
  .clip { grid-template-columns: 200px 1fr; padding: 20px; }
  .clip-poster { width: 200px; margin: 0; }
  .picker { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .result-again { width: auto; }
  .save-button { width: auto; min-width: 240px; }
}
