/* Judge phone screen. Built for one thumb, bright light and sweaty hands. */

html,
body {
  height: 100%;
  overscroll-behavior: none;
}
body {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  -webkit-user-select: none;
  user-select: none;
}

.screen {
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 12px) 16px calc(env(safe-area-inset-bottom) + 12px);
}
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 8px;
}
.logo {
  width: 110px;
  margin-bottom: 18px;
}
.event-logo {
  height: 64px;
  max-width: 220px;
  margin-bottom: 22px;
}
h1 {
  font-size: 30px;
  font-weight: 600;
  margin: 0;
  line-height: 1.1;
}
.lead {
  color: var(--muted);
  max-width: 30ch;
  line-height: 1.45;
  margin: 6px 0 18px;
}
.err {
  color: var(--bad);
  min-height: 1.4em;
}

.btn {
  min-height: 52px;
  padding: 0 18px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--card);
  font-weight: 600;
  font-size: 17px;
}
.btn.primary {
  background: var(--orange);
  border-color: var(--orange);
  color: var(--on-accent);
}
.btn.small {
  min-height: 40px;
  font-size: 15px;
  padding: 0 14px;
}
.btn:active {
  transform: scale(0.98);
}

.code-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: min(100%, 320px);
}
.code-form input {
  height: 56px;
  border-radius: 14px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  text-align: center;
  font-size: 24px;
  letter-spacing: 0.2em;
  -webkit-user-select: text;
  user-select: text;
}

/* lane picker */
.pick-head {
  padding: 12px 2px 18px;
}
.pick-head h1 {
  margin-top: 6px;
}
.pick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pick {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  min-height: 118px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  text-align: left;
}
.pick .n {
  font-size: 40px;
  font-weight: 700;
  line-height: 1;
}
.pick .t {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 600;
  line-height: 1.15;
}
.pick .j {
  font-size: 12px;
  color: var(--muted);
}
.pick.empty .t {
  color: var(--dim);
}

/* race screen */
.race {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  min-height: 0;
  padding-top: calc(env(safe-area-inset-top) + 6px);
  gap: 0;
}
.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 6px 0 10px;
  border-bottom: 1px solid var(--line);
}
.who {
  min-width: 0;
}
.lane-tag {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.lane-tag b {
  color: var(--bone);
  font-size: 15px;
}
.lane-tag .lanebars {
  font-size: 15px;
}
.heat-name {
  color: var(--dim);
  letter-spacing: 0.08em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.team {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.1;
  margin-top: 5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ath {
  font-size: 13px;
  color: var(--muted);
  margin-top: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.net {
  flex: none;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 10px 0 12px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--panel);
  font-size: 13px;
  font-weight: 600;
}
.net i {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--dim);
}
.net.ok i {
  background: var(--ok);
}
.net.slow i {
  background: var(--warn);
}
.net.off i {
  background: var(--bad);
  animation: blink 1s steps(2) infinite;
}
.net .dots {
  color: var(--muted);
  letter-spacing: 0.05em;
}
@keyframes blink {
  50% {
    opacity: 0.25;
  }
}

.clockbox {
  text-align: center;
  padding: 10px 0 2px;
}
.clock {
  font-size: clamp(50px, 17vw, 76px);
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}
.clock-sub {
  color: var(--muted);
  font-size: 14px;
  margin-top: 6px;
  min-height: 1.2em;
}

.nowbox {
  text-align: center;
  padding: 10px 0 12px;
}
.station {
  font-size: clamp(30px, 9.4vw, 42px);
  font-weight: 600;
  line-height: 1.05;
  margin-top: 4px;
  min-height: 1.05em;
}
.spec {
  color: var(--muted);
  margin-top: 6px;
  font-size: 15px;
  min-height: 1.2em;
}

.action {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 190px;
}
.action > * {
  flex: 1;
}
.panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
  padding: 18px;
}
.panel p {
  color: var(--muted);
  max-width: 32ch;
  line-height: 1.45;
  margin: 8px 0 0;
}
.panel .big {
  font-size: 26px;
  font-weight: 600;
}
.order {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.order li {
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
}
.count-n {
  font-size: 140px;
  font-weight: 700;
  line-height: 1;
  color: var(--orange);
}

.donebtn {
  position: relative;
  overflow: hidden;
  border: 0;
  border-radius: 22px;
  background: var(--orange);
  color: var(--on-accent);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 16px;
  touch-action: none;
  box-shadow: 0 10px 30px var(--accent-glow);
  transition: transform 0.06s ease, opacity 0.2s ease;
}
.donebtn:active {
  transform: scale(0.985);
}
.done-hint {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  opacity: 0.85;
}
.done-big {
  font-size: clamp(44px, 14vw, 64px);
  font-weight: 800;
  letter-spacing: 0.01em;
  line-height: 1;
}
.done-name {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 600;
}
.donebtn.locked {
  background: var(--card);
  color: var(--bone);
  box-shadow: none;
}
.donebtn.run {
  background: transparent;
  color: var(--bone);
  border: 2px solid var(--bone);
  box-shadow: none;
}
.donebtn.finish {
  background: var(--bone);
  color: var(--deep);
  box-shadow: 0 10px 30px rgba(255, 255, 255, 0.18);
}
.lockbar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 5px;
  width: 0;
  background: var(--orange);
}

.reps {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.pad {
  position: relative;
  flex: 1;
  border-radius: 22px;
  border: 2px solid var(--line-strong);
  background: var(--panel);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  touch-action: none;
  -webkit-touch-callout: none;
  overflow: hidden;
  padding: 10px;
}
.pad .count {
  font-size: clamp(100px, 36vw, 168px);
  font-weight: 700;
  line-height: 0.92;
  letter-spacing: -0.03em;
}
.pad .of {
  color: var(--muted);
  font-size: 20px;
  margin-top: 4px;
}
.pad .hint {
  margin-top: 12px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}
.repbar {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 8px;
  background: var(--line);
}
.repbar i {
  display: block;
  height: 100%;
  width: 0;
  background: var(--orange);
  transition: width 0.12s ease-out;
}
.pad.flash {
  animation: flash 0.22s ease-out;
}
@keyframes flash {
  from {
    background: var(--orange-soft);
    border-color: var(--orange);
  }
}
.rep-row {
  flex: none !important;
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

.fin .fin-time {
  font-size: clamp(54px, 18vw, 84px);
  font-weight: 700;
  line-height: 1;
  margin-top: 8px;
  color: var(--bone);
}
.fin .fin-sub {
  margin-top: 10px;
  color: var(--muted);
  font-size: 16px;
}
.fin {
  border-color: var(--line-strong);
}

.undo-row {
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-top: 10px;
}
.undo {
  width: 100%;
  min-height: 50px;
  border-color: var(--warn);
  color: var(--warn);
  background: transparent;
}
.last {
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.track {
  display: flex;
  gap: 4px;
  padding: 8px 0 2px;
  cursor: pointer;
}
.chip {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}
.chip b {
  display: flex;
  gap: 2px;
  width: 100%;
  height: 6px;
}
.chip b i {
  flex: 1;
  border-radius: 3px;
  background: var(--line);
}
.chip b i.r {
  flex: 0 0 30%;
}
.chip b i.d {
  background: var(--done);
}
.chip b i.p {
  background: repeating-linear-gradient(90deg, var(--done) 0 3px, transparent 3px 5px);
}
.chip b i.n {
  background: var(--orange);
}
.chip span {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: clip;
  max-width: 100%;
}
.chip.done span {
  color: var(--muted);
}
.chip.now span {
  color: var(--bone);
}

/* sheet */
.sheet-bg,
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 20;
}
.sheet {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  max-height: 88dvh;
  overflow: auto;
  z-index: 21;
  background: var(--panel);
  border-top: 1px solid var(--line-strong);
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(env(safe-area-inset-bottom) + 18px);
  -webkit-user-select: text;
  user-select: text;
}
.sheet-grip {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--line-strong);
  margin: 4px auto 10px;
}
.sheet-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.sh-team {
  font-size: 21px;
  font-weight: 600;
  margin-top: 4px;
}
.splits {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.splits th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 6px 4px;
}
.splits td {
  padding: 9px 4px;
  border-top: 1px solid var(--line);
}
.splits td.r,
.splits th.r {
  text-align: right;
}
.splits tr.run td {
  color: var(--muted);
  font-size: 13px;
}
.splits tr.now td {
  color: var(--orange);
}
.splits .wait {
  color: var(--warn);
  font-size: 12px;
}
.sheet-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 18px 0 12px;
}
.sheet-actions #sh-force {
  grid-column: 1 / -1;
  font-size: 14px;
  color: var(--warn);
  border-color: rgba(232, 176, 74, 0.5);
}
.diag {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}
.diag dt {
  color: var(--dim);
}
.diag dd {
  margin: 0;
}

