/* ---------- Temalar ---------- */
:root,
[data-theme="gece"] {
  --bg: #0F1712; --surface: #18241C; --surface-2: #141F18; --chip: #22322A; --border: #2A3A2F; --border-strong: #3A4D40;
  --text: #F2F5EF; --muted: #A9B8AD; --accent: #C8F25A; --on-accent: #0F1712;
  --good: #2FBF71; --bad: #E5484D; --warn: #FFC83D; --hard: #FF8A4C; --tr: #C8102E; --on-tr: #FFFFFF;
  --good-text: #7FE0A8; --bad-text: #FF9EA1;
  color-scheme: dark;
}
[data-theme="stadyum"] {
  --bg: #0E1424; --surface: #18213A; --surface-2: #131B30; --chip: #222C48; --border: #2A3654; --border-strong: #3B4A6E;
  --text: #EEF2FA; --muted: #A3AEC6; --accent: #5AD2F2; --on-accent: #0E1424;
  --good: #2FBF71; --bad: #E5484D; --warn: #FFC83D; --hard: #FF8A4C; --tr: #C8102E; --on-tr: #FFFFFF;
  --good-text: #7FE0A8; --bad-text: #FF9EA1;
  color-scheme: dark;
}
[data-theme="ayyildiz"] {
  --bg: #1A0F11; --surface: #2A171B; --surface-2: #221316; --chip: #3A2026; --border: #45262C; --border-strong: #5C343C;
  --text: #FBEFEF; --muted: #C9A9AD; --accent: #FF6B6B; --on-accent: #1A0F11;
  --good: #2FBF71; --bad: #FF5A5F; --warn: #FFC83D; --hard: #FFA05C; --tr: #FF6B6B; --on-tr: #1A0F11;
  --good-text: #7FE0A8; --bad-text: #FFB0B2;
  color-scheme: dark;
}
[data-theme="kupa"] {
  --bg: #121212; --surface: #1E1E1E; --surface-2: #181818; --chip: #2A2A2A; --border: #333333; --border-strong: #474747;
  --text: #F5F2EA; --muted: #B3AD9E; --accent: #FFC83D; --on-accent: #121212;
  --good: #2FBF71; --bad: #E5484D; --warn: #FFC83D; --hard: #FF8A4C; --tr: #C8102E; --on-tr: #FFFFFF;
  --good-text: #7FE0A8; --bad-text: #FF9EA1;
  color-scheme: dark;
}
[data-theme="derbi"] {
  --bg: #140F1F; --surface: #211A33; --surface-2: #1A1429; --chip: #2C2342; --border: #382D52; --border-strong: #4C3F6E;
  --text: #F1EDFA; --muted: #B3A8CC; --accent: #B79CFF; --on-accent: #140F1F;
  --good: #2FBF71; --bad: #E5484D; --warn: #FFC83D; --hard: #FF8A4C; --tr: #C8102E; --on-tr: #FFFFFF;
  --good-text: #7FE0A8; --bad-text: #FF9EA1;
  color-scheme: dark;
}
[data-theme="gunisigi"] {
  --bg: #F6F7F2; --surface: #FFFFFF; --surface-2: #EEF0E9; --chip: #E6E9E1; --border: #D9DED5; --border-strong: #BFC7BA;
  --text: #13201A; --muted: #55625A; --accent: #1F7A45; --on-accent: #FFFFFF;
  --good: #1F8A4C; --bad: #C8312F; --warn: #9A6400; --hard: #B4501A; --tr: #C8102E; --on-tr: #FFFFFF;
  --good-text: #17663A; --bad-text: #A3211F;
  color-scheme: light;
}

/* ---------- Temel ---------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
.noscript { padding: 24px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.app {
  max-width: 480px;
  min-height: 100dvh;
  margin: 0 auto;
  padding: max(28px, env(safe-area-inset-top)) 20px max(24px, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 20px;
}
@media (min-width: 720px) {
  .app { padding-top: 48px; padding-bottom: 48px; }
}

.display { font-family: "Barlow Condensed", "Arial Narrow", sans-serif; font-weight: 700; line-height: 1.1; margin: 0; }
.h1 { font-size: clamp(34px, 9vw, 44px); }
.h2 { font-size: 30px; }
.label { color: var(--muted); font-size: 13px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.muted { color: var(--muted); }
.spacer { flex-grow: 1; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.row { display: flex; align-items: center; gap: 12px; }
.between { justify-content: space-between; }

/* ---------- Bileşenler ---------- */
.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 26px; letter-spacing: .5px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 12px; border: none;
  background: var(--surface); color: var(--text); flex-shrink: 0;
}
.icon-btn:focus-visible, .btn:focus-visible, .option:focus-visible, .card:focus-visible, .seg button:focus-visible, .pill:focus-visible, .swatch:focus-visible {
  outline: 3px solid var(--accent); outline-offset: 2px;
}

