:root {
  --red: #e4002b;
  --red-deep: #a80020;
  --ink: #141414;
  --paper: #fff;
  --sky-1: #dff0ff;
  --sky-2: #a7d3f5;
  --mtn-far: #8fb6d8;
  --mtn-near: #5f93c4;
  --sea-1: #2f8fd6;
  --sea-2: #1c6aa8;
  --sea-3: #155688;
  --wood: #5a3d28;
  --wood-d: #402a1b;
  --good: #12b76a;
  --good-deep: #0b8a4f;
  --gold: #ffc530;
  --disp: "Barlow Condensed", system-ui, sans-serif;
  --body: "Barlow", system-ui, sans-serif;
}
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}
html,
body {
  margin: 0;
  height: 100%;
}
body {
  font-family: var(--body);
  background: #0b0d12;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  overscroll-behavior: none;
}
#app {
  position: relative;
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  user-select: none;
  background: var(--sea-2);
}

/* brand */
.brand {
  flex: 0 0 auto;
  background: var(--red);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  box-shadow:
    0 3px 0 var(--red-deep),
    0 8px 14px rgba(0, 0, 0, 0.18);
  z-index: 30;
}
.brand__logo {
}

.brand__logo img {
  width: 46px;
}
.brand__title {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.mute {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.16);
  border: 0;
  color: #fff;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 16px;
  display: grid;
  place-items: center;
}
.mute:active {
  transform: scale(0.92);
}

/* race tracker */
.tracker {
  flex: 0 0 auto;
  background: var(--ink);
  padding: 9px 14px 11px;
  z-index: 25;
}
.tracker__top {
  display: flex;
  align-items: baseline;
  gap: 8px;
  color: #fff;
  margin-bottom: 8px;
}
.rank {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 22px;
  line-height: 1;
}
.rank small {
  font-size: 13px;
  opacity: 0.6;
  font-weight: 700;
}
.rank__lbl {
  font-family: var(--disp);
  font-weight: 700;
  letter-spacing: 2px;
  font-size: 12px;
  text-transform: uppercase;
  opacity: 0.6;
}
.dist {
  margin-left: auto;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 14px;
  opacity: 0.75;
}
.lane-bar {
  position: relative;
  height: 16px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}
.lane-bar::after {
  content: "🏁";
  position: absolute;
  right: -3px;
  top: -4px;
  font-size: 15px;
}
.dot {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  border: 2px solid rgba(255, 255, 255, 0.65);
  transition: left 0.12s linear;
  display: grid;
  place-items: center;
  font-size: 7px;
  font-weight: 800;
  color: #fff;
  font-family: var(--disp);
}
.dot.you {
  width: 20px;
  height: 20px;
  border-color: #fff;
  box-shadow: 0 0 10px rgba(228, 0, 43, 0.8);
  z-index: 2;
}

/* stage / sea */
.stage {
  position: relative;
  flex: 1 1 auto;
  overflow: hidden;
  background: linear-gradient(var(--sky-1), var(--sky-2));
}
.layer {
  position: absolute;
  left: 0;
  right: 0;
  pointer-events: none;
}
.mtns {
  top: 0%;
  height: 50vh;
  background-image: url(img/planine2.png);
  background-repeat: repeat-x;
  background-size: auto 110%;
  opacity: 1;
  z-index: 2;
}

/* .clouds {
  top: 0%;
  height: 40vh;
  background-image: url(img/oblaci.png);
  background-repeat: repeat-x;
  background-size: auto 110%;
  opacity: 1;
  z-index: 4;
} */

.waves {
  bottom: 0%;
  bottom: 0;
  background-image: url("img/more3.png");
  background-repeat: repeat-x;
  background-size: auto 100%;
  height: 45vh;
  z-index: 2;
  opacity: 1;
}

/* boats */
.boat-wrap {
  position: absolute;
  width: 150px;
  will-change: left;
  z-index: 5;
}
.boat-wrap.you {
  z-index: 8;
}
.bob {
  transform-origin: 50% 90%;
}
.boat-wrap.you .bob {
  animation: bob 2.6s ease-in-out infinite;
}
.boat-wrap.r1 .bob {
  animation: bob 2.9s ease-in-out infinite;
}
.boat-wrap.r2 .bob {
  animation: bob 2.3s ease-in-out infinite 0.3s;
}
.boat-wrap.r3 .bob {
  animation: bob 3.1s ease-in-out infinite 0.1s;
}
.boat-wrap.r4 .bob {
  animation: bob 2.5s ease-in-out infinite 0.4s;
}
@keyframes bob {
  0%,
  100% {
    transform: translateY(0) rotate(-1.2deg);
  }
  50% {
    transform: translateY(-4px) rotate(1.2deg);
  }
}
.boat-wrap svg {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 6px 5px rgba(0, 0, 0, 0.28));
}

