@font-face {
  font-family: "CanvaSans", sans-serif;
  font-display: swap;
  font-weight: 400;
  font-style: normal;
  src: url("./assets/CanvaSans-Regular.woff2") format("woff2");
}

@font-face {
  font-family: "CanvaSans", sans-serif;
  font-display: swap;
  font-weight: 700;
  font-style: normal;
  src: url("./assets/CanvaSans-Bold.woff2") format("woff2");
}

@font-face {
  font-display: swap;
  font-family: "Leckerli One";
  font-style: normal;
  font-weight: 400;
  src: url("./assets/leckerli-one-v20-latin-regular.woff2") format("woff2");
}

* {
  box-sizing: border-box;
  -webkit-box-sizing: border-box;
}

body {
  padding: 0;
  margin: 0;
  min-width: 20rem;
  font-family: "CanvaSans", sans-serif;
  color: #000;
}

main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.container {
  width: 860px;
  max-width: 100%;
  margin: auto;
  padding: 0 30px;
  text-align: center;
}

#header {
  padding-top: 30px;
}

.headline h1 {
  margin: 0;
  font-family: "Leckerli One";
  font-size: 90px;
  font-weight: 400;
}

.headline h3 {
  color: #ebebeb;
  font-size: 22px;
  font-weight: 400;
  margin: 1rem 0 0;
}

.headline h3 span {
  font-family: "Leckerli One";
}

.headline p {
  font-size: 20px;
  margin: 10px 0;
  font-family: "CanvaSans", sans-serif;
}

.scores {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin: 4rem auto 3rem;
  font-size: 32px;
  font-weight: 700;
}

.player-score {
  position: relative;
  display: inline-block;
}

.progress-bar {
  position: relative;
  width: 400px;
  height: 0.875rem;
  background-color: #d4d4d4;
  max-width: 100%;
}

.progress-bar::before {
  position: absolute;
  top: -20px;
  left: 0;
  right: 0;
  margin: auto;
  width: 100px;
  font-size: 12px;
  z-index: 9;
}

.invalid .progress-bar::before {
  content: "Not a valid word!";
  color: #dfb1cf;
}

.processing .progress-bar::before {
  content: "Validating...";
  color: #dfb1cf;
}

.progress-bar .progress {
  position: absolute;
  top: 0;
  left: 0;
  width: 0%;
  height: 100%;
  background-color: #000;
  transition: all 0.5s ease-out;
}

.invalid .progress-bar .progress {
  opacity: 0.8;
  background-color: #000;
}

.slot-wrapper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 3rem;
  user-select: none;
}

.slot {
  position: relative;
  width: 84px;
  height: 110px;
  border: 3px solid #000000;
  border-radius: 10px;
  margin-left: -1px;
}

.word-assembly .slot {
  background-color: #fff;
}

.word-assembly .slot.has-hint::before {
  content: attr(data-hint);
  position: absolute;
  top: -24px;
  left: 0;
  right: 0;
  color: #dfb1cf;
}

.word-assembly .slot[boosted]::after {
  content: "Ly";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: "Leckerli One";
  font-size: 53px;
  color: #ebebeb;
}

.letter-generator .slot {
  background-color: #ebebeb;
}

.letter-wrapper {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: #dfb1cf;
  color: #fff;
  border-radius: 6px;
  cursor: grab;
  z-index: 1;
}

.letter-wrapper:active {
  cursor: grabbing;
}

.letter-wrapper .letter {
  font-size: 70px;
  font-weight: 700;
  line-height: 1;
}

.letter-wrapper .point {
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  transform: translateY(6px);
}

