/* The scoreboard (member request, Elsa_Cline: "Put up a scoreboard on the wall in the lobby of all the wins, losses and
   ties of each player in all the games and tables"). See DESIGN.md "The scoreboard". The board from the plaza's wall,
   close up: a felt letterboard strip on top, then an old ballpark scoreboard in Fam indigo (steel panels), names painted
   white, every count on a felt number plate with hinge notches. The latest results sit on a white paper slip. */
.sb {
  --sb-felt: #2b2a33; --sb-groove: #232229; --sb-steel: #3340a0; --sb-seam: #2e3a94; --sb-plate: #2b2a33; --sb-hinge: #1c1b22; --sb-letter: #f5f5f2;
  position: fixed; left: 0; right: 0; top: var(--app-top, 0px); height: var(--app-h); z-index: 30; display: flex; flex-direction: column;
  background: var(--sb-felt); color: #fff; font-family: var(--font);
  opacity: 0; transition: opacity .18s;
}
.sb.in { opacity: 1; }
body.tabs-on .sb { top: calc(var(--app-top, 0px) + var(--tabs-y, 0px)); height: calc(var(--app-h) - var(--tabs-y, 0px)); max-width: 760px; margin: 0 auto; }
body.in-scores { background: #2b2a33; }
.sb :focus-visible { outline: 3px solid #fff; outline-offset: 2px; }

.sb-top { flex: none; display: grid; grid-template-columns: 80px minmax(0, 1fr) 80px; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px; background: var(--sb-felt);
  background-image: repeating-linear-gradient(to bottom, transparent 0 11px, var(--sb-groove) 11px 13px); }
body.tabs-on .sb-top { padding-top: 8px; }
.sb-title { margin: 0; text-align: center; color: var(--sb-letter); font: 600 25px/1.1 var(--board); letter-spacing: .04em; text-transform: uppercase; }
.sb-back { justify-self: start; min-width: 64px; min-height: 40px; padding: 0 12px; border: 1.5px solid #ffffff40; border-radius: 10px; background: var(--sb-felt); color: var(--sb-letter); font-weight: 700; font-size: 15px; }

/* the board: steel panels bolted side by side */
.sb-body { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  background: var(--sb-steel) repeating-linear-gradient(to right, transparent 0 125px, var(--sb-seam) 125px 128px);
  border-top: 6px solid #232a70; padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }
.sb-board { --cols: minmax(0, 1fr) 50px 50px 50px; padding: 0 12px; }
.sb-wait { margin: 48px 8px; text-align: center; color: #ffffffcc; }

/* which game: a row of chips that scrolls sideways */
.sb-games { display: flex; gap: 8px; overflow-x: auto; margin: 0 -12px; padding: 14px 12px 4px; scrollbar-width: none; }
.sb-games::-webkit-scrollbar { display: none; }
.sb-chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 8px 0 13px; border: 2px solid #ffffff70; border-radius: 10px;
  background: transparent; color: #fff; font: 700 15px/1 var(--font); white-space: nowrap; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sb-chip span { min-width: 24px; padding: 4px 5px 3px; border-radius: 3px; background: var(--sb-plate); color: #fff; font: 600 16px/1 var(--board); text-align: center; }
.sb-chip[aria-pressed="true"] { background: #fff; border-color: #fff; color: var(--sb-steel); }

/* painted column heads, then a white painted rule */
.sb-head { display: grid; grid-template-columns: var(--cols); align-items: end; gap: 6px; padding: 16px 0 8px; border-bottom: 4px solid #fff; }
.sb-head span { font: 600 27px/1 var(--board); letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-head b { font: 600 25px/1 var(--board); text-align: center; }

.sb-list { list-style: none; margin: 0; padding: 0; }
.sb-row { display: grid; grid-template-columns: var(--cols); align-items: center; gap: 6px; min-height: 58px; border-bottom: 2px solid var(--sb-seam); }
.sb-row.me { background: #3d4bb2; box-shadow: -12px 0 0 #3d4bb2, 12px 0 0 #3d4bb2; }
.sb-who { display: flex; align-items: center; gap: 8px; min-width: 0; min-height: 56px; padding: 0; border: 0; background: none; color: #fff; text-align: left; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.sb-rank { flex: none; width: 22px; font: 600 22px/1 var(--board); color: #ffffffa8; text-align: right; }
.sb-face { flex: none; width: 40px; height: 40px; display: grid; place-items: center; }
.sb-face > * { width: 40px; height: 40px; }
.sb-face img, .sb-face svg { width: 40px; height: 40px; display: block; }
.sb-name { min-width: 0; display: flex; align-items: center; gap: 8px; font: 700 17px/1.2 var(--font); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-fine { position: absolute; z-index: 1; top: -9px; left: -14px; padding: 2px 4px 1px; border: 2px solid #e8352b; border-radius: 3px;
  background: #fff4ea; color: #e8352b; font: 600 13px/1 var(--board); font-style: normal; transform: rotate(-12deg);
  box-shadow: 0 1px 3px #0006; pointer-events: none; } /* a stamped fine on the W plate: wins taken off for quitting */
.sb-name::before { content: ""; flex: none; width: 12px; height: 12px; background: var(--c); box-shadow: 0 0 0 2px #fff; }

/* a number plate: felt, hinge notches at the sides, a painted numeral */
.sb-plate { position: relative; justify-self: center; width: 46px; height: 40px; display: grid; place-items: center; border-radius: 3px;
  background: var(--sb-plate); color: #fff; font: 600 27px/1 var(--board); font-variant-numeric: tabular-nums; }
.sb-plate.long { font-size: 20px; }
.sb-plate::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 3px; margin-top: -1.5px;
  background: linear-gradient(to right, var(--sb-hinge) 0 6px, transparent 6px calc(100% - 6px), var(--sb-hinge) calc(100% - 6px)); } /* hinge notches at the edges */
.sb-plate.flip { animation: sb-flip .5s ease-out; transform-origin: 50% 0; }
@keyframes sb-flip { 0% { transform: perspective(200px) rotateX(-100deg); } 70% { transform: perspective(200px) rotateX(12deg); } 100% { transform: none; } }

/* someone's games, under their row */
.sb-by { grid-column: 1 / -1; list-style: none; margin: -4px 0 10px; padding: 0 0 0 30px; }
.sb-by li { display: grid; grid-template-columns: var(--cols); gap: 6px; align-items: center; min-height: 30px; color: #ffffffe0; font-size: 15px; }
.sb-by li + li { border-top: 1px solid var(--sb-seam); }
.sb-by b { text-align: center; font: 600 21px/1 var(--board); font-variant-numeric: tabular-nums; }
.sb-row.open .sb-who .sb-name { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }

.sb-none { padding: 26px 4px; color: #ffffffd8; line-height: 1.45; }
.sb-foot { margin: 12px 0 0; color: #ffffffb8; font-size: 14px; text-align: center; }

/* the latest results: a paper slip, like gin's score sheet */
.sb-slip { margin: 22px 0 0; padding: 12px 14px 6px; border-radius: 4px; background: #fff; color: #1d2140; }
.sb-slip h2 { margin: 0 0 4px; font: 700 17px/1.3 var(--font); }
.sb-slip ul { list-style: none; margin: 0; padding: 0; }
.sb-slip li { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 8px 0; font-size: 15px; line-height: 1.35; }
.sb-slip li + li { border-top: 1px solid #cfd5de; }
.sb-slip time { flex: none; color: #5b6079; font-size: 13px; }

@media (prefers-reduced-motion: reduce) { .sb-plate.flip { animation: none; } .sb { transition: none; } }

/* Recent wins (member request): days painted like the column heads, a row per win with the winner's face and colour
   square, who they beat in white-on-steel, the time hung on a wide felt plate. */
.sb-day { margin: 0; padding: 18px 0 8px; border-bottom: 4px solid #fff; font: 600 27px/1 var(--board); letter-spacing: .03em; text-transform: uppercase; }
.sb-wins { list-style: none; margin: 0; padding: 0; }
.sb-win { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; align-items: center; gap: 10px; min-height: 62px; padding: 6px 0; border-bottom: 2px solid var(--sb-seam); }
.sb-win.me { background: #3d4bb2; box-shadow: -12px 0 0 #3d4bb2, 12px 0 0 #3d4bb2; }
.sb-wtxt { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.sb-wtxt > span { color: #ffffffd8; font-size: 15px; line-height: 1.3; overflow-wrap: anywhere; }
.sb-plate.sb-at { width: auto; min-width: 64px; padding: 0 8px; font-size: 21px; }
