/* FlyMacroPilot — Career HUD & Shock Event Styles
   v1.0.0: XP progression bar, rank-up overlay, market shock event,
           Kalshi-style consensus panel */

/* ── VARIABLES ─────────────────────────────────────────────────────────────── */
:root {
    --ch-bg:       rgba(8, 12, 20, 0.92);
    --ch-border:   rgba(0, 229, 212, 0.25);
    --ch-green:    #00e5d4;
    --ch-amber:    #ffb000;
    --ch-red:      #ff3344;
    --ch-text:     #cde;
    --ch-dim:      rgba(160, 200, 220, 0.45);
    --ch-cut:      #44aaff;
    --ch-hold:     #ffcc00;
    --ch-hike:     #ff5544;
}

/* ══════════════════════════════════════════════════════════════════════════════
   XP HUD — floating career bar
══════════════════════════════════════════════════════════════════════════════ */

.xp-hud {
    position: fixed;
    top: 8px;
    right: 8px;
    z-index: 6000;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--ch-bg);
    border: 1px solid var(--ch-border);
    border-radius: 6px;
    padding: 5px 10px;
    font-family: 'Courier New', monospace;
    font-size: 0.68rem;
    color: var(--ch-text);
    backdrop-filter: blur(6px);
    box-shadow: 0 0 16px rgba(0, 229, 212, 0.08);
    pointer-events: none;
    user-select: none;
}

.xp-icon { font-size: 0.9rem; }

.xp-rank-title {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    white-space: nowrap;
}

.xp-bar-outer {
    width: 80px;
    height: 4px;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 2px;
    overflow: hidden;
}

.xp-bar-inner {
    height: 100%;
    border-radius: 2px;
    transition: width 0.6s ease;
}

.xp-total {
    font-size: 0.60rem;
    color: var(--ch-dim);
    white-space: nowrap;
}

.xp-streak {
    font-size: 0.65rem;
    color: var(--ch-amber);
    font-weight: 700;
}

/* ── XP Float notification ─────────────────────────────────────────────────── */

.xp-float {
    position: fixed;
    right: 16px;
    top: 46px;
    z-index: 6100;
    background: var(--ch-bg);
    border: 1px solid var(--ch-green);
    border-radius: 6px;
    padding: 6px 12px;
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    color: var(--ch-green);
    pointer-events: none;
    opacity: 0;
    transform: translateY(-8px);
    transition: opacity 0.25s, transform 0.25s;
    box-shadow: 0 0 12px rgba(0, 229, 212, 0.15);
    text-align: right;
}

.xp-float strong { font-size: 0.75rem; display: block; }
.xp-float span   { color: var(--ch-dim); }

.xp-float-show { opacity: 1; transform: translateY(0); }
.xp-float-hide { opacity: 0; transform: translateY(-12px); }

/* ── Rank-Up celebration ───────────────────────────────────────────────────── */

.xp-rankup {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.7);
    opacity: 0;
    transition: opacity 0.4s;
    pointer-events: none;
}

.xp-rankup-show { opacity: 1; }
.xp-rankup-hide { opacity: 0; }

