/* Ders defteri teması: kâğıt zemin, mürekkep yazı, tek vurgu rengi.
   Vurgu rengi app.js tarafından (--accent, --accent-soft, --accent-ink) seçilen palete göre atanır. */
:root {
  --bg: #f5f1e8;
  --paper: #fffdf8;
  --paper2: #f0ebdf;
  --ink: #1f1c16;
  --ink2: #4a453b;
  --muted: #8a8373;
  --line: #e2dbcb;
  --rule: #d5ccb8;
  --accent: #2a45c9;
  --accent-ink: #2a45c9;
  --accent-soft: #e8ecfb;
  --ok: #2f7a3f;
  --ok-soft: #e6f1e3;
  --bad: #b8322a;
  --bad-soft: #f8e5e1;
  --warn: #a86b12;
  --warn-soft: #f6ecd6;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
:root[data-mode="dark"] {
  --bg: #14130f;
  --paper: #1d1b16;
  --paper2: #26231c;
  --ink: #efe9dc;
  --ink2: #cfc8b8;
  --muted: #8f887a;
  --line: #322e26;
  --rule: #3d382e;
  --ok: #7fc28b;
  --ok-soft: #1f2e21;
  --bad: #ef8a7f;
  --bad-soft: #3a1f1c;
  --warn: #e0b061;
  --warn-soft: #362b18;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 500 16px/1.55 var(--sans); touch-action: manipulation;
  -webkit-font-smoothing: antialiased;
}
#app {
  max-width: 620px; margin: 0 auto;
  padding: calc(env(safe-area-inset-top) + 14px) 18px calc(env(safe-area-inset-bottom) + 32px);
  min-height: 100vh;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; text-align: inherit; }
b { font-weight: 750; }
.serif { font-family: var(--serif); }
.muted { color: var(--muted); }
.small { font-size: 13.5px; }
.row { display: flex; gap: 10px; align-items: center; }
.grow { flex: 1; min-width: 0; }

