:root {
  --bg: #ffffff;
  --ink: #111111;
  --muted: #6b6b6b;
  --line: #111111;
  --soft: #f1f1f1;
  --accent: #c8102e;
  --video: #c8102e;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
}
/* Background: muted looping YouTube video, scaled to cover the window */
body { background: #000; }
#bgVideo {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  background: #000;
}
#bgVideo video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}
#bgVideo::after {
  content: "";
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, .55);
}
header, footer { color: #fff; }
header .hint, footer { color: #d6d6d6; }
header .bar { background: rgba(255, 255, 255, .25); }
.cell { background: rgba(255, 255, 255, .15); color: #fff; border-color: rgba(255, 255, 255, .8); text-shadow: 0 1px 2px rgba(0, 0, 0, .8); }
.cell.locked { background: rgba(255, 255, 255, .35); border-color: rgba(255, 255, 255, .45); color: rgba(255, 255, 255, .7); }
.cell.locked:hover { background: rgba(255, 255, 255, .35); color: rgba(255, 255, 255, .7); }

header {
  max-width: 760px;
  margin: 0 auto;
  padding: 28px 16px 8px;
  text-align: center;
}
h1 { margin: 0 0 6px; font-size: clamp(20px, 4vw, 30px); }
.count { margin: 0 0 10px; font-size: 18px; }
.count strong { font-size: 28px; color: var(--accent); }
.bar { height: 8px; background: var(--soft); border-radius: 99px; overflow: hidden; }
#barFill { height: 100%; width: 0; background: var(--accent); }
.hint { color: var(--muted); font-size: 14px; margin: 10px 0 0; }

/* 10 boxes per row, split 5 + 5 like the sketch */
#grid {
  max-width: 760px;
  margin: 16px auto 16px;
  padding: 0 16px;
  display: grid;
  grid-template-columns: repeat(5, 1fr) 14px repeat(5, 1fr);
  gap: 8px 6px;
}
.cell {
  aspect-ratio: 4 / 3;
  min-width: 0;
  padding: 0;
  border: 3px solid var(--line);
  border-radius: 9px;
  background: var(--bg);
  color: var(--ink);
  font-family: inherit;
  font-weight: 700;
  font-size: clamp(10px, 2.3vw, 17px);
  line-height: 1;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.cell:nth-child(10n + 6) { grid-column-start: 7; }
.cell:hover, .cell:focus-visible { background: var(--ink); color: var(--bg); outline: none; }
.cell.has-video { border-color: var(--video); color: var(--video); }
.cell.has-video:hover, .cell.has-video:focus-visible { background: var(--video); color: #fff; }
.cell.locked {
  border-color: #cfcfcf;
  color: #c4c4c4;
  background: #fafafa;
  cursor: not-allowed;
}
.cell.locked:hover { background: #fafafa; color: #c4c4c4; }

footer {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 16px 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
}

button, #searchBtn {
  font: inherit;
  font-size: 14px;
  padding: 8px 12px;
  border: 2px solid var(--line);
  border-radius: 8px;
  background: var(--bg);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}
button:hover:not(.cell):not(:disabled), #searchBtn:hover { background: var(--ink); color: var(--bg); }
button:disabled { opacity: .35; cursor: default; }

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .6);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 12px;
  overflow-y: auto;
}
#overlay[hidden] { display: none; }
#modal {
  position: relative;
  width: 100%;
  max-width: 1000px;
  background: var(--bg);
  border-radius: 14px;
  padding: 22px 20px 18px;
}
#closeBtn {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 22px;
  line-height: 1;
}
#mNumber { margin: 0; color: var(--accent); font-weight: 700; }
#mTitle { margin: 2px 40px 2px 0; font-size: 22px; }
#mSub { margin: 0 0 12px; color: var(--muted); }
#mFacts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 8px;
  margin: 0 0 10px;
}
#mFacts div { background: var(--soft); border-radius: 8px; padding: 8px 10px; }
#mFacts dt { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
#mFacts dd { margin: 2px 0 0; font-weight: 600; text-transform: capitalize; }
#mNotes { margin: 0 0 12px; font-size: 14px; }
#mNotes:empty { display: none; }

#videoBox { margin-bottom: 12px; }
#videoBox iframe {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  border-radius: 10px;
  background: #000;
}
#videoBox .empty {
  margin: 0;
  padding: 18px;
  border: 2px dashed #c9c9c9;
  border-radius: 10px;
  color: var(--muted);
  text-align: center;
  font-size: 14px;
}
#searchBtn { display: inline-block; }

#videoForm { display: none; }
#videoForm label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
.row { display: flex; gap: 6px; flex-wrap: wrap; }
.row input {
  flex: 1 1 220px;
  min-width: 0;
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
  border: 2px solid var(--line);
  border-radius: 8px;
}
#formMsg { margin: 6px 0 0; font-size: 13px; color: var(--muted); min-height: 1em; }

.nav { display: flex; justify-content: space-between; margin-top: 12px; }

/* Background music: small YouTube player (Coldplay - Viva La Vida) */
#music {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}
/* player is kept off-screen: only the sound is used */
#musicPlayer, #music iframe { position: fixed; left: -9999px; top: 0; width: 200px; height: 113px; border: 0; opacity: 0; pointer-events: none; }
#musicBtn { background: rgba(255, 255, 255, .92); }
#overlay { z-index: 10; }

/* see-through boxes over the background video */
.cell.has-video { color: #fff; }
.cell.locked { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .3); color: rgba(255, 255, 255, .45); }
.cell.locked:hover { background: rgba(255, 255, 255, .06); color: rgba(255, 255, 255, .45); }
.cell { background: rgba(255, 255, 255, .15); color: #fff; }
.cell.has-video { background: rgba(255, 255, 255, .15); color: #fff; border-color: var(--video); }
.cell:hover, .cell:focus-visible, .cell.has-video:hover, .cell.has-video:focus-visible { background: var(--video); color: #fff; }
.cell.locked, .cell.locked:hover { background: rgba(255, 255, 255, .06); border-color: rgba(255, 255, 255, .3); color: rgba(255, 255, 255, .45); }

/* pages of 100 goals */
#pager { max-width: 760px; margin: 0 auto 28px; padding: 0 16px; display: flex; justify-content: space-between; align-items: center; color: #fff; font-weight: 700; }

/* team logos in the goal popup title */
#mTitle { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
#mTitle .team { display: inline-flex; align-items: center; gap: 8px; }
#mTitle .team img { width: 40px; height: 40px; object-fit: contain; }
#mTitle .vs { color: var(--muted); font-weight: 400; font-size: 16px; }