/* Touch dragging styles */
.touch-dragging {
  opacity: 0.5;
  position: absolute;
  transform: scale(1.25);
  display: flex !important;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

/* Ensure touch events aren't blocked */
.letter-wrapper {
  touch-action: none;
}

.dragging {
  opacity: 0.6;
}

[draggable="true"] {
  -webkit-tap-highlight-color: transparent;
}
/* End Touch Dragging */

.action {
  display: flex;
  gap: 4rem;
  justify-content: center;
  align-items: center;
  margin-top: 4rem;
  margin-bottom: 3rem;
}

.action button {
  position: relative;
  width: 130px;
  font-size: 18px;
  line-height: 1;
  padding: 14px;
  background-color: #d4d4d4;
  border: none;
  cursor: pointer;
  z-index: 1;
  overflow: hidden;
  transition: all 0.3s ease;
}

.action button:hover {
  background-color: #dfb1cf;
}

.add-space {
  flex: 1;
  width: 100%;
  max-width: 100%;
  height: 80px;
  background-color: #d4d4d4;
  text-align: center;
}

.top-players h2 {
  margin: 0 0 1.5rem;
  text-transform: uppercase;
}

.top-players table {
  width: 600px;
  max-width: 100%;
  margin: auto;
  background-color: #8f5f7e;
  border: 8px solid #fff;
}

.top-players tr,
.top-players th,
.top-players td {
  border: 1px solid #fff;
  padding: 5px;
}

.top-players th {
  font-weight: 700;
  background-color: #8f5f7e;
  color: #fff;
}

.top-players .name {
  width: 70%;
  text-align: left;
  padding-left: 10px;
}

.top-players tr td:nth-child(2) {
  text-align: left;
  padding-left: 10px;
}

.top-players td {
  background-color: #ffffff;
  color: #8f5f7e;
  border: 1px solid #d4d4d4;
}

.cta {
  padding: 1.5rem 0 0;
  text-align: center;
}

.btn-join {
  display: inline-block;
  padding: 10px 20px;
  background-color: #fff;
  border-radius: 4px;
  cursor: pointer;
}

.top-player-message {
  font-size: 1.25rem;
  font-weight: 600;
  margin: 1.5rem 0;
}

.guest-win {
  padding: 40px 0 80px;
}

.guest-win.headline h3 {
  color: #000;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  display: none;
  width: 100%;
  height: 100%;
  z-index: 999;
  background-color: rgb(255 200 234 / 90%);
  padding: 10% 1.5rem 0;
}

.modal .container {
  width: 400px;
  max-width: 100%;
  padding: 30px;
  background-color: #fff;
  border-radius: 10px;
}

.modal h2 {
  margin: 0 0 1.5rem;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  color: #fff;
}

.modal .form-row {
  display: flex;
  gap: 10px;
}

.modal .form-col {
  flex: 1;
  position: relative;
}

.modal input {
  width: 100%;
  padding: 10px 15px;
  border: none;
  border-radius: 0.25rem;
  background-color: #d4d4d4;
  color: #000;
  font-size: 1.125rem;
}

.modal input:focus {
  outline: none;
}

.modal input[type="submit"] {
  background-color: #8f5f7e;
  color: #fff;
  cursor: pointer;
  font-size: 1.25rem;
}

.error-message {
  position: absolute;
  z-index: 9;
  font-size: 12px;
  background-color: #8f5f7e;
  color: #fff;
  border-radius: 8px;
  padding: 6px 10px;
  animation: fadeIn 0.5s ease-in-out;
}

.login-link {
  font-size: 14px;
  padding: 10px 0 0px;
}

.btn-link {
  text-decoration: underline;
  color: #8f5f7e;
  cursor: pointer;
}

.close-win-screen,
.close-score-screen,
.close-modal {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background-color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  line-height: 1;
  color: #8f5f7e;
  cursor: pointer;
}

.close-win-screen::before,
.close-score-screen::before,
.close-win-screen::after,
.close-score-screen::after,
.close-modal::before,
.close-modal::after {
  content: "";
  position: absolute;
  width: 16px;
  height: 2px;
  border-radius: 2px;
  background-color: #8f5f7e;
  transform: rotate(-45deg);
}

.close-win-screen::after,
.close-score-screen::after,
.close-modal::after {
  transform: rotate(45deg);
}

.sparkle-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: baseline;
  background-color: rgb(255 200 234 / 90%);
  padding: 10% 1.5rem 0;
  animation: fadeIn 0.5s ease-in-out;
  z-index: 9;
}

.sparkle-screen.darker {
  background-color: rgb(255 200 234 / 98%);
}

