/* =============================================
   TECLAS MÓVEIS — Design por Mary Andrioli
   Paleta: Rosa #E8185A | Azul #00AEEF | Laranja #F7941D | Verde-azulado #00B5B8 | Roxo #7C3AED
   ============================================= */

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

:root {
  --rosa:        #E8185A;
  --azul:        #00AEEF;
  --laranja:     #F7941D;
  --verde:       #00B5B8;
  --roxo:        #7C3AED;
  --branco:      #FFFFFF;
  --fundo:       #FFF8F0;
  --texto-escuro:#2D2D2D;
  --sombra:      rgba(0,0,0,0.15);
}

/* ---- Reset & Base ---- */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
}

body {
  font-family: 'Nunito', Arial, sans-serif;
  background: var(--fundo);
  color: var(--texto-escuro);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---- Fundo decorativo com bolinhas ---- */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image:
    radial-gradient(circle at 10% 15%, rgba(0,174,239,0.08) 0%, transparent 40%),
    radial-gradient(circle at 90% 80%, rgba(232,24,90,0.08) 0%, transparent 40%),
    radial-gradient(circle at 50% 50%, rgba(247,148,29,0.05) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
}

/* ---- Header ---- */
header {
  background: linear-gradient(135deg, var(--rosa) 0%, #c0105a 100%);
  padding: 18px 24px 22px;
  text-align: center;
  position: relative;
  box-shadow: 0 4px 16px rgba(232,24,90,0.35);
  z-index: 10;
}

header::after {
  content: '';
  position: absolute;
  bottom: -12px;
  left: 0;
  right: 0;
  height: 24px;
  background: linear-gradient(135deg, var(--rosa) 0%, #c0105a 100%);
  clip-path: ellipse(52% 100% at 50% 0%);
}

header h1 {
  font-size: clamp(1.6rem, 5vw, 2.4rem);
  font-weight: 900;
  color: var(--branco);
  letter-spacing: 1px;
  text-shadow: 0 2px 8px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

header h1::before {
  content: '🔤';
  font-size: 1.8rem;
}

/* ---- Main ---- */
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding: 36px 20px 24px;
  gap: 24px;
  max-width: 1100px;
  width: 100%;
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

/* ---- Seção de Input ---- */
.input-section {
  background: var(--branco);
  border-radius: 20px;
  padding: 28px 32px;
  box-shadow: 0 6px 24px var(--sombra);
  border-top: 5px solid var(--azul);
  position: relative;
  overflow: hidden;
}

.input-section::before {
  content: '';
  position: absolute;
  top: 0; right: 0;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(0,174,239,0.12) 0%, transparent 70%);
  border-radius: 50%;
}

.input-label {
  display: block;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--azul);
  margin-bottom: 6px;
}

.subtitle {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: #888;
  margin-top: 2px;
}

.input-group {
  display: flex;
  gap: 12px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.text-input {
  flex: 1;
  min-width: 180px;
  padding: 14px 20px;
  font-size: 1.1rem;
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 700;
  border: 3px solid #E0E0E0;
  border-radius: 14px;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
  background: #FAFAFA;
  color: var(--texto-escuro);
}

.text-input:focus {
  border-color: var(--azul);
  box-shadow: 0 0 0 4px rgba(0,174,239,0.18);
  background: var(--branco);
}

.text-input::placeholder {
  color: #BDBDBD;
  font-weight: 600;
}

.generate-btn {
  padding: 14px 28px;
  font-size: 1rem;
  font-family: 'Nunito', Arial, sans-serif;
  font-weight: 800;
  background: linear-gradient(135deg, var(--laranja) 0%, #e07a10 100%);
  color: var(--branco);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s, filter 0.15s;
  box-shadow: 0 4px 14px rgba(247,148,29,0.45);
  white-space: nowrap;
  letter-spacing: 0.5px;
}

.generate-btn:hover {
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 8px 20px rgba(247,148,29,0.5);
  filter: brightness(1.05);
}

.generate-btn:active {
  transform: translateY(0) scale(0.98);
  box-shadow: 0 2px 8px rgba(247,148,29,0.4);
}

/* ---- Área de Jogo ---- */
.game-area {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.drag-container {
  flex: 1;
  min-height: 380px;
  background: var(--branco);
  border-radius: 20px;
  padding: 20px;
  box-shadow: 0 6px 24px var(--sombra);
  border: 3px dashed rgba(0,181,184,0.4);
  position: relative;
  transition: border-color 0.3s;
}

.drag-container:empty::after {
  content: 'As teclas aparecerão aqui — arraste e monte palavras! 🎯';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1rem;
  font-weight: 700;
  color: #BDBDBD;
  text-align: center;
  pointer-events: none;
  width: 80%;
}

/* ---- Letras / Teclas ---- */
.letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 60px;
  height: 60px;
  font-size: 1.6rem;
  font-weight: 900;
  font-family: 'Nunito', Arial, sans-serif;
  border-radius: 14px;
  cursor: grab;
  position: absolute;
  user-select: none;
  text-transform: uppercase;
  transition: transform 0.1s, box-shadow 0.1s;
  box-shadow: 0 4px 10px var(--sombra), 0 2px 0 rgba(0,0,0,0.15);
}

.letter:active,
.letter.ui-draggable-dragging {
  cursor: grabbing;
  transform: scale(1.15) rotate(-3deg);
  box-shadow: 0 10px 28px rgba(0,0,0,0.25);
  z-index: 1000 !important;
}

/* Cores cíclicas para as teclas */
.letter:nth-child(5n+1) {
  background: linear-gradient(135deg, var(--rosa) 0%, #c0105a 100%);
  color: var(--branco);
  border-bottom: 4px solid #9a0d48;
}
.letter:nth-child(5n+2) {
  background: linear-gradient(135deg, var(--azul) 0%, #0090c8 100%);
  color: var(--branco);
  border-bottom: 4px solid #006fa0;
}
.letter:nth-child(5n+3) {
  background: linear-gradient(135deg, var(--laranja) 0%, #e07a10 100%);
  color: var(--branco);
  border-bottom: 4px solid #b86008;
}
.letter:nth-child(5n+4) {
  background: linear-gradient(135deg, var(--verde) 0%, #009496 100%);
  color: var(--branco);
  border-bottom: 4px solid #007476;
}
.letter:nth-child(5n+5) {
  background: linear-gradient(135deg, var(--roxo) 0%, #5b21b6 100%);
  color: var(--branco);
  border-bottom: 4px solid #4c1d95;
}

/* ---- Footer ---- */
footer {
  background: var(--branco);
  border-top: 3px solid #F0F0F0;
  padding: 16px 24px;
  text-align: center;
  font-size: 0.88rem;
  font-weight: 600;
  color: #888;
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px 24px;
}

footer a {
  color: var(--rosa);
  text-decoration: none;
  font-weight: 700;
  transition: color 0.2s;
}

footer a:hover {
  color: var(--azul);
  text-decoration: underline;
}

/* ---- Responsividade ---- */
@media (max-width: 600px) {
  main {
    padding: 28px 12px 16px;
    gap: 16px;
  }

  .input-section {
    padding: 20px 18px;
  }

  .input-group {
    flex-direction: column;
  }

  .generate-btn {
    width: 100%;
    padding: 16px;
    font-size: 1.05rem;
  }

  .letter {
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
    border-radius: 12px;
  }

  .drag-container {
    min-height: 300px;
  }
}

/* ---- Animação de entrada das teclas ---- */
@keyframes popIn {
  0%   { transform: scale(0) rotate(-10deg); opacity: 0; }
  70%  { transform: scale(1.15) rotate(3deg); opacity: 1; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.letter.pop-in {
  animation: popIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}
