/* =============================================================
   game.css — Игровой экран: поле, буквы, таймер, ввод, слова
   ============================================================= */

#screen-game {
  padding: 8px 12px 100px;
  justify-content: flex-start;
}

/* ===== GAME HEADER ===== */
.game-header {
  width: 100%; max-width: 480px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 10px;
}
.back-btn {
  width: 36px; height: 36px; border-radius: 10px;
  background: var(--card); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 18px; flex-shrink: 0; transition: all 0.2s;
}
.back-btn:hover { border-color: var(--accent); }
.game-mode-badge {
  background: var(--card); border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 10px;
  font-size: 11px; font-weight: 700; color: var(--text2);
  letter-spacing: 0.08em; text-transform: uppercase;
}
.score-display {
  margin-left: auto;
  font-family: 'Unbounded', sans-serif; font-size: 18px; font-weight: 900;
  color: var(--accent);
}

/* ===== TIMER ===== */
.timer-wrap { width: 100%; max-width: 480px; margin-bottom: 10px; position: relative; }
.timer-bar  { height: 6px; background: rgba(255,255,255,0.1); border-radius: 3px; overflow: hidden; margin-bottom: 6px; }
.timer-fill {
  height: 100%; border-radius: 3px;
  background: linear-gradient(90deg, var(--green), var(--blue));
  transition: width 1s linear, background 0.5s;
  transform-origin: left;
}
.timer-fill.warning { background: linear-gradient(90deg, var(--accent), #ff9a9e); }
.timer-fill.pulse   { animation: pulse-bar 0.5s ease infinite alternate; }
@keyframes pulse-bar { from { opacity: 1; } to { opacity: 0.5; } }
.timer-text { font-family: 'Unbounded', sans-serif; font-size: 13px; text-align: right; color: var(--text2); }
.timer-text.warning { color: var(--accent); }

/* ===== BIG WORD / LETTER TILES ===== */
/* ===== BIG WORD / LETTER TILES ===== */
.big-word-wrap {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 20px 16px;
  margin-bottom: 16px;
  text-align: center;
}

.big-word-label {
  font-size: 11px;
  color: var(--text2);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

.big-word-letters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  padding: 4px;
}

.letter-tile {
  width: clamp(48px, 12vw, 64px);
  height: clamp(48px, 12vw, 64px);
  background: var(--card2);
  border: 2px solid rgba(255,255,255,0.2);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Unbounded', sans-serif;
  font-size: clamp(22px, 6vw, 32px);
  font-weight: 900;
  cursor: pointer;
  transition: all 0.15s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.letter-tile::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(233,69,96,0.3), transparent);
  opacity: 0;
  transition: opacity 0.2s;
}

.letter-tile:active::after {
  opacity: 1;
}

.letter-tile.used {
  background: rgba(233,69,96,0.2);
  border-color: var(--accent);
  color: var(--accent);
  transform: scale(0.92);
  filter: grayscale(0.3);
}

.letter-tile:hover {
  border-color: rgba(255,255,255,0.5);
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}

.letter-tile:active {
  transform: scale(0.92);
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Анимация для букв при наборе */
.letter-tile.selected {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  transform: scale(0.95);
  box-shadow: 0 0 15px rgba(233,69,96,0.5);
}

/* Эффект пульсации для нового слова */
@keyframes letter-pulse {
  0% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(233,69,96,0.4);
  }
  70% {
    transform: scale(1.05);
    box-shadow: 0 0 0 10px rgba(233,69,96,0);
  }
  100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(233,69,96,0);
  }
}

.new-word-highlight {
  animation: letter-pulse 0.5s ease;
}


/* Адаптация для мобильных */
@media (max-width: 480px) {
  .letter-tile {
    width: clamp(44px, 11vw, 56px);
    height: clamp(44px, 11vw, 56px);
    font-size: clamp(20px, 5vw, 28px);
    border-radius: 14px;
  }
  .big-word-letters {
    gap: 8px;
  }
}

@media (max-width: 360px) {
  .letter-tile {
    width: clamp(40px, 10vw, 48px);
    height: clamp(40px, 10vw, 48px);
    font-size: clamp(18px, 4.5vw, 24px);
    border-radius: 12px;
  }
  .big-word-letters {
    gap: 6px;
  }
}


/* ===== INPUT AREA ===== */
.input-area {
  width: 100%; max-width: 480px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px; margin-bottom: 10px;
}