.xp-ru-body {
    background: linear-gradient(160deg, #080e18, #0d1520);
    border: 1px solid rgba(255, 220, 100, 0.5);
    border-radius: 12px;
    padding: 40px 56px;
    text-align: center;
    box-shadow: 0 0 60px rgba(255, 200, 50, 0.15), 0 0 120px rgba(0, 0, 0, 0.8);
    animation: xp-ru-pop 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes xp-ru-pop {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

.xp-ru-icon    { font-size: 3rem; margin-bottom: 12px; }
.xp-ru-label   { font-family: 'Courier New', monospace; font-size: 0.7rem; letter-spacing: 0.3em; color: rgba(255,255,255,0.4); margin-bottom: 6px; }
.xp-ru-title   { font-family: 'Courier New', monospace; font-size: 1.5rem; font-weight: 800; letter-spacing: 0.1em; margin-bottom: 8px; }
.xp-ru-note    { font-family: 'Courier New', monospace; font-size: 0.7rem; color: rgba(255,255,255,0.35); font-style: italic; }

/* ══════════════════════════════════════════════════════════════════════════════
   MARKET SHOCK OVERLAY
══════════════════════════════════════════════════════════════════════════════ */

#shock-overlay {
    position: fixed;
    inset: 0;
    z-index: 8500;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(20, 4, 4, 0.82);
    backdrop-filter: blur(4px);
    animation: shock-in 0.35s ease;
}

@keyframes shock-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

.shock-inner {
    background: linear-gradient(160deg, #130808, #0e0505);
    border: 1px solid rgba(255, 50, 50, 0.5);
    border-radius: 10px;
    width: min(620px, 92vw);
    max-height: 92vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: 0 0 80px rgba(255, 30, 30, 0.2), 0 0 160px rgba(0, 0, 0, 0.9);
}

.shock-alert {
    background: #c01010;
    color: #fff;
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.25em;
    text-align: center;
    padding: 8px 16px;
    border-radius: 9px 9px 0 0;
    animation: shock-blink 1s steps(2) infinite;
}

@keyframes shock-blink {
    0%   { opacity: 1; }
    50%  { opacity: 0.75; }
    100% { opacity: 1; }
}

.shock-title {
    font-family: 'Courier New', monospace;
    font-size: 1.4rem;
    font-weight: 800;
    color: #fff;
    padding: 18px 24px 0;
    letter-spacing: 0.03em;
}

.shock-sub {
    font-family: 'Courier New', monospace;
    font-size: 0.8rem;
    color: rgba(255, 200, 200, 0.8);
    padding: 8px 24px 0;
    line-height: 1.5;
}

.shock-tags {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    padding: 12px 24px;
}

.shock-tag {
    font-family: 'Courier New', monospace;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 4px;
    padding: 3px 8px;
}

.s-neg { background: rgba(255, 50, 50, 0.2); color: #ff6666; border: 1px solid rgba(255, 50, 50, 0.3); }
.s-pos { background: rgba(50, 200, 100, 0.2); color: #44dd88; border: 1px solid rgba(50, 200, 100, 0.3); }

.shock-choose {
    padding: 0 24px 16px;
}

.shock-choose-hd {
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    color: rgba(255, 150, 150, 0.7);
    letter-spacing: 0.2em;
    margin-bottom: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 50, 50, 0.15);
}

#shock-cd {
    color: #ff4444;
    font-weight: 800;
}

.shock-btn {
    display: flex;
    flex-direction: column;
    width: 100%;
    background: rgba(255, 50, 50, 0.06);
    border: 1px solid rgba(255, 50, 50, 0.2);
    border-radius: 6px;
    color: #fff;
    cursor: pointer;
    padding: 10px 14px;
    text-align: left;
    margin-bottom: 8px;
    transition: background 0.15s, border-color 0.15s;
    font-family: 'Courier New', monospace;
}

.shock-btn:hover {
    background: rgba(255, 80, 80, 0.14);
    border-color: rgba(255, 80, 80, 0.5);
}

.shock-btn-lbl  { font-size: 0.8rem; font-weight: 700; margin-bottom: 3px; }
.shock-btn-hint { font-size: 0.68rem; color: rgba(255, 200, 200, 0.6); font-style: italic; }

.shock-note {
    font-family: 'Courier New', monospace;
    font-size: 0.66rem;
    color: rgba(255, 200, 100, 0.55);
    padding: 10px 24px 18px;
    border-top: 1px solid rgba(255, 50, 50, 0.1);
    line-height: 1.5;
    font-style: italic;
}

/* ══════════════════════════════════════════════════════════════════════════════
   RATE CONSENSUS PANEL (Kalshi / Polymarket style)
══════════════════════════════════════════════════════════════════════════════ */

#rc-panel {
    background: var(--ch-bg);
    border: 1px solid var(--ch-border);
    border-radius: 8px;
    padding: 8px 10px;
    margin-top: 0;
    font-family: 'Courier New', monospace;
    box-shadow: 0 2px 16px rgba(0,0,0,0.6), 0 0 12px rgba(0, 229, 212, 0.06);
    backdrop-filter: blur(6px);
    font-size: 0.78rem;
}

.rc-head {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 4px;
}

.rc-icon  { font-size: 0.85rem; }

.rc-title {
    font-size: 0.62rem;
    font-weight: 800;
    letter-spacing: 0.2em;
    color: var(--ch-green);
    flex: 1;
}

.rc-links { display: flex; gap: 6px; }

.rc-link {
    font-size: 0.58rem;
    color: var(--ch-dim);
    text-decoration: none;
    letter-spacing: 0.08em;
    transition: color 0.2s;
}

.rc-link:hover { color: var(--ch-green); }

.rc-sub {
    font-size: 0.58rem;
    color: var(--ch-dim);
    margin-bottom: 10px;
}

/* Probability bars */
.rc-bars { display: flex; flex-direction: column; gap: 5px; margin-bottom: 10px; }

.rc-row {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 3px 5px;
    border-radius: 4px;
    transition: background 0.3s;
}

.rc-row.rc-dominant { background: rgba(255, 255, 255, 0.04); }

.rc-lbl {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    width: 32px;
    text-align: right;
}

.rc-cut  { color: var(--ch-cut);  }
.rc-hold { color: var(--ch-hold); }
.rc-hike { color: var(--ch-hike); }

.rc-track {
    flex: 1;
    height: 5px;
    background: rgba(255, 255, 255, 0.06);
    border-radius: 3px;
    overflow: hidden;
}

.rc-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

.rc-fill-cut  { background: var(--ch-cut);  }
.rc-fill-hold { background: var(--ch-hold); }
.rc-fill-hike { background: var(--ch-hike); }

.rc-pct {
    font-size: 0.6rem;
    color: var(--ch-dim);
    width: 30px;
    text-align: right;
}

/* Verdict */
.rc-verdict {
    font-size: 0.62rem;
    padding: 5px 6px;
    border-radius: 4px;
    margin-bottom: 5px;
    line-height: 1.4;
}

.rc-agree { color: #44dd88; background: rgba(50, 200, 100, 0.08); }
.rc-contra { color: var(--ch-amber); background: rgba(255, 176, 0, 0.08); }

.rc-taylor {
    font-size: 0.58rem;
    color: var(--ch-dim);
    margin-bottom: 2px;
}

.rc-sentiment {
    font-size: 0.62rem;
    color: var(--ch-green);
    letter-spacing: 0.12em;
    font-weight: 700;
}

/* ── Live badge ────────────────────────────────────────────────────────────── */

.rc-live-badge {
    display: block;
    font-family: 'Courier New', monospace;
    font-size: 0.58rem;
    font-weight: 800;
    color: #ff4444;
    letter-spacing: 0.15em;
    margin-bottom: 4px;
    animation: rc-live-pulse 2s ease-in-out infinite;
}

@keyframes rc-live-pulse {
    0%, 100% { opacity: 1; }
    50%       { opacity: 0.6; }
}

/* ── Metaculus forecasts strip ─────────────────────────────────────────────── */

.rc-metaculus {
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid rgba(0, 229, 212, 0.1);
}

.rcm-head {
    font-family: 'Courier New', monospace;
    font-size: 0.58rem;
    letter-spacing: 0.18em;
    color: var(--ch-dim);
    margin-bottom: 6px;
}

.rcm-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    margin-bottom: 3px;
}

.rcm-label {
    font-family: 'Courier New', monospace;
    font-size: 0.58rem;
    color: rgba(160, 200, 220, 0.5);
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding-right: 8px;
}

.rcm-val {
    font-family: 'Courier New', monospace;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--ch-green);
    white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════════════════════════
   COCKPIT FX — Gears, Steam, Flicker, Ripple
══════════════════════════════════════════════════════════════════════════════ */

/* Gear overlay layer */
#fx-gear-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 100;
    overflow: hidden;
}

/* Gear SVG positions */
.fx-gear {
    position: absolute;
    opacity: 0.7;
}

.fx-gear-bl { bottom: 40px; left: 20px;  width: 90px;  height: 90px; }
.fx-gear-br { bottom: 55px; right: 28px; width: 55px;  height: 55px; }
.fx-gear-tr { top: 70px;   right: 14px; width: 44px;  height: 44px; opacity: 0.4; }

/* Steam vent decals */
.fx-vent {
    position: absolute;
    bottom: 38%;
    width: 6px;
    height: 32px;
    border-radius: 3px;
    background: repeating-linear-gradient(
        0deg,
        rgba(200, 150, 10, 0.25) 0px,
        rgba(200, 150, 10, 0.25) 4px,
        transparent 4px,
        transparent 8px
    );
}
.fx-vent-l { left: 12px; }
.fx-vent-r { right: 12px; }

/* Steam particles */
.fx-steam-particle {
    position: fixed;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(220,190,120,0.7) 0%, rgba(220,190,120,0) 70%);
    pointer-events: none;
    z-index: 9500;
    animation: fx-steam-rise var(--dur, 800ms) ease-out forwards;
}

