/* ============================================================
   GLOBAL RESET
   ============================================================ */

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: #000;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* ============================================================
   APP CONTAINER
   ============================================================ */

#app {
  height: 100vh;
  width: 100vw;
  display: flex;
  flex-direction: column;
  background: radial-gradient(circle at top, #333 0, #000 60%);
  color: #f5f5f5;
}

/* ============================================================
   HEADER
   ============================================================ */

.top-bar {
  padding: 0.75rem 1rem 0.85rem;
  text-align: center;
  background: rgba(0, 0, 0, 0.8);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.top-bar .title {
  font-size: 1.2rem;
  font-weight: 700;
}

.top-bar .subtitle {
  font-size: 0.85rem;
  opacity: 0.8;
}

/* ============================================================
   GAME AREA (COLUMN LAYOUT)
   ============================================================ */

.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0; /* allows inner flex children to scroll */
}

/* HUD row: clues + fart badge */

.hud-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.4rem 0.75rem 0.25rem;
  font-size: 0.9rem;
}

.clues-label {
  font-weight: 500;
}

.fart-banner {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 235, 59, 0.4);
  background: rgba(0, 0, 0, 0.6);
  color: #ffeb3b;
  font-size: 0.8rem;
  white-space: nowrap;
}

.hidden {
  display: none !important;
}

/* ============================================================
   GRID (MIDDLE FLEX AREA)
   ============================================================ */

.grid {
  flex: 1 1 auto;
  min-height: 0;
  padding: 0.35rem 0.75rem 0.3rem;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(5, minmax(0, 1fr));
  gap: 0.35rem;
  overflow-y: auto; /* if space is tight, grid scrolls a little */
}

.person {
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: linear-gradient(to top, rgba(0, 0, 0, 0.9), rgba(45, 45, 45, 0.95));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0.4rem 0;
  transition: transform 0.08s ease, box-shadow 0.08s ease, border-color 0.08s ease;
}

.person:hover {
  transform: translateY(-1px);
}

.person-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
}

.person-emoji {
  font-size: 1.8rem;
  transition: transform 0.12s ease;
}

.person-label {
  font-size: 0.75rem;
  opacity: 0.85;
}

/* Selection feedback */

.person.selected {
  border-color: #ffeb3b;
  box-shadow: 0 0 0 2px rgba(255, 235, 59, 0.5);
}

.person.correct {
  border-color: #4caf50;
  box-shadow: 0 0 0 2px rgba(76, 175, 80, 0.6);
}

.person.wrong {
  border-color: #f44336;
  box-shadow: 0 0 0 2px rgba(244, 67, 54, 0.6);
}

/* Bounce animation */

.person.bounce .person-emoji {
  animation: bounce 0.25s ease-out;
}

@keyframes bounce {
  0% { transform: translateY(0); }
  30% { transform: translateY(-6px); }
  60% { transform: translateY(3px); }
  100% { transform: translateY(0); }
}

/* ============================================================
   CLUE TOAST (BOTTOM ROW, NO OVERLAY)
   ============================================================ */

.clue-toast {
  margin: 0 0.75rem 0.3rem;
  padding: 0.4rem 0.6rem;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.75);
  font-size: 0.9rem;
  text-align: center;
  min-height: 2.1rem;
  line-height: 1.3;
}

/* ============================================================
   CONTROLS + RESULT (BOTTOM)
   ============================================================ */

.controls {
  padding: 0.35rem 0.75rem 0.35rem;
  display: flex;
  justify-content: center;
  gap: 0.6rem;
}

.btn {
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(0, 0, 0, 0.8);
  color: #f5f5f5;
  padding: 0.5rem 1.1rem;
  font-size: 0.9rem;
  cursor: pointer;
  min-width: 120px;
  transition: background 0.12s, transform 0.06s;
}

.btn.primary {
  background: #ff9800;
  border-color: #ffa726;
  color: #111;
  font-weight: 600;
}

.btn:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn:not(:disabled):active {
  transform: translateY(1px);
}

.result-panel {
  margin: 0 0.75rem 0.6rem;
  padding: 0.4rem 0.7rem;
  font-size: 0.9rem;
  text-align: center;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

/* ============================================================
   MOBILE TWEAKS
   ============================================================ */

@media (max-height: 700px) {
  .person-emoji { font-size: 1.55rem; }
  .person-label { font-size: 0.6rem; }
  .grid { gap: 0.25rem; }
  .btn { padding: 0.45rem 1rem; min-width: 110px; }
  .clue-toast { font-size: 0.8rem; padding: 0.35rem 0.5rem; }
}
