/* "Skor defteri": kâğıt beyazı zemin, mürekkep rengi yazı, ince çizgiler. Mobil öncelikli; masaüstünde dar sütun.
   Vurgu rengi (simgenin kırmızısı) yalnız üç yerde: seçili sekme, takip edilen takım, kazanan skor.
   Tema: sistem ayarı (prefers-color-scheme) ya da Ayarlar'daki seçim (html[data-theme]). Renkler WCAG AA'yı geçer. */
:root {
  --bg: #faf9f7;
  --bar: #faf9f7;          /* tarayıcı çubuğu (theme-color); app.js okur */
  --card: #ffffff;         /* yükseltilmiş yüzey: pencere, bildirim önizlemesi */
  --ink: #1a1817;
  --ink-inv: #faf9f7;
  --muted: #69625c;
  --line: #e8e4df;
  --rule: #1a1817;         /* bölüm başı çizgisi */
  --accent: #c8102e;
  --tint: #fbecee;         /* takip edilen satırın zemini */
  --island-dim: #a7a29d;   /* alt menü adası: seçili olmayan simge */
  --island-pill: #34312f;  /* alt menü adası: seçili sekmenin zemini */
  --watermark: .06;        /* arka plandaki silik topun saydamlığı */
  --win: #1a1817;
  --ok: #1a6a42;
  --warn: #8a5800;
  --shadow: 0 1px 2px rgb(0 0 0 / .05), 0 8px 24px rgb(0 0 0 / .08);
  --radius: 12px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --gutter: max(16px, env(safe-area-inset-left, 0px));
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121110;
    --bar: #121110;
    --card: #1d1b1a;
    --ink: #eeeae5;
    --ink-inv: #121110;
    --muted: #a39c95;
    --line: #2d2a28;
    --rule: #eeeae5;
    --accent: #ff7084;
    --tint: #2a1619;
    --island-dim: #5f5a56;
    --island-pill: #d6d1cb;
    --watermark: .08;
    --win: #ffffff;
    --ok: #5cc28e;
    --warn: #e2a84a;
    --shadow: 0 0 0 1px #2d2a28, 0 8px 24px rgb(0 0 0 / .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --island-dim: #5f5a56;
  --island-pill: #d6d1cb;
  --watermark: .08;
  --bg: #121110;
  --bar: #121110;
  --card: #1d1b1a;
  --ink: #eeeae5;
  --ink-inv: #121110;
  --muted: #a39c95;
  --line: #2d2a28;
  --rule: #eeeae5;
  --accent: #ff7084;
  --tint: #2a1619;
  --win: #ffffff;
  --ok: #5cc28e;
  --warn: #e2a84a;
  --shadow: 0 0 0 1px #2d2a28, 0 8px 24px rgb(0 0 0 / .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.45 var(--font);
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
}
button, select, input, textarea { font: inherit; color: inherit; }
/* Arka planda silik top: sağ üst köşede, kenardan taşar; yazıların arkasına pek girmez, kaydırınca yerinde kalır. Yönetim sayfasında yok. */
body:not(.admin)::before {
  content: ""; position: fixed; z-index: -1; pointer-events: none;
  top: -90px; right: -150px; width: 440px; height: 440px;
  background: var(--ink); opacity: var(--watermark);
  -webkit-mask: url(/arka-top.svg) center / contain no-repeat; mask: url(/arka-top.svg) center / contain no-repeat;
}
a { color: inherit; text-decoration-color: var(--muted); text-underline-offset: 3px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- üst: küçük künye satırı + büyük, sola yaslı başlık ---------- */
.top {
  max-width: 640px; margin: 0 auto;
  padding: env(safe-area-inset-top, 0px) var(--gutter) 0;
}
.top-row { display: flex; align-items: center; gap: 4px; min-height: 52px; }
.brand {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand img { width: 20px; height: 20px; border-radius: 6px; flex: none; box-shadow: 0 0 0 1px var(--line); }
.top .back {
  background: none; border: 0; padding: 0; margin-left: -12px; min-width: 44px; min-height: 44px;
  display: grid; place-items: center; cursor: pointer; color: var(--ink); border-radius: 50%;
}
.top svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.top select {
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 4px 12px; min-height: 44px;
  font-size: 14px; font-weight: 600;
}
.top h1 {
  margin: 2px 0 0; font-size: clamp(26px, 8vw, 32px); line-height: 1.12; font-weight: 780; letter-spacing: -.025em;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

main {
  max-width: 640px; margin: 0 auto;
  padding: 20px var(--gutter) 32px;
}
main:focus { outline: none; }
/* Bölümler arası boşluk tek yerden (#view: sınıf kurallarındaki margin: 0'ı geçsin). */
#view > * + * { margin-top: 28px; }
#view > .list-item + .list-item, #view > details + details, #view > .skeleton + .skeleton { margin-top: 0; }
#view > .section-title + .list-item { margin-top: 8px; }
#view > .note { margin-top: 36px; }

/* ---------- alt menü: yüzen mürekkep ada; seçili sekmede ad ve simgenin kırmızı noktası ---------- */
.tabs {
  position: fixed; z-index: 5; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom, 0px));
  display: flex; gap: 2px; padding: 6px; max-width: calc(100vw - 24px);
  background: var(--ink); color: var(--ink-inv); border-radius: 999px;
  box-shadow: 0 8px 24px rgb(0 0 0 / .18);
}
.tabs a {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  min-width: 48px; min-height: 48px; padding: 0 10px; border-radius: 999px;
  color: var(--island-dim); text-decoration: none; font-size: 14px; font-weight: 650;
  transition: background-color .2s, color .2s;
}
.tabs a span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink-inv); background: var(--island-pill); padding: 0 16px 0 12px; }
.tabs a[aria-current="page"] span { position: static; width: auto; height: auto; clip-path: none; }
.tabs svg { width: 22px; height: 22px; flex: none; overflow: visible; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tabs .dot { fill: var(--accent); stroke: var(--island-pill); stroke-width: 2.2; display: none; }
.tabs a[aria-current="page"] .dot { display: inline; }
.tabs :focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- bölümler: kart yok; üstte ince mürekkep çizgisi, altında başlık ---------- */
.card { border-top: 1px solid var(--rule); padding-top: 12px; min-width: 0; }
.card > h2, .card > .row > h2 { margin: 0 0 4px; font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
.fol-title { display: flex; align-items: center; gap: 8px; }
.fol-title::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.row { display: flex; align-items: center; gap: 12px; }
.row > .grow { flex: 1; min-width: 0; }
.stack { display: grid; gap: 12px; }
.stack:has(> .list-item) { gap: 0; }
.section-title {
  margin: 0; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .1em;
}

/* Kısa bilgi notu (ör. "Bildirimler kapalı"): çizgi yerine ince çerçeve. */
.card.small { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }

/* Takım sayfasının başı: etiket, grup, takip düğmesi (çizgisiz). */
.card.row { border-top: 0; padding-top: 0; }
.card.row strong { display: block; font-size: 17px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--ink); border-radius: 999px; padding: 10px 18px; min-height: 44px; cursor: pointer;
  background: var(--ink); color: var(--ink-inv); font-weight: 650; text-decoration: none; white-space: nowrap;
}
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--muted); }
.btn.small { padding: 8px 14px; font-size: 14px; }
.btn:disabled { opacity: .5; cursor: default; }
.fab {
  position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--ink); color: var(--ink-inv);
  font-size: 28px; font-weight: 300; line-height: 1; box-shadow: var(--shadow); cursor: pointer;
}

