/* ==============================================================
   Learn Hangul with Fun — design system
   Palette: hanji paper · ink · celadon · seal-paste red
   Type:    Gowun Batang (display) · Pretendard (body)
   Motif:   manuscript-paper cells (원고지) — letters live in squares
   ============================================================== */
@import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard@v1.3.9/dist/web/static/pretendard.min.css');
@import url('https://fonts.googleapis.com/css2?family=Gowun+Batang:wght@400;700&display=swap');

:root {
    --paper: #FAF7EF;
    --paper-deep: #F1EBDC;
    --card: #FFFEFA;
    --line: #DCD2BC;
    --line-soft: #E8E1D0;
    --ink: #262117;
    --ink-soft: #7C7361;
    --celadon: #2F6D5E;
    --celadon-deep: #234F44;
    --celadon-tint: #E3ECE3;
    --seal: #C4482A;
    --seal-deep: #A83A20;
    --serif: 'Gowun Batang', 'Apple SD Gothic Neo', 'Noto Serif KR', serif;
    --sans: 'Pretendard', -apple-system, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
}

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

body {
    font-family: var(--sans);
    line-height: 1.65;
    color: var(--ink);
    background-color: var(--paper);
}

.container {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 24px;
}

a {
    color: var(--celadon);
}

::selection {
    background: var(--celadon-tint);
    color: var(--celadon-deep);
}

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

/* Korean showcase text keeps the bookish serif */
.korean-title,
.large-korean,
.korean-examples,
.korean-text {
    font-family: var(--serif);
    font-weight: 700;
}

/* ------------------------------------------------ header ---- */
header {
    background: var(--paper);
    border-bottom: 1px solid var(--line);
    padding: 0;
}

.header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1.5rem;
    min-height: 68px;
    flex-wrap: wrap;
    padding-top: 10px;
    padding-bottom: 10px;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: var(--ink);
}

.brand-seal {
    width: 40px;
    height: 40px;
    background: var(--seal);
    color: #FBF3E4;
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.35rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    transform: rotate(-3deg);
    box-shadow: inset 0 0 0 2px rgba(255, 245, 225, .28);
}

.brand-name {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.15rem;
    line-height: 1.25;
}

.brand-name em {
    display: block;
    font-family: var(--sans);
    font-style: normal;
    font-weight: 500;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--ink-soft);
}

.main-nav ul {
    list-style: none;
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.nav-link {
    display: block;
    color: var(--ink);
    text-decoration: none;
    font-size: 0.95rem;
    font-weight: 500;
    padding: 0.45rem 0.7rem;
    border-radius: 6px;
    transition: background 0.15s ease, color 0.15s ease;
}

.nav-link:hover {
    background: var(--paper-deep);
    color: var(--celadon-deep);
}

.nav-link.active {
    color: var(--seal);
    font-weight: 700;
    background: none;
    box-shadow: inset 0 -2px 0 var(--seal);
    border-radius: 0;
}

/* -------------------------------------------------- hero ---- */
.hero {
    padding: 4.5rem 0 4rem;
    border-bottom: 1px solid var(--line);
    background-image:
        repeating-linear-gradient(0deg, transparent 0 55px, rgba(38, 33, 23, 0.045) 55px 56px),
        repeating-linear-gradient(90deg, transparent 0 55px, rgba(38, 33, 23, 0.045) 55px 56px);
}

.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 3rem;
    align-items: center;
}

.eyebrow {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--celadon);
    margin-bottom: 1rem;
}

.hero-title {
    font-family: var(--serif);
    font-weight: 700;
    font-size: clamp(2.1rem, 4.6vw, 3.1rem);
    line-height: 1.22;
    margin-bottom: 1.2rem;
}

.hero-title .accent {
    color: var(--celadon);
}

.hero-description {
    font-size: 1.06rem;
    color: var(--ink-soft);
    max-width: 30rem;
    margin-bottom: 2rem;
}

.hero-actions {
    display: flex;
    align-items: center;
    gap: 1.4rem;
    flex-wrap: wrap;
}

/* the signature: syllable assembly in manuscript cells */
.block-demo {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}

.block-row {
    display: flex;
    align-items: center;
    gap: 0.9rem;
}

.cell {
    position: relative;
    background: var(--card);
    border: 1.5px solid var(--ink);
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-family: var(--serif);
    font-weight: 700;
    color: var(--ink);
    box-shadow: 3px 3px 0 rgba(38, 33, 23, 0.12);
}

