/* ============================================================
   UnlockPool Phase 13
   Next-generation Homepage / Mission Control
============================================================ */

:root {
    --p13-bg: #050a12;
    --p13-panel: rgba(13, 23, 40, 0.86);
    --p13-panel-2: rgba(10, 18, 32, 0.92);
    --p13-line: rgba(133, 178, 229, 0.20);
    --p13-line-strong: rgba(141, 217, 255, 0.38);
    --p13-text: #f3f7ff;
    --p13-muted: #9fb0ca;
    --p13-cyan: #9fe8ff;
    --p13-blue: #77bdf0;
    --p13-green: #91e58f;
    --p13-orange: #f1aa48;
    --p13-danger: #f07c87;
    --p13-glow: 0 0 30px rgba(114, 210, 255, 0.13);
}

html {
    scroll-behavior: smooth;
}

body {
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -2;
    background:
        radial-gradient(circle at 18% 12%, rgba(76, 156, 214, 0.08), transparent 30%),
        radial-gradient(circle at 82% 28%, rgba(240, 138, 62, 0.05), transparent 28%),
        radial-gradient(circle at 50% 100%, rgba(98, 193, 255, 0.06), transparent 34%),
        #050a12;
}

body::after {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: -1;
    opacity: 0.35;
    background-image:
        linear-gradient(rgba(132, 180, 225, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(132, 180, 225, 0.03) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: linear-gradient(to bottom, black, transparent 88%);
}

/* Existing hero enhancement */
.p13-hero-live {
    position: relative;
    isolation: isolate;
}

.p13-hero-live::before {
    content: "";
    position: absolute;
    inset: -80px -120px;
    pointer-events: none;
    z-index: -1;
    background:
        radial-gradient(circle at 72% 42%, rgba(96, 205, 255, 0.12), transparent 32%),
        radial-gradient(circle at 76% 45%, rgba(118, 228, 152, 0.06), transparent 24%);
    animation: p13-hero-breathe 7s ease-in-out infinite;
}

@keyframes p13-hero-breathe {
    0%, 100% { opacity: 0.72; transform: scale(0.98); }
    50% { opacity: 1; transform: scale(1.02); }
}

/* Shared Phase 13 sections */
.p13-shell {
    width: min(1520px, calc(100% - 64px));
    margin: 42px auto 0;
}

.p13-section {
    position: relative;
    overflow: hidden;
    border: 1px solid var(--p13-line);
    border-radius: 26px;
    background:
        linear-gradient(145deg, rgba(18, 31, 53, 0.94), rgba(7, 14, 26, 0.94));
    box-shadow: var(--p13-glow);
}

.p13-section::before {
    content: "";
    position: absolute;
    width: 420px;
    height: 420px;
    right: -220px;
    top: -260px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(127, 220, 255, 0.12), transparent 66%);
    pointer-events: none;
}

.p13-kicker {
    margin: 0 0 10px;
    color: var(--p13-cyan);
    font-size: 13px;
    line-height: 1.2;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.p13-title {
    margin: 0;
    color: var(--p13-text);
    font-size: clamp(30px, 3vw, 54px);
    line-height: 1.04;
    letter-spacing: -0.035em;
}

.p13-subtitle {
    margin: 15px 0 0;
    max-width: 820px;
    color: var(--p13-muted);
    font-size: clamp(16px, 1.25vw, 20px);
    line-height: 1.7;
}

/* Mission Control */
.p13-mission {
    padding: clamp(24px, 4vw, 54px);
}

.p13-mission-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 30px;
    margin-bottom: 32px;
}

.p13-live-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    flex: 0 0 auto;
    padding: 11px 16px;
    border: 1px solid rgba(135, 223, 151, 0.28);
    border-radius: 999px;
    background: rgba(79, 164, 95, 0.12);
    color: #a5f1a2;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.p13-live-pill::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--p13-green);
    box-shadow: 0 0 0 0 rgba(145, 229, 143, 0.55);
    animation: p13-pulse 1.8s ease-out infinite;
}

@keyframes p13-pulse {
    0% { box-shadow: 0 0 0 0 rgba(145, 229, 143, 0.55); }
    70% { box-shadow: 0 0 0 12px rgba(145, 229, 143, 0); }
    100% { box-shadow: 0 0 0 0 rgba(145, 229, 143, 0); }
}

.p13-metric-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    border: 1px solid var(--p13-line);
    border-radius: 20px;
    overflow: hidden;
    background: rgba(4, 10, 19, 0.54);
}

.p13-metric {
    min-height: 154px;
    padding: 24px;
    border-right: 1px solid var(--p13-line);
    position: relative;
}

.p13-metric:last-child {
    border-right: 0;
}

.p13-metric-label {
    display: block;
    color: #8294b2;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.p13-metric-value {
    display: block;
    margin-top: 18px;
    color: var(--p13-text);
    font-size: clamp(25px, 2.2vw, 38px);
    line-height: 1;
    font-weight: 800;
    letter-spacing: -0.035em;
}

