/* Shared styling for the cookie choice dialog on the game, error page and documentation portal. */
.cookie-run-overlay {
    --font: 'IBM Plex Sans', system-ui, -apple-system, sans-serif;
    position: fixed;
    inset: 0;
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: rgba(5, 5, 12, 0.45);
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    pointer-events: none;
    overflow-y: auto;
}

.cookie-run-overlay.show {
    opacity: 1;
    visibility: visible;
}

.cookie-run-overlay.is-dismissed {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.cookie-run-card {
    width: min(640px, 100%);
    background: linear-gradient(145deg, rgba(18, 10, 32, 0.94), rgba(28, 14, 48, 0.92));
    border: none;
    border-radius: 20px;
    padding: 28px 32px 24px;
    box-shadow: 0 24px 80px rgba(88, 28, 135, 0.35);
    transform: translateY(24px) scale(0.96);
    transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
    pointer-events: auto;
    flex-shrink: 0;
    margin: auto;
    overflow: visible;
}

.cookie-run-body {
    display: flex;
    align-items: center;
    gap: 24px;
    margin: 24px 0 16px;
    overflow: visible;
}

.cookie-run-overlay.show .cookie-run-card {
    transform: translateY(0) scale(1);
}

.cookie-run-badge {
    display: inline-block;
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
    font-size: 0.7rem;
    font-weight: 600;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: #c084fc;
    background: rgba(168, 85, 247, 0.15);
    border: 1px solid rgba(168, 85, 247, 0.35);
    border-radius: 999px;
    padding: 4px 12px;
    margin-bottom: 10px;
}

.cookie-run-title {
    font-family: var(--font-display, 'Space Grotesk', sans-serif);
    font-size: 1.65rem;
    font-weight: 700;
    color: #fff;
    margin: 0 0 8px;
    line-height: 1.2;
}

.cookie-run-desc {
    font-family: var(--font);
    font-size: 0.95rem;
    color: rgba(255, 255, 255, 0.78);
    margin: 0;
    line-height: 1.55;
}

.cookie-run-robot-wrap {
    flex-shrink: 0;
    width: 100px;
    animation: cookieRobotDance 1.8s ease-in-out infinite;
    transform-origin: center bottom;
    position: relative;
    overflow: visible;
}

.cookie-run-robot-sprites {
    position: relative;
    width: 100%;
    min-height: 116px;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    overflow: visible;
}

.cookie-run-robot-badge {
    display: block;
    min-height: 1rem;
    margin-bottom: 4px;
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-align: center;
    text-transform: uppercase;
    color: transparent;
    opacity: 0;
    transform: translateY(4px) scale(0.92);
}

.cookie-run-robot {
    display: block;
    width: 100px;
    height: auto;
    filter: drop-shadow(0 8px 24px rgba(168, 85, 247, 0.4));
    opacity: 0;
    transform: scale(0.88);
    transition:
        opacity 0.35s ease,
        transform 0.55s cubic-bezier(0.22, 1, 0.36, 1),
        filter 0.45s ease,
        width 0.45s ease;
    position: absolute;
    bottom: 0;
    left: 50%;
    margin-left: -50px;
    pointer-events: none;
}

.cookie-run-robot.is-active {
    opacity: 1;
    transform: scale(1);
    position: relative;
    left: auto;
    margin-left: 0;
    transition:
        opacity 0.35s ease,
        filter 0.45s ease,
        width 0.45s ease;
}

.cookie-run-robot-wrap:not([class*="robot-outcome--"]) .cookie-run-robot.is-active {
    animation: cookieRobotJump 1.25s ease-in-out infinite;
}

.cookie-run-robot-wrap[class*="robot-outcome--"] .cookie-run-robot.is-active {
    animation: cookieRobotJump 1.15s ease-in-out 0.75s infinite;
}

.cookie-run-robot-wrap.robot-outcome--accepted {
    animation: cookieRobotLevelUp 0.95s cubic-bezier(0.22, 1, 0.36, 1) forwards;
    width: 118px;
}

.cookie-run-robot-wrap.robot-outcome--accepted .cookie-run-robot-badge {
    color: #fde68a;
    text-shadow: 0 0 14px rgba(251, 191, 36, 0.85);
    animation: cookieRobotBadgePop 0.55s ease-out 0.15s forwards;
}

.cookie-run-robot-wrap.robot-outcome--accepted .cookie-run-robot--accepted.is-active {
    width: 118px;
    object-fit: contain;
    filter: drop-shadow(0 0 18px rgba(251, 191, 36, 0.5)) drop-shadow(0 8px 22px rgba(168, 85, 247, 0.4));
}

.cookie-run-robot-wrap.robot-outcome--essential {
    animation: cookieRobotBabyBounce 0.85s ease-out forwards;
    width: 78px;
}

.cookie-run-robot-wrap.robot-outcome--essential .cookie-run-robot-badge {
    color: #f9a8d4;
    text-shadow: 0 0 10px rgba(249, 168, 212, 0.7);
    animation: cookieRobotBadgePop 0.5s ease-out 0.12s forwards;
}

.cookie-run-robot-wrap.robot-outcome--essential .cookie-run-robot--essential.is-active {
    width: 78px;
    filter: drop-shadow(0 6px 18px rgba(196, 181, 253, 0.55));
}

.cookie-run-robot-wrap.robot-outcome--rejected {
    animation: cookieRobotShutdown 0.8s ease-out forwards;
}

.cookie-run-robot-wrap.robot-outcome--rejected .cookie-run-robot-badge {
    color: #fca5a5;
    text-shadow: none;
    animation: cookieRobotBadgePop 0.45s ease-out 0.1s forwards;
}

.cookie-run-robot-wrap.robot-outcome--rejected .cookie-run-robot--rejected.is-active {
    filter: drop-shadow(0 4px 14px rgba(107, 114, 128, 0.45));
}

@keyframes cookieRobotLevelUp {
    0% { transform: translateY(0) scale(1); }
    35% { transform: translateY(-22px) scale(1.15); }
    65% { transform: translateY(-10px) scale(1.08) rotate(-2deg); }
    100% { transform: translateY(0) scale(1.05); }
}

@keyframes cookieRobotBabyBounce {
    0% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-16px) scale(0.92); }
    70% { transform: translateY(-4px) scale(0.96); }
    100% { transform: translateY(0) scale(0.98); }
}

