:root {
    --bg: #050505;
    --bg-deep: #0a0a0a;
    --surface: #121212;
    --ink: #f4f4f5;
    --ink-soft: #d4d4d8;
    --muted: #a1a1aa;
    --line: rgba(255, 255, 255, 0.1);
    --accent: #2dd4bf;
    --accent-hot: #fb923c;
    --accent-soft: rgba(45, 212, 191, 0.14);
    --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
    --radius: 18px;
    --nav-h: 68px;
    --font-display: "Outfit", "Zen Kaku Gothic New", sans-serif;
    --font-body: "Zen Kaku Gothic New", "Hiragino Sans", sans-serif;
    --max: 1120px;
}

*, *::before, *::after { box-sizing: border-box; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 20px);
}

body {
    margin: 0;
    color: var(--ink);
    font-family: var(--font-body);
    font-size: 16px;
    line-height: 1.7;
    background:
        radial-gradient(ellipse 80% 50% at 70% -10%, rgba(45, 212, 191, 0.12), transparent 55%),
        radial-gradient(ellipse 60% 40% at 0% 30%, rgba(251, 146, 60, 0.08), transparent 50%),
        var(--bg);
    -webkit-font-smoothing: antialiased;
}

main {
    padding-top: var(--nav-h);
}

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

a { color: inherit; }

.container {
    width: min(100% - 40px, var(--max));
    margin-inline: auto;
}

/* ── Nav ── */
.navbar {
    position: fixed;
    inset: 0 0 auto;
    z-index: 1000;
    height: var(--nav-h);
    background: rgba(5, 5, 5, 0.88);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}

.navbar .container {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 100%;
}

.navbar-brand {
    font-family: var(--font-display);
    font-weight: 800;
    font-size: 1.15rem;
    letter-spacing: -0.03em;
    text-decoration: none;
    color: var(--ink);
}

.navbar-brand span { color: var(--accent); }

.nav-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--line);
    border-radius: 10px;
    width: 42px;
    height: 42px;
    cursor: pointer;
    color: var(--ink);
    font-size: 1.1rem;
}

.nav-links {
    display: flex;
    gap: 4px;
    list-style: none;
    margin: 0;
    padding: 0;
}

.nav-links a {
    display: inline-block;
    padding: 8px 14px;
    text-decoration: none;
    color: var(--muted);
    font-weight: 600;
    font-size: 0.92rem;
    border-radius: 999px;
    transition: color 0.2s, background 0.2s;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent);
    background: var(--accent-soft);
}

/* ── Buttons ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 46px;
    padding: 0 20px;
    border-radius: 999px;
    border: 1px solid transparent;
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.btn:hover { transform: translateY(-1px); }

.btn-primary {
    background: var(--accent);
    color: #04110f;
    box-shadow: 0 10px 24px rgba(45, 212, 191, 0.28);
}

.btn-primary:hover { background: #5eead4; color: #04110f; }

.btn-ghost {
    background: rgba(255, 255, 255, 0.08);
    border-color: rgba(255, 255, 255, 0.28);
    color: #fff;
    backdrop-filter: blur(8px);
}

.btn-ghost:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }

.btn-solid {
    background: #fff;
    color: #050505;
}

.btn-solid:hover { background: #e4e4e7; color: #050505; }

.btn-outline {
    background: transparent;
    border-color: var(--line);
    color: var(--ink);
}

.btn-outline:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: var(--accent-soft);
}

.btn-group {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* ── Sections ── */
.section {
    padding: 88px 0;
}

.section-head {
    margin-bottom: 40px;
    max-width: 36rem;
}

.section-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.8rem, 4vw, 2.6rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.15;
}

.reveal {
    opacity: 1;
    transform: none;
}

/* ── Featured games ── */
.games {
    display: grid;
    gap: 56px;
}

.game {
    display: grid;
    gap: 28px;
}

.game-intro h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.6rem, 3vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.03em;
}

.game-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr);
    gap: 24px;
    align-items: start;
}

.screen-stage,
.editor-stage {
    background: #000;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.screen-stage {
    aspect-ratio: 256 / 240;
    position: relative;
}

.game-carousel {
    position: absolute;
    inset: 0;
}

