/* =============================================================
 * UB Intelligence, THE CORE (intelligence.php). Script: assets/js/ubi-core.js. Page styles: assets/css/intelligence.css.
 *
 *   .ubn-canvas   one canvas behind the whole stage (the sphere, the tool disc, packets, beams); aria-hidden
 *   .ubn-zone     the space the core sits in: four gauges in its corners, the state word under the core,
 *                 four callouts naming the tools the engine picked (the canvas draws a leader line to each),
 *                 and the hover tip for a point on the disc
 *   .ubn-term     the box: a glass terminal under the core (the real textarea, the demo's ghost line, actions,
 *                 the readout strip)
 *   .is-demo / .is-user / .is-typing / .is-read / .is-paused   set on the form by the script, as before
 * Motion is the canvas (one requestAnimationFrame loop) plus transforms and opacity here; prefers-reduced-motion gets
 * still frames. Text colours are the site's AA pairs; the accent is decoration in light mode.
 * ============================================================= */

.ubn { --ubn-glass: rgba(9, 12, 17, .74); --ubn-glass-2: rgba(14, 18, 25, .86); --ubn-tw: 880px; }
/* too narrow for boxes beside the terminal: the terminal takes the width and the boxes step aside (the beams still land
   on the tools, the box's line names the best one, and the readings below list them all) */

[data-theme="light"] .ubn { --ubn-glass: rgba(255, 255, 255, .78); --ubn-glass-2: rgba(255, 255, 255, .92); }
.ubn-canvas { position: absolute; inset: 0; z-index: -1; width: 100%; height: 100%; display: block; pointer-events: none; }
.ubn .ubx-env__grid { opacity: .28; }
.ubn .ubx-hud { margin-bottom: clamp(14px, 2vw, 24px); }
.ubn .ubx-title { margin-bottom: 0; position: relative; z-index: 1; }
.ubn .ubx-title__lead { font-size: clamp(1.9rem, 3.7vw, 3rem); }
.ubn .ubx-title__sub { margin-top: 10px; font-size: clamp(.95rem, 1.15vw, 1.02rem); }
.ubn-box { position: relative; }

/* ================================================================== the core's space */
.ubn-zone {
    position: relative;
    /* fit the screen: whatever height is left after the site header, HUD, the two cards, the title and the box
       (--ubn-rest, measured at 1280x600 to 1920x950 so the whole box shows); never under 220px, never over 500px */
    --ubn-rest: 421px;
    height: clamp(200px, calc(100vh - var(--ubn-rest)), 500px);
    height: clamp(200px, calc(100svh - var(--ubn-rest)), 500px);
    margin: -6px auto -78px;      /* the terminal overlaps the front of the disc */
    font-family: var(--font-mono);
    color: var(--text-tertiary);
    user-select: none;
}
.ubn-zone { cursor: grab; touch-action: pan-y; }
.ubn-zone.is-hover { cursor: pointer; }
.ubn-zone.is-grab { cursor: grabbing; }

/* gauges: corner readouts with a bracket */
.ubn-gauge {
    position: absolute;
    display: grid;
    gap: 3px;
    min-width: 150px;
    padding: 8px 12px;
    font-size: .62rem;
    letter-spacing: .14em;
    text-transform: uppercase;
}
.ubn-gauge::before {
    content: '';
    position: absolute;
    width: 14px;
    height: 14px;
    border: 0 solid color-mix(in srgb, var(--accent) 60%, transparent);
}
.ubn-gauge b { font-weight: 500; font-size: 1.05rem; letter-spacing: .02em; color: var(--text-primary); font-variant-numeric: tabular-nums; text-transform: none; }
.ubn-gauge i { display: block; height: 2px; width: 100%; background: linear-gradient(90deg, var(--accent) var(--p, 0%), var(--ubx-line-2) 0); border-radius: 2px; }
.ubn-gauge--tl { left: 0; top: 6px; }
.ubn-gauge--tl::before { left: 0; top: 0; border-left-width: 1px; border-top-width: 1px; }
.ubn-gauge--tr { right: 0; top: 6px; text-align: right; }
.ubn-gauge--tr::before { right: 0; top: 0; border-right-width: 1px; border-top-width: 1px; }
.ubn-gauge--bl { left: 0; bottom: 92px; }
.ubn-gauge--bl::before { left: 0; bottom: 0; border-left-width: 1px; border-bottom-width: 1px; }
.ubn-gauge--br { right: 0; bottom: 92px; text-align: right; }
.ubn-gauge--br::before { right: 0; bottom: 0; border-right-width: 1px; border-bottom-width: 1px; }
.ubn-gauge b.is-tick { animation: ubn-tick .5s ease; }
@keyframes ubn-tick { from { color: var(--accent); } }
[data-theme="light"] .ubn-gauge b.is-tick { animation: none; }

