@font-face {
  font-family: 'NewsCycle';
  src: url('/fonts/NewsCycle-Regular.ttf') format('truetype');
}
@font-face {
  font-family: 'Dosis';
  src: url('/fonts/Dosis.ttf') format('truetype');
}

:root {
    font-size: 16px;
    font-family: 'Dosis';
    --real-vh: 100vh;

    --bg-primary: #fefaf1;
    --bg-secondary: #eee9df;
    
    --dark-bg-primary: #1b1814;
    --dark-bg-secondary: #26221d;

    --bg-card: #fcf6eb;
    --bg-btn: #f7dab1;

    --positive-bg-btn: #d7efd6;
    --negative-bg-btn: #f1c9c9;

    --border: #f1e4d0;
    /* --border-secondary: #cdbedc; */
    --border-secondary: #d6c6df;

    --theme: #fde8d5;
    /* --theme-secondary: #d9c8eb; */
    --theme-secondary: #e7d6f2;

    --positive-theme: #c8ebd9;
    --positive-border: #d3e9d8;

    --dark-positive-theme: #6d8f5f;
    --dark-negative-theme: #9b5f5f;

    --negative-theme: #ebc8c8;
    --negative-border: #e6c8c8;

    --theme-shadow: #cabaaa40;
    --theme-shadow-secondary: #ada0c340;

    --positive-shadow: #a3cfc240;
    --negative-shadow: #d9a8a840;

    --font-primary: #5b4a2e;
    --font-secondary: #73634d;

    --dark-font-primary: #d8d3ca;
    --dark-font-secondary: #bcb8b0;

    --transition-speed: 400ms;
    --fast-transition-speed: 150ms;

    --canvas-size: 16rem;
}

* {
    font-family: 'Dosis';
    font-size: 1rem;
    color: var(--font-primary);
}

h1, h2 {
  font-family: 'NewsCycle';
}

::-webkit-scrollbar {
  display: none;
}

html {
  height: 100%;
  /* overflow: hidden; */
}

html,
body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-primary);
  color: var(--font-primary);
}

body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

ul,
ol {
    list-style: none;
}

a {
    text-decoration: none;
}

img {
  -webkit-user-drag: none;
}

header {
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
}

#logoTitle {
  display: none;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0.5rem;
  user-select: none;
}

#logoTitle h1 {
  font-size: 1.5rem;
  margin: 0;
}

#logoTitle img {
  width: 4rem;
  object-fit: contain;
}

.profile,
.profile-stack {
  position: relative;
  display: flex;
  gap: 1rem;
  font-weight: 600;
  user-select: none;
}

.profile {
  width: 100%;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  margin: 1rem 0.5rem;
}

.profile-stack {
  flex-direction: column;
  justify-content: center;
  align-items: flex-end;
  margin: 0 0.5rem 0 0;
}

#usernameDisplay {
  max-width: 8.5rem;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  padding: 0.5rem 0.75rem;
  border-radius: 8px;
  background: var(--theme-secondary);
  border: 2px solid var(--border-secondary);
  cursor: pointer;
  transition: background 0.2s ease;
}

#usernameDisplay:hover {
  background: var(--theme-shadow-secondary);
}

#profile.closed #usernameDisplay {
  background: var(--theme-shadow-secondary);
}

#profileMenu {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 0.5rem;
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  background: var(--bg-card);
  box-shadow: -6px 6px 10px var(--theme-shadow-secondary);
  border: 2px solid var(--border-secondary);
  border-radius: 1rem;
  padding: 0.5rem 0.5rem 0.5rem 0.5rem;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
  min-width: max-content;
  z-index: 50;
}

#profile.closed #profileMenu,
#avatarPicker.closed {
  opacity: 0;
  transform: translateY(-10px);
  pointer-events: none;
}

#profileMenu button {
  background-color: var(--theme-secondary);
  box-shadow: 0 2px 6px var(--theme-shadow-secondary);
  border: 2px solid var(--border-secondary);
  border-radius: 0.5rem;
}

#profileMenu button:hover {
  box-shadow: 0 6px 12px var(--theme-shadow-secondary);
}

#profilePic {
  position: relative;
  width: 4rem;
  height: 4rem;
  background-color: var(--theme-secondary);
  border-radius: 50%;
  margin-left: 0.5rem;
}

#profilePic img {
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  object-fit:fill;
}

