:root {
    --bg: #070b12;
    --bg-alt: #0c121c;
    --surface: rgba(16, 24, 36, 0.72);
    --text: #eef4fb;
    --muted: #93a6bb;
    --line: rgba(120, 210, 255, 0.14);
    --accent: #3ee0ff;
    --accent-2: #e3b34a;
    --danger: #ff6b7d;
    --success: #7dcea0;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
    --radius: 26px;
    --sans: "Outfit", "Segoe UI", system-ui, sans-serif;
    --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
    --header-h: 78px;
}

[data-theme="light"] {
    --bg: #f3efe6;
    --bg-alt: #ebe4d6;
    --surface: rgba(255, 252, 246, 0.82);
    --text: #121c26;
    --muted: #536273;
    --line: rgba(13, 80, 96, 0.14);
    --accent: #0b7c92;
    --accent-2: #9a6f12;
    --shadow: 0 20px 50px rgba(40, 28, 8, 0.08);
}

@font-face {
    font-family: "Outfit";
    src: url("../fonts/outfit-latin.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: "Source Serif 4";
    src: url("../fonts/source-serif-4-latin.woff2") format("woff2");
    font-weight: 200 900;
    font-style: normal;
    font-display: swap;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
    margin: 0;
    color: var(--text);
    background: var(--bg);
    font-family: var(--sans);
    font-size: 1.05rem;
    line-height: 1.7;
}

.atmosphere {
    pointer-events: none;
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(circle at 12% -8%, rgba(62, 224, 255, 0.16), transparent 32rem),
        radial-gradient(circle at 92% 8%, rgba(227, 179, 74, 0.12), transparent 26rem),
        linear-gradient(180deg, transparent, rgba(8, 12, 20, 0.35)),
        var(--bg);
}

.atmosphere::after {
    content: "";
    position: absolute;
    inset: 0;
    background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 72px 72px;
    mask-image: radial-gradient(circle at 50% 20%, black, transparent 78%);
    opacity: 0.35;
}

img { max-width: 100%; height: auto; }

a {
    color: var(--accent);
    text-decoration-thickness: 1px;
    text-underline-offset: 0.2em;
}

a:hover { color: var(--accent-2); }

:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 3px;
}

::selection {
    background: color-mix(in srgb, var(--accent) 35%, transparent);
}

.skip-link {
    position: absolute;
    left: 12px;
    top: -40px;
    z-index: 20;
    padding: 8px 12px;
    background: var(--accent);
    color: #081018;
}

.skip-link:focus { top: 12px; }

.wrap {
    width: min(1180px, calc(100% - 48px));
    margin: 0 auto;
}

.kicker {
    margin: 0 0 12px;
    color: var(--accent-2);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    backdrop-filter: blur(22px);
    background: color-mix(in srgb, var(--bg) 72%, transparent);
    border-bottom: 1px solid var(--line);
    transition: box-shadow 400ms ease, background 400ms ease;
}

.site-header.is-scrolled {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
}

.header-inner,
.header-actions {
    display: flex;
    align-items: center;
    gap: 18px;
}

.header-inner {
    min-height: var(--header-h);
    justify-content: space-between;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    color: inherit;
    text-decoration: none;
}

.brand small {
    display: block;
    color: var(--muted);
    font-size: 0.76rem;
}

.brand-logo {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    object-fit: cover;
    box-shadow: 0 0 24px rgba(62, 224, 255, 0.18);
}

.menu {
    display: flex;
    gap: 22px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.menu a,
.footer-menu a {
    color: inherit;
    text-decoration: none;
}

.menu a:hover,
.footer-menu a:hover { color: var(--accent); }

.btn,
.theme-toggle,
.nav-toggle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: transparent;
    color: inherit;
    font: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease;
}

.btn:hover,
.theme-toggle:hover,
.nav-toggle:hover {
    transform: translateY(-1px);
    border-color: color-mix(in srgb, var(--accent) 50%, var(--line));
}

.btn-primary,
.btn-game {
    background: var(--accent);
    border-color: transparent;
    color: #071018;
    font-weight: 700;
}

.btn-game {
    gap: 8px;
    background: linear-gradient(135deg, #43e7ff, #7af0b0);
    box-shadow: 0 10px 30px rgba(62, 224, 255, 0.18);
    font-weight: 800;
    letter-spacing: 0.01em;
}

.btn-game svg {
    width: 18px;
    height: 18px;
    flex: 0 0 18px;
}

.btn-large { min-height: 54px; padding: 0 24px; }

.theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-sun { display: inline; }
[data-theme="light"] .theme-toggle .icon-moon { display: none; }
.nav-toggle { display: none; }

.hero,
.page-hero,
.section { padding: 88px 0; }

.footer-grid,
.stats-grid,
.skill-grid,
.project-grid,
.post-grid {
    display: grid;
    gap: 28px;
}

.about-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(260px, 320px);
    gap: 48px 64px;
    align-items: start;
}

