:root {
  --felt: #07140e;
  --felt-2: #0d2418;
  --card: rgba(14, 36, 26, 0.78);
  --card-solid: #10291d;
  --gold: #e8c547;
  --gold-2: #f3de8a;
  --cream: #f4efe4;
  --muted: #93a899;
  --line: rgba(232, 197, 71, 0.16);
  --danger: #ef6b6b;
  --ok: #5ee0a0;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; min-height: 100dvh; }
body {
  font-family: Outfit, system-ui, sans-serif;
  color: var(--cream);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(232, 197, 71, 0.12), transparent 50%),
    radial-gradient(900px 500px at 110% 10%, rgba(34, 197, 94, 0.08), transparent 45%),
    linear-gradient(180deg, var(--felt-2), var(--felt));
  padding: env(safe-area-inset-top) 0 env(safe-area-inset-bottom);
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: url("data:image/svg+xml,%3Csvg width='72' height='72' viewBox='0 0 72 72' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='8' y='8' width='22' height='28' rx='4' fill='none' stroke='%23e8c547' stroke-width='1'/%3E%3Crect x='42' y='36' width='22' height='28' rx='4' fill='none' stroke='%23e8c547' stroke-width='1'/%3E%3C/svg%3E");
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; touch-action: manipulation; color: inherit; }
input, select, textarea {
  color: var(--cream);
  background: rgba(0, 0, 0, 0.38);
  border: 1px solid var(--line);
  border-radius: 12px;
  caret-color: var(--gold);
}
input::placeholder, textarea::placeholder { color: var(--muted); }
input[type="color"] {
  padding: 4px;
  min-height: 48px;
  background: rgba(0, 0, 0, 0.38);
  cursor: pointer;
}

.login-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 36px 28px 28px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
  text-align: center;
}
.tile {
  width: 64px;
  height: 80px;
  margin: 0 auto 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8f1da, #e8d9a8);
  color: #7a1c1c;
  display: grid;
  place-items: center;
  font-family: Fraunces, serif;
  font-size: 34px;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(0,0,0,.35);
}
.login-card h1 {
  font-family: Fraunces, serif;
  margin: 0 0 6px;
  font-size: 32px;
}
.login-card p { margin: 0 0 22px; color: var(--muted); }
.field { text-align: left; margin-bottom: 12px; }
.field label { display: block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%;
  padding: 12px 14px;
  outline: none;
  font-size: 16px;
  min-height: 48px;
}
.field textarea { min-height: 90px; resize: vertical; }
.btn {
  border: 0;
  border-radius: 12px;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--gold-2), var(--gold));
  color: #1b1404;
  font-weight: 700;
  min-height: 48px;
}
.btn.full { width: 100%; margin-top: 8px; }
.btn.ghost {
  background: transparent;
  color: var(--cream);
  border: 1px solid var(--line);
}
.btn.danger { background: var(--danger); color: #fff; }
.btn.small { padding: 8px 12px; font-size: 13px; }
.error { color: var(--danger); min-height: 20px; margin: 8px 0 0; font-size: 14px; }

.shell { min-height: 100vh; display: grid; grid-template-rows: auto 1fr; }
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px 8px;
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(180deg, rgba(7,20,14,.95), rgba(7,20,14,.72) 70%, transparent);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand b { font-family: Fraunces, serif; font-size: 22px; }
.brand span { color: var(--muted); font-size: 13px; }
.nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.nav button {
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  padding: 8px 12px;
  border-radius: 999px;
}
.nav button.active {
  color: #1b1404;
  background: var(--gold);
  font-weight: 700;
}
.page { padding: 8px 20px 40px; max-width: 1180px; margin: 0 auto; width: 100%; }

.hero {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin: 8px 0 18px;
}
.hero h2 { font-family: Fraunces, serif; font-size: 34px; margin: 0; }
.kpis { display: flex; gap: 10px; flex-wrap: wrap; }
.kpi {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 10px 14px;
  min-width: 140px;
}
.kpi small { color: var(--muted); display: block; }
.kpi strong { font-family: Fraunces, serif; font-size: 24px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}
.panel h3 { margin: 0 0 14px; font-size: 18px; letter-spacing: .04em; }

.row {
  display: grid;
  grid-template-columns: 92px 1fr 92px;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
}
.chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 12px;
  color: #111;
}
.track {
  height: 14px;
  background: rgba(255,255,255,.06);
  border-radius: 999px;
  overflow: hidden;
}
.fill { height: 100%; border-radius: 999px; }
.val { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.total-row {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #e8c547;
  color: #1b1404;
  display: flex;
  justify-content: space-between;
  font-weight: 800;
}

.list { display: grid; gap: 10px; }
.card-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.reset-pw {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.reset-pw input {
  width: min(220px, 100%);
  min-height: 44px;
  padding: 8px 12px;
  font-size: 16px;
}
.player-edit {
  display: grid;
  grid-template-columns: minmax(120px, 1.4fr) 88px 110px minmax(120px, 1fr);
  gap: 10px;
  width: 100%;
}
.player-edit label {
  display: grid;
  gap: 6px;
  font-size: 11px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
}
.player-edit input {
  width: 100%;
  padding: 10px 12px;
  font-size: 16px;
  min-height: 44px;
  font-weight: 600;
}
.muted { color: var(--muted); }
.live { color: var(--ok); font-weight: 700; font-size: 12px; letter-spacing: .08em; }

.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.form-grid .span-2 { grid-column: span 2; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }

.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.photos figure {
  margin: 0;
  position: relative;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #000;
}
.photos img { width: 100%; height: 140px; object-fit: cover; display: block; }
.photos figcaption {
  position: absolute; left: 8px; bottom: 8px;
  background: rgba(0,0,0,.55);
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
}
.photos .x {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border: 0; border-radius: 50%;
  background: rgba(0,0,0,.6); color: #fff;
}

.score-table, .yazboz-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
}
.score-table th, .score-table td, .yazboz-table th, .yazboz-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px;
  text-align: center;
}
.yazboz-table input {
  width: 72px;
  text-align: center;
  padding: 8px 4px;
}
.yazboz-wrap { overflow-x: auto; }