#avatarPicker {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.5rem;
  position: absolute;
  top: calc(100% + 0.9rem);
  left: 0.5rem;
  background: var(--bg-card);
  box-shadow: -6px 6px 10px var(--theme-shadow-secondary);
  border: 2px solid var(--border-secondary);
  border-radius: 1rem;
  padding: 0.5rem 0.5rem 0.5rem 0.5rem;
  overflow: hidden;
  opacity: 1;
  transform: translateY(0);
  transition: opacity 0.25s ease, transform 0.25s ease;
  min-width: max-content;
  z-index: 50;
}

.avatar-picker img {
  background-color: var(--theme-secondary);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s ease;
}

.avatar-picker img:hover {
  transform: scale(1.1);
}

.progress-bar {
  width: 10rem;
  height: 1.05rem;
  background-color: var(--bg-secondary);
  border: 2px solid var(--border-secondary);
  position: relative;
  border-radius: 1rem;
}

.progress-bar span {
  display: block;
  height: 100%;
  width: 50%;
  background-color: var(--theme-secondary);
  transition: width 0.3s ease;
  border-radius: 1rem;
}

.lessons-category .progress-bar {
  width: 80%;
}
.lessons-category .progress-bar.completed {
  border: 2px solid var(--positive-border);
}
.lessons-category .progress-bar.completed span {
  background-color: var(--positive-theme);
}

.progress-bar .progress-text {
  position: absolute;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1rem;
  left: 0;
  right: 0;
  top: 0;
  bottom: 0;
  color: var(--font-secondary);
  font-weight: 600;
}

main {
  flex: 1;
  width: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

h1 {
  font-size: 2.5rem;
}

h3 {
  font-size: 1.5rem;
  font-weight: 500;
}

p {
  width: 100%;
  text-align: center;
  margin: 0;
}

button {
  font-weight: 500;
  background-color: var(--bg-btn);
  border: 2px solid var(--border);
  border-radius: 10rem;
  padding: 0.25rem 0.5rem;
  box-shadow: 0 2px 6px var(--theme-shadow);
  transition: all 0.2s ease;
  cursor: pointer;
}

button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px var(--theme-shadow);
}

button.disabled {
  filter: grayscale(0.75);
  cursor: not-allowed;
}
button.disabled:hover {
  transform: none;
  box-shadow: 0 2px 6px var(--theme-shadow);
}
button span.emoji {
  font-size: 1.1rem;
}

main > h1 {
  width: calc(100% - 3rem);
  text-align: center;
  font-size: 2rem;
  text-decoration: underline;
  text-decoration-color: var(--theme-shadow);
  text-decoration-thickness: 0.5rem;
  text-underline-offset: 0.5rem;
  margin: 1rem 1.5rem 1.2rem 1.5rem;
}

#loginBody {
  background-color: var(--bg-primary);
  background-image: url("/images/background/login_background.png");
  background-repeat: repeat;
  background-position: center;
  background-size: 40rem;
}

#loginHeader {
  position: fixed;
  justify-content: center;
  align-items: center;
}

#loginMain {
  display: flex;
  justify-content: center;
  align-items: center;
  overflow: visible;
  background-color: transparent;
}
#loginMain::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100%;
  height: 100%;
  background: #0a0f1e80;
  z-index: 53;
  pointer-events: none;
  transition: background 1s ease-in-out;
}
#loginMain.unfocused::before {
  background: transparent;
}

#loginMain h2 {
  font-size: 1.2rem;
}

#login-section,
#register-section {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

form {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#loginSwitch,
#registerSwitch {
  width: auto;
  text-decoration: underline;
  font-size: 0.9rem;
  margin: 1rem 0;
  cursor: pointer;
}

.login-lottie-wrapper {
  position: relative;
  width: 10rem;
  height: 10rem;
}

#loginCharacter,
#loginBubbleCharacter,
.login-character-shade {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
}

#loginCharacter {
  z-index: 50;
  transition: filter 1s ease-in-out;
}

.login-character-shade {
  height: 100%;
  width: auto;
  z-index: 51;
  opacity: 1;
  transition: opacity 1s ease-in-out;
}

#loginBubbleCharacter {
  z-index: 52;
  opacity: 1;
  transition: opacity 1s ease-in-out;
}

#loginMain.unfocused .login-character-shade,
#loginMain.unfocused #loginBubbleCharacter {
  opacity: 0;
}


