* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg: #000;
    --text: #e8e8e8;
    --text-dim: #666;
    --accent: #888;
}

/* Intro Animation */
#intro-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: #000;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: opacity 0.8s ease-out;
}

#intro-overlay.fade-out {
    opacity: 0;
    pointer-events: none;
}

#intro-overlay.hidden {
    display: none;
}

#cube-canvas {
    position: absolute;
    width: 100%;
    height: 100%;
}

#intro-hero {
    position: absolute;
    top: 80px;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 10;
    pointer-events: none;
}

#intro-hero .intro-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 28px;
}

#intro-hero h1 {
    font-size: 36px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 12px;
}

#intro-hero h1 .handle {
    color: var(--text-dim);
    font-weight: 400;
    font-size: 20px;
}

#intro-hero p {
    font-size: 16px;
    color: var(--accent);
}

#intro-hero .intro-tagline {
    margin-top: 20px;
    font-size: 14px;
    color: var(--text-dim);
    font-style: italic;
}

#click-hint {
    position: absolute;
    bottom: 60px;
    color: #444;
    font-family: 'JetBrains Mono', monospace;
    font-size: 14px;
    letter-spacing: 2px;
    animation: pulse 2s ease-in-out infinite;
    z-index: 10;
}

@keyframes pulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 1; }
}

/* Terminal Animation */
.terminal-container {
    position: absolute;
    width: 280px;
    height: 165px;
    background: rgba(0, 0, 0, 0.6);
    border: 1px solid #333;
    border-radius: 6px;
    padding: 12px 14px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 11px;
    color: #888;
    overflow: hidden;
    z-index: 5;
    opacity: 0.7;
}

.terminal-container::before {
    content: '● ● ●';
    display: block;
    font-size: 8px;
    color: #444;
    margin-bottom: 10px;
    letter-spacing: 4px;
}

.terminal-line {
    white-space: nowrap;
    overflow: hidden;
    margin-bottom: 4px;
    opacity: 0;
    animation: fadeInLine 0.3s ease forwards;
}

.terminal-line.fade-out {
    animation: fadeOutLine 0.3s ease forwards;
}

