/* Explicit opt-in: do not alter multi-material lists or image-mode uploaders. */
html body #task-panel .single-material-upload {
  --single-surface: #f7f9fc;
  --single-hover: #eef5ff;
  --single-line: #d8e2f2;
  --single-ink: #34435d;
  --single-muted: #77859d;
  --single-button: #fff;
  position: relative !important; display: block !important; box-sizing: border-box !important;
  width: 100% !important; height: 220px !important; min-height: 220px !important;
  padding: 20px !important; margin: 0 !important; overflow: visible !important;
  border: 1px dashed var(--single-line) !important; border-radius: 14px !important;
  background: var(--single-surface) !important; box-shadow: none !important;
  color: var(--single-ink) !important; cursor: pointer;
}
html[data-theme="dark"] body #task-panel .single-material-upload {
  --single-surface: #252a34; --single-hover: #29364b; --single-line: #424e62;
  --single-ink: #e2e7f0; --single-muted: #acb8cb; --single-button: #252d3b;
}
html body #task-panel .single-material-upload:hover { background: var(--single-hover) !important; border-color: #6a98ff !important; }
html body #task-panel .single-material-upload.is-dragging-file { background: var(--single-hover) !important; border-color: #2678ff !important; box-shadow: 0 0 0 2px rgba(38, 120, 255, .12) inset !important; }
html body #task-panel .single-material-upload .single-material-original { display: none !important; }
html body #task-panel .video-free-first-last:has(.single-material-upload) { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }
html body #task-panel .video-free-first-last[hidden] { display: none !important; }
html body #task-panel .video-free-first-last:has(.single-material-upload) > .video-free-frame-flow { display: none; }
html body #task-panel .single-material-upload .speech-training-source-actions { display: none; }
html body #task-panel .single-material-upload .speech-training-record-hint:not([hidden]) { position: absolute; top: 4px; left: 12px; right: 12px; margin: 0; font-size: 12px; font-weight: 400; color: var(--single-muted); }
html body #task-panel .single-material-heading { position: absolute; inset: 28px 20px auto; display: flex; flex-direction: column; align-items: center; gap: 12px; pointer-events: none; }
html body #task-panel .single-material-heading > img { width: 54px !important; height: 54px !important; object-fit: contain; background: none !important; }
html body #task-panel .single-material-heading > div { text-align: center; min-width: 0; }
html body #task-panel .single-material-title { display: block; color: var(--single-ink) !important; font-size: 16px !important; font-weight: 500 !important; line-height: 24px; }
html body #task-panel .single-material-note { display: block; margin-top: 8px; color: var(--single-muted) !important; font-size: 13px !important; font-weight: 400 !important; line-height: 20px; }
html body #task-panel .single-material-filled .single-material-heading { inset: 32px auto auto 22px; width: 43%; flex-direction: row; gap: 14px; }
html body #task-panel .single-material-filled .single-material-heading > div { text-align: left; }
html body #task-panel .single-material-upload .single-material-preview {
  --single-preview-width: 160px; --single-preview-ratio: 160 / 184;
  position: absolute !important; right: 30px; top: 18px;
  width: min(var(--single-preview-width), 43%); height: auto; aspect-ratio: var(--single-preview-ratio);
  transform-origin: top right; transform: scale(1); transition: transform 260ms ease;
  background: transparent !important; border: 0 !important; border-radius: 3px !important;
}
html body #task-panel .single-material-upload .single-material-preview[hidden] { display: none !important; }
html body #task-panel .single-material-upload .single-material-open {
  display: flex !important; flex-direction: column; align-items: center; justify-content: center;
  width: 100% !important; height: 100% !important; padding: 0 !important; margin: 0 !important;
  border: 0 !important; border-radius: 3px !important; background: transparent !important;
  box-shadow: none !important; color: var(--single-ink) !important; overflow: hidden; cursor: zoom-in;
}
html body #task-panel .single-material-open :is(img,video) { display: block !important; width: 100% !important; height: 100% !important; object-fit: contain !important; border-radius: 3px !important; background: transparent !important; }
html body #task-panel .single-material-upload .single-material-remove {
  position: absolute !important; right: -7px !important; top: -7px !important;
  width: 22px !important; height: 22px !important; min-width: 22px !important; padding: 0 !important;
  display: grid !important; place-items: center; border: 1px solid #fff !important; border-radius: 50% !important;
  font: 20px/1 sans-serif !important; background: #475569 !important; color: white !important;
  box-shadow: none !important; cursor: pointer;
}
html body #task-panel .single-material-upload .single-material-remove[hidden] { display: none !important; }
html body #task-panel .single-material-upload .single-material-remove:hover { background: #e84258 !important; }
html body #task-panel .single-material-actions { position: absolute; left: 20px; right: 20px; bottom: 16px; display: flex; justify-content: center; gap: 10px; opacity: 0; visibility: hidden; pointer-events: none; transition: opacity 120ms ease, visibility 0s linear 120ms; }
html body #task-panel .single-material-actions { align-items: center !important; display: grid !important; grid-template-columns: repeat(3, minmax(0, 1fr)); }
html body #task-panel .single-material-actions > button {
  display: inline-flex !important; align-items: center !important; justify-content: center !important; gap: 7px !important;
  box-sizing: border-box !important; min-width: 0 !important; width: auto !important; height: 40px !important; min-height: 40px !important; margin: 0 !important; padding: 0 7px !important;
  border: 1px solid var(--single-line) !important; border-radius: 10px !important; background: var(--single-button) !important;
  color: var(--single-ink) !important; font-size: 14px !important; font-weight: 500 !important; box-shadow: none !important; cursor: pointer;
}
html body #task-panel .single-material-actions > button :is(span,svg) { color: inherit !important; }
html body #task-panel .single-material-actions > button svg { width: 16px; height: 16px; }
html body #task-panel .single-material-actions > .single-material-extra-action { position: absolute; bottom: 50px; left: 0; }
.single-library-audio { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 110px; gap: 10px; }
.single-library-audio svg { width: 36px; height: 36px; }
/* Source selectors opened inside the voice-training modal must sit above it. */
#product-library-picker[data-upload-mode="single-material"], #free-generate-phone-upload-dialog { z-index: 1950 !important; }
#product-library-picker [data-library-select-card] video { display: block; width: 100%; height: 140px; object-fit: contain; }
html body #task-panel .single-material-actions > button:is(:hover,:focus-visible) { background: #2678ff !important; border-color: #2678ff !important; color: white !important; }
html body #task-panel .single-material-upload:not(.single-material-pending):not(.single-material-rest):is(:hover,:focus-visible,:has(:focus-visible)) .single-material-actions { opacity: 1; visibility: visible; pointer-events: auto; transition: opacity 140ms ease 180ms, visibility 0s linear 180ms; }
html body #task-panel .single-material-upload:not(.single-material-filled):is(:hover,:focus-visible,:has(:focus-visible)) .single-material-actions { transition-delay: 0s; }
html body #task-panel .single-material-upload:not(.single-material-filled):is(:hover,:focus-visible,:has(:focus-visible)) .single-material-note { visibility: hidden; }
html body #task-panel .single-material-filled:not(.single-material-pending):not(.single-material-rest):is(:hover,:focus-visible,:has(:focus-visible)) .single-material-preview { transform: scale(.62); }
html body #task-panel .single-material-loading { display: none; }
html body #task-panel .single-material-pending .single-material-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 8px; background: #17203355; color: white; border-radius: 3px; pointer-events: none; }
html body #task-panel .single-material-loading > span { width: 26px; height: 26px; border: 2px solid #ffffff70; border-top-color: white; border-radius: 50%; animation: single-material-spin .8s linear infinite; }
html body #task-panel .single-material-loading > small { font-size: 12px !important; font-weight: 400 !important; color: white !important; }
html body #task-panel .single-material-audio-symbol { width: 72px; height: 72px; color: #5687ed; flex-shrink: 0; }
html body #task-panel .single-material-audio-name { display: block; width: 100%; padding: 0 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px !important; font-weight: 400 !important; }
html body #task-panel .single-material-open > small { font-size: 12px !important; font-weight: 400 !important; color: var(--single-muted); margin-top: 4px; }
html body #task-panel .single-material-filled:not(.single-material-pending):not(.single-material-rest):is(:hover,:focus-visible,:has(:focus-visible)) .single-material-remove { transform: scale(1.6129); }
html body #task-panel .single-material-upload :focus-visible { outline: 2px solid #5188ef !important; outline-offset: 3px; }
.single-material-viewer { position: fixed; inset: 0; width: 100vw; max-width: none; height: 100vh; max-height: none; padding: 50px; border: 0; background: transparent; color: white; }
.single-material-viewer[open] { display: flex; align-items: center; justify-content: center; }
.single-material-viewer::backdrop { background: #000b; }
.single-material-viewer > div { position: relative; max-width: 90vw; max-height: 85vh; }
.single-material-viewer :is(img,video) { display: block; max-width: 90vw; max-height: 85vh; object-fit: contain; }
.single-material-viewer audio { width: min(500px,80vw); }
.single-material-viewer button { position: absolute; right: -32px; top: -32px; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: #334155; color: white; font: 28px/1 sans-serif; cursor: pointer; }
@keyframes single-material-spin { to { transform: rotate(360deg); } }
@media (hover: none), (pointer: coarse) {
  html body #task-panel .single-material-upload:not(.single-material-pending) .single-material-actions { opacity: 1; visibility: visible; pointer-events: auto; }
  html body #task-panel .single-material-filled:not(.single-material-pending) .single-material-preview { transform: scale(.62); }
  html body #task-panel .single-material-upload:not(.single-material-filled) .single-material-note { visibility: hidden; }
}
@media (prefers-reduced-motion: reduce) {
  html body #task-panel .single-material-upload :is(.single-material-actions,.single-material-preview) { transition: none !important; }
  html body #task-panel .single-material-loading > span { animation: none; }
}
