* { box-sizing: border-box; }

:root{
  --text-cols: 1;
  --card-height: 56px;
}

body{
  font-family: system-ui, sans-serif;
  background:#77a9e9;
  margin:0;
  padding:16px;
  text-align:center;
}

h1{
  margin:0 0 6px;
  font-size: clamp(1.4rem, 3vw, 2rem);
}

p{ margin:0 0 10px; }

#dataset-selector{
  margin: 0 0 12px;
  padding: 6px 10px;
  font-size: 1rem;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,.15);
}

#scoreboard{
  display:flex;
  gap: 16px;
  justify-content:center;
  align-items:center;
  font-size: clamp(1rem, 2vw, 1.2rem);
  margin-bottom: 12px;
}

#game{
  display:grid;
  grid-template-columns: 0.7fr 2.3fr;
  gap: 4vw;
  max-width: 1600px;
  margin: 0 auto;
  height: calc(100vh - 220px);
}

.column{
  display:grid;
  gap: 10px;
  padding: 8px;
  background: rgba(255,255,255,.15);
  border-radius: 12px;
  overflow-y: auto;
  align-content: start;
  touch-action: none;
}

.text-column{
  grid-template-columns: repeat(var(--text-cols, 1), 1fr);
  grid-auto-rows: minmax(32px, min(var(--card-height), 56px));
  justify-items: stretch;
}

.text-card{
  display:flex;
  align-items:center;
  justify-content:center;
  text-align:center;

  background:white;
  border:2px solid #ddd;
  border-radius:10px;
  padding: 6px 8px;
  font-size: clamp(.8rem, .95vw, 1rem);
  white-space: nowrap;

  transition: background-color .2s, border-color .2s, transform .1s, opacity .2s;
}

.text-card.drag-over{
  background: #eaf2ff;
  border-color: #007bff;
  outline: 3px dashed #007bff;
  transform: scale(1.02);
}

.text-card.locked{
  opacity: .45;
  filter: grayscale(100%);
  pointer-events: none;
}

.image-column{
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  align-content: start;
  justify-items: stretch;
}

.image-card{
  width: 100%;
  aspect-ratio: 1 / 1;
  min-width: 150px;
  min-height: 150px;

  object-fit: contain;
  background:white;
  border:2px solid #ddd;
  border-radius: 14px;
  padding: 10px;

  cursor: grab;
  transition: transform .15s ease, box-shadow .15s ease, opacity .2s;
}

.image-card:active,
.image-card.dragging{
  cursor: grabbing;
  transform: scale(1.06);
  box-shadow: 0 12px 28px rgba(0,0,0,.3);
}

.image-card.locked{
  opacity: 0.35;
  filter: grayscale(100%);
  cursor: default;
  transform: none !important;
  box-shadow: none !important;
  pointer-events: none;
}

#feedback{
  margin-top: 12px;
  min-height: 30px;
  font-weight: 700;
}

.success{ color:#1b7e2a; }
.error{ color:#b30000; }

.confetti{
  position: fixed;
  pointer-events: none;
  z-index: 3000;
}

@keyframes trailFloat{
  0% { transform: translate(0, 0) rotate(0deg); opacity: 1; }
  100%{ transform: translate(0px, 25px) rotate(360deg); opacity: .6; }
}

@media (max-width: 768px){
  #game{
    grid-template-columns: 1fr;
    height: auto;
  }
}
