:root {
    --bg-a: #050611;
    --bg-b: #0d1024;
    --bg-c: #171b3f;
    --text: #f6f7ff;
    --muted: rgba(246, 247, 255, .68);
    --soft: rgba(246, 247, 255, .1);
    --line: rgba(246, 247, 255, .16);
    --cyan: #5ff4ff;
    --pink: #ff4fd8;
    --violet: #8b5cff;
    --acid: #d8ff4f;
    --orange: #ffb84f;
    --green: #68ff8f;
    --danger: #ff2f65;
    --glass: rgba(255, 255, 255, .075);
    --shadow: 0 28px 90px rgba(0, 0, 0, .55);
}

* { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    min-height: 100%;
}

body {
    min-height: 100%;
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at 16% 18%, rgba(95, 244, 255, .23), transparent 28%),
        radial-gradient(circle at 88% 12%, rgba(255, 79, 216, .22), transparent 26%),
        radial-gradient(circle at 52% 94%, rgba(216, 255, 79, .13), transparent 28%),
        linear-gradient(135deg, var(--bg-a), var(--bg-b) 48%, var(--bg-c));
    overflow-x: hidden;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    pointer-events: none;
    background-image:
        linear-gradient(rgba(255, 255, 255, .045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, .045) 1px, transparent 1px);
    background-size: 44px 44px;
    mask-image: radial-gradient(circle at center, black 22%, transparent 78%);
    opacity: .52;
    z-index: 0;
}

body::after {
    content: "404 404 404 404 404 404 404 404 404 404";
    position: fixed;
    left: -10vw;
    right: -10vw;
    top: 42vh;
    transform: rotate(-8deg);
    pointer-events: none;
    color: rgba(255, 255, 255, .035);
    font-size: clamp(68px, 13vw, 190px);
    font-weight: 1000;
    letter-spacing: -.09em;
    white-space: nowrap;
    z-index: 0;
}

button,
a,
input { font: inherit; }

button { cursor: pointer; }

img { max-width: 100%; display: block; }

.noise,
.scanline,
.matrix-canvas {
    position: fixed;
    inset: 0;
    pointer-events: none;
}

.matrix-canvas {
    z-index: 0;
    opacity: 0;
    transition: opacity .25s ease;
}

body.matrix-on .matrix-canvas,
body.pizza-on .matrix-canvas { opacity: .8; }

.noise {
    z-index: 4;
    opacity: .14;
    mix-blend-mode: overlay;
    background-image:
        radial-gradient(circle at 20% 20%, rgba(255, 255, 255, .2) 0 1px, transparent 1px),
        radial-gradient(circle at 80% 70%, rgba(255, 255, 255, .16) 0 1px, transparent 1px);
    background-size: 18px 18px, 27px 27px;
}

.scanline {
    z-index: 5;
    background: repeating-linear-gradient(to bottom, rgba(255, 255, 255, .035) 0, rgba(255, 255, 255, .035) 1px, transparent 1px, transparent 7px);
    opacity: .25;
    mix-blend-mode: overlay;
}

.page-shell {
    position: relative;
    z-index: 2;
    width: min(1220px, calc(100% - 32px));
    min-height: calc(100svh - 56px);
    margin: 28px auto;
    overflow: hidden;
    border: 1px solid var(--line);
    border-radius: 34px;
    background:
        radial-gradient(circle at 8% 14%, rgba(95, 244, 255, .16), transparent 28%),
        radial-gradient(circle at 92% 18%, rgba(255, 79, 216, .14), transparent 26%),
        linear-gradient(145deg, rgba(255, 255, 255, .13), rgba(255, 255, 255, .045)),
        rgba(5, 7, 20, .82);
    backdrop-filter: blur(24px);
    box-shadow: var(--shadow);
    transition: transform .35s ease, filter .35s ease, border-color .35s ease;
}

.site-topbar,
.site-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border-color: rgba(255, 255, 255, .11);
}

.site-topbar { border-bottom: 1px solid rgba(255, 255, 255, .11); }
.site-footer { border-top: 1px solid rgba(255, 255, 255, .11); color: rgba(246, 247, 255, .56); font-size: 13px; }
.site-footer p { margin: 0; }
.site-footer strong { color: rgba(246, 247, 255, .86); }

.brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    color: var(--text);
    text-decoration: none;
}

.brand-mark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 15px;
    background: linear-gradient(135deg, rgba(95, 244, 255, .24), rgba(255, 79, 216, .24));
    border: 1px solid rgba(255, 255, 255, .16);
    color: var(--acid);
    font-weight: 1000;
    box-shadow: 0 0 36px rgba(95, 244, 255, .12);
}

