/* =========================================================
   GLOBAL BASE
   Used by all public pages
   ========================================================= */

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family:
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        "Noto Sans SC",
        "Noto Sans",
        Arial,
        sans-serif;
    background: #f5f7fb;
    color: #172033;
    line-height: 1.6;
}

a {
    color: #2563eb;
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}


/* =========================================================
   HOMEPAGE LAYOUT
   Used by public/home.html
   ========================================================= */

.container {
    max-width: 600px;
    margin: 0 auto;
    padding: 32px 16px;
}

.container h1 {
    text-align: center;
    margin-bottom: 12px;
}

.tagline {
    text-align: center;
    color: #666;
    margin-bottom: 24px;
}

.search-form {
    margin-bottom: 16px;
}

input[type="search"] {
    width: 100%;
    box-sizing: border-box;
    padding: 16px;
    font-size: 18px;
    border: 1px solid #ddd;
    border-radius: 12px;
}

.language-notice {
    position: fixed;
    top: 12px;
    right: 12px;
    font-size: 14px;
    color: #777;
    z-index: 1000;
}


/* =========================================================
   SITE HEADER
   Used by word_detail.html:
   <header class="site-header">
   ========================================================= */

.site-header {
    position: sticky;
    top: 0;
    z-index: 20;

    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;

    padding: 14px 28px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
}

.brand {
    font-size: 20px;
    font-weight: 800;
    color: #111827;
}

.language-switcher {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: flex-end;
}