.seg { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; background: var(--surface); border-radius: 14px; padding: 5px; }
.seg button { min-height: 44px; border-radius: 10px; border: none; background: transparent; color: var(--muted); font-weight: 700; font-size: 15px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.pills { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pill { min-height: 44px; border-radius: 999px; border: 1px solid var(--border-strong); background: transparent; color: var(--muted); font-weight: 600; font-size: 14px; }
.pill[aria-pressed="true"] { border: 2px solid var(--text); color: var(--text); }

.card {
  display: flex; flex-direction: column; gap: 6px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px 20px; color: var(--text);
}
.card:hover { border-color: var(--border-strong); }
.card-title { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 28px; line-height: 1.1; }
.card-badge { border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 14px; background: var(--accent); color: var(--on-accent); }
.card-badge.tr { background: var(--tr); color: var(--on-tr); }
.card-desc { color: var(--muted); font-size: 14px; }

.btn {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 54px; border-radius: 14px; border: none; padding: 0 18px;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: 17px; text-decoration: none;
}
.btn[disabled] { opacity: .6; cursor: default; }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--border-strong); font-weight: 600; font-size: 16px; min-height: 52px; }
.link-btn { background: none; border: none; color: var(--accent); font-weight: 600; font-size: 15px; padding: 10px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.stat { background: var(--surface); border-radius: 14px; padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; }
.stat b { font-family: "Barlow Condensed", sans-serif; font-size: 26px; line-height: 1.1; }
.stat span { color: var(--muted); font-size: 12px; }

.chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 4px 12px; font-size: 13px; color: var(--muted); }
.chip.kolay { color: var(--good-text); }
.chip.orta { color: var(--warn); }
.chip.zor { color: var(--hard); }
.score-chip { display: inline-flex; align-items: center; gap: 6px; background: var(--surface); border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 15px; color: var(--accent); }

/* Oyun ekranı */
.progress { display: grid; gap: 4px; }
.progress i { display: block; height: 6px; border-radius: 3px; background: var(--border); }
.progress i.ok { background: var(--good); }
.progress i.no { background: var(--bad); }
.progress i.now { background: var(--text); }
.stages { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.stage { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--muted); }
.stage i { display: block; height: 6px; border-radius: 3px; background: var(--border); }
.stage.done i { background: var(--good); }
.stage.active i { background: var(--hard); }
.stage.active { color: var(--hard); font-weight: 700; }

.timer-track { height: 10px; border-radius: 5px; background: var(--border); overflow: hidden; }
.timer-bar { height: 100%; border-radius: 5px; background: var(--accent); transform-origin: left center; }
.timer-bar.low { background: var(--bad); }
.timer-num { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 32px; line-height: 1; font-variant-numeric: tabular-nums; }

.question { font-size: clamp(26px, 7vw, 32px); }
.options { display: flex; flex-direction: column; gap: 12px; }
.option {
  display: flex; align-items: center; gap: 14px; min-height: 58px; width: 100%; padding: 10px 16px; text-align: left;
  border-radius: 14px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 17px; font-weight: 600;
}
.option:not([disabled]):hover { border-color: var(--border-strong); }
.option .key { display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; flex-shrink: 0; border-radius: 8px; background: var(--chip); color: var(--muted); font-size: 14px; }
.option[disabled] { cursor: default; }
.option.dim { opacity: .55; }
.option.right { border: 2px solid var(--good); background: color-mix(in srgb, var(--good) 18%, var(--surface)); opacity: 1; }
.option.right .key { color: var(--good-text); }
.option.wrong { border: 2px solid var(--bad); background: color-mix(in srgb, var(--bad) 16%, var(--surface)); opacity: 1; }
.option.wrong .key { color: var(--bad-text); }
.option .mark { margin-left: auto; display: inline-flex; }

.banner { display: flex; align-items: center; gap: 14px; border-radius: 16px; padding: 14px 16px; border: 1px solid; }
.banner.good { background: color-mix(in srgb, var(--good) 16%, var(--bg)); border-color: var(--good); }
.banner.bad { background: color-mix(in srgb, var(--bad) 14%, var(--bg)); border-color: var(--bad); }
.banner .dot { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 20px; flex-shrink: 0; color: var(--bg); }
.banner.good .dot { background: var(--good); }
.banner.bad .dot { background: var(--bad); }
.banner-title { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 26px; line-height: 1; }
.banner-sub { font-size: 14px; color: var(--muted); }

.fact { display: flex; flex-direction: column; gap: 6px; background: var(--surface); border-radius: 16px; padding: 16px; font-size: 15px; }
.fact .label { color: var(--warn); }