.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-size: 18px; letter-spacing: -.04em; }
.brand-copy em { color: var(--muted); font-size: 12px; font-style: normal; }

.top-nav {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: center;
}

.top-nav a,
.status-pill,
.ghost-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    min-height: 38px;
    padding: 9px 13px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(0, 0, 0, .22);
    color: rgba(246, 247, 255, .76);
    text-decoration: none;
    font-size: 13px;
    font-weight: 850;
}

.status-pill span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--cyan);
    box-shadow: 0 0 24px var(--cyan);
}

.hero-section {
    display: grid;
    grid-template-columns: 1.07fr .93fr;
    gap: clamp(22px, 5vw, 66px);
    align-items: center;
    padding: clamp(28px, 6vw, 76px);
}

.kicker {
    display: inline-flex;
    width: fit-content;
    margin: 0 0 18px;
    padding: 9px 13px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    border: 1px solid rgba(255, 255, 255, .13);
    color: var(--acid);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .18em;
    text-transform: uppercase;
}

h1 {
    margin: 0;
    font-size: clamp(58px, 11vw, 142px);
    line-height: .78;
    letter-spacing: -.095em;
    text-transform: lowercase;
}

h1 i { font-style: normal; }
h1 i:nth-child(1) { color: var(--cyan); text-shadow: 0 0 34px rgba(95, 244, 255, .28); }
h1 i:nth-child(2) { color: var(--pink); text-shadow: 0 0 34px rgba(255, 79, 216, .26); }
h1 i:nth-child(3) { color: var(--acid); text-shadow: 0 0 34px rgba(216, 255, 79, .18); }

.glitch {
    position: relative;
    display: inline-block;
}

.glitch::before,
.glitch::after {
    content: attr(data-text);
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: .55;
}

.glitch::before { color: var(--cyan); transform: translate(2px, -1px); clip-path: inset(0 0 58% 0); }
.glitch::after { color: var(--pink); transform: translate(-2px, 1px); clip-path: inset(52% 0 0 0); }

.lead {
    max-width: 650px;
    margin: 24px 0 0;
    color: var(--muted);
    font-size: clamp(18px, 2.2vw, 25px);
    line-height: 1.42;
}

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-top: 28px;
}

.main-button,
.lab-card button,
.card-link {
    appearance: none;
    border: 0;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 48px;
    padding: 13px 18px;
    border-radius: 17px;
    font-weight: 950;
    color: #050713;
    background: linear-gradient(135deg, var(--cyan), var(--acid));
    box-shadow: 0 18px 46px rgba(95, 244, 255, .17);
    transition: transform .2s ease, filter .2s ease, background .2s ease;
}

.main-button:hover,
.lab-card button:hover,
.card-link:hover { transform: translateY(-2px); filter: brightness(1.08); }
.main-button.secondary { color: var(--text); background: rgba(255, 255, 255, .085); border: 1px solid rgba(255, 255, 255, .14); box-shadow: none; }
.main-button.danger { color: #170813; background: linear-gradient(135deg, var(--pink), var(--orange)); }

.chaos-meter {
    max-width: 510px;
    margin-top: 24px;
    padding: 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .13);
    background: rgba(0, 0, 0, .22);
}

.chaos-meter-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .14em;
}

.chaos-meter-top strong { color: var(--acid); }
.chaos-track { height: 10px; margin-top: 10px; border-radius: 999px; background: rgba(255, 255, 255, .1); overflow: hidden; }
.chaos-track span { display: block; width: 0%; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--cyan), var(--pink), var(--acid)); transition: width .28s ease; }

.terminal-card {
    position: relative;
    min-height: 460px;
    display: grid;
    grid-template-rows: auto 1fr auto auto;
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: linear-gradient(145deg, rgba(0, 0, 0, .46), rgba(255, 255, 255, .025));
    overflow: hidden;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .08);
}

.terminal-head {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 15px 16px;
    border-bottom: 1px solid rgba(255, 255, 255, .11);
    background: rgba(0, 0, 0, .22);
}

.terminal-head button {
    width: 12px;
    height: 12px;
    padding: 0;
    border: 0;
    border-radius: 50%;
    background: var(--pink);
}

.terminal-head button:nth-child(2) { background: var(--acid); }
.terminal-head button:nth-child(3) { background: var(--cyan); }
.terminal-head span { margin-left: auto; color: var(--muted); font-size: 12px; font-weight: 850; }

.terminal-body {
    min-height: 220px;
    max-height: 340px;
    overflow: auto;
    padding: 18px 20px 10px;
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    color: rgba(246, 247, 255, .82);
    font-size: 13px;
    line-height: 1.6;
}

.terminal-body p { margin: 0 0 6px; }
.terminal-body b { color: var(--acid); }
.terminal-body strong { color: var(--cyan); }
.terminal-body em { color: var(--pink); font-style: normal; }

