/* ---------- renkler (açık / koyu tema) ---------- */
:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #ece9e1;
  --text: #1f2421;
  --muted: #6b716c;
  --accent: #2f5d50;
  --accent-text: #ffffff;
  --good: #2e7d4f;
  --bad: #b3412e;
  --border: #dcd8ce;
  --shadow: 0 6px 24px rgba(0, 0, 0, .08);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151816;
    --surface: #1f2421;
    --surface-2: #2a302c;
    --text: #e9ece9;
    --muted: #9aa29c;
    --accent: #7fc0a8;
    --accent-text: #10201a;
    --good: #6cc38f;
    --bad: #ef8a76;
    --border: #343b36;
    --shadow: 0 6px 24px rgba(0, 0, 0, .4);
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  display: flex;
  flex-direction: column;
  -webkit-tap-highlight-color: transparent;
}
button, select, input { font: inherit; color: inherit; }

/* ---------- üst çubuk ve sekmeler ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 12px) 16px 8px;
}
.topbar h1 { font-size: 1.3rem; margin: 0; }
.streak { font-size: .9rem; color: var(--muted); }

main {
  flex: 1;
  overflow-y: auto;
  padding: 8px 16px 24px;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
}

.tabs {
  display: grid; grid-template-columns: repeat(4, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
}
.tabs button {
  background: none; border: 0; padding: 8px 0 10px;
  font-size: .75rem; color: var(--muted);
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  cursor: pointer;
}
.tabs button .ico { font-size: 1.3rem; }
.tabs button.active { color: var(--accent); font-weight: 600; }

/* ---------- genel parçalar ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: .85rem; }
.big { font-size: 2rem; font-weight: 700; line-height: 1.1; }
label.field { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--muted); flex: 1; min-width: 120px; }
select, input[type=search], input[type=number] {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px; width: 100%;
}
.check { display: flex; gap: 8px; align-items: center; font-size: .9rem; }

.btn {
  border: 0; border-radius: 12px; padding: 14px 18px;
  background: var(--surface-2); cursor: pointer; font-weight: 600;
  min-height: 48px;
}
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.good { background: var(--good); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stats div { background: var(--surface-2); border-radius: 12px; padding: 10px 4px; }
.stats b { display: block; font-size: 1.4rem; }
.stats span { font-size: .75rem; color: var(--muted); }

/* ---------- kart çevirme ---------- */
.progressbar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; margin: 4px 0 12px; }
.progressbar > div { height: 100%; background: var(--accent); transition: width .3s; }

.card-wrap { perspective: 1200px; }
.card {
  /* ekranın boş kalan kısmını kullan (üst çubuk + sayaç + butonlar + sekmeler ≈ 300px) */
  position: relative; width: 100%; min-height: max(340px, calc(100dvh - 310px));
  transform-style: preserve-3d; transition: transform .45s;
  cursor: pointer;
}
.card.flipped { transform: rotateY(180deg); }
.face {
  position: absolute; inset: 0;
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 20px; display: flex; flex-direction: column;
  overflow-y: auto;
}
.face.front { align-items: center; justify-content: center; text-align: center; }
.face.back { transform: rotateY(180deg); }
.word { font-size: 2.1rem; font-weight: 700; word-break: break-word; }
.pos { color: var(--muted); font-style: italic; }
.tag { display: inline-block; font-size: .75rem; background: var(--surface-2); border-radius: 99px; padding: 2px 10px; color: var(--muted); }
.hint { margin-top: 18px; font-size: .85rem; color: var(--muted); }
.meaning { font-size: 1.3rem; font-weight: 600; margin: 4px 0 10px; }
.back h3 { font-size: .75rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin: 12px 0 2px; }
.ex { margin: 4px 0; }
.ex .tr { color: var(--muted); font-size: .92rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { background: var(--surface-2); border-radius: 99px; padding: 2px 10px; font-size: .9rem; }
.chip.ant { border: 1px dashed var(--border); background: none; }

/* ---------- quiz ---------- */
.question { font-size: 1.6rem; font-weight: 700; text-align: center; margin: 12px 0 4px; word-break: break-word; }
.options { display: grid; gap: 10px; margin-top: 16px; }
.option {
  text-align: left; padding: 14px 16px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer;
  min-height: 52px;
}
.option.correct { background: var(--good); color: #fff; border-color: var(--good); }
.option.wrong { background: var(--bad); color: #fff; border-color: var(--bad); }

/* ---------- ilerleme ---------- */
.boxes { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; align-items: end; height: 110px; margin-top: 8px; }
.boxes .bar { background: var(--accent); border-radius: 6px 6px 0 0; min-height: 2px; }
.boxes-labels { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; font-size: .7rem; color: var(--muted); text-align: center; }
.days { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 8px; }
.day {
  aspect-ratio: 1; border-radius: 8px; font-size: .72rem;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); border: 0; cursor: pointer; position: relative; overflow: hidden;
}
.day .fill { position: absolute; left: 0; right: 0; bottom: 0; background: var(--accent); opacity: .45; }
.day span { position: relative; }
.activity { display: grid; grid-template-columns: repeat(14, 1fr); gap: 3px; align-items: end; height: 60px; }
.activity div { background: var(--accent); border-radius: 3px 3px 0 0; min-height: 2px; opacity: .8; }

/* ---------- liste ---------- */
.list-item { padding: 10px 4px; border-bottom: 1px solid var(--border); cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.list-item b { font-weight: 600; }
.box-dot { font-size: .75rem; color: var(--muted); white-space: nowrap; }

.modal {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .45);
  display: flex; align-items: flex-end; justify-content: center; z-index: 10;
}
.modal .sheet {
  background: var(--bg); width: 100%; max-width: 560px; max-height: 85vh; overflow-y: auto;
  border-radius: 20px 20px 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom));
}
.modal .card { min-height: 0; cursor: default; }
.modal .face { position: static; transform: none; box-shadow: none; }
