*, *:before, *:after {
  box-sizing: border-box;
}

:root {
  --green-bottom: #bdf7b8;
  --green-top: #f4fff3;
  --black: #000000;
  --white: #ffffff;
  --grey: #666666;
  --light-grey: #bcbcbc;
  --success-green: #39ff14;
  --threshold-green: #239b56;
  --teal: #7fded8;
}

html {
  font-family: sans-serif;
}

body {
  background: linear-gradient(to top, var(--green-bottom) 0%, var(--green-top) 100%);
  color: var(--black);
  font-family: sans-serif;
  margin: 0;
  overflow: hidden;
}

.landscape-app {
  background: linear-gradient(to top, var(--green-bottom) 0%, var(--green-top) 100%);
  height: 100vh;
  left: 0;
  overflow: hidden;
  position: fixed;
  top: 0;
  width: 100vw;
}

button {
  font-family: inherit;
}

.finger-highlight {
  font-size: inherit;
  font-weight: 900;
}

/* Shared buttons */

.recalibrate-button {
  background-color: var(--black);
  border: none;
  border-radius: 999px;
  color: var(--white);
  cursor: pointer;
  font-size: 0.62rem;
  font-weight: bold;
  padding: 5px 9px;
  touch-action: manipulation;
}

.quit-button,
.return-button,
.back-button {
  background-color: transparent;
  border: 3px solid var(--black);
  border-radius: 999px;
  color: var(--black);
  cursor: pointer;
  font-size: 1.2rem;
  font-weight: bold;
  padding: 7px 10px;
  touch-action: manipulation;
}

/* Intro popups */

.intro-popup {
  align-items: center;
  background: linear-gradient(to top, var(--green-bottom) 0%, var(--green-top) 100%);
  display: flex;
  height: 100vh;
  justify-content: center;
  left: 0;
  opacity: 1;
  pointer-events: auto;
  position: fixed;
  top: 0;
  transition: opacity 250ms ease;
  width: 100vw;
  z-index: 999;
}

.intro-popup.hidden {
  opacity: 0;
  pointer-events: none;
}

.intro-popup-content {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 18px;
  text-align: center;
}

.intro-popup-text {
  color: var(--black);
  font-size: 1.45rem;
  font-weight: bold;
  line-height: 1.15;
  margin-bottom: 14px;
  text-align: center;
}

.intro-popup-image {
  border-radius: 18px;
  display: block;
  max-height: 70vh;
  max-width: 82vw;
  object-fit: contain;
}

/* Index / calibration */

.skip-force-mode-button {
  background-color: transparent;
  border: 1px solid var(--black);
  border-radius: 999px;
  color: var(--black);
  cursor: pointer;
  font-size: 0.55rem;
  font-weight: bold;
  padding: 4px 7px;
  position: absolute;
  right: 30px;
  top: 8px;
  z-index: 20;
  touch-action: manipulation;
}

.calibration-screen {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100%;
  padding: 12px;
  text-align: center;
  width: 100%;
}

.calibration-title {
  font-size: 1.65rem;
  font-weight: bold;
  padding: 0 30px 4px 30px;
  position: relative;
  text-align: center;
  z-index: 10;
}

.calibration-force-bar-area {
  align-items: center;
  display: flex;
  justify-content: center;
  margin: 8px 0 6px 0;
  width: 100%;
}

.calibration-force-bar-shell {
  background-color: transparent;
  border: 3px solid var(--black);
  border-radius: 8px;
  height: 26px;
  overflow: hidden;
  width: 260px;
}

.calibration-force-bar-fill {
  background-color: rgb(0, 255, 0);
  height: 100%;
  transition:
    width 80ms linear,
    background-color 80ms linear;
  width: 0%;
}

.calibration-press-area {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 105px;
  width: 100%;
  margin: 0;
}

.calibration-btn {
  align-items: center;
  background-color: transparent;
  border: 5px solid var(--grey);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  font-size: 1.05rem;
  font-weight: 900;
  height: 150px;
  justify-content: center;
  line-height: 1.15;
  text-align: center;
  width: 150px;
  touch-action: none;
  user-select: none;
}

.calibration-button-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 0;
}

.calibration-button {
  border: none;
  border-radius: 999px;
  color: var(--white);
  cursor: pointer;
  font-weight: bold;
  margin-left: 15px;
  margin-top: 10px;
  touch-action: manipulation;
}

#back-btn.calibration-button {
  background-color: var(--black);
  font-size: 1.2rem;
  padding: 10px 20px;
}

