/* İMO Tekirdağ — Halı Saha Turnuvası
   Görsel dil: teknik çizim paftası. Kağıt zemin, mürekkep çizgi, sentetik çim yeşili,
   ve revizyon kırmızısı yalnızca "canlı" ve dikkat gerektiren yerlerde. */

:root {
  --paper: #f3f5f2;
  --paper-2: #e9ede9;
  --ink: #1b2a33;
  --ink-soft: #5f6f76;
  --line: #cfd8d3;
  --grid: rgba(27, 42, 51, .055);
  --turf: #1f7a4d;
  --turf-soft: #dcefe4;
  --red: #d2382b;
  --red-soft: #fbe3df;
  --surface: #ffffff;
  --focus: #1f6fd1;
  --radius: 6px;
  --maxw: 1120px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f171b; --paper-2: #162127; --ink: #e6ece9; --ink-soft: #93a4a8; --line: #2a3a41;
    --grid: rgba(230, 236, 233, .045); --turf: #3fb57a; --turf-soft: #173529; --red: #ff6a5c;
    --red-soft: #3a1e1b; --surface: #131e23; --focus: #6aa8ff; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f171b; --paper-2: #162127; --ink: #e6ece9; --ink-soft: #93a4a8; --line: #2a3a41;
  --grid: rgba(230, 236, 233, .045); --turf: #3fb57a; --turf-soft: #173529; --red: #ff6a5c;
  --red-soft: #3a1e1b; --surface: #131e23; --focus: #6aa8ff; color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink);
  background-color: var(--paper);
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 24px 24px;
  font-variant-numeric: tabular-nums;
}
a { color: inherit; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 3px;
}
img { max-width: 100%; display: block; }
h1, h2, h3 { line-height: 1.1; margin: 0; font-weight: 800; }
p { margin: 0; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 16px; }

/* ─── Üst bar ─── */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar .wrap { display: flex; align-items: center; gap: 16px; min-height: 60px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand-mark { width: 34px; height: 34px; flex: none; }
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-text strong { font-size: 15px; font-weight: 800; font-stretch: 112%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand-text span { font-size: 12px; color: var(--ink-soft); white-space: nowrap; }
.nav { display: flex; gap: 2px; margin-left: auto; }
.nav a {
  text-decoration: none; font-size: 14px; font-weight: 600; padding: 8px 11px; border-radius: var(--radius);
  color: var(--ink-soft); white-space: nowrap;
}
.nav a:hover { color: var(--ink); background: var(--paper-2); }
.nav a[aria-current="page"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 -2px 0 var(--turf); }
.theme-btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--ink); width: 36px; height: 36px;
  border-radius: var(--radius); cursor: pointer; flex: none; display: grid; place-items: center;
}

@media (max-width: 900px) {
  .topbar .wrap { flex-wrap: wrap; gap: 0 12px; }
  .theme-btn { margin-left: auto; }
  .nav {
    order: 3; width: calc(100% + 32px); margin: 0 -16px; padding: 0 12px 8px; overflow-x: auto;
    scrollbar-width: none;
  }
  .nav::-webkit-scrollbar { display: none; }
}

main { padding: 28px 0 64px; min-height: 60vh; }

/* ─── Hero: pafta ─── */
.sheet {
  position: relative; background: var(--surface);
  border: 1.5px solid var(--ink); outline: 1px solid var(--ink); outline-offset: 5px;
  margin: 8px 6px 40px;
  display: grid; grid-template-columns: minmax(0, 1fr) 320px;
}
.sheet-drawing { padding: 28px 28px 20px; border-right: 1.5px solid var(--ink); min-width: 0; }
.sheet-drawing h1 {
  font-size: clamp(34px, 6.2vw, 68px); font-weight: 900; font-stretch: 125%; letter-spacing: -.02em;
  line-height: .95; max-width: 13ch;
}
.sheet-drawing .lede { margin-top: 14px; font-size: 18px; color: var(--ink-soft); max-width: 46ch; }
.pitch-plan { margin-top: 22px; width: 100%; height: auto; color: var(--ink); }
.pitch-plan .turf { fill: var(--turf-soft); }
.pitch-plan .stroke { stroke: var(--turf); }
.pitch-plan .dim { stroke: var(--ink-soft); }
.pitch-plan text { fill: var(--ink-soft); font-family: var(--font); font-size: 11px; font-weight: 600; }
.pitch-plan .ball { fill: var(--red); }

