@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-Regular.ttf") format("truetype");
  font-style: normal;
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-SemiBold.ttf") format("truetype");
  font-style: normal;
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Montserrat";
  src: url("/assets/fonts/Montserrat-Bold.ttf") format("truetype");
  font-style: normal;
  font-weight: 700;
  font-display: swap;
}

:root {
  color-scheme: dark;
  font-family: "Montserrat", Arial, sans-serif;
  background: #07111f;
  color: #ffffff;
  --mc-bg: #07111f;
  --mc-panel: #0b1728;
  --mc-panel-deep: #081321;
  --mc-panel-soft: #0d1a2c;
  --mc-text: #ffffff;
  --mc-muted: #b7c1cf;
  --mc-muted-2: #8795a8;
  --mc-gold: #f0c545;
  --mc-line: #20354f;
}

* { box-sizing: border-box; }

html {
  overflow-x: hidden;
  scrollbar-width: none;
}

html::-webkit-scrollbar,
body::-webkit-scrollbar {
  display: none;
}

body {
  margin: 0;
  padding: 0;
  overflow-x: hidden;
  scrollbar-width: none;
  background: var(--mc-bg);
}

main {
  width: 100%;
  max-width: 1100px;
  margin: auto;
  overflow: hidden;
  background: var(--mc-panel);
  border: 1px solid var(--mc-line);
  border-top: 3px solid var(--mc-gold);
}

.scoreboard {
  padding: 22px 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
  background: var(--mc-panel-soft);
  border-bottom: 1px solid var(--mc-line);
}

.team {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
}

.team.away { flex-direction: row-reverse; }

.match-kit { flex: 0 0 48px; display: grid; justify-items: center; font-size: 8px; color: var(--mc-muted); text-align: center; }
.match-kit img { width: 44px; height: 48px; object-fit: contain; }
button:disabled { opacity: .6; cursor: wait; }

.team h1 {
  margin: 0;
  overflow-wrap: anywhere;
  color: var(--mc-text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.1;
  text-transform: uppercase;
}

.team-badge {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
}

.team-badge img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.team-badge img[hidden] { display: none; }

.team-badge__fallback {
  width: 48px;
  height: 48px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-size: 13px;
  font-weight: 900;
}

.team-badge__fallback:not([hidden]) { display: grid; }

.scorecentre {
  min-width: 0;
  text-align: center;
}

#clock {
  color: var(--mc-gold);
  font-size: 15px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

#score {
  margin: 4px 0;
  color: var(--mc-text);
  font-size: 44px;
  font-weight: 900;
  line-height: 1;
  white-space: nowrap;
}

#score span {
  color: var(--mc-muted-2);
  font-weight: 500;
}

#phase {
  color: var(--mc-muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.field {
  position: relative;
  background: #194b39;
  border-top: 1px solid var(--mc-line);
  border-bottom: 1px solid var(--mc-line);
}

canvas {
  width: 100%;
  height: auto;
  display: block;
}

#curtain {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: rgba(6, 16, 28, 0.82);
  backdrop-filter: blur(2px);
}

#curtain > div {
  color: var(--mc-text);
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

#curtain p { color: var(--mc-muted); }

button,
select {
  min-height: 46px;
  padding: 0 18px;
  border: 1px solid #36516f;
  border-radius: 0;
  background: #12243b;
  color: var(--mc-text);
  font: inherit;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  cursor: pointer;
}

button:hover,
select:hover {
  background: #183150;
  border-color: #4a6d93;
}

button:focus-visible,
select:focus-visible {
  outline: 2px solid var(--mc-gold);
  outline-offset: 2px;
}

#start,
#play {
  background: var(--mc-gold);
  border-color: var(--mc-gold);
  color: var(--mc-bg);
}

#start:hover,
#play:hover {
  background: #ffdc65;
  border-color: #ffdc65;
}

#banner {
  position: absolute;
  top: 20px;
  left: 50%;
  display: none;
  padding: 14px 26px;
  transform: translateX(-50%);
  background: var(--mc-gold);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.42);
  color: var(--mc-bg);
  font-size: 22px;
  font-weight: 900;
  white-space: nowrap;
}

#banner.red-card-banner {
  border-left: 6px solid #ff6874;
  background: #b31322;
  color: #ffffff;
}

#banner.decision-banner {
  border: 1px solid #f2c94c;
  background: #07111f;
  color: #f2c94c;
  letter-spacing: 0.06em;
}

#banner.yellow-card-banner {
  border-left: 6px solid #fff3a6;
  background: #ffd229;
  color: #07111f;
}

.goal-flash { animation: goalPulse 0.8s ease-out 2; }

@keyframes goalPulse {
  50% { box-shadow: inset 0 0 60px var(--goal-flash, var(--mc-gold)); }
}

.commentary {
  position: relative;
  min-height: 88px;
  padding: 18px 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--mc-panel-soft);
  border-bottom: 1px solid var(--mc-line);
  text-align: center;
}

#minute {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  min-width: 44px;
  color: var(--mc-gold);
  font-size: 18px;
  font-weight: 900;
  text-align: center;
}

