@font-face {
  font-family: 'Chewy';
  src: url('assets/ui/chewy.ttf');
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: 'Chewy', cursive;
  background: #FFF4DD;
  height: 100dvh;
  width: 100vw;
  overflow: hidden;
  color: #3D2425;
}

.cursor {
  --cursor-size: 93px;
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: var(--cursor-size);
  height: var(--cursor-size);
  background-image: url('assets/ui/cursor.png');
  background-size: contain;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 9999;
  transition: transform 0.2s cubic-bezier(.28, .84, .42, 1);
  transform-origin: 15% 10%;
}

.cursor.clicked {
  transform: scale(0.8);
}

@media (pointer: fine) {
  body, button, a {
    cursor: none;
  }
  .cursor {
    display: block;
  }
}

.container {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.header {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1vh;
  height: 12vh;
  position: relative;
}

.title {
  height: 100%;
  object-fit: contain;
  animation: stretchy 3s ease-in-out infinite;
}

@keyframes stretchy {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05, 0.95); }
}

.fullscreen-btn,
.download-btn,
.music-btn {
  position: absolute;
  top: 1vh;
  height: 25%;
  object-fit: contain;
}

.fullscreen-btn { left: 1vh; }
.download-btn { left: 6vh; }
.music-btn { right: 1vh; }

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 1vh;
  gap: 2vh;
}

.character-preview {
  flex: 2;
  display: flex;
  justify-content: center;
  align-items: center;
}

.puppet {
  position: relative;
  width: 50vmin;
  height: 50vmin;
  max-width: 400px;
  max-height: 400px;
}

.puppet img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: auto;
  object-fit: contain;
}

.controls {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.tabs {
  display: flex;
  justify-content: center;
  gap: 1vw;
  margin-bottom: 2vh;
}

.tab {
  position: relative;
  width: 12vmin;
  height: 12vmin;
  min-width: 60px;
  min-height: 60px;
  background: url('assets/ui/tabs/button.png') center/contain no-repeat;
  border: none;
  transition: transform 0.1s;
}

.tab.active { transform: scale(1.1); }

.tab img {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.tab .color-circle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 40%;
  height: 40%;
  border-radius: 50%;
  border: max(3px, 0.4vw) solid #3D2425;
}

.accessories {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.accessory-grid {
  display: flex;
  justify-content: center;
  gap: 2vw;
  margin-bottom: 2vh;
  min-height: 120px;
}

.accessory-btn {
  position: relative;
  width: 15vmin;
  height: 15vmin;
  min-width: 80px;
  min-height: 80px;
  background: url('assets/ui/accessory_button.png') center/contain no-repeat;
  border: none;
  transition: transform 0.1s;
}

.accessory-btn.selected {
  transform: scale(1.1);
  filter: brightness(1.2);
}

.accessory-btn img {
  position: absolute;
  top: 60%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 95%;
  height: 95%;
  object-fit: contain;
}

.accessory-btn .color-preview {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 60%;
  height: 60%;
  border-radius: 50%;
  border: max(3px, 0.4vw) solid #3D2425;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 2vw;
  margin-bottom: 3vh;
}

.arrow {
  width: 10vmin;
  height: 10vmin;
  min-width: 50px;
  min-height: 50px;
  background: url('assets/ui/arrow.png') center/contain no-repeat;
  border: none;
  transition: transform 0.1s;
}

.arrow.left { transform: scaleX(-1); }

.arrow.left.bounce {
  animation: bounceLeft 0.3s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes bounceLeft {
  0% { transform: scaleX(-1) scale(1); }
  50% { transform: scaleX(-1) scale(0.9); }
  100% { transform: scaleX(-1) scale(1); }
}

.arrow:disabled {
  opacity: 0.5;
}

.page-counter {
  font-size: clamp(22px, 5vw, 32px);
  font-weight: bold;
}

.bounce {
  animation: bounce 0.3s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes bounce {
  0% { transform: scale(1); }
  50% { transform: scale(0.9); }
  100% { transform: scale(1); }
}

@media (max-width: 768px) {
  .puppet { width: 60vmin; height: 60vmin; }
  .tab { width: 18vmin; height: 18vmin; }
  .accessory-btn { width: 22vmin; height: 22vmin; }
  .arrow { width: 14vmin; height: 14vmin; }
  
  .tab .color-circle {
    border: 4px solid #3D2425;
  }
  
  .accessory-btn .color-preview {
    border: 4px solid #3D2425;
  }
}