.ubn-state {
    position: absolute;
    left: 50%;
    bottom: 88px;
    transform: translateX(-50%);
    padding: 3px 12px;
    border: 1px solid var(--ubx-line);
    border-radius: 999px;
    background: var(--ubn-glass);
    font-size: .6rem;
    letter-spacing: .22em;
    text-transform: uppercase;
    white-space: nowrap;
    color: var(--text-secondary);
}
.ubn-state::before { content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px; border-radius: 50%; background: var(--ubx-line-2); vertical-align: 1px; }
.ubn-state.is-busy::before { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: ubn-blink .5s steps(1) infinite; }
.ubn-state.is-lock::before { background: #7be0a5; box-shadow: 0 0 8px #7be0a5; }
[data-theme="light"] .ubn-state.is-lock::before { background: #1f9a62; box-shadow: none; }
@keyframes ubn-blink { 50% { opacity: .2; } }

/* callouts: the tools the engine picked (the canvas draws the leader from the tool's point) */
/* the suggestions, inside the box (as on the homepage console): numbered rows, best first; the best one is lit */
.ubn-routes {                     /* two rows tall, the rest a scroll away: the galaxy keeps the height; fixed, so nothing jumps */
    position: relative; z-index: 1; display: grid; align-content: start; gap: 2px;
    height: 66px; margin: 0; padding: 2px 6px 6px 10px; list-style: none;
    overflow-y: auto; overscroll-behavior: contain;
    scrollbar-width: thin; scrollbar-color: color-mix(in srgb, var(--accent) 45%, transparent) transparent;
}
.ubn-routes::-webkit-scrollbar { width: 6px; }
.ubn-routes::-webkit-scrollbar-thumb { border-radius: 3px; background: color-mix(in srgb, var(--accent) 45%, transparent); }
.ubn-call {
    display: grid;
    grid-template-columns: 26px minmax(0, 1fr) auto 90px 3.4em;
    align-items: center;
    gap: 12px;
    height: 28px;
    padding: 0 10px;
    border-left: 2px solid transparent;
    border-radius: 7px;
    color: var(--text-secondary);
    font-size: .88rem;
    cursor: pointer;
    transition: background-color .15s ease, border-color .15s ease;
}
.ubn-call:not(.is-on) { display: none; }
.ubn-call.is-on { animation: ubn-in .35s cubic-bezier(.2, .7, .2, 1) both; }
.ubn-call--1 { animation-delay: .06s !important; }
.ubn-call--2 { animation-delay: .12s !important; }
.ubn-call--3 { animation-delay: .18s !important; }
.ubn-call:hover, .ubn-call--0 { background: color-mix(in srgb, var(--accent) 9%, transparent); border-left-color: var(--accent); color: var(--text-primary); }
.ubn-call__n { font-family: var(--font-mono); font-size: .68rem; letter-spacing: .06em; color: var(--text-tertiary); }
.ubn-call--0 .ubn-call__n { color: var(--text-primary); }
.ubn-call__t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--text-primary); }
.ubn-call--0 .ubn-call__t { font-weight: 600; }
.ubn-call__c { font-family: var(--font-mono); font-size: .6rem; letter-spacing: .12em; text-transform: uppercase; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 22ch; }
.ubn-call__bar { height: 3px; border-radius: 2px; background: var(--ubx-line-2); overflow: hidden; }
.ubn-call__bar i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 50%, transparent), var(--accent)); transform-origin: left; transform: scaleX(0); transition: transform .8s cubic-bezier(.2, .7, .2, 1); }
.ubn-call__p { text-align: right; font-family: var(--font-mono); font-size: .76rem; color: var(--text-primary); font-variant-numeric: tabular-nums; white-space: nowrap; }
.ubn-call--0 .ubn-call__p::after { content: ' \21B5'; color: var(--accent); }
.ubn-routes__empty { display: none; height: 30px; padding: 0 12px; align-items: center; font-family: var(--font-mono); font-size: .7rem; letter-spacing: .06em; color: var(--text-tertiary); }
.ubn-routes:not(:has(.is-on)) .ubn-routes__empty { display: flex; }
.ubn-term.is-demo .ubn-routes { opacity: .8; }

