:root {
  color-scheme: light;
  --bg: #eef1f5;
  --sheet: #ffffff;
  --text: #1a2433;
  --muted: #5b6675;
  --line: #d6dce4;
  --line-soft: #e7ebf0;
  --field: #ffffff;
  --field-border: #b5bfcb;
  --brand: #1e3a5f;
  --brand-text: #ffffff;
  --brand-line: rgba(255, 255, 255, 0.35);
  --brand-hover: rgba(255, 255, 255, 0.14);
  --accent: #1f5aa8;
  --accent-text: #ffffff;
  --accent-soft: #e8eff9;
  --hit: #fff3c4;
  --good-bg: #e6f4ea;
  --good-fg: #145532;
  --good-line: #b8dcc4;
  --warn-bg: #edf0f5;
  --warn-fg: #2b3a52;
  --warn-line: #c9d2df;
  --info-bg: #e8eff9;
  --info-fg: #1b4685;
  --info-line: #bdd0ee;
  --none-bg: #f1f3f6;
  --none-fg: #3a4452;
  --none-line: #d6dce4;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 10px 28px rgba(16, 24, 40, 0.06);
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0f1419;
    --sheet: #171d25;
    --text: #e8edf3;
    --muted: #a3adba;
    --line: #2c3541;
    --line-soft: #232b35;
    --field: #1c232c;
    --field-border: #4a5563;
    --brand: #14243b;
    --brand-text: #ffffff;
    --brand-line: rgba(255, 255, 255, 0.3);
    --brand-hover: rgba(255, 255, 255, 0.12);
    --accent: #8fb6f0;
    --accent-text: #0f1419;
    --accent-soft: #1c2b45;
    --hit: #3d3617;
    --good-bg: #163022;
    --good-fg: #9be0b6;
    --good-line: #245a3a;
    --warn-bg: #232b37;
    --warn-fg: #c9d6ea;
    --warn-line: #3a4658;
    --info-bg: #182640;
    --info-fg: #b0caf7;
    --info-line: #2a4470;
    --none-bg: #222a33;
    --none-fg: #d6dce4;
    --none-line: #35404c;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.35);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0f1419;
  --sheet: #171d25;
  --text: #e8edf3;
  --muted: #a3adba;
  --line: #2c3541;
  --line-soft: #232b35;
  --field: #1c232c;
  --field-border: #4a5563;
  --brand: #14243b;
  --brand-text: #ffffff;
  --brand-line: rgba(255, 255, 255, 0.3);
  --brand-hover: rgba(255, 255, 255, 0.12);
  --accent: #8fb6f0;
  --accent-text: #0f1419;
  --accent-soft: #1c2b45;
  --hit: #3d3617;
  --good-bg: #163022;
  --good-fg: #9be0b6;
  --good-line: #245a3a;
  --warn-bg: #232b37;
  --warn-fg: #c9d6ea;
  --warn-line: #3a4658;
  --info-bg: #182640;
  --info-fg: #b0caf7;
  --info-line: #2a4470;
  --none-bg: #222a33;
  --none-fg: #d6dce4;
  --none-line: #35404c;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.35), 0 10px 28px rgba(0, 0, 0, 0.35);
}

/* Yazı boyutu kademeleri (A− / A+) */
html { font-size: 100%; height: 100%; }
html[data-size="2"] { font-size: 118%; }
html[data-size="3"] { font-size: 140%; }

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 1.0625rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

button { font-family: inherit; }

.wrap {
  width: 100%;
  max-width: 760px;
  margin-inline: auto;
  padding-inline: 20px;
}

/* ---------- Üst bant ---------- */

.top { background: var(--brand); color: var(--brand-text); }
.top-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-block: 12px;
}
.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-right: auto;
  font-weight: 600;
  font-size: 1.15rem;
  letter-spacing: -0.005em;
}
.mark {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--brand-text);
  position: relative;
  flex: none;
}
.mark::before, .mark::after {
  content: "";
  position: absolute;
  left: 6px;
  right: 6px;
  height: 4px;
  border-radius: 2px;
  background: var(--brand);
}
.mark::before { top: 6px; }
.mark::after { bottom: 6px; opacity: 0.55; }