.player-picks { display: flex; flex-wrap: wrap; gap: 8px; }
.pick {
  border: 1px solid var(--line);
  background: transparent;
  border-radius: 999px;
  padding: 8px 12px;
}
.pick.on { background: var(--gold); color: #1b1404; font-weight: 700; border-color: transparent; }

.toast {
  position: fixed;
  right: 16px;
  bottom: calc(16px + env(safe-area-inset-bottom));
  background: #123224;
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 12px;
  display: none;
  z-index: 50;
  max-width: min(360px, calc(100vw - 32px));
}

.live-notice {
  position: fixed;
  left: 12px;
  right: 12px;
  top: calc(10px + env(safe-area-inset-top));
  z-index: 60;
  border: 0;
  border-radius: 16px;
  padding: 14px 16px;
  background: #e8c547;
  color: #1b1404;
  text-align: left;
  box-shadow: var(--shadow);
  display: grid;
  gap: 2px;
}
.live-notice[hidden] { display: none !important; }
.live-notice b { font-size: 15px; }
.live-notice span { font-size: 13px; opacity: .85; }

.tabbar { display: none; }
.more-list { display: grid; gap: 10px; }
.more-list .card-row {
  width: 100%;
  color: inherit;
  font: inherit;
  cursor: pointer;
}

.badge {
  display: inline-block;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .06em;
}
.badge.pending { background: #c9a227; color: #1b1404; }
.badge.approved { background: var(--ok); color: #062214; }
.badge.wait { background: rgba(255,255,255,.12); color: var(--cream); }

.home-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
}
.stat-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 14px 16px;
}
.stat-card small { color: var(--muted); display: block; margin-bottom: 4px; }
.stat-card strong { font-family: Fraunces, serif; font-size: 28px; }
.stat-card .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }

.charts {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 16px;
  margin-bottom: 18px;
}
.chart-box {
  height: 280px;
  position: relative;
}
.chart-box.tall { height: 300px; }
.pay-table { display: grid; gap: 8px; }

@media (max-width: 860px) {
  .home-grid { grid-template-columns: 1fr 1fr; }
  .grid-2, .form-grid, .charts { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .hero { flex-direction: column; align-items: start; }
  .hero h2 { font-size: 26px; }
  .row { grid-template-columns: 78px 1fr 72px; }
  .top {
    flex-direction: row;
    align-items: center;
    padding: 10px 14px 8px;
  }
  .nav-desktop { display: none; }
  .page { padding: 8px 12px 96px; }
  .stat-card strong { font-size: 22px; }
  .chart-box, .chart-box.tall { height: 220px; }
  .toast { left: 12px; right: 12px; bottom: calc(84px + env(safe-area-inset-bottom)); }
  .tabbar {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 40;
    background: rgba(7, 20, 14, 0.96);
    border-top: 1px solid var(--line);
    padding: 6px 6px calc(8px + env(safe-area-inset-bottom));
    gap: 4px;
  }
  .tabbar button {
    position: relative;
    background: transparent;
    border: 0;
    color: var(--muted);
    min-height: 48px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    padding: 6px 2px;
  }
  .tabbar button.active {
    color: #1b1404;
    background: var(--gold);
  }
  .tab-badge {
    position: absolute;
    top: 4px;
    right: 8px;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    line-height: 16px;
  }
  .pick { min-height: 44px; }
  .p-edit { grid-template-columns: 1fr; }
  .player-edit { grid-template-columns: 1fr 88px; }
  .player-edit label:nth-child(3),
  .player-edit label:nth-child(4) { grid-column: span 1; }
  .user-reset { grid-template-columns: 1fr; }
  .reset-pw { width: 100%; }
  .reset-pw input { flex: 1; width: auto; min-width: 0; }
}

@media (min-width: 861px) {
  .tabbar { display: none !important; }
}
