/* ==========================================================================
   Soru Defteri — kareli defter teması
   Mobil öncelikli. Kırılımlar: 640px (büyük telefon/küçük tablet), 900px (tablet yatay+)
   ========================================================================== */

:root {
  --ink: #1e2a5a;
  --ink-2: #55608c;
  --ink-3: #8a93b5;
  --paper: #f6f8fc;
  --grid: rgba(59, 104, 214, .075);
  --line: #dde3f1;
  --card: #ffffff;
  --marker: #ffd43b;
  --marker-soft: #fff3bf;
  --ok: #138a4a;
  --ok-bg: #e6f6ec;
  --ok-line: #8fd5aa;
  --bad: #d93a40;
  --bad-bg: #fdeced;
  --bad-line: #f3a6a9;
  --blank: #8a93b5;
  --accent: #2563eb;
  --f-head: 'Baloo 2', 'Nunito', system-ui, sans-serif;
  --f-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --r-sm: 10px;
  --r: 16px;
  --r-lg: 22px;
  --sh: 0 1px 0 rgba(30, 42, 90, .06), 0 6px 18px -10px rgba(30, 42, 90, .22);
  --sh-up: 0 -6px 24px -14px rgba(30, 42, 90, .35);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --tabbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--f-body);
  font-size: 17px;
  line-height: 1.55;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 26px 26px;
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  min-height: 100vh;
  min-height: 100dvh;
}
img { max-width: 100%; height: auto; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { font-family: var(--f-head); line-height: 1.15; margin: 0; font-weight: 700; letter-spacing: -.01em; }
p { margin: 0; }
code { background: #eef1fa; padding: .1em .35em; border-radius: 5px; font-size: .9em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--ink-3); }
.center { text-align: center; }
.ic { width: 1.25em; height: 1.25em; flex: none; display: inline-block; vertical-align: -.25em; }
mark { background: linear-gradient(transparent 45%, var(--marker) 45%, var(--marker) 92%, transparent 92%); color: inherit; padding: 0 .1em; }

.wrap {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 18px 16px calc(var(--tabbar-h) + var(--safe-b) + 28px);
}
.area-bare .wrap { padding-bottom: 28px; }

/* ---------- Fosforlu kalem vurgusu (imza öğe) ---------- */
.hl {
  background: linear-gradient(100deg, transparent 0 2%, var(--marker) 2% 97%, transparent 97%) no-repeat 0 78% / 100% 46%;
  padding: 0 .12em;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

/* ---------- Düğmeler ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 48px; padding: 0 20px;
  border: 2px solid transparent; border-radius: 14px;
  font-weight: 800; font-size: 1rem; text-decoration: none; cursor: pointer;
  transition: transform .08s ease, background-color .15s, box-shadow .15s;
  user-select: none; -webkit-user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: #fff; box-shadow: 0 3px 0 rgba(0,0,0,.25); box-shadow: 0 3px 0 color-mix(in srgb, var(--accent) 70%, #000); }
.btn-primary:hover:not(:disabled) { filter: brightness(1.05); }
.btn-ink { background: var(--ink); color: #fff; box-shadow: 0 3px 0 #0d1433; }
.btn-marker { background: var(--marker); color: var(--ink); box-shadow: 0 3px 0 #d8a800; }
.btn-ghost { background: var(--card); color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-danger { background: var(--card); color: var(--bad); border-color: var(--bad-line); }
.btn-lg { min-height: 56px; font-size: 1.08rem; padding: 0 24px; border-radius: 16px; }
.btn-sm { min-height: 38px; padding: 0 12px; font-size: .92rem; border-radius: 11px; }
.btn-block { width: 100%; }
.icon-btn {
  width: 44px; height: 44px; display: inline-grid; place-items: center;
  border: 0; background: transparent; border-radius: 12px; cursor: pointer; font-size: 1.4rem; font-weight: 800;
}
.icon-btn:hover { background: #eef1fa; }

/* ---------- Üst çubuk ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 16px 10px;
  background: rgba(246, 248, 252, .9);
  backdrop-filter: saturate(1.4) blur(10px);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; font-family: var(--f-head); font-weight: 800; font-size: 1.25rem; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand em { font-style: normal; font-weight: 600; color: var(--ink-3); font-size: .85em; margin-left: .2em; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; font-weight: 800; font-size: .92rem; text-decoration: none; background: var(--card); border: 1px solid var(--line); }
.chip-star .ic { color: #e0a800; fill: var(--marker); }
.chip-ink { background: var(--ink); color: #fff; border-color: var(--ink); }
@media (max-width: 420px) { .chip-ink span { display: none; } }

/* ---------- Alt sekme çubuğu ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(4, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-b));
  padding-bottom: var(--safe-b);
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line);
}
.tabbar a {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  text-decoration: none; color: var(--ink-3); font-size: .78rem; font-weight: 800;
}
.tabbar .ic { width: 26px; height: 26px; }
.tabbar a[aria-current="page"] { color: var(--ink); }
.tabbar a[aria-current="page"] .ic { background: var(--marker); border-radius: 9px; padding: 2px; width: 30px; height: 30px; margin: -2px 0; }
.badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--bad); color: #fff; font-style: normal; font-size: .72rem; line-height: 20px; text-align: center; }
@media (min-width: 900px) {
  .tabbar { left: 50%; right: auto; bottom: 18px; transform: translateX(-50%); width: 520px; height: 64px; padding: 0; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--sh); }
}

/* ---------- Bildirimler ---------- */
.flash { padding: 12px 16px; border-radius: 12px; margin: 0 0 14px; font-weight: 700; border: 1px solid; transition: opacity .4s; }
.flash-ok { background: var(--ok-bg); border-color: var(--ok-line); color: #0d6a39; }
.flash-err { background: var(--bad-bg); border-color: var(--bad-line); color: #a8262b; }
.flash-info, .flash-warn { background: var(--marker-soft); border-color: #f2d36b; color: #6b5200; }
.flash.fade { opacity: 0; }
.toast {
  position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + var(--safe-b) + 16px); z-index: 90;
  transform: translate(-50%, 20px); opacity: 0; transition: .25s;
  max-width: min(92vw, 460px); padding: 12px 18px; border-radius: 14px;
  background: var(--ink); color: #fff; font-weight: 700; box-shadow: var(--sh);
}
.toast.in { transform: translate(-50%, 0); opacity: 1; }
.toast-err { background: #b4232a; }
.quiz-page .toast, .pdf-page .toast { bottom: calc(96px + var(--safe-b)); }

/* ---------- Ana sayfa ---------- */
.hello { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 6px 0 18px; }
.hello h1 { font-size: clamp(1.75rem, 6vw, 2.4rem); }
.hello p { color: var(--ink-2); font-weight: 600; margin-top: 4px; }
.hello-stats { display: flex; align-items: center; gap: 10px; flex: none; }
.ring { position: relative; width: 74px; height: 74px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: #e4e8f4; stroke-width: 5; }
.ring-fg { fill: none; stroke: var(--ok); stroke-width: 5; stroke-linecap: round; stroke-dasharray: var(--p) 100; transition: stroke-dasharray .8s ease; }
.ring b { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; font-family: var(--f-head); font-size: 1.35rem; line-height: 1; }
.ring small { font-size: .65em; color: var(--ink-3); font-weight: 700; }
.streak { display: grid; justify-items: center; padding: 8px 10px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); min-width: 64px; color: var(--ink-3); }
.streak .ic { width: 24px; height: 24px; }
.streak b { font-family: var(--f-head); font-size: 1.3rem; line-height: 1; color: var(--ink); }
.streak small { font-size: .7rem; font-weight: 800; }
.streak.on .ic { color: #f0670f; fill: #ffb366; }
@media (max-width: 520px) {
  .hello { flex-direction: column; align-items: flex-start; }
}

.resume, .review-cta, .mixed, .rg {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 16px; margin-bottom: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh); text-decoration: none;
}
.resume-ic { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--marker); flex: none; }
.resume-txt, .rg-txt { flex: 1; min-width: 0; display: grid; }
.resume-txt b, .review-cta b, .mixed b, .rg-txt b { font-weight: 800; }
.resume-txt small, .review-cta small, .mixed small, .rg-txt small { color: var(--ink-2); font-weight: 600; font-size: .9rem; }
.resume-go { color: var(--ink-3); }
.review-cta { background: var(--marker-soft); border-color: #f2d36b; }
.review-cta > div, .mixed > div { flex: 1; display: grid; }
.mixed { background: var(--ink); color: #fff; border-color: var(--ink); margin-top: 18px; }
.mixed small { color: #c5cbe6; }
.mixed .btn-ink { background: #fff; color: var(--ink); box-shadow: 0 3px 0 #9aa3cc; }
@media (max-width: 480px) {
  .review-cta, .mixed { flex-wrap: wrap; }
  .review-cta .btn, .mixed .btn { width: 100%; }
}

.section-title { font-size: 1.3rem; margin: 26px 0 12px; }

/* Ders kutuları — her ders bir kuru boya rengi */
.subjects { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
@media (min-width: 720px) { .subjects { grid-template-columns: repeat(3, 1fr); gap: 16px; } }
.subject {
  position: relative; display: flex; flex-direction: column; gap: 4px;
  padding: 16px 14px 18px; min-height: 150px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg);
  text-decoration: none; box-shadow: var(--sh);
  transition: transform .12s ease, box-shadow .12s;
  overflow: hidden;
}
.subject::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 6px; background: var(--c); }
.subject:hover { transform: translateY(-2px); }
.subject:active { transform: translateY(0); }
.subject.is-empty { opacity: .62; box-shadow: none; }
.subject-ic { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: #eef2fb; background: color-mix(in srgb, var(--c) 14%, #fff); color: var(--c); flex: none; }
.subject-ic .ic { width: 26px; height: 26px; }
.subject-ic.lg { width: 56px; height: 56px; border-radius: 16px; }
.subject-ic.lg .ic { width: 30px; height: 30px; }
.subject-name { font-family: var(--f-head); font-weight: 700; font-size: 1.22rem; line-height: 1.15; margin-top: 8px; }
.subject-meta { font-size: .85rem; color: var(--ink-2); font-weight: 600; }
.subject .pencil { margin-top: auto; }

/* Kalem şeklinde ilerleme çubuğu */
.pencil { position: relative; display: block; height: 10px; border-radius: 6px 3px 3px 6px; background: #edf0f8; margin-top: 10px; overflow: visible; }
.pencil i { position: absolute; left: 0; top: 0; bottom: 0; width: var(--w, 0%); max-width: 100%; border-radius: 6px 0 0 6px; background: var(--c, var(--accent)); transition: width .6s ease; }
.pencil i::after {
  content: ""; position: absolute; right: -7px; top: 0; border-style: solid; border-width: 5px 0 5px 8px;
  border-color: transparent transparent transparent var(--c, var(--accent));
}
.pencil i[style*="width:0"]::after, .pencil[style*="--w: 0%"] i::after { display: none; }
.pencil.big { height: 12px; margin: 0; }
.pencil.big i::after { border-width: 6px 0 6px 9px; right: -8px; }

/* ---------- Sayfa başlıkları ---------- */
.page-head { display: flex; align-items: center; gap: 14px; margin: 4px 0 20px; }
.page-head h1 { font-size: clamp(1.45rem, 5vw, 2rem); }
.page-head p { color: var(--ink-2); font-weight: 600; }
.page-head .crumb, .crumb { color: var(--ink-3); font-weight: 800; font-size: .9rem; }
.page-head.plain { display: block; }
.page-head.plain p { margin-top: 4px; max-width: 60ch; }
.back { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; background: var(--card); border: 1px solid var(--line); flex: none; }

/* Üniteler */
.units { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.unit {
  position: relative; display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; align-items: center;
  padding: 16px 16px 18px 18px; text-decoration: none;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r); box-shadow: var(--sh);
}
.unit::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 5px; border-radius: 0 4px 4px 0; background: var(--c); }
.unit.is-empty { box-shadow: none; opacity: .55; }
.unit.is-empty::before { background: var(--line); }
.unit-name { font-weight: 800; font-size: 1.05rem; }
.unit-meta { grid-column: 1; display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: .86rem; color: var(--ink-2); font-weight: 600; }
.unit .pencil { grid-column: 1; }
.unit-go { grid-column: 2; grid-row: 1 / span 3; color: var(--ink-3); }

/* Test başlatma formu */
.starter { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 18px; box-shadow: var(--sh); }
.opt-group { border: 0; padding: 0; margin: 0 0 18px; }
.opt-group legend { font-weight: 800; margin-bottom: 8px; padding: 0; }
.pills { display: flex; flex-wrap: wrap; gap: 8px; }
.pills label { position: relative; }
.pills input, .modes input, .seg input { position: absolute; opacity: 0; pointer-events: none; }
.pills span {
  display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 16px;
  border: 2px solid var(--line); border-radius: 16px; font-weight: 700; cursor: pointer; background: #fff; line-height: 1.3; padding-top: 6px; padding-bottom: 6px;
}
.pills small { color: var(--ink-3); font-weight: 800; }
.pills input:checked + span { border-color: var(--c, var(--accent)); background: #eef2fb; background: color-mix(in srgb, var(--c, var(--accent)) 10%, #fff); }
.pills input:focus-visible + span, .modes input:focus-visible + span { outline: 3px solid var(--accent); outline-offset: 2px; }
.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modes span {
  display: grid; grid-template-columns: auto 1fr; gap: 0 10px; align-items: center;
  padding: 14px; border: 2px solid var(--line); border-radius: 14px; cursor: pointer; height: 100%; background: #fff;
}
.modes .ic { grid-row: 1 / span 2; width: 28px; height: 28px; color: var(--ink-3); }
.modes b { font-weight: 800; }
.modes small { font-size: .84rem; color: var(--ink-2); font-weight: 600; line-height: 1.35; }
.modes input:checked + span { border-color: var(--c, var(--accent)); background: #eef2fb; background: color-mix(in srgb, var(--c, var(--accent)) 8%, #fff); }
.modes input:checked + span .ic { color: var(--c, var(--accent)); }
@media (max-width: 460px) { .modes { grid-template-columns: 1fr; } }

.topic-bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.topic-bars li { display: grid; grid-template-columns: minmax(0, 1fr) 34% 44px; gap: 10px; align-items: center; font-weight: 700; font-size: .95rem; padding: 10px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.topic-bars b { text-align: right; font-size: .9rem; }
.bar { height: 10px; border-radius: 5px; background: #edf0f8; overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--c, var(--accent)); border-radius: 5px; }
.bar.good i { background: var(--ok); }
.bar.weak i { background: var(--bad); }

/* PDF listesi ve geçmiş */
.pdf-list { display: grid; gap: 10px; }
@media (min-width: 720px) { .pdf-list { grid-template-columns: 1fr 1fr; } }
.pdf-item { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: var(--r); text-decoration: none; box-shadow: var(--sh); }
.pdf-ic { width: 44px; height: 52px; display: grid; place-items: center; border-radius: 8px 14px 8px 8px; background: #eef2fb; background: color-mix(in srgb, var(--c) 12%, #fff); color: var(--c); flex: none; }
.pdf-txt { flex: 1; min-width: 0; display: grid; }
.pdf-txt b { font-weight: 800; line-height: 1.3; }
.pdf-txt small { color: var(--ink-2); font-weight: 600; font-size: .86rem; }
.pdf-best { font-family: var(--f-head); font-weight: 700; font-size: 1.1rem; }
.pdf-new { font-size: .8rem; font-weight: 800; padding: 4px 10px; border-radius: 999px; background: var(--marker); }

.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.history a { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; text-decoration: none; }
.history .ic { color: var(--ink-3); }
.h-txt { flex: 1; min-width: 0; display: grid; }
.h-txt b { font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-txt small { color: var(--ink-2); font-size: .85rem; font-weight: 600; }
.score { min-width: 62px; height: 44px; display: grid; place-items: center; border-radius: 12px; font-family: var(--f-head); font-weight: 700; font-size: 1.05rem; }
.sgood { background: var(--ok-bg); color: var(--ok); }
.smid { background: var(--marker-soft); color: #7a5d00; }
.sweak { background: var(--bad-bg); color: var(--bad); }
.pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 18px; font-weight: 800; }

.empty { text-align: center; padding: 48px 20px; background: var(--card); border: 2px dashed var(--line); border-radius: var(--r-lg); }
.empty h2 { font-size: 1.4rem; }
.empty p { color: var(--ink-2); margin: 6px auto 18px; max-width: 40ch; }

/* Yanlışlarım */
.review-groups { display: grid; gap: 10px; }
@media (min-width: 720px) { .review-groups { grid-template-columns: 1fr 1fr; } .rg-all { grid-column: 1 / -1; } }
.rg { margin: 0; }
.rg-all { background: var(--marker-soft); border-color: #f2d36b; }
.wrong-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.wrong-list li { background: var(--card); border: 1px solid var(--line); border-left: 5px solid var(--c); border-radius: 14px; }
.wrong-list summary { list-style: none; cursor: pointer; padding: 12px 14px; display: grid; gap: 2px; }
.wrong-list summary::-webkit-details-marker { display: none; }
.wl-sub { font-size: .8rem; font-weight: 800; color: var(--c); }
.wl-body { font-weight: 600; }
.wl-tag { justify-self: start; font-size: .75rem; font-weight: 800; background: var(--ok-bg); color: var(--ok); padding: 2px 8px; border-radius: 999px; }
.wl-full { padding: 0 14px 14px; }

/* ==========================================================================
   Test çözme ekranı
   ========================================================================== */
.quiz-page, .pdf-page { background-attachment: scroll; }
.quiz-page .wrap, .pdf-page .wrap { max-width: none; padding: 0; }
.quiz { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }
.quiz-top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 12px;
  padding: calc(env(safe-area-inset-top, 0px) + 10px) 14px 12px;
  background: rgba(246, 248, 252, .94); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.quiz-close { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; color: var(--ink-2); flex: none; }
.quiz-close:hover { background: #eef1fa; }
.quiz-progress { flex: 1; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; --c: var(--accent); }
.quiz-meta { display: flex; justify-content: space-between; gap: 10px; font-size: .88rem; font-weight: 800; min-width: 0; }
.quiz-title { color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.quiz-count { flex: none; }
.quiz-timer, .quiz-score {
  display: inline-flex; align-items: center; gap: 6px; height: 40px; padding: 0 12px; flex: none;
  border: 1px solid var(--line); border-radius: 12px; background: var(--card); font-weight: 800; font-variant-numeric: tabular-nums; cursor: default;
}
button.quiz-timer { cursor: pointer; }
.quiz-score .ic { color: var(--ok); }

.quiz-stage { flex: 1; width: 100%; max-width: 760px; margin: 0 auto; padding: 18px 14px calc(110px + var(--safe-b)); }
.qcard { background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 18px; box-shadow: var(--sh); }
.qcard.enter { animation: cardIn .28s ease both; }
.qcard.shake { animation: shake .38s ease; }
@keyframes cardIn { from { opacity: 0; transform: translateX(18px); } to { opacity: 1; transform: none; } }
@keyframes shake { 20%, 60% { transform: translateX(-6px); } 40%, 80% { transform: translateX(6px); } }
.q-topic { display: inline-block; font-size: .8rem; font-weight: 800; color: var(--accent); background: #eef2fb; background: color-mix(in srgb, var(--accent) 10%, #fff); padding: 3px 10px; border-radius: 999px; margin-bottom: 12px; }
.q-body { font-size: 1.12rem; font-weight: 600; line-height: 1.6; }
@media (min-width: 640px) { .q-body { font-size: 1.22rem; } .qcard { padding: 26px 26px; } }
.q-body u { text-decoration-thickness: 2px; text-underline-offset: 3px; }
.qtext { margin: 10px 0; padding: 14px 16px; border-left: 4px solid var(--marker); background: #fffbea; border-radius: 0 12px 12px 0; font-weight: 600; }
.q-img { display: block; margin: 14px auto 0; border-radius: 12px; max-height: 360px; object-fit: contain; }

.opts { display: grid; gap: 10px; margin-top: 20px; }
@media (min-width: 900px) { .opts.two { grid-template-columns: 1fr 1fr; } }
.opt {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 58px; padding: 10px 14px;
  text-align: left; cursor: pointer; background: #fff;
  border: 2px solid var(--line); border-radius: 16px; font-weight: 700; font-size: 1.05rem; line-height: 1.4;
  transition: border-color .12s, background-color .12s, transform .08s;
}
.opt:hover:not(:disabled) { border-color: var(--ink-3); }
.opt:active:not(:disabled) { transform: scale(.99); }
.opt-l {
  width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 11px;
  background: #eef1fa; font-family: var(--f-head); font-weight: 800; font-size: 1.05rem;
}
.opt-t { flex: 1; min-width: 0; }
.opt.is-sel { border-color: var(--accent); background: #eef2fb; background: color-mix(in srgb, var(--accent) 7%, #fff); }
.opt.is-sel .opt-l { background: var(--accent); color: #fff; }
.opt:disabled { cursor: default; color: var(--ink); }
.opt.is-right { border-color: var(--ok); background: var(--ok-bg); }
.opt.is-right .opt-l { background: var(--ok); color: #fff; }
.opt.is-right .opt-t > span { background: linear-gradient(transparent 58%, rgba(255, 212, 59, .75) 58%); -webkit-box-decoration-break: clone; box-decoration-break: clone; padding: 0 .1em; }
.opt.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.opt.is-wrong .opt-l { background: var(--bad); color: #fff; }
.opt:disabled:not(.is-right):not(.is-wrong) { opacity: .6; }

.feedback { margin-top: 16px; padding: 14px 16px; border-radius: 14px; border: 2px solid; animation: cardIn .25s ease both; }
.feedback.is-right { background: var(--ok-bg); border-color: var(--ok-line); }
.feedback.is-wrong { background: var(--bad-bg); border-color: var(--bad-line); }
.fb-head { font-family: var(--f-head); font-weight: 800; font-size: 1.25rem; }
.is-right .fb-head { color: var(--ok); }
.is-wrong .fb-head { color: var(--bad); }
.feedback .fb-exp { margin-top: 6px; font-weight: 600; color: var(--ink); }
.fb-exp { display: flex; gap: 10px; align-items: flex-start; }
.rv .fb-exp, .wl-full .fb-exp { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: #fffbea; border: 1px solid #f2e09a; font-weight: 600; }
.fb-exp .ic { color: #c99700; margin-top: 2px; }

.quiz-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px;
  padding: 12px 14px calc(12px + var(--safe-b));
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border-top: 1px solid var(--line); box-shadow: var(--sh-up);
}
.quiz-bar .btn { min-height: 56px; font-size: 1.05rem; }
.quiz-bar [data-check][data-state="next"] { background: var(--ink); box-shadow: 0 3px 0 #0d1433; }
@media (min-width: 900px) {
  .quiz-bar { left: 50%; right: auto; width: 760px; transform: translateX(-50%); bottom: 16px; border: 1px solid var(--line); border-radius: 20px; padding: 10px; }
}
.quiz-bar [data-skip][hidden] + .btn { grid-column: 1 / -1; }

/* Alt çekmece / iletişim kutusu */
.sheet { position: fixed; inset: 0; z-index: 50; background: rgba(20, 28, 64, .45); display: flex; align-items: flex-end; justify-content: center; animation: fadeIn .18s ease; }
.sheet-panel {
  width: 100%; max-width: 560px; max-height: 86vh; overflow: auto;
  background: var(--card); border-radius: 22px 22px 0 0; padding: 20px 18px calc(20px + var(--safe-b));
  animation: sheetUp .22s ease;
}
.sheet-panel h2 { font-size: 1.35rem; margin-bottom: 6px; }
.sheet-panel p { color: var(--ink-2); font-weight: 600; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.sheet-head b { font-family: var(--f-head); font-size: 1.25rem; }
.sheet-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 18px; }
@media (min-width: 640px) { .sheet { align-items: center; } .sheet-panel { border-radius: 22px; } }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes sheetUp { from { transform: translateY(30px); opacity: 0; } }
.qgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; margin-bottom: 16px; }
.qgrid button { height: 48px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 800; cursor: pointer; }
.qgrid button.done { background: var(--accent); border-color: var(--accent); color: #fff; }
.qgrid button.cur { outline: 3px solid var(--marker); outline-offset: 1px; }

body.is-loading { cursor: progress; }
body.is-loading .quiz-bar, body.is-loading .pdfx-omr { opacity: .6; pointer-events: none; }

/* Efektler */
.spark { position: fixed; z-index: 80; width: 10px; height: 10px; margin: -5px; border-radius: 2px; background: var(--marker); pointer-events: none; animation: spark .65s ease-out forwards; }
.spark:nth-child(odd) { background: var(--ok); border-radius: 50%; }
@keyframes spark { to { transform: translate(var(--dx), var(--dy)) rotate(120deg); opacity: 0; } }
.confetti { position: fixed; inset: 0; pointer-events: none; z-index: 80; overflow: hidden; }
.confetti i { position: absolute; top: -20px; width: 9px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translate(var(--x), 105vh) rotate(var(--r)); } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}

/* ==========================================================================
   Sonuç ekranı
   ========================================================================== */
.result { text-align: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 24px 18px; box-shadow: var(--sh); }
.result-ring { position: relative; width: 150px; height: 150px; margin: 12px auto 6px; }
.result-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.result-ring .ring-bg { stroke-width: 10; }
.result-ring .ring-fg { stroke-width: 10; stroke: var(--c); animation: ringIn 1s ease both; }
@keyframes ringIn { from { stroke-dasharray: 0 100; } }
.result-ring div { position: absolute; inset: 0; display: grid; place-content: center; line-height: 1; }
.result-ring b { font-family: var(--f-head); font-size: 3rem; }
.result-ring small { font-weight: 800; color: var(--ink-3); font-size: 1rem; }
.result h1 { font-size: 2rem; }
.result h1::after { content: ""; display: block; width: 96px; height: 10px; margin: 2px auto 0; background: var(--marker); border-radius: 6px; transform: skewX(-12deg); }
.result .lead { color: var(--ink-2); font-weight: 600; margin-top: 8px; }
.result-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 20px 0; }
.result-stats div { padding: 10px 4px; border-radius: 12px; background: #f3f5fb; }
.result-stats dt { font-size: .8rem; font-weight: 800; color: var(--ink-2); }
.result-stats dd { margin: 0; font-family: var(--f-head); font-weight: 700; font-size: 1.35rem; }
.st-ok { background: var(--ok-bg) !important; } .st-ok dd { color: var(--ok); }
.st-bad { background: var(--bad-bg) !important; } .st-bad dd { color: var(--bad); }
.result-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }
.result-actions form { display: contents; }
@media (max-width: 520px) { .result-actions .btn { width: 100%; } .result-stats dd { font-size: 1.15rem; } }

.review-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin: 26px 0 12px; }
.review-head .section-title { margin: 0; }
.seg { display: inline-flex; padding: 4px; gap: 4px; background: #e9edf7; border-radius: 14px; }
.seg button, .seg label span { border: 0; background: transparent; min-height: 40px; padding: 0 14px; border-radius: 10px; font-weight: 800; cursor: pointer; display: inline-flex; align-items: center; }
.seg button.on, .seg input:checked + span { background: #fff; box-shadow: var(--sh); }
.seg.small button { min-height: 36px; font-size: .9rem; }
.review-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.rv { background: var(--card); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; }
.rv-bad { border-left: 5px solid var(--bad); }
.rv-blank { border-left: 5px solid var(--blank); }
.rv-ok { border-left: 5px solid var(--ok); }
.rv-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; font-size: .88rem; font-weight: 800; flex-wrap: wrap; }
.rv-n { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 9px; background: #eef1fa; }
.rv-st { display: inline-flex; align-items: center; gap: 4px; }
.rv-ok .rv-st { color: var(--ok); } .rv-bad .rv-st { color: var(--bad); } .rv-blank .rv-st { color: var(--blank); }
.rv-topic { color: var(--ink-3); }
.rv .q-body { font-size: 1.02rem; }
.rv-opts { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.rv-opts li { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; border: 1px solid var(--line); font-weight: 600; }
.rv-opts li .opt-l { width: 30px; height: 30px; font-size: .95rem; border-radius: 9px; }
.rv-opts li.is-right { border-color: var(--ok-line); background: var(--ok-bg); }
.rv-opts li.is-right .opt-l { background: var(--ok); color: #fff; }
.rv-opts li.is-wrong { border-color: var(--bad-line); background: var(--bad-bg); }
.rv-opts li.is-wrong .opt-l { background: var(--bad); color: #fff; }
.rv-opts em { margin-left: auto; font-style: normal; font-size: .75rem; font-weight: 800; color: var(--ink-2); white-space: nowrap; }

.omr-result { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; }
.omr-cell { display: grid; justify-items: center; padding: 8px 4px; border-radius: 12px; background: var(--card); border: 2px solid var(--line); font-weight: 800; }
.omr-cell .n { font-size: .75rem; color: var(--ink-3); }
.omr-cell .you { font-family: var(--f-head); font-size: 1.3rem; line-height: 1.1; }
.omr-cell .key { font-size: .78rem; color: var(--ok); }
.omr-cell.ok { border-color: var(--ok-line); background: var(--ok-bg); }
.omr-cell.bad { border-color: var(--bad-line); background: var(--bad-bg); }
.omr-cell.bad .you { color: var(--bad); }
.hint { color: var(--ink-2); font-size: .9rem; font-weight: 600; margin-top: 12px; }

/* ==========================================================================
   PDF test ekranı
   ========================================================================== */
.pdfx { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.pdfx-body { flex: 1; display: block; }
.pdfx-doc { position: relative; padding: 12px 10px calc(96px + var(--safe-b)); }
.pdfx-tools { position: sticky; top: 76px; z-index: 5; display: flex; align-items: center; justify-content: center; gap: 4px; width: max-content; margin: 0 auto 10px; padding: 2px 6px; background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--sh); font-weight: 800; font-size: .9rem; }
.pdfx-pages { overflow-x: auto; display: grid; justify-items: center; gap: 12px; }
.pdfx-page { background: #fff; box-shadow: var(--sh); border-radius: 6px; overflow: hidden; }
.pdfx-page canvas { display: block; }
.pdfx-loading { padding: 60px 20px; text-align: center; font-weight: 700; color: var(--ink-2); }

.pdfx-omr {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
  max-height: 78vh; overflow: auto;
  background: var(--card); border-radius: 22px 22px 0 0; box-shadow: var(--sh-up);
  padding: 16px 16px calc(16px + var(--safe-b));
  transform: translateY(105%); transition: transform .25s ease;
}
.pdfx-omr.open { transform: none; }
body.omr-open::after { content: ""; position: fixed; inset: 0; background: rgba(20, 28, 64, .35); z-index: 35; }
.omr-fab {
  position: fixed; left: 50%; bottom: calc(14px + var(--safe-b)); transform: translateX(-50%); z-index: 30;
  display: inline-flex; align-items: center; gap: 10px; min-height: 56px; padding: 0 20px;
  border: 0; border-radius: 18px; background: var(--ink); color: #fff; font-weight: 800; font-size: 1.02rem; cursor: pointer; white-space: nowrap; box-shadow: 0 6px 18px -6px rgba(14, 22, 60, .6);
}
.omr-fab b { background: var(--marker); color: var(--ink); padding: 2px 10px; border-radius: 999px; font-size: .9rem; }
.omr { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 6px; }
.omr li { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-radius: 12px; }
.omr li:nth-child(odd) { background: #f5f7fc; }
.omr-n { width: 32px; text-align: right; font-weight: 800; color: var(--ink-2); flex: none; padding-right: 4px; }
.omr button {
  width: 44px; height: 44px; border-radius: 50%; border: 2px solid #b9c2dc; background: #fff;
  font-weight: 800; font-size: .95rem; cursor: pointer; color: var(--ink-2); flex: none;
}
.omr button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
@media (min-width: 900px) {
  .pdfx-body { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; padding: 0 16px; }
  .pdfx-doc { padding: 14px 0 30px; }
  .pdfx-omr { position: sticky; top: 76px; align-self: start; max-height: calc(100vh - 92px); transform: none; border-radius: 20px; border: 1px solid var(--line); box-shadow: var(--sh); margin-top: 14px; z-index: 5; }
  .omr-fab, .omr-close { display: none !important; }
  body.omr-open::after { display: none; }
}

/* ==========================================================================
   Giriş ve kurulum
   ========================================================================== */
.auth-page .wrap { display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--card); border: 1px solid var(--line); border-radius: 26px; padding: 28px 22px; box-shadow: var(--sh); }
.install-card { max-width: 600px; }
.auth-head { text-align: center; margin-bottom: 20px; }
.auth-head .brand-mark { width: 56px; height: 56px; }
.auth-head h1 { font-size: 1.8rem; margin-top: 8px; }
.auth-head p { color: var(--ink-2); font-weight: 600; }
.auth-switch { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 20px; font-weight: 800; color: var(--ink-2); text-decoration: none; }
.pin-dots { display: flex; justify-content: center; gap: 16px; margin: 6px 0 22px; }
.pin-dots i { width: 18px; height: 18px; border-radius: 50%; border: 2.5px solid var(--ink-3); transition: .12s; }
.pin-dots i.on { background: var(--ink); border-color: var(--ink); transform: scale(1.1); }
.pin-dots.shake { animation: shake .4s ease; }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; max-width: 300px; margin: 0 auto; }
.pin-pad button {
  height: 68px; border-radius: 20px; border: 2px solid var(--line); background: #fff;
  font-family: var(--f-head); font-size: 1.8rem; font-weight: 700; cursor: pointer; box-shadow: 0 3px 0 var(--line);
  display: grid; place-items: center;
}
.pin-pad button:active { transform: translateY(2px); box-shadow: none; background: var(--marker-soft); }
.pin-form.sending .pin-pad { opacity: .5; pointer-events: none; }

.form { display: grid; gap: 14px; }
.form label { display: grid; gap: 6px; font-weight: 800; font-size: .92rem; }
.form input:not([type=checkbox]):not([type=radio]), .form select, .form textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border: 2px solid var(--line); border-radius: 12px; background: #fff; font-weight: 600; font-size: 1rem;
}
.form textarea { min-height: 96px; resize: vertical; line-height: 1.5; }
.form input:focus, .form select:focus, .form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 3px 0 rgba(0,0,0,.25); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.form fieldset { border: 1px solid var(--line); border-radius: 16px; padding: 14px; margin: 0; display: grid; gap: 12px; }
.form legend { font-family: var(--f-head); font-weight: 700; font-size: 1.1rem; padding: 0 6px; }
.form .check, label.check { display: flex; align-items: center; gap: 10px; font-weight: 700; cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); flex: none; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .row2 { grid-template-columns: 1fr; } }
.checks { list-style: none; margin: 0 0 18px; padding: 0; display: grid; gap: 4px; font-size: .92rem; }
.checks li { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.checks small { color: var(--ink-3); font-weight: 600; }
.checks .ok .ic { color: var(--ok); } .checks .bad { color: var(--bad); }
textarea.code { width: 100%; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .82rem; padding: 12px; border: 2px solid var(--line); border-radius: 12px; margin-bottom: 14px; }
.chip-lock { width: 38px; height: 38px; padding: 0; justify-content: center; color: var(--ink-3); }
.chip-lock .ic { width: 18px; height: 18px; }