/* Turbokoşu ortak site katmanı (Faz 3): SSR sayfaları (tahminler, hipodrom, at, tutan tahminler),
   yasal sayfalar ve 404 aynı üst bar, menü, renk token'ları, düğmeler ve alt bilgiyi buradan alır.
   Token'lar style.css'teki SPA token'larının birebir kopyasıdır (açık varsayılan; koyu: sistem tercihi
   ya da data-theme="dark"). Token değişirse iki dosyada da güncelleyin (tests/test_faz3.py denetler). */

/* ---------- Yazı tipi: Archivo (SIL Open Font License 1.1), sitede barındırılır ----------
   Google Fonts'a istek gitmez (IP aktarımı yok, render engelleyen dış CSS yok). Değişken ağırlık 400–700. */
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/archivo-latin-ext.woff2?v=25") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: "Archivo"; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url("fonts/archivo-latin.woff2?v=25") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

/* ---------- Token'lar ---------- */
:root {
  --bg: #eef0f3;
  --surface: #f5f6f8;
  --card: #fbfbfc;
  --raised: #e4e7ec;
  --border: #c9ced6;
  --border-strong: #aab2bd;
  --text: #0f172a;
  --muted: #1e293b;
  --dim: #334155;
  --odds: #11151b;
  --brand: #5b36a3;
  --brand-strong: #472786;
  --brand-subtle: #ebe4f7;
  --brand-line: #8b6cc9;
  --accent: var(--brand);
  --accent-soft: var(--brand-subtle);
  --accent-line: var(--brand-line);
  --accent-subtle: var(--brand-subtle);
  --accent-strong: var(--brand-strong);
  --pos: #136b45;
  --neg: #b0322a;
  --pos-ink: #0b4a2e;
  --pos-tint: #d7efe1;
  --neg-ink: #7a1d16;
  --neg-tint: #f8dcd8;
  --fav: #1d5fbf;
  --fav-ink: #123e80;
  --fav-tint: #dbe7fb;
  --tr: #b3121f;
  --us: #1f3a7a;
  --other: #3d4654;
  --badge-ink: #fbfbfc;
  --wm-opacity: 0.16;
  --bar: #9aa6b5;
  --focus: var(--brand-strong);

  --brand-alpha: rgba(91, 54, 163, 0.12);
  --line: var(--border);
  --hover: var(--raised);
  --surface-hover: var(--raised);
  --text-muted: var(--muted);
  --bg-alt: var(--surface);

  --brand-logo-fill: #7c3aed;
  --brand-logo-glow: drop-shadow(0 1px 3px rgba(124, 58, 237, 0.35));
  --brand-box-border: rgba(124, 58, 237, 0.65);
  --brand-box-glow: 0 0 10px rgba(124, 58, 237, 0.25);
  --brand-box-glow-pulse: 0 0 18px rgba(124, 58, 237, 0.5);
  --brand-accent-color: #6d28d9;
  --brand-accent-glow: none;
  --brand-name-shadow: none;
  --brand-notice-color: #5b36a3;

  --font: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 0.75rem;
  --radius-sm: 0.5rem;
  --tap: 2.75rem; /* 44px */
  --topbar-h: 4.875rem; /* ~78px: %50 büyütülmüş ferah üst panel */
  --tabbar-h: 3.5rem;
  --ticker-h: 2.75rem; /* 44px: dokunma alanı */
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14181d;
    --surface: #181d23;
    --card: #1d232b;
    --raised: #262d37;
    --border: #2e3641;
    --border-strong: #3a4350;
    --text: #ffffff;
    --muted: #cbd5e1;
    --dim: #94a3b8;
    --odds: #f1f3f5;
    --brand: #b7a3f5;
    --brand-strong: #d4c6fb;
    --brand-subtle: #2e2640;
    --brand-line: #8a75cc;
    --accent: var(--brand);
    --accent-soft: var(--brand-subtle);
    --accent-line: var(--brand-line);
    --accent-subtle: var(--brand-subtle);
    --accent-strong: var(--brand-strong);
    --pos: #74d3a0;
    --neg: #f39486;
    --pos-ink: #a6f0c6;
    --pos-tint: #163a2a;
    --neg-ink: #ffc2b8;
    --neg-tint: #44221f;
    --fav: #7fb0ff;
    --fav-ink: #b9d3ff;
    --fav-tint: #17284a;
    --tr: #b3121f;
    --us: #1f3a7a;
    --other: #3d4654;
    --badge-ink: #fbfbfc;
    --wm-opacity: 0.12;
    --bar: #5b6676;
    --focus: var(--brand-strong);
    --brand-logo-fill: #c084fc;
    --brand-logo-glow: drop-shadow(0 0 8px rgba(192, 132, 252, 0.75));
    --brand-box-border: rgba(168, 85, 247, 0.75);
    --brand-box-glow: 0 0 12px rgba(168, 85, 247, 0.4);
    --brand-box-glow-pulse: 0 0 20px rgba(168, 85, 247, 0.65);
    --brand-accent-color: #c084fc;
    --brand-accent-glow: 0 0 10px rgba(192, 132, 252, 0.6);
    --brand-name-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
    --brand-notice-color: #c4b5fd;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #14181d;
  --surface: #181d23;
  --card: #1d232b;
  --raised: #262d37;
  --border: #2e3641;
  --border-strong: #3a4350;
  --text: #ffffff;
  --muted: #cbd5e1;
  --dim: #94a3b8;
  --odds: #f1f3f5;
  --brand: #b7a3f5;
  --brand-strong: #d4c6fb;
  --brand-subtle: #2e2640;
  --brand-line: #8a75cc;
  --accent: var(--brand);
  --accent-soft: var(--brand-subtle);
  --accent-line: var(--brand-line);
  --accent-subtle: var(--brand-subtle);
  --accent-strong: var(--brand-strong);
  --pos: #74d3a0;
  --neg: #f39486;
  --pos-ink: #a6f0c6;
  --pos-tint: #163a2a;
  --neg-ink: #ffc2b8;
  --neg-tint: #44221f;
  --fav: #7fb0ff;
  --fav-ink: #b9d3ff;
  --fav-tint: #17284a;
  --tr: #b3121f;
  --us: #1f3a7a;
  --badge-ink: #fbfbfc;
  --wm-opacity: 0.12;
  --bar: #5b6676;
  --focus: var(--brand-strong);
  --brand-logo-fill: #c084fc;
  --brand-logo-glow: drop-shadow(0 0 8px rgba(192, 132, 252, 0.75));
  --brand-box-border: rgba(168, 85, 247, 0.75);
  --brand-box-glow: 0 0 12px rgba(168, 85, 247, 0.4);
  --brand-box-glow-pulse: 0 0 20px rgba(168, 85, 247, 0.65);
  --brand-accent-color: #c084fc;
  --brand-accent-glow: 0 0 10px rgba(192, 132, 252, 0.6);
  --brand-name-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  --brand-notice-color: #c4b5fd;
  color-scheme: dark;
}