.terminal-form {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px 4px;
    color: var(--cyan);
    font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    font-size: 13px;
}

.terminal-form label { white-space: nowrap; }
.terminal-form input {
    min-width: 0;
    width: 100%;
    border: 0;
    outline: none;
    background: transparent;
    color: var(--text);
}

.fortune-box {
    margin: 14px 20px 20px;
    padding: 12px 14px;
    border-radius: 18px;
    border: 1px solid rgba(255, 255, 255, .13);
    background: rgba(0, 0, 0, .24);
    color: rgba(246, 247, 255, .84);
}

.fortune-box span {
    display: block;
    margin-bottom: 4px;
    color: var(--acid);
    font-size: 11px;
    font-weight: 950;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.fortune-box p { margin: 0; font-size: 14px; line-height: 1.4; }

.demo-section,
.lab-section {
    padding: 0 clamp(20px, 6vw, 76px) clamp(28px, 6vw, 76px);
}

.section-heading {
    display: grid;
    gap: 7px;
    margin-bottom: 18px;
}

.section-heading p,
.section-heading span {
    margin: 0;
    color: var(--acid);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .16em;
    text-transform: uppercase;
}

.section-heading h2 {
    margin: 0;
    font-size: clamp(28px, 4vw, 48px);
    line-height: 1;
    letter-spacing: -.06em;
}

.section-heading span { color: var(--muted); }

.demo-grid,
.lab-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.demo-card,
.lab-card,
.empty-state {
    position: relative;
    overflow: hidden;
    border-radius: 25px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(255, 255, 255, .045);
}

.demo-card {
    display: grid;
    min-height: 100%;
}

.demo-card::before,
.lab-card::before {
    content: "";
    position: absolute;
    inset: -1px;
    pointer-events: none;
    background: radial-gradient(circle at 20% 0%, rgba(95, 244, 255, .16), transparent 38%);
    opacity: .8;
}

.demo-cover {
    position: relative;
    display: block;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: rgba(0, 0, 0, .25);
}

.demo-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .35s ease, filter .35s ease;
}

.demo-card:hover .demo-cover img { transform: scale(1.06) rotate(-1deg); filter: saturate(1.2); }
.demo-cover span {
    position: absolute;
    left: 12px;
    top: 12px;
    padding: 7px 10px;
    border-radius: 999px;
    background: rgba(0, 0, 0, .52);
    border: 1px solid rgba(255, 255, 255, .16);
    color: var(--text);
    font-size: 11px;
    font-weight: 950;
    text-transform: uppercase;
}

.demo-content,
.lab-card,
.empty-state { padding: 20px; }
.demo-meta,
.tag-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    align-items: center;
}

.demo-meta span,
.tag-row span,
.lab-card span {
    display: inline-flex;
    padding: 6px 8px;
    border-radius: 999px;
    border: 1px solid rgba(255, 255, 255, .12);
    background: rgba(0, 0, 0, .22);
    color: var(--muted);
    font-size: 11px;
    font-weight: 850;
}

.demo-card[data-danger="high"] .demo-meta span:first-child,
.danger-card > span { color: var(--pink); }
.demo-card[data-danger="low"] .demo-meta span:first-child { color: var(--green); }

.demo-card h3,
.lab-card h3,
.empty-state h3 {
    margin: 13px 0 8px;
    font-size: 21px;
    line-height: 1.12;
    letter-spacing: -.035em;
}

.demo-card p,
.lab-card p,
.empty-state p {
    margin: 0;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.45;
}

.tag-row { margin-top: 14px; }
.card-link { width: 100%; margin-top: 16px; min-height: 40px; padding: 10px 14px; font-size: 13px; }

.lab-section { padding-top: 8px; }
.lab-card { min-height: 245px; display: flex; flex-direction: column; justify-content: space-between; }
.lab-card button { width: 100%; min-height: 40px; margin-top: 16px; padding: 10px 14px; font-size: 13px; }
.danger-card button { background: linear-gradient(135deg, var(--pink), var(--orange)); }

.empty-state code {
    color: var(--acid);
    background: rgba(0, 0, 0, .24);
    padding: 2px 5px;
    border-radius: 6px;
}

.html-bug {
    position: fixed;
    left: 24px;
    top: 24px;
    z-index: 99;
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: rgba(255, 79, 216, .18);
    border: 1px solid rgba(255, 79, 216, .38);
    box-shadow: 0 0 26px rgba(255, 79, 216, .35);
    transform: scale(var(--bug-scale, 1));
    transition: left .35s ease, top .35s ease, transform .25s ease;
}

