@import url("https://fonts.googleapis.com/css2?family=Instrument+Sans:wght@400;500;600&family=Geist+Mono:wght@500&display=swap");

.kp-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.kp-eyebrow { font: 600 11px/14px var(--font-sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-muted); }
:where(.kp-btn, .kp-chip, .kp-product, .kp-credit-add, .kp-composer-text):focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

/* Button */
.kp-btn { display: inline-flex; align-items: center; gap: var(--space-3); border: 1px solid transparent; border-radius: var(--radius-full); font: 500 13px/18px var(--font-sans); cursor: pointer; white-space: nowrap; transition: background-color .16s ease-out, border-color .16s ease-out, filter .16s ease-out; }
.kp-btn-sm { padding: 7px 14px; }
.kp-btn-md { padding: 10px 20px; }
.kp-btn-lg { padding: 14px 26px; font-size: 15px; line-height: 20px; }
.kp-btn-block { width: 100%; justify-content: center; }
.kp-btn-primary { background: var(--violet); color: var(--on-violet); }
.kp-btn-primary:hover { filter: brightness(1.18); }
.kp-btn-secondary { background: transparent; color: var(--text); border-color: var(--line-strong); }
.kp-btn-secondary:hover { background: var(--surface-2); }
.kp-btn-ghost { background: transparent; color: var(--text-muted); padding-inline: 10px; }
.kp-btn-ghost:hover { color: var(--text); }
.kp-btn:disabled { opacity: .4; cursor: not-allowed; filter: none; }
.kp-btn-cost { font: 500 11px/16px var(--font-mono); letter-spacing: .02em; text-transform: uppercase; opacity: .7; }

/* Chip */
.kp-chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.kp-chip { display: inline-flex; align-items: center; gap: var(--space-2); padding: 6px 12px; border: 1px solid var(--line); border-radius: var(--radius-full); background: var(--surface-2); color: var(--text-muted); font: 500 12px/16px var(--font-mono); cursor: pointer; transition: color .16s ease-out, border-color .16s ease-out; }
.kp-chip:hover { color: var(--text); border-color: var(--line-strong); }
.kp-chip.is-on { background: var(--violet-wash); border-color: var(--violet-text); color: var(--violet-text); }
.kp-chip:disabled { opacity: .4; cursor: not-allowed; }
.kp-chip-meta { opacity: .7; }

