/* DraftSim: a coach's tactics board. Felt green surface, chalk lines, team-coloured magnets. */
:root {
  --panel: #10181b;
  --panel-line: #263236;
  --board: #17352e;
  --felt: #1e453b;
  --felt-up: #27564a;
  --chalk: #eef3ea;
  --chalk-dim: #a9c0b4;
  --line: rgba(238, 243, 234, 0.16);
  --blue: #6ab2ff;
  --blue-deep: #2a6fd0;
  --red: #f4777e;
  --red-deep: #c93a43;
  --gold: #f2d35c;
  --ui: "Barlow Semi Condensed", "Arial Narrow", system-ui, sans-serif;
  --score: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--board);
  color: var(--chalk);
  font: 400 17px/1.4 var(--ui);
}

h1, h2 { margin: 0; font-weight: 600; }
h1 { font: 600 30px/1 var(--score); letter-spacing: 0.01em; }
h2 { font-size: 17px; color: var(--chalk-dim); font-weight: 500; }

button, select, input { font: inherit; color: inherit; }

button {
  background: transparent;
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 7px 14px;
  cursor: pointer;
}
button:hover:not(:disabled) { border-color: var(--chalk-dim); }
button:disabled { opacity: 0.45; cursor: default; }
button.primary { background: var(--chalk); color: var(--board); border-color: var(--chalk); font-weight: 600; }
button.primary:hover:not(:disabled) { background: #fff; }
button.quiet { border-color: transparent; color: var(--chalk-dim); }

select, input[type="text"] {
  background: var(--felt);
  border: 1.5px solid var(--line);
  border-radius: 6px;
  padding: 6px 9px;
}

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

.field { display: inline-flex; align-items: center; gap: 8px; color: var(--chalk-dim); }
.field select, .field input { color: var(--chalk); }
.check { display: inline-flex; align-items: center; gap: 6px; color: var(--chalk-dim); white-space: nowrap; }
.note { color: var(--gold); font-size: 15px; }

/* top bar */
.bar {
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px;
  padding: 14px 24px;
  border-bottom: 1.5px solid var(--line);
}
.bar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-left: auto; }
.seed input { width: 6.5em; }

.status { margin: 0; padding: 10px 24px; min-height: 44px; color: var(--chalk-dim); }
.status.error { color: var(--red); }

/* page layout: on wide screens the game sits left; gold lead, events, players and
   playback stack on the right. Narrower screens get one column, controls first. */
.layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "main" "controls" "below";
  max-width: 1290px; margin: 0 auto;
}
.layout > .table { grid-area: main; }
.layout > .controls { grid-area: controls; }
.layout > .below { grid-area: below; }
.controls { padding: 0 24px 20px; max-width: 738px; width: 100%; justify-self: center; }
.controls .players { margin-top: 0; }