.toast-stack {
    position: fixed;
    z-index: 120;
    right: 18px;
    bottom: 18px;
    display: grid;
    gap: 10px;
    width: min(360px, calc(100vw - 36px));
}

.toast {
    padding: 13px 14px;
    border-radius: 16px;
    border: 1px solid rgba(255, 255, 255, .14);
    background: rgba(8, 10, 28, .9);
    color: rgba(246, 247, 255, .88);
    box-shadow: 0 18px 60px rgba(0, 0, 0, .35);
    backdrop-filter: blur(16px);
    font-size: 13px;
    line-height: 1.35;
    animation: toastIn .25s ease both;
}

.delete-overlay,
.boss-overlay {
    position: fixed;
    inset: 0;
    z-index: 110;
    display: none;
    place-items: center;
    padding: 20px;
    background: rgba(0, 0, 0, .72);
    backdrop-filter: blur(10px);
}

.delete-overlay.is-visible,
.boss-overlay.is-visible { display: grid; }

.delete-card,
.boss-card {
    width: min(520px, 100%);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, .16);
    background:
        radial-gradient(circle at 10% 0%, rgba(255, 79, 216, .22), transparent 42%),
        linear-gradient(145deg, rgba(255, 255, 255, .12), rgba(255, 255, 255, .045)),
        #080a1c;
    padding: 24px;
    box-shadow: var(--shadow);
    text-align: center;
}

.delete-label {
    margin: 0 0 8px;
    color: var(--pink);
    font-size: 12px;
    font-weight: 950;
    letter-spacing: .16em;
}

.delete-card h2,
.boss-card h2 { margin: 0; font-size: clamp(28px, 6vw, 52px); letter-spacing: -.06em; }
.delete-card p,
.boss-card p { color: var(--muted); line-height: 1.45; }
.delete-progress { height: 18px; margin: 18px 0; border-radius: 999px; border: 1px solid rgba(216, 255, 79, .5); overflow: hidden; background: rgba(255, 255, 255, .06); }
.delete-progress span { display: block; width: 0%; height: 100%; background: linear-gradient(90deg, var(--pink), var(--acid)); transition: width .12s linear; }
.ghost-button { min-height: 44px; color: var(--text); }

body.panic-on .page-shell { animation: panicShake .06s linear infinite; border-color: rgba(255, 79, 216, .55); filter: contrast(1.35) saturate(1.7); }
body.overdrive-on .page-shell { animation: overdrive 1.2s ease-in-out infinite; }
body.gravity-on .page-shell { transform: rotate(-5deg) translateX(-28px); }
body.clean-on .page-shell { filter: grayscale(1) contrast(.9); transform: none !important; }
body.clean-on .matrix-canvas,
body.clean-on .noise,
body.clean-on .scanline,
body.clean-on .html-bug { opacity: 0 !important; }
body.party-on .page-shell { animation: partyHue 1.6s linear infinite; }

.confetti-piece {
    position: fixed;
    top: -18px;
    z-index: 100;
    pointer-events: none;
    font-size: 20px;
    animation: confettiFall 1.8s linear forwards;
}

@keyframes toastIn { from { transform: translateY(12px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
@keyframes panicShake { 0%, 100% { transform: translate(0, 0); } 25% { transform: translate(5px, -4px) rotate(-1deg); } 50% { transform: translate(-5px, 4px) rotate(1deg); } 75% { transform: translate(3px, 5px); } }
@keyframes overdrive { 0%, 100% { transform: scale(1) rotate(0deg); } 50% { transform: scale(.985) rotate(.65deg); } }
@keyframes partyHue { to { filter: hue-rotate(360deg) saturate(1.35); } }
@keyframes confettiFall { to { transform: translateY(110vh) rotate(720deg); opacity: 0; } }

@media (max-width: 980px) {
    .page-shell { width: min(100% - 22px, 760px); margin: 11px auto; border-radius: 28px; }
    .hero-section { grid-template-columns: 1fr; padding: 28px; }
    .demo-grid,
    .lab-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
    .site-topbar,
    .site-footer { align-items: flex-start; flex-direction: column; }
    .top-nav { justify-content: flex-start; }
    .hero-section { padding: 24px 16px; }
    h1 { font-size: clamp(56px, 19vw, 92px); }
    .lead { font-size: 17px; }
    .hero-actions { display: grid; }
    .main-button { width: 100%; }
    .terminal-card { min-height: auto; }
    .terminal-body { max-height: 270px; font-size: 12px; }
    .terminal-form { align-items: flex-start; flex-direction: column; font-size: 12px; }
    .demo-section,
    .lab-section { padding-left: 16px; padding-right: 16px; }
    .demo-grid,
    .lab-grid { grid-template-columns: 1fr; }
}
