/* ===== ÇatPat tema ===== */
:root {
  --bg: #101418;
  --surface: #1a2129;
  --surface2: #232d38;
  --text: #eef3f8;
  --text-dim: #93a3b3;
  --accent: #58cc60;
  --accent2: #4fb8e5;
  --accent-soft: #1d3a22;
  --ok: #3fcf7a;
  --bad: #ff6b60;
  --gold: #f2c14e;
  --border: #33404e;
  --shadow: 0 3px 14px rgba(0,0,0,.45);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  background-image: radial-gradient(700px 400px at 85% -5%, rgba(88,204,96,.10), transparent 60%);
}

/* ===== Üst bar ===== */
.topbar {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: .7rem 1rem;
  padding-top: calc(.7rem + env(safe-area-inset-top));
  background: rgba(26,33,41,.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 1.05rem; flex: 1; font-weight: 700; letter-spacing: .02em; }
.icon-btn {
  background: none; border: none; font-size: 1.3rem; cursor: pointer;
  color: var(--text); padding: .25rem .4rem; border-radius: 8px;
}
.icon-btn:active { background: var(--surface2); }
.stats { display: flex; gap: .7rem; font-size: .85rem; font-weight: 700; }
#stat-streak { color: var(--gold); }
#stat-xp { color: var(--accent2); }

main {
  flex: 1; width: 100%; max-width: 560px; margin: 0 auto;
  padding: 1rem; padding-bottom: 3rem;
}
.loading { text-align: center; color: var(--text-dim); padding: 3rem 0; }

/* ===== Kurs seçici ===== */
.picker { padding-top: .8rem; }
.picker-hi { text-align: center; color: var(--text-dim); font-size: .95rem; margin-bottom: 1.1rem; }
.course-card {
  display: flex; align-items: center; gap: .9rem; width: 100%;
  background: var(--surface); border: 2px solid var(--border); border-radius: 16px;
  padding: 1rem; margin-bottom: .8rem; cursor: pointer; color: var(--text);
  box-shadow: 0 3px 0 rgba(0,0,0,.3); text-align: left;
  -webkit-tap-highlight-color: transparent;
}
.course-card:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.cc-flag { font-size: 2rem; }
.cc-body { flex: 1; display: flex; flex-direction: column; }
.cc-name { font-weight: 800; font-size: 1.05rem; }
.cc-desc { font-size: .78rem; color: var(--text-dim); }
.cc-go { font-size: .8rem; font-weight: 800; color: var(--accent); white-space: nowrap; }

/* ===== Yol (path) ===== */
.unit {
  border-radius: 16px;
  padding: .8rem 1rem;
  margin: 1.2rem 0 1rem;
  text-align: center;
  font-weight: 800;
  color: #101418;
  background: linear-gradient(90deg, var(--accent), #3da845);
  box-shadow: var(--shadow);
}
.unit .u-sub { display: block; font-size: .72rem; font-weight: 600; opacity: .75; }
.unit.locked { background: var(--surface2); color: var(--text-dim); box-shadow: none; }

.path { display: flex; flex-direction: column; align-items: center; padding: .4rem 0; }
.node-wrap { display: flex; flex-direction: column; align-items: center; width: 100%; margin-bottom: 1rem; }
.node-wrap.pos-l { align-items: flex-start; padding-left: 18%; }
.node-wrap.pos-r { align-items: flex-end; padding-right: 18%; }
.node {
  width: 72px; height: 72px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 30px; cursor: pointer; position: relative;
  background: var(--surface2); border: 4px solid var(--border);
  box-shadow: 0 5px 0 rgba(0,0,0,.4);
  transition: transform .1s;
  -webkit-tap-highlight-color: transparent;
  color: var(--text);
}
.node:active { transform: translateY(2px); box-shadow: 0 3px 0 rgba(0,0,0,.4); }
.node.done { background: var(--gold); border-color: #d9a93a; box-shadow: 0 5px 0 #a87e26; }
.node.cur { background: var(--accent); border-color: #8fe996; box-shadow: 0 5px 0 #2e7d34; animation: pulse 1.8s infinite; }
.node.locked { opacity: .4; filter: grayscale(.7); cursor: default; }
.node.review { background: var(--accent2); border-color: #7ed4f0; box-shadow: 0 5px 0 #2b7ba0; }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.05); } }
.node .crowns {
  position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%);
  background: var(--bg); border: 1px solid var(--border); border-radius: 999px;
  font-size: .62rem; padding: .05rem .45rem; color: var(--gold); white-space: nowrap;
}
.node .n-badge {
  position: absolute; top: -6px; right: -6px; background: var(--bad); color: #fff;
  border-radius: 999px; min-width: 22px; height: 22px; font-size: .72rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}
.node-lbl { margin-top: .55rem; font-size: .8rem; font-weight: 600; color: var(--text-dim); text-align: center; max-width: 150px; }

/* ===== Ders oturumu ===== */
.lesson-bar { display: flex; align-items: center; gap: .7rem; margin-bottom: 1.1rem; }
.lesson-bar .x { background: none; border: none; color: var(--text-dim); font-size: 1.3rem; cursor: pointer; }
.lesson-bar .pb { flex: 1; height: 14px; background: var(--surface2); border-radius: 8px; overflow: hidden; }
.lesson-bar .pf { height: 100%; background: linear-gradient(90deg, var(--ok), #7fe0a5); border-radius: 8px; transition: width .35s; }

.ex-type {
  font-size: .72rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--accent2); margin-bottom: .5rem;
}
.ex-type.review { color: var(--gold); }
.ex-q { font-size: 1.05rem; font-weight: 700; margin-bottom: 1rem; line-height: 1.45; white-space: pre-wrap; }

/* egzersiz bileşenleri */
.opt-list { display: flex; flex-direction: column; gap: .55rem; }
.opt {
  background: var(--surface); border: 2px solid var(--border); border-radius: 14px;
  padding: .85rem 1rem; font-size: .95rem; color: var(--text); text-align: left;
  cursor: pointer; line-height: 1.45; box-shadow: 0 3px 0 rgba(0,0,0,.3);
  -webkit-tap-highlight-color: transparent;
}
.opt:active { transform: translateY(1px); box-shadow: 0 2px 0 rgba(0,0,0,.3); }
.opt:disabled { cursor: default; }
.opt.correct { background: rgba(63,207,122,.18); border-color: var(--ok); color: #8ee7ae; animation: pop .35s; }
.opt.wrong { background: rgba(255,107,96,.15); border-color: var(--bad); color: #ffa39c; animation: shake .4s; }
@keyframes pop { 50% { transform: scale(1.02); } }
@keyframes shake { 20%,60% { transform: translateX(-6px); } 40%,80% { transform: translateX(6px); } }

.pair-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.tile {
  background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
  padding: .8rem .5rem; font-size: .9rem; color: var(--text); text-align: center;
  cursor: pointer; box-shadow: 0 3px 0 rgba(0,0,0,.3); line-height: 1.35;
  -webkit-tap-highlight-color: transparent;
}
.tile.sel { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.tile.matched { border-color: var(--ok); color: var(--ok); opacity: .5; cursor: default; box-shadow: none; }
.tile.flash-bad { animation: shake .4s; border-color: var(--bad); }

.cloze-text {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 1rem; font-size: 1rem; line-height: 2; margin-bottom: .9rem;
}
.blank {
  display: inline-block; min-width: 76px; border-bottom: 2.5px solid var(--accent);
  text-align: center; color: var(--accent); font-weight: 700; cursor: pointer; padding: 0 .3rem;
}
.blank.empty::after { content: " "; }
.bank { display: flex; flex-wrap: wrap; gap: .5rem; }
.word {
  background: var(--surface2); border: 2px solid var(--border); border-radius: 10px;
  padding: .45rem .85rem; font-size: .92rem; color: var(--text); cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,.3);
  -webkit-tap-highlight-color: transparent;
}
.word.used { opacity: .25; pointer-events: none; }

.order-pool, .order-answer { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .9rem; }
.order-answer { min-height: 48px; border: 2px dashed var(--border); border-radius: 12px; padding: .5rem; }
.o-item {
  display: flex; align-items: center; gap: .6rem;
  background: var(--surface); border: 2px solid var(--border); border-radius: 12px;
  padding: .65rem .8rem; font-size: .9rem; cursor: pointer; line-height: 1.35;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
}
.o-item .no {
  background: var(--accent); color: #101418; font-weight: 800; border-radius: 999px;
  width: 22px; height: 22px; display: flex; align-items: center; justify-content: center;
  font-size: .75rem; flex-shrink: 0;
}

/* translate: cevap şeridi */
.tr-answer {
  min-height: 52px; border-bottom: 2px dashed var(--border);
  display: flex; flex-wrap: wrap; gap: .45rem; align-items: center;
  padding: .35rem 0 .6rem; margin-bottom: .9rem;
}
.tr-answer.good { border-color: var(--ok); }
.tr-answer.bad { border-color: var(--bad); }

/* type: yazma alanı + diakritik çubuğu */
.type-inp {
  width: 100%; background: var(--surface); border: 2px solid var(--border); border-radius: 14px;
  padding: .85rem 1rem; font-size: 1.05rem; font-weight: 700; color: var(--text);
  outline: none; margin-bottom: .7rem;
}
.type-inp:focus { border-color: var(--accent2); }
.type-inp.good { border-color: var(--ok); color: var(--ok); }
.type-inp.bad { border-color: var(--bad); color: var(--bad); }
.diac-bar { display: flex; gap: .45rem; flex-wrap: wrap; }
.diac-key {
  background: var(--surface2); border: 2px solid var(--border); border-radius: 10px;
  padding: .4rem .8rem; font-size: 1.05rem; font-weight: 800; color: var(--gold); cursor: pointer;
  box-shadow: 0 2px 0 rgba(0,0,0,.3);
  -webkit-tap-highlight-color: transparent;
}
.diac-key:active { transform: translateY(1px); box-shadow: none; }

/* chars: büyük karakter + şık ızgarası */
.kana-big {
  text-align: center; font-size: 4.2rem; font-weight: 700; line-height: 1.2;
  margin: .4rem 0 1.1rem; letter-spacing: .1em;
}
.char-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .55rem; }
.char-opt { text-align: center; }
.char-opt.big { font-size: 1.9rem; padding: .7rem; }

.check-row { margin-top: 1rem; }
.big-btn {
  width: 100%; border: none; border-radius: 14px; padding: .95rem;
  font-size: 1rem; font-weight: 800; cursor: pointer; color: #101418;
  background: var(--accent); box-shadow: 0 4px 0 #2e7d34;
  -webkit-tap-highlight-color: transparent;
}
.big-btn:active { transform: translateY(2px); box-shadow: 0 2px 0 #2e7d34; }
.big-btn:disabled { opacity: .35; cursor: default; }
.big-btn.ok-btn { background: var(--ok); box-shadow: 0 4px 0 #2a9457; }
.big-btn.ghost { background: var(--surface2); color: var(--text); box-shadow: 0 4px 0 rgba(0,0,0,.35); }

.feedback {
  margin-top: 1rem; border-radius: 14px; padding: .85rem 1rem; font-size: .92rem; line-height: 1.5;
}
.feedback.good { background: rgba(63,207,122,.13); border: 1.5px solid var(--ok); color: #9debb7; }
.feedback.bad { background: rgba(255,107,96,.12); border: 1.5px solid var(--bad); color: #ffb3ac; }
.feedback b { display: block; margin-bottom: .15rem; }

/* ===== Ders sonu ===== */
.finish { text-align: center; padding: 2rem 0 1rem; }
.finish .fx { font-size: 3rem; }
.finish .xp-big { font-size: 2.4rem; font-weight: 900; color: var(--gold); margin: .3rem 0; }
.finish .sub { color: var(--text-dim); font-size: .92rem; margin-bottom: 1.4rem; }
.finish-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; margin-bottom: 1.6rem; }
.f-box {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: .8rem .3rem; font-size: .72rem; color: var(--text-dim);
}
.f-box b { display: block; font-size: 1.25rem; color: var(--text); }

.empty-msg { text-align: center; color: var(--text-dim); padding: 2.5rem 1rem; }
.hint { font-size: .8rem; color: var(--text-dim); text-align: center; margin: .6rem 0 1rem; }

/* ===== Profil ===== */
.stats { cursor: pointer; border-radius: 10px; padding: .2rem .4rem; }
.stats:active { background: var(--surface2); }
.sec-title {
  font-size: .78rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase;
  color: var(--text-dim); margin: 1.4rem 0 .7rem;
}
.days-chart {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: .4rem; height: 130px; padding: .8rem .6rem .5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  margin-bottom: 1rem;
}
.day-col { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; }
.day-xp { font-size: .62rem; color: var(--accent2); font-weight: 700; margin-bottom: .15rem; }
.day-bar {
  width: 70%; min-height: 3px; border-radius: 5px 5px 2px 2px;
  background: linear-gradient(180deg, var(--accent2), var(--accent));
}
.day-lbl { font-size: .66rem; color: var(--text-dim); margin-top: .3rem; }