.split {
    display: grid;
    grid-template-columns: 1fr 1.05fr;
    align-items: start;
    gap: 56px;
}

.hero h1,
.page-hero h1,
.section h2,
.game-banner h2,
.article-hero h1 {
    margin: 0 0 16px;
    font-family: var(--serif);
    font-size: clamp(2.2rem, 5vw, 4.6rem);
    line-height: 1.05;
    letter-spacing: -0.04em;
}

.section h2,
.game-banner h2 { font-size: clamp(1.9rem, 3vw, 3rem); }

.lede,
.hero-copy p { color: var(--muted); }

.about-card {
    padding: 12px 12px 14px;
    border: 1px solid var(--line);
    border-radius: 28px;
    background: var(--surface);
    backdrop-filter: blur(18px);
    box-shadow: var(--shadow);
}

.about-photo {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
    object-position: 50% 20%;
    border-radius: 20px;
    margin-bottom: 10px;
    background: #4a4a4a;
}

.contact-list {
    margin: 0;
    padding: 4px 6px 8px;
    list-style: none;
    display: grid;
    gap: 2px;
}

.contact-list a {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    padding: 8px;
    border-radius: 14px;
    color: inherit;
    text-decoration: none;
}

.contact-list a:hover {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
}

.contact-icon {
    display: grid;
    place-items: center;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    border: 1px solid color-mix(in srgb, var(--accent) 28%, var(--line));
    background: color-mix(in srgb, var(--accent) 12%, transparent);
    color: var(--accent);
}

.contact-list svg {
    width: 16px;
    height: 16px;
}

.contact-label {
    min-width: 0;
    font-size: 0.92rem;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.phone-number .contact-label {
    overflow-wrap: normal;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    letter-spacing: 0.02em;
}

.page-hero .contact-list,
.footer-grid .contact-list {
    max-width: 360px;
    margin-top: 16px;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: 18px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
}

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

.stats { padding: 0 0 12px; }

.stats-grid,
.skill-grid,
.project-grid,
.post-grid { grid-template-columns: repeat(2, 1fr); }

.sites-grid { grid-template-columns: repeat(3, 1fr); }

.stat-card,
.skill-card,
.project-card,
.post-card,
.edu-card,
.job,
.contact-form {
    padding: 26px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    backdrop-filter: blur(18px);
    transition: transform 380ms ease, border-color 380ms ease, box-shadow 380ms ease;
}

.stat-card:hover,
.skill-card:hover,
.project-card:hover,
.post-card:hover,
.job:hover {
    transform: translateY(-6px);
    border-color: color-mix(in srgb, var(--accent) 45%, var(--line));
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.16);
}

.stat-card strong {
    display: block;
    color: var(--accent);
    font-size: 1.7rem;
}

.section-alt { background: color-mix(in srgb, var(--bg-alt) 78%, transparent); }
.section-copy { margin-bottom: 12px; }
.labs-heading { margin-top: 56px; }

.plain-links,
.chip-list,
.timeline,
.skill-card ul,
.job ul,
.footer-menu {
    margin: 0;
    padding: 0;
    list-style: none;
}

.plain-links { display: grid; gap: 8px; }

.skill-card ul,
.job ul {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.skill-card li,
.chip-list li,
.chip {
    padding: 6px 11px;
    border: 1px solid var(--line);
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.9rem;
}

.job ul {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.job ul li {
    padding-left: 16px;
    border: 0;
    border-radius: 0;
    position: relative;
}

.job ul li::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0.75em;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--accent);
}

.timeline { display: grid; gap: 20px; }
.job-meta,
.job-company { color: var(--muted); margin: 0 0 6px; }

.job h3,
.project-card h3,
.post-card h2,
.post-card h3,
.edu-card h3 {
    margin: 0 0 10px;
    font-family: var(--serif);
}

.project-card a,
.post-card a {
    color: inherit;
    text-decoration: none;
}

.text-link {
    display: inline-block;
    margin-top: 8px;
    font-weight: 600;
}

.chip-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 16px;
}

.game-banner { padding: 20px 0 88px; }

.game-banner-inner {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(220px, 260px);
    align-items: center;
    gap: 40px;
    padding: 40px 44px;
    border-radius: 32px;
    background:
        linear-gradient(135deg, rgba(62, 224, 255, 0.16), rgba(227, 179, 74, 0.1)),
        var(--surface);
    border: 1px solid var(--line);
}

.game-banner-copy p:last-child {
    margin-bottom: 0;
    color: var(--muted);
}

