:root {
  --bg: #0d0d0d;
  --pitch: #1b3d1b;
  --pitch2: #1f451f;
  --surface: #161616;
  --surface2: #1e1e1e;
  --border: #2a2a2a;
  --gold: #f0c040;
  --gold2: #c9a030;
  --green: #3ddc84;
  --red: #cc3333;
  --text: #f0f0f0;
  --muted: #666;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}
html,
body {
  height: 100%;
}
body {
  background: var(--bg);
  color: var(--text);
  font-family: "DM Sans", sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.hdr {
  width: 100%;
  padding: 0.5rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.hdr > div:first-child,
.hdr-r {
  min-width: 80px;
}
.hdr-r {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
}
.logo {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.5rem;
  letter-spacing: 0.15em;
  color: var(--gold);
}
.hdr-c {
  text-align: center;
  flex: 1;
}
.hdr-meta {
  font-family: "Space Mono", monospace;
  font-size: 0.62rem;
  color: var(--muted);
  letter-spacing: 0.1em;
}
.pbar {
  width: 120px;
  height: 2px;
  background: var(--border);
  border-radius: 2px;
  margin: 4px auto 0;
}
.pfill {
  height: 100%;
  background: var(--gold);
  border-radius: 2px;
  transition: width 0.4s;
  width: 0%;
}
.btn {
  font-family: "Space Mono", monospace;
  font-size: 0.6rem;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.7rem;
  border-radius: 4px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover {
  border-color: var(--gold2);
  color: var(--gold);
}
.btn.gold {
  border-color: var(--gold2);
  color: var(--gold);
  background: rgba(240, 192, 64, 0.08);
}
.btn:disabled {
  opacity: 0.3;
  pointer-events: none;
}

.screen {
  display: none;
  width: 100%;
  max-width: 680px;
  padding: 0.5rem 1rem 0.5rem;
  flex-direction: column;
  align-items: center;
}
.screen.active {
  display: flex;
  animation: fadeUp 0.3s ease;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.stitle {
  font-family: "Bebas Neue", sans-serif;
  font-size: 2rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.3rem;
}
.ssub {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 1.8rem;
}

.fgrid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 64px;
  gap: 0.6rem;
  width: 100%;
}
.fbtn {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 0.6rem;
  cursor: pointer;
  transition: all 0.15s;
  text-align: center;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1rem;
  letter-spacing: 0.06em;
  color: var(--text);
}
.fbtn:hover {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(240, 192, 64, 0.05);
}
.fbtn.sel {
  border-color: var(--gold);
  color: var(--gold);
  background: rgba(240, 192, 64, 0.1);
}
.btn-start {
  margin-top: 1.8rem;
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.12em;
  padding: 0.85rem 2.8rem;
  border-radius: 7px;
  border: none;
  background: var(--gold);
  color: #000;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-start:hover {
  background: var(--gold2);
  transform: translateY(-2px);
}
.btn-start:disabled {
  opacity: 0.35;
  pointer-events: none;
  transform: none;
}

#s-team,
#s-place,
#s-result {
  justify-content: flex-start;
}

.plabel {
  font-family: "Bebas Neue", sans-serif;
  font-size: 0.85rem;
  letter-spacing: 0.2em;
  color: var(--muted);
  text-align: center;
  margin-bottom: 0.3rem;
}
.pitch {
  width: min(100%, 420px);
  aspect-ratio: 0.65 / 1;
  max-height: calc(100vh - 190px);
  min-height: 320px;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
  border: 2px solid rgba(255, 255, 255, 0.07);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
  background: repeating-linear-gradient(
    180deg,
    var(--pitch) 0%,
    var(--pitch) 8.33%,
    var(--pitch2) 8.33%,
    var(--pitch2) 16.66%,
    var(--pitch) 16.66%,
    var(--pitch) 25%,
    var(--pitch2) 25%,
    var(--pitch2) 33.33%,
    var(--pitch) 33.33%,
    var(--pitch) 41.66%,
    var(--pitch2) 41.66%,
    var(--pitch2) 50%,
    var(--pitch) 50%,
    var(--pitch) 58.33%,
    var(--pitch2) 58.33%,
    var(--pitch2) 66.66%,
    var(--pitch) 66.66%,
    var(--pitch) 75%,
    var(--pitch2) 75%,
    var(--pitch2) 83.33%,
    var(--pitch) 83.33%,
    var(--pitch) 91.66%,
    var(--pitch2) 91.66%,
    var(--pitch2) 100%
  );
}
.plines {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.plines svg {
  width: 100%;
  height: 100%;
}
.pplayers {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3% 3%;
}
.prow {
  display: flex;
  justify-content: space-around;
  align-items: center;
}
.prow:has(> :only-child) {
  justify-content: center;
}
.prow.wide {
  justify-content: space-between;
  padding: 0 5%;
}

.p-circ {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  cursor: pointer;
}
.p-circ:hover .pbub {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(204, 51, 51, 0.5);
}
.pbub {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--red);
  border: 2.5px solid rgba(255, 255, 255, 0.25);
  overflow: hidden;
  position: relative;
  transition: all 0.18s;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
}
.pbub img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
  position: absolute;
  inset: 0;
}
.pbub .pnum {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.1rem;
  color: #fff;
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
.pbub.selp {
  border-color: #fff;
  background: var(--gold);
  box-shadow: 0 0 24px rgba(240, 192, 64, 0.6);
  transform: scale(1.12);
}
.pbub.selp .pnum {
  color: #000;
}
.plbl {
  font-size: 0.54rem;
  font-weight: 700;
  color: #fff;
  text-align: center;
  max-width: 60px;
  line-height: 1.1;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}

.sc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.sb {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.3);
  border: 2px dashed rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.25);
  transition: all 0.2s;
  overflow: hidden;
  position: relative;
}
.sc.place {
  cursor: pointer;
}
.sc.place .sb {
  border-color: var(--gold);
  border-style: solid;
  background: rgba(240, 192, 64, 0.07);
  animation: pulse 1s ease infinite;
}
.sc.place:hover .sb {
  background: rgba(240, 192, 64, 0.18);
  box-shadow: 0 0 18px rgba(240, 192, 64, 0.4);
}
.sc.filled .sb {
  border: 2.5px solid var(--green);
  background: rgba(0, 0, 0, 0.4);
}
.sb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top center;
}
.sb .snum {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1rem;
  color: #fff;
  position: relative;
  z-index: 2;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.9);
}
@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 8px rgba(240, 192, 64, 0.25);
  }
  50% {
    box-shadow: 0 0 22px rgba(240, 192, 64, 0.55);
  }
}
.slbl {
  font-size: 0.54rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  max-width: 60px;
  line-height: 1.2;
}
.sc.filled .slbl {
  color: var(--text);
}