.tools { display: flex; align-items: center; gap: 8px; }
.tools button {
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0 0.8rem;
  border: 1px solid var(--brand-line);
  border-radius: 8px;
  background: transparent;
  color: var(--brand-text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.tools button:hover { background: var(--brand-hover); }
.tools button:disabled { opacity: 0.4; cursor: default; }
.tools button:focus-visible { outline-color: var(--brand-text); }

.modes { display: flex; flex-wrap: wrap; gap: 0 6px; }
.modes [role="tab"] {
  appearance: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 6px 10px 12px;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.78);
  cursor: pointer;
}
.modes [role="tab"]:hover { color: var(--brand-text); }
.modes [role="tab"][aria-selected="true"] { color: var(--brand-text); border-bottom-color: var(--brand-text); }
.modes [role="tab"]:focus-visible { outline-color: var(--brand-text); }

/* ---------- Yaprak ---------- */

main.wrap { padding-block: 28px 48px; }
main.wrap > *, .sheet > *, .panel > * { min-width: 0; }

.sheet {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 30px 32px 34px;
}
@media (max-width: 560px) {
  .wrap { padding-inline: 14px; }
  .sheet { padding: 22px 18px 26px; border-radius: 12px; }
}

h1 { margin: 0; font-size: 1.7rem; font-weight: 600; line-height: 1.2; letter-spacing: -0.01em; }
.sub { margin: 6px 0 0; color: var(--muted); }

button.link {
  font: inherit;
  color: var(--accent);
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 3rem;
  padding: 0.6rem 1.3rem;
  border-radius: 10px;
  border: 1.5px solid var(--accent);
  background: var(--accent);
  color: var(--accent-text);
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
}
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: var(--field); color: var(--text); border-color: var(--field-border); }
.btn.secondary:hover { border-color: var(--accent); color: var(--accent); filter: none; }
.btn.quiet { background: none; border-color: transparent; color: var(--accent); padding-inline: 0.4rem; }
.btn.quiet:hover { filter: none; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Adım adım (sihirbaz) ---------- */

.progress { margin: 0 0 0.5rem; color: var(--accent); font-size: 0.95rem; font-weight: 600; }
.question { margin: 0; font-size: 1.7rem; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; }
.question:focus { outline: none; }
.help { margin: 0.6rem 0 0; color: var(--muted); font-size: 1rem; }

.choices-big { display: grid; gap: 0.7rem; margin-top: 1.5rem; }
.choice-big {
  position: relative;
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.95rem 2.8rem 0.95rem 1.15rem;
  border: 1.5px solid var(--line);
  border-radius: 12px;
  background: var(--field);
  color: var(--text);
  font: inherit;
  line-height: 1.35;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, box-shadow 120ms ease;
}
.choice-big::after {
  content: "";
  position: absolute;
  right: 1.2rem;
  top: 50%;
  width: 0.55rem;
  height: 0.55rem;
  border-right: 2px solid var(--muted);
  border-bottom: 2px solid var(--muted);
  transform: translateY(-50%) rotate(-45deg);
}
.choice-big:hover { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 2px 10px rgba(31, 90, 168, 0.1); }
.choice-big:hover::after { border-color: var(--accent); }
.choice-big strong { display: block; font-size: 1.2rem; font-weight: 600; }
.choice-big span { display: block; margin-top: 0.15rem; color: var(--muted); font-size: 0.98rem; }
.choice-big, .verdict, .variant-answer, .facts li { overflow-wrap: anywhere; }

.entry { display: flex; flex-wrap: wrap; align-items: center; gap: 0.8rem; margin-top: 1.4rem; }
.entry input {
  font: inherit;
  font-size: 1.4rem;
  padding: 0.55rem 0.8rem;
  min-height: 3.25rem;
  width: 11rem;
  max-width: 100%;
  border: 1.5px solid var(--field-border);
  border-radius: 10px;
  background: var(--field);
  color: var(--text);
}
.entry input[type="date"] { width: 15rem; }
.entry input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }
.error { margin: 0.6rem 0 0; color: var(--warn-fg); font-weight: 600; }