.game-launch {
    display: grid;
    justify-items: center;
    text-align: center;
    gap: 6px;
    padding: 28px 22px 24px;
    border-radius: 24px;
    color: #071018;
    text-decoration: none;
    background: linear-gradient(135deg, #43e7ff, #7af0b0);
    box-shadow: 0 16px 40px rgba(62, 224, 255, 0.22);
    transition: transform 220ms ease, box-shadow 220ms ease;
}

.game-launch:hover {
    transform: translateY(-4px);
    box-shadow: 0 22px 50px rgba(62, 224, 255, 0.34);
}

.game-launch-icon {
    display: grid;
    place-items: center;
    width: 56px;
    height: 56px;
    margin-bottom: 6px;
    border-radius: 18px;
    background: rgba(7, 16, 24, 0.14);
}

.game-launch-icon svg {
    width: 28px;
    height: 28px;
}

.game-launch strong {
    font-size: 1.15rem;
    font-weight: 800;
    letter-spacing: 0.01em;
}

.game-launch > span:last-child {
    font-size: 0.86rem;
    font-weight: 600;
    opacity: 0.72;
}

.more-link,
.pagination { margin-top: 32px; }

.contact-form,
.search-form { display: grid; gap: 16px; }
.contact-form label,
.search-form label { display: grid; gap: 8px; }

.contact-form input,
.contact-form textarea,
.search-form input {
    width: 100%;
    padding: 14px 16px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: color-mix(in srgb, var(--bg) 80%, transparent);
    color: var(--text);
    font: inherit;
}

.captcha-prompt {
    font-size: 1.15rem;
    letter-spacing: 0.04em;
    color: var(--accent, #3ee0ff);
}

.captcha-box {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.captcha-image {
    width: 220px;
    height: 64px;
    border-radius: 14px;
    border: 1px solid var(--line);
    background: #0b121c;
}

.hp-field {
    position: absolute;
    left: -9999px;
    height: 0;
    overflow: hidden;
}

.form-note { padding: 14px 16px; border-radius: 16px; }
.form-note.is-success { background: color-mix(in srgb, var(--success) 18%, transparent); }
.form-note.is-error { background: color-mix(in srgb, var(--danger) 18%, transparent); }

.article-layout {
    width: min(760px, calc(100% - 48px));
    margin: 0 auto;
    padding: 72px 0 120px;
}

.article-hero { margin-bottom: 42px; }

.article-hero h1 {
    font-size: clamp(2.2rem, 4vw, 3.4rem);
    line-height: 1.15;
}

.article-body.prose,
.prose {
    width: 100%;
    font-family: var(--serif);
    font-size: 1.2rem;
    line-height: 1.9;
}

.prose p { margin: 0 0 1.45em; }
.prose h2,
.prose h3 {
    font-family: var(--serif);
    line-height: 1.25;
    margin: 2.1em 0 0.7em;
}

.prose h2 { font-size: 1.85rem; }
.prose h3 { font-size: 1.4rem; }
.prose ul,
.prose ol {
    margin: 0 0 1.6em;
    padding-left: 1.3em;
}

.prose li { margin: 0 0 0.55em; }
.article-end { margin-top: 56px; }

.read-progress {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 12;
    width: 100%;
    height: 3px;
    background: transparent;
}

.read-progress span {
    display: block;
    height: 100%;
    width: 0;
    background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

.blog-index { padding-top: 20px; }
.article-list { display: grid; gap: 24px; }

.post-card-wide {
    padding: 36px 40px;
}

.page-article .wrap.prose {
    width: min(760px, 100%);
    padding-bottom: 80px;
}

.site-footer {
    padding: 56px 0 32px;
    border-top: 1px solid var(--line);
    background: var(--bg-alt);
}

.footer-grid { grid-template-columns: 1.4fr 1fr 1fr; }
.footer-menu { display: grid; gap: 8px; }
.footer-meta { margin-top: 28px; color: var(--muted); }

.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
}

.reveal {
    opacity: 0;
    transform: translateY(28px);
    transition: opacity 700ms cubic-bezier(0.22, 1, 0.36, 1), transform 700ms cubic-bezier(0.22, 1, 0.36, 1);
}

.reveal.is-in {
    opacity: 1;
    transform: none;
}

.nav-open .site-nav { display: block; }

@media (max-width: 980px) {
    .sites-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 860px) {
    .split,
    .about-grid,
    .stats-grid,
    .skill-grid,
    .project-grid,
    .post-grid,
    .sites-grid,
    .footer-grid,
    .game-banner-inner { grid-template-columns: 1fr; }
    .game-launch { max-width: 280px; width: 100%; margin-inline: auto; }

    .about-card { max-width: 320px; margin-inline: auto; }

    .site-nav {
        display: none;
        position: absolute;
        inset: var(--header-h) 20px auto 20px;
        padding: 16px;
        border: 1px solid var(--line);
        border-radius: 18px;
        background: var(--surface);
    }

    .menu { flex-direction: column; }
    .nav-toggle { display: inline-flex; }
    .header-actions .btn-game { display: none; }
    .article-layout,
    .wrap { width: min(100% - 32px, 1180px); }
    .post-card-wide { padding: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal {
        opacity: 1;
        transform: none;
        transition: none;
    }
    .btn,
    .stat-card,
    .skill-card,
    .project-card,
    .post-card,
    .job { transition: none; }
}
