:root {
  --bg: #fbfaf7;
  --card: #ffffff;
  --text: #1f2328;
  --muted: #656d76;
  --border: #e3e0d8;
  --accent: #3b5bdb;
  --c-author: #1c64c4;
  --c-title: #8a3ab9;
  --c-container: #0b7a75;
  --c-contrib: #7a5c3e;
  --c-publisher: #1a7f37;
  --c-year: #b35900;
  --c-page: #c4253a;
  --c-url: #57606a;
  --hata: #cf222e;
  --hata-bg: #ffebe9;
  --uyari: #9a6700;
  --uyari-bg: #fff3c4;
  --bilgi: #0969da;
  --bilgi-bg: #ddf4ff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #17181b;
    --card: #212226;
    --text: #e6e6e6;
    --muted: #9aa0a6;
    --border: #34363b;
    --accent: #8ea6ff;
    --c-author: #6cb0ff;
    --c-title: #d39bff;
    --c-container: #4fd1c5;
    --c-contrib: #d2a679;
    --c-publisher: #5fd27f;
    --c-year: #ffad5c;
    --c-page: #ff7b8a;
    --c-url: #a0a7b0;
    --hata: #ff7b72;
    --hata-bg: #4a1d1f;
    --uyari: #e3b341;
    --uyari-bg: #3d3214;
    --bilgi: #79c0ff;
    --bilgi-bg: #102a44;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 16px/1.5 system-ui, "Segoe UI", sans-serif; }
button { font: inherit; }
a { color: var(--accent); }

/* Üst gezinme */
.topnav { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; padding: 10px 24px; border-bottom: 1px solid var(--border); background: var(--card); }
.topnav .brand { font-weight: 700; margin-right: 16px; }
.topnav a { text-decoration: none; color: var(--muted); padding: 6px 12px; border-radius: 6px; }
.topnav a[aria-current="page"] { color: var(--text); background: var(--bg); font-weight: 600; }
header.page { padding: 20px 24px 4px; max-width: 1200px; margin: 0 auto; }
header.page h1 { margin: 0; font-size: 1.5rem; }
.sub { margin: 2px 0 0; color: var(--muted); }

/* Form öğeleri */
input, select { font: inherit; padding: 7px 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--card); color: var(--text); width: 100%; }
input:focus, select:focus, [contenteditable]:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
label { display: flex; flex-direction: column; gap: 4px; }
label > span, legend { font-weight: 600; font-size: .9rem; }
label em, legend em { font-weight: 400; color: var(--muted); font-style: normal; font-size: .85rem; }
fieldset { border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px 10px; margin: 0; }
.btn { border: 1px solid var(--border); background: var(--card); color: var(--text); border-radius: 6px; padding: 6px 12px; cursor: pointer; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.danger { color: var(--hata); }
.link { border: none; background: none; color: var(--accent); cursor: pointer; padding: 0; }
.errors { margin: 0; padding-left: 18px; color: var(--hata); font-size: .9rem; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; background: currentColor; vertical-align: baseline; }

/* Künye oluşturucu */
.builder { display: grid; grid-template-columns: minmax(280px, 400px) 1fr; gap: 24px; padding: 16px 24px 40px; max-width: 1200px; margin: 0 auto; }
.builder form { display: flex; flex-direction: column; gap: 12px; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.author { display: grid; grid-template-columns: 1fr 1fr auto; gap: 6px; margin-bottom: 6px; }
.remove { border: none; background: none; color: var(--muted); font-size: 1.3rem; cursor: pointer; padding: 0 6px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; flex-wrap: wrap; }
.tabs button { border: none; background: none; color: var(--muted); padding: 8px 14px; cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a { text-decoration: none; color: var(--muted); padding: 8px 14px; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs a[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .85rem; margin-bottom: 12px; }

.card { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 12px 16px; margin-bottom: 12px; }
.card h2, .card h3 { margin: 0 0 6px; font-size: .85rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.card h2 button { text-transform: none; letter-spacing: 0; border: 1px solid var(--border); background: none; color: var(--muted); border-radius: 5px; padding: 1px 8px; cursor: pointer; }
.card h2 button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.card h2 button:disabled { opacity: .55; cursor: default; }
.card-btns { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.notice { margin: 0 0 12px; padding: 8px 12px; border-radius: 6px; background: var(--bilgi-bg); color: var(--text); font-size: .9rem; }
.view[hidden] { display: none !important; }

/* Kaynak ekle penceresi */
.cite-dialog { width: min(1150px, 96vw); max-height: 92vh; padding: 0; border: 1px solid var(--border); border-radius: 10px; background: var(--bg); color: var(--text); }
.cite-dialog::backdrop { background: rgb(0 0 0 / .45); }
.dlg-head { position: sticky; top: 0; z-index: 1; display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--card); border-bottom: 1px solid var(--border); }
.dlg-head h2 { margin: 0; font-size: 1.15rem; flex: 1; }
label.inline { flex-direction: row; align-items: center; gap: 6px; font-size: .9rem; }
label.inline input { width: auto; }

.dlg-original { padding: 10px 24px; background: var(--card); border-bottom: 1px solid var(--border); font-size: .92rem; }
.dlg-original .cite { font-size: 1rem; }
.dlg-original small { color: var(--muted); }

/* Metin üzerinde işlem: tıklanabilir cümleler, menü, düzeltme düğmeleri */
.tip { margin: 0 0 10px; color: var(--muted); font-size: .88rem; }
.paper.interactive [data-loc] { cursor: pointer; border-radius: 3px; }
.paper.interactive span[data-loc]:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.paper.interactive mark[data-loc]:hover { filter: brightness(.95); }
.actmenu { position: fixed; z-index: 900; min-width: 220px; max-width: 360px; display: flex; flex-direction: column; padding: 4px;
  background: var(--card); border: 1px solid var(--border); border-radius: 8px; box-shadow: 0 8px 24px rgb(0 0 0 / .18); font-family: system-ui, sans-serif; }
.actmenu button { text-align: left; border: none; background: none; color: var(--text); padding: 7px 10px; border-radius: 5px; cursor: pointer; font-size: .9rem; }
.actmenu button:hover, .actmenu button:focus { background: var(--bg); outline: none; }
.actmenu button.primary { font-weight: 600; color: var(--accent); }
.actmenu button.danger { color: var(--hata); }
.fixes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.btn.small { padding: 2px 10px; font-size: .82rem; }

/* Bölüm başlığına ait uyarı */
.chtitle .cw-uyari { border-bottom: 2px solid var(--uyari); }
.chtitle .cw-hata { border-bottom: 2px solid var(--hata); }
.chtitle .cw-bilgi { border-bottom: 2px dotted var(--bilgi); }

/* Kurum kılavuzu: Sinop Üniversitesi LEE — önizleme ve çıktı kılavuz ölçüleriyle */
body[data-profil="sinop"] .paper { font-family: "Times New Roman", Times, serif; font-size: 12pt; line-height: 1.5; }
body[data-profil="sinop"] .paper p { margin: 0 0 6pt; }
body[data-profil="sinop"] .paper blockquote, body[data-profil="sinop"] .paper .footnotes { line-height: 1.15; }
body[data-profil="sinop"] .paper .bib p { padding-left: 0; text-indent: 0; font-size: 11pt; line-height: 1.15; }
@media print {
  @page { size: A4; margin: 2.5cm 2.5cm 2.5cm 3.5cm; }
}

.site-footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 20px 16px 28px; border-top: 1px solid var(--border); margin-top: 24px; }
.site-footer a { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; transition: .25s;
  background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 8px; font-size: .92rem; z-index: 1000; max-width: 90vw; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.card.muted .cite { color: var(--muted); font-family: inherit; font-size: .95rem; }
.cite { font-family: Georgia, "Times New Roman", serif; font-size: 1.1rem; overflow-wrap: anywhere; }
.num { color: var(--muted); }

.p-author { color: var(--c-author); }
.p-title { color: var(--c-title); }
.p-container { color: var(--c-container); }
.p-contrib { color: var(--c-contrib); }
.p-publisher { color: var(--c-publisher); }
.p-year { color: var(--c-year); }
.p-page { color: var(--c-page); }
.p-url { color: var(--c-url); }
.cite .part { border-bottom: 2px solid currentColor; }

.hints { border-left: 3px solid var(--accent); padding: 4px 0 4px 14px; color: var(--muted); margin-top: 8px; }
.hints h3 { margin: 0 0 4px; font-size: .95rem; color: var(--text); }
.hints ol, .hints p { margin: 0 0 6px; }
.hints ol { padding-left: 20px; }

/* Kurallar sayfası */
.doc { max-width: 900px; margin: 0 auto; padding: 16px 24px 60px; }
.doc h2 { margin-top: 36px; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
.doc .toc { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.doc table { border-collapse: collapse; width: 100%; }
.doc th, .doc td { border: 1px solid var(--border); padding: 6px 10px; text-align: left; vertical-align: top; }
.example dl { display: grid; grid-template-columns: 140px 1fr; gap: 4px 12px; margin: 8px 0 0; }
.example dt { color: var(--muted); font-size: .85rem; padding-top: 3px; }
.example dd { margin: 0; }
.tag { font-size: .75rem; color: var(--muted); border: 1px solid var(--border); border-radius: 10px; padding: 0 8px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.good, .bad { padding: 6px 10px; border-radius: 6px; margin-top: 6px; font-family: Georgia, serif; }
.good { background: color-mix(in srgb, var(--c-publisher) 12%, transparent); }
.bad { background: var(--hata-bg); }
.good::before { content: "✓ Doğru  "; font-family: system-ui, sans-serif; font-weight: 600; color: var(--c-publisher); }
.bad::before { content: "✗ Yanlış  "; font-family: system-ui, sans-serif; font-weight: 600; color: var(--hata); }
:target { scroll-margin-top: 12px; }
.card:target { outline: 2px solid var(--accent); }

/* Seviye etiketleri */
.chip { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 10px; text-transform: uppercase; letter-spacing: .03em; }
.chip.hata { color: var(--hata); background: var(--hata-bg); }
.chip.uyari { color: var(--uyari); background: var(--uyari-bg); }
.chip.bilgi { color: var(--bilgi); background: var(--bilgi-bg); }

/* Tez denetimi */
.tezbar { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-end; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.tezbar label { min-width: 160px; }
.tezbar label.grow { flex: 1; min-width: 220px; }
.tez { display: grid; grid-template-columns: 240px minmax(0, 1fr) 320px; gap: 20px; padding: 16px 24px 40px; }
@media (max-width: 1100px) { .tez { grid-template-columns: 220px minmax(0, 1fr); } .tez #warnings { grid-column: 1 / -1; } }
@media (max-width: 760px) {
  .tez, .builder { grid-template-columns: 1fr; padding: 16px; }
  .tezbar, .topnav, header.page { padding-left: 16px; padding-right: 16px; }
  .doc { padding: 16px; }
  .example dl { grid-template-columns: 1fr; }
}

.chlist { list-style: none; margin: 0 0 12px; padding: 0; }
.chlist button { width: 100%; text-align: left; border: 1px solid transparent; background: none; color: var(--text); padding: 6px 8px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 6px; align-items: center; }
.chlist button[aria-current="true"] { background: var(--card); border-color: var(--border); font-weight: 600; }
.chlist small { display: block; color: var(--muted); font-weight: 400; font-size: .78rem; }
.badges { display: flex; gap: 3px; flex-shrink: 0; }
.addch { display: flex; flex-direction: column; gap: 6px; border-top: 1px solid var(--border); padding-top: 12px; }

.paper { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 24px 32px; font-family: Georgia, "Times New Roman", serif; font-size: 1.02rem; line-height: 1.7; }
.paper h2.chtitle { font-family: system-ui, sans-serif; font-size: 1.2rem; margin: 0 0 12px; }
.paper h2.chtitle:not(:first-child) { margin-top: 40px; padding-top: 20px; border-top: 1px dashed var(--border); }
.paper h3 { font-family: system-ui, sans-serif; font-size: 1.05rem; }
.paper p { margin: 0 0 12px; text-align: justify; }
.paper blockquote { margin: 0 0 12px 2.5em; font-size: .95rem; }
.paper .fn { color: var(--accent); font-family: system-ui, sans-serif; font-size: .7em; }
.paper .footnotes { border-top: 1px solid var(--border); margin-top: 20px; padding-top: 8px; font-size: .88rem; }
.paper .footnotes li { margin-bottom: 4px; }
.paper .bib p { padding-left: 2em; text-indent: -2em; text-align: left; }
.paper .empty { color: var(--muted); font-family: system-ui, sans-serif; }
.pw-uyari { box-shadow: -4px 0 0 var(--uyari); }
.pw-bilgi { box-shadow: -4px 0 0 var(--bilgi); }
.pw-hata { box-shadow: -4px 0 0 var(--hata); }
mark { color: inherit; border-radius: 3px; cursor: pointer; padding: 0 1px; }
mark.hata { background: var(--hata-bg); border-bottom: 2px solid var(--hata); }
mark.uyari { background: var(--uyari-bg); border-bottom: 2px solid var(--uyari); }
mark.bilgi { background: var(--bilgi-bg); border-bottom: 2px dotted var(--bilgi); }
/* Metin içi uyarı numaraları ve kural notları */
.wrefs { font-family: system-ui, sans-serif; line-height: 1; margin-left: 1px; }
.wn { display: inline-flex; align-items: center; justify-content: center; min-width: 1.45em; height: 1.45em; padding: 0 4px; border-radius: 999px;
  font: 700 .68rem/1 system-ui, sans-serif; text-decoration: none; cursor: pointer; margin-right: 2px; color: #fff; vertical-align: super; }
.note-head .wn, .wlist .wn { vertical-align: middle; }
.wn.hata { background: var(--hata); }
.wn.uyari { background: var(--uyari); }
.wn.bilgi { background: var(--bilgi); }
@media (prefers-color-scheme: dark) { .wn { color: #111; } }
.notes { font-family: system-ui, sans-serif; font-size: .86rem; line-height: 1.5; margin: -4px 0 16px; display: flex; flex-direction: column; gap: 6px; }
.paper blockquote + .notes { margin-left: 2.5em; }
.note { border-left: 3px solid; border-radius: 0 6px 6px 0; padding: 6px 10px; }
.note.hata { border-color: var(--hata); background: var(--hata-bg); }
.note.uyari { border-color: var(--uyari); background: var(--uyari-bg); }
.note.bilgi { border-color: var(--bilgi); background: var(--bilgi-bg); }
.note-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.note p { margin: 4px 0 0; text-align: left; }
.note .note-rule { color: var(--muted); }
.note details { margin-top: 4px; }
.note summary { cursor: pointer; color: var(--accent); font-size: .82rem; }
.note .good, .note .bad { font-size: .9rem; }
.footnotes .notes { margin: 4px 0 8px; }
.flash { animation: flash 1.2s ease-out; }
@keyframes flash { 0% { outline: 3px solid var(--accent); } 100% { outline: 3px solid transparent; } }

.wlist { list-style: none; padding: 0; margin: 0; }
.wlist li { background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; margin-bottom: 8px; cursor: pointer; font-size: .9rem; }
.wlist li:hover { border-color: var(--accent); }
.wlist .w-head { display: flex; gap: 6px; align-items: center; font-weight: 600; }
.wlist .w-text { color: var(--muted); font-style: italic; margin: 4px 0; overflow-wrap: anywhere; }
.wlist .w-msg { margin: 0; }
.wfilter { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.wfilter label { flex-direction: row; align-items: center; gap: 4px; font-size: .85rem; }
.wfilter input { width: auto; }
.summary { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }

.edit { display: flex; flex-direction: column; gap: 10px; }
.minibar { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.minibar .hint { color: var(--muted); font-size: .85rem; }
#editor { min-height: 360px; background: var(--card); border: 1px solid var(--border); border-radius: 8px; padding: 16px 20px; font-family: Georgia, serif; line-height: 1.6; overflow-wrap: anywhere; }
#editor blockquote { margin-left: 2.5em; border-left: 3px solid var(--border); padding-left: 10px; }
#editor ol[data-footnotes] { border-top: 1px solid var(--border); padding-top: 8px; font-size: .9rem; }
#editor ol[data-footnotes]::before { content: "Dipnotlar"; display: block; font-family: system-ui, sans-serif; font-weight: 600; color: var(--muted); margin: 0 0 4px -20px; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

@media print {
  .topnav, .tezbar, #chapters, .tabs, .wfilter, .no-print, .toast, .cite-dialog { display: none !important; }
  .tez { display: block; padding: 0; }
  .paper { border: none; padding: 0; }
  body { background: #fff; color: #000; }
  .wlist li { break-inside: avoid; }
}