.nav { margin-top: 2rem; display: flex; flex-wrap: wrap; gap: 0.75rem; }

.answer-big {
  margin: 0.6rem 0 0;
  padding: 1.1rem 1.25rem;
  border-radius: 12px;
  border: 1px solid var(--none-line);
  font-size: clamp(1.4rem, 5vw, 1.85rem);
  font-weight: 600;
  line-height: 1.25;
  background: var(--none-bg);
  color: var(--none-fg);
  overflow-wrap: anywhere;
}
.answer-big.tone-good { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-line); }
.answer-big.tone-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.answer-big.tone-info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-line); }
.plain { margin: 1rem 0 0; font-size: 1.15rem; }

.facts { margin: 1.5rem 0 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.facts li { padding: 0.6rem 0; border-bottom: 1px solid var(--line-soft); display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.2rem 0.7rem; }
.facts li b { font-weight: 600; min-width: 9rem; }
.facts li .fact-value { flex: 1 1 12rem; }
.facts li .fact-code { color: var(--muted); font-size: 0.95rem; }
.facts li .link { font-size: 0.95rem; }

.src { margin: 0.9rem 0 0; color: var(--muted); font-size: 0.98rem; }

/* Dayanak satır kartı (isteğe bağlı açılır) */
.rowcard { margin-top: 0.6rem; }
.rowcard summary { cursor: pointer; color: var(--accent); font-size: 0.98rem; list-style: none; width: fit-content; }
.rowcard summary::-webkit-details-marker { display: none; }
.rowcard summary::before { content: "▸ "; }
.rowcard[open] summary::before { content: "▾ "; }
.rowcard .rowdl { margin: 0.7rem 0 0; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.rowcard .rowdl > div { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 0.6rem; padding: 0.5rem 0.8rem; border-top: 1px solid var(--line-soft); font-size: 0.95rem; }
.rowcard .rowdl > div:first-child { border-top: 0; }
.rowcard .rowdl dt { color: var(--muted); }
.rowcard .rowdl dd { margin: 0; }
.rowcard .rowdl > div.last dd { font-weight: 600; }
.rowcard .rowdl .rowhead { display: block; padding: 0.45rem 0.8rem; background: var(--none-bg); font-weight: 600; font-size: 0.9rem; }

/* Bilmiyorum: iki olasılık */
.variants { display: grid; gap: 0.7rem; margin-top: 1rem; }
.variant { padding: 0.9rem 1.1rem; border-radius: 12px; background: var(--none-bg); border: 1px solid var(--none-line); }
.variant.tone-good { background: var(--good-bg); border-color: var(--good-line); }
.variant.tone-warn { background: var(--warn-bg); border-color: var(--warn-line); }
.variant.tone-info { background: var(--info-bg); border-color: var(--info-line); }
.variant-label { margin: 0; color: var(--muted); font-size: 0.95rem; }
.variant.tone-good .variant-answer { color: var(--good-fg); }
.variant.tone-warn .variant-answer { color: var(--warn-fg); }
.variant.tone-info .variant-answer { color: var(--info-fg); }
.variant-answer { margin: 0.15rem 0 0; font-size: 1.25rem; font-weight: 600; }
.variant .src { margin-top: 0.3rem; }

.actions { margin-top: 1.6rem; display: flex; flex-wrap: wrap; gap: 0.7rem; }

/* ---------- Hızlı giriş (formlar) ---------- */

form { margin-top: 26px; max-width: 520px; }
.q { margin: 0 0 22px; padding: 0; border: 0; min-width: 0; }
.q > label, .q > legend { display: block; padding: 0; margin: 0 0 6px; font-weight: 600; font-size: 1rem; }

select {
  width: 100%;
  min-height: 3rem;
  padding: 0 40px 0 12px;
  font: inherit;
  color: var(--text);
  background-color: var(--field);
  border: 1.5px solid var(--field-border);
  border-radius: 10px;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 14 14'%3E%3Cpath d='M2 5l5 5 5-5' fill='none' stroke='%23777' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
select:hover { border-color: var(--accent); }
select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-soft); }

.options { display: flex; flex-wrap: wrap; gap: 8px 24px; }
.options.stack { flex-direction: column; gap: 10px; }
.options label { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; min-height: 2.75rem; }
.options input { margin: 0; width: 1.25rem; height: 1.25rem; accent-color: var(--accent); }

.answer { margin-top: 28px; max-width: 520px; }
.verdict {
  margin: 0;
  padding: 0.9rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--none-line);
  font-size: 1.35rem;
  font-weight: 600;
  line-height: 1.3;
  background: var(--none-bg);
  color: var(--none-fg);
}
.verdict.tone-good { background: var(--good-bg); color: var(--good-fg); border-color: var(--good-line); }
.verdict.tone-warn { background: var(--warn-bg); color: var(--warn-fg); border-color: var(--warn-line); }
.verdict.tone-info { background: var(--info-bg); color: var(--info-fg); border-color: var(--info-line); }

