:root {
  --bg: #07130d;
  --bg-2: #0d1f16;
  --panel: rgba(18, 38, 28, 0.72);
  --panel-solid: #12261c;
  --line: rgba(255, 255, 255, 0.09);
  --text: #eef7f0;
  --muted: #8fa99a;
  --accent: #c6ff3d;
  --accent-ink: #0b1a05;
  --home: #ff8a3d;
  --home-ink: #2b1100;
  --away: #4fd1ff;
  --away-ink: #00222e;
  --danger: #ff5d6c;
  --radius: 18px;
  --shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  --font-display: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --font-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font-body);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(198, 255, 61, 0.10), transparent 60%),
    radial-gradient(900px 500px at 110% 10%, rgba(79, 209, 255, 0.08), transparent 60%),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
a { color: inherit; }

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 800; font-size: 26px;
  letter-spacing: 0.04em; text-transform: uppercase; text-decoration: none;
}
.brand-ball {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--accent); display: grid; place-items: center;
  box-shadow: 0 0 24px rgba(198, 255, 61, 0.5);
}
.brand-ball svg { width: 20px; height: 20px; }
.brand span em { font-style: normal; color: var(--accent); }

.btn {
  border: 0; cursor: pointer; border-radius: 999px;
  padding: 12px 22px; font-weight: 700; letter-spacing: 0.01em;
  transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}
.btn:active { transform: translateY(1px) scale(0.99); }
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 10px 30px rgba(198, 255, 61, 0.25);
}
.btn-primary:hover { box-shadow: 0 12px 40px rgba(198, 255, 61, 0.4); }
.btn-ghost {
  background: rgba(255, 255, 255, 0.06); border: 1px solid var(--line);
}
.btn-ghost:hover { background: rgba(255, 255, 255, 0.12); }
.btn-sm { padding: 8px 14px; font-size: 13px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field label {
  font-size: 12px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.input {
  width: 100%; padding: 13px 16px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line);
  outline: none; transition: border-color .15s, box-shadow .15s;
  color-scheme: dark;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px rgba(198, 255, 61, 0.15); }

/* ------------------------------------------------------------ landing */
.landing {
  max-width: 1180px; margin: 0 auto; padding: 28px 24px 60px;
}
.landing nav { display: flex; justify-content: space-between; align-items: center; }
.hero {
  display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 48px;
  align-items: center; margin-top: 56px;
}
.eyebrow {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 6px 12px; border-radius: 999px; font-size: 12px; font-weight: 600;
  letter-spacing: 0.08em; text-transform: uppercase;
  background: rgba(198, 255, 61, 0.1); color: var(--accent);
  border: 1px solid rgba(198, 255, 61, 0.25);
}
.eyebrow::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 10px var(--accent);
  animation: pulse 1.8s ease-in-out infinite;
}
@keyframes pulse { 50% { opacity: 0.3; } }
.hero h1 {
  font-family: var(--font-display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(52px, 7vw, 92px); line-height: 0.9; margin: 20px 0 18px;
  letter-spacing: -0.01em;
}
.hero h1 .stroke { color: transparent; -webkit-text-stroke: 2px var(--accent); }
.hero p.lead { color: var(--muted); font-size: 18px; line-height: 1.6; max-width: 480px; }
.hero-stats { display: flex; gap: 32px; margin-top: 32px; }
.hero-stats div { font-family: var(--font-display); font-size: 34px; font-weight: 800; }
.hero-stats small {
  display: block; font-family: var(--font-body); font-size: 12px; font-weight: 500;
  color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase;
}

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 24px;
  padding: 30px; box-shadow: var(--shadow); backdrop-filter: blur(16px);
  position: relative; overflow: hidden;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 4px;
  background: linear-gradient(90deg, var(--home), var(--accent), var(--away));
}
.card h2 {
  font-family: var(--font-display); font-size: 30px; text-transform: uppercase;
  margin: 0 0 4px; letter-spacing: 0.02em;
}
.card .sub { color: var(--muted); margin: 0 0 24px; font-size: 14px; }
.form-grid { display: grid; gap: 18px; }
.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.size-picker { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.size-picker input { position: absolute; opacity: 0; pointer-events: none; }
.size-picker label {
  cursor: pointer; text-align: center; padding: 14px 6px; border-radius: 14px;
  border: 1px solid var(--line); background: rgba(0, 0, 0, 0.25);
  transition: all .15s ease; text-transform: none; letter-spacing: 0; color: var(--text);
}
.size-picker label b {
  display: block; font-family: var(--font-display); font-size: 34px; line-height: 1;
}
.size-picker label span { font-size: 12px; color: var(--muted); }
.size-picker input:checked + label {
  border-color: var(--accent); background: rgba(198, 255, 61, 0.12);
  box-shadow: 0 0 0 4px rgba(198, 255, 61, 0.12) inset;
}
.size-picker input:checked + label b { color: var(--accent); }
.size-picker input:focus-visible + label { outline: 2px solid var(--accent); }

.recent { margin-top: 64px; }
.recent h3 {
  font-family: var(--font-display); text-transform: uppercase; font-size: 22px;
  letter-spacing: 0.04em; margin: 0 0 16px; color: var(--muted);
}
.recent-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.recent-item {
  display: block; text-decoration: none; padding: 18px 20px; border-radius: 16px;
  background: var(--panel); border: 1px solid var(--line); transition: transform .15s, border-color .15s;
}
.recent-item:hover { transform: translateY(-2px); border-color: rgba(198, 255, 61, 0.4); }
.recent-item strong { display: block; font-size: 16px; }
.recent-item span { font-size: 13px; color: var(--muted); }

/* ------------------------------------------------------------ game page */
.game-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 16px 28px;
  border-bottom: 1px solid var(--line); background: rgba(7, 19, 13, 0.7);
  backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20;
}
.topbar .meta { display: flex; flex-direction: column; gap: 2px; margin-left: 12px;
  padding-left: 20px; border-left: 1px solid var(--line); min-width: 0; }