/* Liste satırı: tam genişlik, ince ayırıcı. */
.list-item {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: 64px;
  background: none; border: 0; border-top: 1px solid var(--line); border-radius: 0;
  padding: 14px 0; text-align: left; cursor: pointer; text-decoration: none; color: inherit;
}
.list-item:not(:has(+ .list-item)) { border-bottom: 1px solid var(--line); }
.list-item > .grow { flex: 1; min-width: 0; }
.list-item .chev { color: var(--muted); font-size: 22px; font-weight: 300; }
.list-item strong { display: block; font-size: 16px; font-weight: 650; }
.list-item .small:not(.muted) { margin-top: 2px; }
.label { color: var(--accent); font-size: 12px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }

/* ---------- maç satırı: büyük saat, altında takımlar tek satırda, skor ortada ---------- */
.match { display: grid; gap: 2px; padding: 14px 0; }
.match + .match { border-top: 1px solid var(--line); }
.when { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.when .clock { font-size: 22px; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.2; }
.when .meta { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .teams { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); gap: 0 12px; align-items: center; }
.match .team.home { justify-content: flex-end; text-align: right; }
.match .team { font-weight: 600; min-width: 0; min-height: 44px; display: flex; align-items: center; overflow-wrap: anywhere; color: inherit; text-decoration: none; }
.match .team.won { color: var(--win); font-weight: 780; }
.match .team.lost { color: var(--muted); font-weight: 500; }
.match .pts { font-variant-numeric: tabular-nums; font-size: 18px; font-weight: 750; text-align: center; white-space: nowrap; letter-spacing: -.01em; }
.match .pts .w { color: var(--accent); }
.match .pts.vs { color: var(--muted); font-weight: 400; font-size: 15px; }
.match .meta { font-size: 13px; color: var(--muted); }
.match .sets { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; word-spacing: .3em; text-align: center; }
.when .share-icon {
  flex: none; align-self: center; margin: -12px -12px -12px auto; width: 44px; height: 44px; display: grid; place-items: center;
  background: none; border: 0; border-radius: 50%; color: var(--muted); cursor: pointer;
}
.when .share-icon:hover { color: var(--ink); }
.when .share-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.match .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.match.fol { border-left: 3px solid var(--accent); padding-left: 13px; margin-left: -16px; }
.pill { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.list-item .pill { color: var(--ink); }

/* ---------- puan tablosu: sıra büyük; takip edilen satırda kırmızı sıra ve ince işaret ---------- */
.table-wrap { overflow-x: auto; margin: 4px calc(-1 * var(--gutter)) 0; padding: 0 var(--gutter); }
table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 14px; }
th { text-align: center; font-size: 11px; color: var(--muted); font-weight: 650; letter-spacing: .06em; text-transform: uppercase; padding: 8px 4px; border-bottom: 1px solid var(--line); white-space: nowrap; }
th:nth-child(2), td:nth-child(2) { text-align: left; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
td { text-align: center; padding: 9px 4px; border-bottom: 1px solid var(--line); }
td.pos { width: 2.2em; font-size: 20px; font-weight: 750; letter-spacing: -.03em; color: var(--muted); }
tr:first-child td.pos { color: var(--ink); }
td:nth-child(2) { font-weight: 600; min-width: 9em; padding: 0 4px; }
td:nth-child(2) a { display: flex; align-items: center; min-height: 44px; color: inherit; text-decoration: none; }
td:last-child { padding-right: 0; text-align: right; }
td:last-child b { font-size: 16px; }
tr.me td { background: var(--tint); }
tr.me td.pos { color: var(--accent); box-shadow: inset 3px 0 var(--accent); padding-left: 8px; }
tr:last-child td { border-bottom: 0; }

/* ---------- form ---------- */
.field { display: grid; gap: 4px; }
.field label { font-size: 12px; color: var(--muted); font-weight: 650; letter-spacing: .04em; }
.field select, .field input[type=text], .field input[type=email], .field input[type=search] {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg);
}
.field select:hover, .field input:hover { border-color: var(--muted); }
.picker { grid-template-columns: 1fr 1fr; }
.picker > .field:nth-child(n+3) { grid-column: 1 / -1; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; cursor: pointer; }
.switch + .switch { border-top: 1px solid var(--line); }
/* Anahtar: yerleşik onay kutusu, görünümü yuvarlak raya çevrilmiş (davranış ve erişilebilirlik aynı). */
.switch input {
  appearance: none; -webkit-appearance: none; flex: none; margin: 0; cursor: pointer;
  width: 48px; height: 28px; border-radius: 999px; border: 1px solid var(--muted);
  background: radial-gradient(circle at 13px 50%, var(--muted) 9px, transparent 10px) var(--bg);
  transition: background-position .15s;
}
.switch input:checked { border-color: var(--ink); background: radial-gradient(circle at 33px 50%, var(--ink-inv) 9px, transparent 10px) var(--ink); }
.switch input:disabled { opacity: .5; cursor: default; }

/* Hafta gezinmesi: iki yuvarlak düğme, ortada tarih aralığı. */
.week { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.week h2 { font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: .01em; }
.week button {
  background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; min-height: 44px;
  cursor: pointer; font-size: 14px; font-weight: 600;
}
.week button:hover { border-color: var(--muted); }

/* Lig başlıkları: açılır, ince ayırıcı; sayı sağda eşit genişlikli. */
details.card { border-top: 1px solid var(--line); padding-top: 0; }
details.card:not(:has(+ details)) { border-bottom: 1px solid var(--line); }
.week + details.card, .card + details.card { border-top-color: var(--rule); }
details summary { cursor: pointer; list-style: none; min-height: 56px; padding: 8px 0; }
details summary strong { font-size: 17px; font-weight: 700; }
details summary::-webkit-details-marker { display: none; }
summary .chev { color: var(--muted); font-size: 22px; transition: transform .15s; }
details[open] summary .chev { transform: rotate(90deg); }
details[open] > div { padding-bottom: 6px; }

/* Boş durum: küçük, ortalı, üstte kısa bir çizgi. */
.empty { text-align: center; padding: 36px 16px; color: var(--muted); border-top: 0; }
.empty::before { content: ""; display: block; width: 28px; height: 2px; margin: 0 auto 16px; background: var(--line); border-radius: 2px; }
.empty strong { display: block; color: var(--ink); font-size: 16px; font-weight: 700; margin-bottom: 4px; }
.empty .small { max-width: 30em; margin: 0 auto; }
.empty .btn { margin-top: 18px; }

.offline {
  max-width: calc(640px - 32px); margin: 12px auto 0; padding: 10px 14px 10px 30px; border-radius: 10px; font-size: 14px;
  border: 1px solid var(--line); color: var(--ink); width: calc(100% - 32px); position: relative;
}
.offline::before { content: ""; position: absolute; left: 13px; top: 17px; width: 8px; height: 8px; border-radius: 50%; background: var(--warn); }

/* Tema seçimi: çerçeveli üç parça; seçili olan mürekkep dolgulu. */
.choice { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; border: 1px solid var(--line); border-radius: 999px; margin: 4px 0 0; padding: 3px; }
.choice legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.choice label { display: grid; place-items: center; min-height: 44px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; }
.choice input { position: absolute; opacity: 0; }
.choice label:has(input:checked) { background: var(--ink); color: var(--ink-inv); }
.choice label:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.steps { margin: 0; padding-left: 20px; display: grid; gap: 4px; }
.note { font-size: 12px; color: var(--muted); }
.skeleton { height: 64px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, transparent, var(--line), transparent); background-size: 200% 100%; animation: sk 1.2s infinite linear; }
@keyframes sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .skeleton { animation: none; } .tabs a, summary .chev { transition: none; } }

