/* The fallback and the film occupy the same reserved slot. */
.usf-slot { position: relative; min-width: 0; min-height: 430px; }
.usf-slot > .preview-terminal { position: absolute; inset: 0 0 auto; max-height: 100%; overflow: auto; }

.usf {
    --g: #31e274;
    --g2: #89f7a9;
    --cyan: #79d9ff;
    --amber: #f2cc5d;
    --red: #ff4d6d;
    --ink: #f5f7f6;
    --mute: #9fb0a7;
    --line: rgba(121, 217, 255, .2);
    --mono: "JetBrains Mono", ui-monospace, monospace;
    --bounce: cubic-bezier(.2, 1.4, .4, 1);
    position: absolute;
    inset: 0;
    pointer-events: none;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    border: 1px solid rgba(80, 235, 139, .32);
    border-radius: 14px;
    background:
        radial-gradient(120% 80% at 0% 0%, rgba(49, 226, 116, .16), transparent 55%),
        radial-gradient(90% 70% at 100% 100%, rgba(49, 226, 116, .08), transparent 60%),
        linear-gradient(180deg, rgba(10, 26, 19, .96), rgba(4, 12, 9, .98));
    box-shadow: 0 30px 90px rgba(0, 0, 0, .5), inset 0 1px 0 rgba(255, 255, 255, .06);
    color: var(--ink);
    font: 600 13px/1.35 Inter, system-ui, sans-serif;
    font-variant-numeric: tabular-nums;
}

