:root {
    --bg: #050b1c;
    --surface: rgba(13, 27, 62, .6);
    --text: #e8efff;
    --muted: #9fb0d0;
    --accent: #1e7bff;
    --accent-2: #2fc0ff;
    --border: rgba(63, 140, 255, .22);
    --radius: 12px;
    --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background:
        radial-gradient(ellipse at 75% 20%, rgba(30, 123, 255, .18), transparent 55%),
        radial-gradient(ellipse at 10% 90%, rgba(47, 192, 255, .08), transparent 50%),
        var(--bg);
    background-attachment: fixed;
    line-height: 1.6;
}

#game {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    display: none;
}

/* ---------- Header ---------- */
.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1.1rem 3rem;
    background: rgba(5, 11, 28, .8);
    backdrop-filter: blur(10px);
    flex-wrap: wrap;
}

.logo { display: flex; flex-direction: column; text-decoration: none; line-height: 1.3; }
.logo-name { color: var(--text); font-weight: 800; letter-spacing: .3em; text-transform: uppercase; font-size: 1.05rem; }
.logo-tag { color: var(--accent-2); font-weight: 600; letter-spacing: .3em; text-transform: uppercase; font-size: .68rem; }

nav { display: flex; gap: 2.2rem; }
nav a {
    color: var(--text);
    text-decoration: none;
    font-weight: 500;
    font-size: .92rem;
    padding: .3rem 0;
    border-bottom: 2px solid transparent;
}
nav a:hover, nav a.active { color: var(--accent-2); border-bottom-color: var(--accent-2); }

.controls { display: flex; gap: .5rem; }

button {
    font: inherit;
    font-weight: 600;
    font-size: .85rem;
    cursor: pointer;
    padding: .45rem .9rem;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text);
}
button:hover { border-color: var(--accent-2); color: var(--accent-2); }

/* ---------- Layout ---------- */
.content {
    position: relative;
    z-index: 1;
    max-width: 1240px;
    margin: 0 auto;
    padding: 0 3rem;
    transition: opacity .3s;
}

section { padding: 5rem 0; }

.eyebrow {
    color: var(--accent-2);
    text-transform: uppercase;
    letter-spacing: .25em;
    font-size: .75rem;
    font-weight: 600;
    margin: 0 0 1rem;
}

/* ---------- Hero ---------- */
.hero {
    display: grid;
    grid-template-columns: 1fr 1.15fr;
    align-items: center;
    gap: 2rem;
    padding: 4rem 0 3rem;
}

.hero h1 {
    font-size: clamp(2.2rem, 4.6vw, 3.6rem);
    line-height: 1.15;
    margin: 0 0 1.5rem;
    font-weight: 800;
}
.highlight {
    color: var(--accent-2);
    text-shadow: 0 0 24px rgba(47, 192, 255, .45);
}

.lead { color: var(--muted); font-size: 1.1rem; max-width: 520px; margin: 0 0 2rem; }

.hero-actions { display: flex; gap: 1rem; flex-wrap: wrap; }

.cta {
    display: inline-flex;
    gap: .6rem;
    align-items: center;
    padding: .85rem 1.6rem;
    border-radius: 6px;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    font-weight: 600;
    box-shadow: 0 8px 24px rgba(30, 123, 255, .35);
    transition: transform .2s, background .2s;
}
.cta:hover { background: #3a8fff; transform: translateY(-2px); }
.cta.ghost { background: transparent; border: 1px solid var(--border); box-shadow: none; }
.cta.ghost:hover { border-color: var(--accent-2); color: var(--accent-2); }

.hero-art { width: 100%; height: auto; overflow: visible; }
.hero-art .links path { stroke-dasharray: 6 6; animation: flow 1.2s linear infinite; }
.hero-art .panel { animation: float 6s ease-in-out infinite; }
.hero-art .panel:last-of-type { animation-delay: -3s; }

@keyframes flow { to { stroke-dashoffset: -12; } }
@keyframes float { 50% { translate: 0 -8px; } }

/* ---------- Feature strip ---------- */
.features {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    border-top: 1px solid var(--border);
    padding: 2.5rem 0;
}
.feature {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0 1.5rem;
    border-left: 1px solid var(--border);
}
.feature:first-child { border-left: none; padding-left: 0; }
.feature svg {
    width: 44px;
    height: 44px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--accent);
    stroke-width: 2.5;
    stroke-linecap: round;
    stroke-linejoin: round;
}
.feature h3 { margin: 0; font-size: 1rem; }
.feature p { margin: 0; color: var(--muted); font-size: .85rem; }