/* Sonuç */
.big-number { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: clamp(72px, 22vw, 96px); line-height: 1; color: var(--accent); }
.center { text-align: center; align-items: center; }
.form-card { display: flex; flex-direction: column; gap: 12px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px; margin: 0; }
.form-card input {
  min-height: 50px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); padding: 0 14px; font-size: 16px;
}
.form-card input:focus { outline: 3px solid var(--accent); outline-offset: 1px; }
.error { color: var(--bad-text); font-size: 14px; margin: 0; }
.success { color: var(--good-text); font-weight: 600; }
.elim { display: flex; flex-direction: column; gap: 8px; background: color-mix(in srgb, var(--bad) 12%, var(--bg)); border: 1px solid var(--bad); border-radius: 16px; padding: 16px; font-size: 15px; }
.elim .label { color: var(--bad-text); }
.strike { text-decoration: line-through; color: var(--bad-text); }
.ok-text { font-weight: 700; color: var(--good-text); }

/* Liderlik */
.lb-head { display: flex; justify-content: space-between; padding: 0 14px; }
.lb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 7px; }
.lb li { display: flex; align-items: center; gap: 12px; min-height: 46px; padding: 0 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--surface); }
.lb li.me { border-color: var(--accent); }
.lb .rank { width: 28px; font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 20px; color: var(--muted); }
.lb li:nth-child(1) .rank { color: #FFC83D; }
.lb li:nth-child(2) .rank { color: #C9D1CB; }
.lb li:nth-child(3) .rank { color: #E0A170; }
[data-theme="gunisigi"] .lb li:nth-child(1) .rank { color: #9A6400; }
[data-theme="gunisigi"] .lb li:nth-child(2) .rank { color: #5E6B63; }
[data-theme="gunisigi"] .lb li:nth-child(3) .rank { color: #9A4F1C; }
.lb .name { flex-grow: 1; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .val { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 20px; font-variant-numeric: tabular-nums; }
.empty { text-align: center; color: var(--muted); padding: 32px 0; }

/* Tema seçimi */
.preview { display: flex; flex-direction: column; gap: 14px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 18px; }
.preview-q { font-family: "Barlow Condensed", sans-serif; font-weight: 700; font-size: 24px; line-height: 1.15; }
.preview-opts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.preview-opts div { min-height: 44px; display: flex; align-items: center; padding: 0 12px; border-radius: 10px; border: 1px solid var(--border); font-weight: 600; font-size: 15px; }
.preview-opts div.on { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }
.swatches { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.swatch { display: flex; flex-direction: column; gap: 10px; padding: 12px; border-radius: 14px; text-align: left; font-weight: 700; font-size: 15px; border: 1px solid; }
.swatch[aria-pressed="true"] { outline: 3px solid var(--accent); outline-offset: 0; }
.swatch .dots { display: flex; gap: 6px; }
.swatch .dots span { width: 22px; height: 22px; border-radius: 11px; }

.loading { display: flex; align-items: center; justify-content: center; min-height: 50vh; color: var(--muted); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}

/* Ekran değişince başlığa verilen odak görünmesin (klavye odağı yine görünür). */
[tabindex="-1"]:focus { outline: none; }

/* Cevap ekranı: şıklar daha sık, "Sonraki soru" düğmesi ekranın altına sabit. */
.options.compact { gap: 8px; }
.options.compact .option { min-height: 48px; padding: 8px 14px; font-size: 16px; }
.options.compact .option .key { width: 28px; height: 28px; }
.sticky-bottom {
  position: sticky;
  bottom: 0;
  z-index: 5;
  margin: 0 -20px calc(-1 * max(24px, env(safe-area-inset-bottom)));
  padding: 16px 20px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, transparent, var(--bg) 22px);
}
.sticky-bottom .btn { width: 100%; }

/* Oyun sonu: soruları gözden geçir */
.review { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; }
.review summary { cursor: pointer; min-height: 52px; display: flex; align-items: center; padding: 0 18px; font-weight: 700; list-style: none; }
.review summary::-webkit-details-marker { display: none; }
.review summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
.review[open] summary::after { transform: rotate(-135deg); }
.review summary:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 18px; }
.review-list { list-style: none; margin: 0; padding: 0 12px 12px; display: flex; flex-direction: column; gap: 10px; }
.review-list li { background: var(--bg); border-radius: 14px; padding: 14px; border-left: 0; border: 1px solid var(--border); display: flex; flex-direction: column; gap: 6px; }
.review-list li.is-right { border-color: color-mix(in srgb, var(--good) 55%, var(--border)); }
.review-list li.is-wrong { border-color: color-mix(in srgb, var(--bad) 55%, var(--border)); }
.review-q { margin: 0; font-weight: 600; }
.review-a { margin: 0; font-size: 15px; color: var(--muted); }
.review-fact { margin: 0; font-size: 14px; color: var(--muted); }
.review-fact .label { color: var(--warn); font-size: 12px; margin-right: 4px; }
