:root {
  --bg1: #fff8e7;
  --bg2: #d9f3ff;
  --primary: #ff7b54;
  --text: #2b2b2b;
  --card: #ffffff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Comic Sans MS", "Trebuchet MS", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, var(--bg1), var(--bg2));
  min-height: 100vh;
}

.app {
  max-width: 920px;
  margin: 0 auto;
  padding: 20px;
}

header {
  text-align: center;
  margin-bottom: 14px;
}

h1 {
  margin: 8px 0;
  font-size: clamp(1.7rem, 4vw, 2.6rem);
}

p { margin: 0; }

.card {
  background: var(--card);
  border-radius: 18px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.09);
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

label {
  font-weight: 700;
  display: flex;
  gap: 6px;
  align-items: center;
}

select {
  border-radius: 10px;
  border: 1px solid #d1d1d1;
  padding: 8px;
}

#menu {
  display: grid;
  gap: 12px;
}

button {
  border: 0;
  border-radius: 14px;
  padding: 12px 14px;
  font-size: 1.05rem;
  font-weight: 700;
  cursor: pointer;
  background: #ffd166;
  color: #2a2a2a;
}

button:hover { filter: brightness(0.98); }
button:active { transform: scale(0.98); }

.hidden { display: none; }

.game-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.score-wrap {
  background: #f0fff3;
  border: 2px solid #cbeed5;
  border-radius: 10px;
  padding: 6px 10px;
  font-weight: 700;
}

#game-area {
  min-height: 280px;
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
}

.memory-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(62px, 1fr));
  gap: 10px;
}

.tile {
  min-height: 68px;
  font-size: 1.6rem;
  background: #8ecae6;
}

.tile.revealed,
.tile.matched {
  background: #b7efc5;
}

.spelling-word {
  text-align: center;
  font-size: 2rem;
  font-weight: 800;
  letter-spacing: 0.1em;
}

.letter-bank,
.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.bubble {
  background: #fca3cc;
  min-width: 68px;
}

.back {
  width: 100%;
  background: var(--primary);
  color: white;
}

@media (max-width: 640px) {
  .memory-grid {
    grid-template-columns: repeat(3, minmax(62px, 1fr));
  }
  .controls {
    justify-content: center;
  }
}
