/* ===========================
   LETS FIND IT — STYLESHEET
   Colour theme: Identify Emotions game
   =========================== */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@700;800;900&display=swap');

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
  background: #f7f3ff;
  /* safe areas for tablets with notches */
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

/* ====== FULLSCREEN BUTTON ====== */
/* Fixed top-right on landing & complete screens */
.fs-btn {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 9999;
  background: #e91e8c;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.3rem;
  font-weight: 900;
  padding: 8px 16px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(233,30,140,0.4);
  transition: background 0.2s, transform 0.15s;
  line-height: 1;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
}

.fs-btn:hover  { background: #c2185b; transform: scale(1.07); }
.fs-btn:active { transform: scale(0.97); }

/* Inline variant inside game header */
.fs-btn-inline {
  position: static;
  background: #e91e8c;
  color: #fff;
  border: none;
  border-radius: 12px;
  font-size: 1.2rem;
  font-weight: 900;
  padding: 8px 14px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(233,30,140,0.35);
  transition: background 0.2s, transform 0.15s;
  line-height: 1;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
}

.fs-btn-inline:hover  { background: #c2185b; transform: scale(1.07); }
.fs-btn-inline:active { transform: scale(0.97); }

/* Fullscreen body state */
body.in-fullscreen {
  position: fixed;
  inset: 0;
  width: 100vw !important;
  height: 100vh !important;
  overflow: hidden !important;
}

body:fullscreen,
body:-webkit-full-screen,
body:-moz-full-screen {
  width: 100vw !important;
  height: 100vh !important;
  overflow: hidden !important;
}

/* ====== SCREENS ====== */
.screen {
  position: fixed;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.screen.active {
  display: flex;
}

/* ====== LANDING PAGE ====== */
#landing-screen {
  background: linear-gradient(160deg, #f0f4ff 0%, #fce4ec 50%, #e8f5e9 100%);
  justify-content: center;
  align-items: center;
}

.landing-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  width: 100%;
  max-width: 1100px;
  padding: 20px;
  overflow-y: auto;
  max-height: 100vh;
}

.title-badge {
  font-size: clamp(48px, 8vw, 80px);
  animation: bounce 2s infinite;
  filter: drop-shadow(0 4px 16px rgba(106,27,154,0.25));
}

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

.main-title {
  font-size: clamp(32px, 6vw, 56px);
  font-weight: 900;
  color: #2d2d6b;
  letter-spacing: -1px;
  text-align: center;
  text-shadow: 0 3px 12px rgba(45,45,107,0.12);
}

.subtitle {
  font-size: clamp(15px, 2vw, 20px);
  color: #666;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

/* ====== CATEGORY GRID ====== */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(175px, 1fr));
  gap: 20px;
  width: 100%;
  max-width: 1000px;
  margin-top: 16px;
}

.category-card {
  background: #fff;
  border: 3px solid #ede7f6;
  border-radius: 24px;
  padding: 28px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 4px 18px rgba(0,0,0,0.08);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.category-card:hover {
  transform: translateY(-6px) scale(1.03);
  border-color: #ab47bc;
  box-shadow: 0 12px 36px rgba(106,27,154,0.18);
}

.category-card:active {
  transform: scale(0.96);
}

.category-emoji {
  font-size: clamp(36px, 5vw, 52px);
  line-height: 1;
}

.category-name {
  font-size: clamp(15px, 2vw, 20px);
  font-weight: 900;
  text-align: center;
  text-transform: capitalize;
  color: #2d2d6b;
}

.category-count {
  font-size: 12px;
  color: #6a1b9a;
  font-weight: 800;
  background: #ede7f6;
  padding: 3px 12px;
  border-radius: 20px;
}

/* ====== GAME SCREEN ====== */
#game-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  background: #f7f3ff;
  height: 100vh;
  overflow: hidden;
}

#game-screen.active {
  display: flex;
}

/* ====== GAME HEADER ====== */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 8px 14px;
  background: #fff;
  border-bottom: 3px solid #ede7f6;
  box-shadow: 0 2px 10px rgba(0,0,0,0.07);
  gap: 12px;
  flex-shrink: 0;
  min-height: 90px;
}

/* Question image sits centred in the header, grows to fill available space */
.question-image-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
}

.question-image-wrap img {
  display: block;
  height: clamp(60px, 10vh, 110px);
  width: auto;
  max-width: 100%;
  object-fit: contain;
}

