@font-face {
  font-family: "QuicksandCustom";
  src: url("Quicksand-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-style: normal;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  min-height: 100vh;
  overflow: hidden;
  position: relative;
  font-family: "QuicksandCustom", "Quicksand", sans-serif;
  background: #dfead3;
}

#bgVideo {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  z-index: -1;
  opacity: 0.5;
}

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 20px;
  position: relative;
  z-index: 1;
}

.screen {
  width: 100%;
}

.page-transition {
  position: fixed;
  inset: 0;
  background: linear-gradient(180deg, rgba(255, 250, 226, 0), rgba(255, 250, 226, 0.92), rgba(255, 250, 226, 0));
  opacity: 0;
  pointer-events: none;
  z-index: 1500;
  transition: opacity 0.38s ease;
}

.page-transition.active {
  opacity: 1;
}

.screen-wrapper {
  display: flex;
  justify-content: center;
  align-items: center;
}

.home-card {
  width: 440px;
  max-width: 95%;
  background: #ffffff;
  border: 2px solid #b8cfff;
  border-radius: 28px;
  padding: 40px 30px;
  text-align: center;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

.logo-box {
  display: inline-block;
  background: #fffdf7;
  padding: 14px 22px;
  border-radius: 18px;
  box-shadow: 0 6px 16px rgba(255, 210, 60, 0.18);
  margin-bottom: 24px;
}

.logo-img {
  width: 170px;
  max-width: 100%;
  height: auto;
  display: block;
}

.game-title,
.title {
  font-family: "Quicksand", sans-serif !important;
  font-weight: 700;
  color: #524fd6;
  text-align: center;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 6px rgba(255, 255, 255, 0.6);
}

.game-title {
  font-size: 56px;
  margin-top: 10px;
  margin-bottom: 10px;
}

.home-title {
  font-size: 24px;
  font-weight: 600;
  line-height: 1.45;
  color: #7082a8;
  margin-bottom: 48px;
}

.play-btn {
  background: linear-gradient(to bottom, #ffe46b, #ffd43b);
  color: #3f60da;
  border: 2px solid #efb400;
  padding: 14px 38px;
  border-radius: 999px;
  font-size: 22px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 6px 14px rgba(255, 204, 0, 0.35);
  transition: all 0.2s ease;
}

.play-btn:hover {
  transform: scale(1.05);
}

.play-btn:active {
  transform: translateY(2px);
}

.game-screen {
  display: flex;
  justify-content: center;
}

.game-wrapper {
  width: min(1200px, 100%);
  background: rgba(255, 255, 255, 0.95);
  border: 2px solid #e3e3e3;
  border-radius: 28px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.12);
  padding: 28px 32px 32px;
}

.title {
  margin-bottom: 24px;
  font-size: clamp(2rem, 4vw, 3.5rem);
}

.game-container {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.right-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.drop-box {
  min-height: 190px;
  padding: 14px;
  border-radius: 22px;
  border: 4px solid;
  background: rgba(255, 255, 255, 0.35);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 70px;
  gap: 14px;
  justify-items: center;
  align-content: center;
}

.drop-box.red {
  border-color: #ef4444;
}

.drop-box.blue {
  border-color: #2563eb;
}

.drop-box.green {
  border-color: #16a34a;
}

.drop-box.yellow {
  border-color: #eab308;
}

.left-panel {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  gap: 12px;
}

.item-card {
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.92);
  border: 2px solid #b9b9b9;
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: grab;
  user-select: none;
  transition: transform 0.2s ease;
}

.item-card:hover {
  transform: scale(1.05);
}

.item-card img {
  width: 70%;
  height: 70%;
  object-fit: contain;
  pointer-events: none;
}

.zoom-image {
  transform: scale(1.12);
}

.drop-box .item-card,
.inside-box {
  width: 70px;
  height: 70px;
  aspect-ratio: auto;
  transform: none !important;
  cursor: default;
}

.dragging {
  opacity: 0.6;
}

.shake {
  animation: shake 0.4s;
}

@keyframes shake {
  0% { transform: translateX(0); }
  25% { transform: translateX(-6px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-6px); }
  100% { transform: translateX(0); }
}

.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 999;
  opacity: 0;
  transition: opacity 0.28s ease;
}

.celebration {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.popup {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(420px, calc(100% - 32px));
  background: #f5f5f5;
  border: 4px solid #f5c542;
  border-radius: 28px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  padding: 36px 28px;
  text-align: center;
  z-index: 1000;
  opacity: 0;
  transform: translate(-50%, -46%) scale(0.94);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.overlay-visible {
  opacity: 1;
}

.popup-visible {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

.popup h2 {
  margin-bottom: 10px;
  font-size: 2rem;
  color: #4a63d8;
}

.popup p {
  margin-bottom: 20px;
  font-size: 1.05rem;
  color: #666;
}

.stars {
  margin-bottom: 24px;
  font-size: 1.75rem;
}

.popup-buttons {
  display: flex;
  justify-content: center;
  gap: 14px;
}

.popup-buttons button {
  border: none;
  border-radius: 999px;
  background: linear-gradient(180deg, #ffd84d, #f7b500);
  color: #2d3a8c;
  padding: 12px 20px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 6px 0 #e0a800;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.popup-buttons button:hover {
  transform: scale(1.05);
  box-shadow: 0 8px 0 #e0a800;
}

.popup-buttons button:active {
  transform: translateY(3px);
  box-shadow: 0 3px 0 #e0a800;
}

.fullscreen-btn {
  position: fixed;
  top: 18px;
  right: 20px;
  width: 52px;
  height: 52px;
  border: none;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.92);
  color: #2f3f4f;
  font-size: 34px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 2000;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.18);
  transition: all 0.25s ease;
}

.fullscreen-btn:hover {
  transform: scale(1.08);
  background: #ffffff;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.22);
}

.fullscreen-btn:active {
  transform: scale(0.94);
}

.hidden {
  display: none !important;
}

.screen-content-enter {
  animation: screenContentEnter 0.45s ease both;
}

@keyframes screenContentEnter {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@media (max-width: 1024px) {
  .game-wrapper {
    padding: 24px;
  }

  .right-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .left-panel {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 600px) {
  .app-shell {
    padding: 12px;
    align-items: flex-start;
  }

  .home-card {
    width: 92%;
    padding: 28px 20px 32px;
  }

  .logo-img {
    width: 145px;
  }

  .game-title {
    font-size: 40px;
  }

  .home-title {
    font-size: 18px;
    margin-bottom: 36px;
  }

  .play-btn {
    font-size: 18px;
    padding: 12px 28px;
  }

  .game-wrapper {
    padding: 18px 12px;
    border-radius: 20px;
  }

  .game-container {
    gap: 16px;
  }

  .right-panel {
    gap: 10px;
  }

  .drop-box {
    min-height: 130px;
    padding: 8px;
    gap: 8px;
    grid-auto-rows: 46px;
  }

  .drop-box .item-card,
  .inside-box {
    width: 46px;
    height: 46px;
    border-radius: 12px;
  }

  .left-panel {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
  }

  .item-card {
    border-radius: 14px;
  }

  .popup {
    padding: 24px 18px;
    border-radius: 22px;
  }

  .popup-buttons {
    flex-direction: column;
  }

  .popup-buttons button {
    width: 100%;
  }

  .fullscreen-btn {
    top: 10px;
    right: 10px;
    width: 42px;
    height: 42px;
    font-size: 28px;
    border-radius: 12px;
  }
}
