/* VERGİ ROTASI – web (PWA) arayüzü. Renkler Android'deki values/colors.xml ve values-night/colors.xml ile aynı. */
:root {
  --brand-start: #1b3a8a;
  --brand-end: #0fa3b1;
  --primary: #1b3a8a;
  --on-primary: #fff;
  --accent: #ff8a00;
  --bg: #f4f6fb;
  --surface: #fff;
  --outline: #dce2ee;
  --text: #14213d;
  --text2: #5c6784;
  --disabled: #c5ccda;
  --chip: #e6eeff;
  --selected: #e6eeff;
  --letter: #eef2f8;
  --correct: #12a150;
  --correct-bg: #e3f7ec;
  --wrong: #e5484d;
  --wrong-bg: #fde8e9;
  --on-status: #fff;
  --star: #ffb020;
  --track: #e4e9f2;
  --shadow: 0 2px 10px rgba(20, 33, 61, 0.07);
  --ts: 1;
  --radius: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --brand-start: #22408f;
    --brand-end: #0c8e9a;
    --primary: #8eb0ff;
    --accent: #ffa53d;
    --bg: #0e1220;
    --surface: #171c2c;
    --outline: #2a3247;
    --text: #e9ecf5;
    --text2: #9aa3ba;
    --disabled: #343c52;
    --chip: #1e2a48;
    --selected: #1e2a48;
    --letter: #232a3d;
    --correct: #3dd68c;
    --correct-bg: #123222;
    --wrong: #ff6b70;
    --wrong-bg: #3a1a1e;
    --on-status: #0e1220;
    --star: #ffc24d;
    --track: #232a3d;
    --shadow: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
  /* Kitap içeriği seçilip kopyalanamasın. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior-y: none;
}
input, textarea { -webkit-user-select: text; user-select: text; font: inherit; color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { cursor: default; }

#app { min-height: 100%; }
.screen {
  max-width: 680px;
  margin: 0 auto;
  min-height: 100vh;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 12px) calc(env(safe-area-inset-right) + 16px)
    calc(env(safe-area-inset-bottom) + 20px) calc(env(safe-area-inset-left) + 16px);
  display: flex;
  flex-direction: column;
}

/* ---------------------------------------------------------------- ortak */
.topbar { display: flex; align-items: center; gap: 10px; min-height: 48px; margin-bottom: 8px; }
.topbar h1 { flex: 1; font-size: 19px; margin: 0; font-weight: 700; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  font-size: 20px; color: var(--text2); background: var(--surface); box-shadow: var(--shadow);
}
.card { background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--outline); }
.muted { color: var(--text2); }
.small { font-size: 13px; }
.center { text-align: center; }
.grow { flex: 1; }
.hidden { display: none !important; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: 14px; font-weight: 700; font-size: 16px;
  background: var(--primary); color: var(--on-primary);
}
@media (prefers-color-scheme: dark) { .btn { background: #3b5bdb; } }
.btn.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--outline); }
.btn.green { background: #25a35a; color: #fff; }
.btn:disabled { opacity: 0.45; }
.btn:active:not(:disabled), .tile:active, .mode:active, .option:active { transform: scale(0.98); }
.link { color: var(--primary); font-weight: 600; }

.field { display: block; margin: 10px 0; }
.field span { display: block; font-size: 13px; color: var(--text2); margin-bottom: 4px; }
.field input, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--outline);
  background: var(--bg); font-size: 16px; outline: none;
}
.field input:focus, .field textarea:focus { border-color: var(--brand-end); }
.error { color: var(--wrong); font-size: 14px; margin: 8px 0; }

.spinner {
  width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--track); border-top-color: var(--brand-end);
  animation: spin 0.8s linear infinite; margin: 0 auto 14px;
}
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { 0% { transform: scale(0.94); } 60% { transform: scale(1.03); } 100% { transform: scale(1); } }
@keyframes shake {
  0%, 100% { transform: translateX(0); } 20% { transform: translateX(-10px); } 40% { transform: translateX(10px); }
  60% { transform: translateX(-7px); } 80% { transform: translateX(7px); }
}
.pop { animation: pop 0.35s ease-out; }
.shake { animation: shake 0.38s ease-out; }

.loading { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 30px; }

