body {
  font-family: "Segoe UI", sans-serif;
  background: linear-gradient(to bottom, #eef2ff, #f8fafc);
  margin: 0;
  text-align: center;
  overflow-x: hidden;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  background: #1e3a8a;
  color: white;
  padding: 15px;
  font-weight: bold;
  font-size: 1.2em;
  flex-shrink: 0;
}

.nav-bar {
  background: #2563eb;
  padding: 10px;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.nav-bar select, .nav-bar button {
  padding: 8px 12px;
  font-size: 1em;
  border-radius: 8px;
  border: none;
  outline: none;
  font-family: inherit;
}

.nav-bar select {
  background: white;
  color: #1e3a8a;
  font-weight: 500;
  cursor: pointer;
}

.nav-bar button {
  background: #10b981;
  color: white;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s;
}

.nav-bar button:hover { background: #059669; }

.wrapper {
  flex-grow: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 15px;
}

.container {
  width: 100%;
  max-width: 500px;
  background: white;
  border-radius: 20px;
  padding: 30px 20px;
  box-shadow: 0 10px 30px rgba(0,0,0,0.08);
}

#word {
  font-size: clamp(2.2em, 8vw, 2.8em);
  margin: 10px 0 5px 0;
  font-weight: bold;
  color: #1e3a8a;
}

#phonetic {
  font-size: 1.2em;
  color: #6b7280;
  margin-bottom: 5px;
  font-style: italic;
}

#visual-cue {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
  color: #6b7280;
  font-size: 1.2em;
  font-weight: 500;
}

#emoji { font-size: 1.5em; }

#hintBtn {
  background: #fef08a;
  color: #854d0e;
  border: none;
  padding: 8px 16px;
  border-radius: 20px;
  font-weight: bold;
  cursor: pointer;
  font-size: 0.95em;
  margin-bottom: 20px;
  transition: transform 0.1s;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

#hintBtn:active { transform: scale(0.95); }

#phonetic-rule {
  font-size: clamp(0.95em, 4vw, 1.1em);
  color: #047857;
  background: #d1fae5;
  padding: 10px 15px;
  border-radius: 10px;
  display: none; 
  margin-bottom: 20px;
  font-weight: 500;
}

#syllables {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 20px;
}

#syllables span {
  padding: 12px 18px;
  background: #e0e7ff;
  border-radius: 12px;
  cursor: pointer;
  font-size: 1.3em;
  font-weight: bold;
  transition: 0.2s;
}

.active {
  background: #2563eb !important;
  color: white;
  transform: scale(1.1);
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.buttons button {
  flex: 1 1 auto;
  min-width: 90px;
  padding: 14px 10px;
  font-size: 1.05em;
  border-radius: 14px;
  border: none;
  cursor: pointer;
  font-weight: bold;
  box-shadow: 0 4px 6px rgba(0,0,0,0.1);
  transition: transform 0.1s;
}

.buttons button:active { transform: scale(0.95); }

.listen { background: #2563eb; color: white; }
.slow { background: #10b981; color: white; }
.speak { background: #dc2626; color: white; }
.listening { background: #991b1b !important; }
.speak:disabled {
  background: #fca5a5; /* Faded red to indicate it is locked */
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  background: red;
  border-radius: 50%;
  margin-right: 8px;
  animation: blink 1s infinite;
}

@keyframes blink { 50% { opacity: 0.3; } }

#feedback {
  margin-top: 20px;
  font-size: 1.2em;
  min-height: 40px;
  font-weight: 500;
}

.progress-bar {
  height: 12px;
  background: #e5e7eb;
  border-radius: 10px;
  margin-top: 20px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  width: 0%;
  background: #2563eb;
  transition: 0.4s ease-out;
}

#module-title {
  font-size: 1.1em;
  color: #1e3a8a;
  font-weight: 600;
  margin-bottom: 15px;
  padding-bottom: 10px;
  border-bottom: 2px dashed #e5e7eb;
}



/
/* =========================================================
   SMARTPREP MEMORY MATCH GAME
   Punjabi Emoji Match Design - Italian Version
   ========================================================= */

/* --- Game Grid --- */
#memory-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    width: 100%;
    margin-bottom: 20px;
    perspective: 1000px;
}

/* Four columns on larger screens */
@media (min-width: 500px) {
    #memory-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}

/* --- Individual Memory Card --- */
#memory-grid .memory-card {
    width: 100%;
    aspect-ratio: 3 / 4;
    position: relative;
    cursor: pointer;

    transform: rotateY(0deg);
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;

    transition: transform 0.5s
        cubic-bezier(0.4, 0.2, 0.2, 1);
}

/* --- Flip Card 180 Degrees --- */
#memory-grid .memory-card.flipped {
    transform: rotateY(180deg);
}

/* --- Correct Match Stays Face Up --- */
#memory-grid .memory-card.matched {
    transform: rotateY(180deg);
    opacity: 1;
    pointer-events: none;
    cursor: default;
}

/* --- Shared Styling for Both Sides --- */
#memory-grid .memory-card > .card-cover,
#memory-grid .memory-card > .card-face {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;

    border-radius: 16px;
    box-sizing: border-box;

    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;

    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;

    text-align: center;
    padding: 8px;

    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

    /* Only the outer card rotates */
    transition: none;
}

/* =========================================================
   CLOSED CARD - PUNJABI PINK
   ========================================================= */

#memory-grid .memory-card > .card-cover {
    background: linear-gradient(
        135deg,
        #ec4899,
        #be185d
    );

    border: 3px solid #9d174d;
    color: #ffffff;
    -webkit-text-fill-color: #ffffff;

    font-size: 3rem;
    font-weight: 700;

    transform: rotateY(0deg);
}

/* =========================================================
   REVEALED CARD - WHITE
   ========================================================= */

#memory-grid .memory-card > .card-face {
    background: #ffffff;
    border: 3px solid #cbd5e1;
    color: #1e3a8a;

    /* Hidden until the whole card flips */
    transform: rotateY(180deg);
}

/* =========================================================
   CORRECT MATCH - GREEN
   ========================================================= */

#memory-grid .memory-card.matched > .card-face {
    background: #d1fae5;
    border: 3px solid #10b981;

    box-shadow: 0 0 15px
        rgba(16, 185, 129, 0.4);
}

/* =========================================================
   CARD CONTENT
   ========================================================= */

/* Italian word */
#memory-grid .card-text {
    font-size: clamp(0.9rem, 4vw, 1.3rem);
    font-weight: 700;
    color: #1e3a8a;

    width: 100%;
    line-height: 1.3;
    overflow-wrap: anywhere;
}

/* Emoji */
#memory-grid .card-emoji {
    font-size: clamp(2rem, 8vw, 3rem);
    line-height: 1.2;
    margin-bottom: 5px;
}

/* English translation */
#memory-grid .card-subtext {
    font-size: clamp(0.7rem, 2.5vw, 0.9rem);
    font-weight: 600;
    color: #6b7280;

    margin-top: 5px;
    overflow-wrap: anywhere;
}

/* =========================================================
   MOBILE OPTIMISATION
   ========================================================= */

@media (max-width: 400px) {
    #memory-grid {
        gap: 8px;
    }

    #memory-grid .memory-card > .card-cover,
    #memory-grid .memory-card > .card-face {
        border-radius: 12px;
        padding: 5px;
    }

    #memory-grid .memory-card > .card-cover {
        font-size: 2.4rem;
    }
}

/* Reduced-motion accessibility */
@media (prefers-reduced-motion: reduce) {
    #memory-grid .memory-card {
        transition: none;
    }
}
