:root {
  --bg: #f6f1e8;
  --card: #ffffff;
  --text: #2f2a24;
  --muted: #7b7065;
  --success: #3b8f5c;
  --error: #c94f4f;
  --accent: #6d8cff;
  --shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

* {
  box-sizing: border-box;
}

html {
  user-select: none;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

button,
img,
svg {
  -webkit-user-drag: none;
}

.app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px 48px;
}

.title-screen {
  text-align: center;
  min-height: calc(100vh - 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 18px;
}

.title-screen h1 {
  margin: 0 0 8px;
  font-size: clamp(2rem, 4vw, 3.2rem);
}

.title-screen p {
  margin: 0;
  color: var(--muted);
  font-size: 1.1rem;
  max-width: 680px;
  line-height: 1.6;
}

.status-bar {
  display: flex;
  justify-content: center;
  gap: 16px;
  flex-wrap: wrap;
  margin: 20px 0 30px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border-radius: 999px;
  padding: 10px 16px;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.08);
  font-weight: 650;
}

.icon-pill {
  min-width: 72px;
  justify-content: center;
}

.status-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
}

.difficulty-screen {
  margin: 34px auto 0;
  max-width: 980px;
  text-align: center;
}

.difficulty-screen h2 {
  margin: 0 0 22px;
  font-size: clamp(1.5rem, 3vw, 2.2rem);
}

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

.difficulty-button {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 14px;
  min-height: 0;
  padding: 14px;
  border-radius: 24px;
  background: var(--card);
  color: var(--text);
  box-shadow: var(--shadow);
  border: 4px solid transparent;
  overflow: hidden;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.difficulty-button:hover,
.difficulty-button:focus-visible {
  transform: translateY(-5px);
  border-color: var(--accent);
  background: #eef2ff;
}

.difficulty-image {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 16px;
}

.difficulty-name {
  display: block;
  font-size: 1.2rem;
  font-weight: 850;
  line-height: 1.2;
  text-align: center;
}

.game-shell[hidden],
.difficulty-screen[hidden],
.title-screen[hidden] {
  display: none;
}

.game-board {
  display: grid;
  grid-template-columns: 1fr;
  gap: 34px;
}

.parents-area {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 18px;
}

.parent-card,
.child-card {
  background: var(--card);
  border-radius: 24px;
  padding: 18px;
  box-shadow: var(--shadow);
  text-align: center;
  position: relative;
  min-height: 310px;
  border: 4px solid transparent;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.parent-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: center;
  overflow: hidden;
}

.parent-card.drop-hover {
  transform: translateY(-6px);
  border-color: var(--accent);
  background: #eef2ff;
}

.parent-card.correct {
  border-color: var(--success);
  background: #eefaf2;
}

.parent-card.answer {
  border-color: var(--success);
  background: #eefaf2;
  box-shadow: 0 12px 30px rgba(59, 143, 92, 0.24);
}

.parent-card.wrong {
  border-color: var(--error);
  background: #fff0f0;
}

.parent-card.fly-away {
  pointer-events: none;
  animation-duration: 0.9s;
  animation-fill-mode: forwards;
  animation-timing-function: cubic-bezier(0.55, -0.25, 0.78, 0.32);
}

.parent-card.fly-away-1 {
  animation-name: fly-away-left;
}

.parent-card.fly-away-2 {
  animation-name: fly-away-top;
}

.parent-card.fly-away-3 {
  animation-name: fly-away-right;
}

.parent-card.fly-away-4 {
  animation-name: fly-away-bottom-left;
}

.parent-card.fly-away-5 {
  animation-name: fly-away-bottom-right;
}

@keyframes fly-away-left {
  to {
    opacity: 0;
    transform: translate(-140vw, -18vh) rotate(-28deg) scale(0.78);
  }
}

@keyframes fly-away-top {
  to {
    opacity: 0;
    transform: translate(8vw, -130vh) rotate(18deg) scale(0.72);
  }
}

@keyframes fly-away-right {
  to {
    opacity: 0;
    transform: translate(140vw, 20vh) rotate(30deg) scale(0.78);
  }
}

@keyframes fly-away-bottom-left {
  to {
    opacity: 0;
    transform: translate(-90vw, 120vh) rotate(34deg) scale(0.76);
  }
}

@keyframes fly-away-bottom-right {
  to {
    opacity: 0;
    transform: translate(90vw, 120vh) rotate(-34deg) scale(0.76);
  }
}

.label {
  font-weight: 800;
  font-size: 1.15rem;
  margin-bottom: 8px;
}

.traits {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin-top: 8px;
  min-height: 28px;
}

.trait-chip {
  font-size: 0.8rem;
  color: var(--muted);
  background: #f1eee9;
  border-radius: 999px;
  padding: 5px 9px;
}

.child-area {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-height: 330px;
  position: relative;
}

.child-card {
  width: min(280px, 90vw);
  cursor: grab;
  user-select: none;
  touch-action: none;
  z-index: 10;
}

.child-card[hidden] {
  display: none;
}

.next-round-button {
  align-self: center;
  min-width: 140px;
}

.next-round-button[hidden] {
  display: none;
}

.child-card.dragging {
  cursor: grabbing;
  position: fixed;
  left: var(--drag-x);
  top: var(--drag-y);
  pointer-events: none;
  opacity: 0.95;
  transform: scale(1.04);
  transition: none;
  z-index: 999;
}

.child-card.returning {
  transition: transform 0.2s ease, left 0.2s ease, top 0.2s ease;
}

.person-svg {
  width: 170px;
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.selected-child-slot {
  position: absolute;
  right: 12px;
  bottom: 12px;
  width: 78px;
  min-height: 78px;
  pointer-events: none;
  z-index: 2;
}

.selected-child {
  width: 78px;
  height: 78px;
  overflow: hidden;
  border-radius: 18px;
  border: 3px solid rgba(47, 42, 36, 0.2);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.14);
}

.selected-child .person-svg {
  width: 74px;
  margin-top: -2px;
}

.message {
  text-align: center;
  margin-top: 22px;
  font-size: 1.15rem;
  font-weight: 800;
  min-height: 32px;
}

.message.success {
  color: var(--success);
}

.message.error {
  color: var(--error);
}

.message-detail {
  display: block;
  max-width: 760px;
  margin: 8px auto 0;
  color: var(--muted);
  font-size: 0.95rem;
  font-weight: 650;
  line-height: 1.4;
}

.controls {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 22px;
}

button {
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  font-size: 1rem;
  font-weight: 800;
  cursor: pointer;
  background: var(--text);
  color: white;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.16);
}

button.secondary {
  background: #ffffff;
  color: var(--text);
}

@media (max-width: 760px) {
  .difficulty-options {
    grid-template-columns: 1fr;
  }

  .difficulty-button {
    max-width: 360px;
    margin: 0 auto;
  }

  .parents-area {
    grid-template-columns: 1fr;
  }

  .parent-card {
    min-height: 260px;
  }

  .person-svg {
    width: 140px;
  }
}
