/* NAPS, the board's assistant (js/assistant.js): a HUD orb in the bottom-left corner (above the
   music player when there is one) and a holographic panel that types out which pick is paying
   more on the simulator today. */

.na {
    --na-cyan: #38e8ff;
    --na-cyan-soft: rgba(56, 232, 255, 0.35);
    --na-ink: #e9fbff;
    --na-glass: rgba(4, 20, 28, 0.97);
    --na-up: #b9e660;
    --na-down: #ff8a7a;
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 56;
    font-size: 14px;
}

.has-music .na {
    bottom: 104px;
}

/* --- The orb --- */

.na-orb {
    position: relative;
    display: grid;
    place-items: center;
    width: 62px;
    height: 62px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(56, 232, 255, 0.18), rgba(4, 20, 28, 0.95) 70%);
    box-shadow: 0 0 18px var(--na-cyan-soft), inset 0 0 12px rgba(56, 232, 255, 0.25);
    cursor: pointer;
    animation: na-hover 4s ease-in-out infinite;
}

.na-orb:focus-visible {
    outline: 3px solid var(--na-cyan);
    outline-offset: 4px;
}

.na-ring {
    position: absolute;
    border-radius: 50%;
    border: 2px solid transparent;
}

.na-ring--1 {
    inset: 3px;
    border-top-color: var(--na-cyan);
    border-right-color: var(--na-cyan-soft);
    animation: na-spin 6s linear infinite;
}

.na-ring--2 {
    inset: 10px;
    border-bottom-color: var(--na-cyan);
    border-left-color: var(--na-cyan-soft);
    animation: na-spin 4s linear infinite reverse;
}

.na-ring--3 {
    inset: 17px;
    border: 1px dashed rgba(56, 232, 255, 0.5);
    animation: na-spin 10s linear infinite;
}

.na-core {
    display: grid;
    place-items: center;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: radial-gradient(circle, #ffffff, var(--na-cyan) 55%, rgba(56, 232, 255, 0.2));
    box-shadow: 0 0 14px var(--na-cyan), 0 0 30px var(--na-cyan-soft);
    animation: na-pulse 2.4s ease-in-out infinite;
}

.na-eye {
    width: 8px;
    height: 2px;
    border-radius: 2px;
    background: #04141c;
    animation: na-blink 5s infinite;
}

/* Something new to say: a small signal light */
.na.has-news .na-orb::after {
    position: absolute;
    top: 4px;
    right: 6px;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--na-up);
    box-shadow: 0 0 8px var(--na-up);
    content: "";
}

/* Speaking: rings race, the core flares */
.na.is-awake .na-ring--1 { animation-duration: 1.4s; }
.na.is-awake .na-ring--2 { animation-duration: 1s; }
.na.is-awake .na-ring--3 { animation-duration: 2.5s; }
.na.is-awake .na-core { animation-duration: 0.8s; }
.na.is-awake .na-orb::after { display: none; }

/* The short flight when it starts talking */
.na.is-flying .na-orb {
    animation: na-fly 1.1s cubic-bezier(0.3, 0.7, 0.3, 1), na-hover 4s ease-in-out 1.1s infinite;
}

@keyframes na-spin { to { transform: rotate(360deg); } }
@keyframes na-pulse { 50% { transform: scale(1.25); box-shadow: 0 0 22px var(--na-cyan), 0 0 44px var(--na-cyan-soft); } }
@keyframes na-blink { 0%, 92%, 100% { transform: scaleY(1); } 95% { transform: scaleY(0.1); } }
@keyframes na-hover { 50% { transform: translateY(-5px); } }
@keyframes na-fly {
    0% { transform: translate(0, 0) scale(1); }
    35% { transform: translate(46px, -70px) scale(1.15) rotate(-12deg); }
    70% { transform: translate(18px, -26px) scale(1.05) rotate(6deg); }
    100% { transform: translate(0, 0) scale(1); }
}

/* --- The panel --- */

.na-panel {
    position: absolute;
    left: 0;
    bottom: calc(100% + 14px);
    width: min(400px, calc(100vw - 32px));
    padding: 14px 16px 14px;
    overflow: hidden;
    border: 1px solid var(--na-cyan-soft);
    border-radius: 4px 18px 18px 18px;
    background:
        repeating-linear-gradient(to bottom, rgba(56, 232, 255, 0.05) 0 1px, transparent 1px 3px),
        var(--na-glass);
    color: var(--na-ink);
    box-shadow: 0 0 0 1px rgba(56, 232, 255, 0.08), 0 0 30px rgba(56, 232, 255, 0.18), 0 20px 50px rgba(0, 0, 0, 0.5);
    animation: na-open 0.35s ease-out;
}

