html, body {
  overflow-x: hidden;
  overscroll-behavior: none;
}

.prompt {
  text-align: center;
  font-size: 20px;
  font-weight: bold;
  color: #555;
  padding: 8px 14px 6px;
}

/* ── Source area: 2x2 grid of fixed slots ── */
.source-area {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  padding: 8px 14px;
  max-width: 420px;
  margin: 0 auto;
}

.source-slot {
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: rgba(0,0,0,0.03);
  border: 2px dashed #d8d8d8;
  transition: border-color 0.15s, background 0.15s;
}

.source-slot.highlight {
  border-color: var(--color-primary);
  background: #fff0f5;
}

.source-slot .card {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
}

.card {
  background: var(--color-card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  aspect-ratio: 1 / 1;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 4px 6px;
  cursor: grab;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  transition: transform 0.15s, box-shadow 0.15s;
  position: relative;
}

.card-hint {
  min-height: 20px;
  font-size: 15px;
  font-weight: bold;
  color: var(--color-primary);
  text-align: center;
  line-height: 1.1;
  word-break: break-all;
  flex-shrink: 0;
  pointer-events: none;
  padding: 0 2px;
}

.card-hint.correct {
  color: var(--color-correct);
  font-size: 14px;
}

.card img {
  flex: 1;
  min-height: 0;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  pointer-events: none;
  -webkit-user-drag: none;
}

.card .fallback {
  font-size: 20px;
  color: #999;
  text-align: center;
}

.card.dragging {
  cursor: grabbing;
  box-shadow: 0 10px 28px rgba(0,0,0,0.25);
  transform: scale(1.08);
  z-index: 1000;
  transition: none;
}

.card.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  15%      { transform: translateX(-10px); }
  30%      { transform: translateX(10px); }
  45%      { transform: translateX(-8px); }
  60%      { transform: translateX(8px); }
  80%      { transform: translateX(-4px); }
}

/* ── Arrow hint between source and slots ── */
.arrow-hint {
  text-align: center;
  font-size: 14px;
  color: #aaa;
  font-weight: bold;
  margin: 4px 0;
}

/* ── Slots area: horizontal 4 slots ── */
.slots-area {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  padding: 8px 8px 20px;
  max-width: 460px;
  margin: 0 auto;
}

.slot-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 0;
}

.slot {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 3px dashed #c8c8c8;
  border-radius: 12px;
  background: #fafafa;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
  color: #bbb;
  font-size: 24px;
  font-weight: bold;
  transition: border-color 0.15s, background 0.15s;
}

.slot.highlight {
  border-color: var(--color-primary);
  background: #fff0f5;
}

.slot .card {
  width: 100%;
  height: 100%;
  aspect-ratio: auto;
  border-radius: 10px;
  padding: 4px;
}

.slot-num {
  color: #ccc;
  font-size: 26px;
  font-weight: bold;
}

.chain-arrow {
  font-size: 22px;
  color: #bbb;
  font-weight: bold;
  padding-bottom: 24px;
}

/* ── Feedback ── */
.feedback {
  position: fixed;
  top: 40%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 120px;
  font-weight: bold;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s;
  z-index: 200;
}

.feedback.show { opacity: 1; }
.feedback.correct { color: var(--color-correct); }
.feedback.wrong   { color: var(--color-wrong); }

/* ── Result ── */
.result {
  text-align: center;
  padding: 40px 20px;
}

.result h2 {
  font-size: 36px;
  color: var(--color-primary);
}

.result .score {
  font-size: 24px;
  margin: 20px 0;
}

.result .candy-get {
  font-size: 56px;
  margin: 20px 0;
  word-break: break-all;
}

.result button {
  margin: 10px 8px;
  font-size: 18px;
}