.back-btn {
  background: #ede7f6;
  color: #4527a0;
  border: none;
  border-radius: 12px;
  font-family: inherit;
  font-size: clamp(13px, 1.6vw, 17px);
  font-weight: 800;
  padding: 10px 18px;
  cursor: pointer;
  transition: background 0.2s, transform 0.15s;
  white-space: nowrap;
  flex-shrink: 0;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.back-btn:hover { background: #d1c4e9; transform: scale(1.05); }
.back-btn:active { transform: scale(0.95); }

/* category-label removed from game header */

.score-display {
  font-size: clamp(14px, 1.6vw, 20px);
  font-weight: 800;
  color: #4527a0;
  background: #ede7f6;
  border-radius: 10px;
  padding: 6px 16px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* Speaker / repeat button */
.speak-btn {
  background: #ede7f6;
  color: #4527a0;
  border: none;
  border-radius: 12px;
  font-size: 1.4rem;
  padding: 8px 14px;
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.2s, transform 0.15s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 44px;
  min-height: 44px;
  line-height: 1;
}

.speak-btn:hover  { background: #d1c4e9; transform: scale(1.08); }
.speak-btn:active { transform: scale(0.94); }

/* Pulse while voice is playing */
.speak-btn.speaking {
  animation: speaker-pulse 0.7s ease-in-out infinite alternate;
  background: #6a1b9a;
  color: #fff;
}

@keyframes speaker-pulse {
  from { transform: scale(1);    box-shadow: 0 0 0 0   rgba(106,27,154,0.4); }
  to   { transform: scale(1.12); box-shadow: 0 0 0 10px rgba(106,27,154,0);  }
}

/* ====== DIFFICULTY SELECTOR ====== */
.difficulty-row {
  display: flex;
  gap: clamp(12px, 2vw, 24px);
  justify-content: center;
  flex-wrap: wrap;
  margin: 4px 0;
}

.diff-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  background: #fff;
  border: 3px solid #ede7f6;
  border-radius: 18px;
  padding: 14px 28px;
  font-family: inherit;
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 900;
  color: #4527a0;
  cursor: pointer;
  transition: border-color 0.18s, transform 0.15s, box-shadow 0.18s;
  box-shadow: 0 3px 12px rgba(0,0,0,0.07);
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-width: 110px;
  min-height: 44px;
}

.diff-btn span {
  font-size: clamp(11px, 1.4vw, 14px);
  font-weight: 700;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.diff-btn:hover {
  border-color: #ab47bc;
  transform: translateY(-3px) scale(1.03);
  box-shadow: 0 8px 24px rgba(106,27,154,0.15);
}

.diff-btn:active { transform: scale(0.96); }

.diff-btn.active {
  background: linear-gradient(135deg, #6a1b9a, #ab47bc);
  border-color: #6a1b9a;
  color: #fff;
  box-shadow: 0 6px 20px rgba(106,27,154,0.35);
}

.diff-btn.active span { color: rgba(255,255,255,0.8); }

/* ====== ANSWER GRID ====== */
.answer-grid {
  display: grid;
  gap: clamp(10px, 1.5vw, 22px);
  width: 100%;
  max-width: 1100px;
  padding: 8px 16px 14px;
  flex: 1;
  min-height: 0;
}

/* 2 answers — side by side, big images */
.answer-grid.answers-2 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: 1fr;
  max-width: 800px;
}

/* 4 answers — 2 × 2 */
.answer-grid.answers-4 {
  grid-template-columns: repeat(2, 1fr);
  grid-template-rows: repeat(2, 1fr);
  max-width: 800px;
}

/* 6 answers — 3 × 2 (default) */
.answer-grid.answers-6 {
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(2, 1fr);
}

/* Answer cards — fully transparent, no box, border-radius on image only */
.answer-card {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  border-radius: 0;
  cursor: pointer;
  padding: 6px;
  transition: transform 0.15s ease;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
  overflow: visible;
}

.answer-card img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 20px;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.12));
  transition: filter 0.2s ease;
  pointer-events: none;
}

.answer-card:hover img {
  filter: drop-shadow(0 8px 24px rgba(106,27,154,0.25));
}

.answer-card:hover {
  transform: scale(1.06);
}

.answer-card:active {
  transform: scale(0.95);
}

/* Correct */
.answer-card.correct img {
  filter: drop-shadow(0 0 18px rgba(6,214,160,0.7));
}

/* Wrong */
.answer-card.wrong {
  animation: shake 0.45s ease;
  opacity: 0.3;
}

.answer-card.disabled {
  pointer-events: none;
}

.answer-card.hidden-card {
  opacity: 0;
  pointer-events: none;
}

/* ====== AFFIRMATION OVERLAY ====== */
.affirmation-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.75);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fade-in 0.2s ease;
}

.affirmation-overlay.hidden {
  display: none;
}

.affirmation-box {
  background: #fff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 16px 60px rgba(0,0,0,0.22);
  animation: pop-in 0.35s cubic-bezier(0.34,1.56,0.64,1);
}