/* Birincil düğme (SPA ile aynı mor; koyu temada açık mor zemin + koyu yazı, kontrast ≥ 4.5:1) */
:root { --btn-primary-bg: #5b36a3; --btn-primary-ink: #ffffff; --amber-ink: #7c3a03; --amber-tint: #fdecc8; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --btn-primary-bg: #b7a3f5; --btn-primary-ink: #14181d; --amber-ink: #fcd34d; --amber-tint: #3d2c0b; } }
:root[data-theme="dark"] { --btn-primary-bg: #b7a3f5; --btn-primary-ink: #14181d; --amber-ink: #fcd34d; --amber-tint: #3d2c0b; }

/* ---------- Temel ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-x: clip; }
body.site {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: 1rem; line-height: 1.55;
  -webkit-font-smoothing: antialiased; overflow-wrap: break-word; overflow-x: clip;
}
body.site :focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip-link { position: absolute; left: 0.5rem; top: -3rem; z-index: 100; padding: 0.5rem 0.75rem; background: var(--card); color: var(--text); border-radius: var(--radius-sm); }
.skip-link:focus { top: 0.5rem; }

/* ---------- Üst bar (SPA ile aynı marka + etiketli menü) ---------- */
.site-head {
  position: sticky; top: 0; z-index: 50;
  background: var(--card); border-bottom: 1px solid var(--border);
}
.site-head-in {
  max-width: 72rem; margin: 0 auto; padding: 0.5rem 1rem;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 1rem;
}
.site-brand {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 2.75rem;
  color: var(--text); text-decoration: none; font-weight: 800; font-size: 1.25rem; letter-spacing: -0.01em;
}
.site-mark {
  display: inline-block; width: 2.5rem; height: 1.6rem; flex: none;
  background: var(--brand-logo-fill);
  -webkit-mask: url("/brand/mark.svg") center / contain no-repeat; mask: url("/brand/mark.svg") center / contain no-repeat;
}
.site-brand .accent { color: var(--brand-accent-color); }
.site-brand .name { color: var(--text); }
.site-nav { display: flex; flex-wrap: wrap; gap: 0.25rem; margin-left: auto; }
.site-nav a {
  display: inline-flex; align-items: center; min-height: 2.75rem; padding: 0 0.75rem;
  border-radius: var(--radius-sm); border: 1px solid transparent;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: 0.9375rem;
}
.site-nav a:hover { background: var(--raised); }
.site-nav a[aria-current="page"] { background: var(--brand-subtle); border-color: var(--brand-line); color: var(--brand-strong); }
.site-head-cta { min-height: 2.5rem; padding: 0 0.875rem; font-size: 0.9375rem; }
@media (max-width: 47.99rem) {
  .site-head-in { padding: 0.375rem 0.75rem; }
  .site-head-cta { order: 2; margin-left: auto; }
  .site-nav { order: 3; }
  .site-nav { margin-left: 0; width: 100%; gap: 0.125rem 0.25rem; }
  .site-nav a { min-height: 2.5rem; padding: 0 0.5rem; font-size: 0.9375rem; white-space: nowrap; }
}

/* ---------- 18+ / bahis oynatılmaz şeridi (her sayfada kalıcı) ---------- */
.yas-bandi {
  margin: 0; padding: 0.5rem 1rem; text-align: center;
  background: var(--brand-subtle); color: var(--text); border-bottom: 1px solid var(--border);
  font-size: 0.875rem; line-height: 1.4;
}
.yas-bandi strong { font-weight: 800; }

/* ---------- Düğmeler ---------- */
.site-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 2.75rem; padding: 0 1rem; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--card); color: var(--text);
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.site-btn:hover { border-color: var(--brand-line); text-decoration: none; }
.site-btn-primary { background: var(--btn-primary-bg); color: var(--btn-primary-ink); border-color: transparent; }

/* ---------- Alt bilgi ---------- */
.site-foot {
  margin-top: auto; padding: 1.5rem 1rem 2rem; border-top: 1px solid var(--border);
  background: var(--surface); color: var(--muted); font-size: 0.9375rem; text-align: center;
}
.site-foot p { margin: 0.25rem auto; max-width: 48rem; }
.site-foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 0.25rem 0.75rem; margin: 0.5rem 0; }
.site-foot-links a { display: inline-flex; align-items: center; min-height: 2rem; color: var(--text); }