.cell::before,
.cell::after {
    content: '';
    position: absolute;
    background-image: linear-gradient(to bottom, var(--line-soft) 55%, transparent 0);
    background-size: 1px 7px;
    pointer-events: none;
}

.cell::before {
    left: 50%;
    top: 7%;
    bottom: 7%;
    width: 1px;
}

.cell::after {
    top: 50%;
    left: 7%;
    right: 7%;
    height: 1px;
    background-image: linear-gradient(to right, var(--line-soft) 55%, transparent 0);
    background-size: 7px 1px;
}

.cell-sm {
    width: 74px;
    height: 74px;
    font-size: 2.1rem;
    color: var(--celadon);
}

.cell-lg {
    width: 128px;
    height: 128px;
    font-size: 4.2rem;
}

.block-op {
    font-family: var(--sans);
    font-size: 1.4rem;
    font-weight: 300;
    color: var(--ink-soft);
}

.block-caption {
    font-size: 0.85rem;
    color: var(--ink-soft);
    letter-spacing: 0.04em;
}

.block-caption b {
    color: var(--celadon-deep);
    font-weight: 700;
}

.block-demo .swap {
    transition: opacity 0.28s ease;
}

.block-demo.swapping .swap {
    opacity: 0;
}

/* ----------------------------------------------- buttons ---- */
.btn,
.step-link,
.game-button {
    display: inline-block;
    background: var(--celadon);
    color: #F6F3EA;
    text-decoration: none;
    font-weight: 600;
    font-size: 0.98rem;
    padding: 0.72rem 1.5rem;
    border: 1px solid var(--celadon-deep);
    border-radius: 8px;
    transition: background 0.15s ease, transform 0.15s ease;
}

.btn:hover,
.step-link:hover,
.game-button:hover {
    background: var(--celadon-deep);
    transform: translateY(-1px);
}

.btn.primary,
.game-button.primary {
    background: var(--seal);
    border-color: var(--seal-deep);
}

.btn.primary:hover,
.game-button.primary:hover {
    background: var(--seal-deep);
}

.btn.quiet {
    background: none;
    border: none;
    color: var(--celadon-deep);
    padding: 0.72rem 0;
    text-decoration: underline;
    text-underline-offset: 4px;
    text-decoration-color: var(--line);
}

.btn.quiet:hover {
    background: none;
    text-decoration-color: var(--celadon);
    transform: none;
}

/* ------------------------------------------- section base ---- */
.section {
    padding: 4.2rem 0;
}

.section-head {
    max-width: 34rem;
    margin-bottom: 2.6rem;
}

.section-head h2 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.9rem;
    line-height: 1.3;
    margin-bottom: 0.5rem;
}

.section-head p {
    color: var(--ink-soft);
}

/* --------------------------------------------- the course ---- */
.course-steps {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1.1rem;
    counter-reset: step;
}

.course-card {
    counter-increment: step;
    position: relative;
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.5rem 1.3rem 1.4rem;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.course-card:hover {
    border-color: var(--celadon);
    box-shadow: 4px 4px 0 var(--celadon-tint);
}

.course-card::before {
    content: counter(step);
    position: absolute;
    top: -1px;
    left: -1px;
    width: 30px;
    height: 30px;
    border: 1px solid var(--line);
    border-radius: 10px 0 8px 0;
    background: var(--paper-deep);
    color: var(--ink-soft);
    font-size: 0.8rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}

.course-sample {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 2rem;
    color: var(--celadon);
    margin: 0.8rem 0 0.7rem;
    min-height: 2.9rem;
    line-height: 1.2;
}

.course-sample small {
    font-size: 1.15rem;
    color: var(--ink-soft);
    font-weight: 400;
}

.course-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.35rem;
}

.course-card p {
    font-size: 0.92rem;
    color: var(--ink-soft);
    margin-bottom: 1.1rem;
    flex-grow: 1;
}

.course-card .go {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--celadon-deep);
    text-decoration: none;
}

.course-card .go:hover {
    color: var(--seal);
}

/* --------------------------------------------- game room ---- */
.game-room {
    background: var(--celadon-deep);
    color: #EDF2EA;
    padding: 4.2rem 0;
}

.game-room .section-head h2 {
    color: #F6F3EA;
}

.game-room .section-head p {
    color: rgba(240, 243, 234, 0.72);
}

.game-list {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1.1rem;
}

.game-tile {
    display: block;
    text-decoration: none;
    background: rgba(250, 247, 239, 0.06);
    border: 1px solid rgba(250, 247, 239, 0.16);
    border-radius: 10px;
    padding: 1.4rem 1.3rem 1.3rem;
    color: #EDF2EA;
    transition: background 0.15s ease, border-color 0.15s ease;
}

