/* Polystar page: the look of the game (night-blue space, neon cyan and violet outlines, gold stars, clean geometric type).
   Only loaded on /games/polystar; the site header and footer keep Blurrydream's style. */

body.theme-polystar {
    --bg: #0A0E18;
    --surface: rgba(21, 27, 42, 0.78);
    --surface-strong: #1B2236;
    --border: rgba(79, 216, 235, 0.14);
    --ps-cyan: #4FD8EB;
    --ps-cyan-soft: rgba(79, 216, 235, 0.14);
    --ps-violet: #A855F7;
    --ps-gold: #F2C14E;
    --ps-pink: #FF5CA8;
    --ps-orange: #FF9A4D;
    --ps-ink: #08111C;
    --ps-font: 'Outfit', var(--font-display);
    --muted: rgba(226, 236, 248, 0.74);
    --faint: rgba(226, 236, 248, 0.5);
    background: var(--bg);
}

/* the teal haze behind the phones of the store screenshots, with a faint polar grid */
body.theme-polystar::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -2;
    background:
        radial-gradient(ellipse 55% 45% at 50% 0%, rgba(79, 216, 235, 0.14), transparent 70%),
        radial-gradient(ellipse 50% 40% at 100% 100%, rgba(168, 85, 247, 0.12), transparent 70%),
        repeating-radial-gradient(circle at 50% 0%, transparent 0 79px, rgba(79, 216, 235, 0.05) 79px 80px),
        var(--bg);
    pointer-events: none;
}

.theme-polystar #bg {
    background: transparent;
}

.theme-polystar .section-title {
    font-family: var(--ps-font);
    font-weight: 800;
    font-size: clamp(32px, 4.6vw, 50px);
    letter-spacing: 0;
    color: #fff;
}

.theme-polystar .section-subtitle {
    color: var(--muted);
    font-family: var(--ps-font);
}

.theme-polystar .breadcrumb a:hover {
    color: var(--ps-cyan);
}

.theme-polystar .btn-ghost {
    color: #fff;
    font-family: var(--ps-font);
    font-weight: 600;
}

.theme-polystar .btn-ghost:hover {
    border-color: var(--ps-cyan);
    color: var(--ps-cyan);
}

/* ---------- Hero ---------- */

.ps-hero-grid {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: clamp(32px, 6vw, 72px);
    align-items: center;
    margin-top: 18px;
}

.ps-brand-top {
    display: flex;
    align-items: center;
    gap: 16px;
}

.ps-icon {
    width: clamp(80px, 10vw, 108px);
    height: auto;
    border-radius: 24%;
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--ps-violet), 0 0 40px rgba(79, 216, 235, 0.3);
}

.ps-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    background: var(--ps-cyan-soft);
    border: 2px solid var(--ps-cyan);
    border-radius: 999px;
    color: var(--ps-cyan);
    font-family: var(--ps-font);
    font-weight: 700;
    font-size: 15px;
}

.ps-badge .pulse-dot {
    background: var(--ps-cyan);
}

.ps-logo {
    margin: 20px 0 6px;
    font-family: var(--ps-font);
    font-weight: 800;
    font-size: clamp(58px, 9vw, 104px);
    line-height: 0.95;
    background: linear-gradient(90deg, #fff 0%, var(--ps-cyan) 55%, var(--ps-violet) 100%);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
}

.ps-logo span {
    display: block;
    margin-top: 8px;
    background: none;
    color: var(--ps-gold);
    -webkit-text-fill-color: var(--ps-gold);
    font-size: 0.36em;
    font-weight: 700;
    letter-spacing: 8px;
    text-transform: uppercase;
}

.ps-tagline {
    font-family: var(--ps-font);
    font-weight: 700;
    font-size: clamp(22px, 3vw, 30px);
    color: #fff;
}

.ps-sub {
    color: var(--ps-cyan);
    font-size: clamp(17px, 2vw, 20px);
}

.ps-text {
    max-width: 560px;
    margin: 16px 0 28px;
    color: var(--muted);
}

.ps-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}

/* the cyan "buy" buttons of the game */
.ps-appstore {
    background: var(--ps-cyan);
    color: var(--ps-ink);
    font-family: var(--ps-font);
    font-weight: 700;
    box-shadow: 0 10px 30px rgba(79, 216, 235, 0.28);
}