@keyframes cookieRobotShutdown {
    0% { transform: translateY(0) rotate(0deg); opacity: 1; }
    35% { transform: translateY(-8px) rotate(-4deg); opacity: 0.95; }
    100% { transform: translateY(6px) rotate(-9deg); opacity: 0.92; }
}

@keyframes cookieRobotJump {
    0%, 100% { transform: translateY(0) scale(1); }
    45% { transform: translateY(-11px) scale(1.03); }
    70% { transform: translateY(-4px) scale(1.01); }
}

@keyframes cookieRobotBadgePop {
    0% { opacity: 0; transform: translateY(4px) scale(0.92); }
    70% { opacity: 1; transform: translateY(-2px) scale(1.06); }
    100% { opacity: 1; transform: translateY(0) scale(1); }
}

@keyframes cookieRobotDance {
    0%, 100% { transform: translateY(0) rotate(-2deg); }
    25% { transform: translateY(-10px) rotate(2deg); }
    50% { transform: translateY(-3px) rotate(-1deg); }
    75% { transform: translateY(-12px) rotate(3deg); }
}

.cookie-run-rail {
    flex: 1;
    position: relative;
    min-height: 80px;
    --cookie-run-progress: 0;
}

@property --cookie-run-progress {
    syntax: '<number>';
    inherits: true;
    initial-value: 0;
}

.cookie-run-rail-track {
    position: absolute;
    left: 8%;
    right: 8%;
    top: 38%;
    height: 8px;
    transform: translateY(-50%);
}

.cookie-run-rail-bg {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        rgba(168, 85, 247, 0.06) 0%,
        rgba(168, 85, 247, 0.18) 50%,
        rgba(168, 85, 247, 0.06) 100%
    );
    box-shadow:
        inset 0 1px 2px rgba(0, 0, 0, 0.45),
        inset 0 0 8px rgba(88, 28, 135, 0.25);
}