/* Paylaşım menüsü (telefonun paylaşım ekranı yoksa): alttan açılan sayfa; üstte mürekkep çizgi, metnin önizlemesi. */
dialog.sheet {
  width: min(100%, 480px); max-width: 100%; margin: auto auto 0; padding: 16px var(--gutter) calc(20px + env(safe-area-inset-bottom, 0px));
  border: 0; border-top: 2px solid var(--rule); border-radius: var(--radius) var(--radius) 0 0;
  background: var(--card); color: var(--ink); box-shadow: var(--shadow);
}
dialog.sheet::backdrop { background: rgb(0 0 0 / .4); }
dialog.sheet h2 { margin: 0 0 8px; font-size: 19px; font-weight: 750; letter-spacing: -.01em; }
dialog.sheet .preview { margin: 0 0 12px; padding-left: 10px; border-left: 2px solid var(--line); white-space: pre-line; font-size: 14px; color: var(--muted); }
dialog.sheet .field { margin-bottom: 12px; }
dialog.sheet .field input { background: var(--card); color: var(--ink); font-size: 14px; }
dialog.sheet .stack { gap: 8px; }
@media (min-width: 700px) { dialog.sheet { margin: auto; border-radius: var(--radius); } }

.toast {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(84px + env(safe-area-inset-bottom, 0px));
  max-width: min(92vw, 420px); background: var(--ink); color: var(--ink-inv); padding: 10px 16px; border-radius: 12px;
  font-size: 14px; z-index: 10; box-shadow: var(--shadow);
}

@media (min-width: 700px) {
  main { padding-top: 28px; }
}

/* ---------- büyükler (TVF ligleri): altyapıdan ayrı bölüm; lig adı küçük başlık, maçlar aynı satır düzeninde ---------- */
.senior-league { margin-top: 14px; }
.senior-league > .section-title { padding-bottom: 6px; border-bottom: 1px solid var(--line); }