/* ---------- başlık ---------- */
.eyebrow { font-size: 11.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.top { display: flex; align-items: flex-end; gap: 12px; margin: 6px 0 18px; padding-bottom: 14px; border-bottom: 1.5px solid var(--ink); }
.top h1 { font: 600 28px/1.1 var(--serif); margin: 2px 0 0; letter-spacing: -.01em; font-variation-settings: "opsz" 72; }
.top .sub { color: var(--muted); font-size: 13.5px; margin-top: 4px; }
.back {
  width: 38px; height: 38px; border-radius: 50%; border: 1.5px solid var(--rule);
  display: grid; place-items: center; flex: none; color: var(--ink); margin-bottom: 2px;
}
.back svg { width: 18px; height: 18px; }

/* ---------- ana sayfa ---------- */
.masthead { padding: 8px 0 18px; border-bottom: 1.5px solid var(--ink); }
.masthead h1 { font: 600 40px/1.02 var(--serif); margin: 10px 0 0; letter-spacing: -.02em; font-variation-settings: "opsz" 144; }
.masthead h1 em { font-style: italic; font-weight: 400; color: var(--accent-ink); }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--rule); }
.fig { padding: 16px 0 14px; }
.fig + .fig { padding-left: 14px; border-left: 1px solid var(--rule); }
.fig .n { font: 600 30px/1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.fig .n small { font-size: 16px; color: var(--muted); font-weight: 500; }
.fig .l { font-size: 12.5px; color: var(--muted); margin-top: 6px; }
.track { height: 3px; background: var(--line); margin-top: -1px; }
.track > i { display: block; height: 100%; background: var(--accent); }

.cta {
  display: flex; align-items: center; justify-content: space-between; width: 100%; gap: 12px;
  background: var(--accent); color: #fff; border-radius: 14px; padding: 18px 20px; margin: 20px 0 6px;
  box-shadow: 0 10px 24px -14px var(--accent);
}
.cta .t { font: 600 21px/1.15 var(--serif); }
.cta .d { font-size: 13.5px; opacity: .85; margin-top: 3px; }
.cta svg { width: 22px; height: 22px; flex: none; }

.list { margin-top: 8px; }
.li {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 15px 2px;
  border-bottom: 1px solid var(--line);
}
.li .no { font: italic 400 15px/1 var(--serif); color: var(--muted); width: 24px; flex: none; }
.li .t { font-weight: 750; font-size: 16.5px; }
.li .d { font-size: 13.5px; color: var(--muted); margin-top: 1px; line-height: 1.4; }
.li .count { font: 600 15px/1 var(--sans); color: #fff; background: var(--bad); border-radius: 99px; padding: 4px 9px; }
.li .arr { color: var(--muted); width: 18px; height: 18px; flex: none; }

.sect { margin: 30px 0 12px; display: flex; align-items: baseline; gap: 10px; }
.sect h2 { font: 600 20px/1.2 var(--serif); margin: 0; }
.sect .rule { flex: 1; height: 1px; background: var(--rule); transform: translateY(-4px); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 8px 13px; border-radius: 99px; border: 1.5px solid var(--rule); font-size: 14px; font-weight: 650; color: var(--ink2);
  background: var(--paper);
}
.chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }

.panel { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 12px; }
.setrow { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; }
.setrow + .setrow, .setblock + .setblock, .setrow + .setblock, .setblock + .setrow { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }
.setblock .lab { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.sw { width: 48px; height: 28px; border-radius: 99px; background: var(--rule); position: relative; flex: none; transition: background .2s; }
.sw::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.sw.on { background: var(--accent); }
.sw.on::after { transform: translateX(20px); }

.seg { display: flex; border: 1.5px solid var(--rule); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; padding: 7px 4px; border-radius: 9px; font-size: 14px; font-weight: 650; color: var(--muted); text-align: center; }
.seg button.on { background: var(--ink); color: var(--bg); }

.swatches { display: flex; flex-wrap: wrap; gap: 14px; }
.swatch { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); font-weight: 650; }
.swatch i { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-style: normal; font-weight: 800; box-shadow: 0 0 0 2px var(--paper), 0 0 0 3.5px transparent; }
.swatch.on i { box-shadow: 0 0 0 2px var(--paper), 0 0 0 4px var(--ink); }
.swatch.on { color: var(--ink); }

/* ---------- butonlar ---------- */
.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px; width: 100%; text-align: center;
  padding: 14px 16px; border-radius: 12px; font-weight: 750; background: var(--ink); color: var(--bg); min-height: 50px;
}
.btn.accent { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; color: var(--ink); border: 1.5px solid var(--rule); }
.btn.ok { background: var(--ok); color: #fff; }
.btn.bad { background: var(--bad); color: #fff; }
.btn.warn { background: var(--warn); color: #fff; }
:root[data-mode="dark"] .btn.ok, :root[data-mode="dark"] .btn.bad, :root[data-mode="dark"] .btn.warn { color: #14130f; }
.btn.sm { padding: 8px 14px; min-height: 38px; font-size: 14px; width: auto; }
.btn[disabled] { opacity: .35; }
.btns { display: grid; gap: 10px; margin-top: 14px; }
.btns.three { grid-template-columns: repeat(3, 1fr); }
.btns.two { grid-template-columns: 1fr 1fr; }
.btns.three .btn { padding: 12px 4px; font-size: 14.5px; }
.cta:active, .li:active, .opt:active, .btn:active, .chip:active, .key:active { transform: scale(.985); }

/* ---------- soru ---------- */
.progress { height: 3px; background: var(--line); margin: -18px 0 18px; }
.progress > i { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.qmeta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; font-size: 12.5px; color: var(--muted); font-weight: 700; letter-spacing: .02em; margin-bottom: 12px; }
.qmeta .type { color: var(--accent-ink); text-transform: uppercase; letter-spacing: .12em; font-size: 11.5px; font-weight: 800; }
.pri { display: inline-flex; align-items: center; gap: 5px; }
.pri::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pri.p3 { color: var(--bad); }
.pri.p2 { color: var(--warn); }
.pri.p1 { color: var(--muted); }
.qtext { font: 500 21px/1.45 var(--serif); letter-spacing: -.003em; font-variation-settings: "opsz" 36; }
.qtext b { font-weight: 700; }
.opts { display: grid; gap: 10px; margin-top: 20px; }
.opt {
  display: flex; gap: 14px; align-items: flex-start; width: 100%;
  background: var(--paper); border: 1.5px solid var(--line); border-radius: 12px; padding: 14px; font-size: 16px; line-height: 1.45;
}
.opt .k { flex: none; width: 26px; height: 26px; border-radius: 50%; border: 1.5px solid var(--rule); display: grid; place-items: center; font: 600 14px/1 var(--serif); color: var(--ink2); }
.opt.sel { border-color: var(--accent); background: var(--accent-soft); }
.opt.sel .k { background: var(--accent); border-color: var(--accent); color: #fff; }
.opt.right { border-color: var(--ok); background: var(--ok-soft); }
.opt.right .k { background: var(--ok); border-color: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad); background: var(--bad-soft); }
.opt.wrong .k { background: var(--bad); border-color: var(--bad); color: #fff; }
.opt.dim { opacity: .5; }
.opt[disabled] { cursor: default; }

.feedback { border-left: 3px solid; padding: 4px 0 4px 16px; margin-top: 20px; font-size: 15.5px; color: var(--ink2); }
.feedback.ok { border-color: var(--ok); }
.feedback.bad { border-color: var(--bad); }
.feedback .h { font: 600 19px/1.2 var(--serif); margin-bottom: 6px; }
.feedback.ok .h { color: var(--ok); }
.feedback.bad .h { color: var(--bad); }
.src { font-size: 12.5px; color: var(--muted); margin-top: 10px; font-weight: 650; }
.src::before { content: "↳ "; }

.answer { background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-top: 14px; font-size: 15.5px; overflow-x: auto; color: var(--ink2); }
.answer .lab { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 8px; }
.answer.mine { background: var(--accent-soft); border-color: transparent; }
.answer p { margin: 0 0 8px; }
.answer p:last-child { margin-bottom: 0; }
.answer ul, .answer ol { margin: 4px 0 8px; padding-left: 22px; }
.answer li { margin-bottom: 4px; }
.tip { border-left: 3px solid var(--warn); background: var(--warn-soft); border-radius: 0 8px 8px 0; padding: 8px 12px; font-size: 14px; color: var(--ink); }
table.tt { border-collapse: collapse; margin: 6px 0 10px; font-size: 14px; font-variant-numeric: tabular-nums; }
table.tt th, table.tt td { border-bottom: 1px solid var(--line); padding: 5px 9px; text-align: center; white-space: nowrap; }
table.tt th { border-bottom: 1.5px solid var(--ink2); font-weight: 750; color: var(--ink); }

textarea {
  width: 100%; min-height: 120px; margin-top: 18px; border-radius: 12px; border: 1.5px solid var(--rule);
  background: var(--paper); color: var(--ink); padding: 12px 14px; font: 500 16px/1.55 var(--sans); resize: vertical;
  background-image: repeating-linear-gradient(transparent 0 calc(1.55em + 0px), var(--line) calc(1.55em + 0px) calc(1.55em + 1px));
  background-position: 0 11px; background-attachment: local;
}
textarea:focus { outline: none; border-color: var(--accent); }

.keys { margin-top: 18px; }
.keys .kh { font: 600 17px/1.3 var(--serif); margin-bottom: 4px; }
.keys .ks { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.key { display: flex; gap: 12px; align-items: flex-start; padding: 11px 2px; border-bottom: 1px solid var(--line); width: 100%; font-size: 15.5px; }
.key .cb { flex: none; width: 22px; height: 22px; border-radius: 6px; border: 1.5px solid var(--rule); display: grid; place-items: center; font-size: 14px; color: #fff; margin-top: 1px; }
.key.on .cb { background: var(--ok); border-color: var(--ok); }
.grade-lab { font-size: 13.5px; color: var(--muted); margin-top: 18px; }

/* ---------- kart ---------- */
.flash { perspective: 1400px; }
.flash .inner { position: relative; min-height: 300px; transition: transform .5s cubic-bezier(.3,.7,.3,1); transform-style: preserve-3d; }
.flash.flipped .inner { transform: rotateY(180deg); }
.flash .face {
  position: absolute; inset: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden;
  background: var(--paper); border: 1px solid var(--line); border-radius: 16px; padding: 28px 22px 40px;
  display: flex; flex-direction: column; justify-content: center; text-align: center;
  box-shadow: 0 1px 0 var(--line), 0 18px 30px -24px rgba(0,0,0,.35);
}
.flash .face.front { font: 500 23px/1.4 var(--serif); }
.flash .face.front::before { content: ""; position: absolute; top: 46px; left: 0; right: 0; height: 1px; background: var(--bad); opacity: .35; }
.flash .face.back { transform: rotateY(180deg); font-size: 17px; line-height: 1.6; color: var(--ink2); border-top: 4px solid var(--accent); }
.flash .hint { position: absolute; bottom: 14px; left: 0; right: 0; font: 600 12.5px/1 var(--sans); color: var(--muted); }

/* ---------- listeler ---------- */
details.item { border-bottom: 1px solid var(--line); }
details.item > summary { list-style: none; padding: 15px 2px; display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
details.item > summary::-webkit-details-marker { display: none; }
details.item > summary .chev { margin-left: auto; color: var(--muted); transition: transform .2s; flex: none; width: 18px; height: 18px; margin-top: 3px; }
details.item[open] > summary .chev { transform: rotate(90deg); }
details.item .body { padding: 0 2px 18px; }
.sumtxt { font-size: 15.5px; line-height: 1.45; font-weight: 600; }
.sumtxt .qmeta { margin: 6px 0 0; }
.yours, .correct { border-left: 3px solid; padding: 2px 0 2px 12px; margin-top: 12px; font-size: 15px; }
.yours { border-color: var(--bad); }
.correct { border-color: var(--ok); }
.yours .lab, .correct .lab { font-size: 11.5px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; display: block; margin-bottom: 2px; }
.yours .lab { color: var(--bad); }
.correct .lab { color: var(--ok); }
.fixtag { color: var(--ok); }

.empty { text-align: center; padding: 44px 20px; color: var(--muted); }
.empty .big { font: italic 400 40px/1 var(--serif); color: var(--ink); margin-bottom: 10px; }

.wk { padding: 16px 0; border-bottom: 1px solid var(--line); }
.wk .hd { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.wk .hd b { font: 600 18px/1.25 var(--serif); }
.meter { height: 4px; border-radius: 9px; background: var(--line); overflow: hidden; margin-top: 8px; }
.meter > i { display: block; height: 100%; border-radius: 9px; }
.topicrow { display: flex; align-items: center; gap: 12px; padding: 10px 0 0; }

.score { padding: 26px 0 22px; border-bottom: 1px solid var(--rule); margin-bottom: 18px; }
.score .big { font: 600 72px/1 var(--serif); letter-spacing: -.03em; font-variation-settings: "opsz" 144; }
.score .big small { font-size: 32px; color: var(--muted); font-weight: 400; }
.score .msg { font: italic 400 18px/1.4 var(--serif); color: var(--ink2); margin-top: 8px; }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; color: var(--ink); }
.timer.low { color: var(--bad); }

.foot { text-align: center; font-size: 12.5px; color: var(--muted); margin-top: 28px; line-height: 1.6; }
.linkbtn { color: var(--accent-ink); font-weight: 750; text-decoration: underline; text-underline-offset: 3px; }