.game-carousel img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    object-position: center top;
    image-rendering: pixelated;
    opacity: 0;
    transition: opacity 0.85s ease;
}

.game-carousel img.is-active {
    opacity: 1;
    z-index: 1;
}

.editor-stage {
    padding: 18px;
    display: grid;
    gap: 14px;
}

.editor-label {
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--accent);
}

.editor-stage img {
    width: 100%;
    border-radius: 10px;
    image-rendering: pixelated;
    background: #000;
}

.game-actions {
    margin-top: 4px;
}

.video-frame {
    position: relative;
    width: 100%;
    aspect-ratio: 16 / 9;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
    border: 1px solid var(--line);
    box-shadow: var(--shadow);
}

.video-frame iframe {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
}

/* ── App gallery ── */
.app-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 28px 20px;
}

.app-item {
    display: grid;
    gap: 12px;
    text-align: left;
    text-decoration: none;
    color: inherit;
    transition: transform 0.25s ease;
}

.app-item:hover { transform: translateY(-4px); }

.app-item.is-static { cursor: default; }
.app-item.is-static:hover { transform: none; }

.app-thumb {
    aspect-ratio: 9 / 16;
    border-radius: 16px;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.35);
}

.app-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
}

.app-item h4 {
    margin: 0;
    font-size: 0.98rem;
    font-weight: 700;
    letter-spacing: -0.01em;
    line-height: 1.35;
    color: var(--ink);
}

.app-item .meta {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--accent);
}

.app-item.discontinued {
    opacity: 0.55;
}

.app-item.discontinued .meta {
    color: var(--accent-hot);
}

.app-item.discontinued h4 {
    text-decoration: line-through;
    color: var(--muted);
}

/* ── Tools ── */
.tool-row {
    display: grid;
    grid-template-columns: minmax(0, 280px) minmax(0, 1fr);
    gap: 28px;
    align-items: center;
    padding: 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}

.tool-row img {
    width: 100%;
    border-radius: 12px;
    image-rendering: pixelated;
    background: #000;
}

.tool-row h3 {
    margin: 0 0 18px;
    font-family: var(--font-display);
    font-size: 1.6rem;
    font-weight: 800;
}

/* ── Footer ── */
.site-footer {
    padding: 56px 0 72px;
    border-top: 1px solid var(--line);
    text-align: center;
}

.site-footer .copyright {
    margin: 18px 0 12px;
    color: var(--muted);
    font-size: 0.9rem;
}

.back-to-top {
    position: fixed;
    right: 20px;
    bottom: 20px;
    z-index: 900;
    width: 44px;
    height: 44px;
    border: 0;
    border-radius: 999px;
    background: #fff;
    color: #050505;
    cursor: pointer;
    opacity: 0;
    pointer-events: none;
    transform: translateY(8px);
    transition: opacity 0.25s, transform 0.25s;
}

.back-to-top.visible {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

/* ── Contact page ── */
.mail-page {
    min-height: 100vh;
    padding: calc(var(--nav-h) + 48px) 0 64px;
}

.mail-panel {
    width: min(100% - 40px, 640px);
    margin: 0 auto;
    padding: 36px 28px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    text-align: center;
}

.mail-panel h1 {
    margin: 0 0 24px;
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -0.03em;
}

.back-link {
    display: inline-block;
    margin-top: 28px;
    color: var(--accent);
    font-weight: 700;
    text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 860px) {
    .nav-toggle { display: inline-flex; align-items: center; justify-content: center; }

    .nav-links {
        display: none;
        position: absolute;
        top: calc(var(--nav-h) - 1px);
        left: 0;
        right: 0;
        flex-direction: column;
        gap: 0;
        padding: 12px 16px 18px;
        background: rgba(5, 5, 5, 0.96);
        border-bottom: 1px solid var(--line);
        backdrop-filter: blur(16px);
    }

    .nav-links.open { display: flex; }

    .game-layout,
    .tool-row {
        grid-template-columns: 1fr;
    }

    .section { padding: 64px 0; }

    .app-gallery {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 480px) {
    .container { width: min(100% - 28px, var(--max)); }

    .app-gallery { gap: 20px 12px; }
}

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