.grid {
  width: 86%;
  display: grid;
  grid-template-columns: 1fr;
  justify-content: center;
  gap: 1.5rem;
  padding: 1.5rem 7% 1rem 7%;
}

.lesson-container {
  width: 100%;
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
  padding: 0;
  opacity: 0;
}

.lessons-category.active .lesson-container {
  padding: 1.5rem 0 1rem 0;
  opacity: 1;
}
.lessons-category {
  display: flex;
  flex-direction: column;
  border-radius: 0.5rem;
  margin: 0.5rem 0;
  overflow: hidden;
  padding: 0 7%;
}
.lessons-category:last-child {
  margin-bottom: 2rem;
}

.lessons-header {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: var(--bg-card);
  border: 2px solid var(--border);
  padding: 0.75rem 1rem;
  font-weight: bold;
  border-radius: 0.5rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.2s ease;
}

.lessons-header:hover {
  background: var(--bg-card);
}

.lessons-category.active .lessons-header {
  background: var(--theme);
}

.lesson-card, .tip-card {
  position: relative;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border-radius: 1rem;
  border: 2px solid var(--border);
  box-shadow: 0 3px 5px var(--theme-shadow);
}

.lesson-card {
  aspect-ratio: 8 / 5;
  padding: 0.5rem;
  user-select: none;
}

.lesson-card.locked, .tip-card.locked {
  box-shadow: none;
}
.lesson-card.locked .card-title-section,
.lesson-card.locked img,
.tip-card.locked img {
  opacity: 0.8;
}
.lesson-card.locked::after,
.tip-card.locked::after {
  content: "";
  position: absolute;
  inset: -2px;
  border: 2px solid var(--border);
  filter: grayscale(0.75);
  pointer-events: none;
  border-radius: 1rem;
}

.tip-card {
  padding: 1rem;
}

.tip-card p {
  text-align: left;
}

.lesson-card.locked img {
  filter: grayscale(0.75);
}

.tip-card.locked img {
  width: 5rem;
  object-fit: contain;
  filter: grayscale(0.5);
}
.lesson-card img, .tip-card img {
  min-height: 5.5rem;
  display: block;
}

.lesson-card img {
  flex: 1;
  margin-top: 0.75rem;
}

.tip-card img {
  max-width: 10rem;
  width: 100%;
}

.lesson-card .card-title-section {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin: 0 0 0.2rem 0;
}

.lesson-card p {
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin: 0;
}

.lesson-card button {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 0.25rem;
  padding: 0.25rem 0.75rem;
  margin-bottom: 0.75rem;
}

.lesson-card.completed {
  box-shadow: 0 3px 5px var(--positive-shadow);
  border: 2px solid var(--positive-border);
}

.lesson-card.completed button {
  background-color: var(--positive-bg-btn);
  border: 2px solid var(--positive-border);
  box-shadow: 0 2px 6px var(--positive-shadow);
}

.lesson-card h3, .tip-card h3 {
  margin: 0;
  text-align: center;
}

.lesson-card h3,
.lesson-card p,
.tip-card h3,
.lesson-card button {
  flex-shrink: 0;
}

#coverImage {
  display: none;
}

main.loading #lottieContainer {
  opacity: 0;
}

.loader {
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
}
main.loading .loader {
  width: calc(6*30px);
  height: 50px;
  display: flex;
  color: #a9d17d;
  filter: drop-shadow(30px 25px 0 currentColor) drop-shadow(60px 0 0 currentColor) drop-shadow(120px 0 0 currentColor);
  clip-path: inset(0 100% 0 0);
  animation: l13 2s infinite steps(7);
}
main.loading .loader:before {
  content: "";
  width: 30px;
  height: 25px;
  background: 
    radial-gradient(farthest-side at right,currentColor 92%,#0000) left/20px 100% no-repeat,
    radial-gradient(farthest-side,         currentColor 92%,#0000) right/17px 9px repeat-y;
}
@keyframes l13 {
  100% {clip-path: inset(0 -30px 0 0)}
}

main.loading #stepBar {
  opacity: 0;
}

#lessonMain {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1.5rem;
  overflow: hidden;
  max-height: 100vh;
  height: 100vh;
}

.lottie-wrapper {
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  aspect-ratio: 1 / 1;
  margin: 0 0.5rem;
  min-height: 0;
  background-color: var(--bg-secondary);
}

main.loading .lottie-wrapper {
  flex: 1;
  max-height: min(500px, calc(100vw - 1rem));
  max-width: min(500px, calc(100% - 1rem));
}