@media (min-width: 1700px) {
  .layout {
    max-width: none;
    grid-template-columns: minmax(0, 1fr) clamp(520px, 30vw, 640px);
    grid-template-rows: auto 1fr;
    grid-template-areas: "main below" "main controls";
    column-gap: 28px;
    padding-right: 24px;
  }
  .layout > .below { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
  #feed li { font-size: 15.5px; padding: 3px 10px; grid-template-columns: 3em 1fr; }
  .scorebar { min-width: 0; }
  .layout > .table { padding-right: 0; }
  .layout > .below { padding: 4px 0 14px; max-width: none; margin: 0; align-self: start; }
  .layout > .controls { padding: 0; max-width: none; align-self: start; }
  .layout > .table { grid-template-columns: 200px minmax(600px, 690px) 200px; }
}

/* the table: roster, board, roster */
.table {
  display: grid;
  grid-template-columns: minmax(190px, 250px) minmax(320px, 690px) minmax(190px, 250px);
  justify-content: center;
  gap: 22px;
  padding: 4px 24px 20px;
}

.roster h2 { padding-bottom: 8px; border-bottom: 3px solid; margin-bottom: 10px; }
.roster.blue h2 { border-color: var(--blue); color: var(--blue); }
.roster.red h2 { border-color: var(--red); color: var(--red); text-align: right; }
.slots { display: grid; gap: 8px; }

.slot {
  display: grid; grid-template-columns: 46px 1fr; align-items: center; gap: 10px;
  width: 100%; padding: 7px 9px; text-align: left;
  background: var(--felt); border-color: transparent;
}
.roster.red .slot { grid-template-columns: 1fr 46px; text-align: right; }
.roster.red .slot .face { order: 2; }
.slot:hover:not(:disabled) { background: var(--felt-up); border-color: transparent; }
.slot.empty { border: 1.5px dashed var(--line); background: transparent; }
.slot.dead .face { filter: grayscale(1) brightness(0.6); }
.slot.dead .who { color: var(--chalk-dim); }

.face {
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center; overflow: hidden;
  border: 2.5px solid var(--blue); background: var(--blue-deep);
  font: 600 16px/1 var(--score); color: var(--chalk);
}
.roster.red .face, .face.red { border-color: var(--red); background: var(--red-deep); }
.slot.empty .face { border-style: dashed; background: transparent; color: var(--chalk-dim); }
.face img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.12); }

