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

:root {
    --cream: #e8e0d4;
    --dark-purple: #3d3548;
    --darker-purple: #3a3440;
    --gold: #c4a87c;
    --coral: #c4786e;
    --muted-purple: #8a7e8f;
    --light-cream: #f2ede6;
    --deepest-purple: #342a40;
}

html, body {
    height: 100%;
    overflow: hidden;
    font-family: 'Nunito', sans-serif;
    background: var(--cream);
    color: var(--dark-purple);
}

body::after {
    content: '';
    position: fixed;
    inset: 0;
    pointer-events: none;
    filter: url(#noise);
    opacity: 0.04;
    mix-blend-mode: overlay;
    z-index: 9999;
}

#sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 280px;
    height: 100%;
    background: var(--deepest-purple);
    display: flex;
    flex-direction: column;
    z-index: 100;
    padding: 2rem 0;
}

.sidebar-header {
    padding: 0 1.5rem 2rem;
    border-bottom: 1px solid rgba(196, 168, 124, 0.2);
    margin-bottom: 1rem;
}

.logo {
    font-family: 'Gaegu', cursive;
    font-weight: 700;
    font-size: 1.8rem;
    color: var(--gold);
}

.jamo-nav {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    padding: 0 1rem;
    overflow-y: auto;
}

.jamo-nav li {
    padding: 0.6rem 1rem;
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.3s, transform 0.2s;
}

.jamo-nav li:hover {
    background: rgba(196, 168, 124, 0.15);
    transform: translateX(4px);
}

.jamo-nav li.active {
    background: rgba(196, 168, 124, 0.25);
}

.jamo-nav li .jamo {
    font-family: 'Gaegu', cursive;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--light-cream);
    transition: color 0.3s;
}

.jamo-nav li:hover .jamo,
.jamo-nav li.active .jamo {
    color: var(--gold);
}

#content {
    margin-left: 280px;
    height: 100%;
    position: relative;
    overflow: hidden;
}

.panel {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transform: translateY(40px);
    transition: opacity 0.6s ease, transform 0.6s ease;
    pointer-events: none;
    padding: 3rem;
    overflow-y: auto;
}

.panel.active {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

.panel-inner {
    max-width: 800px;
    width: 100%;
    position: relative;
    z-index: 2;
}

.hero-title {
    font-family: 'Gaegu', cursive;
    font-weight: 700;
    font-size: clamp(4rem, 12vw, 12rem);
    color: var(--dark-purple);
    letter-spacing: 0.02em;
    line-height: 1;
    margin-bottom: 1rem;
}

.hero-subtitle {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(1.2rem, 3vw, 2.4rem);
    color: var(--coral);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1.5rem;
}

.hero-desc {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1.1rem;
    line-height: 1.8;
    color: var(--muted-purple);
    max-width: 600px;
}

.halftone-bg {
    position: absolute;
    inset: 0;
    background-image: radial-gradient(circle, var(--coral) 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.06;
    z-index: 1;
}

.section-title {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: clamp(2rem, 5vw, 3.5rem);
    color: var(--dark-purple);
    margin-bottom: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.section-body {
    font-family: 'Noto Sans KR', sans-serif;
    font-size: 1.1rem;
    line-height: 1.9;
    color: var(--darker-purple);
    margin-bottom: 2.5rem;
    max-width: 650px;
}

.hangul-display {
    font-family: 'Gaegu', cursive;
    font-weight: 700;
    font-size: clamp(3rem, 8vw, 7rem);
    color: var(--gold);
    margin: 1.5rem 0;
}

.caption {
    font-family: 'Fira Code', monospace;
    font-size: 0.85rem;
    color: var(--muted-purple);
    letter-spacing: 0.02em;
}

.jamo-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 1rem;
    max-width: 600px;
}

.jamo-card {
    background: var(--light-cream);
    border-radius: 12px;
    padding: 1.2rem;
    text-align: center;
    transition: transform 0.3s, box-shadow 0.3s;
    border: 2px solid transparent;
}

.jamo-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(61, 53, 72, 0.12);
    border-color: var(--gold);
}

.jamo-card span {
    font-family: 'Gaegu', cursive;
    font-size: 2.2rem;
    font-weight: 700;
    color: var(--dark-purple);
    display: block;
    margin-bottom: 0.3rem;
}

.jamo-card small {
    font-family: 'Fira Code', monospace;
    font-size: 0.7rem;
    color: var(--muted-purple);
}

.block-demo {
    display: flex;
    align-items: center;
    gap: 2rem;
    margin-top: 2rem;
    flex-wrap: wrap;
}

.block-explode {
    display: flex;
    gap: 1rem;
}

.block-part {
    font-family: 'Gaegu', cursive;
    font-size: 3rem;
    font-weight: 700;
    color: var(--coral);
    background: var(--light-cream);
    width: 70px;
    height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    border: 2px solid var(--coral);
}

.block-arrow {
    font-size: 2.5rem;
    color: var(--muted-purple);
}

.block-result {
    font-family: 'Gaegu', cursive;
    font-size: 5rem;
    font-weight: 700;
    color: var(--gold);
}

.vowel-display {
    display: flex;
    gap: 1.5rem;
    flex-wrap: wrap;
    margin-top: 1rem;
}

.vowel-char {
    font-family: 'Gaegu', cursive;
    font-size: 4rem;
    font-weight: 300;
    color: var(--dark-purple);
    transition: color 0.3s, transform 0.3s;
    cursor: default;
}

.vowel-char:hover {
    color: var(--coral);
    transform: scale(1.2);
}

.feature-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    max-width: 500px;
}

.feature-card {
    background: var(--deepest-purple);
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
}

.feature-num {
    font-family: 'Nunito', sans-serif;
    font-weight: 900;
    font-size: 2.5rem;
    color: var(--gold);
    display: block;
}

.feature-label {
    font-family: 'Fira Code', monospace;
    font-size: 0.8rem;
    color: var(--muted-purple);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.code-block {
    background: var(--deepest-purple);
    border-radius: 12px;
    padding: 2rem;
    overflow-x: auto;
}

.code-block code {
    font-family: 'Fira Code', monospace;
    font-size: 0.9rem;
    color: var(--light-cream);
    line-height: 1.8;
}

#jamo-dust {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 50;
}

@media (max-width: 768px) {
    #sidebar {
        position: fixed;
        left: 0;
        top: auto;
        bottom: 0;
        width: 100%;
        height: 70px;
        flex-direction: row;
        padding: 0 1rem;
        align-items: center;
    }

    .sidebar-header {
        display: none;
    }

    .jamo-nav {
        flex-direction: row;
        overflow-x: auto;
        overflow-y: hidden;
        gap: 0;
        padding: 0;
    }

    .jamo-nav li {
        padding: 0.5rem 0.7rem;
    }

    .jamo-nav li .jamo {
        font-size: 1.3rem;
    }

    #content {
        margin-left: 0;
        margin-bottom: 70px;
    }

    .jamo-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 0.5rem;
    }

    .feature-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}