#lottieContainer {
  width: 100%;
  height: 100%;
  background-color: var(--bg-secondary);
  z-index: 1;
  transition: opacity 0.6s cubic-bezier(0.40,0.00,0.20,1.00);
}

#stepBar {
  height: 4px;
  z-index: 51;
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  opacity: 1;
  background-color: var(--dark-font-primary);
  transition: opacity 0.3s ease;
}

#stepBar > span {
  display: block;
  height: 100%;
  width: 0%;
  background-color: var(--font-secondary);
  transition: width 0.6s cubic-bezier(0.00,0.00,0.20,1.00);
}

.title-section {
  width: 100%;
  max-width: 20rem;
  padding: 0 0.5rem;
  box-sizing: border-box;
}

.title-container h2 {
  margin: 0;
  font-size: 1.2rem;
}
.title-container p {
  margin: 0;
  text-align: left;
}

#btnLoop {
  cursor: pointer;
}

#crawlBody,
#crawlPaws,
#crawlPawsEnd {
  position: absolute;
  width: 24%;
  height: 24%;
  top: 0;
  left: 50%;
  translate: -50% -86.8%;
}
#crawlPaws, #crawlPawsEnd {
  filter: drop-shadow(0px 2px 1px rgba(0,0,0,0.4));
}
#crawlBody {
  z-index: 0;
  transition: translate 0.8s ease;
}
#crawlBody.stopanim {
  translate: -50% 0%;
}
#crawlPaws.stopanim {
  display: none;
}
#crawlPawsEnd {
  opacity: 0;
  translate: -50% -86.8%;
  transition: translate 0.5s 0.2s ease;
}
#crawlPawsEnd.stopanim {
  opacity: 1;
  translate: -50% 0%;
}

#patContainer {
  width: 30rem;
  height: 30rem;
}

#hiContainer {
  width: 10rem;
  height: 10rem;
  filter: drop-shadow(1px 1px 3px rgba(0,0,0,0.4));
}

#ropeDropContainer {
  width: 15rem;
  height: 15rem;
  filter: drop-shadow(2px 2px 2px rgba(0,0,0,0.2));
}

#kartContainer {
  width: min(25rem, 100vw);
  height: min(25rem, 100vw);
  filter: drop-shadow(0px 0px 32px rgba(0,0,0,0.2));
}

#floatingGhostContainer {
  width: 5rem;
  aspect-ratio: 98 / 125;
  transition: left 6s linear;
  animation: blinkingOpacity 1.5s linear infinite;
}

#floatingGhostContainer > div {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
}

@keyframes blinkingOpacity {
  0% {
    filter: opacity(0.5);
  }
  25% {
    filter: opacity(0.1);
  }
  50% {
    filter: opacity(0.5);
  }
  75% {
    filter: opacity(0.3);
  }
  100% {
    filter: opacity(0.5);
  }
}

#floatingGhostContainer.stopanim {
  animation: none;
}

#floatingGhostContainer.stopanim.left-to-right {
  left: -5rem;
  transition: left 0s;
}
#floatingGhostContainer.stopanim.right-to-left {
  left: 100%;
  transition: left 0s;
}

#floatingGhostContainer.left-to-right {
  left: 100%;
  scale: 1 1;
}

#floatingGhostContainer.right-to-left {
  left: -5rem;
  scale: -1 1;
}

#floatingGhostContainer > div.stopanim {
  display: none;
}

.character-animation {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 100;
  pointer-events: none;
}

.animation-disabled {
  opacity: 0!important;
}

.instruction-card-wrapper {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

.instruction-card {
  max-width: min(80%, 30rem);
  background: var(--bg-card);
  border-radius: 1rem;
  border: 2px solid var(--border);
  box-shadow: 0 3px 5px var(--theme-shadow);
  padding: 0.5rem 0.75rem;
  margin-top: 1.5rem;
  font-weight: 500;
  text-wrap: balance;
  user-select: none;
  transition: transform 0.15s;
}

.instruction-card.bounce {
  animation: boing 300ms cubic-bezier(.34,1.56,.64,1);
}

@keyframes boing {
  0%   { transform: scale(1); }
  35%  { transform: scale(0.85); }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1); }
}

.controls {
  position: relative;
  width: 100%;

  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;

  margin: 0.5rem auto 1.5rem auto;
  box-sizing: border-box;
}

