:root {
  --bg: #0d1117;
  --panel: #161b22;
  --ink: #e6edf3;
  --muted: #8b949e;
  --accent: #f7b955;
  --accent2: #4ec9b0;
  --pitch: #2d8a3e;
  --line: #ffffff;
  --teamA: #ff6b6b;
  --teamB: #4ea8ff;
  --danger: #f85149;
  --shadow: 0 6px 18px rgba(0,0,0,.3);
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink); font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; }
h1, h2 { margin: 0 0 .5em; }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.2em; font-size: .9em; }
.hidden { display: none !important; }

.btn {
  display: inline-block; padding: .7em 1.2em; border-radius: .5em;
  background: var(--panel); color: var(--ink); border: 1px solid #30363d;
  cursor: pointer; text-decoration: none; font-size: 1em;
}
.btn:hover { background: #1f242c; }
.btn.primary { background: var(--accent); color: #1a1300; border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { filter: brightness(1.1); }
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.big { font-size: 1.1em; padding: 1em 1.6em; }

.card {
  background: var(--panel); border-radius: 1em; padding: 1.5em;
  box-shadow: var(--shadow); max-width: 480px; margin: 1em auto;
}
.row { display: flex; gap: 1em; flex-wrap: wrap; }
.row > * { flex: 1; text-align: center; }

.centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 1em; }

/* Player view (laptop) */
.player { max-width: 720px; margin: 0 auto; padding: 1.5em 1em; }
.player h1 { font-size: 2em; text-align: center; margin: .4em 0 .6em; }
.player label { display: block; margin: .8em 0 .3em; color: var(--muted); font-size: .95em; }
.player input, .player select {
  width: 100%; padding: .7em; border-radius: .5em;
  background: #0d1117; color: var(--ink); border: 1px solid #30363d;
  font-size: 1em;
}
.stats { display: grid; gap: .7em; margin: 1em 0; }
.stat { display: grid; grid-template-columns: 1fr auto auto; gap: .7em; align-items: center; }
.stat label { margin: 0; color: var(--ink); }
.stat label .blurb { display: block; color: var(--muted); font-size: .72em; font-weight: 400; margin-top: .15em; line-height: 1.25; }
.stat-controls { display: flex; gap: .3em; }
.stat-controls button {
  width: 2.2em; height: 2.2em; border-radius: 50%; border: 1px solid #30363d;
  background: var(--panel); color: var(--ink); font-size: 1.1em; cursor: pointer;
}
.stat-val { display: inline-block; min-width: 1.5em; text-align: center; font-weight: 600; }

/* Host view */
.host { background: linear-gradient(180deg, #0d1117 0%, #11161e 100%); }
.hostbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: .8em 1.5em; border-bottom: 1px solid #21262d;
}
.brand { font-size: 1.3em; font-weight: 700; }
.roominfo { font-size: 1.1em; }
.code { font-family: ui-monospace, monospace; font-size: 1.4em; color: var(--accent); letter-spacing: .15em; }
.stage { padding: 1.5em; max-width: 1400px; margin: 0 auto; }
.screen h1 { font-size: 2.5em; margin: .3em 0 .5em; }
.big-url { font-size: 2em; font-family: ui-monospace, monospace; color: var(--accent); }
.player-list { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .8em; margin: 1.5em 0; }
.player-list li {
  background: var(--panel); padding: .6em 1em; border-radius: 2em;
  font-size: 1.1em; border: 1px solid #30363d;
}
.player-list li.ready { border-color: var(--accent2); }
.player-list li.ready::after { content: " ✓"; color: var(--accent2); }

.teams { display: flex; gap: 1em; margin: 1.5em 0; flex-wrap: wrap; }
.team-card {
  background: var(--panel); padding: 1em 1.2em; border-radius: .8em;
  flex: 1; min-width: 200px; border-top: 4px solid var(--accent);
}
.team-card h3 { margin: 0 0 .5em; }
.team-card ul { list-style: none; padding: 0; margin: 0; }
.team-card li { padding: .2em 0; }
.team-card .role { color: var(--muted); font-size: .9em; margin-left: .5em; }

.fixtures { display: grid; gap: .5em; max-width: 700px; }
.fixture {
  display: grid; grid-template-columns: 1fr auto 1fr auto; gap: 1em;
  padding: .8em 1em; background: var(--panel); border-radius: .5em; align-items: center;
}
.fixture .a { text-align: right; }
.fixture .b { text-align: left; }
.fixture .vs { color: var(--muted); }
.fixture.played { opacity: .7; }
.fixture .badge { padding: .2em .6em; border-radius: 1em; background: var(--accent); color: #1a1300; font-size: .85em; font-weight: 600; }

#standings { margin: 1.5em 0; }
#standings table { width: 100%; max-width: 700px; border-collapse: collapse; }
#standings th, #standings td { padding: .4em .8em; text-align: left; border-bottom: 1px solid #21262d; }
#standings th { color: var(--muted); font-weight: 500; font-size: .9em; }

/* Match */
.scoreboard {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: center; gap: 2em; padding: 1em 2em;
  background: var(--panel); border-radius: .8em; margin-bottom: 1em;
  position: relative;
}
.team-name { font-size: 2em; font-weight: 700; }
.team-name:first-of-type { text-align: right; color: var(--teamA); }
.team-name:last-of-type { text-align: left; color: var(--teamB); }
.score { font-size: 3em; font-weight: 800; font-family: ui-monospace, monospace; }
.clock { position: absolute; top: .5em; right: 1em; color: var(--muted); font-family: ui-monospace, monospace; }
.speedctl {
  display: flex; align-items: center; gap: .6em; justify-content: center;
  margin: 0 auto .8em; max-width: 1200px;
}
.speedctl input[type=range] { width: 220px; accent-color: var(--accent); }
.speedctl .btn { padding: .35em .7em; font-size: .95em; }
.speed-val { font-family: ui-monospace, monospace; min-width: 4em; text-align: center; color: var(--accent); }
#pitch {
  display: block; margin: 0 auto;
  background: var(--pitch); border-radius: .8em;
  max-width: 100%; height: auto;
}
.commentary {
  max-width: 1200px; margin: 1em auto 0; padding: 1em;
  background: var(--panel); border-radius: .8em;
  font-family: ui-monospace, monospace; font-size: 1.1em;
  max-height: 180px; overflow-y: auto;
}
.commentary div { padding: .15em 0; }
.commentary div.goal { color: var(--accent); font-weight: 700; }
.commentary div.card-yellow { color: #d4a017; }
.commentary div.card-red { color: var(--danger); font-weight: 700; }

.mvp {
  max-width: 1200px; margin: 1em auto 0; padding: .8em 1.2em;
  background: linear-gradient(90deg, rgba(247,185,85,.18), rgba(247,185,85,.05));
  border: 1px solid var(--accent); border-radius: .8em;
  color: var(--accent); font-weight: 700; font-size: 1.4em; text-align: center;
  font-family: ui-monospace, monospace;
}

/* Goal celebration pop-up (overlays the pitch, brief pause) */
.pitch-wrap { position: relative; display: inline-block; max-width: 100%; }
.pitch-wrap canvas { display: block; max-width: 100%; height: auto; }
.goal-pop {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  pointer-events: none; opacity: 0; transition: opacity .12s; padding: 0 1rem;
  font: 800 clamp(2rem, 7vw, 5rem)/1.05 -apple-system, "Segoe UI", sans-serif;
  color: #fff; text-align: center; text-shadow: 0 4px 24px rgba(0,0,0,.8), 0 0 10px var(--accent);
  background: radial-gradient(ellipse at center, rgba(247,185,85,.30), rgba(13,17,23,.55));
  border-radius: .8em;
}
.goal-pop.show { opacity: 1; animation: goalPulse .5s ease; }
.goal-pop::before { content: "⚽ GOAL! "; }
@keyframes goalPulse { 0% { transform: scale(.55); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

.awards { display: grid; gap: 1em; margin: 2em 0; }
.award { background: var(--panel); padding: 1em 1.5em; border-radius: .5em; }
.award strong { color: var(--accent); }