/* ---------- Çerez şeridi (cerez.js; style.css ile aynı kurallar) ---------- */
.cerez-bar {
  position: fixed; z-index: 45;
  left: max(0.75rem, env(safe-area-inset-left)); right: max(0.75rem, env(safe-area-inset-right));
  bottom: calc(env(safe-area-inset-bottom) + 0.75rem);
  max-width: 40rem; margin: 0 auto;
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem;
  padding: 0.75rem 0.875rem;
  background: var(--card); color: var(--text);
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 0.5rem 1.5rem rgba(10, 12, 16, 0.25);
}
.cerez-text { flex: 1 1 16rem; margin: 0; font-size: 0.875rem; line-height: 1.45; color: var(--muted); }
.cerez-text a { color: var(--brand); font-weight: 600; }
.cerez-text code { font-size: 0.8125rem; }
.cerez-actions { display: flex; gap: 0.5rem; flex: 0 0 auto; margin-left: auto; }
.cerez-btn {
  min-height: var(--tap); min-width: 5.5rem; padding: 0 1.125rem;
  border: 1px solid var(--brand-strong); border-radius: var(--radius-sm);
  font: inherit; font-weight: 700; font-size: 1rem; cursor: pointer;
}
/* Kabul ve Reddet eşit büyüklükte (reddetmek kabul etmek kadar kolay olmalı) */
.cerez-ok { background: var(--brand-strong); color: var(--card); }
.cerez-red { background: var(--card); color: var(--brand-strong); }
.cerez-btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
@media (min-width: 64rem) {
  .cerez-bar-app { bottom: calc(var(--ticker-h) + 0.75rem); }
}

/* ---------- Yasal sayfa / 404 gövdesi ---------- */
.site-main { width: 100%; max-width: 72rem; margin: 0 auto; padding: 1rem; flex: 1 0 auto; }
.legal-body { max-width: 44rem; margin: 0 auto; padding: 0.5rem 0 2rem; line-height: 1.6; }
.legal-body h1 { font-size: 1.5rem; margin: 0.75rem 0 0.25rem; }
.legal-body h2 { font-size: 1.125rem; margin: 1.5rem 0 0.375rem; }
.legal-body ul { padding-left: 1.25rem; display: grid; gap: 0.25rem; }
.legal-body .meta { color: var(--muted); font-size: 0.9375rem; }
.legal-body a { color: var(--brand-strong); }

/* SSR: değeri olmayan oran / AGF hücresi ("—" yerine okunur etiket) ve boş analiz notu */
.veri-yok { color: var(--muted); font-weight: 500; font-size: 0.875em; font-family: var(--font); }
.race-no-analysis { margin: 0.5rem 0 0.75rem; padding: 0.625rem 0.875rem; border: 1px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--muted); font-size: 0.9375rem; }
.yas-bandi p { margin: 0; }