.topbar .meta strong {
  font-family: var(--font-display); font-size: 22px; text-transform: uppercase;
  letter-spacing: 0.03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.topbar .meta span { font-size: 13px; color: var(--muted); }
.topbar .actions { margin-left: auto; display: flex; gap: 10px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px;
  border-radius: 999px; background: rgba(198, 255, 61, 0.12); color: var(--accent);
  font-size: 12px; font-weight: 700;
}

.game-main {
  flex: 1; display: grid; grid-template-columns: 340px 1fr; gap: 28px;
  padding: 28px; max-width: 1400px; width: 100%; margin: 0 auto;
}

.roster {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px; display: flex; flex-direction: column; gap: 18px;
  align-self: start; position: sticky; top: 96px; max-height: calc(100vh - 124px);
}
.roster-head { display: flex; justify-content: space-between; align-items: baseline; }
.roster-head h2 {
  margin: 0; font-family: var(--font-display); font-size: 26px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.roster-head span { color: var(--muted); font-size: 13px; }
.add-form { display: flex; gap: 8px; }
.add-form .input { padding: 11px 14px; }
.add-form .btn { padding: 0 18px; flex-shrink: 0; }

.bench {
  flex: 1; overflow-y: auto; min-height: 140px; border-radius: 14px;
  border: 1.5px dashed var(--line); padding: 10px;
  display: flex; flex-direction: column; gap: 8px;
  transition: border-color .15s, background .15s;
}
.bench.drop-target { border-color: var(--accent); background: rgba(198, 255, 61, 0.06); }
.bench-empty {
  margin: auto; text-align: center; color: var(--muted); font-size: 14px; padding: 20px;
  line-height: 1.5;
}

.chip {
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px;
  border-radius: 12px; background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line); cursor: grab; user-select: none; touch-action: none;
  transition: background .15s, border-color .15s, transform .15s;
}
.chip:hover { background: rgba(255, 255, 255, 0.08); border-color: rgba(255, 255, 255, 0.18); }
.chip.dragging-source { opacity: 0.3; }
.chip .avatar {
  width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 800; font-size: 13px; background: linear-gradient(135deg, #2a4a38, #1a3326);
  border: 1px solid rgba(255, 255, 255, 0.12); flex-shrink: 0;
}
.chip .name { flex: 1; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chip .remove {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center;
  opacity: 0; transition: opacity .15s, background .15s, color .15s;
}
.chip:hover .remove, .chip .remove:focus-visible { opacity: 1; }
.chip .remove:hover { background: rgba(255, 93, 108, 0.15); color: var(--danger); }

.roster-foot { display: flex; gap: 8px; }
.roster-foot .btn { flex: 1; }
.hint { font-size: 12px; color: var(--muted); line-height: 1.5; margin: 0; }

/* ------------------------------------------------------------ pitch */
.pitch-col {
  --pitch-w: min(100%, 620px, calc((100vh - 230px) * 0.68));
  display: flex; flex-direction: column; gap: 14px; align-items: center;
}
.team-bar {
  width: var(--pitch-w); display: flex; align-items: center; gap: 12px;
}
.team-bar .swatch { width: 14px; height: 14px; border-radius: 4px; }
.team-bar.home .swatch { background: var(--home); box-shadow: 0 0 14px var(--home); }
.team-bar.away .swatch { background: var(--away); box-shadow: 0 0 14px var(--away); }
.team-name {
  font-family: var(--font-display); font-size: 26px; font-weight: 800; text-transform: uppercase;
  letter-spacing: 0.03em; background: transparent; border: 1px solid transparent;
  border-radius: 8px; padding: 2px 8px; width: 220px; outline: none;
}
.team-name:hover { border-color: var(--line); }
.team-name:focus { border-color: var(--accent); background: rgba(0, 0, 0, 0.3); }
.team-count { margin-left: auto; font-weight: 700; font-size: 14px; color: var(--muted); }
.team-count b { color: var(--text); font-size: 18px; }
.team-count.full b { color: var(--accent); }

.pitch {
  position: relative; width: var(--pitch-w); aspect-ratio: 68 / 100;
  border-radius: 22px; overflow: hidden; box-shadow: var(--shadow), 0 0 0 6px rgba(255,255,255,0.04);
  background:
    repeating-linear-gradient(180deg, #2f8a4a 0 10%, #2a7d43 10% 20%);
}
.pitch::after { /* vignette & sheen */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    radial-gradient(120% 70% at 50% 50%, transparent 55%, rgba(0, 0, 0, 0.35)),
    linear-gradient(115deg, rgba(255,255,255,0.06), transparent 40%);
}
.pitch svg.lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.half {
  position: absolute; left: 0; right: 0; height: 50%;
  transition: background .2s ease, box-shadow .2s ease;
}
.half.home { top: 0; }
.half.away { bottom: 0; }
.half.drop-target.home { background: rgba(255, 138, 61, 0.18); box-shadow: inset 0 0 0 3px var(--home); }
.half.drop-target.away { background: rgba(79, 209, 255, 0.16); box-shadow: inset 0 0 0 3px var(--away); }
.half.drop-blocked { background: rgba(255, 93, 108, 0.18); box-shadow: inset 0 0 0 3px var(--danger); }
.half-label {
  position: absolute; left: 50%; transform: translateX(-50%);
  font-family: var(--font-display); font-weight: 800; font-size: 13px;
  letter-spacing: 0.25em; text-transform: uppercase; color: rgba(255, 255, 255, 0.35);
  pointer-events: none;
}
.half.home .half-label { bottom: 10px; }
.half.away .half-label { top: 10px; }

.token {
  position: absolute; transform: translate(-50%, -50%); z-index: 2;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: grab; user-select: none; touch-action: none;
  transition: left .25s cubic-bezier(.2,.8,.2,1), top .25s cubic-bezier(.2,.8,.2,1);
}
.token.dragging-source { opacity: 0.25; }
.token .disc {
  width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  border: 3px solid rgba(255, 255, 255, 0.9);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.35), inset 0 -6px 12px rgba(0, 0, 0, 0.18);
}
.token.home .disc { background: linear-gradient(160deg, #ffb07a, var(--home)); color: var(--home-ink); }
.token.away .disc { background: linear-gradient(160deg, #a5e9ff, var(--away)); color: var(--away-ink); }
.token .label {
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(5, 15, 10, 0.78); white-space: nowrap; max-width: 120px;
  overflow: hidden; text-overflow: ellipsis;
}

.drag-ghost {
  position: fixed; z-index: 1000; pointer-events: none; transform: translate(-50%, -50%) scale(1.08);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  filter: drop-shadow(0 16px 24px rgba(0, 0, 0, 0.5));
}
.drag-ghost .disc {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-display); font-weight: 800; font-size: 20px;
  background: var(--accent); color: var(--accent-ink); border: 3px solid #fff;
}
.drag-ghost.home .disc { background: var(--home); color: var(--home-ink); }
.drag-ghost.away .disc { background: var(--away); color: var(--away-ink); }
.drag-ghost .label {
  padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 700;
  background: rgba(5, 15, 10, 0.85);
}

.toast {
  position: fixed; left: 50%; bottom: 28px; transform: translate(-50%, 30px);
  background: var(--panel-solid); border: 1px solid var(--line); padding: 12px 18px;
  border-radius: 12px; box-shadow: var(--shadow); opacity: 0; pointer-events: none;
  transition: all .25s ease; z-index: 1001; font-weight: 600; font-size: 14px;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: rgba(255, 93, 108, 0.5); color: #ffc0c6; }

.notfound { min-height: 100vh; display: grid; place-items: center; text-align: center; padding: 24px; }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; margin-top: 32px; }
  .game-main { grid-template-columns: 1fr; padding: 16px; }
  .roster { position: static; max-height: none; }
  .bench { max-height: 260px; }
  .pitch-col { --pitch-w: 100%; }
  .topbar { padding: 12px 16px; flex-wrap: wrap; }
  .topbar .meta { margin-left: 0; padding-left: 0; border-left: 0; }
  .token .disc { width: 42px; height: 42px; font-size: 16px; }
}
@media (max-width: 520px) {
  .row-2 { grid-template-columns: 1fr; }
  .card { padding: 22px; }
  .team-name { width: 150px; font-size: 22px; }
}

/* ------------------------------------------------------------ confirm modal */
.btn-danger { background: var(--danger); color: #2a0007; box-shadow: 0 10px 30px rgba(255, 93, 108, 0.25); }
.btn-danger:hover { box-shadow: 0 12px 40px rgba(255, 93, 108, 0.4); }
.modal-backdrop {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px;
  background: rgba(2, 8, 5, 0.65); backdrop-filter: blur(6px);
  animation: fade .15s ease;
}
.modal-backdrop[hidden] { display: none; }
.modal {
  width: 100%; max-width: 400px; text-align: center; padding: 30px 28px 24px;
  background: var(--panel-solid); border: 1px solid var(--line); border-radius: 22px;
  box-shadow: var(--shadow); animation: pop .2s cubic-bezier(.2,.9,.3,1.2);
}
.modal-icon {
  width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 28px; font-weight: 800;
  background: rgba(255, 93, 108, 0.14); color: var(--danger);
}
.modal h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 28px; text-transform: uppercase; }
.modal p { margin: 0 0 22px; color: var(--muted); line-height: 1.5; }
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: scale(0.92); opacity: 0; } }