.cookie-run-rail-fill-wrap {
    position: absolute;
    inset: 1px;
    border-radius: 999px;
    overflow: hidden;
}

.cookie-run-rail-fill {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(
        90deg,
        var(--brand-purple-deep, #6b21a8) 0%,
        var(--brand-purple, #a855f7) 45%,
        var(--brand-purple-bright, #c084fc) 78%,
        #e9d5ff 100%
    );
    box-shadow:
        0 0 14px rgba(168, 85, 247, 0.55),
        0 0 28px rgba(192, 132, 252, 0.2);
    transform: scaleX(var(--cookie-run-progress, 0));
    transform-origin: left center;
    will-change: transform;
}

.cookie-run-rail.is-completing .cookie-run-rail-fill,
.cookie-run-rail.is-completing .cookie-run-rail-head {
    transition: none;
}

.cookie-run-rail-shimmer {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        105deg,
        transparent 0%,
        transparent 40%,
        rgba(255, 255, 255, 0.35) 50%,
        transparent 60%,
        transparent 100%
    );
    background-size: 200% 100%;
    animation: cookieRailShimmer 2.4s ease-in-out infinite;
}

.cookie-run-rail.is-idle .cookie-run-rail-shimmer {
    animation-duration: 3.2s;
}

.cookie-run-rail.is-entering,
.cookie-run-rail.is-idle {
    transition: none;
}

.cookie-run-overlay.is-complete .cookie-run-rail-fill {
    background: linear-gradient(
        90deg,
        var(--brand-purple-deep, #6b21a8) 0%,
        var(--brand-purple-bright, #c084fc) 60%,
        #f3e8ff 100%
    );
    box-shadow:
        0 0 18px rgba(168, 85, 247, 0.7),
        0 0 36px rgba(233, 213, 255, 0.35);
    transition-duration: 1.25s;
}

.cookie-run-overlay.is-complete .cookie-run-rail-shimmer {
    animation: cookieRailCompleteFlash 0.8s ease-out forwards;
}

.cookie-run-rail-head {
    position: absolute;
    top: 50%;
    left: calc(8% + (84% * var(--cookie-run-progress, 0)));
    width: 0;
    height: 0;
    transform: translate(-50%, -50%);
    pointer-events: none;
    z-index: 2;
}

.cookie-run-rail-head-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 12px;
    height: 12px;
    margin: -6px 0 0 -6px;
    border-radius: 50%;
    background: radial-gradient(circle at 35% 35%, #fff 0%, #e9d5ff 35%, #c084fc 100%);
    box-shadow:
        0 0 0 2px rgba(168, 85, 247, 0.4),
        0 0 14px rgba(192, 132, 252, 0.95),
        0 0 28px rgba(168, 85, 247, 0.5);
}

.cookie-run-rail-head-ring {
    position: absolute;
    top: 50%;
    left: 50%;
    border-radius: 50%;
    border: 1px solid rgba(192, 132, 252, 0.55);
    transform: translate(-50%, -50%);
    animation: cookieRailHeadRing 2.2s ease-out infinite;
}

.cookie-run-rail-head-ring--outer {
    width: 28px;
    height: 28px;
    animation-delay: 0s;
}

.cookie-run-rail-head-ring--inner {
    width: 20px;
    height: 20px;
    animation-delay: 0.55s;
}

.cookie-run-overlay.is-complete .cookie-run-rail-head-ring {
    animation: cookieRailHeadBurst 0.7s ease-out forwards;
}

@keyframes cookieRailShimmer {
    0% { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

@keyframes cookieRailHeadRing {
    0% {
        opacity: 0.85;
        transform: translate(-50%, -50%) scale(0.65);
    }
    70% {
        opacity: 0.15;
        transform: translate(-50%, -50%) scale(1.35);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(1.5);
    }
}

@keyframes cookieRailHeadBurst {
    0% {
        opacity: 1;
        transform: translate(-50%, -50%) scale(1);
    }
    100% {
        opacity: 0;
        transform: translate(-50%, -50%) scale(2.2);
    }
}

@keyframes cookieRailCompleteFlash {
    0% { opacity: 1; }
    100% { opacity: 0; }
}

@keyframes cookieRunRailEnter {
    0% { --cookie-run-progress: 0; }
    38% { --cookie-run-progress: 0.33; }
    72% { --cookie-run-progress: 0.5; }
    100% { --cookie-run-progress: 0.5; }
}

.cookie-run-rail.is-entering {
    animation: cookieRunRailEnter 1.9s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.cookie-run-rail.is-entering .cookie-run-rail-fill,
.cookie-run-rail.is-entering .cookie-run-rail-head {
    transition: none;
}

.cookie-run-rail.is-idle {
    --cookie-run-progress: 0.5;
    animation: cookieRailIdleBreath 3.5s ease-in-out infinite;
}

@keyframes cookieRailIdleBreath {
    0%, 100% { --cookie-run-progress: 0.47; }
    50% { --cookie-run-progress: 0.53; }
}

.cookie-run-rail-nodes {
    position: relative;
    display: flex;
    justify-content: space-between;
    list-style: none;
    margin: 0;
    padding: 0 4%;
    height: 80px;
    align-items: flex-end;
}

.cookie-run-rail-node {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    width: 33.33%;
}

.cookie-run-rail-node-dot {
    position: relative;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: rgba(18, 10, 32, 0.95);
    border: 2px solid rgba(168, 85, 247, 0.3);
    transition:
        transform 0.5s cubic-bezier(0.22, 1, 0.36, 1),
        background 0.45s ease,
        border-color 0.45s ease,
        box-shadow 0.45s ease;
    z-index: 1;
}

.cookie-run-rail-node-dot::after {
    content: '';
    position: absolute;
    inset: -6px;
    border-radius: 50%;
    border: 1px solid transparent;
    transition: border-color 0.45s ease, opacity 0.45s ease;
    opacity: 0;
}

.cookie-run-rail-node.is-lit .cookie-run-rail-node-dot {
    background: radial-gradient(circle at 35% 35%, #e9d5ff 0%, var(--brand-purple, #a855f7) 55%, #6b21a8 100%);
    border-color: var(--brand-purple-bright, #c084fc);
    box-shadow:
        0 0 10px rgba(168, 85, 247, 0.65),
        0 0 20px rgba(168, 85, 247, 0.25);
}

.cookie-run-rail-node.is-current .cookie-run-rail-node-dot {
    transform: scale(1.15);
    box-shadow:
        0 0 0 3px rgba(168, 85, 247, 0.2),
        0 0 16px rgba(192, 132, 252, 0.9),
        0 0 32px rgba(168, 85, 247, 0.35);
    animation: cookieNodePulse 2.4s ease-in-out infinite;
}

.cookie-run-rail-node.is-current .cookie-run-rail-node-dot::after {
    border-color: rgba(192, 132, 252, 0.45);
    opacity: 1;
    animation: cookieNodeRing 2.4s ease-out infinite;
}

.cookie-run-overlay.is-complete .cookie-run-rail-node.is-current .cookie-run-rail-node-dot {
    animation: cookieNodeComplete 0.6s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes cookieNodePulse {
    0%, 100% { transform: scale(1.15); }
    50% { transform: scale(1.28); }
}

@keyframes cookieNodeRing {
    0% {
        transform: scale(0.8);
        opacity: 0.7;
    }
    100% {
        transform: scale(1.6);
        opacity: 0;
    }
}

@keyframes cookieNodeComplete {
    0% { transform: scale(1.15); }
    50% { transform: scale(1.45); box-shadow: 0 0 24px rgba(233, 213, 255, 0.9); }
    100% { transform: scale(1.2); }
}

.cookie-run-rail-node-label {
    font-family: var(--font-mono, 'IBM Plex Mono', monospace);
    font-size: 0.65rem;
    color: rgba(255, 255, 255, 0.45);
    text-align: center;
    white-space: nowrap;
    transition: color 0.3s ease;
}

.cookie-run-rail-node.is-lit .cookie-run-rail-node-label,
.cookie-run-rail-node.is-current .cookie-run-rail-node-label {
    color: rgba(255, 255, 255, 0.85);
}

.cookie-run-policy {
    font-family: var(--font);
    font-size: 0.85rem;
    text-align: center;
    margin: 0 0 18px;
}

.cookie-run-policy a {
    color: #c084fc;
    text-decoration: underline;
    text-underline-offset: 2px;
}

.cookie-run-policy a:hover {
    color: #e9d5ff;
}

.cookie-run-buttons {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.cookie-run-btn {
    font-family: var(--font);
    width: 100%;
    padding: 14px 24px;
    border-radius: 14px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
    border: 2px solid transparent;
    letter-spacing: 0.03em;
}

.cookie-run-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
}

.cookie-run-btn--accept {
    background: linear-gradient(45deg, #8a2be2, #6b21a8);
    color: #fff;
    border: none;
    box-shadow: 0 4px 20px rgba(138, 43, 226, 0.4);
}

.cookie-run-btn--accept:hover:not(:disabled) {
    background: linear-gradient(45deg, #6b21a8, #8a2be2);
    transform: translateY(-2px);
    box-shadow: 0 8px 28px rgba(138, 43, 226, 0.55);
}

.cookie-run-btn--essential {
    background: transparent;
    color: rgba(255, 255, 255, 0.9);
    border-color: rgba(168, 85, 247, 0.5);
}

.cookie-run-btn--essential:hover:not(:disabled) {
    background: rgba(168, 85, 247, 0.12);
    border-color: #a855f7;
    transform: translateY(-1px);
}

.cookie-run-btn--reject {
    background: rgba(255, 255, 255, 0.04);
    color: rgba(255, 255, 255, 0.65);
    border-color: rgba(255, 255, 255, 0.15);
    font-size: 0.9rem;
    padding: 11px 24px;
}

.cookie-run-btn--reject:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.08);
    color: rgba(255, 255, 255, 0.85);
}

@media (prefers-reduced-motion: reduce) {
.cookie-run-robot-wrap {
        animation: none;
    }

.cookie-run-robot-wrap:not([class*="robot-outcome--"]) .cookie-run-robot.is-active,
    .cookie-run-robot-wrap[class*="robot-outcome--"] .cookie-run-robot.is-active {
        animation: none;
    }

.cookie-run-robot-wrap.robot-outcome--accepted,
    .cookie-run-robot-wrap.robot-outcome--essential,
    .cookie-run-robot-wrap.robot-outcome--rejected {
        animation: none;
    }

.cookie-run-robot-badge {
        animation: none;
        opacity: 1;
        transform: none;
    }

.cookie-run-rail-shimmer,
    .cookie-run-rail-head-ring,
    .cookie-run-rail-node.is-current .cookie-run-rail-node-dot,
    .cookie-run-rail-node.is-current .cookie-run-rail-node-dot::after {
        animation: none;
    }

.cookie-run-rail.is-entering,
    .cookie-run-rail.is-idle,
    .cookie-run-rail.is-completing {
        animation: none;
    }

.cookie-run-rail.is-idle {
        --cookie-run-progress: 0.5;
    }

.cookie-run-card,
    .cookie-run-overlay,
    .cookie-run-rail-fill,
    .cookie-run-rail-head {
        transition: none;
    }
}

@media (max-width: 768px) {
.cookie-run-body {
        flex-direction: column;
        gap: 16px;
    }

.cookie-run-robot-wrap.robot-outcome--accepted {
        width: 96px;
    }

.cookie-run-robot-wrap.robot-outcome--accepted .cookie-run-robot--accepted.is-active {
        width: 96px;
    }

.cookie-run-robot-wrap.robot-outcome--essential {
        width: 68px;
    }

.cookie-run-robot-wrap.robot-outcome--essential .cookie-run-robot--essential.is-active {
        width: 68px;
    }

.cookie-run-robot-wrap {
        width: 80px;
    }

.cookie-run-robot {
        width: 80px;
        margin-left: -40px;
    }

.cookie-run-robot.is-active {
        margin-left: 0;
    }

.cookie-run-rail-node-label {
        font-size: 0.58rem;
    }
}

@media (max-width: 480px) {
.cookie-run-card {
        padding: 22px 20px 18px;
    }

.cookie-run-title {
        font-size: 1.35rem;
    }
}