/* ---------------------------------------------------------------- logo / hero */
.logo { width: 56px; height: 56px; border-radius: 16px; flex: none; box-shadow: 0 4px 14px rgba(15, 30, 80, 0.25); }
.logo.big { width: 84px; height: 84px; border-radius: 22px; }
.hero {
  background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
  color: #fff; border-radius: 22px; padding: 18px; display: flex; gap: 14px; align-items: center;
  box-shadow: 0 8px 24px rgba(27, 58, 138, 0.25);
}
.hero h2 { margin: 0; font-size: 20px; }
.hero .tag { opacity: 0.85; font-size: 13px; margin-top: 2px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.chip { background: rgba(255, 255, 255, 0.2); border-radius: 999px; padding: 3px 10px; font-size: 12.5px; font-weight: 600; }

.searchbar {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 0 14px; min-height: 50px;
  color: var(--text2); width: 100%; text-align: left;
}
.section-card { display: flex; align-items: center; gap: 12px; margin-top: 12px; padding: 12px 14px; width: 100%; text-align: left; }
.section-card .grow div:first-child { font-size: 12.5px; color: var(--text2); }
.section-card .grow div:last-child { font-weight: 700; }

.mode {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; margin-top: 12px;
  padding: 16px; border-radius: 18px; color: #fff;
}
.mode .num {
  width: 52px; height: 52px; border-radius: 14px; background: rgba(255, 255, 255, 0.22);
  display: grid; place-items: center; font-weight: 800; font-size: 18px; flex: none;
}
.mode b { display: block; font-size: 17px; }
.mode span { font-size: 13px; opacity: 0.9; }
.mode.single { background: linear-gradient(135deg, #5b5fef, #9b5cf6); }
.mode.test { background: linear-gradient(135deg, #0fa3b1, #22c55e); }
.mode.exam { background: linear-gradient(135deg, #c2255c, #f06595); }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 12px; }
.tile { padding: 14px; text-align: left; display: flex; flex-direction: column; gap: 8px; }
.tile .ic { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: #fff; font-weight: 800; font-size: 18px; }
.tile b { font-size: 15px; }
.tile span { font-size: 12.5px; color: var(--text2); }
.ic.custom { background: linear-gradient(135deg, #ff7a00, #ffb020); }
.ic.wrongs { background: linear-gradient(135deg, #e5484d, #ff7a59); }
.ic.marks { background: linear-gradient(135deg, #e89b00, #f7c948); }
.ic.stats { background: linear-gradient(135deg, #8b5cf6, #d946ef); }
.foot { text-align: center; margin-top: 18px; }

/* ---------------------------------------------------------------- soru ekranı */
.quiz-top { display: flex; align-items: center; gap: 10px; min-height: 48px; }
.quiz-top .title { flex: 1; font-weight: 700; font-size: 16px; text-align: left; }
.quiz-top .score { font-weight: 700; color: var(--text2); font-variant-numeric: tabular-nums; }
.quiz-top .score.low { color: var(--wrong); }
.star { font-size: 24px; color: var(--text2); width: 42px; height: 42px; }
.star.on { color: var(--star); }
.progress { height: 6px; border-radius: 3px; background: var(--track); overflow: hidden; margin: 6px 0 12px; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--brand-start), var(--brand-end)); transition: width 0.25s; }
.qmeta { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; font-size: 12.5px; }
.badge { background: var(--chip); color: var(--primary); border-radius: 999px; padding: 3px 10px; font-weight: 600; }
.qtext { font-size: calc(17px * var(--ts)); line-height: 1.5; margin: 12px 0 14px; white-space: pre-wrap; }
.option {
  display: flex; gap: 12px; align-items: flex-start; width: 100%; text-align: left; padding: 12px;
  margin-bottom: 10px; border-radius: 14px; background: var(--surface); border: 1.5px solid var(--outline);
  transition: opacity 0.2s;
}
.option .letter {
  width: 32px; height: 32px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: var(--letter); color: var(--text2); font-weight: 700;
}
.option .otext { font-size: calc(15.5px * var(--ts)); padding-top: 4px; white-space: pre-wrap; }
.option.selected { border-color: var(--primary); background: var(--selected); }
.option.selected .letter { background: var(--primary); color: var(--on-primary); }
@media (prefers-color-scheme: dark) { .option.selected .letter { background: #3b5bdb; color: #fff; } }
.option.correct { border-color: var(--correct); background: var(--correct-bg); }
.option.correct .letter { background: var(--correct); color: var(--on-status); }
.option.wrong { border-color: var(--wrong); background: var(--wrong-bg); }
.option.wrong .letter { background: var(--wrong); color: var(--on-status); }
.option.dim { opacity: 0.55; }
.feedback { border-radius: 14px; padding: 14px; margin: 4px 0 12px; }
.feedback.ok { background: var(--correct-bg); }
.feedback.bad { background: var(--wrong-bg); }
.feedback b { font-size: calc(17px * var(--ts)); }
.feedback.ok b { color: var(--correct); }
.feedback.bad b { color: var(--wrong); }
.feedback p { margin: 8px 0 0; font-size: calc(15px * var(--ts)); white-space: pre-wrap; }
.actions {
  position: sticky; bottom: 0; display: flex; gap: 10px; padding: 12px 0 calc(env(safe-area-inset-bottom) + 4px);
  background: linear-gradient(to top, var(--bg) 75%, transparent); margin-top: auto;
}
.actions .btn { flex: 1; }
.actions .btn.prev { flex: 0 0 auto; min-width: 104px; }

/* ---------------------------------------------------------------- sonuç */
.result-hero { padding: 20px; text-align: center; }
.ring { width: 150px; height: 150px; margin: 0 auto 6px; position: relative; }
.ring svg { transform: rotate(-90deg); }
.ring .pct { position: absolute; inset: 0; display: grid; place-items: center; font-size: 34px; font-weight: 800; }
.ring .pct small { display: block; font-size: 12px; font-weight: 600; color: var(--text2); margin-top: -8px; }
.counts { display: flex; gap: 10px; margin-top: 14px; }
.counts > div { flex: 1; border-radius: 14px; padding: 10px; }
.counts b { display: block; font-size: 22px; }
.counts .c { background: var(--correct-bg); color: var(--correct); }
.counts .w { background: var(--wrong-bg); color: var(--wrong); }
.counts .e { background: var(--letter); color: var(--text2); }
.review-head { display: flex; align-items: center; justify-content: space-between; margin: 20px 0 8px; gap: 10px; }
.review-head h3 { margin: 0; font-size: 16px; }
.review { padding: 14px; margin-bottom: 10px; }
.review .meta { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--text2); }
.review .status { font-weight: 800; font-size: 12px; }
.review .q { font-size: calc(15px * var(--ts)); margin: 8px 0; white-space: pre-wrap; }
.review .ans { font-size: calc(14.5px * var(--ts)); margin: 4px 0; white-space: pre-wrap; }
.review .ans.bad { color: var(--wrong); }
.review .ans.ok { color: var(--correct); font-weight: 600; }
.review .expl { font-size: calc(14px * var(--ts)); color: var(--text2); margin-top: 8px; white-space: pre-wrap; }
.review .rstar { font-size: 22px; color: var(--text2); }
.review .rstar.on { color: var(--star); }

/* ---------------------------------------------------------------- istatistik / listeler */
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { padding: 14px; }
.stat b { display: block; font-size: 22px; }
.stat span { font-size: 12.5px; color: var(--text2); }
h3.sec { font-size: 15px; margin: 22px 0 8px; }
.row { padding: 12px 14px; display: flex; gap: 10px; align-items: center; border-bottom: 1px solid var(--outline); }
.row:last-child { border-bottom: 0; }
.row .grow > div:first-child { font-weight: 600; }
.bar { height: 6px; border-radius: 3px; background: var(--track); margin-top: 6px; overflow: hidden; }
.bar > div { height: 100%; background: var(--brand-end); }
.list { overflow: hidden; }
.list button.row { width: 100%; text-align: left; }

/* ---------------------------------------------------------------- arama */
.search-input { position: sticky; top: 0; background: var(--bg); padding-bottom: 8px; z-index: 2; }
.result-item { padding: 12px 14px; width: 100%; text-align: left; border-bottom: 1px solid var(--outline); }
.result-item .meta { font-size: 12.5px; color: var(--text2); }
.result-item .t { font-size: calc(14.5px * var(--ts)); display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------------------------------------------------------------- etkinleştirme / kurulum */
.act-head { text-align: center; padding: 18px 0 8px; }
.act-head h1 { margin: 10px 0 2px; font-size: 22px; }
.step { padding: 16px; margin-top: 12px; }
.step-title { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.step-title i {
  font-style: normal; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand-start), var(--brand-end)); color: #fff; font-size: 14px;
}
.device-code {
  display: block; width: 100%; margin: 10px 0; padding: 12px; border-radius: 12px; border: 1.5px dashed var(--brand-end);
  background: var(--bg); text-align: center;
}
.device-code b { display: block; font-size: 26px; letter-spacing: 3px; font-family: ui-monospace, Menlo, monospace; }
.code-big { font-size: 30px; letter-spacing: 3px; font-weight: 800; font-family: ui-monospace, Menlo, monospace; text-align: center; margin: 8px 0; }
.install-step { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--outline); }
.install-step:last-child { border-bottom: 0; }
.install-step .n {
  width: 30px; height: 30px; border-radius: 50%; flex: none; display: grid; place-items: center; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--brand-start), var(--brand-end));
}
.share-ic { display: inline-block; vertical-align: -4px; }

/* ---------------------------------------------------------------- iletişim kutuları */
.overlay {
  position: fixed; inset: 0; background: rgba(8, 12, 24, 0.5); display: flex; align-items: flex-end; justify-content: center;
  z-index: 50; animation: fade 0.15s ease-out;
}
@media (min-width: 600px) { .overlay { align-items: center; } }
@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(30px); opacity: 0.6; } }
.dialog {
  background: var(--surface); width: 100%; max-width: 520px; max-height: 88vh; display: flex; flex-direction: column;
  border-radius: 22px 22px 0 0; padding: 18px 18px calc(env(safe-area-inset-bottom) + 14px); animation: up 0.2s ease-out;
}
@media (min-width: 600px) { .dialog { border-radius: 22px; padding-bottom: 14px; } }
.dialog h2 { margin: 0 0 10px; font-size: 18px; }
.dialog .body { overflow-y: auto; -webkit-overflow-scrolling: touch; flex: 1; }
.dialog .body p { margin: 0 0 10px; white-space: pre-wrap; }
.dialog .buttons { display: flex; gap: 10px; margin-top: 14px; }
.dialog .buttons .btn { flex: 1; min-height: 48px; font-size: 15px; }
.choice {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; padding: 12px; border-radius: 12px;
  border: 1.5px solid var(--outline); margin-bottom: 8px; background: var(--surface);
}
.choice::before {
  content: ""; width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--disabled); flex: none;
}
.choice.on { border-color: var(--primary); background: var(--selected); }
.choice.on::before { border-color: var(--primary); background: radial-gradient(circle, var(--primary) 45%, transparent 50%); }
.choice:disabled { opacity: 0.45; }
.choice .sub { display: block; font-size: 12.5px; color: var(--text2); white-space: pre-wrap; }
.menu-item { display: block; width: 100%; text-align: left; padding: 14px 6px; border-bottom: 1px solid var(--outline); font-size: 16px; }
.menu-item:last-child { border-bottom: 0; }
.group-label { font-size: 13px; font-weight: 700; color: var(--text2); margin: 12px 0 6px; }
.nav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.nav-grid button {
  min-height: 48px; border-radius: 12px; border: 1.5px solid var(--outline); font-weight: 700; font-size: 14px; line-height: 1.1;
}
.nav-grid button small { display: block; font-size: 11px; font-weight: 600; color: var(--text2); }
.nav-grid button.answered { background: var(--selected); border-color: var(--primary); }
.nav-grid button.current { outline: 2.5px solid var(--accent); }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom) + 90px); transform: translateX(-50%);
  background: rgba(20, 26, 44, 0.92); color: #fff; padding: 10px 16px; border-radius: 12px; z-index: 60;
  font-size: 14px; max-width: 86vw; text-align: center; animation: fade 0.15s;
}
.banner {
  display: flex; gap: 10px; align-items: center; padding: 10px 14px; margin-top: 12px; border-radius: 14px;
  background: var(--chip); color: var(--text); font-size: 14px;
}
.banner .btn { min-height: 38px; padding: 0 12px; font-size: 14px; }