/* the input line's icons (choose a file, clear) and Open top match at the end of the answer line */
.ubn-ibtn {
    display: inline-grid; place-items: center; width: 32px; height: 30px; padding: 0;
    border: 1px solid var(--ubx-line-2); border-radius: 8px; background: var(--ubx-row);
    color: var(--text-secondary); cursor: pointer;
}
.ubn-ibtn:hover { color: var(--text-primary); border-color: color-mix(in srgb, var(--accent) 55%, var(--ubx-line-2)); }
.ubn-ibtn[hidden] { display: none; }
.ubn-ibtn svg { width: 16px; height: 16px; }
.ubn-go {
    flex: none; margin-left: auto; display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 11px;
    border: 1px solid var(--accent); border-radius: 7px; background: var(--accent); color: var(--text-inverse);
    font: 600 .76rem/1 var(--font-body); cursor: pointer; box-shadow: 0 6px 18px -10px var(--accent);
}
.ubn-go:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.ubn-status { margin-left: auto; text-transform: none; letter-spacing: .02em; }
.ubn-status + .ubx-tele__help { margin-left: 0; }

/* hover tip for a point on the disc */
.ubn-tip {
    position: absolute;
    left: 0;
    top: 0;
    z-index: 3;
    display: grid;
    gap: 1px;
    max-width: 260px;
    padding: 6px 10px;
    border: 1px solid var(--ubx-line-2);
    border-radius: 8px;
    background: var(--ubn-glass-2);
    pointer-events: none;
    white-space: nowrap;
}
.ubn-tip[hidden] { display: none; }
.ubn-tip b { font-family: var(--font-body); font-size: .82rem; font-weight: 600; color: var(--text-primary); overflow: hidden; text-overflow: ellipsis; }
.ubn-tip span { font-size: .58rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-tertiary); }

