/* =====================================================================
   HoopLife NBA - tasarim sistemi
   Tek tema (koyu). Renkler tek yerde; sayfalar yalnizca bu
   degiskenleri kullanir. Isletim sisteminin acik/koyu ayarina
   bakilmiyor: eski surumde "prefers-color-scheme" yuzunden acik
   modda beyaz zemine beyaz yazi cikiyordu.
   ===================================================================== */
:root {
  color-scheme: dark;
  --bg: #0B0F17;
  --surface: #131926;
  --surface-2: #1A2130;
  --surface-3: #222B3D;
  --line: rgba(255, 255, 255, .08);
  --line-strong: rgba(255, 255, 255, .14);
  --text: #E8ECF4;
  --muted: #9AA6BD;
  --dim: #6B7893;
  --brand: #D0112B;
  --brand-hover: #E0253E;
  --accent: #3987E5;
  --accent-soft: rgba(57, 135, 229, .16);
  --good: #34D399;
  --good-soft: rgba(52, 211, 153, .14);
  --warn: #F5B544;
  --warn-soft: rgba(245, 181, 68, .14);
  --bad: #EF6464;
  --bad-soft: rgba(239, 100, 100, .14);
  --gold: #F2C94C;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, .35);
  --sidebar: 252px;
  --topbar: 56px;
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 15px/1.5 var(--font); -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
img { max-width: 100%; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0 0 .5rem; line-height: 1.2; letter-spacing: -.02em; }
h1 { font-size: 1.7rem; font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 800; margin-top: 1.6rem; }
h3 { font-size: 1.02rem; font-weight: 700; }
p { margin: 0 0 .8rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.4rem 0; }
.muted { color: var(--muted); }
.dim { color: var(--dim); }
.small { font-size: .84rem; }
.tiny { font-size: .76rem; }
.nowrap { white-space: nowrap; }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); }
.center { text-align: center; }
.right { text-align: right; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ==================== YERLESIM ==================== */
.topbar {
  display: none; position: sticky; top: 0; z-index: 40; height: var(--topbar);
  align-items: center; gap: 8px; padding: 0 8px env(safe-area-inset-right) 8px;
  padding-top: env(safe-area-inset-top);
  background: rgba(11, 15, 23, .94); backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px); border-bottom: 1px solid var(--line);
}
.topbar-brand { display: flex; align-items: center; gap: 8px; font-weight: 800;
  color: var(--text); font-size: 1rem; margin-right: auto; }
.topbar-brand:hover { text-decoration: none; }
.topbar-signin { font-weight: 700; font-size: .9rem; padding: 8px 12px; }
.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; border-radius: 10px; border: 0; background: transparent;
  color: var(--text); cursor: pointer;
}
.icon-btn:hover { background: var(--surface-2); }

.drawer {
  position: fixed; inset: 0 auto 0 0; width: var(--sidebar); z-index: 60;
  background: #0E131D; border-right: 1px solid var(--line);
  display: flex; flex-direction: column; overflow-y: auto; overscroll-behavior: contain;
  padding: 14px 12px calc(16px + env(safe-area-inset-bottom));
}
.drawer-head { display: flex; align-items: center; justify-content: center; position: relative; margin-bottom: 8px; }
.drawer-logo img { display: block; width: 96px; height: 96px; object-fit: contain; }
.drawer-close { display: none; position: absolute; right: 0; top: 0; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-link {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  min-height: 42px; padding: 9px 12px; border-radius: 10px; color: var(--muted);
  font-weight: 600; font-size: .93rem; width: 100%; text-align: left;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--surface-3); color: var(--text); box-shadow: inset 3px 0 0 var(--brand); }
.nav-button { border: 0; background: transparent; font: inherit; cursor: pointer; }
.nav-sep { height: 1px; background: var(--line); margin: 10px 6px; }
.drawer-user { margin-top: auto; padding-top: 16px; display: flex; flex-direction: column; gap: 6px; }
.user-card { border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 12px; margin-bottom: 4px; }
.user-name { font-weight: 800; }
.user-mail { color: var(--muted); font-size: .8rem; margin: 2px 0 8px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.main {
  margin-left: var(--sidebar); padding: 28px 32px 24px; max-width: calc(1240px + var(--sidebar));
  min-height: 100vh; display: flex; flex-direction: column;
}
.main > .footer { margin-top: auto; }
.footer { display: flex; gap: 16px; flex-wrap: wrap; padding: 28px 0 8px; color: var(--dim); font-size: .8rem; }
.footer a { color: var(--dim); }
.scrim { position: fixed; inset: 0; background: rgba(0, 0, 0, .55); z-index: 55; }

@media (max-width: 960px) {
  .topbar { display: flex; }
  .drawer { transform: translateX(-100%); transition: transform .22s ease; width: min(86vw, 320px); box-shadow: var(--shadow); }
  .drawer.is-open { transform: none; }
  .drawer-close { display: inline-flex; }
  .drawer-logo img { width: 72px; height: 72px; }
  .main { margin-left: 0; padding: 18px 14px 20px; padding-left: max(14px, env(safe-area-inset-left)); padding-right: max(14px, env(safe-area-inset-right)); }
  h1 { font-size: 1.4rem; }
  h2 { font-size: 1.12rem; }
}
body.no-scroll { overflow: hidden; }

/* ==================== BILESENLER ==================== */
.page-head { margin-bottom: 18px; }
.page-head p { color: var(--muted); max-width: 720px; margin: 0; }
.eyebrow { font-size: .72rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); margin-bottom: 6px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.card-title { font-weight: 800; margin-bottom: 8px; }
.card.tight { padding: 12px; }
.grid { display: grid; gap: 12px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-auto { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
@media (max-width: 960px) { .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); } }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.spacer { height: 16px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line-strong);
  background: var(--surface-2); color: var(--text); font: 600 .92rem var(--font);
  cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--surface-3); text-decoration: none; }
