:root {
  --grass1: #2e8b57;
  --grass2: #3aa869;
  --ink: #0d1b2a;
  --panel: #14233a;
  --panel2: #1d3354;
  --accent: #ffd23f;
  --accent2: #ff7a18;
  --good: #38d39f;
  --bad: #ff5d6c;
  --white: #f5f7fb;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  font-family: "Trebuchet MS", "Segoe UI", system-ui, sans-serif;
  color: var(--white);
  background: radial-gradient(circle at 50% -10%, #1b3b5f 0%, #0a1626 55%, #060d18 100%);
  -webkit-text-size-adjust: 100%;
}

#app {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.screen { display: none; width: 100%; max-width: 980px; }
.screen.active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Title ---------- */
.title-wrap { text-align: center; padding: 30px 10px; }
.logo {
  font-size: clamp(40px, 9vw, 92px);
  font-weight: 900;
  letter-spacing: 2px;
  line-height: .95;
  text-transform: uppercase;
  background: linear-gradient(180deg, #fff 0%, var(--accent) 55%, var(--accent2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 0 rgba(0,0,0,.35));
}
.logo small { display: block; font-size: .26em; letter-spacing: 8px; color: var(--good); -webkit-text-fill-color: var(--good); }
.tagline { opacity: .8; margin: 6px 0 26px; font-size: 18px; }

/* ---------- Panels & buttons ---------- */
.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--panel2) 100%);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 18px;
  padding: 22px;
  box-shadow: 0 18px 40px rgba(0,0,0,.45);
}
h2.section { margin: 0 0 4px; font-size: 26px; }
.sub { opacity: .7; margin: 0 0 18px; font-size: 14px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: inherit; font-weight: 800; cursor: pointer;
  border: none; border-radius: 14px; padding: 14px 22px; font-size: 18px;
  color: var(--ink);
  background: linear-gradient(180deg, var(--accent) 0%, var(--accent2) 100%);
  box-shadow: 0 6px 0 #b4530a, 0 10px 18px rgba(0,0,0,.35);
  transition: transform .06s ease, box-shadow .06s ease;
  text-transform: uppercase; letter-spacing: .5px;
}
.btn:active { transform: translateY(4px); box-shadow: 0 2px 0 #b4530a, 0 4px 10px rgba(0,0,0,.35); }
.btn.big { font-size: 22px; padding: 18px 34px; }
.btn.ghost {
  color: var(--white);
  background: rgba(255,255,255,.08);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.18);
}
.btn.ghost:active { transform: translateY(2px); }
.btn-row { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 10px; }

/* ---------- Form bits ---------- */
.grid2 { display: grid; grid-template-columns: 1.1fr .9fr; gap: 22px; }
@media (max-width: 760px){ .grid2 { grid-template-columns: 1fr; } }

label.fld { display: block; margin: 0 0 14px; }
label.fld > span { display: block; font-size: 13px; opacity: .8; margin-bottom: 6px; text-transform: uppercase; letter-spacing: .6px; }
input[type=text], textarea, select {
  width: 100%; font-family: inherit; font-size: 16px; color: var(--white);
  background: rgba(0,0,0,.28); border: 1px solid rgba(255,255,255,.14);
  border-radius: 10px; padding: 11px 12px;
}
textarea { resize: vertical; min-height: 110px; line-height: 1.5; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); }

.colors { display: flex; gap: 14px; flex-wrap: wrap; }
.colorpick { text-align: center; font-size: 12px; opacity: .85; }
.colorpick input[type=color] {
  width: 56px; height: 46px; border: none; border-radius: 10px; background: none; cursor: pointer;
  padding: 0;
}
.colorpick span { display: block; margin-top: 4px; }

.chips { display: flex; gap: 10px; flex-wrap: wrap; }
.chip {
  cursor: pointer; padding: 10px 16px; border-radius: 12px; font-weight: 700;
  background: rgba(255,255,255,.07); border: 2px solid transparent; user-select: none;
}
.chip.sel { border-color: var(--accent); background: rgba(255,210,63,.16); }

/* jersey preview */
.preview-box { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.jersey-name { font-size: 22px; font-weight: 900; letter-spacing: 1px; }

/* ---------- Opponent / team cards ---------- */
.team-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px,1fr)); gap: 12px; }
.team-card {
  cursor: pointer; border-radius: 14px; padding: 12px 8px 10px; text-align: center;
  background: rgba(255,255,255,.05); border: 2px solid transparent; transition: transform .08s ease;
}
.team-card:hover { transform: translateY(-3px); }
.team-card.sel { border-color: var(--good); background: rgba(56,211,159,.14); }
.team-card .cname { font-weight: 800; font-size: 14px; margin-top: 6px; }
.team-card .skill { font-size: 11px; opacity: .7; }