.ps-appstore:hover {
    background: #74E3F2;
    box-shadow: 0 14px 40px rgba(79, 216, 235, 0.45);
}

.ps-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin: 28px 0 18px;
}

.ps-stats div {
    min-width: 96px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
}

.ps-stats dt {
    color: var(--ps-gold);
    font-family: var(--ps-font);
    font-weight: 800;
    font-size: 28px;
    line-height: 1;
}

.ps-stats dd {
    color: var(--faint);
    font-size: 13px;
}

.ps-systems {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    list-style: none;
}

.ps-systems li {
    padding: 4px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--faint);
    font-size: 13px;
}

/* ---------- Playable universe (the main screen of the game) ---------- */

.ps-try {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.ps-phone {
    width: min(100%, 340px);
    padding: 22px 16px 16px;
    background: #0D121D;
    border: 3px solid #2A3245;
    border-radius: 40px;
    color: #fff;
    font-family: var(--ps-font);
    box-shadow: 0 30px 70px rgba(0, 0, 0, 0.7), 0 0 70px rgba(79, 216, 235, 0.14), inset 0 0 0 2px #05080F;
}

.ps-counter {
    display: grid;
    justify-items: center;
    text-align: center;
}

.ps-counter-label {
    color: var(--faint);
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 1px;
    text-transform: uppercase;
}

.ps-counter-value {
    font-weight: 700;
    font-size: 38px;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.ps-counter-rate {
    color: var(--ps-cyan);
    font-weight: 600;
    font-size: 13px;
}

.ps-counter-row {
    display: flex;
    justify-content: space-between;
    width: 100%;
    margin-top: 10px;
    padding: 0 4px;
    color: var(--muted);
    font-size: 12px;
}

.ps-stage {
    position: relative;
    margin: 4px auto;
    aspect-ratio: 1;
    width: 100%;
}

.ps-canvas {
    display: block;
    width: 100%;
    height: 100%;
}

/* the core is a real button on top of the drawn one */
.ps-core {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 72px;
    height: 72px;
    background: none;
    border: 0;
    border-radius: 50%;
    cursor: pointer;
    transform: translate(-50%, -50%);
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
}

.ps-core:focus-visible {
    outline: 2px solid var(--ps-gold);
    outline-offset: 4px;
}

.ps-star {
    position: absolute;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: none;
    border: 0;
    color: var(--ps-gold);
    cursor: pointer;
    transform: translate(-50%, -50%);
    filter: drop-shadow(0 0 10px rgba(242, 193, 78, 0.9));
    animation: ps-star 1.2s ease-in-out infinite alternate;
}

.ps-star[hidden] {
    display: none;
}

.ps-star svg {
    width: 30px;
    height: 30px;
}

@keyframes ps-star {
    from { transform: translate(-50%, -50%) rotate(-12deg) scale(0.92); }
    to   { transform: translate(-50%, -50%) rotate(12deg) scale(1.08); }
}

.ps-toast {
    position: absolute;
    bottom: 6px;
    left: 50%;
    padding: 4px 12px;
    background: rgba(242, 193, 78, 0.15);
    border: 1px solid var(--ps-gold);
    border-radius: 999px;
    color: var(--ps-gold);
    font-weight: 700;
    font-size: 13px;
    white-space: nowrap;
    opacity: 0;
    transform: translate(-50%, 6px);
    transition: opacity 0.25s ease, transform 0.25s ease;
    pointer-events: none;
}

.ps-toast.is-on {
    opacity: 1;
    transform: translate(-50%, 0);
}

.ps-tabs {
    display: flex;
    gap: 14px;
    margin: 4px 4px 8px;
    color: var(--faint);
    font-size: 13px;
}

.ps-tabs .is-active {
    padding: 2px 10px;
    background: var(--ps-cyan-soft);
    border-radius: 8px;
    color: var(--ps-cyan);
    font-weight: 600;
}

.ps-shop {
    display: grid;
    gap: 6px;
    list-style: none;
}

.ps-item {
    --shape: var(--ps-pink);
    display: grid;
    grid-template-columns: 36px 1fr auto;
    gap: 10px;
    align-items: center;
    padding: 7px 8px 7px 10px;
    background: #151B2A;
    border-left: 3px solid var(--shape);
    border-radius: 10px;
}

.ps-item--2 { --shape: var(--ps-orange); }
.ps-item--3 { --shape: var(--ps-violet); }
.ps-item--4 { --shape: var(--ps-cyan); }

.ps-item-icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.04);
    border-radius: 50%;
    color: var(--shape);
}