.modal-bg {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 30;
}
.modal {
  width: min(100%, 380px);
  background: var(--panel);
  border: 1px solid var(--line-strong);
  border-radius: 20px;
  padding: 20px;
}
.modal h2 {
  margin: 0 0 8px;
  font-size: 22px;
  font-weight: 600;
}
.modal p {
  margin: 0 0 18px;
  color: var(--muted);
  line-height: 1.45;
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(env(safe-area-inset-bottom) + 18px);
  z-index: 40;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--bone);
  color: var(--deep);
  font-weight: 600;
  font-size: 15px;
  line-height: 1.35;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(24px);
  transition: transform 0.25s ease, opacity 0.25s ease;
  pointer-events: none;
}
.toast.show {
  opacity: 1;
  transform: none;
}
.toast.bad {
  background: var(--bad);
  color: #fff;
}

@media (max-height: 680px) {
  .clock {
    font-size: 46px;
  }
  .station {
    font-size: 28px;
  }
  .nowbox {
    padding: 6px 0 8px;
  }
  .team {
    font-size: 20px;
  }
}

/* adidas look */
html[data-theme='adidas'] .done-big {
  text-transform: uppercase;
}

/* name screen */
.name-form input {
  letter-spacing: 0;
  font-size: 22px;
}

/* after the finish: review, card, the team confirms */
.fin {
  gap: 10px;
}
.fin .fin-time {
  font-size: clamp(44px, 14vw, 64px);
  margin-top: 2px;
}
.fin .fin-sub {
  margin-top: 0;
}
.fin-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  width: 100%;
  margin-top: 6px;
}
.fin-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 100%;
}
.fin-ask {
  margin: 4px 0 0 !important;
  font-size: 14px;
}
.btn.big {
  min-height: 58px;
  font-size: 19px;
}
.btn.linkish {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 15px;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.fin-done {
  width: 100%;
  padding: 12px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 16px;
}
.fin-done.ok {
  background: rgba(95, 191, 134, 0.14);
  color: var(--ok);
}
.fin-done.disputed {
  background: rgba(239, 90, 76, 0.14);
  color: var(--bad);
}