.titleblock { display: flex; flex-direction: column; font-size: 14px; }
.titleblock .cell { border-bottom: 1px solid var(--ink); padding: 10px 14px; }
.titleblock .cell:last-child { border-bottom: 0; }
.titleblock .k { display: block; font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.titleblock .v { display: block; font-weight: 700; margin-top: 1px; }
.titleblock .v.big { font-size: 20px; font-stretch: 112%; font-weight: 800; }
.titleblock .row2 { display: grid; grid-template-columns: 1fr 1fr; }
.titleblock .row2 > div + div { border-left: 1px solid var(--ink); }
.titleblock .row2 > div { padding: 10px 14px; }
.countdown { display: flex; gap: 14px; margin-top: 6px; }
.countdown div { display: flex; flex-direction: column; }
.countdown b { font-size: 28px; font-weight: 800; font-stretch: 112%; line-height: 1; }
.countdown small { font-size: 11px; color: var(--ink-soft); margin-top: 4px; }
.titleblock .cta { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px; margin-top: auto; }

@media (max-width: 860px) {
  .sheet { grid-template-columns: 1fr; }
  .sheet-drawing { border-right: 0; border-bottom: 1.5px solid var(--ink); padding: 22px 18px 16px; }
}

/* ─── Butonlar ─── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px;
  padding: 0 16px; border-radius: var(--radius); border: 1.5px solid var(--ink); background: var(--ink);
  color: var(--paper); font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer;
}
.btn:hover { filter: brightness(1.12); }
.btn.ghost { background: transparent; color: var(--ink); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ─── Bölümler ─── */
.section { margin-top: 44px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.section-head h2 { font-size: 24px; font-stretch: 112%; }
.section-head a { font-size: 14px; font-weight: 600; color: var(--turf); text-decoration: none; }
.section-head a:hover { text-decoration: underline; }
.page-title { font-size: clamp(30px, 5vw, 44px); font-weight: 900; font-stretch: 120%; letter-spacing: -.015em; }
.page-sub { color: var(--ink-soft); margin-top: 6px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: 1fr; gap: 0; } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.muted { color: var(--ink-soft); }
.empty { padding: 28px 18px; text-align: center; color: var(--ink-soft); }

/* ─── Maç satırı ─── */
.match-list { list-style: none; margin: 0; padding: 0; }
.match {
  display: grid; grid-template-columns: 74px minmax(0, 1fr) 76px minmax(0, 1fr) 70px; align-items: center; gap: 10px;
  padding: 12px 14px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit;
}
.match-list li:last-child .match { border-bottom: 0; }
a.match:hover { background: var(--paper-2); }
.match .when { font-size: 13px; color: var(--ink-soft); line-height: 1.25; }
.match .when b { display: block; color: var(--ink); font-size: 15px; }
.match .team { display: flex; align-items: center; gap: 8px; font-weight: 700; min-width: 0; }
.match .team span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.match .team.home { justify-content: flex-end; text-align: right; }
.match .team.won { color: var(--ink); }
.match .team.lost { color: var(--ink-soft); font-weight: 600; }
.match .score {
  text-align: center; font-size: 20px; font-weight: 800; font-stretch: 112%;
  background: var(--paper-2); border-radius: var(--radius); padding: 4px 0; line-height: 1.2;
}
.match .score.pending { font-size: 14px; font-weight: 600; color: var(--ink-soft); background: transparent; border: 1px dashed var(--line); }
.match .score.live { background: var(--red-soft); color: var(--red); }
.match .score small { display: block; font-size: 11px; font-weight: 600; color: var(--ink-soft); }
.match .where { font-size: 12px; color: var(--ink-soft); text-align: right; }
.chip { width: 12px; height: 12px; border-radius: 3px; flex: none; box-shadow: inset 0 0 0 1px rgba(0,0,0,.15); }
.chip.lg { width: 18px; height: 18px; border-radius: 4px; }
.live-dot { display: inline-flex; align-items: center; gap: 5px; color: var(--red); font-weight: 700; font-size: 12px; }
.live-dot::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--red); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .live-dot::before { animation: none; } }

/* Dar kapsayıcıda (mobil veya iki sütunlu ana sayfa) kompakt maç satırı */
.match-list { container-type: inline-size; }
@container (max-width: 560px) {
  .match { grid-template-columns: minmax(0, 1fr) 64px minmax(0, 1fr); row-gap: 6px; padding: 12px; }
  .match .when { grid-column: 1 / -1; display: flex; gap: 8px; align-items: baseline; }
  .match .when b { display: inline; font-size: 13px; }
  .match .where { display: none; }
  .match .team { font-size: 14px; }
  .match .score { font-size: 18px; }
}

