:root {
  --sky-top: #dff7ff;
  --sky-bottom: #c8f0ff;
  --grass: #70d59a;
  --basket-1: #ffb74d;
  --basket-2: #ff9f43;
  --basket-3: #ff7f50;
  --basket-4: #ff5d73;
  --panel: rgba(255, 255, 255, 0.7);
  --panel-strong: rgba(255, 255, 255, 0.9);
  --ink: #214c6d;
  --accent: #4ea3ff;
  --success: #2ec27e;
  --danger: #ff5f5f;
  --shadow: rgba(26, 69, 88, 0.16);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
  font-family: 'Fredoka', sans-serif;
  background: linear-gradient(180deg, var(--sky-top) 0%, var(--sky-bottom) 100%);
  color: var(--ink);
}

body {
  min-height: 100vh;
}

button {
  font: inherit;
}

.page-shell {
  position: relative;
  min-height: 100vh;
  padding: 18px 20px 40px;
}

.topbar {
  max-width: 1100px;
  margin: 0 auto 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.title-block {
  flex: 1;
  text-align: center;
}

.eyebrow {
  display: none;
}

h1 {
  margin: 0;
  font-size: clamp(1.8rem, 2.5vw, 2.8rem);
}

.back-button,
.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.8);
  box-shadow: 0 6px 18px var(--shadow);
}

.back-button {
  width: 54px;
  height: 54px;
  padding: 0;
  text-decoration: none;
  color: var(--ink);
  font-size: 1.5rem;
  font-weight: 600;
}

.status-pill {
  min-width: 60px;
  padding: 0 14px;
  font-size: 0.95rem;
  font-weight: 700;
}

.selection-screen {
  display: none;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 120px);
}

.selection-screen.active {
  display: flex;
}

.selection-card {
  width: min(760px, 92vw);
  padding: 32px 24px 26px;
  border-radius: 28px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: 0 18px 42px rgba(23, 64, 92, 0.12);
  border: 3px solid rgba(255, 255, 255, 0.7);
  text-align: center;
}

.selection-kicker,
.selection-copy {
  display: none;
}

.selection-badge {
  font-size: 3.4rem;
  line-height: 1;
  margin-bottom: 8px;
}

.selection-card h2 {
  margin: 0 0 18px;
  font-size: clamp(2.4rem, 4vw, 3rem);
  line-height: 1;
}

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 18px;
}