.rower {
  transform-box: fill-box;
  transform-origin: 50% 100%;
}
.oar {
  transform-box: fill-box;
  transform-origin: 50% 0;
  transform: rotate(24deg);
}
.mallet {
  transform-box: fill-box;
  transform-origin: 80% 90%;
  transition: transform 0.1s;
}
.boat-wrap.you.rowing .rower {
  animation: rowerPull 0.5s cubic-bezier(0.34, 1.3, 0.5, 1) var(--d, 0s);
}
.boat-wrap.you.rowing .oar {
  animation: oarSweep 0.5s ease var(--d, 0s);
}
.boat-wrap.you.drum .mallet {
  transform: rotate(-40deg);
}
@keyframes rowerPull {
  0% {
    transform: rotate(0);
  }
  30% {
    transform: rotate(-16deg);
  }
  62% {
    transform: rotate(12deg);
  }
  100% {
    transform: rotate(0);
  }
}
@keyframes oarSweep {
  0% {
    transform: rotate(24deg);
  }
  28% {
    transform: rotate(44deg);
  }
  60% {
    transform: rotate(4deg);
  }
  100% {
    transform: rotate(24deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .bob,
  .boat-wrap.you.rowing .rower,
  .boat-wrap.you.rowing .oar {
    animation-duration: 0.25s;
  }
}

.finish-gate {
  position: absolute;
  top: 40%;
  bottom: 0;
  width: 16px;
  z-index: 7;
  will-change: left;
  display: none;
}
.finish-gate::before {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-conic-gradient(#141414 0 25%, #fff 0 50%) 0 0/16px 16px;
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.7);
}

/* meter */
.meter {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  width: min(calc(100% - 28px), 440px);
  height: 44px;
  z-index: 14;
  background: rgba(20, 20, 20, 0.82);
  border-radius: 22px;
  padding: 0 18px;
  box-shadow:
    0 8px 20px rgba(0, 0, 0, 0.3),
    inset 0 0 0 3px rgba(255, 255, 255, 0.08);
  display: flex;
  align-items: center;
}
.track {
  position: relative;
  flex: 1 1 auto;
  height: 16px;
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0.1),
    rgba(255, 255, 255, 0.03)
  );
  border-radius: 8px;
}
.zone {
  position: absolute;
  top: -6px;
  bottom: -6px;
  background: linear-gradient(180deg, var(--good), var(--good-deep));
  border-radius: 9px;
  box-shadow:
    0 0 14px rgba(18, 183, 106, 0.6),
    inset 0 0 0 2px rgba(255, 255, 255, 0.35);
}
.zone::before {
  content: "";
  position: absolute;
  top: 4px;
  bottom: 4px;
  left: 50%;
  width: 2px;
  background: rgba(255, 255, 255, 0.55);
}
.marker {
  position: absolute;
  top: -11px;
  bottom: -11px;
  width: 8px;
  left: 0;
  transform: translateX(-50%);
  background: var(--red);
  border-radius: 4px;
  box-shadow:
    0 0 0 2px #fff,
    0 2px 6px rgba(0, 0, 0, 0.5);
}
.marker::after {
  content: "";
  position: absolute;
  bottom: -9px;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
}

/* toast */
.toast {
  position: absolute;
  top: 34%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.6);
  font-family: var(--disp);
  font-weight: 800;
  font-size: 40px;
  letter-spacing: 1px;
  color: #fff;
  text-shadow: 0 3px 0 rgba(0, 0, 0, 0.35);
  text-transform: uppercase;
  opacity: 0;
  pointer-events: none;
  z-index: 20;
  white-space: nowrap;
}
.toast .t-in {
  padding: 0 6px;
}
.toast.bad .t-in {
  background: rgba(20, 20, 20, 0.55);
  border-radius: 8px;
}
.toast.pass .t-in {
  color: var(--gold);
}
.toast.good .t-in {
  color: var(--good);
}
.toast.show {
  animation: pop 0.7s ease forwards;
}
@keyframes pop {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.6);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -58%) scale(1.15);
  }
  72% {
    opacity: 1;
    transform: translate(-50%, -64%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -78%) scale(1);
  }
}