@keyframes fx-steam-rise {
    0%   { opacity: 0.8; transform: translate(0, 0) scale(1); }
    100% { opacity: 0;   transform: translate(var(--drift-x, 0), var(--drift-y, -60px)) scale(var(--scale-end, 2)); }
}

/* Screen flicker overlay */
.fx-flicker {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 9200;
    opacity: 0;
    transition: opacity 0.08s step-start;
}

/* Pressure ring pulse */
.fx-pressure-ring {
    position: fixed;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: 2px solid rgba(255, 80, 0, 0.8);
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 9300;
    animation: fx-ring-expand 0.9s ease-out forwards;
}

@keyframes fx-ring-expand {
    0%   { opacity: 0.9; transform: translate(-50%, -50%) scale(0.5); }
    100% { opacity: 0;   transform: translate(-50%, -50%) scale(2.5); }
}

/* Button ripple */
.fx-ripple {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    pointer-events: none;
    animation: fx-ripple-expand 0.55s ease-out forwards;
}

@keyframes fx-ripple-expand {
    0%   { opacity: 0.8; transform: translate(-50%, -50%) scale(1); }
    100% { opacity: 0;   transform: translate(-50%, -50%) scale(14); }
}

/* ══════════════════════════════════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════════════════════════════════ */

@media (max-width: 640px) {
    .xp-hud {
        top: auto;
        bottom: 0;
        right: 0;
        left: 0;
        border-radius: 0;
        justify-content: center;
        border-left: none;
        border-right: none;
        border-bottom: none;
    }

    .xp-bar-outer { width: 60px; }

    .shock-inner { width: 96vw; }
    .shock-title { font-size: 1.1rem; }

    #rc-panel { margin-top: 8px; }
}