@keyframes fadeInLine {
    from { opacity: 0; transform: translateY(5px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeOutLine {
    from { opacity: 1; transform: translateY(0); }
    to { opacity: 0; transform: translateY(-5px); }
}

.terminal-prompt {
    color: #6a9955;
}

.terminal-command {
    color: #dcdcaa;
}

.terminal-string {
    color: #ce9178;
}

.terminal-keyword {
    color: #569cd6;
}

.terminal-comment {
    color: #6a9955;
}

.terminal-left-top {
    left: 5%;
    top: 15%;
}

.terminal-left-bottom {
    left: 8%;
    bottom: 20%;
}

.terminal-right-top {
    right: 5%;
    top: 18%;
}

.terminal-right-bottom {
    right: 8%;
    bottom: 22%;
}

@media (max-width: 1200px) {
    .terminal-container {
        display: none;
    }
}

#floating-particles {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: -1;
}

main .hero {
    opacity: 0;
}

main.visible .hero {
    opacity: 1;
}

/* Hide content only when intro is playing */
main.intro-playing section:not(.hero) h2,
main.intro-playing section:not(.hero) h3,
main.intro-playing section:not(.hero) p,
main.intro-playing section:not(.hero) .year {
    visibility: hidden;
}

main.intro-playing.typing-started section:not(.hero) h2,
main.intro-playing.typing-started section:not(.hero) h3,
main.intro-playing.typing-started section:not(.hero) p,
main.intro-playing.typing-started section:not(.hero) .year {
    visibility: visible;
}

/* Hide project boxes until typing starts */
.project.typing-pending,
.side-item.typing-pending {
    border-color: transparent;
}

.project.typing-pending h3,
.project.typing-pending .project-tags,
.project.typing-pending p,
.side-item.typing-pending h3,
.side-item.typing-pending p {
    visibility: hidden;
}

/* Typing effect */
.typing-hidden {
    opacity: 0;
}

.typing-cursor {
    display: inline-block;
    width: 0.55em;
    height: 1.15em;
    background: #e8e8e8;
    vertical-align: text-bottom;
    margin-left: 1px;
    animation: cursor-blink 0.7s step-end infinite;
}

@keyframes cursor-blink {
    0%, 50% { opacity: 1; }
    51%, 100% { opacity: 0; }
}

body {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg);
    color: var(--text);
    line-height: 1.9;
    font-size: 15px;
}

/* Navigation */
.about {
    position: relative;
}

.about p a {
    color: #999;
    text-decoration: underline;
    text-underline-offset: 3px;
    transition: color 0.2s;
}

.about p a:hover {
    color: #fff;
}

.about-nav {
    position: absolute;
    top: -75px;
    right: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.nav-link {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 14px;
    transition: color 0.2s;
}

.nav-link:hover {
    color: var(--text);
}

.lang-switch {
    display: flex;
    gap: 4px;
}

.lang-btn {
    background: transparent;
    border: 1px solid #333;
    color: var(--text-dim);
    padding: 6px 12px;
    font-family: inherit;
    font-size: 12px;
    cursor: pointer;
    transition: all 0.2s;
}

.lang-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.lang-btn.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

.effect-btn {
    background: transparent;
    border: 1px solid #333;
    color: var(--text-dim);
    padding: 6px 10px;
    font-family: inherit;
    font-size: 10px;
    cursor: pointer;
    transition: all 0.2s;
    margin-left: 8px;
}

.effect-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.effect-btn.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

/* Main */
main {
    max-width: 720px;
    margin: 0 auto;
    padding: 80px 32px 80px;
    position: relative;
    z-index: 1;
    background: var(--bg);
}

/* Hero */
.hero {
    margin-bottom: 110px;
    text-align: center;
}

.hero-logo {
    width: 80px;
    height: 80px;
    margin-bottom: 28px;
}

.hero h1 {
    font-size: 36px;
    font-weight: 700;
    margin-bottom: 12px;
}

.handle {
    color: var(--text-dim);
    font-weight: 400;
    font-size: 20px;
}

.role {
    color: var(--accent);
    font-size: 16px;
}

/* Sections */
section {
    margin-bottom: 80px;
}

section:last-child {
    margin-bottom: 0;
}

section h2 {
    font-size: 12px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 2px;
    margin-bottom: 28px;
}

/* About */
.about p {
    margin-bottom: 20px;
    color: #bbb;
    font-size: 15px;
}

.about p:last-child {
    margin-bottom: 0;
}

/* Table of Contents */
.toc {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 80px;
    padding: 24px 0;
    border-top: 1px solid #222;
    border-bottom: 1px solid #222;
}

.toc a {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.2s;
}

.toc a:hover {
    color: var(--text);
}

.toc-dot {
    color: #333;
    font-size: 13px;
}

/* History */
.history .item {
    margin-bottom: 28px;
}

.history .item:last-child {
    margin-bottom: 0;
}

.history .year {
    display: block;
    color: #e8e8e8;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.history .year a {
    color: #e8e8e8;
    text-decoration: none;
    border-bottom: 1px solid #444;
    padding-bottom: 2px;
    transition: border-color 0.2s, color 0.2s;
}

.history .year a:hover {
    border-bottom-color: var(--text);
    color: #fff;
}

.history .item p {
    color: #999;
    font-size: 14px;
    line-height: 1.9;
}

/* Presentation */
.presentation .item {
    margin-bottom: 28px;
}

.presentation .item:last-child {
    margin-bottom: 0;
}

.presentation .year {
    display: block;
    color: #e8e8e8;
    font-size: 16px;
    font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: 1px;
}

.presentation .year a {
    color: #e8e8e8;
    text-decoration: none;
    border-bottom: 1px solid #444;
    padding-bottom: 2px;
    transition: border-color 0.2s, color 0.2s;
}

.presentation .year a:hover {
    border-bottom-color: var(--text);
    color: #fff;
}

.presentation .item p {
    color: #999;
    font-size: 14px;
    line-height: 1.9;
}

/* Tags (Interested) */
.tags {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.tags span {
    padding: 10px 16px;
    border: 1px solid #333;
    font-size: 13px;
    color: #aaa;
    transition: all 0.2s;
}

.tags span:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Projects */
.project {
    margin-bottom: 20px;
    padding: 28px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 8px;
    transition: border-color 0.25s, background 0.25s;
    position: relative;
    cursor: pointer;
}

.project h3 a::after {
    content: '';
    position: absolute;
    inset: 0;
}

.project:hover {
    border-color: #333;
    background: #0d0d0d;
}

.project:last-child {
    margin-bottom: 0;
}

.project h3 {
    font-size: 18px;
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.project h3 a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

.project h3 a:hover {
    color: var(--accent);
}

.project h3::after {
    content: '→';
    color: #333;
    font-size: 16px;
    transition: color 0.25s, transform 0.25s;
}

.project:hover h3::after {
    color: #666;
    transform: translateX(3px);
}

.project .project-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.project .project-tags span {
    font-size: 11px;
    color: #555;
    padding: 2px 8px;
    border: 1px solid #1a1a1a;
    border-radius: 3px;
    background: #050505;
}

.project p {
    color: #777;
    font-size: 13.5px;
    line-height: 1.85;
}

/* Side Projects */
.side-projects {
    margin-bottom: 80px;
}

.side-projects h2 {
    margin-bottom: 32px;
}

.side-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.side-item {
    padding: 14px 16px;
    background: #0a0a0a;
    border: 1px solid #1a1a1a;
    border-radius: 6px;
}

.side-item h3 {
    font-size: 13px;
    font-weight: 600;
    color: #bbb;
    margin-bottom: 6px;
}

.side-item p {
    color: #555;
    font-size: 11px;
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Contributions */
.contributions .contrib-item {
    margin-bottom: 24px;
}

.contributions .contrib-item:last-child {
    margin-bottom: 0;
}

.contrib-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 6px;
}

.contrib-repo {
    color: var(--text);
    font-size: 15px;
    font-weight: 700;
}

.contrib-pr {
    color: var(--text-dim);
    text-decoration: none;
    font-size: 13px;
    border-bottom: 1px solid #333;
    padding-bottom: 1px;
    transition: color 0.2s, border-color 0.2s;
}

.contrib-pr:hover {
    color: var(--text);
    border-bottom-color: var(--text);
}

.contrib-desc {
    color: #888;
    font-size: 14px;
    line-height: 1.7;
}

/* Contact */
.contact p {
    margin-bottom: 12px;
    font-size: 15px;
}

.contact a {
    color: var(--text);
    text-decoration: none;
    transition: color 0.2s;
}

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

/* Q&A Page */
.qna-intro {
    position: relative;
    margin-bottom: 60px;
}

.qna-intro h2 {
    margin-bottom: 16px;
}

.qna-date {
    color: var(--text-dim);
    font-size: 13px;
    margin-bottom: 20px;
}

.qna-introduce {
    color: #999;
    font-size: 15px;
    line-height: 1.9;
}

.qna-list {
    margin-bottom: 80px;
}

.qna-item {
    margin-bottom: 48px;
}

.qna-item:last-child {
    margin-bottom: 0;
}

.qna-item .question {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 16px;
}

.qna-item .question::before {
    content: 'Q. ';
    font-weight: 700;
    color: #fff;
}

.qna-item .question.sub-question {
    margin-top: 28px;
}

.qna-item .answer {
    color: #ddd;
    font-size: 16px;
    line-height: 2;
}

.qna-item .answer::before {
    content: 'A. ';
    font-weight: 700;
    color: #aaa;
}

/* Footer */
footer {
    text-align: center;
    padding: 40px 32px;
    color: var(--text-dim);
    font-size: 12px;
}

#replay-intro {
    background: transparent;
    border: none;
    color: #666;
    font-size: 14px;
    cursor: pointer;
    padding: 8px;
    margin-top: 12px;
    opacity: 0.5;
    transition: opacity 0.2s;
}

#replay-intro:hover {
    opacity: 1;
    color: #999;
}

/* Crafts Gallery */
.crafts {
    max-width: 100%;
    margin: 0 auto;
    padding: 0 0 80px;
    background: var(--bg);
}

.crafts-toggle {
    text-align: right;
    margin-bottom: 16px;
    padding-right: 32px;
}

.carousel-btn {
    background: transparent;
    border: 1px solid #333;
    color: var(--text-dim);
    padding: 6px 10px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    border-radius: 4px;
}

.carousel-btn:hover {
    border-color: var(--text);
    color: var(--text);
}

.carousel-btn.active {
    background: var(--text);
    border-color: var(--text);
    color: var(--bg);
}

/* Carousel Mode (default) */
.crafts-carousel {
    overflow: hidden;
    width: 100%;
}

.carousel-track {
    display: flex;
    gap: 12px;
    animation: carousel-scroll 60s linear infinite;
}

.crafts-carousel .craft-item {
    flex: 0 0 220px;
    width: 220px;
    height: 220px;
    border-radius: 8px;
    overflow: hidden;
}

.crafts-carousel .craft-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
    filter: grayscale(100%);
    transition: filter 0.4s ease, transform 0.4s ease;
}

.crafts-carousel .craft-item:hover img {
    filter: grayscale(0%);
    transform: scale(1.05);
}

@keyframes carousel-scroll {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(calc(-232px * 24));
    }
}