/* ---------- Services ---------- */
h2 { font-size: 2rem; margin: 0 0 2rem; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.25rem;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    transition: transform .2s, border-color .2s, box-shadow .2s;
}
.card:hover {
    transform: translateY(-4px);
    border-color: var(--accent-2);
    box-shadow: 0 0 30px rgba(47, 192, 255, .15);
}
.card h3 { margin: .75rem 0 .5rem; }
.card p { color: var(--muted); margin: 0; }
.icon {
    display: grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 10px;
    background: rgba(30, 123, 255, .15);
    color: var(--accent-2);
    font-size: 1.4rem;
    font-weight: 800;
}

.about p, .contact p { color: var(--muted); max-width: 720px; font-size: 1.1rem; }
.contact { text-align: center; }
.contact p { margin: 0 auto 1.5rem; }

.footer {
    position: relative;
    z-index: 1;
    text-align: center;
    padding: 2rem;
    color: var(--muted);
    border-top: 1px solid var(--border);
}

.hud { display: none; }

/* ---------- Projects ---------- */
.ico {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
    fill: none;
    stroke: var(--accent-2);
    stroke-width: 1.6;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.project-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.project {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
    position: relative;
    overflow: hidden;
}
.project::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}
.project-head { display: flex; gap: 1rem; align-items: flex-start; margin-bottom: 1.25rem; }
.project-head .ico {
    width: 48px;
    height: 48px;
    padding: 10px;
    border-radius: 10px;
    background: rgba(30, 123, 255, .15);
}
.project-head h3 { margin: 0; }
.project-head p { margin: 0; color: var(--muted); font-size: .9rem; }

.project-list { list-style: none; margin: 0; padding: 0; }
.project-list li {
    display: flex;
    flex-direction: column;
    padding: .8rem 0;
    border-top: 1px solid var(--border);
}
.project-list span { color: var(--muted); font-size: .9rem; }

.chips { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: .6rem; }
.chips li {
    padding: .45rem 1rem;
    border: 1px solid var(--border);
    border-radius: 999px;
    font-size: .9rem;
    background: rgba(30, 123, 255, .08);
}

.clients {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
}
.client-group {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.75rem;
}
.client-group h3 {
    margin: 0 0 1rem;
    font-size: .8rem;
    text-transform: uppercase;
    letter-spacing: .2em;
    color: var(--accent-2);
}
.client-group ul { list-style: none; margin: 0; padding: 0; }
.client-group li {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: .85rem 0;
    border-top: 1px solid var(--border);
}
.client-group li:first-child { border-top: none; }
.client-group li div { display: flex; flex-direction: column; line-height: 1.35; }
.client-group span { color: var(--muted); font-size: .85rem; }

@media (max-width: 760px) {
    .project-grid, .clients { grid-template-columns: 1fr; }
}

body.arcade .project, body.arcade .client-group { border: 2px solid var(--border); box-shadow: 0 0 12px rgba(57, 255, 20, .4); }
body.arcade .project::before { background: var(--accent); }
body.arcade .project-head .ico { border-radius: 0; background: transparent; border: 2px solid var(--accent); }
body.arcade .ico { stroke: var(--accent); }
body.arcade .project-head h3, body.arcade .client-group strong { color: var(--accent-2); }
body.arcade .client-group h3 { color: var(--accent); }
body.arcade .chips li { border-radius: 0; border: 2px solid var(--accent-2); background: transparent; font-size: .65rem; }
body.arcade .project-list span, body.arcade .client-group span, body.arcade .project-head p { font-size: .65rem; }

/* ---------- Arcade (dark) mode ---------- */
body.arcade {
    --bg: #000;
    --surface: rgba(0, 0, 0, .75);
    --text: #39ff14;
    --muted: #b6ffb0;
    --accent: #ff2bd6;
    --accent-2: #00f0ff;
    --border: #39ff14;
    --radius: 0;
    --font: "Press Start 2P", monospace;
    background: #000;
    font-size: 13px;
    line-height: 1.9;
}

body.arcade #game { display: block; transition: opacity .4s; }
body.arcade:not(.playing) #game { opacity: .25; filter: blur(1px); }