/* ---------- Kaynak tablo ---------- */

.source { margin-top: 26px; padding: 0 6px; }
.source summary { cursor: pointer; font-size: 1rem; color: var(--muted); list-style: none; width: fit-content; }
.source summary::-webkit-details-marker { display: none; }
.source summary::before { content: "▸ "; }
.source[open] summary::before { content: "▾ "; }
.source summary:hover { color: var(--text); }
.source .viewbar { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.source .viewbar .seg { display: inline-flex; border: 1px solid var(--field-border); border-radius: 8px; overflow: hidden; background: var(--field); }
.source .viewbar .seg button { border: 0; background: transparent; color: var(--muted); padding: 0.4rem 0.85rem; font: inherit; font-size: 0.95rem; cursor: pointer; }
.source .viewbar .seg button[aria-pressed="true"] { background: var(--accent); color: var(--accent-text); }
.source .filter.inline { margin-top: 0; }
.source .filter input {
  width: 100%;
  max-width: 360px;
  min-height: 2.6rem;
  padding: 0 12px;
  font: inherit;
  border: 1px solid var(--field-border);
  border-radius: 8px;
  background: var(--field);
  color: var(--text);
}
.scroll { margin-top: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); }
.matrix { margin-top: 12px; overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--sheet); padding: 10px; }
.matrix .mtarih { margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 0.95rem; }