/* ─── Tablolar ─── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th {
  text-align: center; font-size: 12px; font-weight: 700; color: var(--ink-soft);
  padding: 10px 8px; border-bottom: 1.5px solid var(--ink); white-space: nowrap;
}
table.data td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
table.data tr:last-child td { border-bottom: 0; }
table.data .l { text-align: left; }
table.data .team-cell { display: flex; align-items: center; gap: 9px; font-weight: 700; }
table.data .team-cell a { text-decoration: none; }
table.data .team-cell a:hover { text-decoration: underline; }
table.data .pts { font-weight: 800; font-size: 16px; }
table.data .pos { width: 40px; font-weight: 800; }
table.data tr.q .pos { color: var(--turf); box-shadow: inset 3px 0 0 var(--turf); }
table.data tr.cut td { border-bottom: 2px dashed var(--turf); }
table.data .hide-sm { }
@media (max-width: 600px) {
  table.data { font-size: 14px; }
  table.data .hide-sm { display: none; }
  table.data td, table.data th { padding: 9px 5px; }
}
.form { display: inline-flex; gap: 3px; }
.form i {
  font-style: normal; width: 20px; height: 20px; border-radius: 4px; display: grid; place-items: center;
  font-size: 11px; font-weight: 800; color: #fff;
}
.form .G { background: var(--turf); } .form .B { background: #8a979c; } .form .M { background: var(--red); }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 13px; color: var(--ink-soft); margin-top: 12px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend .sw { width: 12px; height: 12px; border-radius: 2px; background: var(--turf); }

/* ─── Gol krallığı ─── */
.scorer-lead {
  display: grid; grid-template-columns: auto 1fr auto; gap: 18px; align-items: center;
  padding: 22px; border: 1.5px solid var(--ink); background: var(--surface); border-radius: var(--radius);
  margin-bottom: 20px;
}
.scorer-lead .n { font-size: 64px; font-weight: 900; font-stretch: 125%; line-height: .9; }
.scorer-lead h2 { font-size: 26px; font-stretch: 112%; }
.scorer-lead .jersey {
  width: 64px; height: 64px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  font-weight: 900; font-size: 26px; font-stretch: 112%;
}
.bar { height: 6px; background: var(--paper-2); border-radius: 3px; overflow: hidden; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--turf); }

/* ─── Takımlar ─── */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.team-tile {
  display: flex; align-items: center; gap: 14px; padding: 16px; text-decoration: none;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  border-left: 6px solid var(--c, var(--turf));
}
.team-tile:hover { border-color: var(--ink); border-left-color: var(--c); }
.team-tile .badge {
  width: 46px; height: 46px; border-radius: 8px; background: var(--c); color: #fff; display: grid; place-items: center;
  font-weight: 900; font-size: 14px; font-stretch: 112%; flex: none; overflow: hidden;
}
.team-tile .badge img { width: 100%; height: 100%; object-fit: cover; }
.team-tile strong { display: block; font-size: 17px; }
.team-tile small { color: var(--ink-soft); font-size: 13px; }

.team-hero { display: flex; gap: 18px; align-items: center; padding-bottom: 20px; border-bottom: 1.5px solid var(--ink); }
.team-hero .badge {
  width: 76px; height: 76px; border-radius: 12px; background: var(--c); color: #fff; display: grid; place-items: center;
  font-weight: 900; font-size: 22px; font-stretch: 112%; flex: none; overflow: hidden;
}
.team-hero .badge img { width: 100%; height: 100%; object-fit: cover; }
.statline { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); margin: 20px 0 0; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.statline div { padding: 12px 14px; border-right: 1px solid var(--line); }
.statline div:last-child { border-right: 0; }
.statline b { display: block; font-size: 24px; font-weight: 800; font-stretch: 112%; }
.statline small { color: var(--ink-soft); font-size: 12px; }
.num-badge {
  display: inline-grid; place-items: center; min-width: 30px; height: 26px; border-radius: 5px; padding: 0 5px;
  background: var(--paper-2); font-weight: 800; font-size: 13px;
}
.cap { font-size: 11px; font-weight: 800; background: var(--ink); color: var(--paper); border-radius: 3px; padding: 1px 5px; margin-left: 6px; }
.role-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .02em; text-transform: uppercase;
  color: var(--ink-soft); border: 1px solid var(--line); border-radius: 3px; padding: 1px 6px; margin-left: 6px;
}
.role-tag.sub { color: var(--ink-soft); background: var(--paper-2); }
.squad-group { margin-bottom: 18px; }
.squad-group h3 { font-size: 13px; font-weight: 700; color: var(--ink-soft); margin-bottom: 8px; text-transform: uppercase; letter-spacing: .04em; }