/* Window chrome */
.usf-top {
    display: flex;
    flex: none;
    align-items: center;
    gap: 10px;
    height: 38px;
    padding: 0 13px;
    border-bottom: 1px solid var(--line);
}
.usf-dots, .usf-live { display: flex; flex: none; align-items: center; gap: 5px; }
.usf-dots i, .usf-live i { width: 6px; height: 6px; border-radius: 50%; }
.usf-dots i:first-child { background: var(--red); }
.usf-dots i:nth-child(2) { background: var(--amber); }
.usf-dots i:last-child, .usf-live i { background: var(--g); }
.usf-file {
    min-width: 0;
    font: 700 12px/1 var(--mono);
    white-space: nowrap;
    overflow: hidden;
}
.usf-upload { flex: 1; min-width: 14px; height: 3px; border-radius: 4px; background: #ffffff14; }
.usf-upload i, .usf-step > i {
    display: block;
    width: 100%;
    height: 100%;
    transform: scaleX(0);
    transform-origin: left;
    background: linear-gradient(90deg, var(--g), var(--cyan));
}
.usf-demo {
    padding: 2px 6px;
    border-radius: 5px;
    background: #f2cc5d29;
    color: var(--amber);
    font-size: 10px;
    letter-spacing: .06em;
}
.usf-live { color: var(--g2); font: 800 10px/1 var(--mono); letter-spacing: .05em; }
.usf-live i { box-shadow: 0 0 10px var(--g); animation: usf-pulse 1.1s ease-in-out infinite; }

.usf-steps {
    display: grid;
    flex: none;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 5px;
    padding: 5px 9px;
    height: 39px;
    border-top: 1px solid var(--line);
    background: #0004;
}
.usf-step {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 0;
    border-bottom: 2px solid #ffffff16;
    color: var(--mute);
    font-size: 11px;
    white-space: nowrap;
}
.usf-step span {
    flex: none;
    display: grid;
    place-items: center;
    width: 17px;
    height: 17px;
    border: 1px solid #ffffff36;
    border-radius: 50%;
    font: 800 10px/1 var(--mono);
}
.usf-step > i { position: absolute; bottom: -2px; height: 2px; }
.usf-step.is-active, .usf-step.is-done { color: var(--g2); }
.usf-step.is-active span { border-color: var(--g); background: var(--g); color: #04130b; }
.usf-step.is-done span { border-color: #31e27683; }
.usf-footer {
    flex: none;
    height: 36px;
    padding: 4px 10px;
    border-top: 1px solid #ffffff0e;
    color: var(--mute);
    font-size: 10px;
    text-align: center;
}
/* Map, drifting grid and diagonal transition */
.usf-stage { position: relative; flex: 1; min-height: 0; overflow: hidden; }
.usf-stage::before {
    content: "";
    position: absolute;
    inset: -24px;
    background:
        repeating-linear-gradient(0deg, #79d9ff0b 0 1px, transparent 1px 24px),
        repeating-linear-gradient(90deg, #79d9ff0b 0 1px, transparent 1px 24px);
    animation: usf-grid 8s linear infinite;
}
.usf-map, .usf-content { position: absolute; inset: 0; width: 100%; height: 100%; }
.usf-scene {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 10px;
    height: 100%;
    max-width: 455px;
    padding: 13px 16px;
    margin: 0 auto;
}
.usf-wipe {
    position: absolute;
    z-index: 3;
    inset: -10% auto -10% 0;
    width: 46%;
    opacity: 0;
    background: linear-gradient(90deg, transparent, #31e27422 65%, #a3ffe2a1);
    border-right: 2px solid #b8ffd0;
    box-shadow: 12px 0 34px -8px var(--g);
    animation: usf-wipe .34s cubic-bezier(.65, 0, .25, 1);
}
.usf-chase, .usf::after {
    position: absolute;
    z-index: 4;
    inset: 0;
    border-radius: inherit;
}
.usf-chase {
    overflow: hidden;
    padding: 1px;
    -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    -webkit-mask-composite: xor;
    mask-composite: exclude;
    display: none;
}
.usf.is-processing .usf-chase { display: block; }
.usf-chase::before {
    content: "";
    position: absolute;
    inset: -100%;
    background: conic-gradient(transparent 39%, var(--cyan), var(--g), transparent 64%);
    animation: usf-spin 1.4s linear infinite;
}
.usf::after { content: ""; opacity: 0; }
.usf.is-error { animation: usf-shake .25s steps(1); }
.usf.is-error::after { border: 2px solid var(--red); box-shadow: inset 0 0 24px #ff4d6d5e; animation: usf-status .65s ease-out; }
.usf.is-success::after { border: 2px solid var(--g); box-shadow: inset 0 0 35px #31e27564; animation: usf-status .55s ease-out; }

/* Shared scene elements */
.usf-between { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.usf-label {
    color: var(--mute);
    font: 750 10px/1.25 var(--mono);
    text-transform: uppercase;
}
.usf-note { color: var(--mute); font-size: 11px; }
.usf-pop { opacity: 0; }
.usf-pop.is-in { opacity: 1; animation: usf-pop .29s var(--bounce) both; }
.usf-chips { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.usf-chip, .usf-pro {
    display: inline-block;
    padding: 3px 7px;
    border: 1px solid var(--line);
    border-radius: 5px;
    background: #0b1a13e8;
    color: var(--cyan);
    font: 750 10px/1.2 var(--mono);
    white-space: nowrap;
}
.usf-beam {
    position: absolute;
    z-index: 2;
    inset: 0 0 1px;
    opacity: 0;
    background: linear-gradient(180deg, transparent 70%, #79d9ff40);
    border-bottom: 2px solid var(--cyan);
    filter: drop-shadow(0 0 5px var(--cyan));
}
.usf .is-scanning > .usf-beam { animation: usf-scan .84s ease-in-out both; }
.usf-logo { display: flex; padding: 4px; border-radius: 6px; background: #fff; }
.usf-logo img { width: 100%; height: 100%; object-fit: contain; }

/* Generate */
.usf-bank-reel { overflow: hidden; padding: 5px 0; }
.usf-bank-track { display: flex; width: 100%; }
.usf-bank-reel.is-rolling .usf-bank-track { animation: usf-bank-roll 1.08s cubic-bezier(.2, .78, .18, 1) both; }
.usf-bank-reel.is-landed .usf-bank-track { transform: translateX(-275%); }
.usf-reel-cell { flex: 0 0 25%; min-width: 0; padding: 0 3px; }
.usf-reel-cell .usf-logo { height: 42px; padding: 5px 7px; }
.usf-bank-reel.is-landed .usf-reel-cell:nth-child(12) .usf-logo {
    outline: 1px solid var(--g);
    box-shadow: 0 0 12px var(--g);
    animation: usf-lock .35s var(--bounce);
}
.usf-bank { color: var(--g2); }
.usf-equation { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 5px; }
.usf-column { display: grid; justify-items: stretch; gap: 3px; text-align: center; }
.usf-digit {
    --digit-height: 35px;
    overflow: hidden;
    height: var(--digit-height);
    border: 1px solid #79d9ff6b;
    border-radius: 5px;
    background: #0c1d1bea;
    color: var(--cyan);
    font: 800 20px/1 var(--mono);
}
.usf-digit-strip { transform: translateY(var(--usf-start)); }
.usf-digit-strip span { display: grid; place-items: center; height: calc(var(--digit-height) - 2px); }
.usf-column.is-spinning .usf-digit-strip { animation: usf-reel var(--usf-spin-time) cubic-bezier(.25, .65, .3, 1) both; }
.usf-column.is-locked .usf-digit-strip { transform: translateY(var(--usf-stop)); }
.usf-column.is-locked .usf-digit {
    color: var(--ink);
    text-shadow: 0 0 9px var(--cyan);
    animation: usf-lock .32s var(--bounce);
}
.usf-weight, .usf-product {
    position: relative;
    color: var(--cyan);
    font: 700 11px/1.2 var(--mono);
}
.usf-product { color: var(--g2); }
.usf-product-flight {
    position: absolute;
    z-index: 2;
    inset: 0;
    color: var(--g2);
    animation: usf-fly .38s ease-in both;
}
.usf-formula { color: var(--cyan); font: 700 13px/1.3 var(--mono); white-space: nowrap; }
.usf-formula b { color: var(--g2); }
.usf-badge, .usf-verdict {
    position: relative;
    flex: none;
    padding: 3px 7px;
    border-radius: 5px;
    background: var(--g);
    color: #04130b;
    font: 800 11px/1.2 var(--mono);
    white-space: nowrap;
}
.usf .is-bursting::before {
    content: "";
    position: absolute;
    inset: calc(50% - 17px) auto auto calc(50% - 17px);
    width: 34px;
    height: 34px;
    border: 2px solid var(--g2);
    border-radius: 50%;
    animation: usf-ring .53s ease-out both;
}
.usf .is-bursting i {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 3px;
    height: 3px;
    border-radius: 50%;
    background: var(--g2);
    box-shadow: 0 0 5px currentColor;
    animation: usf-fly .52s ease-out both;
}
.usf .is-bursting i:nth-child(even) { background: var(--cyan); }
.usf-account {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #07130edb;
}
.usf-account b { color: var(--cyan); font: 750 14px/1.2 var(--mono); white-space: nowrap; }
.usf-account-char { display: inline-block; text-align: center; width: .65em; }
.usf-account-char.is-locked { color: var(--ink); animation: usf-lock .23s var(--bounce); }

/* Batch and targeted outputs */
.usf-table { position: relative; display: grid; gap: 3px; overflow: hidden; }
.usf-row {
    display: grid;
    grid-template-columns: minmax(0, 9fr) minmax(0, 12fr) minmax(0, 8fr) 12px;
    align-items: center;
    gap: 6px;
    padding: 3px 6px;
    border: 1px solid #79d9ff26;
    border-radius: 5px;
    background: #081710b8;
    font: 650 12px/1.1 var(--mono);
    white-space: nowrap;
}
.usf-row.usf-label { border: 0; padding-block: 1px; background: transparent; color: var(--mute); font-size: 9px; }
.usf-row.usf-pop.is-in { animation-name: usf-row-in; }
.usf-row .usf-logo { height: 19px; max-width: 90px; padding: 2px 4px; border-radius: 3px; }
.usf-routing > span { color: var(--mute); }
.usf-tick, .usf-counter { color: var(--g2); }
.usf-counter { font: 800 12px/1 var(--mono); }
.usf-export-note { color: var(--mute); font-size: 10px; }

/* Validation and bank search */
.usf-field, .usf-result, .usf-dropdown {
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: #071610c8;
}
.usf-field {
    position: relative;
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    overflow: hidden;
    font: 800 20px/1 var(--mono);
}
.usf .is-typing::after { content: "▍"; color: var(--g2); animation: usf-pulse .45s steps(1) infinite; }
.usf-field.is-invalid { border-color: var(--red); }
.usf-field.is-valid { border-color: var(--g); box-shadow: 0 0 15px #31e2743d; }
.usf-field.is-invalid b { text-shadow: 2px 0 var(--red), -2px 0 var(--cyan); animation: usf-glitch .25s steps(1); }
.usf-validation-math { min-height: 24px; visibility: hidden; }
.usf-validation-math.is-in { visibility: visible; }
.usf-verdict:empty { visibility: hidden; }
.usf-validation-math.is-invalid .usf-verdict { background: var(--red); color: #190309; }
.usf-validation-math.is-invalid .usf-mod { color: var(--red); }
.usf-result { display: grid; gap: 5px; }
.usf-result .usf-logo, .usf-dropdown .usf-logo { width: 92px; height: 24px; }
.usf-magnifier { position: relative; width: 11px; height: 11px; border: 1px solid var(--amber); border-radius: 50%; }
.usf-magnifier::after { content: ""; position: absolute; top: 8px; left: 7px; width: 5px; height: 1px; background: var(--amber); transform: rotate(45deg); }
.usf-dropdown { display: flex; align-items: center; gap: 8px; }
.usf-dropdown.is-selected { border-color: var(--amber); box-shadow: 0 0 21px #f2cc5d40; }
.usf-selected { margin-left: auto; color: var(--amber); opacity: 0; }
.usf-dropdown.is-selected .usf-selected { opacity: 1; animation: usf-lock .35s var(--bounce); }
.usf-target .usf-routing, .usf-target .usf-routing > span { color: var(--amber); }
.usf-pro { border-color: #f2cc5d66; background: #201b09e8; color: var(--amber); }

@keyframes usf-pulse { 50% { transform: scale(.7); opacity: .48; } }
@keyframes usf-spin { to { transform: rotate(360deg); } }
@keyframes usf-grid { to { transform: translate(24px, 24px); } }
@keyframes usf-wipe {
    from { opacity: 1; transform: translateX(-116%) skewX(-13deg); }
    70% { opacity: .8; }
    to { opacity: 0; transform: translateX(245%) skewX(-13deg); }
}
@keyframes usf-pop { from { opacity: 0; transform: translateY(7px) scale(.92); } }
@keyframes usf-row-in { from { opacity: 0; transform: translateX(-13px); } }
@keyframes usf-lock { from { transform: scale(1.15); filter: brightness(1.65); } }
@keyframes usf-bank-roll {
    0% { transform: translateX(0); }
    14% { filter: blur(1.5px); }
    to { transform: translateX(-275%); }
}
@keyframes usf-reel {
    0% { transform: translateY(var(--usf-start)); }
    10%, 79% { filter: blur(1.5px); }
    to { transform: translateY(var(--usf-stop)); filter: none; }
}
@keyframes usf-fly { to { opacity: 0; transform: translate(var(--usf-x), var(--usf-y)) scale(.6); } }
@keyframes usf-ring { from { opacity: .9; transform: scale(.45); } to { opacity: 0; transform: scale(2.75); } }
@keyframes usf-scan {
    from { opacity: 0; transform: translateY(-100%); }
    20%, 88% { opacity: .9; }
    to { opacity: 0; transform: translateY(0); }
}
@keyframes usf-status { from { opacity: 1; } to { opacity: 0; } }
@keyframes usf-shake { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }
@keyframes usf-glitch { 20% { transform: translateX(5px); } 45% { transform: translateX(-3px); } 70% { transform: translateX(2px); } }

.usf.is-paused, .usf.is-paused *, .usf.is-paused *::before, .usf.is-paused::after,
.usf.is-paused *::after { animation-play-state: paused !important; }
.usf.is-still, .usf.is-still *, .usf.is-still *::before, .usf.is-still::after,
.usf.is-still *::after { animation: none !important; }

@media (max-width: 720px) {
    .usf-enabled > .hero-preview { min-width: 0; }
    .usf-slot { min-height: 300px; }
    .usf-top { height: 30px; gap: 6px; padding: 0 8px; }
    .usf-file { font-size: 10px; }
    .usf-demo, .usf-live { font-size: 8px; }
    .usf-steps { height: 31px; padding: 3px 5px; gap: 3px; }
    .usf-step { font-size: 9px; gap: 3px; }
    .usf-step span { width: 13px; height: 13px; font-size: 8px; }
    .usf-footer { height: 32px; font-size: 9px; }
    .usf-scene { gap: 5px; padding: 7px 9px; }
    .usf-label, .usf-note { font-size: 9px; }
    .usf-reel-cell .usf-logo { height: 28px; }
    .usf-digit { --digit-height: 27px; font-size: 16px; }
    .usf-weight, .usf-product, .usf-badge, .usf-verdict { font-size: 9px; }
    .usf-formula { font-size: 11px; }
    .usf-account { padding: 5px 6px; }
    .usf-account b { font-size: 12px; }
    .usf-table { gap: 2px; }
    .usf-row { gap: 4px; padding: 1px 4px; font-size: 10px; }
    .usf-row .usf-logo { height: 15px; }
    .usf-chip, .usf-pro { font-size: 9px; padding: 2px 4px; }
    .usf-field { min-height: 35px; font-size: 16px; padding: 5px 8px; }
    .usf-dropdown { padding-block: 4px; }
    .usf-result .usf-logo, .usf-dropdown .usf-logo { width: 72px; height: 19px; }
}