table.sheet { border-collapse: collapse; width: 100%; min-width: 680px; font-size: 0.9rem; line-height: 1.4; }
table.sheet th, table.sheet td { text-align: left; vertical-align: top; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); }
table.sheet tr:last-child td { border-bottom: 0; }
table.sheet th { position: sticky; top: 0; background: var(--none-bg); border-bottom: 1px solid var(--line); font-weight: 600; font-size: 0.85rem; }
table.sheet .rownum { width: 3em; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
table.sheet td.last { font-weight: 600; }
table.sheet tr.hit td { background: var(--hit); }
table.sheet tr.note td { color: var(--muted); font-size: 0.85rem; }

table.grid { border-collapse: collapse; font-size: 0.82rem; line-height: 1.3; }
table.grid th, table.grid td { border: 1px solid var(--line-soft); padding: 5px 7px; text-align: center; vertical-align: middle; min-width: 6.5rem; }
table.grid th { background: var(--none-bg); font-weight: 600; }
table.grid th.corner { text-align: left; font-weight: 400; color: var(--muted); }
table.grid th.rowh { text-align: left; position: sticky; left: 0; z-index: 1; min-width: 9rem; }
table.grid td.g-good { background: var(--good-bg); color: var(--good-fg); font-weight: 600; }
table.grid td.g-warn { background: var(--warn-bg); color: var(--warn-fg); font-weight: 600; }
table.grid td.g-info { background: var(--info-bg); color: var(--info-fg); font-weight: 600; }
table.grid td.g-mixed { background: var(--hit); font-weight: 600; }
table.grid td.g-none { color: var(--muted); }
table.grid td button { font: inherit; background: none; border: 0; color: inherit; cursor: pointer; padding: 0; width: 100%; }

/* ---------- Yazdırma özeti (A4) ---------- */

#print-summary { display: none; }

@page { size: A4; margin: 16mm 18mm 18mm; }

@media print {
  html { font-size: 100%; }
  body { background: #fff; color: #111827; font-family: var(--font); font-size: 11pt; line-height: 1.45; }
  header.top, main > *:not(#print-summary) { display: none !important; }
  main.wrap { padding: 0; max-width: none; }
  #print-summary { display: block !important; max-width: none; padding: 0; }

  .p-head { display: flex; justify-content: space-between; align-items: flex-end; padding-bottom: 8pt; border-bottom: 2pt solid #1e3a5f; }
  .p-brand { display: inline-flex; align-items: center; gap: 7pt; font-weight: 600; font-size: 13pt; color: #1e3a5f; }
  .p-mark { display: inline-block; width: 13pt; height: 13pt; border-radius: 3pt; background: #1e3a5f; position: relative; }
  .p-mark::before, .p-mark::after { content: ""; position: absolute; left: 3pt; right: 3pt; height: 2pt; border-radius: 1pt; background: #fff; }
  .p-mark::before { top: 3.5pt; }
  .p-mark::after { bottom: 3.5pt; opacity: 0.6; }
  .p-meta { text-align: right; font-size: 9.5pt; color: #5b6675; line-height: 1.35; }

  .p-title { margin: 18pt 0 0; font-size: 19pt; font-weight: 600; letter-spacing: -0.01em; color: #111827; }

  .p-result { margin: 12pt 0 0; padding: 12pt 14pt; border: 1pt solid #c9d2df; border-radius: 6pt; background: #f4f6f9; break-inside: avoid; }
  .p-result.tone-good { border-color: #b8dcc4; background: #eef7f1; }
  .p-result.tone-warn { border-color: #c9d2df; background: #f1f3f7; }
  .p-result.tone-info { border-color: #bdd0ee; background: #eef3fb; }
  .p-label { font-size: 9pt; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #5b6675; }
  .p-answer { margin: 3pt 0 0; font-size: 17pt; font-weight: 600; line-height: 1.25; color: #111827; }
  .p-result.tone-good .p-answer { color: #145532; }
  .p-result.tone-info .p-answer { color: #1b4685; }
  .p-result.tone-warn .p-answer { color: #2b3a52; }
  .p-plain { margin: 6pt 0 0; font-size: 11pt; color: #1f2937; }

  .p-h2 { margin: 18pt 0 6pt; font-size: 10pt; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #1e3a5f; }
  .p-sub { margin: -2pt 0 6pt; font-size: 10pt; color: #5b6675; }

  #print-summary table { border-collapse: collapse; width: 100%; font-size: 10.5pt; break-inside: avoid; }
  #print-summary th, #print-summary td { text-align: left; vertical-align: top; padding: 5pt 8pt; border-top: 1pt solid #e3e8ee; }
  #print-summary tr:first-child th, #print-summary tr:first-child td { border-top: 0; }
  #print-summary th { width: 38%; font-weight: 500; color: #5b6675; }
  #print-summary td { color: #111827; }
  .p-facts th { color: #111827; font-weight: 600; }
  .p-row { border: 1pt solid #dfe4ea; border-radius: 4pt; }
  .p-row th { background: #f4f6f9; }
  .p-row tr.last td { font-weight: 600; }

  .p-foot { margin-top: 22pt; padding-top: 8pt; border-top: 1pt solid #dfe4ea; font-size: 8.5pt; color: #6b7280; }
  .p-foot p { margin: 0 0 2pt; }
}

@media (prefers-contrast: more) {
  :root { --muted: #333333; --line: #666666; --line-soft: #888888; --field-border: #333333; }
  .verdict, .answer-big, .variant { border: 2px solid currentColor; }
  .choice-big { border-color: #333333; }
}
@media (forced-colors: active) {
  .verdict, .answer-big, .variant, .choice-big, .btn, select { border: 2px solid ButtonText; }
  .modes [role="tab"][aria-selected="true"] { border-bottom: 3px solid Highlight; }
}

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