:root {
  --bg: #f6f1e7;
  --surface: #fffdf8;
  --surface-2: #efe7d8;
  --ink: #2a221d;
  --ink-2: #6b5d52;
  --line: #e2d7c4;
  --terra: #b9472a;
  --terra-2: #9c3820;
  --terra-soft: #f6e0d5;
  --olive: #4f6b2f;
  --olive-soft: #e3ecd3;
  --red: #b3261e;
  --red-soft: #f8dcd8;
  --gold: #c58b1b;
  --shadow: 0 1px 2px rgba(60, 40, 20, .06), 0 6px 20px rgba(60, 40, 20, .06);
  --radius: 14px;
  --display: 'Fraunces', Georgia, serif;
  --body: 'DM Sans', system-ui, -apple-system, Segoe UI, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1b1714; --surface: #24201c; --surface-2: #2f2924; --ink: #f1e9dd; --ink-2: #b3a596;
    --line: #3b332c; --terra: #e0714f; --terra-2: #f08a69; --terra-soft: #3d2620; --olive: #9cbc6c;
    --olive-soft: #2a3320; --red: #f2857c; --red-soft: #3c2220; --gold: #e2ad48;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #1b1714; --surface: #24201c; --surface-2: #2f2924; --ink: #f1e9dd; --ink-2: #b3a596;
  --line: #3b332c; --terra: #e0714f; --terra-2: #f08a69; --terra-soft: #3d2620; --olive: #9cbc6c;
  --olive-soft: #2a3320; --red: #f2857c; --red-soft: #3c2220; --gold: #e2ad48;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 6px 20px rgba(0,0,0,.25); color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.55 var(--body); min-height: 100vh; }
a { color: var(--terra); }
h1, h2, h3 { font-family: var(--display); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: clamp(1.9rem, 4vw, 2.8rem); }
h2 { font-size: 1.55rem; }
h3 { font-size: 1.15rem; }
p { margin: 0 0 .8em; }
button, input { font: inherit; color: inherit; }

/* ---------- top bar ---------- */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100vw - 1080px) / 2)); background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.35rem; color: var(--ink); text-decoration: none; }
.flag { display: inline-flex; width: 26px; height: 18px; border-radius: 3px; overflow: hidden; box-shadow: 0 0 0 1px var(--line); }
.flag i { flex: 1; } .flag i:nth-child(1) { background: #009246; } .flag i:nth-child(2) { background: #f4f1ea; } .flag i:nth-child(3) { background: #ce2b37; }
#nav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
#nav a { color: var(--ink-2); text-decoration: none; padding: 7px 11px; border-radius: 9px; font-weight: 500; font-size: .95rem; }
#nav a:hover, #nav a.active { background: var(--surface-2); color: var(--ink); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 10px; border-radius: 999px; background: var(--surface-2); font-size: .85rem; font-weight: 600; color: var(--ink); }

main { max-width: 1080px; margin: 0 auto; padding: 28px 16px 80px; }

/* ---------- buttons, forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 20px; border-radius: 11px; border: 1px solid transparent;
  background: var(--terra); color: #fff; font-weight: 600; cursor: pointer; text-decoration: none; transition: transform .08s, background .15s; }
.btn:hover { background: var(--terra-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { background: var(--surface-2); }
.btn.olive { background: var(--olive); }
.btn.big { padding: 14px 26px; font-size: 1.05rem; }
.btn.small { padding: 7px 12px; font-size: .9rem; }
.icon-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 10px; width: 38px; height: 38px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; font-size: 1.05rem; flex: none; }
.icon-btn:hover { background: var(--surface-2); }

.field { display: block; margin-bottom: 14px; }
.field span { display: block; font-size: .9rem; font-weight: 600; margin-bottom: 6px; color: var(--ink-2); }
.input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); outline: none; font-size: 1rem; }
.input:focus { border-color: var(--terra); box-shadow: 0 0 0 3px var(--terra-soft); }
.error { color: var(--red); background: var(--red-soft); padding: 10px 12px; border-radius: 9px; font-size: .92rem; margin-bottom: 12px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.muted { color: var(--ink-2); }
.center { text-align: center; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.g3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* ---------- landing ---------- */
.hero { display: grid; grid-template-columns: 1.2fr 1fr; gap: 40px; align-items: center; padding: 30px 0 50px; }
.hero h1 { font-size: clamp(2.4rem, 6vw, 4rem); }
.hero h1 em { color: var(--terra); font-style: italic; }
.hero p.lead { font-size: 1.15rem; color: var(--ink-2); max-width: 34em; }
.hero-art { position: relative; aspect-ratio: 1; max-width: 400px; justify-self: center; width: 100%; }
.bubble { position: absolute; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 18px; box-shadow: var(--shadow); font-family: var(--display); font-size: 1.3rem; }
.bubble small { display: block; font-family: var(--body); font-size: .85rem; color: var(--ink-2); }
.bubble:nth-child(1) { top: 6%; left: 0; transform: rotate(-4deg); }
.bubble:nth-child(2) { top: 36%; right: 0; transform: rotate(3deg); background: var(--terra); color: #fff; border-color: transparent; }
.bubble:nth-child(2) small { color: #ffe3d8; }
.bubble:nth-child(3) { bottom: 8%; left: 12%; transform: rotate(-2deg); background: var(--olive-soft); }
.feature { padding: 20px; }
.feature .ico { font-size: 1.6rem; margin-bottom: 8px; }
.levels-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-top: 14px; }
.lvl { border-radius: 14px; padding: 18px; background: var(--surface); border: 1px solid var(--line); }
.lvl b { font-family: var(--display); font-size: 1.8rem; display: block; color: var(--terra); }
.lvl.off b { color: var(--ink-2); }
section.block { margin: 46px 0; }

/* ---------- auth ---------- */
.auth { max-width: 420px; margin: 30px auto; }
.or { display: flex; align-items: center; gap: 12px; color: var(--ink-2); font-size: .9rem; margin: 18px 0 14px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.gbtn { display: flex; justify-content: center; min-height: 44px; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: .92rem; margin: 4px 0 16px; line-height: 1.45; cursor: pointer; }
.check input { margin-top: 3px; width: 18px; height: 18px; flex: none; accent-color: var(--terra); }
.small { font-size: .85rem; }
.card.danger { border-color: color-mix(in srgb, var(--red) 40%, var(--line)); }
.sitefoot { text-align: center; color: var(--ink-2); font-size: .85rem; padding: 0 16px 28px; margin-top: -40px; }
.sitefoot a { color: var(--ink-2); }

/* ---------- dashboard ---------- */
.stat { padding: 16px 18px; }
.stat b { display: block; font-family: var(--display); font-size: 1.9rem; line-height: 1.1; }
.stat span { color: var(--ink-2); font-size: .9rem; }
.level-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; transition: transform .12s, border-color .12s; }
a.level-card:hover { transform: translateY(-2px); border-color: var(--terra); }
.level-card .code { font-family: var(--display); font-size: 2.4rem; font-weight: 700; color: var(--terra); line-height: 1; }
.level-card.locked { opacity: .6; }
.level-card.locked .code { color: var(--ink-2); }
.bar { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--olive); border-radius: 99px; transition: width .4s; }
.continue { display: flex; align-items: center; gap: 18px; background: var(--terra); color: #fff; border: 0; }
.continue .big-ico { font-size: 2.4rem; }
.continue h3 { color: #fff; }
.continue p { color: #ffe3d8; margin: 0; }
.continue .btn { background: #fff; color: var(--terra-2); margin-left: auto; }

/* ---------- unit path ---------- */
.units { display: grid; gap: 12px; }
.unit { display: flex; align-items: center; gap: 16px; padding: 16px 18px; text-decoration: none; color: inherit; }
a.unit:hover { border-color: var(--terra); }
.unit .no { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-size: 1.5rem; background: var(--surface-2); }
.unit.passed .no { background: var(--olive-soft); }
.unit.locked { opacity: .55; cursor: not-allowed; }
.unit .meta { flex: 1; min-width: 0; }
.unit .meta h3 { margin: 0; }
.unit .meta p { margin: 0; color: var(--ink-2); font-size: .92rem; }
.badge { flex: none; font-size: .8rem; font-weight: 700; padding: 5px 10px; border-radius: 99px; background: var(--surface-2); color: var(--ink-2); white-space: nowrap; }
.badge.ok { background: var(--olive-soft); color: var(--olive); }
.badge.go { background: var(--terra-soft); color: var(--terra); }
.exam-card { border: 2px dashed var(--gold); }

/* ---------- lesson ---------- */
.lesson-head { margin-bottom: 18px; }
.crumbs { font-size: .9rem; color: var(--ink-2); margin-bottom: 6px; }
.crumbs a { color: var(--ink-2); }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 18px 0 22px; overflow-x: auto; }
.tabs button { background: none; border: 0; padding: 10px 14px; font-weight: 600; color: var(--ink-2); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs button.on { color: var(--terra); border-bottom-color: var(--terra); }
.words { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.word { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.word .t { flex: 1; min-width: 0; }
.word .it { font-weight: 700; font-size: 1.05rem; }
.word .tr { color: var(--ink-2); }
.word .note { font-size: .82rem; color: var(--ink-2); font-style: italic; margin-top: 2px; }
.grammar section { margin-bottom: 26px; }
table.g { border-collapse: collapse; margin: 10px 0 14px; width: 100%; max-width: 640px; background: var(--surface); border-radius: 10px; overflow: hidden; border: 1px solid var(--line); font-size: .95rem; }
table.g th, table.g td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.g th { background: var(--surface-2); font-size: .85rem; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); }
table.g tr:last-child td { border-bottom: 0; }
.table-wrap { overflow-x: auto; }
.tip { background: var(--olive-soft); border-left: 4px solid var(--olive); padding: 10px 14px; border-radius: 8px; margin: 10px 0; }
ul.ex { padding-left: 18px; margin: 8px 0; }
ul.ex li { margin: 4px 0; }
ul.ex i, table.g i, .it-block i { color: var(--terra-2); font-style: normal; font-weight: 600; }
.it-block { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; }
.dialogue { display: grid; gap: 10px; max-width: 680px; }
.line { display: flex; gap: 10px; align-items: flex-start; }
.line.r { flex-direction: row-reverse; }
.line .who { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; background: var(--surface-2); font-size: .85rem; }
.line.r .who { background: var(--terra-soft); color: var(--terra); }
.line .say { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 10px 14px; max-width: 80%; }
.line .say .it { font-weight: 600; }
.line .say .tr { color: var(--ink-2); font-size: .9rem; }
.line .say.hidden-tr .tr { display: none; }

/* ---------- exercise runner ---------- */
.runner { max-width: 680px; margin: 0 auto; }
.progress { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.progress .bar { flex: 1; height: 12px; }
.progress .bar > i { background: var(--terra); }
.ex-card { padding: 28px; }
.ex-kind { font-size: .8rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); margin-bottom: 8px; }
.ex-q { font-size: 1.3rem; font-family: var(--display); margin-bottom: 20px; }
.ex-q .blank { display: inline-block; min-width: 90px; border-bottom: 2px solid var(--terra); }
.ex-q input.inline { display: inline-block; width: auto; min-width: 140px; max-width: 220px; padding: 4px 10px; font-family: var(--body); font-size: 1.1rem; border-radius: 8px; border: 2px solid var(--line); background: var(--bg); }
.ex-q input.inline:focus { border-color: var(--terra); outline: none; }
.options { display: grid; gap: 10px; }
.opt { text-align: left; padding: 13px 16px; border-radius: 12px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.02rem; font-weight: 500; }
.opt:hover:not(:disabled) { border-color: var(--terra); }
.opt.sel { border-color: var(--terra); background: var(--terra-soft); }
.opt.right { border-color: var(--olive); background: var(--olive-soft); }
.opt.wrong { border-color: var(--red); background: var(--red-soft); }
.opt:disabled { cursor: default; }
.listen-btns { display: flex; gap: 12px; justify-content: center; margin-bottom: 22px; }
.listen-btns .play { width: 86px; height: 86px; border-radius: 50%; font-size: 2rem; border: 0; background: var(--terra); color: #fff; cursor: pointer; box-shadow: var(--shadow); }
.listen-btns .slow { align-self: flex-end; }
.answer-line { min-height: 58px; border-bottom: 2px solid var(--line); display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0; margin-bottom: 18px; }
.bank { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { padding: 9px 14px; border-radius: 10px; border: 2px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; box-shadow: 0 2px 0 var(--line); }
.chip:hover { border-color: var(--terra); }
.chip.used { visibility: hidden; }
.match { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.match .col { display: grid; gap: 10px; align-content: start; }
.match .chip { text-align: center; }
.match .chip.sel { border-color: var(--terra); background: var(--terra-soft); }
.match .chip.done { border-color: var(--olive); background: var(--olive-soft); opacity: .6; cursor: default; }
.match .chip.bad { border-color: var(--red); background: var(--red-soft); animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.feedback { margin-top: 20px; padding: 14px 16px; border-radius: 12px; font-weight: 500; display: none; }
.feedback.show { display: block; }
.feedback.ok { background: var(--olive-soft); color: var(--olive); }
.feedback.no { background: var(--red-soft); color: var(--red); }
.feedback small { display: block; font-weight: 400; color: var(--ink); margin-top: 4px; }
.ex-actions { display: flex; justify-content: space-between; align-items: center; margin-top: 20px; gap: 12px; }
.hint { font-size: .9rem; color: var(--ink-2); }
.result { text-align: center; padding: 36px 24px; }
.result .score { font-family: var(--display); font-size: 4rem; font-weight: 700; line-height: 1; margin: 10px 0; }
.result .score.pass { color: var(--olive); }
.result .score.fail { color: var(--terra); }

/* ---------- flashcards ---------- */
.flash { perspective: 1000px; max-width: 460px; margin: 0 auto 18px; height: 250px; cursor: pointer; }
.flash .inner { position: relative; width: 100%; height: 100%; transition: transform .45s; transform-style: preserve-3d; }
.flash.flipped .inner { transform: rotateY(180deg); }
.flash .face { position: absolute; inset: 0; backface-visibility: hidden; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border-radius: 18px; border: 1px solid var(--line); background: var(--surface); box-shadow: var(--shadow); padding: 20px; text-align: center; }
.flash .face.back { transform: rotateY(180deg); background: var(--terra-soft); }
.flash .big { font-family: var(--display); font-size: 2rem; font-weight: 600; }
.boxes { display: flex; gap: 6px; }
.boxes div { flex: 1; text-align: center; padding: 8px 4px; border-radius: 9px; background: var(--surface-2); font-size: .8rem; color: var(--ink-2); }
.boxes div b { display: block; font-size: 1.2rem; color: var(--ink); }

/* ---------- certificate ---------- */
.cert { border: 3px double var(--gold); padding: 34px; text-align: center; background: var(--surface); border-radius: 6px; max-width: 560px; margin: 20px auto; }
.cert h2 { color: var(--gold); }

#toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); background: var(--ink); color: var(--bg); padding: 11px 18px; border-radius: 11px; opacity: 0; pointer-events: none; transition: .25s; font-weight: 500; z-index: 50; max-width: calc(100vw - 32px); }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.loader { text-align: center; padding: 60px; color: var(--ink-2); }

/* ---------- fiiller ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips .chip { box-shadow: none; padding: 7px 13px; font-weight: 600; font-size: .92rem; }
.chips .chip.on { background: var(--terra); border-color: var(--terra); color: #fff; }
.vgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.vcard { display: flex; flex-direction: column; gap: 2px; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; transition: border-color .12s, transform .12s; }
.vcard:hover { border-color: var(--terra); transform: translateY(-1px); }
.vcard b { font-size: 1.05rem; }
.vcard span { color: var(--ink-2); font-size: .9rem; }
.vcard .vb, .row .badge + .badge { margin-top: 4px; }
.vcard .vb { display: flex; flex-wrap: wrap; gap: 4px; }
.vcard .badge, .vb .badge { font-size: .7rem; padding: 3px 7px; }
.tgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); gap: 14px; margin-top: 18px; }
.tcard { padding: 16px 18px; }
.tcard h3 { font-size: 1rem; color: var(--terra); margin-bottom: 8px; }
table.conj { width: 100%; border-collapse: collapse; }
table.conj td { padding: 6px 4px; border-bottom: 1px solid var(--line); }
table.conj tr:last-child td { border-bottom: 0; }
table.conj tr { cursor: pointer; }
table.conj tr:hover { background: var(--surface-2); }
table.conj td.p { color: var(--ink-2); width: 34%; font-size: .9rem; }
table.conj td.s { width: 28px; text-align: right; opacity: .45; font-size: .85rem; }
table.conj tr:hover td.s { opacity: 1; }

/* ---------- kelime temaları ---------- */
.card.theme { text-decoration: none; color: inherit; padding: 16px 18px; transition: transform .12s, border-color .12s; }
.card.theme:hover { transform: translateY(-2px); border-color: var(--terra); }

/* ---------- okuma ---------- */
.it-text { font-size: 1.15rem; line-height: 1.85; margin: 14px 0; }
details summary { cursor: pointer; color: var(--terra); font-weight: 600; }
.rq { margin: 14px 0; }
.rq p { margin-bottom: 8px; }
.rq .opt { padding: 10px 14px; font-size: .97rem; }
.rq .options { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* ---------- hatalar ---------- */
.mlist { list-style: none; padding: 0; margin: 0; }
.mlist li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.mlist li:last-child { border-bottom: 0; }
.mlist small { white-space: nowrap; }

@media print {
  .topbar, .row, #toast { display: none !important; }
  body { background: #fff; }
}

@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; row-gap: 6px; padding-top: 8px; padding-bottom: 8px; }
  #nav { width: 100%; justify-content: space-between; gap: 0; }
  .hero { grid-template-columns: 1fr; padding-top: 10px; }
  .hero-art { max-width: 300px; }
  .levels-strip { grid-template-columns: repeat(2, 1fr); }
  .continue { flex-wrap: wrap; }
  .continue .btn { margin-left: 0; }
  .ex-card { padding: 20px; }
  .ex-q { font-size: 1.15rem; }
  #nav a { padding: 6px 8px; font-size: .88rem; }
  .brand { font-size: 1.15rem; }
  .match .chip { padding: 9px 8px; font-size: .92rem; }
}

/* Dar telefonlar (uygulama görünümü): menü tek satır, gerekirse yatay kaydırılır */
@media (max-width: 480px) {
  .topbar { flex-wrap: nowrap; gap: 8px; padding: 8px 10px; }
  .brand { font-size: 1.05rem; gap: 6px; flex: none; }
  .brand .flag { width: 20px; height: 14px; }
  #nav { flex-wrap: nowrap; overflow-x: auto; justify-content: flex-start; width: auto; scrollbar-width: none; gap: 0; }
  #nav::-webkit-scrollbar { display: none; }
  #nav a { padding: 6px 7px; font-size: .84rem; white-space: nowrap; }
  #nav .pill { padding: 4px 8px; font-size: .78rem; }
  main { padding-top: 18px; }
}