.language-switcher a {
    display: inline-flex;
    align-items: center;
    justify-content: center;

    min-width: 34px;
    padding: 4px 8px;

    border-radius: 999px;
    background: #eef2f7;
    color: #475569;

    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.language-switcher a:hover {
    background: #dbeafe;
    color: #1d4ed8;
    text-decoration: none;
}


/* =========================================================
   WORD PAGE SHELL
   Used by:
   <main class="word-page">
   <article class="word-entry">
   ========================================================= */

.word-page {
    max-width: 980px;
    margin: 0 auto;
    padding: 24px 16px 64px;
}

.word-entry {
    display: flex;
    flex-direction: column;
    gap: 28px;
}


/* =========================================================
   BREADCRUMBS
   Used by:
   <nav class="breadcrumbs">
   ========================================================= */

.breadcrumbs {
    margin: 0 0 18px;
    color: #94a3b8;
    font-size: 13px;
}

.breadcrumbs a {
    color: #64748b;
}

.breadcrumbs span,
.breadcrumbs strong {
    margin-left: 7px;
}


/* =========================================================
   WORD HERO
   Used by:
   <header class="word-hero">
   <h1>
   .h1-pinyin
   .h1-context
   .pinyin
   .hsk
   .intro
   ========================================================= */

.word-hero {
    text-align: center;

    padding: 44px 32px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 28px;
    box-shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

.eyebrow {
    margin: 0 0 12px;

    color: #64748b;
    font-size: 13px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.word-hero h1 {
    margin: 0;

    color: #0f172a;
    font-size: clamp(64px, 10vw, 88px);
    line-height: 1.05;
    font-weight: 850;
    letter-spacing: -0.03em;
}

.h1-pinyin {
    display: block;
    margin-top: 10px;

    color: #64748b;
    font-size: 24px;
    font-weight: 650;
    letter-spacing: 0;
}

.h1-context {
    display: block;
    margin-top: 8px;

    color: #334155;
    font-size: 18px;
    font-weight: 750;
    letter-spacing: 0;
}

.pinyin {
    margin: 20px 0 0;

    color: #0f766e;
    font-size: 26px;
    font-weight: 750;
}

.hsk {
    display: inline-flex;
    margin: 18px 0 0;
    padding: 6px 13px;

    border-radius: 999px;
    background: #ecfeff;
    color: #0e7490;

    font-size: 14px;
    font-weight: 800;
}

.intro {
    max-width: 680px;
    margin: 22px auto 0;

    color: #475569;
    font-size: 17px;
}


/* =========================================================
   GENERIC CARD
   Used by:
   <section class="card">
   ========================================================= */

.card {
    padding: 28px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 24px;
    box-shadow: 0 12px 30px rgba(15, 23, 42, 0.055);
}

.card h2 {
    margin: 0 0 20px;

    color: #111827;
    font-size: 28px;
    line-height: 1.25;
}


/* =========================================================
   MEANING / READING BLOCKS
   Used by:
   <section class="reading-block">
   <div class="meaning-block">
   ========================================================= */

.reading-block {
    padding: 20px;

    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-left: 5px solid #38bdf8;
    border-radius: 18px;
}

.reading-block + .reading-block {
    margin-top: 18px;
}

.reading-block h3 {
    margin: 0 0 16px;

    color: #111827;
    font-size: 24px;
}

.reading-block h3 span {
    margin-left: 8px;

    color: #0f766e;
    font-size: 18px;
    font-weight: 700;
}

.meaning-block {
    padding: 18px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

.meaning-block + .meaning-block {
    margin-top: 14px;
}

.pos {
    display: inline-flex;
    margin: 0 0 10px;
    padding: 4px 10px;

    border-radius: 999px;
    background: #eef2ff;
    color: #4338ca;

    font-size: 13px;
    font-weight: 800;
}

.translation {
    margin: 0 0 14px;

    color: #111827;
    font-size: 23px;
    font-weight: 800;
}


/* =========================================================
   EXAMPLE SENTENCE BOX
   Used by:
   <div class="example">
   ========================================================= */

.example {
    margin-top: 16px;
    padding: 16px 18px;

    background: #f1f5f9;
    border-radius: 16px;
}

.example h4 {
    margin: 0 0 10px;

    color: #475569;
    font-size: 14px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.zh-example {
    margin: 0;

    color: #0f172a;
    font-size: 23px;
    font-weight: 700;
}

.example-pinyin {
    margin: 8px 0 0;

    color: #0f766e;
    font-size: 16px;
    font-weight: 650;
}

.example-translation {
    margin: 8px 0 0;

    color: #475569;
    font-size: 16px;
}


/* =========================================================
   CHARACTER BREAKDOWN CARDS
   Used by:
   <section class="character-card">
   ========================================================= */

.character-card {
    padding: 22px;

    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
}

.character-card + .character-card {
    margin-top: 22px;
}

.character-card h3 {
    display: flex;
    align-items: baseline;
    gap: 12px;

    margin: 0 0 10px;
}

.character-card h3 a {
    color: #0f172a;
    font-size: 44px;
    font-weight: 850;
}

.character-card h3 span {
    color: #0f766e;
    font-size: 19px;
    font-weight: 750;
}

.character-card > p {
    margin: 0 0 16px;

    color: #475569;
    font-size: 17px;
}


/* =========================================================
   DECOMPOSITION CHIPS
   Used by:
   <section class="decomposition">
   ========================================================= */

.decomposition {
    margin-top: 16px;
    padding: 16px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

.decomposition h4 {
    margin: 0 0 12px;

    color: #334155;
    font-size: 15px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.decomposition ul {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;

    margin: 0;
    padding: 0;
    list-style: none;
}

.decomposition li {
    display: inline-flex;
    align-items: baseline;
    gap: 5px;

    padding: 7px 11px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 999px;

    color: #475569;
}

.decomposition li a {
    color: #111827;
    font-size: 18px;
    font-weight: 850;
}


/* =========================================================
   RELATED WORD CHIPS
   Used by:
   <section class="related">
   ========================================================= */

.related {
    margin-top: 16px;
    padding: 16px;

    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
}

.related h4 {
    margin: 0 0 12px;

    color: #334155;
    font-size: 15px;
    font-weight: 850;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.related ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;

    margin: 0;
    padding: 0;
    list-style: none;
}

.related li {
    margin: 0;
}

.related a {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 5px;

    min-height: 44px;
    padding: 10px 12px;

    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 14px;

    color: #475569;
}

.related a:hover {
    background: #eff6ff;
    border-color: #bfdbfe;
    text-decoration: none;
}

.related strong {
    color: #0f172a;
    font-size: 18px;
    font-weight: 850;
}

.related span {
    font-size: 14px;
}

.related small {
    margin-left: auto;
    padding: 2px 7px;

    border-radius: 999px;
    background: #ecfeff;
    color: #0e7490;

    font-size: 11px;
    font-weight: 850;
}


/* =========================================================
   FOOTER
   Used by:
   <footer class="site-footer">
   ========================================================= */

.site-footer {
    max-width: 980px;
    margin: 0 auto;
    padding: 28px 16px 44px;

    color: #94a3b8;
    font-size: 14px;
}


/* =========================================================
   MOBILE RESPONSIVE RULES
   Applies below 700px width
   ========================================================= */

@media (max-width: 700px) {
    .site-header {
        align-items: flex-start;
        flex-direction: column;
        padding: 14px 16px;
    }

    .language-switcher {
        justify-content: flex-start;
    }

    .word-page {
        padding: 18px 12px 48px;
    }

    .word-entry {
        gap: 20px;
    }

    .word-hero {
        padding: 34px 20px;
        border-radius: 22px;
    }

    .word-hero h1 {
        font-size: 58px;
    }

    .h1-pinyin {
        font-size: 22px;
    }

    .h1-context {
        font-size: 16px;
    }

    .pinyin {
        font-size: 22px;
    }

    .card {
        padding: 20px;
        border-radius: 20px;
    }

    .card h2 {
        font-size: 24px;
    }

    .reading-block,
    .character-card {
        padding: 16px;
    }

    .related ul {
        grid-template-columns: 1fr;
    }

    .zh-example {
        font-size: 21px;
    }
}