.btn:disabled, .btn.is-loading { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-ghost { background: transparent; }
.btn-danger { background: transparent; border-color: rgba(239, 100, 100, .45); color: var(--bad); }
.btn-danger:hover { background: var(--bad-soft); }
.btn-sm { min-height: 36px; padding: 6px 12px; font-size: .84rem; }
.btn-block { width: 100%; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.seg { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.seg a, .seg button, .seg label {
  display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 6px 14px;
  border-radius: 9px; color: var(--muted); font: 600 .88rem var(--font); background: transparent; border: 0; cursor: pointer;
}
.seg a:hover, .seg button:hover, .seg label:hover { color: var(--text); text-decoration: none; }
.seg .is-on, .seg input:checked + span { background: var(--surface-3); color: var(--text); }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg label { position: relative; padding: 0; }
.seg label span { display: inline-flex; align-items: center; min-height: 38px; padding: 6px 14px; border-radius: 9px; }
.seg-block { display: flex; }
.seg-block > * { flex: 1; }

.chip { display: inline-flex; align-items: center; font-size: .66rem; font-weight: 800; letter-spacing: .08em; padding: 3px 8px; border-radius: 999px; background: var(--surface-3); color: var(--muted); }
.chip-pro { background: rgba(242, 201, 76, .16); color: var(--gold); }
.chip-free { background: rgba(255, 255, 255, .07); color: var(--muted); }
.chip-good { background: var(--good-soft); color: var(--good); }
.chip-bad { background: var(--bad-soft); color: var(--bad); }
.chip-warn { background: var(--warn-soft); color: var(--warn); }
.chip-accent { background: var(--accent-soft); color: #8FBDF2; }

.flash { border-radius: 12px; padding: 12px 14px; margin-bottom: 16px; font-weight: 600; border: 1px solid; }
.flash-ok { background: var(--good-soft); border-color: rgba(52, 211, 153, .35); color: #A7F3D0; }
.flash-error { background: var(--bad-soft); border-color: rgba(239, 100, 100, .4); color: #FECACA; }
.flash-info { background: var(--accent-soft); border-color: rgba(57, 135, 229, .4); color: #BFDBFE; }
.note { border-radius: 12px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); color: var(--muted); font-size: .88rem; }
.note b { color: var(--text); }
.note-info { border-color: rgba(57, 135, 229, .35); background: var(--accent-soft); color: #C7DDF7; }
.note-warn { border-color: rgba(245, 181, 68, .35); background: var(--warn-soft); color: #F8DDA8; }
.empty { text-align: center; padding: 32px 16px; color: var(--muted); border: 1px dashed var(--line-strong); border-radius: var(--radius); }

/* ==================== FORM ==================== */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field > span, .label { font-size: .8rem; font-weight: 700; color: var(--muted); }
.input, select.input, textarea.input {
  width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--bg); color: var(--text);
  font: 500 16px var(--font);  /* 16px: iOS'ta odaklaninca yakinlasmasin */
}
select.input { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%239AA6BD' stroke-width='2'%3E%3Cpath d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.check { display: flex; align-items: center; gap: 10px; min-height: 40px; cursor: pointer; font-weight: 500; }
.check input { width: 20px; height: 20px; accent-color: var(--brand); }
input[type=range] { width: 100%; accent-color: var(--brand); }
.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ==================== TABLO ==================== */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.table { width: 100%; border-collapse: collapse; font-size: .88rem; }
.table th, .table td { padding: 9px 10px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
.table th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; z-index: 1; }
.table th.sortable { cursor: pointer; user-select: none; }
.table th.sortable:hover { color: var(--text); }
.table th.sorted-asc::after { content: " ▲"; font-size: .6rem; }
.table th.sorted-desc::after { content: " ▼"; font-size: .6rem; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: rgba(255, 255, 255, .025); }
.table .l { text-align: left; }
.table .sticky-col { position: sticky; left: 0; background: var(--surface); z-index: 1; }
.table th.sticky-col { z-index: 2; background: var(--surface-2); }
.table tr.clickable { cursor: pointer; }
.table .score { font-weight: 800; color: var(--good); }
.player-cell { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; object-position: top center; background: #0C1119; border: 1px solid var(--line); flex: 0 0 auto; }
.avatar-lg { width: 46px; height: 46px; }
.player-name { font-weight: 700; color: var(--text); overflow: hidden; text-overflow: ellipsis; }
.player-sub { font-size: .74rem; color: var(--dim); }

/* ==================== SEKMELER ==================== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: 0 0 auto; padding: 10px 14px; min-height: 44px; border: 0; background: transparent; color: var(--muted); font: 700 .9rem var(--font); cursor: pointer; border-bottom: 2px solid transparent; }
.tab:hover { color: var(--text); }
.tab.is-on { color: var(--text); border-bottom-color: var(--brand); }
.tab-panel:not(.is-on) { display: none; }

/* ==================== PENCERE ==================== */
.modal { border: 0; padding: 0; background: transparent; color: var(--text); max-width: min(880px, 100vw); width: 100%; max-height: 100dvh; }
.modal::backdrop { background: rgba(0, 0, 0, .65); }
.modal-inner { position: relative; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 18px; padding: 22px 20px 20px; max-height: calc(100dvh - 32px); overflow-y: auto; box-shadow: var(--shadow); }
.modal-close { position: absolute; top: 8px; right: 8px; }
@media (max-width: 640px) {
  .modal { margin: auto 0 0; max-width: 100vw; }
  .modal-inner { border-radius: 18px 18px 0 0; padding: 20px 14px calc(20px + env(safe-area-inset-bottom)); max-height: 92dvh; }
}
.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 100; background: #1E2637; border: 1px solid var(--line-strong); color: var(--text); padding: 11px 16px; border-radius: 12px; font-weight: 600; font-size: .9rem; transition: opacity .2s, transform .2s; box-shadow: var(--shadow); max-width: calc(100vw - 32px); }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { border-color: rgba(239, 100, 100, .5); }

.spinner { width: 28px; height: 28px; border: 3px solid var(--line-strong); border-right-color: var(--accent); border-radius: 50%; animation: spin .7s linear infinite; margin: 24px auto; }
.skeleton { background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi-label { font-size: .72rem; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.kpi-value { font-size: 1.45rem; font-weight: 800; margin-top: 2px; }
.bar { height: 6px; border-radius: 4px; background: rgba(255, 255, 255, .08); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }

/* ==================== ANA SAYFA ==================== */
.games { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.game { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.game-top { display: flex; justify-content: space-between; align-items: center; font-size: .78rem; color: var(--muted); font-weight: 600; }
.game-row { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px; }
.team { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.team img { width: 34px; height: 34px; object-fit: contain; }
.team.home { justify-content: flex-end; }
.game-score { font-size: 1.3rem; font-weight: 800; white-space: nowrap; text-align: center; min-width: 88px; }
.game-score.hidden-score { filter: blur(8px); cursor: pointer; user-select: none; transition: filter .25s; }
.excite { font-size: .72rem; font-weight: 800; padding: 3px 8px; border-radius: 8px; color: #0B0F17; }
.leaders { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); margin-bottom: 14px; }
.leader { position: relative; background: linear-gradient(150deg, #171D2A, #10141D); border: 1px solid var(--line); border-radius: 14px; padding: 12px; cursor: pointer; text-align: left; color: var(--text); font: inherit; }
.leader:hover { border-color: var(--line-strong); }
.leader-rank { position: absolute; top: 8px; right: 10px; font-size: .7rem; font-weight: 800; color: var(--dim); }
.leader-score { font-size: 1.3rem; font-weight: 800; color: var(--good); margin-top: 8px; }
.leader-score small { font-size: .62rem; color: var(--dim); letter-spacing: .08em; margin-left: 4px; }
.leader-line { font-size: .76rem; color: var(--muted); margin-top: 2px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; min-width: 150px; flex: 1 1 150px; }
details.more { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
details.more > summary { cursor: pointer; padding: 12px 14px; font-weight: 700; list-style: none; min-height: 44px; }
details.more > summary::-webkit-details-marker { display: none; }
details.more > summary::after { content: "+"; float: right; color: var(--dim); }
details.more[open] > summary::after { content: "–"; }
details.more > .more-body { padding: 0 14px 14px; }

.insight { border-radius: 10px; padding: 10px 12px; border-left: 3px solid; margin-bottom: 8px; background: var(--surface-2); }
.insight b { display: block; margin-bottom: 2px; }
.insight.good { border-color: var(--good); } .insight.bad { border-color: var(--bad); }
.insight.warn { border-color: var(--warn); } .insight.info { border-color: var(--accent); }
.insight { color: var(--text); }

/* ==================== YARDIMCI ==================== */
.hide-mobile { }
@media (max-width: 640px) { .hide-mobile { display: none !important; } }
.show-mobile { display: none; }
@media (max-width: 640px) { .show-mobile { display: initial; } }

/* Telefonda segment grubu tek satirda kalsin, esit paylasilsin */
@media (max-width: 640px) {
  .seg-fill { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; width: 100%; }
  .seg-fill a, .seg-fill button { padding: 6px 4px; font-size: .82rem; }
}
.seg-block label { flex: 1; }
.seg-block label span { width: 100%; justify-content: center; }