.game-tile:hover {
    background: rgba(250, 247, 239, 0.11);
    border-color: rgba(250, 247, 239, 0.4);
}

.game-tile .sample {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.7rem;
    color: #CFE3CE;
    display: block;
    margin-bottom: 0.55rem;
    line-height: 1.25;
}

.game-tile h3 {
    font-size: 1.02rem;
    margin-bottom: 0.2rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.game-tile .tag {
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    background: var(--seal);
    color: #FBF3E4;
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
}

.game-tile p {
    font-size: 0.9rem;
    color: rgba(240, 243, 234, 0.72);
}

.game-tile .play {
    display: inline-block;
    margin-top: 0.8rem;
    font-size: 0.88rem;
    font-weight: 600;
    color: #CFE3CE;
}

.game-tile:hover .play {
    color: #fff;
}

/* --------------------------------- interior page header ---- */
.page-header {
    background: var(--paper-deep);
    border-bottom: 1px solid var(--line);
    padding: 3rem 0 2.6rem;
    text-align: center;
    background-image:
        repeating-linear-gradient(0deg, transparent 0 55px, rgba(38, 33, 23, 0.04) 55px 56px),
        repeating-linear-gradient(90deg, transparent 0 55px, rgba(38, 33, 23, 0.04) 55px 56px);
}

.page-title {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 2.6rem;
    color: var(--ink);
    margin-bottom: 0.4rem;
}

.page-subtitle {
    font-size: 1rem;
    color: var(--ink-soft);
}

/* ------------------------------------------ content areas ---- */
.content-section {
    padding: 3.2rem 0;
    background: var(--paper);
}

.content-section h2 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.8rem;
    margin-bottom: 1.4rem;
    color: var(--ink);
    text-align: center;
}

.section-content {
    max-width: 780px;
    margin: 0 auto;
    text-align: center;
}

.section-content p {
    color: var(--ink-soft);
    margin-bottom: 0.8rem;
}

/* ---------------------------------------- character cards ---- */
.character-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(128px, 1fr));
    gap: 0.9rem;
    margin: 2rem 0;
}

.character-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.2rem 0.8rem 1rem;
    text-align: center;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    cursor: pointer;
}

.character-card:hover {
    border-color: var(--celadon);
    box-shadow: 3px 3px 0 var(--celadon-tint);
}

.character-korean {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 2.4rem;
    color: var(--ink);
    margin-bottom: 0.3rem;
    display: block;
    line-height: 1.2;
}

.character-romanization {
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--celadon);
    margin-bottom: 0.25rem;
}

.character-description {
    font-size: 0.82rem;
    color: var(--ink-soft);
}

/* ------------------------------------------------ legacy ---- */
/* Kept for interior pages that still use these hooks. */
.learning-path,
.features,
.game-selection {
    padding: 4rem 0;
}

.learning-path h2,
.features h2,
.game-selection h2 {
    font-family: var(--serif);
    text-align: center;
    font-size: 2rem;
    margin-bottom: 2.4rem;
    color: var(--ink);
}

.learning-steps,
.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 1.2rem;
}

.step-card,
.feature {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1.8rem 1.5rem;
    text-align: center;
}

.step-number {
    width: 44px;
    height: 44px;
    background: var(--paper-deep);
    border: 1px solid var(--line);
    color: var(--ink-soft);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
    font-weight: 700;
    margin: 0 auto 1rem;
}

.step-card h3,
.feature h3 {
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
}

.korean-examples {
    font-size: 1.7rem;
    margin: 0.8rem 0;
    color: var(--celadon);
    letter-spacing: 0.06em;
}

.step-card p,
.feature p {
    color: var(--ink-soft);
    font-size: 0.94rem;
    margin-bottom: 1.2rem;
}

.feature-icon {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
}

.game-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.2rem;
}

.game-card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 2rem 1.6rem;
    text-align: center;
}

.game-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.6rem;
}

.game-card .korean-examples {
    font-size: 1.5rem;
}

.game-card p {
    color: var(--ink-soft);
    font-size: 0.95rem;
    margin-bottom: 1.2rem;
}

.game-stats {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin: 1.2rem 0;
}

.game-stats span {
    font-size: 0.8rem;
    color: var(--celadon-deep);
    background: var(--celadon-tint);
    border-radius: 5px;
    padding: 0.25rem 0.6rem;
    white-space: nowrap;
}

.game-icon {
    font-size: 2.6rem;
    margin-bottom: 0.8rem;
}