/* ─── Eleme ağacı ─── */
.bracket { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0 36px; }
.bracket .col { display: flex; flex-direction: column; }
.bracket .col h3 { font-size: 14px; color: var(--ink-soft); font-weight: 700; margin-bottom: 10px; }
.bracket .slots { flex: 1; display: flex; flex-direction: column; justify-content: space-around; gap: 16px; }
.tie {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; display: block;
}
.tie:hover { border-color: var(--ink); }
.tie .side { display: flex; align-items: center; gap: 8px; padding: 9px 12px; font-weight: 700; }
.tie .side + .side { border-top: 1px solid var(--line); }
.tie .side .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tie .side.tbd .nm { color: var(--ink-soft); font-weight: 500; font-style: italic; }
.tie .side.win .nm { color: var(--turf); }
.tie .side.out { color: var(--ink-soft); }
.tie .side .sc { font-weight: 800; min-width: 22px; text-align: right; }
.tie .side .pk { font-size: 11px; color: var(--ink-soft); font-weight: 600; }
.tie .meta { font-size: 12px; color: var(--ink-soft); padding: 6px 12px; border-top: 1px dashed var(--line); }
.bracket .col:not(:last-child) .tie::after {
  content: ''; position: absolute; right: -19px; top: 50%; width: 18px; border-top: 1.5px solid var(--line);
}
.bracket .col.final .tie { border: 1.5px solid var(--ink); }
.seed { font-size: 11px; color: var(--ink-soft); font-weight: 600; width: 16px; }
@media (max-width: 760px) {
  .bracket { grid-template-columns: 1fr; gap: 24px; }
  .bracket .col:not(:last-child) .tie::after { display: none; }
}

/* ─── Sekme / filtre ─── */
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 18px 0; }
.tabs button {
  font: inherit; font-size: 14px; font-weight: 600; padding: 7px 13px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft);
}
.tabs button[aria-pressed="true"] { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.round-title { font-size: 16px; font-weight: 800; margin: 26px 0 10px; display: flex; gap: 10px; align-items: baseline; }
.round-title small { font-weight: 500; color: var(--ink-soft); font-size: 13px; }

/* ─── Format akışı ─── */
.flow { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); counter-reset: step; border: 1.5px solid var(--ink); background: var(--surface); }
.flow li { list-style: none; padding: 18px; border-right: 1px solid var(--line); counter-increment: step; }
.flow li:last-child { border-right: 0; }
.flow li::before { content: counter(step); display: block; font-size: 13px; font-weight: 800; color: var(--turf); margin-bottom: 6px; }
.flow b { display: block; font-size: 17px; font-stretch: 112%; }
.flow p { font-size: 14px; color: var(--ink-soft); margin-top: 4px; }
@media (max-width: 760px) {
  .flow { grid-template-columns: 1fr 1fr; }
  .flow li:nth-child(2) { border-right: 0; }
  .flow li:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
.rules { margin: 0; padding-left: 20px; }
.rules li { padding: 5px 0; }

/* ─── Maç detayı ─── */
.scoreboard { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; padding: 28px 16px; text-align: center; }
.scoreboard .side { display: flex; flex-direction: column; align-items: center; gap: 10px; text-decoration: none; }
.scoreboard .side strong { font-size: 18px; }
.scoreboard .big { font-size: clamp(44px, 10vw, 72px); font-weight: 900; font-stretch: 125%; line-height: 1; }
.scoreboard .pens { font-size: 14px; color: var(--ink-soft); margin-top: 6px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: grid; grid-template-columns: 1fr 52px 1fr; padding: 8px 0; border-bottom: 1px solid var(--line); align-items: center; }
.timeline li:last-child { border-bottom: 0; }
.timeline .min { text-align: center; font-weight: 800; font-size: 13px; color: var(--ink-soft); }
.timeline .h { text-align: right; padding-right: 8px; }
.timeline .a { padding-left: 8px; }
.og { font-size: 11px; color: var(--red); font-weight: 700; margin-left: 4px; }

/* ─── Footer ─── */
footer { border-top: 1px solid var(--line); padding: 28px 0 40px; font-size: 14px; color: var(--ink-soft); }
footer .wrap { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
footer a { color: var(--ink); }

.skeleton { height: 160px; border-radius: var(--radius); background: linear-gradient(90deg, var(--paper-2), var(--surface), var(--paper-2)); 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; } }

.jersey {
  width: 64px; height: 64px; border-radius: 10px; display: grid; place-items: center; color: #fff;
  font-weight: 900; font-size: 22px; font-stretch: 112%; background: var(--c, var(--turf)); overflow: hidden; flex: none;
}
.jersey img { width: 100%; height: 100%; object-fit: cover; }

.sub-team { display: none; font-size: 13px; }
@media (max-width: 600px) { .sub-team { display: block; } }

@media (max-width: 600px) {
  .statline div { padding: 10px 8px; }
  .statline b { font-size: 18px; }
  .statline small { font-size: 11px; }
}
