/* fbscores — Fenerbahçe-branded mobile-first design system.
   One stylesheet for every page. Light + dark aware. Large tap targets. */

:root {
  --navy: #0a1f44;
  --navy-2: #12295a;
  --navy-3: #1c3a78;
  --yellow: #ffd200;
  --yellow-2: #ffde3d;

  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #f6f8fc;
  --text: #14181f;
  --muted: #5b6472;
  --border: #e2e7f0;

  --success: #1f9d55;
  --danger: #d64545;
  --warning: #b7791f;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 2px 10px rgba(10, 31, 68, .08);
  --shadow-lg: 0 8px 28px rgba(10, 31, 68, .16);
  --nav-h: 66px;
  --header-h: 56px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0a0f1e;
    --surface: #151c30;
    --surface-2: #1b2440;
    --text: #eef1f7;
    --muted: #9aa4b6;
    --border: #29334f;
    --shadow: 0 2px 10px rgba(0, 0, 0, .4);
    --shadow-lg: 0 8px 28px rgba(0, 0, 0, .55);
  }
}
:root[data-theme="light"] {
  --bg: #eef1f6; --surface: #fff; --surface-2: #f6f8fc; --text: #14181f;
  --muted: #5b6472; --border: #e2e7f0;
}
:root[data-theme="dark"] {
  --bg: #0a0f1e; --surface: #151c30; --surface-2: #1b2440; --text: #eef1f7;
  --muted: #9aa4b6; --border: #29334f;
}

* { 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(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
}
a { color: var(--navy-3); text-decoration: none; }
@media (prefers-color-scheme: dark) { a { color: var(--yellow-2); } }
:root[data-theme="dark"] a { color: var(--yellow-2); }

/* ---------- Header ---------- */
.app-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-h);
  display: flex; align-items: center; gap: 10px;
  padding: 0 14px;
  background: var(--navy);
  color: #fff;
  border-bottom: 3px solid var(--yellow);
  padding-top: env(safe-area-inset-top, 0px);
}
.app-header .crest { height: 30px; width: 30px; object-fit: contain; }
.app-header .brand { font-weight: 800; letter-spacing: .3px; font-size: 17px; }
.app-header .brand b { color: var(--yellow); }
.app-header .season {
  margin-left: auto; font-size: 12px; font-weight: 700;
  background: rgba(255,255,255,.12); color: var(--yellow-2);
  padding: 4px 10px; border-radius: 999px;
}

/* ---------- Layout ---------- */
.app-main { max-width: 680px; margin: 0 auto; padding: 16px 14px 24px; }
.page-title { font-size: 20px; font-weight: 800; margin: 4px 2px 14px; }
.section-title { font-size: 15px; font-weight: 800; color: var(--muted);
  text-transform: uppercase; letter-spacing: .6px; margin: 22px 2px 10px; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px; margin-bottom: 14px;
}
.card.tight { padding: 12px; }

/* ---------- Toast / flash ---------- */
.toasts { position: fixed; left: 0; right: 0; top: calc(var(--header-h) + 8px);
  z-index: 60; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; padding: 0 12px; }
.toast {
  pointer-events: auto; max-width: 640px; width: 100%;
  background: var(--surface); color: var(--text);
  border: 1px solid var(--border); border-left: 5px solid var(--navy-3);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-lg);
  padding: 12px 14px; font-weight: 600;
  animation: toastIn .25s ease;
}
.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }
@keyframes toastIn { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 18px; width: 100%;
  font-size: 17px; font-weight: 800; font-family: var(--font);
  border: none; border-radius: var(--radius-sm); cursor: pointer;
  background: var(--yellow); color: var(--navy);
  transition: transform .06s ease, filter .15s ease;
}
.btn:active { transform: scale(.985); }
.btn:hover { filter: brightness(.96); }
.btn.secondary { background: var(--navy); color: #fff; }
.btn.ghost { background: transparent; color: var(--navy-3); border: 1.5px solid var(--border); }
:root[data-theme="dark"] .btn.ghost { color: var(--yellow-2); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { min-height: 40px; font-size: 15px; padding: 8px 14px; width: auto; }

/* ---------- Forms ---------- */
label { display: block; font-weight: 700; font-size: 14px; margin: 0 0 6px; color: var(--muted); }
input[type=text], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  font-size: 16px; font-family: var(--font); color: var(--text);
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--navy-3); box-shadow: 0 0 0 3px rgba(28,58,120,.15);
}
.field { margin-bottom: 14px; }
.pw-wrap { position: relative; }
.pw-wrap .toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); font-size: 20px;
  width: 44px; height: 44px; cursor: pointer;
}
.checkbox { display: flex; align-items: center; gap: 10px; font-weight: 600; color: var(--text); }
.checkbox input { width: 22px; height: 22px; }

