#sourceFileConversionBtn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; font: inherit; cursor: pointer; }
#sourceFileConversionBtn img { object-fit: contain; }
.source-file-overlay {
  --sf-card: #20232b; --sf-border: #ffffff0a; --sf-text: #f5f6fa;
  --sf-body: #e6e8ef; --sf-muted: #969ba9; --sf-hover: #252932;
  position: fixed; inset: 0; z-index: 11000; display: flex; align-items: safe center; justify-content: center;
  padding: 48px 40px; overflow-y: auto; background: #080b11e8; backdrop-filter: blur(12px);
  color: var(--sf-text); animation: source-file-fade .2s ease both; font-family: inherit;
}
.source-file-overlay[data-theme="light"] {
  --sf-card: #fff; --sf-border: #2533510d; --sf-text: #252a35;
  --sf-body: #424b5d; --sf-muted: #7a8292; --sf-hover: #fff;
  background: #eef1f8ed;
}
.source-file-dialog {
  width: min(1400px, 100%); min-width: 0; padding: 20px 12px 24px;
  animation: source-file-enter .22s cubic-bezier(.2,.7,.2,1) both;
}
.source-file-header { display: flex; align-items: center; gap: 12px; margin-bottom: 82px; }
.source-file-heading-icon { display: flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  flex-shrink: 0; border: 1px solid #8b97f326; border-radius: 12px; background: #8895f312; color: #939ffd; }
.source-file-heading-icon img { object-fit: contain; }
[data-theme="light"] .source-file-heading-icon { color: #6372df; }
.source-file-heading { flex: 1; min-width: 0; }
.source-file-heading h2 { margin: 0; font-size: 18px; line-height: 1.5; font-weight: 650; letter-spacing: .02em; }
.source-file-heading p { margin: 3px 0 0; color: var(--sf-muted); font-size: 12px; line-height: 1.6; }
.source-file-close { display: flex; align-items: center; justify-content: center; flex-shrink: 0; width: 34px; height: 34px;
  border: 0; border-radius: 10px; background: #ffffff08; color: var(--sf-muted); cursor: pointer; transition: background .18s, color .18s; }
.source-file-close:hover { background: var(--sf-hover); color: var(--sf-text); }
.source-file-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
/* Entrance and hover transforms live on separate layers so fast pointer moves stay smooth. */
.source-file-choice-entry { position: relative; min-width: 0;
  animation: source-file-card-enter .4s cubic-bezier(.2,.75,.25,1) both;
  animation-delay: calc(var(--sf-order) * .18s); }
.source-file-choice-entry:has(.source-file-choice:is(:hover,:focus-visible):not(:disabled)) { z-index: 2; }
.source-file-choice {
  --sf-accent: #31a8ff;
  position: relative; display: flex; flex-direction: column; width: 100%; min-width: 0; min-height: 286px;
  padding: 29px 24px 22px; border: 1px solid var(--sf-border); border-radius: 23px;
  text-align: left; font: inherit; color: inherit; background: var(--sf-card); cursor: pointer;
  transform-origin: center bottom;
  transition: transform .38s cubic-bezier(.2,.75,.2,1), background .3s ease, box-shadow .38s ease;
}
.source-file-cdr { --sf-accent: #33d776; }
.source-file-svg { --sf-accent: #df4281; }
.source-file-ai { --sf-accent: #ff9a00; }
[data-theme="light"] .source-file-psd { --sf-accent: #087fcd; }
[data-theme="light"] .source-file-cdr { --sf-accent: #159749; }
[data-theme="light"] .source-file-svg { --sf-accent: #cb3270; }
[data-theme="light"] .source-file-ai { --sf-accent: #bf7100; }
.source-file-choice:is(:hover,:focus-visible):not(:disabled) {
  transform: translateY(-4px) scale(1.045); background: var(--sf-hover); box-shadow: 0 20px 48px #0003;
}
[data-theme="light"] .source-file-choice { box-shadow: 0 8px 32px #20334a08; }
[data-theme="light"] .source-file-choice:is(:hover,:focus-visible):not(:disabled) { box-shadow: 0 20px 48px #20334a1a; }
.source-file-choice:disabled { cursor: not-allowed; }
.source-file-choice:disabled .source-file-icon { opacity: .5; }
.source-file-choice-heading { position: relative; padding-right: 47px; }
.source-file-choice h3 { margin: 0; font-size: clamp(22px, 2.05vw, 30px); line-height: 1.3; font-weight: 750; letter-spacing: -.04em;
  white-space: nowrap; transition: color .3s ease; }
.source-file-heading-rule { display: block; width: 25px; height: 3px; margin-top: 9px; border-radius: 1px; background: currentColor; }
.source-file-choice h3:has(.source-file-version) { position: relative; width: max-content; padding-right: 37px; }
.source-file-version { position: absolute; top: -6px; right: 0; display: inline-flex; align-items: center; justify-content: center;
  height: 19px; padding: 0 5px; border: 1px solid #ffb45445; border-radius: 6px;
  background: linear-gradient(135deg, #ffb45420, #ff9a000c); color: #ffc477;
  font-family: Inter, "Segoe UI", sans-serif; font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: .02em; }
[data-theme="light"] .source-file-version { border-color: #d8903038; background: linear-gradient(135deg, #fff0d6, #fff8ec); color: #a65e00; }
.source-file-icon { position: absolute; top: 28px; right: 24px; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; pointer-events: none; transform-origin: center;
  transition: transform .46s cubic-bezier(.2,.75,.2,1), filter .35s ease; }
.source-file-icon img { display: block; width: 100%; height: 100%; object-fit: contain; user-select: none; }
.source-file-choice:is(:hover,:focus-visible):not(:disabled) .source-file-icon {
  transform: translate(-7px, -36px) rotate(12deg) scale(2.65); filter: drop-shadow(0 8px 10px #0002);
}
.source-file-choice:is(:hover,:focus-visible):not(:disabled) h3 { color: var(--sf-accent); }
.source-file-description { margin: 15px 0 0; color: var(--sf-body); font-size: 14px; font-weight: 600; line-height: 1.65; min-height: 47px; text-wrap: balance; }
.source-file-hint { margin: 5px 0 0; font-size: 11px; line-height: 1.8; color: var(--sf-muted); }
.source-file-action { position: relative; display: flex; align-items: center; gap: 6px; min-height: 59px;
  padding: 22px 39px 0 0; margin-top: auto; font-size: 11px; line-height: 1.6; font-weight: 600; }
.source-file-action-label { display: block; transform-origin: left center; transition: transform .38s cubic-bezier(.2,.75,.2,1); }
.source-file-action-arrow { position: absolute; bottom: 0; right: 0; color: #a4a7ad; transform-origin: right bottom;
  transition: transform .38s cubic-bezier(.2,.75,.2,1), color .3s ease; }
.source-file-choice:is(:hover,:focus-visible):not(:disabled) .source-file-action-label { transform: scale(1.4); }
.source-file-choice:is(:hover,:focus-visible):not(:disabled) .source-file-action-arrow { transform: scale(2.1); color: var(--sf-text); }
.source-file-action.is-unavailable { min-height: 66px; margin-top: 20px; padding: 10px 12px; gap: 9px;
  border: 1px solid #f4bb5b30; border-radius: 11px; background: #f4bb5b0c; color: #f0ca8e; font-size: 13.5px; font-weight: 650; }
[data-theme="light"] .source-file-action.is-unavailable { background: #fff7e9; border-color: #dfae6245; color: #92601d; }
.source-file-action svg:not(.source-file-action-arrow) { flex-shrink: 0; }
.source-file-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 28px;
  color: var(--sf-muted); font-size: 11px; line-height: 1.8; }
.source-file-footer a { display: inline-flex; flex-shrink: 0; align-items: center; gap: 5px; color: var(--sf-body); text-decoration: none; }
.source-file-footer a:hover { color: var(--sf-text); }
.source-file-footer.has-download { position: sticky; bottom: 0; z-index: 3; padding: 15px 18px;
  border: 1px solid var(--sf-border); border-radius: 17px; background: #181c25f5;
  box-shadow: 0 8px 30px #0002; backdrop-filter: blur(12px); }
[data-theme="light"] .source-file-footer.has-download { background: #ffffffed; box-shadow: 0 8px 30px #20334a0d; }
.source-file-footer .source-file-download { justify-content: center; gap: 10px; min-width: 188px; min-height: 50px; padding: 12px 21px;
  border: 1px solid #a4afff80; border-radius: 12px; background: #6878f1; color: #fff;
  box-shadow: 0 5px 18px #4e60dc35; font-size: 15px; font-weight: 700; line-height: 1.5;
  transition: background .2s, box-shadow .2s; }
.source-file-footer .source-file-download:hover { background: #7c8aff; color: #fff; box-shadow: 0 6px 24px #6678f15c; }
.source-file-error { margin: 18px 0 0; padding: 10px 12px; border: 1px solid #ef444426; border-radius: 10px;
  background: #ef44440a; color: #e47474; font-size: 12px; line-height: 1.7; }
.source-file-dialog :is(button,a):focus-visible { outline: 2px solid #8b99f5; outline-offset: 5px; }
.source-file-overlay.is-closing { animation: source-file-fade-out .28s ease-in-out both; }
.source-file-overlay.is-closing .source-file-dialog { animation: source-file-exit .28s cubic-bezier(.4,0,.6,1) both; pointer-events: none; }
@keyframes source-file-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes source-file-enter { from { opacity: 0; transform: translateY(12px) scale(.985); } to { opacity: 1; transform: none; } }
@keyframes source-file-fade-out { from { opacity: var(--sf-exit-opacity, 1); } to { opacity: 0; } }
@keyframes source-file-exit {
  from { opacity: var(--sf-exit-opacity, 1); transform: var(--sf-exit-transform, none); }
  to { opacity: 0; transform: translateY(14px) scale(.97); }
}
@keyframes source-file-card-enter { from { opacity: 0; transform: translateY(24px) scale(.96); } to { opacity: 1; transform: none; } }
@media (max-width: 1250px) {
  .source-file-dialog { width: min(780px, 100%); }
  .source-file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 64px 24px; }
  .source-file-choice h3 { font-size: 28px; }
}
@media (max-width: 680px) {
  .source-file-overlay { padding: 24px 20px; }
  .source-file-dialog { padding: 8px 4px; }
  .source-file-header { margin-bottom: 66px; }
  .source-file-grid { grid-template-columns: 1fr; gap: 60px; }
  .source-file-choice { min-height: 255px; padding: 25px 22px 20px; }
  .source-file-choice h3 { font-size: 27px; }
  .source-file-description { min-height: 0; }
  .source-file-icon { right: 25px; }
  .source-file-footer { align-items: flex-start; font-size: 10px; }
  .source-file-footer.has-download { flex-direction: column; align-items: stretch; gap: 10px; padding: 13px; }
  .source-file-footer.has-download > span { text-align: center; }
  .source-file-footer .source-file-download { width: 100%; }
}
/* Keep this dialog's requested entrance, exit and hover effects in desktop WebViews
   that report prefers-reduced-motion. Other canvas motion preferences stay separate. */