.ps-item-icon svg {
    width: 24px;
    height: 24px;
}

.ps-item-info {
    display: grid;
    min-width: 0;
}

.ps-item-name {
    font-weight: 700;
    font-size: 14px;
}

.ps-item-name b {
    color: var(--shape);
    font-weight: 700;
}

.ps-item-rate {
    color: var(--faint);
    font-size: 11px;
}

.ps-buy {
    display: grid;
    min-width: 74px;
    padding: 4px 8px;
    background: var(--ps-cyan);
    border: 0;
    border-radius: 8px;
    color: var(--ps-ink);
    font: inherit;
    line-height: 1.1;
    cursor: pointer;
    transition: background-color 0.15s ease, opacity 0.15s ease, transform 0.1s ease;
}

.ps-buy:hover:not(:disabled) {
    background: #74E3F2;
}

.ps-buy:active:not(:disabled) {
    transform: scale(0.95);
}

.ps-buy:focus-visible {
    outline: 2px solid var(--ps-gold);
    outline-offset: 2px;
}

.ps-buy:disabled {
    opacity: 0.35;
    cursor: default;
}

.ps-buy-label {
    font-size: 9px;
    font-weight: 600;
    text-transform: uppercase;
}

.ps-buy-cost {
    font-weight: 800;
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.ps-try-caption {
    margin-top: 16px;
    color: var(--ps-cyan);
    font-family: var(--ps-font);
    font-weight: 700;
    font-size: 18px;
    letter-spacing: 1px;
}

/* ---------- From a point to a universe ---------- */

.ps-path {
    position: relative;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 18px;
    list-style: none;
}

/* the thread that links the shapes, like the lines between the orbits of the game */
.ps-path::before {
    content: '';
    position: absolute;
    top: 44px;
    right: 10%;
    left: 10%;
    height: 2px;
    background: linear-gradient(90deg, var(--ps-pink), var(--ps-orange), var(--ps-violet), var(--ps-gold), var(--ps-cyan));
    opacity: 0.6;
}

.ps-step {
    position: relative;
    text-align: center;
}

.ps-node {
    display: grid;
    place-items: center;
    width: 88px;
    height: 88px;
    margin: 0 auto 16px;
    background: #0D121D;
    border: 2px solid currentColor;
    border-radius: 50%;
    color: var(--ps-pink);
    box-shadow: 0 0 0 6px var(--bg), 0 0 30px color-mix(in srgb, currentColor 35%, transparent);
    transition: transform 0.3s ease;
}

.ps-step:nth-child(2) .ps-node { color: var(--ps-orange); }
.ps-step:nth-child(3) .ps-node { color: var(--ps-violet); }
.ps-step:nth-child(4) .ps-node { color: var(--ps-gold); }
.ps-step:nth-child(5) .ps-node { color: var(--ps-cyan); }

.ps-step:hover .ps-node {
    transform: rotate(15deg) scale(1.06);
}

.ps-node svg {
    width: 46px;
    height: 46px;
    filter: drop-shadow(0 0 6px currentColor);
}

/* the Big Bang: the whole universe collapsing into a bright point */
.ps-node-bang {
    width: 22px;
    height: 22px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 0 0 8px rgba(79, 216, 235, 0.25), 0 0 0 18px rgba(79, 216, 235, 0.1), 0 0 30px 10px rgba(255, 255, 255, 0.6);
    animation: ps-bang 2.4s ease-in-out infinite;
}

@keyframes ps-bang {
    0%, 100% { transform: scale(0.8); }
    50%      { transform: scale(1.15); }
}

.ps-step h3 {
    font-family: var(--ps-font);
    font-weight: 700;
    font-size: 21px;
    line-height: 1.15;
}

.ps-step p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 15px;
}

/* ---------- Calm ---------- */

.ps-calm {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: clamp(28px, 6vw, 64px);
    align-items: center;
    padding: clamp(24px, 4vw, 40px);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 28px;
}