/* Grid Mode */
.crafts.grid-mode {
    max-width: 1000px;
    padding: 0 48px 80px;
}

.crafts.grid-mode .crafts-carousel {
    overflow: visible;
}

.crafts.grid-mode .carousel-track {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    animation: none;
}

.crafts.grid-mode .craft-item {
    flex: none;
    width: 100%;
    height: auto;
    aspect-ratio: 1;
}

/* Hide duplicates in grid mode */
.crafts.grid-mode .craft-item:nth-child(n+25) {
    display: none;
}

/* Responsive */
@media (max-width: 700px) {
    main {
        padding: 60px 20px 60px;
    }

    .about-nav {
        position: static;
        margin-bottom: 20px;
    }

    .hero {
        margin-bottom: 60px;
    }

    .hero-logo {
        width: 64px;
        height: 64px;
    }

    .hero h1 {
        font-size: 28px;
    }

    .handle {
        font-size: 16px;
    }

    section {
        margin-bottom: 60px;
    }

    .project {
        padding: 18px;
    }

    .side-grid {
        grid-template-columns: 1fr;
    }

    .side-item {
        padding: 14px 16px;
    }

    .crafts {
        padding: 0 20px 60px;
    }

    .crafts.grid-mode .carousel-track {
        grid-template-columns: repeat(4, 1fr);
        gap: 8px;
    }

    .crafts-carousel .craft-item {
        flex: 0 0 160px;
        width: 160px;
        height: 160px;
    }
}
