:root {
  color-scheme: dark;
  --bg: #0e0f11; --side: #121316; --surface: #17181b; --surface-2: #1d1f23; --line: #26282d; --grid: #222428;
  --text: #f1f1ee; --text-2: #b9b9b2; --muted: #7d7e79;
  --accent: #3987e5; --accent-soft: rgba(57,135,229,.16);
  --s2: #d95926; --s3: #199e70;
  --good: #22b14c; --good-bg: rgba(34,177,76,.14);
  --warn: #e0a21a; --warn-bg: rgba(224,162,26,.15);
  --bad: #e66767; --bad-bg: rgba(230,103,103,.14);
  --neutral-bg: rgba(255,255,255,.06);
  --radius: 14px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    color-scheme: light;
    --bg: #f4f4f1; --side: #fbfbf9; --surface: #ffffff; --surface-2: #f7f7f4; --line: #e5e4df; --grid: #efeee9;
    --text: #111110; --text-2: #4f4e4a; --muted: #8a8984;
    --accent: #2a78d6; --accent-soft: rgba(42,120,214,.12);
    --s2: #eb6834; --s3: #1baf7a;
    --good: #0b8a2c; --good-bg: rgba(11,138,44,.10);
    --warn: #9a6700; --warn-bg: rgba(237,161,0,.14);
    --bad: #c23130; --bad-bg: rgba(227,73,72,.10);
    --neutral-bg: rgba(0,0,0,.045);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif; font-feature-settings: "tnum", "cv11"; -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
svg { width: 18px; height: 18px; fill: currentColor; flex: none; }
button { font: inherit; }

/* Yerleşim */
.app { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side); border-right: 1px solid var(--line); padding: 18px 12px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 18px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px; }
.brand b { display: block; font-size: 15px; }
.brand small { color: var(--muted); font-size: 12px; }
.logo { width: 32px; height: 32px; border-radius: 9px; background: var(--accent); color: #fff; display: grid; place-items: center; font-weight: 700; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; color: var(--text-2); font-weight: 500; }
.nav a:hover { background: var(--neutral-bg); color: var(--text); }
.nav a.on { background: var(--accent-soft); color: var(--text); }
.nav a.on svg { color: var(--accent); }
.side-games { display: flex; flex-direction: column; gap: 2px; }
.side-games h6 { margin: 0 0 6px; padding: 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; }
.side-games a { display: flex; align-items: center; gap: 9px; padding: 5px 10px; border-radius: 8px; color: var(--text-2); font-size: 13px; }
.side-games a:hover, .side-games a.on { background: var(--neutral-bg); color: var(--text); }
.side-games img, .side-games .ph { width: 22px; height: 22px; border-radius: 5px; object-fit: cover; background: var(--neutral-bg); flex: none; }
.side-games .ph, .tl-game .ph { display: grid; place-items: center; font-size: 9.5px; font-weight: 600; color: var(--muted); overflow: hidden; }
.tl-game .ph { font-size: 12px; }
.side-games .n { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-games .c { font-size: 12px; color: var(--good); font-weight: 600; }
.side-foot { margin-top: auto; padding: 0 10px; color: var(--muted); font-size: 11.5px; }

.main { padding: 22px 28px 60px; min-width: 0; max-width: 1360px; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.topbar h1 { font-size: 22px; font-weight: 600; margin: 0; letter-spacing: -.02em; display: flex; align-items: center; gap: 10px; }
.top-r { display: flex; gap: 8px; align-items: center; }
.chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 12.5px; color: var(--text-2); background: var(--surface); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.dot.stale { background: var(--warn); box-shadow: 0 0 0 3px var(--warn-bg); }
.dot.err { background: var(--bad); box-shadow: 0 0 0 3px var(--bad-bg); }
.btn { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { padding: 7px; }
.btn.danger { color: var(--bad); }
.btn:disabled { opacity: .55; cursor: default; }
.banner { display: none; padding: 11px 14px; border-radius: 12px; margin-bottom: 16px; font-size: 13px; border: 1px solid transparent; }
.banner.show { display: flex; gap: 10px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.banner.err { background: var(--bad-bg); border-color: color-mix(in srgb, var(--bad) 30%, transparent); }
.banner.mock { background: var(--warn-bg); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.banner a { text-decoration: underline; font-weight: 500; }

/* Kartlar */
.grid { display: grid; gap: 14px; }
.kpis { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 15px 16px; min-width: 0; }
.kpi .l { color: var(--text-2); font-size: 12.5px; display: flex; align-items: center; gap: 6px; }
.kpi .v { font-size: 26px; font-weight: 600; letter-spacing: -.025em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .s { color: var(--muted); font-size: 12px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi.hl { background: linear-gradient(160deg, var(--accent-soft), transparent 70%), var(--surface); }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--good); animation: pulse 2s infinite; }
@keyframes pulse { 0%{box-shadow:0 0 0 0 var(--good-bg)} 70%{box-shadow:0 0 0 7px transparent} 100%{box-shadow:0 0 0 0 transparent} }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.card-h h2 { font-size: 14.5px; font-weight: 600; margin: 0; }
.card-h .sub { color: var(--muted); font-size: 12.5px; font-weight: 400; margin-top: 2px; }
.cols-2 { grid-template-columns: 1fr 1fr; }
.cols-3 { grid-template-columns: repeat(3, 1fr); }
.cols-21 { grid-template-columns: 2fr 1fr; }
.mb { margin-bottom: 14px; }
.seg { display: inline-flex; background: var(--neutral-bg); border-radius: 9px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; color: var(--text-2); font-size: 12.5px; padding: 4px 11px; border-radius: 7px; cursor: pointer; font-weight: 500; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.18); }
.chart-box { position: relative; height: 260px; }
.chart-box.sm { height: 200px; }
.chart-box.lg { height: 300px; }
.empty { color: var(--muted); text-align: center; padding: 50px 10px; font-size: 13px; }

/* Rozetler */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; padding: 3px 9px; border-radius: 999px; font-weight: 500; white-space: nowrap; }
.badge.bd::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-live { color: var(--good); background: var(--good-bg); }
.b-wait { color: var(--warn); background: var(--warn-bg); }
.b-off { color: var(--text-2); background: var(--neutral-bg); }
.b-acc { color: var(--accent); background: var(--accent-soft); }
.b-solid { background: rgba(0,0,0,.6); color: #fff; backdrop-filter: blur(6px); }

/* Oyun kartları */
.game-grid { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.gcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; display: flex; flex-direction: column; transition: transform .15s, border-color .15s; }
.gcard:hover { transform: translateY(-2px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.gcard .cover { position: relative; aspect-ratio: 4/3; background: var(--surface-2); overflow: hidden; }
.gcard .cover img { width: 100%; height: 100%; object-fit: cover; object-position: center 25%; display: block; }
.gcard .cover .ph, .ph-big { width: 100%; height: 100%; display: grid; place-items: center; font-size: 34px; font-weight: 700; color: var(--muted); background: linear-gradient(135deg, var(--surface-2), var(--neutral-bg)); }
.gcard .cover .tl { position: absolute; top: 10px; left: 10px; }
.gcard .cover .tr { position: absolute; top: 10px; right: 10px; }
.gcard .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 10px; }
.gcard .name { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcard .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.gstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; border-top: 1px solid var(--line); padding-top: 10px; margin-top: auto; }
.gstats div { min-width: 0; }
.gstats .l { color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcap { display: none; }
.gstats .v { font-weight: 600; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Tablolar */
.tbl-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; }
table { width: 100%; border-collapse: collapse; }
th { text-align: right; font-weight: 500; color: var(--muted); font-size: 12px; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { text-align: right; padding: 10px; border-bottom: 1px solid var(--grid); white-space: nowrap; }
th:first-child, td:first-child { text-align: left; padding-left: 0; }
th:last-child, td:last-child { padding-right: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover td { background: var(--neutral-bg); }
tfoot td { font-weight: 600; border-top: 1px solid var(--line); border-bottom: 0; }
.tl-game { display: flex; align-items: center; gap: 10px; }
.tl-game img, .tl-game .ph { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--neutral-bg); flex: none; }
.zero { color: var(--muted); }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.bar-cell { display: flex; align-items: center; gap: 10px; justify-content: flex-end; }
.bar-cell .track { width: 90px; height: 6px; background: var(--neutral-bg); border-radius: 3px; overflow: hidden; }
.bar-cell .fill { height: 100%; background: var(--accent); border-radius: 3px; }

/* Oyun detay */
.hero { display: grid; grid-template-columns: 170px 1fr; grid-template-areas: "art info" "art facts"; grid-template-rows: auto 1fr; gap: 14px 20px; margin-bottom: 14px; }
.hero .art { grid-area: art; align-self: start; width: 100%; border-radius: var(--radius); overflow: hidden; aspect-ratio: 3/4; background: var(--surface-2); border: 1px solid var(--line); }
.hero .facts { grid-area: facts; align-self: end; }
.hero .art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.hero .info { grid-area: info; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.hero h2 { margin: 0; font-size: 28px; letter-spacing: -.02em; }
.hero .badges { display: flex; gap: 6px; flex-wrap: wrap; }
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.fact { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; }
.fact .l { color: var(--muted); font-size: 11.5px; }
.fact .v { font-weight: 600; margin-top: 2px; }
.progress { height: 6px; border-radius: 3px; background: var(--neutral-bg); overflow: hidden; margin-top: 6px; }
.progress > i { display: block; height: 100%; background: var(--good); border-radius: 3px; }
.back { color: var(--text-2); font-size: 13px; display: inline-flex; align-items: center; gap: 4px; margin-bottom: 12px; }
.back:hover { color: var(--text); }
.deal { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.deal .box { background: var(--surface-2); border-radius: 12px; padding: 12px 14px; }
.deal .box .l { color: var(--muted); font-size: 12px; }
.deal .box .v { font-size: 18px; font-weight: 600; margin-top: 2px; }
.deal .box .s { color: var(--text-2); font-size: 12px; margin-top: 2px; }
.note { color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--grid); }
.list-row:last-child { border-bottom: 0; }
.list-row .k { width: 84px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .track { flex: 1; height: 8px; background: var(--neutral-bg); border-radius: 4px; overflow: hidden; }
.list-row .fill { height: 100%; background: var(--accent); border-radius: 4px; }
.list-row .val { width: 90px; text-align: right; }
.list-row .pct { width: 46px; text-align: right; color: var(--muted); font-size: 12px; }

/* Ayarlar */
.form { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.field label { display: block; font-weight: 500; margin-bottom: 6px; }
.field .hint { color: var(--muted); font-size: 12px; margin-top: 5px; }
.input { width: 100%; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--text); font: inherit; }
.input:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea.input { min-height: 90px; resize: vertical; font-family: ui-monospace, Menlo, monospace; font-size: 12px; -webkit-text-security: disc; }
textarea.input.show { -webkit-text-security: none; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.msg { font-size: 13px; padding: 9px 12px; border-radius: 10px; display: none; }
.msg.ok { display: block; background: var(--good-bg); color: var(--good); }
.msg.err { display: block; background: var(--bad-bg); color: var(--bad); }
ol.steps { margin: 0; padding-left: 20px; color: var(--text-2); line-height: 1.8; }
ol.steps code, .note code { background: var(--neutral-bg); padding: 1px 6px; border-radius: 5px; font-size: 12px; color: var(--text); }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

.tip { position: fixed; pointer-events: none; z-index: 50; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 12px; box-shadow: 0 6px 20px rgba(0,0,0,.25); display: none; }

/* Mobil */
@media (max-width: 1100px) { .cols-3 { grid-template-columns: 1fr 1fr; } .cols-21 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .app { grid-template-columns: 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; padding: 10px 16px; gap: 12px; border-right: 0; border-bottom: 1px solid var(--line); overflow-x: auto; }
  .brand small, .side-games, .side-foot { display: none; }
  .nav { flex-direction: row; }
  .nav a { padding: 7px 10px; white-space: nowrap; font-size: 13px; }
  .nav a svg { display: none; }
  .main { padding: 16px 16px 50px; }
  .cols-2, .cols-3 { grid-template-columns: 1fr; }
  .hero { grid-template-columns: 96px 1fr; grid-template-areas: "art info" "facts facts"; gap: 14px; }
  .hero .facts { grid-template-columns: 1fr 1fr; }
  .hero h2 { font-size: 21px; }
  .kpi .v { font-size: 22px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
}

.list-row .track, .list-row .fill, .bar-cell .track, .bar-cell .fill { display: block; }

/* Giriş sayfaları */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 14px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 28px; }
.auth-card h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: -.01em; }
.auth-card .note { margin: 0 0 18px; }
.auth-card .form { max-width: none; }
.auth-card .btn.primary { justify-content: center; padding: 11px; margin-top: 4px; }
.auth-card .msg { margin-top: 14px; }
.auth-foot { color: var(--muted); font-size: 12px; margin: 0; }

/* Kullanıcı menüsü ve ekip */
.user-chip { display: inline-flex; align-items: center; gap: 8px; color: var(--text-2); font-size: 13px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; font-weight: 600; font-size: 12px; }
.role { font-size: 11px; padding: 2px 7px; border-radius: 999px; background: var(--neutral-bg); color: var(--text-2); }
.role.admin { background: var(--accent-soft); color: var(--accent); }
.linkbox { display: flex; gap: 8px; align-items: center; background: var(--surface-2); border: 1px dashed var(--line); border-radius: 10px; padding: 8px 10px; margin-top: 10px; }
.linkbox code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.qr { background: #fff; padding: 10px; border-radius: 10px; display: inline-block; line-height: 0; }
.qr svg { width: 168px; height: 168px; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; margin: 22px 0 10px; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
select.input { appearance: auto; }

@media (max-width: 860px) { .user-chip .uname, .user-chip .role { display: none; } }