@media (max-width: 420px) {
  .pbub,
  .sb {
    width: 42px;
    height: 42px;
  }
  .pbub .pnum,
  .sb .snum {
    font-size: 0.8rem;
  }
  .plbl,
  .slbl {
    font-size: 0.44rem;
  }
  .pplayers {
    padding: 2% 1.5%;
  }
}

.minfo {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 0.3rem;
}
.mteam {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.1rem;
  letter-spacing: 0.08em;
}
.msub {
  font-family: "Space Mono", monospace;
  font-size: 0.55rem;
  color: var(--muted);
}
.mscore {
  font-family: "Bebas Neue", sans-serif;
  font-size: 0.95rem;
  color: var(--gold);
}

.tracker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
  justify-content: center;
  margin-bottom: 0.4rem;
}
.tchip {
  font-family: "Space Mono", monospace;
  font-size: 0.5rem;
  padding: 1px 4px;
  border-radius: 3px;
  background: var(--surface2);
  border: 1px solid var(--border);
  color: var(--muted);
}
.tchip.done {
  opacity: 0.2;
}
.tchip.now {
  border-color: var(--gold2);
  color: var(--gold);
  background: rgba(240, 192, 64, 0.08);
}

.ptitle {
  font-family: "Bebas Neue", sans-serif;
  font-size: 1.4rem;
  letter-spacing: 0.1em;
  margin-bottom: 0.2rem;
}
.ptitle span {
  color: var(--gold);
}
.psub {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.8rem;
  font-family: "Space Mono", monospace;
}

.bbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(13, 13, 13, 0.96);
  border-top: 1px solid var(--border);
  padding: 0.4rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  z-index: 40;
}
.bbl {
  font-family: "Space Mono", monospace;
  font-size: 0.6rem;
  color: var(--muted);
  position: absolute;
  left: 1.5rem;
}
.bbr {
  font-family: "Space Mono", monospace;
  font-size: 0.6rem;
  color: var(--muted);
  text-align: center;
}
.bbr span {
  color: var(--gold);
}