.shake {
  animation: shake 0.3s;
}
@keyframes shake {
  0%,
  100% {
    transform: translate(0, 0);
  }
  25% {
    transform: translate(-4px, 2px);
  }
  50% {
    transform: translate(4px, -2px);
  }
  75% {
    transform: translate(-3px, -2px);
  }
}
@media (prefers-reduced-motion: reduce) {
  .shake {
    animation: none;
  }
}

/* controls */
.controls {
  display: none;
  flex: 0 0 auto;
  padding: 11px 16px calc(11px + env(safe-area-inset-bottom));
  background: var(--ink);
  z-index: 30;
}
#app.racing .controls {
  display: block;
}
.go {
  display: block;
  width: 100%;
  max-width: 240px;
  margin: 0 auto;
  border: 0;
  cursor: pointer;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: #fff;
  background: linear-gradient(var(--red), var(--red-deep));
  padding: 12px;
  border-radius: 15px;
  box-shadow:
    0 6px 0 #7a0018,
    0 10px 18px rgba(0, 0, 0, 0.35);
  transition:
    transform 0.06s,
    box-shadow 0.06s;
}
.go:active {
  transform: translateY(4px);
  box-shadow:
    0 2px 0 #7a0018,
    0 5px 10px rgba(0, 0, 0, 0.35);
}
.hint {
  margin: 7px 2px 0;
  color: rgba(255, 255, 255, 0.55);
  font-size: 12px;
  text-align: center;
  font-weight: 600;
}

/* screens */
.screen {
  position: absolute;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 26px;
  gap: 12px;
  transition: opacity 0.3s;
}
.screen--start {
  background: url(img/brod.png) #e81b28;
  background-size: cover;
  background-position: bottom right;
  background-repeat: no-repeat;
  color: #fff;
}
.screen--end {
  background: linear-gradient(160deg, var(--red), var(--red-deep));
  color: #fff;
  opacity: 0;
  pointer-events: none;
}
.screen--end.lose {
  background: linear-gradient(160deg, #22405e, #12283d);
}
.screen--end.show {
  opacity: 1;
  pointer-events: auto;
  background: url(img/brod.png) #e81b28;
  background-size: cover;
  background-position: bottom right;
  background-repeat: no-repeat;
  color: #fff;
}
.screen.gone {
  opacity: 0;
  pointer-events: none;
}
.splash {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff, #bfe3ff);
  box-shadow: 0 0 4px rgba(190, 225, 255, 0.7);
  pointer-events: none;
}
.kicker {
  font-family: var(--disp);
  font-weight: 700;
  letter-spacing: 4px;
  text-transform: uppercase;
  font-size: 18px;
}
.big {
  font-family: var(--disp);
  font-weight: 800;
  font-size: 62px;
  line-height: 0.92;
  text-transform: uppercase;
  letter-spacing: -1px;
}
.sub {
  font-size: 17px;
  max-width: 640px;
  line-height: 1.15;
  font-weight: 600;
}
.btn {
  margin-top: 6px;
  border: 0;
  cursor: pointer;
  font-family: var(--disp);
  font-weight: 800;
  font-size: 31px;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--red);
  background: #fff;
  padding: 18px 38px;
  border-radius: 13px;
  box-shadow: 0 6px 0 rgba(0, 0, 0, 0.25);
  transition:
    transform 0.06s,
    box-shadow 0.06s;
}
.icon {
  width: 64px;
}

.directions {
  font-family: var(--disp);
  font-size: 15px;
  line-height: 0.92;
  text-transform: uppercase;
  margin: 6px auto;
}

.screen--end.lose .btn {
  color: #12283d;
}
.btn:active {
  transform: translateY(4px);
  box-shadow: 0 2px 0 rgba(0, 0, 0, 0.25);
}
.howto {
  display: flex;
  gap: 16px;
  margin-top: 2px;
}
.howto div {
  max-width: 120px;
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.3;
}
.howto b {
  display: block;
  font-family: var(--disp);
  font-size: 28px;
  font-weight: 800;
  margin-bottom: 2px;
}
.confetti {
  position: absolute;
  top: -16px;
  width: 9px;
  height: 14px;
  z-index: 41;
  border-radius: 1px;
}
@keyframes fall {
  to {
    transform: translateY(115vh) rotate(720deg);
  }
}