/* ================================================================== the terminal */
.ubn-term {
    --ubh-line: var(--ubx-line);
    position: relative;
    max-width: var(--ubn-tw);
    margin: 0 auto;
    border: 1px solid var(--ubx-line-2);
    border-radius: 18px;
    background: var(--ubn-glass);
    -webkit-backdrop-filter: blur(14px) saturate(1.15);
            backdrop-filter: blur(14px) saturate(1.15);
    box-shadow: var(--ubx-shadow);
    transition: border-color .25s ease, box-shadow .25s ease;
}
.ubn-term::before {                 /* a lit edge on top, like light from the core */
    content: '';
    position: absolute;
    left: 12%;
    right: 12%;
    top: -1px;
    height: 1px;
    background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 85%, transparent), transparent);
}
.ubn-term::after {                  /* corner brackets */
    content: '';
    position: absolute;
    inset: 7px;
    pointer-events: none;
    --c: color-mix(in srgb, var(--accent) 50%, transparent);
    background:
        linear-gradient(var(--c), var(--c)) left top / 12px 1px, linear-gradient(var(--c), var(--c)) left top / 1px 12px,
        linear-gradient(var(--c), var(--c)) right top / 12px 1px, linear-gradient(var(--c), var(--c)) right top / 1px 12px,
        linear-gradient(var(--c), var(--c)) left bottom / 12px 1px, linear-gradient(var(--c), var(--c)) left bottom / 1px 12px,
        linear-gradient(var(--c), var(--c)) right bottom / 12px 1px, linear-gradient(var(--c), var(--c)) right bottom / 1px 12px;
    background-repeat: no-repeat;
    opacity: .7;
}
.ubn-term:focus-within { border-color: color-mix(in srgb, var(--accent) 60%, var(--ubx-line-2)); box-shadow: var(--ubx-shadow), 0 0 0 4px color-mix(in srgb, var(--accent) 12%, transparent), 0 0 70px -20px color-mix(in srgb, var(--accent) 55%, transparent); }
.ubn-term :is(button):focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.ubn-term__bar {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 6px 12px;
    min-height: 44px;
    padding: 6px 10px 6px 18px;
    border-bottom: 1px solid var(--ubx-line);
    font-family: var(--font-mono);
    font-size: .68rem;
    letter-spacing: .12em;
    text-transform: uppercase;
    color: var(--text-tertiary);
}
.ubn-term__dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #7be0a5; box-shadow: 0 0 0 3px rgba(123, 224, 165, .15), 0 0 10px rgba(123, 224, 165, .5); }
[data-theme="light"] .ubn-term__dot { background: #1f9a62; box-shadow: 0 0 0 3px rgba(31, 154, 98, .14); }
.ubn-term.is-user .ubn-term__dot { background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent), 0 0 10px var(--accent); }
.ubn-term__label { font-weight: 500; color: var(--text-primary); white-space: nowrap; cursor: text; }
.ubn-term__k { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; letter-spacing: .08em; }
.ubn-term__k::before { content: '\00B7'; margin-right: 10px; }
.ubn-term__meta { margin-left: auto; white-space: nowrap; letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.ubn-demo { display: inline-flex; align-items: center; gap: 4px; flex: none; }
.ubn-term__meta:empty + .ubn-demo { margin-left: auto; }
.ubn-term.is-user .ubn-demo { display: none; }
.ubn-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border: 1px solid var(--ubx-line-2);
    border-radius: 8px;
    background: var(--ubx-row);
    color: var(--text-secondary);
    font: 500 .74rem/1 var(--font-body);
    letter-spacing: 0;
    text-transform: none;
    cursor: pointer;
}
.ubn-icon:hover { color: var(--text-primary); border-color: color-mix(in srgb, var(--accent) 55%, var(--ubx-line-2)); }
.ubn-icon svg { width: 14px; height: 14px; flex: none; }
.ubn-icon .is-play { display: none; }
.ubn-term.is-paused .ubn-icon .is-pause { display: none; }
.ubn-term.is-paused .ubn-icon .is-play { display: block; }