/* Composer */
.kp-composer { display: grid; gap: var(--space-4); max-width: 760px; padding: var(--space-4) var(--space-4) var(--space-4) var(--space-6); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: var(--shadow-float); }
.kp-composer-product { padding-top: var(--space-2); }
.kp-composer-text { width: 100%; box-sizing: border-box; resize: none; padding: var(--space-2) 0 0; border: 0; background: transparent; color: var(--text); font: 400 16px/24px var(--font-sans); outline: none; }
.kp-composer-text::placeholder { color: var(--text-muted); }
.kp-composer-bar { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; justify-content: space-between; }
.kp-composer-opts { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.kp-composer-div { width: 1px; height: 20px; background: var(--line); }

/* StatusBadge */
.kp-badge { display: inline-flex; align-items: center; gap: 6px; font: 500 11px/16px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: var(--text-muted); }
.kp-badge i { width: 6px; height: 6px; border-radius: var(--radius-full); background: currentColor; }
.kp-badge-processing { color: var(--violet-text); }
.kp-badge-processing i { animation: kp-pulse 1.4s ease-in-out infinite; }
.kp-badge-done { color: var(--status-done); }
.kp-badge-failed { color: var(--status-failed); }
@keyframes kp-pulse { 50% { opacity: .3; } }

/* ProductCard */
.kp-product { display: flex; gap: var(--space-3); align-items: center; width: 100%; max-width: 340px; padding: var(--space-3); text-align: left; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); color: var(--text); font: inherit; }
button.kp-product { cursor: pointer; transition: border-color .16s ease-out; }
button.kp-product:hover { border-color: var(--line-strong); }
.kp-product.is-selected { border-color: var(--violet-text); }
.kp-product-compact { padding: 6px 14px 6px 6px; border-radius: var(--radius-full); background: var(--surface-2); width: auto; max-width: 100%; }
.kp-product-img { flex: none; width: 48px; height: 48px; border-radius: var(--radius-sm); overflow: hidden; background: linear-gradient(140deg, #2e1b52, #121214); }
.kp-product-compact .kp-product-img { width: 32px; height: 32px; border-radius: var(--radius-full); }
.kp-product-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.kp-product-body { display: grid; gap: 2px; min-width: 0; }
.kp-product-name { font: 500 13px/18px var(--font-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp-product-meta { display: flex; flex-wrap: wrap; gap: 10px; font: 500 11px/16px var(--font-mono); color: var(--text-muted); }
.kp-product-comm { color: var(--violet-text); }

/* VideoCard */
.kp-video { margin: 0; display: grid; gap: 10px; min-width: 0; }
.kp-video-frame { position: relative; max-width: 100%; border-radius: var(--radius-md); overflow: hidden; background: var(--media); color: #f2f1ec; }
.kp-video-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.kp-tone-violet { background: radial-gradient(80% 60% at 50% 38%, #5a1fb8 0%, #1d0f33 55%, #050506 100%); }
.kp-tone-rose { background: radial-gradient(70% 55% at 45% 45%, #7a4a44 0%, #24161a 58%, #050506 100%); }
.kp-tone-slate { background: radial-gradient(75% 55% at 55% 40%, #48525c 0%, #171b20 58%, #050506 100%); }
.kp-tone-ivory { background: radial-gradient(70% 50% at 50% 42%, #b9b3a6 0%, #3a3833 55%, #050506 100%); }
.is-processing .kp-video-frame::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 35%, rgba(117,0,255,.18) 50%, transparent 65%) 0 0 / 300% 100%; animation: kp-sweep 2.2s linear infinite; }
@keyframes kp-sweep { to { background-position: -300% 0; } }
@media (prefers-reduced-motion: reduce) { .is-processing .kp-video-frame::after, .kp-badge-processing i { animation: none; } }
.kp-video-status { position: absolute; top: 10px; left: 12px; padding: 3px 8px; border-radius: var(--radius-full); background: rgba(5,5,6,.72); }
.kp-video-status .kp-badge-processing { color: #b48cff; }
.kp-video-status .kp-badge-failed { color: #ff8a70; }
.kp-video-time { position: absolute; right: 10px; bottom: 10px; padding: 2px 7px; border-radius: var(--radius-full); background: rgba(5,5,6,.72); font: 500 11px/16px var(--font-mono); color: #f2f1ec; }
.kp-video-progress { position: absolute; left: 12px; right: 12px; bottom: 12px; display: grid; gap: 6px; }
.kp-video-pct { font: 500 22px/24px var(--font-mono); letter-spacing: -.02em; color: #f2f1ec; }
.kp-video-track { height: 2px; border-radius: var(--radius-full); background: rgba(242,241,236,.18); overflow: hidden; }
.kp-video-track div { height: 100%; background: #b48cff; }
.kp-video-msg { position: absolute; left: 12px; right: 12px; bottom: 12px; margin: 0; font: 400 12px/17px var(--font-sans); color: #f2f1ec; }
.kp-video-actions { position: absolute; inset: auto 10px 10px; display: flex; gap: 6px; justify-content: flex-end; opacity: 0; transition: opacity .16s ease-out; }
.kp-video:hover .kp-video-actions, .kp-video:focus-within .kp-video-actions { opacity: 1; }
.is-failed .kp-video-actions { opacity: 1; justify-content: flex-start; }
.is-failed .kp-video-msg { position: absolute; bottom: 52px; }
.kp-video figcaption { display: grid; gap: 2px; min-width: 0; }
.kp-video-title { font: 500 13px/18px var(--font-sans); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kp-video-meta { font: 500 11px/16px var(--font-mono); color: var(--text-muted); }

/* CreditPill */
.kp-credit { display: inline-flex; align-items: center; gap: 6px; padding: 4px 4px 4px 14px; border: 1px solid var(--line); border-radius: var(--radius-full); background: var(--surface); }
.kp-credit::before { content: ""; width: 6px; height: 6px; border-radius: var(--radius-full); background: var(--violet); margin-right: 2px; }
.kp-credit.is-low::before { background: var(--status-failed); }
.kp-credit-num { font: 500 13px/18px var(--font-mono); color: var(--text); }
.kp-credit-unit { font: 500 12px/18px var(--font-sans); color: var(--text-muted); margin-right: 6px; }
.kp-credit-add { padding: 5px 12px; border: 0; border-radius: var(--radius-full); background: var(--surface-2); color: var(--text); font: 500 12px/16px var(--font-sans); cursor: pointer; }
.kp-credit-add:hover { background: var(--line); }

/* Voice and music results: a player on the poster instead of a picture */
.kp-video.is-audio .kp-video-frame { display: grid; place-items: center; }
.kp-video-kind { position: absolute; top: 10px; left: 12px; padding: 3px 8px; border-radius: var(--radius-full); background: rgba(5,5,6,.72); font: 500 11px/16px var(--font-mono); letter-spacing: .06em; text-transform: uppercase; color: #f2f1ec; }
.kp-video-audio { position: absolute; left: 10px; right: 10px; bottom: 10px; width: calc(100% - 20px); height: 36px; }
.is-audio .kp-video-actions { bottom: 54px; }