.p13-metric-note {
    display: block;
    margin-top: 12px;
    color: var(--p13-muted);
    font-size: 12px;
    line-height: 1.45;
}

.p13-metric-change {
    animation: p13-number-flash 0.65s ease;
}

@keyframes p13-number-flash {
    0% { color: white; text-shadow: 0 0 22px rgba(159, 232, 255, 0.9); transform: translateY(-3px); }
    100% { color: var(--p13-text); text-shadow: none; transform: translateY(0); }
}

/* Flow */
.p13-flow-section {
    margin-top: 30px;
    padding: clamp(24px, 3.8vw, 48px);
}

.p13-flow {
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    align-items: stretch;
    gap: 0;
    margin-top: 30px;
}

.p13-flow-node {
    position: relative;
    min-height: 180px;
    padding: 28px 22px;
    border: 1px solid var(--p13-line);
    background: rgba(5, 12, 23, 0.70);
    text-align: center;
}

.p13-flow-node:first-child {
    border-radius: 18px 0 0 18px;
}

.p13-flow-node:last-child {
    border-radius: 0 18px 18px 0;
}

.p13-flow-node + .p13-flow-node {
    border-left: 0;
}

.p13-flow-icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    margin: 0 auto 18px;
    border: 1px solid rgba(147, 226, 255, 0.35);
    border-radius: 15px;
    color: var(--p13-cyan);
    font-size: 22px;
    background: rgba(80, 168, 211, 0.08);
}

.p13-flow-name {
    color: var(--p13-text);
    font-size: 18px;
    font-weight: 800;
}

.p13-flow-state {
    margin-top: 10px;
    color: var(--p13-green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.p13-flow-node::after {
    content: "";
    position: absolute;
    top: 50%;
    right: -1px;
    width: 46%;
    height: 2px;
    background: linear-gradient(90deg, transparent, var(--p13-cyan), transparent);
    transform: translate(50%, -50%);
    z-index: 3;
    opacity: 0.82;
    animation: p13-data-run 2.2s linear infinite;
}

.p13-flow-node:last-child::after {
    display: none;
}

@keyframes p13-data-run {
    0% { opacity: 0.16; background-position: -80px 0; }
    50% { opacity: 1; }
    100% { opacity: 0.16; background-position: 80px 0; }
}

/* Activity / AI */
.p13-two-col {
    display: grid;
    grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
    gap: 30px;
    margin-top: 30px;
}

.p13-activity,
.p13-ai {
    padding: clamp(24px, 3.5vw, 44px);
}

.p13-feed {
    margin-top: 28px;
    border-top: 1px solid var(--p13-line);
}

.p13-event {
    display: grid;
    grid-template-columns: 88px 14px 1fr auto;
    align-items: center;
    gap: 16px;
    min-height: 78px;
    border-bottom: 1px solid var(--p13-line);
}

.p13-event-time {
    color: #8194b1;
    font-size: 12px;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.p13-event-dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--p13-green);
    box-shadow: 0 0 15px rgba(145, 229, 143, 0.65);
}

.p13-event-body strong {
    display: block;
    color: var(--p13-text);
    font-size: 15px;
}

.p13-event-body span {
    display: block;
    margin-top: 5px;
    color: var(--p13-muted);
    font-size: 13px;
}

.p13-event-value {
    color: var(--p13-cyan);
    font-size: 13px;
    font-weight: 800;
    text-align: right;
}

.p13-ai-score {
    display: flex;
    align-items: center;
    gap: 24px;
    margin-top: 26px;
    padding: 22px;
    border: 1px solid var(--p13-line);
    border-radius: 20px;
    background: rgba(4, 10, 19, 0.55);
}

.p13-ai-orb {
    position: relative;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    width: 112px;
    height: 112px;
    border-radius: 50%;
    background:
        radial-gradient(circle at center, #0a1323 58%, transparent 59%),
        conic-gradient(var(--p13-cyan) calc(var(--p13-score, 90) * 1%), rgba(56, 76, 106, 0.35) 0);
    box-shadow: 0 0 34px rgba(127, 221, 255, 0.13);
}

.p13-ai-orb strong {
    color: white;
    font-size: 34px;
}

.p13-ai-copy h3 {
    margin: 0;
    color: var(--p13-text);
    font-size: 24px;
}

.p13-ai-copy p {
    margin: 8px 0 0;
    color: var(--p13-muted);
    line-height: 1.65;
}

.p13-ai-list {
    display: grid;
    gap: 12px;
    margin-top: 22px;
}

.p13-ai-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 15px 16px;
    border: 1px solid var(--p13-line);
    border-radius: 14px;
    color: var(--p13-muted);
    background: rgba(5, 12, 23, 0.52);
}

.p13-ai-item::before {
    content: "✓";
    display: grid;
    place-items: center;
    width: 25px;
    height: 25px;
    flex: 0 0 auto;
    border-radius: 50%;
    color: var(--p13-green);
    background: rgba(92, 176, 100, 0.14);
}

/* Atlas */
.p13-atlas {
    margin-top: 30px;
    padding: clamp(24px, 3.8vw, 48px);
}

.p13-atlas-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 28px;
    margin-top: 30px;
}