body.arcade .topbar { background: rgba(0, 0, 0, .85); border-bottom: 2px solid var(--border); }
body.arcade .logo-name, body.arcade .logo-tag { letter-spacing: .1em; }
body.arcade .logo-name { text-shadow: 0 0 8px var(--text); font-size: .8rem; }
body.arcade .logo-tag { font-size: .55rem; }
body.arcade nav a { font-size: .65rem; }
body.arcade button { border: 2px solid var(--border); background: #000; color: var(--text); border-radius: 0; font-size: .7rem; }
body.arcade button:hover { color: var(--accent); border-color: var(--accent); }

body.arcade .hero { grid-template-columns: 1fr; text-align: center; padding-top: 6rem; }
body.arcade .hero-art { display: none; }
body.arcade .lead { margin-inline: auto; }
body.arcade .hero-actions { justify-content: center; }
body.arcade .hero h1 {
    color: var(--accent);
    text-shadow: 0 0 10px var(--accent), 4px 4px 0 #00f0ff;
    font-size: clamp(1.3rem, 3.5vw, 2.4rem);
    line-height: 1.5;
}
body.arcade .highlight { color: #ffe600; text-shadow: 4px 4px 0 var(--accent); }
body.arcade .cta { background: #000; border: 2px solid var(--accent); color: var(--accent); border-radius: 0; box-shadow: none; font-size: .75rem; }
body.arcade .cta:hover { background: var(--accent); color: #000; }
body.arcade .features { border-top: 2px dashed var(--border); background: rgba(0, 0, 0, .6); }
body.arcade .feature { border-left: 2px dashed var(--border); }
body.arcade .feature:first-child { border-left: none; }
body.arcade .feature h3 { font-size: .7rem; color: var(--accent-2); }
body.arcade .feature p { font-size: .6rem; }
body.arcade .card { border: 2px solid var(--border); box-shadow: 0 0 12px rgba(57, 255, 20, .4); }
body.arcade .card h3 { color: var(--accent-2); }
body.arcade .icon { border-radius: 0; background: transparent; border: 2px solid var(--accent); color: var(--accent); }
body.arcade h2 { color: var(--accent-2); text-shadow: 0 0 8px var(--accent-2); font-size: 1.4rem; }

body.arcade .hud {
    display: flex;
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 20;
    gap: 1.25rem;
    align-items: center;
    padding: .6rem 1rem;
    background: rgba(0, 0, 0, .85);
    border: 2px solid var(--border);
    color: var(--text);
    font-size: .7rem;
    flex-wrap: wrap;
    justify-content: center;
}
body.arcade .hud small { color: var(--muted); font-size: .6rem; }

body.playing .content,
body.playing .footer { opacity: .08; pointer-events: none; }

/* ---------- Touch controls (phones / tablets) ---------- */
.touch-controls { display: none; }

@media (pointer: coarse) {
    body.arcade.playing .touch-controls {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 1rem;
        z-index: 30;
        justify-content: space-between;
        padding: 0 1rem;
        pointer-events: none;
    }
    .touch-controls button {
        pointer-events: auto;
        width: 72px;
        height: 72px;
        font-size: 1.6rem;
        border-radius: 50%;
        background: rgba(0, 0, 0, .55);
        touch-action: none;
        user-select: none;
        -webkit-user-select: none;
    }
    .touch-controls button[data-key="Space"] { color: var(--accent); border-color: var(--accent); }
    body.arcade.playing .hud { top: 5.5rem; bottom: auto; }
    body.arcade.playing .hud small { display: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .hero { grid-template-columns: 1fr; text-align: center; }
    .lead { margin-inline: auto; }
    .hero-actions { justify-content: center; }
    .hero-art { max-width: 560px; margin: 0 auto; }
    .features { grid-template-columns: repeat(2, 1fr); row-gap: 2rem; }
    .feature:nth-child(3) { border-left: none; padding-left: 0; }
}

@media (max-width: 640px) {
    .topbar { padding: 1rem; }
    nav { display: none; }
    .content { padding: 0 1.25rem; }
    .features { grid-template-columns: 1fr; }
    .feature { border-left: none; padding-left: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .hero-art .links path, .hero-art .panel { animation: none; }
}

/* ---------- Profile ---------- */
.about {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 4rem;
    align-items: center;
}
.profile {
    position: relative;
    width: 260px;
    aspect-ratio: 1;
    margin: 20px;
}
.profile img {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid var(--accent);
    box-shadow: 0 0 0 8px rgba(30, 123, 255, .12), 0 0 40px rgba(47, 192, 255, .35);
    filter: saturate(.9) contrast(1.05);
}
.orbit {
    position: absolute;
    inset: -18px;
    border-radius: 50%;
    border: 1.5px dashed var(--accent-2);
    opacity: .6;
    animation: orbit 24s linear infinite;
}
.orbit::before {
    content: "";
    position: absolute;
    top: 50%;
    left: -6px;
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--accent-2);
    box-shadow: 0 0 12px var(--accent-2);
}
@keyframes orbit { to { transform: rotate(360deg); } }

/* Animated gradient ring around the portrait */
.profile::before {
    content: "";
    position: absolute;
    inset: -7px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--accent), var(--accent-2), transparent 35%, var(--accent-2) 55%, var(--accent), transparent 80%, var(--accent));
    -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
            mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 3px));
    filter: drop-shadow(0 0 8px var(--accent-2));
    opacity: .75;
    animation: orbit 8s linear infinite;
    transition: opacity .4s ease, inset .4s ease, filter .4s ease;
}
.profile img {
    transition: transform .5s cubic-bezier(.2, .8, .2, 1), box-shadow .5s ease, filter .5s ease, border-color .5s ease;
}
.orbit { transition: inset .5s ease, opacity .5s ease; }
.profile:hover::before {
    inset: -11px;
    opacity: 1;
    filter: drop-shadow(0 0 16px var(--accent-2));
    animation-duration: 2.5s;
}
.profile:hover img {
    transform: scale(1.04) rotate(-2deg);
    border-color: var(--accent-2);
    box-shadow: 0 0 0 10px rgba(30, 123, 255, .18), 0 0 60px rgba(47, 192, 255, .6), 0 18px 40px rgba(0, 0, 0, .45);
    filter: saturate(1.1) contrast(1.08);
}
.profile:hover .orbit {
    inset: -30px;
    opacity: .9;
    animation-duration: 6s;
}

@media (max-width: 760px) {
    .about { grid-template-columns: 1fr; justify-items: center; text-align: center; gap: 2rem; }
    .profile { width: 200px; }
}

@media (prefers-reduced-motion: reduce) {
    .orbit, .profile::before { animation: none; }
    .profile:hover img { transform: none; }
}

body.arcade .profile img {
    border-radius: 0;
    border: 4px solid var(--text);
    box-shadow: 8px 8px 0 var(--accent), 0 0 20px rgba(57, 255, 20, .5);
    image-rendering: pixelated;
    filter: grayscale(1) sepia(1) hue-rotate(60deg) saturate(3) contrast(1.1);
}
body.arcade .orbit, body.arcade .profile::before { display: none; }
body.arcade .profile:hover img { transform: translate(-4px, -4px); box-shadow: 12px 12px 0 var(--accent), 0 0 30px rgba(57, 255, 20, .7); }

.profile::after {
    content: "KL";
    position: absolute;
    inset: 0;
    z-index: -1;
    display: grid;
    place-items: center;
    border-radius: 50%;
    border: 3px solid var(--accent);
    background: radial-gradient(circle at 30% 30%, #1747a8, #081846);
    color: var(--text);
    font-size: 4rem;
    font-weight: 800;
    letter-spacing: .1em;
}
.profile { z-index: 0; }
body.arcade .profile::after { border-radius: 0; border: 4px solid var(--text); background: #000; font-size: 2.5rem; }

/* ---------- Project list icons & CV ---------- */
.project-list li { flex-direction: row; align-items: center; gap: 1rem; }
.project-list li div { display: flex; flex-direction: column; line-height: 1.35; }
.cv-links { display: flex; gap: 1rem; flex-wrap: wrap; margin-top: 1.5rem; }
@media (max-width: 760px) { .cv-links { justify-content: center; } }

/* ---------- Business card ---------- */
.bizcard-wrap { margin-top: 2rem; display: flex; flex-direction: column; align-items: flex-start; gap: 1rem; }
.bizcard {
    width: 360px;
    max-width: 100%;
    height: 210px;
    padding: 0;
    border: none;
    background: none;
    perspective: 1200px;
    cursor: pointer;
    font: inherit;
    color: var(--text);
    text-align: left;
}
.bizcard:hover { border: none; }
.bizcard-inner {
    position: relative;
    display: block;
    width: 100%;
    height: 100%;
    transition: transform .7s cubic-bezier(.2, .8, .2, 1);
    transform-style: preserve-3d;
}
.bizcard.open .bizcard-inner { transform: rotateY(180deg); }
.bizcard-face {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: .35rem;
    padding: 1.5rem 1.75rem;
    border-radius: 14px;
    border: 1px solid var(--border);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    background:
        radial-gradient(circle at 85% 15%, rgba(47, 192, 255, .35), transparent 45%),
        linear-gradient(135deg, #0d2259, #050b1c);
    box-shadow: 0 18px 40px rgba(0, 0, 0, .45), 0 0 30px rgba(30, 123, 255, .2);
}
.bizcard-front::after {
    content: "";
    position: absolute;
    right: 1.5rem;
    bottom: 1.5rem;
    width: 44px;
    height: 32px;
    border-radius: 6px;
    background: linear-gradient(135deg, #f5d27a, #b88a2c);
    opacity: .85;
}
.bc-name { font-size: 1.35rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.bc-title { color: var(--accent-2); font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; }
.bc-hint { margin-top: 1.25rem; color: var(--muted); font-size: .8rem; }
.bizcard-back { transform: rotateY(180deg); gap: .5rem; }
.bc-row { display: flex; align-items: center; gap: .75rem; font-size: .9rem; }
.bc-row .ico { width: 18px; height: 18px; }
.bc-row a { color: var(--text); text-decoration: none; }
.bc-row a:hover { color: var(--accent-2); }

@media (max-width: 760px) {
    .bizcard-wrap { align-items: center; }
}

/* ---------- About layout: photo | card, CV | save ---------- */
.about { display: block; }
.about-media {
    display: grid;
    grid-template-columns: 300px 360px;
    gap: 3rem;
    align-items: center;
    margin-top: 2.5rem;
}
.about-media .profile { width: 220px; margin: 18px auto; justify-self: center; }
.about-media .bizcard { justify-self: center; }
.about-actions {
    display: grid;
    grid-template-columns: 300px 360px;
    gap: 3rem;
    margin-top: 3rem;
}
.about-actions .cta { justify-self: center; }
.bc-qr {
    position: absolute;
    right: 1.25rem;
    top: calc(50% - 42px);
    width: 84px;
    height: 84px;
    padding: 4px;
    border-radius: 8px;
    background: #fff;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
}
.bizcard-back { padding-right: 7.5rem; }
@media (max-width: 760px) {
    .about-media, .about-actions { grid-template-columns: 1fr; justify-items: center; gap: 1.5rem; }
    .about-actions { margin-top: 2.5rem; }
    .bc-qr { width: 70px; height: 70px; top: calc(50% - 35px); }
    .bizcard-back { padding-right: 6rem; }
}
body.arcade .bc-qr { border-radius: 0; box-shadow: 4px 4px 0 var(--accent); }

body.arcade .bizcard-face { border-radius: 0; border: 2px solid var(--border); background: #000; box-shadow: 6px 6px 0 var(--accent); }
body.arcade .bizcard-front::after { display: none; }
body.arcade .bc-name { font-size: .85rem; color: var(--accent); }
body.arcade .bc-title, body.arcade .bc-hint, body.arcade .bc-row { font-size: .6rem; }

/* ---------- Crypto rain ---------- */
.project.finance > *:not(.coin) { position: relative; z-index: 1; }
.coin {
    position: absolute;
    top: -40px;
    z-index: 0;
    display: grid;
    place-items: center;
    width: var(--size, 28px);
    height: var(--size, 28px);
    border-radius: 50%;
    background: var(--coin);
    color: #fff;
    font-weight: 800;
    font-size: calc(var(--size, 28px) * .55);
    font-family: "Inter", system-ui, sans-serif;
    box-shadow: 0 0 12px var(--coin);
    opacity: .85;
    pointer-events: none;
    animation: coin-fall var(--dur, 2.4s) linear forwards;
}
@keyframes coin-fall {
    to { transform: translateY(var(--fall, 320px)) rotate(var(--spin, 360deg)); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
    .coin { display: none; }
}
body.arcade .coin { border-radius: 0; box-shadow: none; font-family: "Press Start 2P", monospace; }
