:root {
  --ink: #0d2b33;
  --ink-2: #4a6670;
  --sand: #f6f2ea;
  --card: #ffffff;
  --line: #e4ddd0;
  --lagoon: #0b6e7a;
  --lagoon-dark: #07434b;
  --reef: #ff6b4a;
  --palm: #2e9e5b;
  --gold: #e8b23a;
  --danger: #c8372d;
  --pitch: #2f8f4e;
  --pitch-2: #2a8247;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(13,43,51,.06), 0 6px 20px rgba(13,43,51,.06);
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--sand);
  color: var(--ink);
  font: 15px/1.5 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}
h1, h2, h3 { font-family: Outfit, Inter, sans-serif; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 28px; font-weight: 800; letter-spacing: -.01em; }
h2 { font-size: 20px; font-weight: 600; }
h3 { font-size: 16px; font-weight: 600; }
a { color: var(--lagoon); }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 24px; padding-bottom: 48px; min-height: 70vh; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.right { text-align: right; }
.center { text-align: center; }
.mt { margin-top: 16px; }
.mb0 { margin-bottom: 0; }

/* ---------- top bar ---------- */
.topbar {
  background: linear-gradient(120deg, var(--lagoon-dark), var(--lagoon));
  color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.topbar-inner { display: flex; align-items: center; gap: 16px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 800 18px Outfit, sans-serif; }
.brand-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: rgba(255,255,255,.14); }
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a { color: rgba(255,255,255,.85); text-decoration: none; padding: 8px 12px; border-radius: 999px; font-weight: 500; font-size: 14px; }
.nav a:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav a.on { background: #fff; color: var(--lagoon-dark); }
.nav .muted-link { opacity: .75; }
@media (max-width: 640px) {
  .topbar-inner { padding-top: 8px; padding-bottom: 8px; }
  .nav { margin-left: 0; width: 100%; overflow-x: auto; flex-wrap: nowrap; }
  .nav a { white-space: nowrap; }
}

.subnav { display: flex; gap: 6px; flex-wrap: wrap; margin: 0 0 20px; }
.subnav a { padding: 7px 12px; border-radius: 999px; background: var(--card); border: 1px solid var(--line); color: var(--ink); text-decoration: none; font-size: 14px; }
.subnav a.on { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- cards / layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.stack > * + * { margin-top: 12px; }

.hero {
  background: radial-gradient(circle at 85% 20%, rgba(255,255,255,.18), transparent 40%),
              linear-gradient(135deg, var(--lagoon), #0f8f86);
  color: #fff; border-radius: 20px; padding: 28px; margin-bottom: 20px; position: relative; overflow: hidden;
}
.hero h1 { color: #fff; }
.hero .muted { color: rgba(255,255,255,.8); }
.hero::after {
  content: ""; position: absolute; right: -60px; bottom: -80px; width: 260px; height: 260px;
  border-radius: 50%; border: 36px solid rgba(255,255,255,.07);
}
.stat { font: 800 32px Outfit, sans-serif; line-height: 1; }
.stat-label { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-2); margin-top: 6px; }
.hero .stat-label { color: rgba(255,255,255,.75); }
.countdown { display: inline-flex; gap: 8px; align-items: center; background: rgba(255,255,255,.15); padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; }

/* ---------- forms ---------- */
label { display: block; font-weight: 600; font-size: 13px; margin: 0 0 6px; }
input[type=text], input[type=tel], input[type=password], input[type=number], input[type=datetime-local], select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font: inherit; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--lagoon); outline-offset: 1px; border-color: transparent; }
.field { margin-bottom: 14px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: 10px; border: 0; cursor: pointer; font: 600 14px Inter, sans-serif;
  background: var(--lagoon); color: #fff; text-decoration: none;
}
.btn:hover { background: var(--lagoon-dark); }
.btn-reef { background: var(--reef); }
.btn-reef:hover { background: #e2512f; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn-ghost:hover { background: #fff; }
.btn-danger { background: var(--danger); }
.btn-sm { padding: 6px 10px; font-size: 13px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; }

.auth-box { max-width: 420px; margin: 32px auto; }

.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-weight: 500; }
.flash-ok { background: #e3f5ea; color: #17643a; }
.flash-error { background: #fde8e6; color: #9b2a22; }
.flash-info { background: #e3f1f3; color: var(--lagoon-dark); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); font-weight: 600; }
tr:last-child td { border-bottom: 0; }
tr.me td { background: #fff7e6; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.rank { display: inline-grid; place-items: center; min-width: 28px; height: 28px; border-radius: 8px; background: var(--sand); font-weight: 700; }
.rank-1 { background: var(--gold); color: #3d2a00; }
.rank-2 { background: #cfd8dc; }
.rank-3 { background: #e7b48b; }

/* ---------- badges ---------- */
.pos { display: inline-block; min-width: 38px; text-align: center; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; letter-spacing: .04em; }
.pos-gkp { background: #fff1c2; color: #7a5600; }
.pos-def { background: #dff4e6; color: #17643a; }
.pos-mid { background: #e0eefc; color: #1d4f8a; }
.pos-fwd { background: #fde4dd; color: #9b2a22; }
.club { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 6px; border-radius: 6px; color: #fff; background: var(--c, #1f6feb); }
.tag { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--sand); }
.tag-open { background: #dff4e6; color: #17643a; }
.tag-locked { background: #fff1c2; color: #7a5600; }
.tag-done { background: #e0eefc; color: #1d4f8a; }
.code { font: 700 22px/1 ui-monospace, Menlo, Consolas, monospace; letter-spacing: .15em; background: var(--sand); padding: 8px 12px; border-radius: 10px; display: inline-block; }

/* ---------- team picker ---------- */
.picker { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
@media (max-width: 860px) { .picker { grid-template-columns: 1fr; } }

.pitch {
  background:
    linear-gradient(transparent 49.6%, rgba(255,255,255,.35) 49.6%, rgba(255,255,255,.35) 50.4%, transparent 50.4%),
    repeating-linear-gradient(0deg, var(--pitch) 0 44px, var(--pitch-2) 44px 88px);
  border-radius: var(--radius); padding: 18px 8px; position: relative; min-height: 440px;
  display: flex; flex-direction: column; justify-content: space-around; gap: 10px;
  border: 3px solid rgba(255,255,255,.4);
}
.pitch::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 90px; height: 90px; transform: translate(-50%,-50%);
  border: 2px solid rgba(255,255,255,.35); border-radius: 50%;
}
.pitch-line { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; position: relative; z-index: 1; min-height: 76px; }
.shirt {
  width: 86px; text-align: center; color: #fff; font-size: 12px; cursor: default; position: relative;
}
.shirt .kit {
  width: 40px; height: 40px; margin: 0 auto 4px; border-radius: 10px 10px 8px 8px; background: var(--c, #1f6feb);
  border: 2px solid rgba(255,255,255,.85); box-shadow: 0 3px 8px rgba(0,0,0,.25);
  display: grid; place-items: center; font-weight: 800; font-size: 11px;
}
.shirt .nm { background: rgba(7,43,40,.85); border-radius: 6px 6px 0 0; padding: 2px 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.shirt .sub { background: rgba(255,255,255,.92); color: var(--ink); border-radius: 0 0 6px 6px; padding: 1px 4px; font-weight: 600; }
.shirt.empty .kit { background: rgba(255,255,255,.18); border-style: dashed; }
.shirt .cap { position: absolute; top: -6px; right: 14px; background: var(--ink); color: #fff; border-radius: 50%; width: 20px; height: 20px; display: grid; place-items: center; font-weight: 800; font-size: 11px; border: 2px solid #fff; }
.shirt button { all: unset; cursor: pointer; display: block; }
@media (max-width: 480px) {
  .pitch-line { gap: 4px; }
  .shirt { width: 18%; min-width: 58px; font-size: 11px; }
  .shirt .kit { width: 34px; height: 34px; font-size: 10px; }
  .shirt .cap { right: 4px; }
}

.summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.summary div { background: var(--sand); border-radius: 10px; padding: 10px; text-align: center; }
.summary b { display: block; font: 800 20px Outfit, sans-serif; }
.summary span { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-2); }
.over b { color: var(--danger); }

.plist { max-height: 560px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; }
.plist .p { display: flex; align-items: center; gap: 8px; padding: 9px 10px; border-bottom: 1px solid var(--line); }
.plist .p:last-child { border-bottom: 0; }
.plist .p .n { flex: 1; min-width: 0; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist .p.picked { background: #eef8f1; }
.plist .p button { min-width: 36px; }
.filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.filters input { grid-column: 1 / -1; }
.errors { background: #fde8e6; color: #9b2a22; border-radius: 10px; padding: 10px 14px; margin: 0 0 12px; font-size: 14px; }
.errors ul { margin: 0; padding-left: 18px; }

/* ---------- misc ---------- */
.empty-state { text-align: center; padding: 32px 16px; color: var(--ink-2); }
.empty-state .big { font-size: 40px; }
.trophy { display: flex; gap: 14px; align-items: center; background: linear-gradient(135deg, #fff6dc, #ffe9b0); border: 1px solid #f2d27a; border-radius: var(--radius); padding: 16px; }
.trophy .ico { font-size: 34px; }
.list-plain { list-style: none; margin: 0; padding: 0; }
.list-plain li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.list-plain li:last-child { border-bottom: 0; }
.stats-table input[type=number] { width: 58px; padding: 6px; text-align: center; }
.stats-table input[type=checkbox] { width: 18px; height: 18px; }
.stats-table td, .stats-table th { padding: 6px 4px; white-space: nowrap; }
.foot { color: var(--ink-2); font-size: 13px; padding-bottom: 32px; }