.ubn-term__body { position: relative; z-index: 1; padding: 14px 18px 6px; }
.ubn-field { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 8px 12px; align-items: start; }
.ubn-term__p { font: 500 1.2rem/30px var(--font-mono); color: var(--accent); }
[data-theme="light"] .ubn-term__p { color: var(--text-secondary); }
.ubn-term__box { position: relative; min-width: 0; }
.ubn-term .ubi-input {
    min-height: 30px;
    max-height: 120px;
    padding: 0;
    resize: none;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    font: 400 1.08rem/30px var(--font-mono);
    color: var(--text-primary);
    caret-color: var(--accent);
}
.ubn-term .ubi-input:focus { box-shadow: none; }
.ubn-term .ubi-input::placeholder { color: var(--text-tertiary); opacity: 0; transition: opacity .2s; }
.ubn-term.is-user .ubi-input::placeholder { opacity: 1; }
.ubn-term .ubi-field.has-file .ubi-input { height: 30px; }
.ubn-ghost {
    position: absolute;
    inset: 0 0 auto 0;
    display: flex;
    align-items: center;
    gap: 8px;
    height: 30px;
    font: 400 1.08rem/30px var(--font-mono);
    color: var(--text-secondary);
    white-space: pre;
    overflow: hidden;
    pointer-events: none;
}
.ubn-term.is-user .ubn-ghost { display: none; }
.ubn-ghost__file { display: none; width: 13px; height: 15px; flex: none; color: var(--accent); }
.is-file > .ubn-field .ubn-ghost__file, .ubn-term__body.is-file .ubn-ghost__file { display: block; }
.ubn-caret { flex: none; width: 9px; height: 19px; margin-left: -6px; background: var(--accent); animation: ubn-caret 1.05s steps(1) infinite; }
.ubn-term.is-typing .ubn-caret { animation: none; }
@keyframes ubn-caret { 50% { opacity: 0; } }
.ubn-term .ubi-file { margin-top: 6px; }
.ubn-term__sub { display: flex; align-items: center; gap: 14px; min-height: 20px; margin-top: 6px; font: 400 .76rem/20px var(--font-mono); white-space: nowrap; overflow: hidden; }
.ubn-term__kind { color: var(--text-tertiary); overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ubn-term__kind:not(:empty)::before { content: '\21B3  '; }
.ubn-term__ans { color: var(--text-primary); font-weight: 500; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ubn-term.is-read .ubn-term__sub > span { animation: ubn-in .4s ease both; }
@keyframes ubn-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

.ubn-term .ubn-term__foot { position: relative; z-index: 1; margin: 0; padding: 10px 18px 14px; gap: 8px 10px; }
.ubn-term__foot .ubi-btn { min-height: 38px; }
.ubn-term__foot .ubi-btn:not(.ubi-btn--go) { background: var(--ubx-row); border-color: var(--ubx-line-2); }
.ubn-term .ubx-tele { border-radius: 0 0 17px 17px; }

.ubn-drop {
    position: absolute;
    inset: 6px;
    z-index: 4;
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1.5px dashed var(--accent);
    border-radius: 14px;
    background: color-mix(in srgb, var(--bg-card) 90%, transparent);
    font-family: var(--font-mono);
    font-size: .74rem;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--text-secondary);
    pointer-events: none;
}
.ubn-drop strong { font-family: var(--ubx-serif, Georgia, serif); font-size: 1.5rem; font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--text-primary); }
.ubn-term:has(.ubi-field.is-drag) .ubn-drop { display: flex; }

/* ================================================================== narrow screens */
@media (max-width: 900px) {
}
@media (max-width: 760px) {
    .ubn-zone { height: 360px; margin-bottom: -20px; }
    .ubn-state { bottom: 30px; }
    .ubn-gauge--bl, .ubn-gauge--br { display: none; }
    .ubn-gauge { min-width: 0; }
    .ubn-term__k, .ubn-term__meta { display: none; }
    .ubn-term__label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
    .ubn-demo { margin-left: auto; }
    .ubn-icon__t { display: none; }
    .ubn-term__bar { padding-left: 14px; }
    .ubn-term__body { padding: 12px 14px 4px; }
    .ubn-term .ubn-term__foot { padding: 10px 14px 12px; }
}
@media (max-width: 420px) {
    .ubn-term__label { font-size: .62rem; letter-spacing: .08em; }
}
@media (prefers-reduced-motion: reduce) {
    .ubn-call, .ubn-call__bar i, .ubn-term { transition: none; }
    .ubn-caret, .ubn-state.is-busy::before, .ubn-term.is-read .ubn-term__sub > span, .ubn-gauge b.is-tick { animation: none; }
}