.who { display: block; font-weight: 500; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sub { display: block; font-size: 14.5px; color: var(--chalk-dim); line-height: 1.25; }
.sub .flag { color: var(--gold); }

/* broadcast-style scoreboard above the board */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.scorebar {
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; column-gap: 18px;
  margin-bottom: 8px; padding: 8px 16px 6px;
  background: var(--panel); border: 1.5px solid var(--panel-line); border-radius: 6px;
  font-family: var(--score); font-variant-numeric: tabular-nums;
}
.sb-team { display: flex; align-items: center; gap: 16px; }
.sb-team.red { justify-content: flex-end; }
.sb-name { font: 600 32px/1 var(--score); color: var(--chalk); letter-spacing: 0.02em; }
.sb-team.blue .sb-name { margin-right: auto; }
.sb-team.red .sb-name { margin-left: auto; }
.sb-stat { display: inline-flex; align-items: center; gap: 6px; font-size: 25px; line-height: 1; }
.sb-stat img { width: 20px; height: 26px; object-fit: contain; }
.sb-team.blue b { color: var(--blue); }
.sb-team.red b { color: var(--red); }
b { font-weight: 600; }
.coin { width: 19px; height: 19px; flex: none; }
.coin circle:first-child { fill: #c99a2e; stroke: #6f5214; stroke-width: 1.2; }
.coin circle:last-child { fill: none; stroke: #f0cd6a; stroke-width: 1.2; }
/* kills and clock share the middle column; each splits into left | centre | right
   so the sword and the colon sit exactly on the centre line */
.sb-kills, .sb-clock { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; }
.sb-kills { column-gap: 10px; font-size: 30px; line-height: 1; }
.sb-kills b:first-child { color: var(--blue); justify-self: end; }
.sb-kills b:last-child { color: var(--red); justify-self: start; }
.sb-kills .sword { justify-self: center; }
#clock-m { justify-self: end; }
#clock-s { justify-self: start; }
.sword { width: 11px; height: 26px; fill: var(--chalk-dim); }
.sb-clock { font-size: 21px; line-height: 1; color: var(--chalk); padding-top: 3px; }
.sb-drakes { display: flex; gap: 4px; min-height: 22px; align-items: center; padding-top: 3px; }
.sb-drakes.blue { justify-content: flex-end; }
.sb-drakes img { width: 22px; height: 22px; }
.sb-drakes.soul img { filter: drop-shadow(0 0 3px var(--gold)); }

/* the scoreboard scales with the width of the map column, not the window */
.stage { container-type: inline-size; min-width: 0; }
@container (max-width: 660px) {
  .scorebar { column-gap: 12px; padding: 7px 12px 5px; }
  .sb-team { gap: 11px; }
  .sb-name { font-size: 25px; }
  .sb-stat { font-size: 21px; gap: 5px; }
  .sb-kills { font-size: 26px; }
  .sb-stat img { width: 17px; height: 22px; }
  .coin { width: 16px; height: 16px; }
}
@container (max-width: 540px) {
  .scorebar { column-gap: 8px; padding: 6px 8px 5px; }
  .sb-team { gap: 7px; }
  .sb-name { font-size: 20px; }
  .sb-stat { font-size: 17px; gap: 3px; }
  .sb-kills { font-size: 22px; column-gap: 6px; }
}

/* player table below the board */
.players {
  width: 100%; margin-top: 8px; border-collapse: separate; border-spacing: 0;
  background: var(--panel); border: 1.5px solid var(--panel-line); border-radius: 6px;
  font-family: var(--score); font-variant-numeric: tabular-nums; font-size: 19px;
}
.players td { padding: 2px 6px; white-space: nowrap; }
.players tr + tr td { border-top: 1px solid var(--panel-line); }
.players .gold { color: #e3c56b; }
.players .gold.blue { text-align: left; padding-left: 12px; }
.players .gold.red { text-align: right; padding-right: 12px; }
.players .kda { color: var(--chalk); }
.players .cs { color: var(--chalk-dim); min-width: 2.4em; }
.players td.blue.kda, .players td.blue.cs { text-align: right; }
.players td.red.kda, .players td.red.cs { text-align: left; }
.players .pic { width: 42px; padding: 2px; }
.portrait {
  position: relative; display: block; width: 34px; height: 34px; border-radius: 4px; overflow: hidden;
  border: 2px solid var(--blue); background: var(--blue-deep);
  font: 600 14px/30px var(--score); text-align: center; color: var(--chalk);
}
.portrait.red { border-color: var(--red); background: var(--red-deep); }
.portrait img { width: 100%; height: 100%; object-fit: cover; display: block; transform: scale(1.12); }
.portrait .lvl {
  position: absolute; right: 0; bottom: 0; min-width: 15px; padding: 0 2px;
  background: rgba(8, 12, 14, 0.85); font: 600 12px/14px var(--score); color: var(--chalk);
}
.portrait.red .lvl { right: auto; left: 0; }
.portrait .timer {
  position: absolute; inset: 0; display: none; place-items: center;
  font: 600 17px/1 var(--score); color: #fff; background: rgba(8, 12, 14, 0.55);
}
.portrait.dead img { filter: grayscale(1) brightness(0.55); }
.portrait.dead { background: #2b3134; border-color: #59656a; }
.portrait.dead .ini { visibility: hidden; }
.portrait.dead .timer { display: grid; }
.players .empty td { color: var(--chalk-dim); }

.board { position: relative; aspect-ratio: 1; }
#map {
  width: 100%; height: 100%; display: block;
  background: #141c20;
  border: 2px solid #34444a;
  border-radius: 6px;
}
.banner {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%);
  background: var(--chalk); color: var(--board);
  padding: 8px 18px; border-radius: 6px;
  font: 600 20px/1.2 var(--score); white-space: nowrap;
}

.transport { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px; padding-top: 12px; }
.transport.minor { padding-top: 8px; }
.transport.minor #copy-link { margin-left: auto; }
.transport #play { min-width: 5.2em; }
#scrub { flex: 1 1 160px; accent-color: var(--gold); }

/* below the table */
.below {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; align-items: end;
  max-width: 1290px; margin: 0 auto; padding: 0 24px 24px;
}
.below h2 { margin-bottom: 8px; }
#gold { width: 100%; height: 150px; display: block; background: var(--felt); border-radius: 4px; }
#feed {
  list-style: none; margin: 0; padding: 0;
  height: 150px; overflow-y: auto;
  background: var(--felt); border-radius: 4px;
}
#feed li { display: grid; grid-template-columns: 3.4em 1fr; gap: 8px; padding: 4px 12px; border-bottom: 1px solid var(--line); }
#feed li.empty { display: block; color: var(--chalk-dim); border: 0; padding: 12px; }
#feed time { color: var(--chalk-dim); font-variant-numeric: tabular-nums; }
#feed .blue { color: var(--blue); }
#feed .red { color: var(--red); }
#feed .major { font-weight: 600; }
#feed .neutral { color: var(--chalk-dim); }

/* champion picker */
dialog {
  width: min(760px, calc(100vw - 24px)); max-height: min(720px, calc(100vh - 24px));
  background: var(--board); color: var(--chalk);
  border: 2px solid var(--chalk-dim); border-radius: 8px; padding: 0;
}
dialog[open] { display: flex; flex-direction: column; }
dialog::backdrop { background: rgba(8, 20, 17, 0.7); }
.picker-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px 6px; }
.picker-head h2 { color: var(--chalk); font-size: 21px; font-weight: 600; }
.picker-tools { display: flex; flex-wrap: wrap; gap: 10px 18px; align-items: center; padding: 6px 18px 12px; }
.picker-tools input[type="text"] { flex: 1 1 200px; }
.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px;
  padding: 4px 18px 18px; overflow-y: auto;
}
.pick {
  display: grid; grid-template-columns: 38px 1fr; gap: 9px; align-items: center;
  padding: 5px 7px; text-align: left; background: var(--felt); border-color: transparent;
}
.pick:hover:not(:disabled) { background: var(--felt-up); border-color: transparent; }
.pick .face { width: 38px; height: 38px; font-size: 13px; border-color: var(--chalk-dim); background: var(--felt-up); }
.grid .none { grid-column: 1 / -1; color: var(--chalk-dim); padding: 10px 0; }

