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

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: linear-gradient(135deg, #1a1a2e 0%, #16213e 50%, #0f3460 100%);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  padding: 30px 20px;
  color: #fff;
}

h1 {
  font-size: 2.2rem;
  margin-bottom: 6px;
  text-align: center;
  background: linear-gradient(90deg, #e94560, #f97316);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 0.9rem;
  color: #aaa;
  margin-bottom: 26px;
  text-align: center;
}

/* ===== DIFFICULTY SCREEN ===== */
#diffScreen {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 40px;
  max-width: 600px;
  width: 100%;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  text-align: center;
}

#diffScreen h2 {
  font-size: 1.5rem;
  margin-bottom: 10px;
  color: #e2e8f0;
}

#diffScreen p {
  color: #999;
  font-size: 0.9rem;
  margin-bottom: 30px;
}

.diff-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.diff-card {
  appearance: none;
  width: 100%;
  background: rgba(255,255,255,0.06);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 16px;
  padding: 24px 16px;
  cursor: pointer;
  color: inherit;
  font: inherit;
  text-align: center;
  transition: transform 0.2s, border-color 0.2s, background 0.2s;
}

.diff-card:hover {
  transform: translateY(-4px);
  border-color: rgba(255,255,255,0.3);
  background: rgba(255,255,255,0.1);
}