.level-button {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  justify-content: center;
  min-height: 170px;
  border: none;
  border-radius: 24px;
  color: var(--ink);
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(92, 104, 33, 0.12);
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.level-button.easy {
  background: linear-gradient(180deg, #e5f9d6, #c8f0a4);
}

.level-button.medium {
  background: linear-gradient(180deg, #fff4c4, #ffd882);
}

.level-button.hard {
  background: linear-gradient(180deg, #ffe3d7, #ffb896);
}

.level-button:hover,
.level-button:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 18px 30px rgba(92, 104, 33, 0.18);
}

.level-basket-row {
  font-size: 2.1rem;
  letter-spacing: 0.15em;
  line-height: 1;
  margin-bottom: 2px;
}

.level-name {
  font-size: clamp(1.4rem, 2vw, 1.8rem);
}

.level-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 92px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  padding: 5px 10px;
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.level-detail {
  font-size: 0.95rem;
  opacity: 0.8;
}

.game-screen {
  display: none;
  max-width: 1100px;
  margin: 0 auto;
  padding-top: 6px;
}

.game-screen.active {
  display: block;
}

.board-panel {
  background: rgba(255, 255, 255, 0.38);
  border: 3px solid rgba(255, 255, 255, 0.8);
  border-radius: 28px;
  padding: 18px 20px 12px;
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.05);
}

.object-area-label {
  display: none;
}

.object-area {
  min-height: 170px;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.25), rgba(255,255,255,0.12));
  border: 2px dashed rgba(97, 149, 183, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px;
}

.basket-panel {
  margin-top: 20px;
}

.basket-area {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  padding: 12px 10px 6px;
}

.basket {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  min-width: 120px;
  width: var(--basket-width, 170px);
  height: 200px;
  padding: 10px 8px 12px;
  transform: translateY(6px);
}

.basket::before {
  content: "";
  position: absolute;
  inset: 28px 6px 0;
  border-radius: 26px 26px 30px 30px;
  background: linear-gradient(180deg, var(--basket-color, #ffb74d), rgba(255,255,255,0.2));
  box-shadow: inset 0 -18px 0 rgba(255,255,255,0.12);
  border: 4px solid rgba(255,255,255,0.7);
}

.basket-emoji {
  position: relative;
  z-index: 1;
  font-size: 3rem;
  line-height: 1;
  margin-bottom: 4px;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.08));
}

.basket-dropzone {
  position: relative;
  z-index: 1;
  width: calc(100% - 20px);
  height: 128px;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 6px;
  padding: 0 12px 12px;
}

.size-object {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  border: none;
  border-radius: 50%;
  background: transparent;
  box-shadow: none;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  font-size: 2.8rem;
  filter: drop-shadow(0 8px 16px rgba(49, 91, 124, 0.18));
}

.size-object:active {
  cursor: grabbing;
}

.size-object:hover {
  transform: translateY(-2px) scale(1.02);
}

.size-object.correct {
  transform: scale(1.05);
  filter: drop-shadow(0 0 0 rgba(0,0,0,0));
}

.size-object.correct {
  transform: scale(1.04);
  box-shadow: 0 0 0 4px rgba(46, 194, 126, 0.2), 0 14px 24px rgba(46, 194, 126, 0.22);
}

.size-object.shake {
  animation: shake 0.38s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-8px); }
  40% { transform: translateX(8px); }
  60% { transform: translateX(-6px); }
  80% { transform: translateX(6px); }
}

.celebration {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(17, 38, 53, 0.46);
  z-index: 20;
}

.celebration.visible {
  display: flex;
}

.celebration-card {
  width: min(560px, 86vw);
  padding: 38px 30px 28px;
  border-radius: 32px;
  background: linear-gradient(180deg, rgba(255,255,255,0.92), rgba(255,255,255,0.8));
  text-align: center;
  box-shadow: 0 18px 40px rgba(0,0,0,0.18);
}

.celebration-icon {
  font-size: clamp(2.8rem, 6vw, 4rem);
  margin-bottom: 10px;
  animation: bounce 0.85s ease-in-out infinite alternate;
}

@keyframes bounce {
  0% { transform: translateY(0); }
  100% { transform: translateY(-8px); }
}

.celebration-card h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 2.8rem);
}

.celebration-card p {
  display: none;
}

.celebration-buttons {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.primary-button,
.secondary-button {
  border: none;
  border-radius: 28px;
  width: 90px;
  height: 90px;
  padding: 0;
  cursor: pointer;
  font-size: 2.2rem;
  font-weight: 700;
  transition: transform 0.15s ease;
}

.primary-button:hover,
.secondary-button:hover {
  transform: translateY(-2px);
}

.primary-button {
  background: linear-gradient(180deg, #6ad77d, #2ec27e);
  color: white;
}

.large-button {
  min-width: 90px;
  padding: 0;
  font-size: 2.2rem;
}

.secondary-button {
  background: linear-gradient(180deg, #8addff, #49a7f4);
  color: white;
}

#confetti-canvas {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 15;
  display: none;
}

#confetti-canvas.visible {
  display: block;
}

.hidden {
  display: none !important;
}

@media (max-width: 760px) {
  .topbar {
    flex-wrap: wrap;
  }

  .level-grid {
    grid-template-columns: 1fr;
  }

  .basket-area {
    gap: 10px;
  }

  .basket {
    flex: 0 0 auto;
    min-width: 90px;
    width: var(--basket-width, 170px);
  }
}