.sparkle-screen .headline {
  max-width: 100%;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.btn-leaderboard {
  display: inline-block;
  cursor: pointer;
  border-radius: 5px;
  background-color: #8f5f7e;
  color: #fff;
  text-transform: uppercase;
  font-size: 1.25rem;
  padding: 1rem 2rem;
}

.sparkle-container {
  position: relative;
  width: 500px;
  max-width: 100%;
  background-color: #fff;
  border-radius: 10px;
  text-align: center;
  padding: 2rem;
}

.sparkle-screen h2 {
  margin: 0;
}

.sparkle-screen .btn-register {
  display: inline-block;
  background-color: #8f5f7e;
  color: #fff;
  cursor: pointer;
  font-size: 1.25rem;
  padding: 0.5rem 1.5rem;
  text-decoration: none;
  border-radius: 4px;
}

.sparkle-screen .next-round {
  font-weight: 700;
  font-size: 1.5rem;
}

.sparkle-screen .beat-time {
  color: #8f5f7e;
  font-weight: 700;
  font-size: 130%;
  vertical-align: middle;
}

.sparkle {
  position: absolute;
  scale: 0;
  animation: sparkle 4s ease-in-out;
  pointer-events: none;
}

.sparkle-bg {
  position: absolute;
  scale: 0;
  animation: sparkle-bg 4s ease-in-out;
  max-width: 100%;
  pointer-events: none;
}

.sparkle-bg img {
  width: 600px;
  max-width: 100%;
}

@keyframes sparkle {
  0% {
    scale: 0;
  }
  40% {
    scale: 1.2;
  }
  70% {
    opacity: 1;
    scale: 1;
  }
  100% {
    opacity: 0;
    scale: 1;
  }
}

@keyframes sparkle-bg {
  0% {
    scale: 0;
    transform: translateY(-20%);
  }
  40% {
    scale: 1;
  }
  60% {
    opacity: 1;
    opacity: 0.5;
  }
  80% {
    scale: 1;
    opacity: 0;
  }
  100% {
    opacity: 0;
    scale: 1;
    transform: translateY(10%);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

.btn-save {
  background-color: #dfb1cf;
  padding: 0.8rem 1.5rem;
  display: inline-block;
  cursor: pointer;
  margin-top: 20px;
}

.next-round {
  font-weight: 700;
}

.top-players {
  position: relative;
}

.btn-logout {
  position: absolute;
  bottom: 10px;
  right: 15px;
  display: inline-block;
  text-decoration: underline;
  text-transform: uppercase;
  font-size: 12px;
  cursor: pointer;
  display: none;
}

.loading-screen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: #fff;
  color: #000;
  font-family: "Leckerli One";
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 20px;
  z-index: 9999;
}

#gameScore {
  padding: 50px 0 80px;
}

.states-wrapper {
  position: relative;
  padding: 40px 30px;
  background-color: #ebebeb;
}

.states {
  display: flex;
  justify-content: space-evenly;
  margin-bottom: 50px;
}

.count-wrapper {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.count-wrapper .count {
  font-size: 36px;
  font-weight: 700;
}

.count-wrapper .count-type {
  font-size: 18px;
}

.hints-used {
  text-align: center;
}

.hints-used p {
  font-size: 18px;
}

.hints-used ul {
  list-style: none;
  padding: 0;
  margin: 0 auto;
  width: 360px;
  max-width: 100%;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.hints-used ul li {
  display: flex;
  align-items: center;
  gap: 20px;
}

.hints-number {
  font-size: 36px;
  font-weight: 700;
}

.hints-bar {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 14px;
}

.hints-bar .bar {
  height: 100%;
  width: 0;
  min-width: 10px;
  background-color: #000;
  transition: all 1.5s ease-in;
}

.hints-bar::after {
  content: attr(data-hints-used);
  font-size: 12px;
  line-height: 1;
}

.active .hints-bar .bar {
  background-color: #dfb1cf;
}

.btn-progress {
  background-color: #dfb1cf;
  color: #fff;
  text-decoration: none;
  padding: 12px 20px;
  display: inline-block;
  text-transform: uppercase;
}

.close-win-screen {
  top: -1rem;
  right: -1rem;
  box-shadow: 0px 0px 7px rgb(0 0 0 / 20%);
}

.close-score-screen {
  top: 1rem;
  right: 1rem;
}

.btn-see-progress,
.btn-win-save {
  margin: 0;
  transform: translateY(-30px);
}

.btn-see-progress {
  color: #fff;
}

@media screen and (max-width: 1200px) {
  .container {
    width: 700px;
  }
  .headline h1 {
    font-size: 80px;
  }
  .headline p {
    font-size: 18px;
  }
  .scores {
    margin: 2rem auto 2rem;
  }
  .word-assembly,
  .letter-generator {
    margin-bottom: 2rem;
  }
  .action {
    margin-top: 2rem;
    margin-bottom: 2rem;
  }
  .timer {
    font-size: 24px;
    margin-bottom: 1rem;
  }
}

@media screen and (max-width: 768px) {
  .scores {
    margin: 3rem auto;
  }
  .word-assembly,
  .letter-generator {
    margin-bottom: 3rem;
  }
  .action {
    margin-top: 3rem;
    margin-bottom: 3rem;
  }
  .timer {
    font-size: 24px;
    margin-bottom: 2rem;
  }
}

@media screen and (max-width: 640px) {
  .container {
    padding: 0 20px;
  }
  .scores {
    font-size: 30px;
    margin: 2rem auto;
  }
  .slot-wrapper {
    margin-bottom: 1rem;
  }
  .slot {
    height: 80px;
  }
  .word-assembly .slot[boosted]::after {
    font-size: 30px;
  }
  .letter-wrapper .letter {
    font-size: 50px;
  }
  .letter-wrapper .point {
    transform: none;
  }
  .action {
    margin-top: 3rem;
    margin-bottom: 2.2rem;
    gap: 2rem;
  }
  .action button {
    padding: 10px 15px;
  }
  .modal .form-row {
    flex-direction: column;
  }
  .sparkle-screen .headline h1 {
    font-size: 30px;
  }
  .sparkle-screen .headline h2 {
    font-size: 22px;
  }
  #gameScore {
    padding: 50px 0;
  }
  .states-wrapper {
    padding: 30px 20px;
  }
  .count-wrapper .count,
  .hints-number {
    font-size: 32px;
  }
  .btn-see-progress,
  .btn-win-save {
    transform: translateY(-20px);
    padding: 0.5rem 1rem;
    font-size: 14px;
  }
}
@media screen and (max-width: 500px) {
  .slot-wrapper {
    gap: 6px;
  }
  .slot {
    height: 60px;
    border-width: 2px;
  }
  .word-assembly .slot[boosted]::after {
    font-size: 24px;
  }
  .word-assembly .slot[data-hint]::before {
    top: -20px;
    font-size: 14px;
  }
  .letter-wrapper .letter {
    font-size: 38px;
  }
  .letter-wrapper .point {
    font-size: 12px;
  }
  .states {
    margin-bottom: 30px;
  }
  .count-wrapper .count,
  .hints-number {
    font-size: 28px;
  }
  .hints-used p,
  .count-wrapper .count-type {
    font-size: 16px;
  }
}

@media screen and (max-width: 400px) {
  #header {
    padding-top: 10px;
  }
  .headline h1 {
    font-size: 70px;
  }
  .sparkle-screen .headline h1 {
    font-size: 24px;
  }
  .sparkle-screen .headline h2 {
    font-size: 18px;
  }
  .btn-leaderboard {
    font-size: 1rem;
    padding: 0.8rem 1.5rem;
  }
  .scores {
    font-size: 24px;
    margin: 2rem auto 1.5rem;
  }
  .progress-bar {
    height: 0.625rem;
  }
  .slot-wrapper {
    margin-bottom: 1rem;
    gap: 4px;
  }
  .slot {
    height: 50px;
  }
  .word-assembly .slot[boosted]::after {
    font-size: 20px;
  }
  .word-assembly .slot[data-hint]::before {
    font-size: 12px;
  }
  .letter-wrapper .letter {
    font-size: 32px;
  }
  .action {
    margin-top: 2rem;
    gap: 1rem;
  }
  .action button {
    font-size: 12px;
  }
  .hints-used ul li {
    gap: 10px;
  }
  .count-wrapper {
    flex-basis: 25%;
  }
  .count-wrapper .count,
  .hints-number {
    font-size: 24px;
  }
  .hints-used p,
  .count-wrapper .count-type {
    font-size: 14px;
  }
  .hints-bar .bar {
    min-width: 7px;
  }
}