.diff-card .diff-icon { font-size: 2.5rem; margin-bottom: 10px; }
.diff-card .diff-name { font-size: 1.1rem; font-weight: 700; margin-bottom: 6px; }
.diff-card .diff-desc { font-size: 0.78rem; color: #aaa; line-height: 1.4; }

.diff-card.easy   { border-color: rgba(74,222,128,0.3); }
.diff-card.easy:hover { border-color: #4ade80; }
.diff-card.easy .diff-name { color: #4ade80; }

.diff-card.medium { border-color: rgba(251,191,36,0.3); }
.diff-card.medium:hover { border-color: #fbbf24; }
.diff-card.medium .diff-name { color: #fbbf24; }

.diff-card.hard   { border-color: rgba(248,113,113,0.3); }
.diff-card.hard:hover { border-color: #f87171; }
.diff-card.hard .diff-name { color: #f87171; }

/* ===== GAME CARD ===== */
.card {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 20px;
  padding: 36px 40px;
  max-width: 820px;
  width: 100%;
  backdrop-filter: blur(12px);
  box-shadow: 0 20px 60px rgba(0,0,0,0.4);
  display: none;
}

/* Top bar */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 10px;
}

.top-left { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.score-box { display: flex; gap: 12px; }

.score-item {
  background: rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 7px 14px;
  font-size: 0.82rem;
  text-align: center;
}

.score-item span {
  display: block;
  font-size: 1.3rem;
  font-weight: 700;
}

.score-item.correct span { color: #4ade80; }
.score-item.wrong   span { color: #f87171; }

.diff-badge {
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
}

.diff-badge.easy   { background: rgba(74,222,128,0.15); color: #4ade80; border: 1px solid #4ade80; }
.diff-badge.medium { background: rgba(251,191,36,0.15);  color: #fbbf24; border: 1px solid #fbbf24; }
.diff-badge.hard   { background: rgba(248,113,113,0.15); color: #f87171; border: 1px solid #f87171; }

.progress-wrap { font-size: 0.82rem; color: #aaa; text-align: right; }

.progress-bar {
  height: 6px;
  background: rgba(255,255,255,0.1);
  border-radius: 10px;
  margin-top: 4px;
  width: 160px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #e94560, #f97316);
  border-radius: 10px;
  transition: width 0.4s ease;
}

/* Latvian sentence */
.lv-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #888;
  margin-bottom: 6px;
}

.lv-sentence {
  font-size: 1.3rem;
  font-weight: 600;
  color: #e2e8f0;
  margin-bottom: 26px;
  line-height: 1.5;
}

/* Answer area */
.answer-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #888;
  margin-bottom: 8px;
}

.answer-area {
  min-height: 62px;
  background: rgba(255,255,255,0.06);
  border: 2px dashed rgba(255,255,255,0.2);
  border-radius: 14px;
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 20px;
  transition: border-color 0.3s;
}

.answer-area.correct-border { border-color: #4ade80; border-style: solid; }
.answer-area.wrong-border   { border-color: #f87171; border-style: solid; }

.answer-area .placeholder {
  color: #555;
  font-size: 0.88rem;
  user-select: none;
}

/* Word chips */
.word-chip {
  background: linear-gradient(135deg, #e94560, #c0392b);
  color: #fff;
  padding: 8px 16px;
  border-radius: 30px;
  cursor: pointer;
  font-size: 0.97rem;
  font-weight: 500;
  border: none;
  transition: transform 0.15s, opacity 0.15s;
  user-select: none;
}

.word-chip:hover  { transform: translateY(-2px); opacity: 0.88; }
.word-chip:active { transform: scale(0.95); }

.word-chip.answer-chip {
  background: linear-gradient(135deg, #0f3460, #1a6fc4);
  cursor: grab;
  touch-action: none;
}

.word-chip.answer-chip:active { cursor: grabbing; }

.word-chip.answer-chip.dragging {
  opacity: 0.45;
  transform: scale(0.96);
}

.word-chip.answer-chip.drop-target {
  outline: 2px solid rgba(255, 255, 255, 0.65);
  outline-offset: 3px;
}

/* Word bank */
.bank-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #888;
  margin-bottom: 8px;
}

.word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  min-height: 50px;
  margin-bottom: 26px;
}

/* Buttons */
.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

.btn {
  padding: 11px 24px;
  border-radius: 12px;
  border: none;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, opacity 0.2s;
}

.btn:hover  { transform: translateY(-2px); opacity: 0.9; }
.btn:active { transform: scale(0.97); }

.btn-check   { background: linear-gradient(135deg, #4ade80, #16a34a); color: #fff; }
.btn-next    { background: linear-gradient(135deg, #f97316, #c2410c); color: #fff; }
.btn-clear   { background: rgba(255,255,255,0.1); color: #ccc; border: 1px solid rgba(255,255,255,0.15); }
.btn-change  { background: rgba(255,255,255,0.07); color: #aaa; border: 1px solid rgba(255,255,255,0.1); font-size: 0.82rem; padding: 11px 16px; }

/* Feedback */
.feedback {
  margin-top: 16px;
  font-size: 1.02rem;
  font-weight: 600;
  min-height: 26px;
  text-align: center;
}

.feedback.ok  { color: #4ade80; }
.feedback.err { color: #f87171; }

.correct-answer-reveal {
  margin-top: 6px;
  font-size: 0.87rem;
  color: #aaa;
  text-align: center;
  min-height: 20px;
}

/* Pop animation */
@keyframes pop {
  0%   { transform: scale(0.5); opacity: 0; }
  70%  { transform: scale(1.1); }
  100% { transform: scale(1);   opacity: 1; }
}
.pop { animation: pop 0.3s ease forwards; }

/* Finish screen */
.finish-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
  padding: 20px 0;
}

.finish-screen h2 { font-size: 2rem; color: #4ade80; }
.finish-screen p  { font-size: 1.05rem; color: #ccc; }

.finish-btns { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: 6px; }

.btn-restart { background: linear-gradient(135deg, #e94560, #c0392b); color: #fff; padding: 13px 32px; font-size: 1rem; }
.btn-newdiff { background: rgba(255,255,255,0.1); color: #ccc; border: 1px solid rgba(255,255,255,0.15); padding: 13px 32px; font-size: 1rem; }

.stars { font-size: 2.5rem; letter-spacing: 4px; }

.game-area { width: 100%; }

@media (max-width: 500px) {
  .card { padding: 24px 18px; }
  .diff-grid { grid-template-columns: 1fr; }
  #diffScreen { padding: 28px 18px; }
}

@media (max-width: 820px) {
  body {
    padding: 16px 12px;
  }

  h1 {
    font-size: 1.7rem;
  }

  #diffScreen {
    padding: 24px 16px;
  }

  .diff-grid {
    grid-template-columns: 1fr;
  }

  .card {
    padding: 22px 14px;
  }

  .progress-wrap {
    width: 100%;
    text-align: left;
  }

  .progress-bar {
    width: 100%;
  }

  .btn-row .btn {
    width: 100%;
    justify-content: center;
  }
}
