*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Roboto', sans-serif;
}

.demo {
  display: flex;
  flex-direction: column;
  padding: 30px 20px;
}

.demo__nav {
  display: flex;
  justify-content: center;
  margin-bottom: 25px;
}

.demo__logo {
  display: flex;
  width: 180px;
  height: 30px;
}

.demo__logo img {
  width: 100%;
  height: 100%;
}

.demo__container {
  align-self: center;
  max-width: 700px;
  width: 100%;
  display: flex;
  flex-direction: column;
}

.demo__select-mic {
  position: relative;
  margin-bottom: 25px;
  align-self: center;
  max-width: 400px;
  width: 100%;
}
.demo__select-mic-input {
  width: 100%;
  appearance: none;
  background-color: transparent;
  border-radius: 10px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.07);
  padding: 15px 40px;
  cursor: pointer;
  color: #000;
}
.demo__select-mic-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}
.demo__select-mic-chevron {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  pointer-events: none;
}

.demo__loader {
  display: flex;
  gap: 20px;
  justify-content: center;
  align-items: center;
  margin-bottom: 25px;
  height: 100px;
}
.demo__loader-status {
  font-size: 1.5rem;
  font-weight: medium;
}

.demo__trial-note {
  display: flex;
  gap: 10px;
  background-color: rgb(255, 244, 229);
  max-width: 600px;
  width: 100%;
  align-self: center;
  padding: 10px;
  border-radius: 10px;
  margin-bottom: 25px;
  min-height: 100px;
}
.demo__trial-note--warning {
  background-color: rgb(253, 237, 237);
  color: rgb(95, 33, 32);
}
.demo__trial-note--err {
  min-height: auto;
}
.demo__trial-note-msg {
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 14px;
  color: rgb(102, 60, 0);
}
.demo__trial-note-icon {
  flex-shrink: 0;
  fill: #ed6c02;
}
.demo__trial-note--warning .demo__trial-note-icon {
  fill: #d32f2f;
}

.demo__error {
  align-self: center;
  padding: 10px 5px;
  background-color: rgb(253, 237, 237);
  color: rgb(95, 33, 32);
  border-radius: 4px;
  margin-bottom: 25px;
  max-width: 600px;
  width: 100%;
}

.demo__title {
  display: flex;
  flex-direction: column;
  position: relative;
  align-self: center;
  align-items: center;
}
.demo__title-msg {
  letter-spacing: 0.25rem;
  font-weight: 900;
  text-align: center;
  margin-top: 0px;
  margin-bottom: 25px;
}
.demo__title-beta-label {
  background-color: rgb(253, 237, 237);
  padding: 5px 10px;
  font-weight: bold;
  font-size: 10px;
  border-radius: 30px;
  margin-bottom: 10px;
}

.demo__text {
  margin-top: 0px;
  margin-bottom: 15px;
}

.demo__highlight-next-word {
  margin-bottom: 25px;
  display: flex;
  align-self: flex-start;
  align-items: center;
  gap: 5px;
  cursor: pointer;
}

.demo__highlight-next-word input[type='checkbox'] {
  width: 15px;
  height: 15px;
  accent-color: #333;
  cursor: pointer;
}

.demo__start-btn {
  align-self: center;
  -webkit-tap-highlight-color: transparent;
  background-color: #111111;
  border-radius: 12px;
  border: none;
  padding: 0;
  cursor: pointer;
  outline-offset: 4px;
  margin-bottom: 25px;
}
.demo__start-btn-front {
  display: block;
  padding: 12px 42px;
  border-radius: 12px;
  background-color: #333333;
  font-size: 1.25rem;
  color: white;
  transform: translateY(-6px);
}
.demo__start-btn:active:not(:disabled) .demo__start-btn-front {
  transform: translateY(-2px);
}
.demo__start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.demo__metrics {
  margin-bottom: 25px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.demo__words-read-correctly {
  display: flex;
  align-items: center;
  gap: 5px;
}
.demo__rate-of-speech {
  display: flex;
  align-items: center;
  gap: 5px;
}

.demo__audio {
  margin-bottom: 25px;
  width: 100%;
}

.demo__debug-btn {
  display: flex;
  background-color: transparent;
  border: none;
  align-items: center;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  font-size: 1.1rem;
  color: #000;
}
.demo__debug--active .demo__debug-chevron {
  transform: rotate(180deg);
}
.demo__debug-info {
  margin-top: 10px;
  font-family: 'Courier New', Courier, monospace;
  display: flex;
  flex-direction: column;
  background-color: #eee;
  padding: 10px;
  border-radius: 10px;
  overflow: auto;
}
.demo__alignment-stats {
  display: flex;
  flex-direction: column;
}

.correct-accent {
  background-color: green;
  color: white;
}
.correct-underline {
  position: relative;
  cursor: pointer;
}
.correct-underline::after {
  position: absolute;
  content: '';
  width: 100%;
  top: 100%;
  bottom: -2px;
  left: 0;
  background-color: green;
  transition: 100ms;
  z-index: -1;
}
.correct-underline:hover::after {
  bottom: -2px;
  top: 0px;
}
.deletion-accent,
.substitution-accent {
  background-color: red;
}
.deletion-underline,
.substitution-underline {
  position: relative;
}
.deletion-underline::after,
.substitution-underline::after {
  position: absolute;
  content: '';
  width: 100%;
  top: 100%;
  bottom: -2px;
  left: 0;
  background-color: red;
  transition: 100ms;
  z-index: -1;
}

@keyframes spin {
  from {
    transform: rotate(0deg);
  }
  to {
    transform: rotate(360deg);
  }
}

.spinner {
  display: inline-flex;
  position: relative;
}
.spinner__progress {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  font-size: 12px;
  color: #888;
}
.spinner__svg {
  color: #333333;
  animation: spin 0.75s linear infinite;
  width: 50px;
  height: 50px;
}
.spinner__ring {
  opacity: 0.25;
}
.spinner__spin {
  opacity: 0.75;
}

@media screen and (min-width: 900px) {
  .demo__title-msg {
    font-size: 2.25rem;
  }

  .demo__text {
    font-size: 1.25rem;
    line-height: 2rem;
  }

  .demo__highlight-next-word {
    font-size: 1.1rem;
  }

  .demo__debug-btn {
    font-size: 1.2rem;
  }
}

@media screen and (min-width: 470px) {
  .demo__title-beta-label {
    position: absolute;
    left: 102%;
    bottom: 85%;
    white-space: nowrap;
    margin: 0;
  }
}

@media screen and (min-width: 1080px) {
  .demo__nav {
    margin-bottom: 0px;
  }

  .demo__logo {
    position: absolute;
    top: 30px;
    left: 20px;
  }
}