#proceed-btn {
  background-color: rgb(11, 169, 11);
  font-size: 1.2rem;
  padding: 10px 20px;
}

#reset-btn {
  background-color: var(--black);
  font-size: 0.5rem;
  padding: 1px 10px;
}

.calibration-button:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

/* Exercise selection */

.exercise-select-screen {
  align-items: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 85%;
  padding: 12px;
  text-align: center;
  width: 100%;
}

.exercise-select-title {
  font-size: 2.5rem;
  font-weight: bold;
  margin-bottom: 20px;
}

.exercise-button {
  align-items: center;
  background-color: var(--black);
  border: none;
  border-radius: 999px;
  color: var(--white);
  cursor: pointer;
  display: flex;
  font-size: 1.5rem;
  font-weight: bold;
  justify-content: center;
  margin: 6px;
  min-width: 230px;
  padding: 9px 14px;
  position: relative;
  touch-action: manipulation;
}

.exercise-button-text {
  display: block;
  padding: 0 30px;
}

.checkmark-slot {
  align-items: center;
  background-color: var(--white);
  border: 2px solid var(--white);
  border-radius: 50%;
  display: flex;
  height: 24px;
  justify-content: center;
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 24px;
}

.checkmark {
  color: var(--white);
  display: none;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1;
}

.exercise-button.completed .checkmark-slot {
  background-color: var(--success-green);
  border-color: var(--success-green);
}

.exercise-button.completed .checkmark {
  display: block;
}

.back-button {
  left: 8px;
  position: absolute;
  top: 8px;
  z-index: 20;
}

/* Exercise 1 */

.round-counter,
.pair-counter {
  font-size: 1rem;
  font-weight: bold;
  left: 8px;
  position: absolute;
  top: 6px;
  z-index: 30;
}

.controls__notice {
  font-size: 1.45rem;
  font-weight: bold;
  padding: 20px 20px 4px 20px;
  position: relative;
  text-align: center;
  z-index: 10;
}

.controls__btn {
  background-color: transparent;
  border: 6px solid var(--grey);
  border-radius: 50%;
  cursor: pointer;
  height: 90px;
  left: 50%;
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  touch-action: none;
  user-select: none;
  width: 90px;
  z-index: 5;
}

.target-circle {
  align-items: center;
  border-radius: 50%;
  color: var(--white);
  display: flex;
  font-size: 1.15rem;
  font-weight: bold;
  height: 34px;
  justify-content: center;
  opacity: 1;
  pointer-events: none;
  position: absolute;
  text-align: center;
  transform: translate(-50%, -50%) scale(1);
  transition:
    opacity 220ms ease,
    transform 220ms ease,
    box-shadow 220ms ease;
  width: 34px;
  z-index: 2;
}

.target-circle.caught-target {
  opacity: 0;
  transform: translate(-50%, -50%) scale(0.35);
}

@keyframes targetPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(50, 255, 50, 0.9);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(50, 255, 50, 0.9);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(180, 180, 180, 0.9);
  }
}

.target-circle.next-target {
  animation: targetPulse 1.1s ease-in-out infinite;
}

.exercise-bottom-left {
  bottom: 8px;
  left: 8px;
  position: absolute;
  z-index: 20;
}

.exercise-bottom-right {
  bottom: 8px;
  position: absolute;
  right: 8px;
  z-index: 20;
}

/* Exercise 2 */

.normal-ui {
  left: 0;
  pointer-events: none;
  position: fixed;
  top: 10px;
  width: 100vw;
  z-index: 100;
}

.normal-bottom-ui {
  bottom: 8px;
  display: flex;
  justify-content: space-between;
  left: 0;
  padding: 0 8px;
  pointer-events: none;
  position: fixed;
  width: 100vw;
  z-index: 120;
}

.normal-bottom-ui button {
  pointer-events: auto;
}

.exercise2-notice {
  font-size: 1.25rem;
  line-height: 1.15;
  padding: 0 18px;
}

.timer {
  color: var(--black);
  font-size: 5rem;
  font-weight: bold;
  margin-left: 50vw;
  margin-top: 70vw;
  pointer-events: none;
  text-align: center;
  transition:
    color 180ms ease,
    font-size 180ms ease,
    margin-left 260ms ease,
    opacity 180ms ease,
    top 260ms ease,
    transform 260ms ease;
}

.timer.thumb-timer {
  left: 50%;
  margin-left: 0;
  margin-top: 0;
  position: fixed;
  top: 50%;
  transform: translate(-50%, -50%);
  width: auto;
}

