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

body {
  font-family: 'Nunito', sans-serif;
  min-height: 100vh;
  background: linear-gradient(135deg, #e8eaf6 0%, #e0f7fa 25%, #fff9c4 50%, #f3e5f5 75%, #fce4ec 100%);
  background-attachment: fixed;
  color: #4a4a6a;
  overflow-x: hidden;
}

h1, h2, h3 { font-family: 'Bubblegum Sans', cursive; }

.section { display: none; max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem 3rem; }
.section.active { display: block; animation: fadeIn .4s ease; }

/* Floating shapes */
.floating-shapes { position: fixed; inset: 0; pointer-events: none; z-index: 0; }
.shape { position: absolute; font-size: 2rem; opacity: .2; animation: float 8s ease-in-out infinite; }
.shape-1 { top: 10%; left: 5%; animation-delay: 0s; }
.shape-2 { top: 20%; right: 10%; animation-delay: 1.5s; }
.shape-3 { bottom: 30%; left: 15%; animation-delay: 3s; }
.shape-4 { top: 50%; right: 5%; animation-delay: 2s; }
.shape-5 { bottom: 10%; right: 20%; animation-delay: 4s; }

/* MENU */
.title-rainbow {
  text-align: center; font-size: 2.5rem;
  background: linear-gradient(90deg, #6c5ce7, #fd79a8, #fdcb6e, #00b894);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  margin-bottom: .3rem;
}
.subtitle { text-align: center; font-size: 1.1rem; color: #999; margin-bottom: 2rem; }

.level-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1rem; margin-bottom: 2rem; }
.level-card {
  background: rgba(255,255,255,.85); border-radius: 1.5rem;
  padding: 2rem 1.5rem; text-align: center; cursor: pointer;
  transition: all .2s; border: 3px solid transparent;
  box-shadow: 0 4px 15px rgba(0,0,0,.06);
}
.level-card:hover { transform: translateY(-4px); border-color: #a29bfe; box-shadow: 0 8px 25px rgba(162,155,254,.2); }
.level-emoji { font-size: 3rem; display: block; margin-bottom: .5rem; }
.level-card h3 { color: #6c5ce7; font-size: 1.3rem; }
.level-card p { font-size: .9rem; color: #999; margin-top: .3rem; }

.stats-box {
  background: rgba(255,255,255,.7); border-radius: 1rem; padding: 1.2rem 1.5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.04);
}
.stats-box h3 { color: #6c5ce7; margin-bottom: .5rem; font-size: 1.1rem; }
.record-row { display: flex; justify-content: space-between; padding: .4rem 0; border-bottom: 1px solid #eee; font-size: .9rem; }

/* GAME */
.game-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 1rem;
}
.btn-back {
  background: rgba(255,255,255,.7); border: none; border-radius: .8rem;
  padding: .5rem 1rem; cursor: pointer; font-size: 1rem;
  font-family: 'Nunito', sans-serif; font-weight: 700;
}
.game-info { display: flex; gap: 1rem; font-weight: 700; font-size: 1.1rem; }
#combo-display { color: #e17055; }

.game-area {
  background: rgba(255,255,255,.85); border-radius: 1.5rem;
  padding: 1.5rem; text-align: center; margin-bottom: 1rem;
  box-shadow: 0 4px 20px rgba(0,0,0,.06);
  position: relative; overflow: hidden;
}

.mascot { font-size: 3rem; margin-bottom: .3rem; }
.mascot-msg { font-family: 'Bubblegum Sans', cursive; color: #6c5ce7; font-size: 1.1rem; margin-bottom: 1rem; min-height: 1.5rem; }
.mascot-msg.bounce { animation: bounce .5s ease; }

/* Word display */
.word-display {
  font-size: 2.8rem; font-family: 'Nunito', monospace; font-weight: 800;
  letter-spacing: 4px; margin: 1rem 0; min-height: 4rem;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 2px;
}
.char {
  display: inline-block; padding: 4px 6px; border-radius: 8px;
  transition: all .15s; min-width: 1.5rem;
  border-bottom: 3px solid #ddd;
}
.char-correct { color: #00b894; border-bottom-color: #00b894; background: #e6fff5; }
.char-wrong { color: #ff6b6b; border-bottom-color: #ff6b6b; background: #ffe6e6; animation: shake .3s ease; }

/* Input */
.input-area { margin: 1rem 0; }
#type-input {
  font-size: 1.8rem; font-family: 'Nunito', monospace; font-weight: 700;
  text-align: center; padding: .6rem 1.5rem; border-radius: 1rem;
  border: 3px solid #ddd; outline: none; width: 100%; max-width: 500px;
  background: #fff; transition: border-color .2s;
}
#type-input:focus { border-color: #6c5ce7; box-shadow: 0 0 0 4px rgba(108,92,231,.15); }

/* Progress */
.progress-bar { height: 8px; background: #e0d4f5; border-radius: 4px; margin-top: 1rem; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, #6c5ce7, #a29bfe); border-radius: 4px; transition: width .3s; width: 0; }
.progress-text { font-size: .85rem; color: #999; margin-top: .3rem; }

/* KEYBOARD */
.keyboard {
  background: rgba(255,255,255,.8); border-radius: 1.2rem;
  padding: 1rem .5rem; box-shadow: 0 2px 15px rgba(0,0,0,.06);
}
.kb-row { display: flex; justify-content: center; gap: 4px; margin-bottom: 4px; }
.key {
  min-width: 38px; height: 42px; background: #f0ecff; border: 2px solid #d4ccf0;
  border-radius: .6rem; display: flex; align-items: center; justify-content: center;
  font-family: 'Nunito', sans-serif; font-weight: 700; font-size: 1rem;
  text-transform: uppercase; cursor: pointer; transition: all .15s;
  user-select: none; color: #555;
}
.key:hover { background: #e0d4f5; }
.key:active { transform: scale(.92); }
.key-space { flex: 1; max-width: 250px; font-size: .85rem; text-transform: none; }
.key-back { min-width: 55px; }

.key-next { background: #6c5ce7 !important; color: white !important; border-color: #5a4bd1 !important; transform: scale(1.08); box-shadow: 0 0 10px rgba(108,92,231,.4); }
.key-correct { background: #00b894 !important; color: white !important; border-color: #00a381 !important; }
.key-wrong { background: #ff6b6b !important; color: white !important; border-color: #e55a5a !important; }

/* RESULTS */
.results-container { text-align: center; padding-top: 2rem; }
.results-stars { font-size: 3.5rem; margin-bottom: 1rem; }
.results-title { font-size: 2rem; color: #6c5ce7; margin-bottom: 1.5rem; }
.results-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: .8rem; margin-bottom: 2rem; }
.stat-card {
  background: rgba(255,255,255,.85); border-radius: 1rem; padding: 1rem .5rem;
  box-shadow: 0 2px 10px rgba(0,0,0,.05);
}
.stat-value { display: block; font-size: 1.8rem; font-weight: 800; color: #6c5ce7; }
.stat-label { font-size: .8rem; color: #999; }

.results-actions { display: flex; gap: 1rem; justify-content: center; }
.btn {
  padding: .7rem 1.8rem; border: none; border-radius: 1rem; font-family: 'Nunito', sans-serif;
  font-size: 1.05rem; font-weight: 700; cursor: pointer; transition: all .2s;
}
.btn-primary { background: linear-gradient(135deg, #6c5ce7, #a29bfe); color: white; }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 4px 15px rgba(108,92,231,.3); }
.btn-secondary { background: rgba(255,255,255,.8); color: #6c5ce7; border: 2px solid #d4ccf0; }

/* Floating emoji */
.floating-emoji {
  position: absolute; font-size: 2rem;
  animation: floatUp 1.5s ease forwards;
  pointer-events: none;
}

/* ANIMATIONS */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes bounce { 0%,100% { transform: scale(1); } 50% { transform: scale(1.1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
@keyframes float { 0%,100% { transform: translateY(0) rotate(0); } 50% { transform: translateY(-20px) rotate(5deg); } }
@keyframes floatUp {
  0% { opacity: 1; transform: translateY(0) scale(1); }
  100% { opacity: 0; transform: translateY(-100px) scale(1.5); }
}

/* RESPONSIVE */
@media (max-width: 600px) {
  .title-rainbow { font-size: 1.8rem; }
  .word-display { font-size: 2rem; }
  #type-input { font-size: 1.4rem; }
  .key { min-width: 28px; height: 36px; font-size: .85rem; }
  .key-space { max-width: 180px; }
  .results-stats { grid-template-columns: repeat(2, 1fr); }
  .game-info { font-size: .95rem; gap: .5rem; }
}