.center-controls {
  display: flex;
  flex-direction: row;
  justify-content: center;
  align-items: center;
  gap: 1rem;
}

.controls button {
  width: 3.25rem;
  height: 3.25rem;
  background-color: var(--dark-bg-secondary);
  color: var(--dark-font-primary);
  border: none;
  box-shadow: none;
  display: flex;
  justify-content: center;
  align-items: center;
}

.controls button:hover {
  transform: none;
}

.controls button svg {
  fill: var(--dark-font-primary);
}

.controls button.disabled {
  filter: opacity(0.6);
}

#btnPlayPause {
  width: 4rem;
  height: 4rem;
}

#btnPlayPause svg {
  height: 1.5rem;
}

button.cta-active {
  animation: 1s ctaButton infinite ;
}

@keyframes ctaButton {
  0%, 100% {
    background-color: var(--dark-bg-secondary);
    scale: 1;
  }
  50% {
    background-color: var(--dark-positive-theme);
    scale: 1.05;
  }
}

#nextStep.finish {
  background-color: var(--dark-positive-theme);
  filter: saturate(1.25);
}

#prevStep svg,
#nextStep svg {
  height: 1.1rem;
}

#loopBtnContainer,
#closeLessonContainer {
  display: flex;
  justify-content: center;
  align-items: center;
  flex: 1;
}

#btnLoop,
#closeLessonBtn {
  width: 2.5rem;
  height: 2.5rem;
}

#btnLoop svg {
  width: 1rem;
}

#closeLessonBtn svg {
  width: 0.9rem;
}

#btnLoop {
  background-color: var(--dark-positive-theme);
}

#btnLoop.disabled {
  background-color: var(--dark-negative-theme);
  filter: none;
}

#tipSection {
  background-color: var(--bg-primary);
  position: absolute;
  top: 50%;
  left: 50%;
  translate: -50% -50%;
  width: calc(100% - 2rem);
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 0 1rem;
  opacity: 0;
  z-index: 52;
  animation: fadeIn 0.6s forwards ease;
}

@keyframes fadeIn {
  0% { opacity: 0; }
  100% { opacity: 1; }
}

#tipSection h2 {
  font-size: 1.5rem;
}

#tipTitle {
  width: min(100%, 30rem);
  margin: 0;
}

#tipDesc {
  width: min(100%, 30rem);
  text-align: left;
}

#tipSection a {
  text-decoration: underline;
}

#tipSection img {
  width: min(60%, 15rem);
}

.hidden {
  display: none!important;
}

@media screen and (min-width: 400px) {
  .lessons-category .progress-bar {
    width: 50%;
  }
  
  .controls {
    width: 25rem;
  }
}

@media screen and (min-width: 600px) {
  #logoTitle {
    display: flex;
  }
  #profile {
    flex-direction: row-reverse;
    gap: 0;
  }
  .profile-stack {
    flex-direction: row;
  }
  #profile,
  .profile-stack {
    justify-content: flex-start;
    align-items: center;
  }
  #profilePic {
    width: 3.5rem;
    height: 3.5rem;
    margin-right: 0.5rem;
  }
  #profilePic img {
    width: 3.5rem;
    height: 3.5rem;
  }
  #avatarPicker {
    right: 0.5rem;
    left: auto;
    grid-template-columns: repeat(4, 1fr);
  }

  #logoTitle img {
    width: 2.5rem;
    object-fit: contain;
  }

  main > h1 {
    font-size: 2.5rem;
    margin-left: 7%;
    width: fit-content;
  }

  .lessons-header {
    flex-direction: row;
  }

  .lessons-category .progress-bar {
    width: 10rem;
  }

  .progress-bar .progress-text {
    left: auto;
    right: 0.5rem;
  }

  .grid {
    grid-template-columns: repeat(auto-fit, 19rem);
  }

  .lesson-card, .tip-card {
    width: 19rem;
  }
}

@media screen and (min-width: 768px) {
  :root {
      font-size: 20px;
  }

  #loginMain {
    display: grid;
    grid-template-columns: 1fr 1fr;
    justify-content: start;
    max-width: 60rem;
    margin: 0 auto;
  }

  .login-lottie-wrapper {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 100%;
    height: 15rem;
  }

  #loginMain > section {
    grid-column: 2;
  }

  .lessons-header:hover {
  background: var(--theme);
  }

  #profile #usernameDisplay:hover {
    background: var(--theme-secondary);
  }
}