footer { padding: 4px 24px 28px; max-width: 1290px; margin: 0 auto; }
footer p { margin: 0; color: var(--chalk-dim); font-size: 14px; line-height: 1.5; max-width: 110ch; }
footer p + p { margin-top: 6px; }

/* mid-size screens: keep the rosters narrow so the board gets the room */
@media (min-width: 981px) and (max-width: 1300px) {
  .table { grid-template-columns: 190px minmax(320px, 690px) 190px; }
}

/* narrow screens: rosters side by side above the board */
@media (max-width: 980px) {
  .table { grid-template-columns: 1fr 1fr; gap: 14px; padding: 4px 14px 16px; }
  .stage { grid-column: 1 / -1; grid-row: 2; }
  .bar, .status { padding-left: 14px; padding-right: 14px; }
  .bar-actions { margin-left: 0; }
  .below { grid-template-columns: 1fr; padding: 0 14px 20px; }
  .controls { padding: 0 14px 16px; }
  .slot { grid-template-columns: 38px 1fr; padding: 5px 6px; gap: 7px; }
  .roster.red .slot { grid-template-columns: 1fr 38px; }
  .slot .face { width: 38px; height: 38px; font-size: 13px; }
  .sb-name { font-size: 24px; }
  .sb-stat { font-size: 20px; gap: 4px; }
  .sb-team { gap: 10px; }
}

@media (max-width: 600px) {
  .scorebar { column-gap: 8px; padding: 6px 8px; }
  .sb-team { flex-direction: column; align-items: flex-start; gap: 3px; }
  .sb-team.red { align-items: flex-end; }
  .sb-team.red .sb-name { order: -1; }
  .sb-name { font-size: 20px; }
  .sb-stat { font-size: 17px; }
  .sb-kills { font-size: 24px; }
  .sb-drakes img { width: 17px; height: 17px; }
  .players { font-size: 15px; }
  .players td { padding: 2px 3px; }
  .players .gold.blue { padding-left: 5px; }
  .players .gold.red { padding-right: 5px; }
  .portrait { width: 30px; height: 30px; line-height: 26px; font-size: 12px; }
  .players .pic { width: 36px; }
}
