/* ===== Tema: Schwarz · Rot · Gold ===== */
:root {
  --schwarz: #141414;
  --rot: #d00000;
  --rot-2: #e52a2a;
  --gold: #ffce00;
  --gold-2: #f2b600;
  --flag: linear-gradient(90deg, #141414 0 33.33%, #d00000 33.33% 66.66%, #ffce00 66.66% 100%);

  --bg: #f5f3ee;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6c675f;
  --line: #e6e1d6;
  --soft: #faf8f3;
  --primary: var(--rot);
  --primary-2: var(--rot-2);
  --ok: #1f8a3b;
  --ok-bg: #e5f5e9;
  --bad: #c92a2a;
  --bad-bg: #fdecec;
  --warn: #c76a00;
  --warn-bg: #fff4dc;
  --der: #1c6fd1;
  --die: #d6336c;
  --das: #2b8a3e;
  --pl: #d9480f;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 4px 14px rgba(20, 20, 20, .06);
  --shadow-lg: 0 10px 30px rgba(20, 20, 20, .16);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0e0e;
    --card: #1a1a1a;
    --text: #f1efe9;
    --muted: #a39e94;
    --line: #2c2a27;
    --soft: #222120;
    --primary: #ff3b3b;
    --primary-2: #ff5c5c;
    --ok: #51cf66;
    --ok-bg: #15301c;
    --bad: #ff6b6b;
    --bad-bg: #3a1a1c;
    --warn: #ffb02e;
    --warn-bg: #3a2c12;
    --der: #4dabf7;
    --die: #f783ac;
    --das: #69db7c;
    --pl: #ff922b;
    --shadow: none;
    --shadow-lg: 0 10px 30px rgba(0, 0, 0, .5);
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { letter-spacing: -.015em; }
button { font: inherit; color: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: var(--text); }
a { color: inherit; }

/* ---------- üst bar ---------- */
.flagbar { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 10px;
  padding: calc(10px + var(--safe-t)) 14px 10px;
  background: var(--schwarz); color: #fff;
}
.topbar::after { content: ''; position: absolute; left: 0; right: 0; bottom: -4px; height: 4px; background: var(--flag); }
.topbar h1 { font-size: 18px; font-weight: 750; margin: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .icon-btn { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: none; }
.topbar .pill { background: rgba(255, 255, 255, .1); color: #fff; box-shadow: none; }
.icon-btn {
  border: 0; background: var(--card); border-radius: 12px;
  width: 40px; height: 40px; display: grid; place-items: center;
  font-size: 22px; box-shadow: var(--shadow); flex: none;
}
.pill { font-size: 14px; font-weight: 600; padding: 5px 11px; border-radius: 99px; background: var(--card); box-shadow: var(--shadow); white-space: nowrap; }
main { padding: 18px 14px calc(96px + var(--safe-b)); max-width: 720px; margin: 0 auto; }

/* ---------- alt menü ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: flex; background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: var(--safe-b);
}
.bottomnav a {
  flex: 1; text-align: center; padding: 8px 0 7px; text-decoration: none; position: relative;
  color: var(--muted); font-size: 11.5px; font-weight: 600;
}
.bottomnav a span { display: block; font-size: 21px; line-height: 1.15; filter: grayscale(.6); opacity: .8; }
.bottomnav a.active { color: var(--text); }
.bottomnav a.active span { filter: none; opacity: 1; }
.bottomnav a.active::before { content: ''; position: absolute; top: 0; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; background: var(--flag); }

/* ---------- kartlar ---------- */
.card {
  background: var(--card); border-radius: var(--radius); padding: 16px;
  box-shadow: var(--shadow); margin-bottom: 12px; border: 1px solid var(--line);
}
.card h2 { margin: 0 0 8px; font-size: 20px; font-weight: 750; }
.card h3 { margin: 16px 0 6px; font-size: 17px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.center { text-align: center; }
.eyebrow { font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--primary); margin-bottom: 4px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; margin: 20px 2px 10px; }
.section-head h3, .section-title { margin: 0; font-size: 18px; font-weight: 750; }
.section-title { margin: 20px 2px 10px; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background: radial-gradient(120% 140% at 100% 0%, #3a3a3a 0%, #141414 55%);
  color: #fff; border-radius: 22px; padding: 18px 18px 16px; margin-bottom: 14px;
  box-shadow: var(--shadow-lg);
}
.hero::before {
  content: ''; position: absolute; right: -40px; top: -30px; width: 170px; height: 170px; border-radius: 50%;
  background: conic-gradient(from 200deg, var(--rot), var(--gold), var(--rot)); opacity: .22; filter: blur(2px);
}
.hero::after { content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: 5px; background: var(--flag); }
.hero > * { position: relative; }
.hero h2 { margin: 12px 0 2px; font-size: 26px; font-weight: 800; }
.hero-sub { opacity: .8; font-size: 15px; }
.hero-top { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-light { font-size: 13px; font-weight: 650; padding: 4px 10px; border-radius: 99px; background: rgba(255, 255, 255, .12); }
.hero-progress { background: rgba(255, 255, 255, .15); margin: 12px 0 2px; }
.hero .btn-row { margin-top: 14px; }

.quick-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.quick-tile, .section-tile {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; text-decoration: none; color: inherit;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 3px; min-height: 96px; position: relative; overflow: hidden;
  transition: transform .12s ease;
}
.quick-tile:active, .section-tile:active, .list-link:active, .unit-item:active { transform: scale(.98); }
.quick-tile .ico, .section-tile .ico { font-size: 26px; line-height: 1.2; }
.quick-tile .name, .section-tile .name { font-weight: 700; }
.section-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.section-tile { min-height: 104px; }

.exam-banner {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: #141414;
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-2) 100%);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--shadow);
}
.exam-banner .exam-ico { font-size: 30px; }
.exam-banner .small { opacity: .75; }
.exam-banner .badge { background: #141414; color: var(--gold); }
.exam-banner .badge.ok { background: #141414; color: #8ce99a; }

/* ---------- ünite listesi ---------- */
.unit-item {
  display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px;
  margin-bottom: 10px; box-shadow: var(--shadow); transition: transform .12s ease;
}
.unit-item.current { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), var(--shadow); }
.unit-num {
  width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center;
  font-weight: 800; font-size: 19px; color: var(--gold); background: var(--schwarz); flex: none;
}
.unit-num.done { background: var(--gold); color: var(--schwarz); }
.unit-item .title { font-weight: 700; }
.unit-item.locked { opacity: .55; }
.chev { color: var(--muted); font-size: 24px; line-height: 1; }
.progress { height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; margin-top: 7px; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--rot), var(--gold)); border-radius: 99px; transition: width .3s; }

.steps { display: flex; gap: 6px; overflow-x: auto; padding: 2px 2px 10px; margin-bottom: 2px; scrollbar-width: none; }
.steps span { flex: none; font-size: 12.5px; font-weight: 600; color: var(--muted); background: var(--card); border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px 4px 4px; display: inline-flex; gap: 6px; align-items: center; }
.steps b { width: 20px; height: 20px; border-radius: 50%; background: var(--schwarz); color: var(--gold); display: grid; place-items: center; font-size: 11px; }

.list-link {
  display: flex; align-items: center; gap: 12px; padding: 13px 14px; text-decoration: none; color: inherit;
  background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 8px; box-shadow: var(--shadow);
  transition: transform .12s ease;
}
.list-link .title { font-weight: 700; }
.list-link .badge { margin-left: auto; }
.list-link .num { width: 30px; height: 30px; flex: none; border-radius: 10px; background: var(--schwarz); color: var(--gold); display: grid; place-items: center; font-weight: 800; font-size: 14px; }
.ico-box { width: 42px; height: 42px; flex: none; border-radius: 12px; background: var(--soft); border: 1px solid var(--line); display: grid; place-items: center; font-size: 22px; }
.badge { font-size: 13px; font-weight: 650; padding: 3px 10px; border-radius: 99px; background: var(--soft); border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { background: var(--ok-bg); color: var(--ok); border-color: transparent; }
.new-tag { display: inline-block; margin-left: 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .05em; padding: 2px 6px; border-radius: 6px; background: var(--gold); color: #141414; vertical-align: 2px; }

/* ---------- butonlar ---------- */
.btn {
  border: 0; border-radius: 14px; padding: 13px 18px; font-weight: 700; text-decoration: none;
  background: var(--primary); color: #fff; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  box-shadow: 0 2px 0 rgba(0, 0, 0, .12); transition: transform .1s ease, filter .15s;
}
.btn:active { transform: translateY(1px); }
.btn.block { width: 100%; display: flex; }
.btn.secondary { background: var(--card); color: var(--text); border: 1.5px solid var(--line); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--primary); padding: 10px; box-shadow: none; }
.btn.ok { background: var(--ok); }
.btn.bad { background: var(--bad); }
.btn.gold { background: var(--gold); color: #141414; }
.btn.glass { background: rgba(255, 255, 255, .12); color: #fff; box-shadow: none; }
.btn:disabled { opacity: .45; }
.btn-row { display: flex; gap: 10px; margin-top: 12px; }
.btn-row > * { flex: 1; }
.speak-btn {
  border: 0; background: var(--soft); border: 1px solid var(--line); border-radius: 99px; width: 34px; height: 34px;
  display: inline-grid; place-items: center; font-size: 15px; vertical-align: middle; flex: none;
}

/* ---------- gramer ---------- */
.grammar table { border-collapse: collapse; width: 100%; margin: 8px 0 12px; font-size: 15.5px; }
.grammar th, .grammar td { border: 1px solid var(--line); padding: 8px 9px; text-align: left; vertical-align: top; }
.grammar th { background: var(--schwarz); color: #fff; font-weight: 650; }
.grammar tr:nth-child(odd) td { background: var(--soft); }
.grammar .tip { background: var(--warn-bg); border-left: 4px solid var(--gold-2); padding: 10px 12px; border-radius: 10px; margin: 10px 0; }
.grammar .rule { background: color-mix(in srgb, var(--primary) 8%, var(--card)); border-left: 4px solid var(--primary); padding: 10px 12px; border-radius: 10px; margin: 10px 0; }
.grammar .ex { padding: 7px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 10px; align-items: center; }
.grammar .ex .de { font-weight: 650; }
.grammar .ex .tr { color: var(--muted); font-size: 15px; }
.grammar b.v { color: var(--primary); }
.src-line { font-size: 13px; color: var(--muted); background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 6px 10px; margin: 0 0 12px; }
.tbl-wrap { overflow-x: auto; }
.passage { white-space: pre-line; background: var(--soft); border: 1px solid var(--line); border-left: 4px solid var(--gold-2); border-radius: 12px; padding: 12px 14px; margin: 6px 0 14px; font-size: 16px; line-height: 1.55; }

.der { color: var(--der); } .die { color: var(--die); } .das { color: var(--das); } .pl { color: var(--pl); }

/* ---------- kaynaklar ---------- */
details.card summary { font-weight: 700; cursor: pointer; }
.sources ul { margin: 4px 0 0; padding-left: 20px; font-size: 14.5px; }
.sources li { margin: 2px 0; }
.src-block { margin-top: 12px; }
.src-h { font-weight: 700; font-size: 14px; }
.gap-block { background: var(--warn-bg); border-radius: 12px; padding: 10px 12px; }

/* ---------- okuma ---------- */
.intro-card, .unit-head { position: relative; overflow: hidden; padding-top: 20px; }
.intro-card::before, .unit-head::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--flag); }
.story-line { padding: 10px 12px; border-radius: 12px; cursor: pointer; transition: background .15s; border: 1px solid transparent; }
.story-line + .story-line { margin-top: 4px; }
.story-line .de { font-size: 18px; line-height: 1.5; }
.story-line .tr { display: none; color: var(--muted); font-size: 15px; margin-top: 3px; }
.story-line.open { background: var(--soft); border-color: var(--line); }
.story-line.open .tr { display: block; }
.story-line.reading { background: color-mix(in srgb, var(--gold) 22%, var(--card)); border-color: var(--gold-2); }

/* ---------- video ---------- */
.video-box { position: relative; padding-top: 56.25%; border-radius: 14px; overflow: hidden; background: #000; }
.video-box iframe, .video-box img { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; object-fit: cover; }
.video-box .play {
  position: absolute; inset: 0; display: grid; place-items: center; font-size: 56px; color: #fff;
  background: rgba(0, 0, 0, .3); border: 0;
}

/* ---------- alıştırmalar ---------- */
.ex-top { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.ex-top .progress { flex: 1; margin: 0; height: 10px; }
.ex-q { font-size: 21px; font-weight: 700; margin: 6px 0 14px; line-height: 1.4; }
.ex-q .gap { display: inline-block; min-width: 60px; border-bottom: 3px solid var(--gold-2); text-align: center; color: var(--primary); }
.ex-sub { color: var(--muted); font-size: 14.5px; font-weight: 600; margin-bottom: 10px; }
.opts { display: grid; gap: 10px; }
.opt {
  border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 14px; text-align: left; font-size: 17px; font-weight: 550;
  transition: border-color .15s, background .15s;
}
.opt.sel { border-color: var(--schwarz); background: var(--soft); }
.opt.right { border-color: var(--ok); background: var(--ok-bg); }
.opt.wrong { border-color: var(--bad); background: var(--bad-bg); }
.txt-in {
  width: 100%; border: 2px solid var(--line); background: var(--card); border-radius: 14px; padding: 13px 14px; font-size: 18px; outline: none;
}
.txt-in:focus { border-color: var(--gold-2); box-shadow: 0 0 0 3px color-mix(in srgb, var(--gold) 30%, transparent); }
textarea.txt-in { min-height: 120px; resize: vertical; }
.umlauts { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.umlauts button { border: 1.5px solid var(--line); background: var(--card); border-radius: 10px; min-width: 42px; height: 40px; font-size: 18px; font-weight: 600; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; min-height: 52px; }
.chip { border: 2px solid var(--line); background: var(--card); border-radius: 12px; padding: 9px 13px; font-size: 17px; font-weight: 550; }
.chip.used { visibility: hidden; }
.answer-zone { border-bottom: 2px dashed var(--line); padding: 6px 0 10px; margin-bottom: 14px; }

.match-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.match-grid .opt { padding: 12px 10px; font-size: 16px; text-align: center; }
.match-grid .opt.done { opacity: .3; pointer-events: none; }

.info-card { text-align: center; padding: 26px 18px; }
.info-card h2 { font-size: 24px; }
.info-card p { color: var(--muted); }

.feedback {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  padding: 18px 16px calc(16px + var(--safe-b)); border-radius: 22px 22px 0 0;
  box-shadow: 0 -6px 24px rgba(0, 0, 0, .16); animation: up .22s ease-out; max-height: 70vh; overflow-y: auto;
}
.feedback.ok { background: var(--ok-bg); }
.feedback.bad { background: var(--bad-bg); }
.feedback.close { background: var(--warn-bg); }
.feedback .fb-title { font-weight: 800; font-size: 20px; margin-bottom: 4px; }
.feedback.ok .fb-title { color: var(--ok); }
.feedback.bad .fb-title { color: var(--bad); }
.feedback.close .fb-title { color: var(--warn); }
.feedback .fb-body { margin-bottom: 12px; font-size: 16px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.pass-line { font-weight: 800; font-size: 18px; }
.pass-line.pass { color: var(--ok); }
.pass-line.fail { color: var(--bad); }

/* konuşma */
.mic-btn {
  width: 84px; height: 84px; border-radius: 50%; border: 0; background: var(--schwarz); color: #fff; font-size: 36px;
  display: grid; place-items: center; margin: 14px auto; box-shadow: 0 0 0 5px var(--gold), 0 8px 22px rgba(0, 0, 0, .25);
}
.mic-btn.rec { background: var(--rot); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.words span { padding: 1px 3px; border-radius: 6px; }
.words .hit { background: var(--ok-bg); color: var(--ok); }
.words .miss { background: var(--bad-bg); color: var(--bad); }
.dialog-line { padding: 10px 12px; border-radius: 14px; margin: 6px 0; max-width: 88%; }
.dialog-line.a { background: var(--soft); border: 1px solid var(--line); }
.dialog-line.b { background: var(--ok-bg); margin-left: auto; }
.dialog-line .tr { font-size: 14px; color: var(--muted); }

/* kartlar (flashcard) */
.flash {
  min-height: 260px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  background: var(--card); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 22px; margin-bottom: 14px; position: relative; overflow: hidden;
}
.flash::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 5px; background: var(--flag); }
.flash .word { font-size: 32px; font-weight: 800; }
.flash .meaning { font-size: 22px; margin-top: 12px; }
.flash .example { margin-top: 14px; color: var(--muted); font-size: 16px; }
.vocab-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.vocab-row:last-child { border-bottom: 0; }
.vocab-row .de { font-weight: 700; }
.vocab-row .tr { color: var(--muted); font-size: 15px; }

.result-big { font-size: 56px; text-align: center; margin: 10px 0 0; font-weight: 850; }
.stars { font-size: 34px; text-align: center; letter-spacing: 4px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(92px + var(--safe-b)); z-index: 60;
  background: var(--schwarz); color: #fff; padding: 10px 16px; border-radius: 12px; font-size: 15px; box-shadow: var(--shadow-lg);
  border-bottom: 3px solid var(--gold);
}
.seg { display: flex; background: var(--line); border-radius: 12px; padding: 3px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 10px; font-size: 15px; }
.seg button.on { background: var(--card); font-weight: 700; box-shadow: var(--shadow); }
select.txt-in { font-size: 16px; }

@media (min-width: 640px) {
  .quick-grid { grid-template-columns: repeat(4, 1fr); }
  .section-grid { grid-template-columns: repeat(3, 1fr); }
}

/* ===== Notlarım ===== */
.hidden { display: none !important; }
.note-src { -webkit-user-select: text; user-select: text; }
.quick-tile.wide { grid-column: span 2; flex-direction: row; align-items: center; gap: 12px; }
.quick-tile.wide .name { flex: 1; }
.link-btn { border: 0; background: none; padding: 4px 2px; font: inherit; font-size: 14px; font-weight: 650; color: var(--primary); cursor: pointer; text-decoration: none; }
.link-btn.danger { color: var(--bad); }
.card.note { border-left: 5px solid var(--gold); }
.note-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.note-quote { background: var(--soft); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; white-space: pre-wrap; font-size: 15px; line-height: 1.5; max-height: 240px; overflow: auto; }
.note-text { white-space: pre-wrap; line-height: 1.55; margin: 6px 0; }
.note-actions { display: flex; align-items: center; gap: 10px; border-top: 1px solid var(--line); margin-top: 10px; padding-top: 6px; }
.card.note.review h2 { margin: 2px 0 6px; }
.sheet-bg { position: fixed; inset: 0; z-index: 100; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--card); width: 100%; max-width: 640px; max-height: 92vh; overflow: auto; border-radius: 22px 22px 0 0; padding: 16px 16px calc(16px + var(--safe-b)); box-shadow: var(--shadow-lg); border-top: 5px solid var(--gold); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; font-size: 18px; }
.sheet-label { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 4px; font-weight: 700; font-size: 14px; }
.sheet textarea.txt-in { resize: vertical; font-family: inherit; min-height: 90px; font-size: 16px; }
.quick-tile.wide { min-height: auto; }
body.sheet-open { overflow: hidden; }