.learn-link {
    display: block;
    color: var(--ink-soft);
    text-decoration: underline;
    text-underline-offset: 3px;
    text-decoration-color: var(--line);
    font-size: 0.88rem;
    margin-top: 0.9rem;
}

.learn-link:hover {
    color: var(--celadon-deep);
}

.game-placeholder {
    background: var(--paper-deep);
    border: 2px dashed var(--line);
    border-radius: 10px;
    padding: 3rem;
    text-align: center;
    margin: 2rem 0;
}

/* ------------------- info pages (guide, about, legal) ---- */
main.content {
    max-width: 780px;
    margin: 0 auto;
    padding: 3rem 24px 4rem;
}

.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 2.4rem 2.6rem;
}

.card h2 {
    font-family: var(--serif);
    font-weight: 700;
    font-size: 1.35rem;
    color: var(--ink);
    margin: 1.9rem 0 0.7rem;
}

.card h2:first-child {
    margin-top: 0;
}

.card h3 {
    font-size: 1.05rem;
    margin: 1.3rem 0 0.5rem;
}

.card p {
    margin-bottom: 0.9rem;
    color: #4A4436;
}

.card ul,
.card ol {
    margin: 0 0 1rem 1.4rem;
    color: #4A4436;
}

.card li {
    margin-bottom: 0.5rem;
}

.card a {
    color: var(--celadon-deep);
}

.card .lead {
    font-size: 1.06rem;
    color: var(--ink);
}

.card .kbd {
    display: inline-block;
    font-family: ui-monospace, 'SF Mono', Menlo, monospace;
    font-size: 0.85em;
    background: var(--paper-deep);
    border: 1px solid var(--line);
    border-bottom-width: 2px;
    border-radius: 5px;
    padding: 0.05rem 0.45rem;
}

.card .cta {
    display: inline-block;
    margin-top: 1rem;
    background: var(--seal);
    color: #F6F3EA;
    border: 1px solid var(--seal-deep);
    border-radius: 8px;
    padding: 0.72rem 1.5rem;
    font-weight: 600;
    text-decoration: none;
    transition: background 0.15s ease;
}

.card .cta:hover {
    background: var(--seal-deep);
}

@media (max-width: 560px) {
    .card {
        padding: 1.6rem 1.3rem;
    }
}

/* ------------------------------------------------ footer ---- */
footer {
    background: var(--paper);
    border-top: 1px solid var(--line);
    color: var(--ink-soft);
    text-align: center;
    padding: 2.2rem 0;
    font-size: 0.9rem;
}

footer .footer-hangul {
    font-family: var(--serif);
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.3rem;
}

.footer-nav {
    margin-top: 0.9rem;
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem 1.4rem;
}

.footer-nav a {
    color: var(--ink-soft);
    text-decoration: none;
    font-size: 0.85rem;
}

.footer-nav a:hover {
    color: var(--celadon-deep);
    text-decoration: underline;
}

/* ------------------------------------------ cookie notice ---- */
.cookie-note {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
    background: var(--card);
    border-top: 1px solid var(--line);
    box-shadow: 0 -3px 12px rgba(38, 33, 23, 0.08);
    padding: 0.7rem 1.2rem;
    font-size: 0.85rem;
    color: #4A4436;
    text-align: center;
}

.cookie-note a {
    color: var(--celadon-deep);
}

.cookie-note button {
    background: var(--celadon);
    color: #F6F3EA;
    border: 1px solid var(--celadon-deep);
    border-radius: 7px;
    padding: 0.35rem 1.1rem;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
}

.cookie-note button:hover {
    background: var(--celadon-deep);
}

/* -------------------------------------------- responsive ---- */
@media (max-width: 900px) {
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 2.5rem;
    }

    .block-demo {
        order: -1;
    }

    .course-steps {
        grid-template-columns: repeat(2, 1fr);
    }

    .game-list {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .header-row {
        justify-content: center;
        text-align: center;
    }

    .page-title {
        font-size: 2rem;
    }

    .character-grid {
        grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
        gap: 0.6rem;
    }
}

@media (max-width: 560px) {
    .container {
        padding: 0 16px;
    }

    .hero {
        padding: 3rem 0;
    }

    .section,
    .game-room,
    .content-section {
        padding: 2.6rem 0;
    }

    .course-steps,
    .game-list {
        grid-template-columns: 1fr;
    }

    .cell-sm {
        width: 60px;
        height: 60px;
        font-size: 1.7rem;
    }

    .cell-lg {
        width: 104px;
        height: 104px;
        font-size: 3.4rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