.timer.active-timer {
  color: var(--teal);
  font-size: 7rem;
}

.hold-target {
  align-items: center;
  background-color: transparent;
  border: 6px solid var(--grey);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  height: 90px;
  justify-content: center;
  opacity: 1;
  position: absolute;
  transform: translate(-50%, -50%) scale(1);
  transition:
    height 260ms ease,
    width 260ms ease,
    border-radius 260ms ease,
    border-width 160ms ease,
    border-color 160ms ease,
    opacity 260ms ease,
    transform 260ms ease;
  width: 90px;
  touch-action: none;
  user-select: none;
  z-index: 2;
}

.hold-target.active-target {
  border-radius: 50%;
  height: 124px;
  width: 124px;
  z-index: 3;
}

.target-label {
  display: none;
  font-size: 1.05rem;
  font-weight: 900;
  line-height: 1.2;
  max-width: 96px;
  opacity: 0;
  pointer-events: none;
  text-align: center;
  transition: opacity 180ms ease;
  white-space: normal;
}

.hold-target.active-target .target-label {
  display: block;
  opacity: 1;
}

@keyframes holdTargetPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(50, 255, 50, 0.9);
  }

  50% {
    box-shadow: 0 0 0 10px rgba(180, 180, 180, 0.15);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(180, 180, 180, 0.9);
  }
}

.hold-target.active-target {
  animation: holdTargetPulse 1.1s ease-in-out infinite;
}

.hold-target.active-target.threshold-met {
  animation: none;
}

.hold-target.threshold-met {
  border-color: var(--threshold-green) !important;
}

.hold-target.completed-target {
  opacity: 0.25;
  transform: translate(-50%, -50%) scale(0.92);
}

/* Exercise 3 */

.drag-circle {
  align-items: center;
  background-color: transparent;
  border: 6px solid var(--grey);
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  font-size: 0.9rem;
  font-weight: 900;
  height: 90px;
  justify-content: center;
  line-height: 1.15;
  position: absolute;
  text-align: center;
  transform: translate(-50%, -50%);
  transition:
    left 180ms ease,
    top 180ms ease,
    border-width 120ms ease,
    border-color 120ms ease,
    opacity 220ms ease;
  width: 90px;
  touch-action: none;
  user-select: none;
  z-index: 5;
}

.drag-circle.dragging {
  transition:
    border-width 120ms ease,
    border-color 120ms ease,
    opacity 220ms ease;
}

.drag-circle.threshold-met {
  border-color: var(--threshold-green);
}

.drag-circle.completed-circle {
  opacity: 0.35;
  transition: opacity 220ms ease;
}

.center-target {
  align-items: center;
  background-color: transparent;
  border: 5px solid var(--light-grey);
  border-radius: 50%;
  color: var(--light-grey);
  display: flex;
  font-size: 0.85rem;
  font-weight: 900;
  height: 96px;
  justify-content: center;
  line-height: 1.15;
  position: absolute;
  text-align: center;
  transform: translate(-50%, -50%);
  width: 96px;
  z-index: 2;
}

.center-target.reached {
  border-color: var(--threshold-green);
  color: var(--threshold-green);
}

@keyframes centerPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(50, 255, 50, 0.9);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(50, 255, 50, 0.45);
  }

  100% {
    box-shadow: 0 0 0 0 rgba(180, 180, 180, 0.9);
  }
}

.center-target {
  animation: centerPulse 1.1s ease-in-out infinite;
}

.center-target.reached {
  animation: none;
}

/* End screen */

.end-screen {
  align-items: center;
  background: linear-gradient(to top, var(--green-bottom) 0%, var(--green-top) 100%);
  display: flex;
  height: 100vh;
  justify-content: center;
  left: 0;
  position: fixed;
  text-align: center;
  top: 0;
  width: 100vw;
}

.end-message {
  font-size: 3rem;
  font-weight: bold;
}

/* Portrait rotation */

@media screen and (orientation: portrait) {
  .rotate-app .landscape-app {
    height: 100vw;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
    width: 100vh;
  }

  .rotate-intro .intro-popup-content {
    height: 100vw;
    transform: rotate(90deg);
    transform-origin: center center;
    width: 100vh;
  }

  .rotate-intro .intro-popup-image {
    max-height: 58vw;
    max-width: 72vh;
  }

  .target-label {
    transform: rotate(-90deg);
  }

  .end-screen.sideways {
    height: 100vw;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) rotate(90deg);
    transform-origin: center center;
    width: 100vh;
  }
}