/* GEARS FLL scoreboard. Colors and type match /timers/fll.html (BIOGLOW). */
:root {
  --ink: #111921;
  --navy: #043a49;
  --fll-bg: #c0de8a;
  --fll-accent: #6abf4b;
  --alert: #b3001b;
  --gold: #bba13e;
  --silver: #8a93a0;
  --bronze: #b56a2b;
  --font: "Arial Black", "Helvetica Neue", Arial, "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--ink); }

.gears-bee {
  position: fixed; top: 0; left: 0;
  width: 6vh; height: auto;
  overflow: visible;
  z-index: 20;
  pointer-events: none;
  transform-origin: center center;
  will-change: transform;
}
.gears-bee .wing {
  transform-box: fill-box;
  transform-origin: 50% 90%;
}
.gears-bee .wing-front { animation: bee-flap .16s ease-in-out infinite alternate; }
.gears-bee .wing-back { animation: bee-flap .18s ease-in-out infinite alternate-reverse; }
@keyframes bee-flap {
  from { transform: rotate(-10deg) scaleY(1); }
  to { transform: rotate(24deg) scaleY(.28); }
}
@media (prefers-reduced-motion: reduce) {
  .gears-bee .wing-front,
  .gears-bee .wing-back { animation: none; }
}

.timer-page {
  overflow: hidden;
  background-repeat: no-repeat;
  background-position: left top;
  background-size: cover;
  height: 100vh;
  height: 100dvh;
}
.prog-fll {
  background-color: var(--fll-bg);
  background-image: url("/timers/images/fll-bioglow-background.png");
}
@media (max-aspect-ratio: 1563/1000) {
  .timer-page { background-size: 100% auto; }
}

.masthead {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 1.6vh 2vw 0;
  text-align: center;
  pointer-events: none;
}
.phase {
  font-size: min(5.2vh, 5vw);
  line-height: 1;
  letter-spacing: .04em;
  padding: .18em .6em .14em;
  border-radius: .3em;
  background: var(--ink);
  color: var(--fll-bg);
  white-space: nowrap;
}
.event-title {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 2.2vh;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0;
  text-align: center;
  pointer-events: none;
}
.event-title h1 {
  margin: 0;
  font-size: min(2.8vh, 3.2vw);
  line-height: 1.15;
  font-weight: 900;
}
.note {
  margin: .3vh 0 0;
  min-height: 1.2em;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: min(1.8vh, 2.2vw);
  opacity: .8;
}

.stage {
  position: absolute;
  inset: 215px 1.5vw 9vh 1.5vw;
  z-index: 2;
  display: flex;
  align-items: stretch;
  justify-content: center;
}
.board {
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.2vw;
  min-height: 0;
}
.board:has(.col:only-child) { grid-template-columns: 1fr; }

.col {
  min-height: 0;
  background: rgba(255, 255, 255, .72);
  border: 3px solid var(--ink);
  border-radius: 1.1vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.scores {
  width: 100%;
  height: 100%;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: clamp(11px, 2.05vh, 22px);
  line-height: 1.05;
}
.scores th,
.scores td {
  padding: .28em .45em;
  vertical-align: middle;
}
.scores thead th {
  background: var(--ink);
  color: var(--fll-bg);
  font-weight: 900;
  letter-spacing: .03em;
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.scores tbody tr:nth-child(even) { background: rgba(106, 191, 75, .18); }
.scores tbody tr:nth-child(odd) { background: transparent; }
.scores .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.scores .name { text-align: left; width: 44%; }
.scores .score {
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 800;
}
.scores .best {
  color: var(--ink);
  font-family: var(--font);
  font-weight: 900;
}
.scores .rank { text-align: center; white-space: nowrap; }
.scores tr.rank-1 .rank { color: #8a6d12; }
.scores tr.rank-2 .rank { color: #4d5560; }
.scores tr.rank-3 .rank { color: #7a4314; }
.scores tr.changed td { animation: bump .9s ease; }
@keyframes bump {
  from { box-shadow: inset 0 0 0 999px #f7e326; }
  to { box-shadow: inset 0 0 0 999px transparent; }
}

.gears-logo {
  position: fixed; right: 2.2vw; bottom: 2.2vh; z-index: 3;
  background: rgba(0,0,0,.78); border-radius: 14px; padding: 10px 16px;
  line-height: 0; pointer-events: auto; cursor: pointer;
  text-decoration: none;
}
.gears-logo img { height: clamp(24px, 4vh, 48px); width: auto; display: block; }

body.stale .phase { background: #5a6570; color: #fff; }
body.error .phase { background: var(--alert); color: #fff; }

@media (max-width: 860px), (max-aspect-ratio: 4/5) {
  .timer-page {
    background-position: center top;
    background-size: cover;
  }
  .gears-bee { width: 40px; }
  .masthead {
    padding: calc(8px + env(safe-area-inset-top, 0px)) 12px 0;
  }
  .phase {
    font-size: 15px;
    padding: .22em .55em .18em;
  }
  .stage {
    inset: calc(48px + env(safe-area-inset-top, 0px)) 8px calc(64px + env(safe-area-inset-bottom, 0px)) 8px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .board {
    grid-template-columns: 1fr;
    height: auto;
    gap: 0;
  }
  .col {
    overflow: visible;
    height: auto;
    border-width: 2px;
    border-radius: 10px;
  }
  .scores {
    height: auto;
    font-size: 12px;
  }
  .scores th,
  .scores td {
    padding: .38em .32em;
  }
  .event-title {
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 0 72px 0 12px;
  }
  .event-title h1 { font-size: 12px; }
  .note { font-size: 10px; }
  .gears-logo {
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    padding: 6px 10px;
    border-radius: 10px;
  }
  .gears-logo img { height: 22px; }
}

@media (max-width: 860px) and (orientation: landscape) {
  .stage {
    inset: calc(40px + env(safe-area-inset-top, 0px)) 8px calc(8px + env(safe-area-inset-bottom, 0px)) 8px;
  }
  .event-title { display: none; }
  .gears-logo {
    top: calc(6px + env(safe-area-inset-top, 0px));
    bottom: auto;
  }
}
