:root {
    color-scheme: dark;
    --bg: #030711;
    --panel: rgba(7, 14, 27, .74);
    --panel-deep: rgba(3, 8, 18, .86);
    --line: rgba(124, 231, 255, .19);
    --line-strong: rgba(124, 231, 255, .48);
    --text: #eff9ff;
    --muted: #9fb4c7;
    --cyan: #77edff;
    --cyan-2: #30c7ff;
    --violet: #9f78ff;
    --blue: #2377ff;
    --gold: #ffc96b;
    --danger: #ff5d73;
    --shadow: 0 30px 90px rgba(0, 0, 0, .54);
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100svh;
    overflow-x: hidden;
    color: var(--text);
    background:
        radial-gradient(circle at 25% 15%, rgba(38, 110, 189, .16), transparent 34%),
        radial-gradient(circle at 80% 10%, rgba(101, 55, 174, .18), transparent 30%),
        linear-gradient(180deg, #08101f 0%, #030712 56%, #01040a 100%);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, canvas { -webkit-tap-highlight-color: transparent; }
button { font: inherit; }

.scene {
    position: fixed;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
    background:
        linear-gradient(180deg, rgba(3, 8, 18, .06), rgba(3, 8, 18, .56) 62%, rgba(1, 4, 10, .96)),
        radial-gradient(ellipse at 50% 110%, rgba(32, 139, 180, .16), transparent 48%);
}

.sky-glow {
    position: absolute;
    width: 52vw;
    aspect-ratio: 1;
    border-radius: 50%;
    filter: blur(54px);
    opacity: .24;
    mix-blend-mode: screen;
}
.sky-glow--one { top: -30vw; left: -8vw; background: #16c8ff; animation: glow-drift 15s ease-in-out infinite alternate; }
.sky-glow--two { top: -26vw; right: -12vw; background: #8b5dff; animation: glow-drift 18s ease-in-out -4s infinite alternate-reverse; }

.stars,
.stars::before,
.stars::after {
    position: absolute;
    inset: 0;
    content: "";
    background-repeat: repeat;
    opacity: .58;
}
.stars {
    background-image:
        radial-gradient(circle, rgba(223,249,255,.92) 0 1px, transparent 1.4px),
        radial-gradient(circle, rgba(130,223,255,.8) 0 1px, transparent 1.35px);
    background-position: 0 0, 71px 37px;
    background-size: 137px 137px, 173px 173px;
    animation: stars-float 35s linear infinite;
}
.stars::before {
    background-image: radial-gradient(circle, rgba(255,255,255,.78) 0 1.2px, transparent 1.6px);
    background-position: 24px 62px;
    background-size: 233px 233px;
    opacity: .34;
}
.stars::after {
    background-image: radial-gradient(circle, rgba(133,95,255,.72) 0 1px, transparent 1.5px);
    background-position: 90px 11px;
    background-size: 281px 281px;
    opacity: .23;
}

.moon {
    position: absolute;
    top: 8vh;
    right: 11vw;
    width: clamp(120px, 15vw, 230px);
    aspect-ratio: 1;
    border-radius: 50%;
    opacity: .6;
    background:
        radial-gradient(circle at 38% 32%, rgba(255,255,255,.96) 0 3%, transparent 4%),
        radial-gradient(circle at 62% 67%, rgba(74,130,169,.3) 0 8%, transparent 9%),
        radial-gradient(circle at 44% 52%, rgba(72,120,160,.24) 0 11%, transparent 12%),
        radial-gradient(circle at 40% 35%, #ebfbff, #8dddf5 58%, #4fa3c3 100%);
    box-shadow: 0 0 70px rgba(102,222,255,.22), 0 0 150px rgba(82,139,255,.14);
}

.mountains {
    position: absolute;
    left: -7%;
    right: -7%;
    bottom: 0;
    transform-origin: bottom center;
}
.mountains::before,
.mountains::after {
    content: "";
    position: absolute;
    inset: 0;
    clip-path: polygon(0 100%, 0 68%, 6% 61%, 11% 67%, 18% 39%, 22% 52%, 29% 26%, 34% 51%, 42% 36%, 48% 59%, 54% 43%, 61% 61%, 67% 31%, 73% 53%, 81% 29%, 87% 51%, 93% 41%, 100% 66%, 100% 100%);
}
.mountains--back { height: 48vh; opacity: .44; filter: blur(.4px); }
.mountains--back::before { background: linear-gradient(180deg, #162944, #06101e 72%); transform: translateY(5%); }
.mountains--back::after { background: linear-gradient(180deg, rgba(46, 86, 128, .35), transparent 68%); transform: translateY(-2%) scaleX(.88); }
.mountains--front { height: 31vh; opacity: .97; }
.mountains--front::before { background: linear-gradient(180deg, #07101d, #010409 70%); }
.mountains--front::after { background: linear-gradient(180deg, rgba(28,76,101,.38), transparent 55%); transform: translateY(7%) scaleX(1.08); }

.citadel {
    position: absolute;
    left: 50%;
    bottom: 15vh;
    width: min(46vw, 740px);
    height: min(34vw, 520px);
    transform: translateX(-50%);
    opacity: .42;
    filter: drop-shadow(0 0 28px rgba(41, 207, 255, .18));
}
.citadel::before {
    content: "";
    position: absolute;
    left: 19%;
    right: 18%;
    bottom: 0;
    height: 42%;
    clip-path: polygon(5% 100%, 2% 48%, 8% 45%, 9% 24%, 18% 19%, 22% 29%, 30% 23%, 34% 7%, 43% 0, 49% 11%, 55% 4%, 61% 14%, 66% 12%, 72% 28%, 80% 24%, 88% 32%, 92% 55%, 98% 58%, 100% 100%);
    background: linear-gradient(180deg, #102338, #02060c 76%);
    border-bottom: 1px solid rgba(92,216,255,.15);
}
.citadel__spire {
    position: absolute;
    bottom: 25%;
    width: 7%;
    background: linear-gradient(180deg, #173454, #040913 76%);
    clip-path: polygon(50% 0, 76% 22%, 70% 24%, 82% 37%, 72% 37%, 84% 100%, 16% 100%, 29% 37%, 17% 37%, 30% 24%, 24% 22%);
}
.citadel__spire::after {
    content: "";
    position: absolute;
    left: 46%;
    top: 26%;
    width: 8%;
    height: 45%;
    background: linear-gradient(180deg, rgba(98,239,255,.9), rgba(74,124,255,.04));
    box-shadow: 0 0 15px rgba(63,225,255,.55);
}
.citadel__spire--1 { left: 24%; height: 72%; }
.citadel__spire--2 { left: 40%; height: 91%; width: 8.5%; }
.citadel__spire--3 { right: 37%; height: 81%; }
.citadel__spire--4 { right: 22%; height: 64%; }
.citadel__bridge {
    position: absolute;
    left: 28%; right: 25%; bottom: 33%; height: 8%;
    border-top: 5px solid #0e2136;
    border-radius: 50% 50% 0 0;
    transform: rotate(-2deg);
}
.citadel__core {
    position: absolute;
    left: 50%; bottom: 27%;
    width: 5.5%; aspect-ratio: .62;
    transform: translateX(-50%);
    border-radius: 48% 48% 25% 25% / 32% 32% 60% 60%;
    background: radial-gradient(circle at 50% 35%, #d5fbff 0 7%, #66ecff 20%, #2076d8 52%, transparent 68%);
    box-shadow: 0 0 45px rgba(78,229,255,.48), 0 0 90px rgba(67,94,255,.28);
}

.mist {
    position: absolute;
    left: -20vw;
    width: 140vw;
    height: 17vh;
    border-radius: 50%;
    filter: blur(20px);
    opacity: .2;
    background: linear-gradient(90deg, transparent 0%, rgba(109,214,236,.34) 18%, rgba(170,183,255,.25) 48%, rgba(92,207,225,.25) 78%, transparent 100%);
}
.mist--one { bottom: 17vh; animation: mist-slide 22s ease-in-out infinite alternate; }
.mist--two { bottom: 6vh; opacity: .12; animation: mist-slide 31s ease-in-out -8s infinite alternate-reverse; }

.rune {
    position: absolute;
    color: rgba(109, 236, 255, .19);
    font-family: Georgia, serif;
    font-size: clamp(22px, 3vw, 50px);
    text-shadow: 0 0 16px rgba(82,225,255,.44);
    animation: rune-float 7s ease-in-out infinite;
}
.rune--1 { left: 6vw; top: 21vh; transform: rotate(-11deg); }
.rune--2 { left: 18vw; top: 68vh; animation-delay: -2s; }
.rune--3 { right: 17vw; top: 55vh; transform: rotate(12deg); animation-delay: -4s; }
.rune--4 { right: 5vw; top: 27vh; animation-delay: -1s; }

.shell {
    position: relative;
    z-index: 2;
    width: min(1320px, calc(100% - 48px));
    min-height: calc(100vh - 96px);
    min-height: calc(100svh - 96px);
    margin: 0 auto;
    padding: clamp(34px, 6vh, 74px) 0 78px;
    display: grid;
    grid-template-columns: minmax(0, 1.08fr) minmax(360px, .92fr);
    gap: clamp(22px, 3vw, 38px);
    align-items: center;
}

.maintenance-card,
.game-card {
    position: relative;
    border: 1px solid var(--line);
    background:
        linear-gradient(145deg, rgba(13, 28, 47, .78), rgba(4, 10, 21, .78) 58%, rgba(6, 9, 21, .88)),
        radial-gradient(circle at 16% 0%, rgba(88,225,255,.11), transparent 33%);
    box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.035);
    backdrop-filter: blur(22px) saturate(125%);
    -webkit-backdrop-filter: blur(22px) saturate(125%);
}

.maintenance-card {
    padding: clamp(30px, 5vw, 68px);
    border-radius: 30px 8px 30px 8px;
    overflow: hidden;
}
.maintenance-card::before {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    pointer-events: none;
    background: linear-gradient(135deg, rgba(119,237,255,.16), transparent 18%, transparent 76%, rgba(125,86,255,.12));
    mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
    mask-composite: exclude;
    padding: 1px;
}
.maintenance-card::after {
    content: "";
    position: absolute;
    left: -90px;
    bottom: -130px;
    width: 360px;
    height: 360px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(25,167,218,.14), transparent 68%);
    pointer-events: none;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 32px;
    padding: 7px 12px;
    border: 1px solid rgba(102, 221, 255, .24);
    border-radius: 999px;
    background: rgba(13, 35, 50, .5);
    color: #c7f6ff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.pulse-dot {
    width: 8px;
    aspect-ratio: 1;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 0 0 rgba(119,237,255,.55);
    animation: pulse 1.8s ease-out infinite;
}

.sigil {
    position: absolute;
    top: 44px;
    right: 46px;
    width: 88px;
    aspect-ratio: 1;
    opacity: .75;
}
.sigil__ring,
.sigil__ring::before,
.sigil__ring::after,
.sigil__core { position: absolute; inset: 0; border-radius: 50%; }
.sigil__ring { border: 1px solid rgba(112,237,255,.42); animation: spin 18s linear infinite; }
.sigil__ring::before {
    content: "";
    inset: 8px;
    border: 1px dashed rgba(151,119,255,.58);
}
.sigil__ring::after {
    content: "";
    inset: 21px;
    border: 1px solid rgba(112,237,255,.55);
    clip-path: polygon(50% 0, 61% 35%, 100% 50%, 64% 61%, 50% 100%, 38% 63%, 0 50%, 36% 38%);
}
.sigil__core {
    inset: 34px;
    background: #aef6ff;
    box-shadow: 0 0 20px #54d8ff, 0 0 42px rgba(100,101,255,.7);
}

.overline {
    margin: clamp(44px, 8vh, 90px) 0 12px;
    color: var(--gold);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 15px;
    font-style: italic;
    letter-spacing: .03em;
}

h1, h2, p { margin-top: 0; }
h1 {
    max-width: 760px;
    margin-bottom: 22px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(46px, 6.3vw, 86px);
    line-height: .96;
    font-weight: 700;
    letter-spacing: -.045em;
    text-wrap: balance;
    text-shadow: 0 8px 35px rgba(0,0,0,.48);
}
.lead {
    max-width: 700px;
    margin-bottom: 32px;
    color: #c3d2df;
    font-size: clamp(16px, 1.4vw, 19px);
    line-height: 1.74;
}

.maintenance-state {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 10px 18px;
    align-items: center;
    margin-top: 22px;
    padding: 17px 18px;
    border: 1px solid rgba(114, 219, 255, .15);
    border-radius: 13px;
    background: rgba(5, 16, 30, .48);
}
.maintenance-state__label {
    color: #7894a8;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}
.maintenance-state strong {
    color: #d9f8ff;
    font-size: 14px;
    font-weight: 650;
    text-align: right;
}

.progress {
    height: 3px;
    margin: 20px 0 28px;
    overflow: hidden;
    border-radius: 3px;
    background: rgba(119, 237, 255, .08);
}
.progress span {
    display: block;
    width: 34%;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, transparent, var(--cyan-2), #cbf9ff, var(--violet), transparent);
    box-shadow: 0 0 15px rgba(75,219,255,.64);
    animation: progress 2.6s ease-in-out infinite;
}

.actions {
    display: flex;
    align-items: center;
    gap: 18px;
    flex-wrap: wrap;
}
.button {
    border: 0;
    cursor: pointer;
    color: #effcff;
    font-weight: 800;
    letter-spacing: .02em;
    transition: transform .2s ease, filter .2s ease, border-color .2s ease;
}
.button:hover { transform: translateY(-2px); filter: brightness(1.08); }
.button:active { transform: translateY(0) scale(.98); }
.button:focus-visible { outline: 2px solid #d7fbff; outline-offset: 3px; }
.button--primary {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    min-height: 50px;
    padding: 0 18px;
    border: 1px solid rgba(113, 239, 255, .4);
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(32, 151, 207, .72), rgba(73, 74, 181, .72));
    box-shadow: inset 0 1px 0 rgba(255,255,255,.14), 0 8px 30px rgba(15,101,163,.22);
}
.button--primary span:last-child { font-size: 20px; font-weight: 400; }
.hint { max-width: 330px; color: #7890a3; font-size: 13px; line-height: 1.55; }

.game-card {
    padding: 22px;
    border-radius: 10px 28px 10px 28px;
}
.game-card__heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin: 2px 3px 12px;
}
.game-kicker {
    margin-bottom: 2px;
    color: var(--cyan);
    font-size: 10px;
    font-weight: 900;
    letter-spacing: .18em;
    text-transform: uppercase;
}
h2 {
    margin-bottom: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(28px, 3vw, 39px);
    letter-spacing: -.025em;
}
.score { text-align: right; }
.score span {
    display: block;
    margin-bottom: 2px;
    color: #73899a;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .13em;
    text-transform: uppercase;
}
.score strong {
    color: #dffcff;
    font-variant-numeric: tabular-nums;
    font-size: 22px;
    letter-spacing: .08em;
    text-shadow: 0 0 16px rgba(82,226,255,.32);
}
.game-copy {
    margin: 0 3px 15px;
    color: #8da3b4;
    font-size: 13px;
    line-height: 1.55;
}
.game-wrap {
    position: relative;
    overflow: hidden;
    min-height: 360px;
    border: 1px solid rgba(122, 229, 255, .17);
    border-radius: 9px 19px 9px 19px;
    background:
        radial-gradient(circle at 50% 104%, rgba(31,161,198,.22), transparent 42%),
        linear-gradient(180deg, rgba(4,12,24,.85), rgba(1,5,12,.96));
    box-shadow: inset 0 0 60px rgba(42,139,186,.07);
    touch-action: none;
}
#game {
    display: block;
    width: 100%;
    height: auto;
    max-height: 52vh;
    aspect-ratio: 640 / 430;
}
.game-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 30px;
    text-align: center;
    background: radial-gradient(circle at 50% 48%, rgba(28, 125, 173, .14), rgba(2,8,17,.86) 62%);
    transition: opacity .25s ease, visibility .25s ease;
}
.game-overlay.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }
.game-overlay strong {
    margin-bottom: 8px;
    font-family: Georgia, "Times New Roman", serif;
    font-size: 24px;
}
.game-overlay > span {
    max-width: 330px;
    margin-bottom: 20px;
    color: #92aabd;
    font-size: 12px;
    line-height: 1.55;
}
.game-orb {
    width: 62px;
    aspect-ratio: 1;
    margin-bottom: 19px;
    border: 1px solid rgba(134, 239, 255, .5);
    border-radius: 50%;
    background: radial-gradient(circle at 38% 32%, #e5feff 0 5%, #6deeff 13%, #2c90ff 33%, #5046bf 57%, rgba(67,63,162,.1) 68%, transparent 70%);
    box-shadow: 0 0 30px rgba(73,224,255,.38), inset 0 0 18px rgba(255,255,255,.16);
    animation: orb 3.6s ease-in-out infinite;
}
.button--game {
    min-height: 42px;
    padding: 0 16px;
    border: 1px solid rgba(115, 235, 255, .33);
    border-radius: 10px;
    background: rgba(21, 90, 127, .55);
    font-size: 12px;
}
.game-footer {
    display: flex;
    justify-content: space-between;
    gap: 14px;
    margin: 13px 3px 0;
    color: #6f8799;
    font-size: 11px;
}
kbd {
    display: inline-grid;
    place-items: center;
    min-width: 23px;
    height: 22px;
    margin-right: 3px;
    padding: 0 5px;
    border: 1px solid rgba(119,220,255,.2);
    border-bottom-width: 2px;
    border-radius: 5px;
    background: rgba(12,28,42,.72);
    color: #bdefff;
    font: 700 10px/1 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.best-score strong { color: #bdefff; font-variant-numeric: tabular-nums; }

.footer {
    position: fixed;
    z-index: 3;
    left: 50%;
    bottom: 16px;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: calc(100% - 34px);
    color: rgba(166, 189, 204, .56);
    font-size: 10px;
    letter-spacing: .05em;
    text-align: center;
}
.footer__dot { width: 3px; aspect-ratio: 1; border-radius: 50%; background: currentColor; }

@keyframes glow-drift { to { transform: translate3d(6vw, 5vh, 0) scale(1.08); opacity: .34; } }
@keyframes stars-float { to { transform: translateY(137px); } }
@keyframes mist-slide { to { transform: translateX(13vw) scaleY(1.15); } }
@keyframes rune-float { 50% { transform: translateY(-13px) rotate(8deg); opacity: .32; } }
@keyframes pulse { 70% { box-shadow: 0 0 0 9px rgba(119,237,255,0); } 100% { box-shadow: 0 0 0 0 rgba(119,237,255,0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes progress { 0% { transform: translateX(-110%); } 55%, 100% { transform: translateX(310%); } }
@keyframes orb { 50% { transform: translateY(-7px) scale(1.04); filter: brightness(1.12); } }

@media (max-width: 980px) {
    .shell {
        grid-template-columns: 1fr;
        align-items: stretch;
        width: min(760px, calc(100% - 30px));
        padding-top: 25px;
        padding-bottom: 90px;
    }
    .maintenance-card { padding: clamp(26px, 7vw, 48px); }
    .overline { margin-top: 56px; }
    .game-wrap { min-height: 0; }
    #game { max-height: none; }
    .citadel { width: 90vw; height: 65vw; bottom: 10vh; }
    .footer { position: absolute; bottom: 20px; }
}

@media (max-width: 560px) {
    .shell { width: min(100% - 20px, 760px); gap: 14px; }
    .maintenance-card { border-radius: 22px 6px 22px 6px; padding: 24px 20px 25px; }
    .sigil { top: 26px; right: 20px; width: 58px; }
    .sigil__ring::after { inset: 15px; }
    .sigil__core { inset: 24px; }
    .eyebrow { max-width: calc(100% - 78px); font-size: 9px; }
    .overline { margin-top: 46px; font-size: 13px; }
    h1 { font-size: clamp(41px, 15vw, 58px); }
    .lead { font-size: 15px; line-height: 1.65; }
    .maintenance-state { grid-template-columns: 1fr; gap: 5px; }
    .maintenance-state strong { text-align: left; }
    .actions { align-items: flex-start; flex-direction: column; }
    .button--primary { width: 100%; }
    .game-card { padding: 15px; border-radius: 7px 22px 7px 22px; }
    .game-wrap { border-radius: 7px 15px 7px 15px; }
    .game-overlay { padding: 18px; }
    .game-footer > span:first-child { display: none; }
    .game-footer { justify-content: flex-end; }
    .footer { flex-wrap: wrap; row-gap: 2px; }
    .footer__dot { display: none; }
    .footer span:last-child { width: 100%; }
    .rune { display: none; }
}

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