/* ---------- Auth card (login/register) ---------- */
.auth-wrap { min-height: calc(100dvh - var(--header-h) - var(--nav-h)); display: flex;
  align-items: center; justify-content: center; padding: 20px 14px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .crest-big { display: block; margin: 0 auto 10px; height: 64px; }
.auth-card h1 { text-align: center; font-size: 22px; margin: 0 0 4px; }
.auth-card .subtitle { text-align: center; color: var(--muted); margin: 0 0 18px; font-size: 14px; }

/* ---------- Match / prediction ---------- */
.match-hero { text-align: center; }
.match-hero .teams { display: flex; align-items: center; justify-content: center; gap: 12px;
  font-size: 20px; font-weight: 800; }
.match-hero .teams .vs { color: var(--muted); font-weight: 700; }
.match-hero .team { display: inline-flex; align-items: center; gap: 6px; }
.match-hero .team img { height: 26px; }
.match-hero .meta { color: var(--muted); font-size: 14px; margin-top: 6px; }
.match-hero .finalscore { font-size: 30px; font-weight: 900; margin-top: 6px; letter-spacing: 1px; }

.pill-row { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 12px; }
.pill { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-weight: 700; font-size: 14px; }
.pill .k { color: var(--muted); font-weight: 600; }
.pill.gold { background: var(--yellow); color: var(--navy); border-color: transparent; }

/* Score stepper */
.stepper { display: inline-flex; align-items: center; gap: 10px; }
.stepper button {
  width: 46px; height: 46px; border-radius: 50%; border: none; cursor: pointer;
  font-size: 26px; font-weight: 800; line-height: 1;
  background: var(--navy); color: #fff;
}
.stepper button:active { transform: scale(.94); }
.stepper .val { min-width: 44px; text-align: center; font-size: 30px; font-weight: 900; font-variant-numeric: tabular-nums; }

.predict-grid { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  gap: 10px; margin: 8px 0 4px; }
.predict-grid .side { text-align: center; }
.predict-grid .side .name { font-weight: 800; font-size: 15px; margin-bottom: 8px; }
.predict-grid .dash { font-size: 28px; font-weight: 900; color: var(--muted); }

/* ---------- Prediction list (others) ---------- */
.pred-list { display: flex; flex-direction: column; gap: 8px; }
.pred-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.pred-row .who { font-weight: 700; flex: 1; }
.pred-row .score { font-weight: 900; font-size: 18px; font-variant-numeric: tabular-nums; }
.pred-row .score.muted { color: var(--muted); font-weight: 700; font-size: 15px; }
.pred-row.me { border-color: var(--yellow); box-shadow: inset 0 0 0 1px var(--yellow); }
.pred-row .tag { font-size: 11px; font-weight: 800; color: var(--navy); background: var(--yellow);
  padding: 2px 8px; border-radius: 999px; }

/* ---------- Tables (stats, history) ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: var(--radius-sm); }
table.data { width: 100%; border-collapse: collapse; font-size: 15px; }
table.data th, table.data td { padding: 11px 10px; text-align: left; border-bottom: 1px solid var(--border); }
table.data th { background: var(--navy); color: #fff; font-size: 13px; text-transform: uppercase;
  letter-spacing: .4px; position: sticky; top: 0; }
table.data tr:last-child td { border-bottom: none; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 700; }
.pos { color: var(--success); font-weight: 800; }
.neg { color: var(--danger); font-weight: 800; }
.rank { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px;
  border-radius: 50%; background: var(--surface-2); font-weight: 800; font-size: 13px; }
.rank.g1 { background: var(--yellow); color: var(--navy); }

.ok  { color: var(--success); font-weight: 900; }
.bad { color: var(--danger); font-weight: 900; }
.wait { color: var(--warning); font-weight: 900; }

/* ---------- Stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 12px 14px; box-shadow: var(--shadow); }
.tile .label { font-size: 11px; color: var(--muted); font-weight: 800; text-transform: uppercase; letter-spacing: .5px; }
.tile .value { font-size: 19px; font-weight: 900; margin-top: 3px; }
.tile .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.tile .emoji { font-size: 16px; }

/* ---------- Diverging net-jeton bar ---------- */
.lead-row { display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 10px;
  padding: 9px 4px; border-bottom: 1px solid var(--border); }
.lead-row:last-child { border-bottom: none; }
.lead-row .name { font-weight: 700; }
.lead-row .name .sub { font-size: 12px; color: var(--muted); font-weight: 600; }
.lead-row .amt { font-weight: 900; font-variant-numeric: tabular-nums; text-align: right; min-width: 62px; }
.netbar { position: relative; height: 20px; background: var(--surface-2); border-radius: 6px; margin-top: 5px; }
.netbar .center { position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--border); }
.netbar .fill { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.netbar .fill.pos { left: 50%; background: var(--success); }
.netbar .fill.neg { right: 50%; background: var(--danger); }

/* ---------- Bottom navigation ---------- */
.bottom-nav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--nav-h) + env(safe-area-inset-bottom, 0px));
  padding-bottom: env(safe-area-inset-bottom, 0px);
  display: flex; background: var(--surface); border-top: 1px solid var(--border);
  box-shadow: 0 -2px 12px rgba(10,31,68,.06);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; color: var(--muted); font-size: 11px; font-weight: 700; text-decoration: none;
}
.bottom-nav a .ico { font-size: 22px; line-height: 1; }
.bottom-nav a.active { color: var(--navy); }
:root[data-theme="dark"] .bottom-nav a.active { color: var(--yellow); }
@media (prefers-color-scheme: dark) { .bottom-nav a.active { color: var(--yellow); } }
.bottom-nav a.active .ico { transform: translateY(-1px); }

/* ---------- Utilities ---------- */
.muted { color: var(--muted); }
.center { text-align: center; }
.small { font-size: 13px; }
.stack > * + * { margin-top: 12px; }
.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; }
.hint { color: var(--muted); font-size: 13px; margin-top: 6px; }
.empty { text-align: center; color: var(--muted); padding: 24px 8px; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 800; }
.badge.open { background: #d7f2df; color: #15703b; }
.badge.closed { background: #ffe6c2; color: #8a4b00; }