.ps-mandala {
    width: 100%;
    height: auto;
}

.ps-cyan { color: var(--ps-cyan); }
.ps-violet { color: var(--ps-violet); }

.ps-ring {
    transform-origin: 0 0;
    animation: ps-turn 60s linear infinite;
}

.ps-ring--2 {
    animation-duration: 80s;
    animation-direction: reverse;
}

.ps-ring--3 {
    animation-duration: 120s;
}

@keyframes ps-turn {
    to { transform: rotate(360deg); }
}

.ps-mandala-core {
    fill: #fff;
    filter: drop-shadow(0 0 12px rgba(180, 240, 255, 0.9));
}

.ps-calm-body p {
    max-width: 480px;
    margin-top: 10px;
    color: var(--muted);
    font-size: 18px;
}

/* ---------- Gallery ---------- */

.ps-gallery {
    justify-content: safe center;
}

.ps-gallery .gallery-item {
    border-radius: 16px;
    border: 1px solid var(--border);
    transition: transform 0.25s ease, border-color 0.25s ease, box-shadow 0.25s ease;
}

.ps-gallery .gallery-item:hover {
    transform: translateY(-6px);
    border-color: var(--ps-cyan);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(79, 216, 235, 0.3);
}

/* ---------- CTA ---------- */

.ps-cta {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: clamp(36px, 6vw, 60px) var(--gutter);
    background:
        repeating-radial-gradient(circle at 50% 50%, transparent 0 39px, rgba(255, 255, 255, 0.06) 39px 40px),
        radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.25), transparent 50%),
        linear-gradient(135deg, var(--ps-cyan), var(--ps-violet));
    border-radius: 28px;
    color: var(--ps-ink);
    text-align: center;
    box-shadow: 0 24px 60px rgba(79, 216, 235, 0.2);
}

.ps-cta-icon {
    width: 88px;
    height: auto;
    border-radius: 24%;
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}

.ps-cta-title {
    margin: 14px 0 4px;
    font-family: var(--ps-font);
    font-weight: 800;
    font-size: clamp(40px, 6vw, 68px);
    line-height: 1;
}

.ps-cta-text {
    margin-bottom: 26px;
    font-size: 18px;
    font-weight: 500;
}

.ps-cta .ps-appstore {
    background: var(--ps-ink);
    color: #fff;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
}

.ps-cta .ps-appstore:hover {
    background: #000;
}

@media (max-width: 860px) {
    .ps-hero-grid,
    .ps-calm {
        grid-template-columns: 1fr;
    }

    .ps-brand,
    .ps-calm-body {
        text-align: center;
    }

    .ps-brand-top,
    .ps-actions,
    .ps-stats,
    .ps-systems {
        justify-content: center;
    }

    .ps-text,
    .ps-calm-body p {
        margin-left: auto;
        margin-right: auto;
    }

    .ps-mandala {
        max-width: 280px;
        margin: 0 auto;
    }

    .ps-stats {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        max-width: 460px;
        margin-left: auto;
        margin-right: auto;
    }

    .ps-stats div {
        min-width: 0;
        padding: 10px 6px;
    }

    /* the thread runs down the left edge */
    .ps-path {
        grid-template-columns: 1fr;
        gap: 22px;
    }

    .ps-path::before {
        top: 30px;
        bottom: 30px;
        left: 35px;
        right: auto;
        width: 2px;
        height: auto;
        background: linear-gradient(180deg, var(--ps-pink), var(--ps-orange), var(--ps-violet), var(--ps-gold), var(--ps-cyan));
    }

    .ps-step {
        display: grid;
        grid-template-columns: 70px 1fr;
        column-gap: 18px;
        text-align: left;
    }

    .ps-node {
        grid-row: span 2;
        width: 70px;
        height: 70px;
        margin: 0;
    }

    .ps-node svg {
        width: 36px;
        height: 36px;
    }
}

@media (max-width: 560px) {
    .ps-stats {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 380px) {
    .ps-phone {
        padding: 18px 10px 10px;
    }

    .ps-buy {
        min-width: 64px;
    }
}

@media (prefers-reduced-motion: reduce) {
    .ps-ring,
    .ps-star,
    .ps-node-bang {
        animation: none;
    }
}