.opt-row { display: flex; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.opt-group { flex: 1; min-width: 200px; }
.opt-group > .lbl { font-size: 13px; opacity: .8; text-transform: uppercase; letter-spacing: .6px; margin-bottom: 8px; }

/* ---------- Match HUD ---------- */
#screen-match.active { display: flex; flex-direction: column; align-items: center; max-width: 1100px; }
.scoreboard {
  display: flex; align-items: center; gap: 14px; margin-bottom: 10px;
  background: rgba(0,0,0,.4); padding: 8px 16px; border-radius: 14px; font-weight: 800;
}
.scoreboard .team { display: flex; align-items: center; gap: 8px; }
.scoreboard .dot { width: 18px; height: 18px; border-radius: 5px; }
.scoreboard .score { font-size: 28px; min-width: 30px; text-align: center; }
.scoreboard .clock { font-size: 24px; color: var(--accent); min-width: 70px; text-align: center; }
/* keep 960x600 (1.6:1) aspect while never taller than the viewport */
.canvas-wrap { position: relative; width: 100%; max-width: min(100%, calc(60vh * 1.6)); margin: 0 auto; }
canvas#pitch { width: 100%; height: auto; display: block; border-radius: 14px; background: #14532d;
  box-shadow: 0 18px 40px rgba(0,0,0,.5); touch-action: none; }
.flash {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: clamp(34px, 8vw, 80px); font-weight: 900; color: #fff; pointer-events: none;
  text-shadow: 0 4px 0 rgba(0,0,0,.5); opacity: 0; transition: opacity .2s;
  letter-spacing: 3px; text-transform: uppercase;
}
.flash.show { opacity: 1; }

.controls-help { margin-top: 10px; font-size: 13px; opacity: .75; text-align: center; line-height: 1.7; }
.controls-help kbd {
  background: rgba(255,255,255,.12); border-radius: 5px; padding: 2px 7px; font-family: inherit; font-weight: 700;
  border: 1px solid rgba(255,255,255,.2);
}
.match-buttons { margin-top: 8px; }

/* on-screen touch controls */
.touch { display: none; position: absolute; inset: 0; pointer-events: none; }
.touch.on { display: block; }
.dpad { position: absolute; left: 12px; bottom: 12px; width: 150px; height: 150px; pointer-events: auto; }
.dpad button { position: absolute; width: 50px; height: 50px; border-radius: 12px; border: none;
  background: rgba(255,255,255,.22); color: #fff; font-size: 20px; font-weight: 900; }
.dpad .up { left: 50px; top: 0; } .dpad .down { left: 50px; bottom: 0; }
.dpad .left { left: 0; top: 50px; } .dpad .right { right: 0; top: 50px; }
.act { position: absolute; right: 14px; bottom: 18px; display: flex; gap: 12px; pointer-events: auto; }
.act button { width: 72px; height: 72px; border-radius: 50%; border: none; font-weight: 900; font-size: 14px; color: var(--ink); }
.act .shoot { background: var(--accent2); color:#fff; }
.act .pass { background: var(--good); }

/* ---------- Bracket ---------- */
.bracket { display: flex; gap: 30px; justify-content: center; overflow-x: auto; padding: 10px; }
.round { display: flex; flex-direction: column; justify-content: space-around; gap: 14px; min-width: 170px; }
.round h4 { text-align: center; opacity: .7; margin: 0 0 4px; font-size: 13px; text-transform: uppercase; }
.bmatch { background: rgba(0,0,0,.25); border-radius: 10px; padding: 6px; }
.bteam { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; font-size: 14px; font-weight: 700; }
.bteam .dot { width: 13px; height: 13px; border-radius: 4px; }
.bteam.win { background: rgba(56,211,159,.18); }
.bteam.lose { opacity: .45; }
.bteam.you { box-shadow: inset 0 0 0 2px var(--accent); border-radius: 7px; }
.bteam .bs { margin-left: auto; font-weight: 900; }

/* ---------- Result ---------- */
.result-wrap { text-align: center; padding: 20px; }
.trophy { font-size: 90px; }
.result-title { font-size: 40px; font-weight: 900; margin: 6px 0; }
.center { text-align: center; }
.mt { margin-top: 18px; }
.spacer { height: 16px; }
