:root {
    --bg: #faf7f2;
    --surface: #ffffff;
    --ink: #1f2330;
    --muted: #6b6f7a;
    --accent: #0e7c66;
    --accent-2: #c98a2b;
    --line: #e8e3da;
    --ok: #1d7a3a;
    --no: #b53030;
    --radius: 12px;
    --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 4px 16px rgba(20, 20, 20, .06);
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    background: var(--bg);
    color: var(--ink);
    font-family: -apple-system, "Apple SD Gothic Neo", "Pretendard", BlinkMacSystemFont,
                 "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

[lang="ar"] {
    font-family: "Amiri", "Scheherazade New", "Noto Naskh Arabic",
                 "Geeza Pro", "Times New Roman", serif;
    font-size: 1.15em;
    line-height: 1.8;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.wrap {
    max-width: 1080px;
    margin: 0 auto;
    padding: 0 24px;
}

/* Header */
.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 10;
}
.site-header .wrap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding-top: 14px;
    padding-bottom: 14px;
}
.brand { display: flex; align-items: baseline; gap: 10px; }
.brand-ar { font-family: "Amiri","Noto Naskh Arabic",serif; font-size: 22px; color: var(--accent); }
.brand-ko { font-weight: 700; color: var(--ink); }
.brand:hover { text-decoration: none; }

.site-header nav ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.site-header nav a {
    display: inline-block;
    padding: 8px 12px;
    border-radius: 8px;
    color: var(--ink);
}
.site-header nav a:hover { background: var(--bg); text-decoration: none; }
.site-header nav a.active { background: var(--accent); color: #fff; }

/* Main */
main.wrap { padding-top: 32px; padding-bottom: 64px; }

.site-footer {
    border-top: 1px solid var(--line);
    background: var(--surface);
    padding: 20px 0;
    color: var(--muted);
}
.site-footer .small { font-size: 12px; margin-top: 2px; }

/* Hero */
.hero {
    display: grid;
    grid-template-columns: 1.4fr 1fr;
    gap: 32px;
    align-items: center;
    background: linear-gradient(180deg, #fffaf0 0%, var(--surface) 100%);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 36px;
    box-shadow: var(--shadow);
}
.kicker { color: var(--accent-2); font-weight: 700; letter-spacing: .1em; text-transform: uppercase; font-size: 12px; margin: 0 0 6px; }
.hero h1 { margin: 4px 0 12px; font-size: 36px; line-height: 1.2; }
.lead { color: var(--muted); font-size: 17px; margin-bottom: 18px; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-art {
    text-align: center;
    color: var(--accent);
    font-size: 84px;
    font-weight: 700;
    line-height: 1;
}
.hero-art-sm { font-size: 36px; color: var(--accent-2); margin-top: 6px; }

/* Buttons */
.btn {
    display: inline-block;
    padding: 10px 16px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    cursor: pointer;
    transition: transform .04s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover { background: #0a6552; }
.btn-ghost { background: transparent; }
.btn-choice { width: 100%; text-align: left; padding: 14px 16px; }
.btn-choice:hover { background: var(--bg); }

/* Feature grid */
.feature-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 16px;
    margin-top: 28px;
}
.feature {
    display: block;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px;
    color: var(--ink);
    box-shadow: var(--shadow);
    transition: transform .08s ease, box-shadow .08s ease;
}
.feature:hover { transform: translateY(-2px); text-decoration: none; box-shadow: 0 8px 24px rgba(20,20,20,.08); }
.feature-glyph { font-family: "Amiri","Noto Naskh Arabic",serif; font-size: 28px; color: var(--accent); margin-bottom: 8px; }
.feature h3 { margin: 4px 0 6px; }
.feature p { margin: 0; color: var(--muted); }

/* Page intro */
.page-intro h1 { margin: 0 0 8px; font-size: 30px; }
.page-intro p { color: var(--muted); margin-top: 0; max-width: 70ch; }
.page-intro { margin-bottom: 24px; }

/* Card grid (alphabet) */
.card-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 14px;
}
.letter-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    box-shadow: var(--shadow);
    position: relative;
}
.letter-index {
    position: absolute; top: 10px; right: 12px;
    font-size: 11px; color: var(--muted);
}
.letter-glyph {
    font-family: "Amiri","Noto Naskh Arabic",serif;
    font-size: 64px; line-height: 1; color: var(--accent);
    text-align: center; padding: 6px 0 12px;
}
.letter-meta > div { margin: 2px 0; font-size: 14px; }
.letter-meta .example { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.muted { color: var(--muted); }

/* Tabs */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 16px; }
.tab {
    padding: 8px 14px;
    border: 1px solid var(--line);
    background: var(--surface);
    border-radius: 999px;
    color: var(--ink);
}
.tab:hover { background: var(--bg); text-decoration: none; }
.tab-active { background: var(--accent); color: #fff; border-color: var(--accent); }
.tab-active:hover { background: #0a6552; }

/* Data table */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.data-table th, .data-table td {
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--line);
}
.data-table th { background: var(--bg); font-weight: 700; }
.data-table tr:last-child td { border-bottom: none; }
.ar-cell {
    font-family: "Amiri","Noto Naskh Arabic",serif;
    font-size: 24px;
    color: var(--accent);
    text-align: right;
    width: 35%;
}

/* Phrases */
.phrase-group { margin-bottom: 28px; }
.phrase-group h2 {
    font-size: 20px;
    margin: 0 0 10px;
    padding-left: 10px;
    border-left: 4px solid var(--accent-2);
}
.phrase-list {
    list-style: none; padding: 0; margin: 0;
    display: grid; gap: 10px;
}
.phrase-list li {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
    box-shadow: var(--shadow);
}
.phrase-ar {
    font-family: "Amiri","Noto Naskh Arabic",serif;
    font-size: 24px;
    color: var(--accent);
    margin-bottom: 4px;
}
.phrase-tr { font-style: italic; font-size: 13px; }
.phrase-ko { margin-top: 4px; }

/* Grammar */
.grammar-block {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 22px 24px;
    margin-bottom: 16px;
    box-shadow: var(--shadow);
}
.grammar-block h2 { margin-top: 0; color: var(--accent); }
.grammar-block code {
    background: var(--bg);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 90%;
}

/* Quiz */
.score-bar {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 10px 16px;
    margin-bottom: 16px;
}
.quiz-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 28px;
    text-align: center;
    box-shadow: var(--shadow);
}
.quiz-ar {
    font-family: "Amiri","Noto Naskh Arabic",serif;
    font-size: 56px;
    color: var(--accent);
    line-height: 1.2;
    margin-bottom: 6px;
}
.quiz-tr { margin-bottom: 20px; }
.quiz-choices {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 10px;
    margin-top: 8px;
}
.feedback {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    border: 1px solid;
}
.feedback-ok { background: #eaf6ed; color: var(--ok); border-color: #c8e6cf; }
.feedback-no { background: #fbeaea; color: var(--no); border-color: #f1c8c8; }

/* Tips */
.tips {
    margin-top: 24px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 20px 24px;
    box-shadow: var(--shadow);
}
.tips h2 { margin-top: 0; }

/* Responsive */
@media (max-width: 720px) {
    .hero { grid-template-columns: 1fr; padding: 24px; }
    .hero h1 { font-size: 28px; }
    .hero-art { font-size: 56px; }
    .site-header .wrap { flex-direction: column; align-items: flex-start; }
    .ar-cell { font-size: 20px; }
    .quiz-ar { font-size: 42px; }
}