.p13-world {
    position: relative;
    min-height: 340px;
    overflow: hidden;
    border: 1px solid var(--p13-line);
    border-radius: 20px;
    background:
        radial-gradient(circle at 50% 50%, rgba(78, 161, 208, 0.09), transparent 54%),
        linear-gradient(rgba(126, 173, 219, 0.05) 1px, transparent 1px),
        linear-gradient(90deg, rgba(126, 173, 219, 0.05) 1px, transparent 1px),
        rgba(3, 9, 17, 0.55);
    background-size: auto, 56px 56px, 56px 56px, auto;
}

.p13-world::before,
.p13-world::after {
    content: "";
    position: absolute;
    border: 1px solid rgba(143, 215, 255, 0.18);
    border-radius: 50%;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
}

.p13-world::before {
    width: 70%;
    height: 70%;
}

.p13-world::after {
    width: 45%;
    height: 45%;
    border-style: dashed;
}

.p13-globe-core {
    position: absolute;
    inset: 50% auto auto 50%;
    transform: translate(-50%, -50%);
    z-index: 2;
    display: grid;
    place-items: center;
    width: 120px;
    height: 120px;
    border: 1px solid rgba(159, 232, 255, 0.48);
    border-radius: 50%;
    color: white;
    font-size: 28px;
    font-weight: 800;
    background: rgba(6, 14, 26, 0.92);
    box-shadow: 0 0 34px rgba(119, 211, 255, 0.15);
}

.p13-map-dot {
    position: absolute;
    width: var(--dot-size, 12px);
    height: var(--dot-size, 12px);
    border-radius: 50%;
    background: var(--p13-green);
    box-shadow: 0 0 0 7px rgba(145, 229, 143, 0.08), 0 0 20px rgba(145, 229, 143, 0.6);
    animation: p13-dot-float var(--dot-speed, 5s) ease-in-out infinite;
}

@keyframes p13-dot-float {
    0%, 100% { transform: translateY(-3px) scale(0.95); opacity: 0.75; }
    50% { transform: translateY(4px) scale(1.08); opacity: 1; }
}

.p13-atlas-stats {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.p13-atlas-stat {
    min-height: 150px;
    padding: 22px;
    border: 1px solid var(--p13-line);
    border-radius: 18px;
    background: rgba(4, 10, 19, 0.58);
}

.p13-atlas-stat span {
    color: #8294b2;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.13em;
    text-transform: uppercase;
}

.p13-atlas-stat strong {
    display: block;
    margin-top: 18px;
    color: var(--p13-text);
    font-size: 34px;
}

.p13-atlas-stat small {
    display: block;
    margin-top: 8px;
    color: var(--p13-muted);
}

/* Hover */
.p13-section,
.p13-flow-node,
.p13-atlas-stat,
.p13-ai-item {
    transition:
        transform 0.25s ease,
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.p13-section:hover {
    border-color: rgba(147, 220, 255, 0.33);
}

.p13-flow-node:hover,
.p13-atlas-stat:hover,
.p13-ai-item:hover {
    transform: translateY(-3px);
    border-color: rgba(147, 220, 255, 0.38);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.17);
}

/* Footer spacing */
.p13-footer-gap {
    height: 70px;
}

/* Responsive */
@media (max-width: 1180px) {
    .p13-metric-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .p13-metric:nth-child(3) {
        border-right: 0;
    }

    .p13-metric:nth-child(-n+3) {
        border-bottom: 1px solid var(--p13-line);
    }

    .p13-flow {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .p13-flow-node,
    .p13-flow-node:first-child,
    .p13-flow-node:last-child {
        min-height: auto;
        border: 1px solid var(--p13-line);
        border-radius: 16px;
    }

    .p13-flow-node::after {
        top: auto;
        right: auto;
        bottom: -13px;
        left: 50%;
        width: 2px;
        height: 26px;
        transform: translateX(-50%);
    }

    .p13-two-col,
    .p13-atlas-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 720px) {
    .p13-shell {
        width: min(100% - 28px, 1520px);
        margin-top: 22px;
    }

    .p13-mission-head {
        display: block;
    }

    .p13-live-pill {
        margin-top: 20px;
    }

    .p13-metric-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .p13-metric {
        min-height: 132px;
        padding: 18px;
        border-bottom: 1px solid var(--p13-line);
    }

    .p13-metric:nth-child(odd) {
        border-right: 1px solid var(--p13-line);
    }

    .p13-metric:nth-child(even) {
        border-right: 0;
    }

    .p13-metric:nth-last-child(-n+2) {
        border-bottom: 0;
    }

    .p13-event {
        grid-template-columns: 72px 10px 1fr;
        padding: 12px 0;
    }

    .p13-event-value {
        grid-column: 3;
        text-align: left;
    }

    .p13-ai-score {
        align-items: flex-start;
        flex-direction: column;
    }

    .p13-atlas-stats {
        grid-template-columns: 1fr;
    }

    .p13-world {
        min-height: 280px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }
}
