/* German trainer — themed to match index.html (JetBrains Mono, #0d1117, sky-400 accents) */

.container {
  width: 100%;
  max-width: 900px;
  box-sizing: border-box;
}

.hidden {
  display: none !important;
}

/* Card hover glow, matches index.html .card */
.card {
  transition: all 0.3s;
}
.card:hover {
  border-color: #38bdf8;
}

textarea {
  width: 100%;
  height: 220px;
  margin-bottom: 15px;
  padding: 15px;
  background: #0d1117;
  color: #c9d1d9;
  border: 1px solid #374151;
  border-radius: 8px;
  font-family: 'JetBrains Mono', monospace;
  font-size: 0.95rem;
  resize: vertical;
  line-height: 1.5;
  box-sizing: border-box;
}

textarea:focus {
  outline: none;
  border-color: #38bdf8;
  box-shadow: 0 0 0 3px rgba(56, 189, 248, 0.15);
}

button {
  padding: 12px 24px;
  cursor: pointer;
  background: #38bdf8;
  color: #0d1117;
  border: none;
  border-radius: 8px;
  font-weight: bold;
  font-size: 1rem;
  font-family: 'JetBrains Mono', monospace;
  transition: transform 0.2s, background-color 0.2s;
  width: 100%;
}

button:hover {
  background: #7dd3fc;
  transform: translateY(-1px);
}

button:disabled {
  background: #374151;
  color: #6b7280;
  cursor: not-allowed;
  transform: none;
}

#typingArea {
  outline: none;
  user-select: none;
  padding-bottom: 50vh;
  margin-top: 1rem;
  cursor: text;
}

.line-group {
  background: rgba(17, 24, 39, 0.5); /* gray-900/50 */
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
  border: 1px solid #374151;
  border-left: 4px solid #374151;
  transition: border-color 0.3s, box-shadow 0.3s;
}

.line-group.active-group {
  border-color: #38bdf8;
  border-left-color: #38bdf8;
  box-shadow: 0 0 20px rgba(56, 189, 248, 0.15);
}

/* Increased line height so the subscript under each word fits */
.typing-line {
  font-size: 1.5rem;
  line-height: 2.5;
  font-family: 'JetBrains Mono', monospace;
  color: #6b7280;
}

.trans-container {
  display: none;
  margin-top: 15px;
  padding-top: 10px;
  border-top: 1px dashed #374151;
}

.trans-container.revealed {
  display: block;
  animation: fadeIn 0.5s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(-5px); }
  to   { opacity: 1; transform: translateY(0); }
}

.trans-hu {
  font-size: 1rem;
  color: #5eead4; /* teal-300 */
  margin-bottom: 0.3rem;
  font-family: Arial, sans-serif;
}

.trans-en {
  font-size: 1rem;
  color: #fbbf24; /* amber-400 */
  font-family: Arial, sans-serif;
}

/* Per-line statistics under the translation */
.line-stats {
  display: none;
  margin-top: 0.6rem;
  font-size: 0.95rem;
  color: #38bdf8;
  font-family: 'JetBrains Mono', monospace;
}

.trans-container.revealed .line-stats {
  display: block;
}

.line-stats .stat-label {
  color: #6b7280;
}

/* Word and subscript styles */
.word {
  position: relative;
  display: inline-block;
}

.word-subscript {
  display: none;
  position: absolute;
  left: 0;
  bottom: -1.2rem;
  font-size: 0.7rem;
  font-family: Arial, sans-serif;
  white-space: nowrap;
  pointer-events: none;
}

.word-subscript .sub-hu { color: #5eead4; }
.word-subscript .sub-en { color: #fbbf24; }

/* When the word is complete, show the subscript */
.word.completed .word-subscript {
  display: block;
  animation: fadeIn 0.3s ease;
}

.char {
  position: relative;
}

.char.correct {
  color: #c9d1d9;
}

.char.incorrect {
  color: #f87171; /* red-400 */
  text-decoration: underline;
  background: rgba(248, 113, 113, 0.15);
}

.char.active::before {
  content: '';
  position: absolute;
  left: 0;
  bottom: 0;
  width: 2px;
  height: 100%;
  background-color: #38bdf8;
  animation: blink 1s infinite;
  box-shadow: 0 0 6px rgba(56, 189, 248, 0.7);
}

@keyframes blink {
  50% { opacity: 0; }
}

#statsDisplay {
  margin-top: 20px;
  text-align: center;
}

.stat-box {
  background: rgba(17, 24, 39, 0.5);
  border: 1px solid #374151;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 20px;
  color: #c9d1d9;
}

.stat-box h3 {
  color: #38bdf8;
  margin-top: 0;
  margin-bottom: 12px;
  font-weight: bold;
}

.stat-box p {
  margin: 6px 0;
  color: #c9d1d9;
}

.stat-box strong {
  color: #38bdf8;
}

#loadingMsg {
  color: #38bdf8;
  text-align: center;
  font-size: 1rem;
  margin-top: 10px;
}

/* Off-screen input used to summon the mobile virtual keyboard.
   Must stay focusable (no display:none / visibility:hidden / disabled). */
#hiddenInput {
  position: fixed;
  top: 0;
  left: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
  border: 0;
  padding: 0;
  margin: 0;
  font-size: 16px; /* prevent iOS zoom on focus */
  background: transparent;
  color: transparent;
  caret-color: transparent;
  z-index: -1;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
}

#hiddenInput:focus {
  outline: none;
}