#comment {
  width: 100%;
  color: var(--mc-text);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
}

.controls {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--mc-panel-deep);
}

.controls button,
.controls select {
  min-height: 58px;
  padding: 0 24px;
  font-size: 14px;
}

#play {
  min-width: 170px;
}

#restart {
  min-width: 150px;
}

.controls label {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--mc-muted);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.subtle { background: transparent; }

.progress {
  height: 3px;
  background: var(--mc-line);
}

#progress {
  width: 0;
  height: 100%;
  background: var(--mc-gold);
}

h2 {
  margin: 0 0 16px;
  color: var(--mc-text);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

h2 span {
  margin-top: 5px;
  display: block;
  color: var(--mc-muted-2);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
}

.events {
  max-height: 338px;
  overflow: auto;
  color: var(--mc-muted);
  font-size: 13px;
}

.event {
  padding: 10px 0;
  border-bottom: 1px solid var(--mc-line);
  line-height: 1.4;
}

.event b {
  margin-right: 10px;
  color: var(--mc-gold);
}

.replays {
  padding: 18px;
  background: var(--mc-panel);
  border-top: 1px solid var(--mc-line);
}

.replays[hidden] { display: none; }

.replay-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.replay-button {
  width: 100%;
  min-height: 54px;
  padding: 9px 12px;
  text-align: left;
}

.replay-button strong,
.replay-button span {
  display: block;
}

.replay-button strong {
  color: var(--mc-gold);
  font-size: 11px;
}

.replay-button span {
  margin-top: 4px;
  overflow: hidden;
  color: var(--mc-text);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#transition {
  position: absolute;
  inset: 0;
  z-index: 4;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--mc-panel-deep);
  box-shadow: inset 0 0 0 1px var(--mc-line);
}

#transition[hidden] { display: none; }

.transition-label {
  color: var(--mc-gold);
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

#transition-detail {
  width: min(880px, 88%);
  margin: 18px 0 14px;
  color: var(--mc-text);
  font-size: clamp(28px, 4.5vw, 50px);
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.08;
  text-align: center;
  text-wrap: balance;
}

#transition-detail:empty { display: none; }

#transition-minute {
  margin: 12px 0;
  color: var(--mc-text);
  font-size: 60px;
  font-weight: 900;
}

#transition-detail:not(:empty) + #transition-minute {
  margin: 0 0 16px;
  color: var(--mc-muted);
  font-size: 20px;
  font-weight: 800;
}

.transition-rule {
  width: 70px;
  height: 3px;
  background: var(--mc-gold);
}

#banner.goal-banner {
  top: 20px;
  z-index: 2;
  width: min(640px, 90%);
  padding: 16px 20px;
  border-left: 6px solid var(--goal-accent);
  background: var(--goal-bg);
  color: var(--goal-text);
  text-align: center;
  white-space: normal;
}

.goal-title {
  font-size: 40px;
  font-weight: 900;
  letter-spacing: 0.1em;
  line-height: 1.05;
}

.goal-scorer {
  margin-top: 8px;
  font-size: 15px;
  font-weight: 700;
}

.goal-score {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid currentColor;
  font-size: 18px;
  font-weight: 900;
  line-height: 1.35;
}

@media (max-width: 700px) {
  body { padding: 0; }
  main { border-right: 0; border-left: 0; }
  .scoreboard {
    padding: 16px 8px;
    grid-template-columns: minmax(0, 1fr) 92px minmax(0, 1fr);
    gap: 6px;
  }
  .team,
  .team.away { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; text-align: center; justify-items: center; }
  .team h1 { grid-column: 1 / -1; grid-row: 2; }
  .team .match-kit { grid-column: 2; grid-row: 1; }
  .team h1 { font-size: 13px; }
  .team-badge { width: 50px; height: 50px; }
  #score { font-size: 36px; }
  .commentary { min-height: 96px; padding: 14px 60px; }
  #minute { left: 10px; font-size: 16px; }
  #comment { font-size: 16px; line-height: 1.35; }
  .controls {
    padding: 12px 10px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 10px;
  }
  .controls button,
  .controls select { min-height: 56px; padding: 0 14px; font-size: 13px; }
  .controls label { grid-column: 1 / -1; grid-row: 2; margin-left: 0; justify-content: center; font-size: 12px; }
  #play { grid-column: 1; grid-row: 1; min-width: 0; }
  #restart { grid-column: 2; grid-row: 1; min-width: 0; }
  .replays { padding: 14px 10px; }
  .replay-list { grid-template-columns: 1fr 1fr; }
  #banner { padding: 11px 12px; font-size: 16px; }
  #curtain > div { font-size: 18px; }
  #banner.goal-banner { top: 8px; padding: 10px 12px; }
  .goal-title { font-size: 27px; }
  .goal-scorer { font-size: 12px; }
  .goal-score { margin-top: 7px; padding-top: 7px; font-size: 13px; }
  #transition-minute { font-size: 44px; }
}

@media (prefers-reduced-motion: reduce) {
  .goal-flash { animation: none; }
}