.word-compose { 
  display: flex; 
  gap: 8px; 
  align-items: center; 
  margin-bottom: 8px; 
}

.compose-field {
  flex: 1;
  background: var(--card2); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 14px;
  font-family: 'Unbounded', sans-serif; font-size: 16px; font-weight: 700;
  color: var(--text); outline: none; letter-spacing: 0.1em; text-transform: uppercase;
  transition: border-color 0.2s;
}

.compose-field:focus   { border-color: var(--accent); }
.compose-field.error   { border-color: var(--accent); animation: shake 0.3s ease; }
.compose-field.success { border-color: var(--green); }

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25%       { transform: translateX(-6px); }
  75%       { transform: translateX(6px); }
}

.submit-btn {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--accent), #c0392b);
  border: none;
  color: #fff;
  font-size: 22px;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.submit-btn:hover { transform: scale(1.05); box-shadow: var(--glow); }
.submit-btn:active { transform: scale(0.95); }

/* Блок с кнопками очистки и подсказки */
.input-actions {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.clear-btn {
  flex: 1;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
}

.clear-btn:hover { border-color: rgba(255,255,255,0.3); color: var(--text); }
.clear-btn:active { transform: scale(0.98); }

/* ===== FOUND WORDS ===== */
.found-words-wrap {
  width: 100%; max-width: 480px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px; margin-bottom: 10px;
  max-height: 200px; overflow-y: auto;
}
.found-words-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px;
}
.found-count { font-family: 'Unbounded', sans-serif; font-size: 12px; font-weight: 700; color: var(--accent); }
.found-words-list { display: flex; flex-wrap: wrap; gap: 6px; }
.found-word {
  background: var(--card2); border: 1px solid var(--border);
  padding: 4px 10px; border-radius: 8px;
  font-size: 13px; font-weight: 700; letter-spacing: 0.05em;
}
.found-word.animated {
  animation: pop-in 0.25s ease forwards;
}
.found-word.bonus { border-color: var(--gold);  color: var(--gold); }
.found-word.long  { border-color: var(--blue);  color: var(--blue); }
@keyframes pop-in {
  from { opacity: 0; transform: scale(0.8); }
  to   { opacity: 1; transform: scale(1); }
}

/* ===== RIVALS ===== */
.rivals-wrap {
  width: 100%; max-width: 480px;
  background: var(--card); border: 1px solid var(--border);
  border-radius: 16px; padding: 12px; margin-bottom: 10px;
}
.rival-row {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 0; border-bottom: 1px solid var(--border); transition: all 0.3s;
}
.rival-row:last-child { border-bottom: none; }
.rival-pos   { font-family: 'Unbounded', sans-serif; font-size: 11px; font-weight: 700; width: 20px; color: var(--text2); }
.rival-pos.me   { color: var(--accent); }
.rival-name  { flex: 1; font-size: 13px; font-weight: 700; }
.rival-name.me  { color: var(--accent); }
.rival-score { font-family: 'Unbounded', sans-serif; font-size: 13px; font-weight: 700; }
.rival-words { font-size: 11px; color: var(--text2); }

/* ===== MOBILE ADAPTATIONS ===== */
@media (max-width: 480px) {
  .letter-tile {
    width: 30px;
    height: 30px;
    font-size: 12px;
    border-radius: 8px;
  }
  .big-word-letters { gap: 4px; }
  
  /* Адаптация поля ввода */
  .word-compose {
    gap: 6px;
  }
  
  .compose-field {
    font-size: 14px;
    padding: 8px 12px;
  }
  
  .submit-btn {
    width: 44px;
    height: 44px;
    font-size: 20px;
  }
  
  .input-actions {
    gap: 6px;
  }
  
  .clear-btn {
    padding: 8px 10px;
    font-size: 11px;
    white-space: normal;
  }
}

@media (max-width: 360px) {
  .compose-field {
    font-size: 13px;
    padding: 8px 8px;
  }
  
  .submit-btn {
    width: 40px;
    height: 40px;
    font-size: 18px;
  }
  
  .clear-btn {
    padding: 8px 6px;
    font-size: 10px;
  }
}

@media (max-height: 600px) {
  .found-words-wrap { max-height: 120px; }
  .big-word-wrap    { padding: 10px; }
  .input-area       { padding: 10px; }
}