/* ===== Shared ===== */
:root {
    --bg: #12152b;
    --bg2: #222a58;
    --ink: #ebe7ff;
    --muted: #a9a6d1;
    --glow: #f4b66a;
    --card: rgba(235, 231, 255, .07);
    --line: rgba(235, 231, 255, .14);
    box-sizing: border-box;
    padding-top: env(safe-area-inset-top, 0px);
    padding-bottom: env(safe-area-inset-bottom, 0px);
}

* {
    box-sizing: border-box
}

html {
    min-height: 100%;
    background: var(--bg);
    scroll-padding-top: env(safe-area-inset-top, 0px);
    scroll-behavior: smooth
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: "Quicksand", system-ui, -apple-system, "Segoe UI", sans-serif;
    color: var(--ink);
    background: radial-gradient(120% 90% at 50% 100%, var(--bg2) 0%, var(--bg) 70%) fixed;
}

footer {
    color: var(--muted);
    opacity: .8;
    text-align: center
}

.moon {
    position: relative;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--ink)
}

.moon::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: 50%;
    background: var(--bg);
    transform: translate(26%, -8%) scale(.86)
}

/* Pill buttons: site nav (topbar) + section nav (.nav) */
.topbar {
    display: flex;
    justify-content: center;
    gap: .5rem
}

.topbar a,
.nav a {
    flex: 0 0 auto;
    padding: .45rem .95rem;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card);
    color: var(--muted);
    font-size: .9rem;
    font-weight: 600;
    text-decoration: none;
    transition: color .15s, border-color .15s, background .15s;
}

.topbar a:hover,
.topbar a:focus-visible,
.topbar a[aria-current="page"],
.nav a:hover,
.nav a:focus-visible,
.nav a.active {
    color: var(--ink);
    border-color: var(--glow);
    background: rgba(244, 182, 106, .12);
    outline: none;
}

/* ===== Home page (body class="home") ===== */
.home {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem 1.5rem
}

.home .topbar {
    margin-top: 1.75rem;
    flex-wrap: wrap
}

.home .moon {
    width: min(46vw, 200px);
    margin: 0 auto 2.5rem;
    box-shadow: 0 0 60px 10px rgba(244, 182, 106, .25);
    animation: breathe 8s ease-in-out infinite;
}

.home h1 {
    font-size: clamp(2.6rem, 9vw, 5rem);
    font-weight: 700;
    letter-spacing: -.02em;
    line-height: 1;
    margin: 0 0 1rem
}

.home p {
    max-width: 34ch;
    margin: 0 auto;
    font-size: 1.15rem;
    line-height: 1.6;
    color: var(--muted)
}

.home footer {
    margin-top: 3rem;
    font-size: .9rem
}

@keyframes breathe {

    0%,
    100% {
        transform: scale(.94);
        box-shadow: 0 0 40px 4px rgba(244, 182, 106, .15)
    }

    50% {
        transform: scale(1.04);
        box-shadow: 0 0 90px 22px rgba(244, 182, 106, .32)
    }
}

/* ===== Links page (body class="links") ===== */
.links {
    padding: 2.5rem 1.25rem 2rem
}


.links main {
    max-width: 520px;
    margin: 0 auto;
    text-align: center
}

.links .moon {
    width: 84px;
    margin: 0 auto 1.25rem;
    box-shadow: 0 0 40px 6px rgba(244, 182, 106, .25);
    animation: breathe-sm 8s ease-in-out infinite
}

@keyframes breathe-sm {

    0%,
    100% {
        transform: scale(.95);
        box-shadow: 0 0 30px 3px rgba(244, 182, 106, .15)
    }

    50% {
        transform: scale(1.03);
        box-shadow: 0 0 56px 12px rgba(244, 182, 106, .3)
    }
}

.links h1,
.links h1 a {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -.02em;
    margin: 0 0 .4rem;
    color: var(--link);
    text-decoration: none;
}

.links .sub {
    margin: 0 0 2rem;
    color: var(--muted);
    line-height: 1.5
}

.links h2 {
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .14em;
    color: var(--glow);
    margin: 2rem 0 .7rem;
    text-align: left
}

h2[id] {
    scroll-margin-top: calc(4.5rem + env(safe-area-inset-top, 0px))
}

.links footer {
    margin-top: 2.5rem;
    font-size: .95rem
}

.links footer a {
    color: var(--glow);
    text-decoration: none;
    transition: color .15s;
}

.nav {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 20;
    display: flex;
    justify-content: center;
    gap: .5rem;
    padding: .6rem 0;
    margin: 0 0 .5rem;
    background: rgba(18, 21, 43, .85);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    overflow-x: auto
}

.link {
    display: flex;
    align-items: center;
    gap: .9rem;
    text-align: left;
    padding: .9rem 1rem;
    margin-bottom: .6rem;
    border-radius: 14px;
    background: var(--card);
    border: 1px solid var(--line);
    color: var(--ink);
    text-decoration: none;
    transition: transform .15s, border-color .15s, background .15s;
}

.link:hover,
.link:focus-visible {
    transform: translateY(-2px);
    border-color: var(--glow);
    background: rgba(244, 182, 106, .1);
    outline: none
}

.ico {
    font-size: 1.5rem;
    width: 2rem;
    text-align: center
}

.ico .svg {
    display: block;
    width: 2rem;
    height: 2rem;
    object-fit: contain;
}

.txt {
    flex: 1;
    min-width: 0
}

.txt b {
    display: block;
    font-weight: 700
}

.txt span {
    display: block;
    font-size: .85rem;
    color: var(--muted);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.go {
    color: var(--muted)
}

details.game {
    margin-bottom: .6rem
}

details.game summary.link {
    margin-bottom: 0;
    cursor: pointer;
    list-style: none
}

details.game summary::-webkit-details-marker {
    display: none
}

details.game .go {
    transition: transform .2s
}

details.game[open] .go {
    transform: rotate(90deg);
    color: var(--glow)
}

details.game[open] summary.link {
    border-color: var(--glow);
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0
}

.panel {
    text-align: left;
    padding: 1rem;
    background: rgba(235, 231, 255, .04);
    border: 1px solid var(--glow);
    border-top: 0;
    border-radius: 0 0 14px 14px
}

.panel ol {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
    color: var(--muted);
    line-height: 1.6;
    font-size: .95rem
}

.panel ol li {
    margin-bottom: .2rem
}

.detail {
    display: flex;
    align-items: center;
    gap: .6rem;
    padding: .55rem .7rem;
    margin-bottom: .4rem;
    border-radius: 10px;
    background: var(--card);
    border: 1px solid var(--line)
}

.detail>span {
    font-size: .75rem;
    text-transform: uppercase;
    letter-spacing: .1em;
    color: var(--muted);
    min-width: 4.5rem
}

.detail code {
    flex: 1;
    min-width: 0;
    font-family: ui-monospace, Menlo, Consolas, monospace;
    font-size: .9rem;
    color: var(--ink);
    overflow-wrap: anywhere
}

.copy {
    font: inherit;
    font-size: .8rem;
    font-weight: 600;
    color: var(--bg);
    background: var(--glow);
    border: 0;
    border-radius: 8px;
    padding: .3rem .7rem;
    cursor: pointer
}

.copy:active {
    transform: scale(.95)
}

@media (prefers-reduced-motion:reduce) {
    html {
        scroll-behavior: auto
    }

    .moon {
        animation: none
    }

    .link,
    .topbar a,
    .nav a {
        transition: none
    }
}