.affirmation-box img {
  width: clamp(200px, 30vw, 420px);
  height: auto;
  display: block;
  border-radius: 12px;
}

/* ====== ANSWER REVEAL OVERLAY ====== */
.reveal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(255,255,255,0.82);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 110;
  animation: fade-in 0.25s ease;
}

.reveal-overlay.hidden { display: none; }

.reveal-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  animation: pop-in 0.4s cubic-bezier(0.34,1.56,0.64,1);
}

.reveal-answer-img {
  width: clamp(200px, 36vw, 480px);
  height: clamp(200px, 36vw, 480px);
  object-fit: contain;
  border-radius: 28px;
  filter: drop-shadow(0 8px 32px rgba(0,0,0,0.18));
}

.reveal-label {
  font-size: clamp(28px, 5vw, 52px);
  font-weight: 900;
  color: #2d2d6b;
  text-transform: capitalize;
  letter-spacing: -0.5px;
  text-align: center;
}

.reveal-next-btn {
  background: linear-gradient(135deg, #6a1b9a, #ab47bc);
  border: none;
  border-radius: 18px;
  color: #fff;
  font-family: inherit;
  font-size: clamp(18px, 2.4vw, 26px);
  font-weight: 900;
  padding: 16px 52px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(106,27,154,0.4);
  transition: transform 0.18s, box-shadow 0.18s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 56px;
}

.reveal-next-btn:hover  { transform: translateY(-4px) scale(1.04); box-shadow: 0 12px 36px rgba(106,27,154,0.5); }
.reveal-next-btn:active { transform: scale(0.97); }

/* ====== WRONG FLASH ====== */
.wrong-overlay {
  position: fixed;
  inset: 0;
  background: rgba(233,30,100,0.15);
  z-index: 50;
  pointer-events: none;
  animation: flash-red 0.4s ease forwards;
}

.wrong-overlay.hidden { display: none; }

@keyframes flash-red {
  0%   { opacity: 0; }
  30%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ====== COMPLETE SCREEN ====== */
#complete-screen {
  background: linear-gradient(160deg, #f0f4ff 0%, #fce4ec 60%, #e8f5e9 100%);
}

.complete-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  padding: 40px 20px;
  text-align: center;
}

.complete-icon {
  font-size: clamp(56px, 10vw, 90px);
  animation: bounce 1.5s infinite;
}

.complete-title {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 900;
  color: #2d2d6b;
}

.complete-sub {
  font-size: clamp(16px, 2.2vw, 22px);
  color: #666;
  font-weight: 700;
}

.complete-stars {
  font-size: clamp(36px, 5vw, 56px);
  animation: pop-in 0.5s cubic-bezier(0.34,1.56,0.64,1) 0.3s both;
}

.play-again-btn {
  background: linear-gradient(135deg, #6a1b9a, #ab47bc);
  border: none;
  border-radius: 18px;
  color: #fff;
  font-family: inherit;
  font-size: clamp(16px, 2.2vw, 22px);
  font-weight: 900;
  padding: 16px 48px;
  cursor: pointer;
  box-shadow: 0 6px 24px rgba(106,27,154,0.4);
  transition: transform 0.18s, box-shadow 0.18s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.play-again-btn:hover { transform: translateY(-4px) scale(1.04); box-shadow: 0 12px 36px rgba(106,27,154,0.5); }
.play-again-btn:active { transform: scale(0.97); }

.home-btn {
  background: linear-gradient(135deg, #e91e8c, #f06292);
  border: none;
  border-radius: 18px;
  color: #fff;
  font-family: inherit;
  font-size: clamp(14px, 2vw, 19px);
  font-weight: 900;
  padding: 14px 36px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(233,30,140,0.35);
  transition: transform 0.18s, box-shadow 0.18s;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  min-height: 44px;
}

.home-btn:hover { transform: translateY(-3px) scale(1.04); box-shadow: 0 10px 30px rgba(233,30,140,0.45); }
.home-btn:active { transform: scale(0.97); }

/* ====== ANIMATIONS ====== */
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-10px); }
  40%       { transform: translateX(10px); }
  60%       { transform: translateX(-8px); }
  80%       { transform: translateX(8px); }
}

@keyframes fade-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes pop-in {
  from { transform: scale(0.5); opacity: 0; }
  to   { transform: scale(1);   opacity: 1; }
}

/* ====== RESPONSIVE ====== */
@media (max-width: 600px) {
  .category-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .answer-grid {
    gap: 8px;
    padding: 6px 10px 10px;
  }
}

@media (max-height: 600px) {
  .game-header { min-height: 56px; padding: 6px 12px; }
  .question-image-wrap img { height: 60px; }
  .answer-grid { gap: 6px; }
}