.na-panel[hidden] {
    display: none;
}

/* HUD corner brackets */
.na-panel::before,
.na-panel::after {
    position: absolute;
    width: 14px;
    height: 14px;
    border: 2px solid var(--na-cyan);
    content: "";
}

.na-panel::before {
    top: 6px;
    right: 6px;
    border-left: 0;
    border-bottom: 0;
}

.na-panel::after {
    bottom: 6px;
    left: 6px;
    border-right: 0;
    border-top: 0;
}

@keyframes na-open {
    from { opacity: 0; transform: translateY(8px) scaleY(0.9); filter: blur(2px); }
}

.na-head {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.na-tag {
    color: var(--na-cyan);
    font-family: "Spline Sans Mono", ui-monospace, monospace;
    font-size: 11px;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.na-live {
    margin-right: auto;
    padding: 1px 6px;
    border: 1px solid var(--na-up);
    border-radius: 4px;
    color: var(--na-up);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.na-icon {
    display: grid;
    place-items: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: none;
    color: var(--na-ink);
    cursor: pointer;
}

.na-icon:hover,
.na-icon[aria-pressed="true"] {
    color: var(--na-cyan);
}

.na-text {
    min-height: 3.2em;
    margin: 0 0 10px;
    font-family: "Spline Sans Mono", ui-monospace, monospace;
    font-size: 13.5px;
    line-height: 1.5;
    text-shadow: 0 0 8px rgba(56, 232, 255, 0.35);
}

.na-caret {
    display: inline-block;
    width: 7px;
    height: 1em;
    margin-left: 2px;
    vertical-align: -2px;
    background: var(--na-cyan);
    animation: na-caret 0.8s steps(1) infinite;
}

.na:not(.is-typing) .na-caret {
    opacity: 0.4;
}

@keyframes na-caret { 50% { opacity: 0; } }

/* Pick 1 and Pick 2 side by side */
.na-bars {
    display: grid;
    gap: 6px;
    margin-bottom: 8px;
}

.na-bars[hidden] {
    display: none;
}

.na-bars__head {
    margin: 0;
    color: #9fd8e6;
    font-size: 11.5px;
}

.na-bar {
    display: grid;
    grid-template-columns: 52px minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
}

.na-bar__track {
    height: 8px;
    overflow: hidden;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.08);
}

.na-bar__fill {
    display: block;
    width: var(--w);
    height: 100%;
    border-radius: 4px;
    background: var(--na-up);
    animation: na-grow 0.8s ease-out;
}

.na-bar.is-down .na-bar__fill {
    background: var(--na-down);
}

.na-bar.is-better .na-bar__name,
.na-bar.is-better .na-bar__value {
    color: var(--na-up);
    font-weight: 700;
}

.na-bar.is-down .na-bar__value {
    color: var(--na-down);
}

@keyframes na-grow { from { width: 0; } }

.na-foot {
    margin: 0 0 10px;
    color: #8fb3bf;
    font-size: 11px;
}

.na-actions {
    display: flex;
    gap: 8px;
}

.na-go,
.na-next {
    padding: 7px 14px;
    border-radius: 999px;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
}

.na-go {
    border: 0;
    background: var(--na-cyan);
    color: #04141c;
}

.na-go[hidden] {
    display: none;
}

.na-next {
    border: 1px solid var(--na-cyan-soft);
    background: transparent;
    color: var(--na-ink);
}

.na-go:focus-visible,
.na-next:focus-visible,
.na-icon:focus-visible {
    outline: 3px solid var(--na-cyan);
    outline-offset: 2px;
}

/* Phones: above the sticky call to action (and the music player) */
@media (max-width: 991.98px) {
    .na {
        bottom: calc(84px + env(safe-area-inset-bottom));
    }

    .has-music .na {
        bottom: calc(168px + env(safe-area-inset-bottom));
    }

    /* The player folded down to its music button (phones start that way): sit beside it */
    .has-music:has(.rm-player.is-folded) .na {
        left: 70px;
        bottom: calc(84px + env(safe-area-inset-bottom));
    }

    .has-music:has(.rm-player.is-folded) .na-panel {
        left: -54px;   /* still 16px from the screen's left edge */
    }

    .na-orb {
        width: 52px;
        height: 52px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .na-orb,
    .na.is-flying .na-orb,
    .na-ring,
    .na-core,
    .na-eye,
    .na-caret,
    .na-panel,
    .na-bar__fill {
        animation: none;
    }
}