/* ================================================================== ON THIS DAY: the people behind the tools
 * In the core's top corners, styled like the corner gauges: the nearest birthday top left (gold), the nearest death
 * anniversary top right (silver), with the Old Style date when there is one. ubi-core.js arms them (.is-armed hides
 * them) and flies each in from its side (.is-in) as the core spells the name; without JS or with reduced motion they
 * simply sit there. They are real links (the rest of the zone is decoration). */
.ubn-alm { position: absolute; left: 0; right: 0; top: 6px; z-index: 2; display: flex; justify-content: space-between; gap: 12px; pointer-events: none; }
.ubn-alm__card {
    --al: #e4b060;
    position: relative;
    display: grid;
    gap: 2px;
    width: min(290px, 32%);
    min-width: 0;
    padding: 8px 12px 9px;
    border-radius: 4px;
    background: linear-gradient(135deg, color-mix(in srgb, var(--al) 9%, transparent), transparent 70%);
    color: var(--text-primary);
    text-decoration: none;
    font-family: var(--font-mono);
    pointer-events: auto;
    transition: background-color .2s ease;
}
.ubn-alm__card::before {               /* a corner bracket, like the gauges */
    content: ''; position: absolute; left: 0; top: 0; width: 14px; height: 14px;
    border-left: 1px solid var(--al); border-top: 1px solid var(--al);
}
.ubn-alm__card--died { --al: #b9c6dc; margin-left: auto; text-align: right; background: linear-gradient(225deg, color-mix(in srgb, var(--al) 9%, transparent), transparent 70%); }
.ubn-alm__card--died::before { left: auto; right: 0; border-left: 0; border-right: 1px solid var(--al); }
[data-theme="light"] .ubn-alm__card { --al: #a26a12; }
[data-theme="light"] .ubn-alm__card--died { --al: #4a5878; }
.ubn-alm__card:hover .ubn-alm__go { text-decoration: underline; text-underline-offset: 3px; }
.ubn-alm__k { display: flex; align-items: center; gap: 7px; font-size: .6rem; letter-spacing: .14em; text-transform: uppercase; color: var(--text-tertiary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ubn-alm__card--died .ubn-alm__k { justify-content: flex-end; }
.ubn-alm__k i { font-style: normal; font-size: .85rem; letter-spacing: 0; color: var(--al); }
.ubn-alm__name { font-family: var(--ubx-serif, Georgia, serif); font-size: 1.12rem; font-weight: 400; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ubn-alm__date { font-size: .64rem; letter-spacing: .04em; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.ubn-alm__date [data-ubn-yrs] { color: var(--al); }
.ubn-alm__line { font-family: var(--font-body); font-size: .76rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ubn-alm__go { color: var(--text-primary); font-weight: 600; }

/* flying in */
.ubn-alm.is-armed .ubn-alm__card { opacity: 0; }
.ubn-alm.is-armed .ubn-alm__card.is-in { opacity: 1; animation: ubn-fly-l 1.05s cubic-bezier(.16, .84, .3, 1) both; }
.ubn-alm.is-armed .ubn-alm__card--died.is-in { animation-name: ubn-fly-r; }
.ubn-alm__card.is-in::after {          /* the flash as it lands */
    content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none;
    box-shadow: 0 0 0 1px color-mix(in srgb, var(--al) 70%, transparent), 0 0 36px -6px var(--al);
    animation: ubn-land 1.4s ease .55s both;
}
@keyframes ubn-fly-l {
    0% { transform: translateX(-115vw) scaleX(1.7); opacity: 0; filter: blur(8px); }
    55% { opacity: 1; filter: blur(1px); }
    78% { transform: translateX(10px) scaleX(.98); filter: blur(0); }
    100% { transform: none; opacity: 1; }
}
@keyframes ubn-fly-r {
    0% { transform: translateX(115vw) scaleX(1.7); opacity: 0; filter: blur(8px); }
    55% { opacity: 1; filter: blur(1px); }
    78% { transform: translateX(-10px) scaleX(.98); filter: blur(0); }
    100% { transform: none; opacity: 1; }
}
@keyframes ubn-land { 0% { opacity: 0; } 15% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
    .ubn-alm.is-armed .ubn-alm__card { opacity: 1; }
    .ubn-alm.is-armed .ubn-alm__card.is-in, .ubn-alm__card.is-in::after { animation: none; }
}
/* the callouts start below the corners */
.ubn-alm__card { transition: opacity .35s ease, background-color .2s ease; }
.ubn-alm .ubn-alm__card.is-covered { opacity: .1 !important; }   /* !important: beats the fly-in's final frame */

/* ================================================================== short screens (laptops): everything above the fold
 * The core's space already shrinks with the window (.ubn-zone); here the text around it tightens too. */
@media (max-height: 860px) and (min-width: 761px) {
    .ubn-zone { --ubn-rest: 373px; }
    .ubn .ubx-hud { margin-bottom: 10px; padding-bottom: 8px; }
    .ubn .ubx-title__lead { font-size: clamp(1.8rem, 3.2vw, 2.55rem); }
    .ubn .ubx-title__sub { margin-top: 6px; font-size: .94rem; line-height: 1.5; }
    .ubn { padding-top: 10px; }
}
@media (max-height: 760px) and (min-width: 761px) {
    .ubn-zone { --ubn-rest: 373px; }
    .ubn-term .ubx-tele { display: none; }   /* short screens: the box's bar already shows the readings and the time */
}
@media (max-height: 720px) and (min-width: 761px) {
    .ubn .ubx-title__lead { font-size: clamp(1.7rem, 2.8vw, 2.2rem); }
}

/* ================================================================== phones: the box within reach
 * The two cards become one swipeable row (each card most of the width, the next one peeking in), the line under the
 * title is kept for screen readers and search only, and the core takes a little less height. */
@media (max-width: 760px) {
    /* phones: the two people stay in the corners, smaller: when, who, and the tool */
    .ubn-alm__card { width: 49%; padding: 6px 8px 7px; }
    .ubn-alm__name { font-size: .95rem; }
    .ubn-alm__date { display: none; }
    .ubn-alm__why { display: none; }
    .ubn-alm__line { font-size: .7rem; }
    .ubn-alm__k { font-size: .54rem; letter-spacing: .08em; }
    .ubn .ubx-hud { margin-bottom: 10px; }
    .ubn .ubx-hud__stats { display: none; }   /* the counts are in the title's line for screen readers, and in the readout */
    .ubn .ubx-title__lead { font-size: 1.75rem; }
    .ubn .ubx-title__sub { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
    .ubn-zone { height: 275px; }
}
@media (max-width: 760px) and (max-height: 700px) {
    .ubn-zone { height: 225px; }
    .ubn .ubx-hud { display: none; }              /* small phones: the cards (who, what they did) come first */
    .ubn .ubx-title__lead { font-size: 1.5rem; }
}
/* a short core (laptops, phones): the corner gauges would collide with the callouts; the box's bar and the readings
   below carry the same numbers. Phones also drop the callouts: the beam still lands on the tool, and the box's line names it. */
@media (max-height: 860px), (max-width: 760px) {
    .ubn-gauge { display: none; }
}
@media (max-width: 760px) {
}
/* phones: a suggestion row keeps its number, the tool and the percentage */
@media (max-width: 760px) {
    .ubn-call { grid-template-columns: 22px minmax(0, 1fr) 3.6em; gap: 8px; }
    .ubn-call__c, .ubn-call__bar { display: none; }
    .ubn-routes { padding: 2px 6px 6px; }
}
@media (prefers-reduced-motion: reduce) { .ubn-call.is-on { animation: none; } }
@media (max-height: 700px) and (min-width: 761px) {
    .ubn-zone { --ubn-rest: 315px; }
    .ubn .ubx-title__sub { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }   /* still read by screen readers and search */
}
