@import "./fonts.css";
@import "./captions-en.css";
@import "./captions-zh.css";
@import "./captions-es.css";

html,
body,
#skill-root {
  margin: 0;
  min-height: 100%;
}
body {
  background: var(--background);
}
button,
input {
  font: inherit;
}
.cc-skill-layout {
  grid-template-columns: minmax(0, 1fr) minmax(330px, 390px);
}
.cc-skill-layout-preview {
  align-items: center;
}
.cc-skill-layout-fields {
  gap: 22px;
}
.caption-preview-panel {
  width: 100%;
  min-width: 0;
}
.caption-preview-heading {
  display: flex;
  justify-content: space-between;
  margin: 0 0 10px;
  gap: 10px;
  font-size: 13px;
  height: 20px;
  line-height: 20px;
  align-items: center;
}
.caption-preview-heading > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.caption-preview-heading > span + span {
  flex-shrink: 0;
  color: var(--text-tertiary);
  font-size: 12px;
}
.caption-player {
  width: 100%;
  margin: auto;
}
.caption-frame {
  aspect-ratio: var(--source-ratio);
}
.caption-frame > video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  position: absolute;
  inset: 0;
}
.caption-frame > .caption-render {
  position: absolute;
  inset: 0;
}
.caption-frame .cp-preview {
  aspect-ratio: auto !important;
  height: 100%;
  background: transparent !important;
  border-radius: 0;
}
.caption-render .cp-frame-size {
  display: none;
}
.caption-render .cp-animated {
  animation: var(--cp-animation) 4000ms var(--cp-timing, linear) infinite;
  animation-play-state: paused;
}
.caption-render.is-playing .cp-animated {
  animation-play-state: running;
}
.caption-preview-note {
  font-size: 12px;
  line-height: 1.6;
  color: var(--text-tertiary);
  margin: 12px 0 0;
}
.caption-field-label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 10px;
}
.caption-style-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.caption-style-card {
  border: 1px solid var(--divider);
  padding: 3px;
  background: transparent;
  color: var(--text-primary);
  border-radius: 9px;
  min-width: 0;
  overflow: hidden;
  text-align: left;
  cursor: pointer;
}
.caption-style-card:hover {
  border-color: var(--text-tertiary);
}
.caption-style-card:has(input:checked) {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 10%, transparent);
}
.caption-style-card:focus-visible,
.caption-gallery-button:focus-visible,
.caption-preview-tabs button:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.caption-render-compact {
  border-radius: 6px;
  overflow: hidden;
}
.caption-render-compact .cp-preview {
  aspect-ratio: 2.2/1 !important;
  background: #24282c !important;
}
.caption-render-compact .cp-preview .cp-content {
  inset: 12%;
  transform: scale(var(--cp-fit, 1));
}
.caption-card-label {
  display: flex;
  justify-content: space-between;
  gap: 5px;
  padding: 7px 4px 4px;
  font-size: 11px;
  line-height: 1.4;
}
.caption-card-label > span {
  color: var(--primary);
  font-weight: 600;
}
.caption-options {
  font-size: 12px;
  color: var(--text-secondary);
  border-top: 1px solid var(--divider);
  padding-top: 16px;
}
.caption-options summary {
  cursor: pointer;
}
.caption-option-fields {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}
.caption-error {
  color: var(--destructive, #bf3f35);
  font-size: 12px;
  line-height: 1.5;
}
@media (max-width: 760px) {
  .cc-skill-layout {
    display: flex;
    flex-direction: column;
    height: auto;
    min-height: 100dvh;
    padding: 18px 14px;
    gap: 20px;
  }
  .cc-skill-layout-panel {
    min-height: 0;
  }
  .caption-gallery-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (prefers-reduced-motion: reduce) {
  .caption-render.is-playing .cp-animated {
    animation: none;
  }
}

.caption-style-card {
  position: relative;
  display: block;
}
.caption-style-card > input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}
.caption-style-card:has(input:focus-visible) {
  outline: 2px solid var(--primary);
  outline-offset: 3px;
}
.caption-card-content,
.caption-frame > .caption-render {
  pointer-events: none;
}
.caption-field-label > span {
  font-size: 11px;
  font-weight: 400;
  color: var(--text-tertiary);
  margin-left: 6px;
}
.caption-speech .cp-animated {
  animation: var(--cp-animation) var(--speech-duration, 4000ms)
    var(--cp-timing, linear) 1 both;
  animation-play-state: paused;
}
.caption-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: white;
  background: #0005;
  font-size: 13px;
  padding: 20px;
}
.caption-loading button {
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}

/* Upload hover and drag feedback belongs to the action text only. */
#source.skill-file-grid[data-drag-active] {
  outline-color: transparent;
}
#source .skill-file-add:not(:disabled):hover {
  background: transparent;
  filter: none;
}
#source .skill-file-add > span {
  transition: color 150ms ease;
}
#source .skill-file-add:not(:disabled):hover > span,
#source[data-drag-active] .skill-file-add:not(:disabled) > span {
  color: var(--primary);
}

.caption-preview-heading,
.cc-skill-layout-example-label {
  display: none;
}
