/* Reset dan dasar */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #fff;
  color: #222;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 2rem;
}

.container {
  max-width: 700px;
  width: 100%;
  background: #fafafa;
  border-radius: 12px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.08);
  padding: 2rem 2.5rem;
}

h1, h2 {
  text-align: center;
  margin-bottom: 1.5rem;
  color: #111;
  font-weight: 700;
}

.screen {
  display: none;
}

.screen.active {
  display: block;
}

.form-group {
  margin-bottom: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

label {
  font-weight: 600;
  font-size: 1rem;
  color: #444;
}

select {
  padding: 0.5rem 1rem;
  font-size: 1rem;
  border-radius: 8px;
  border: 1px solid #bbb;
  background: #fff;
  transition: border-color 0.3s ease;
}

select:focus {
  outline: none;
  border-color: #0078d7;
}

.btn {
  display: inline-block;
  padding: 0.65rem 1.8rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 1rem;
  border: none;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.25s ease, color 0.25s ease;
  margin-top: 1rem;
  text-align: center;
}

.primary-btn {
  background-color: #0078d7;
  color: #fff;
}

.primary-btn:hover:not(:disabled) {
  background-color: #005fa3;
}

.secondary-btn {
  background-color: #e1e1e1;
  color: #333;
  margin-left: 0.5rem;
}

.secondary-btn:hover:not(:disabled) {
  background-color: #c8c8c8;
}

.secondary-btn:disabled,
.primary-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.sentence-container {
  background: #fff;
  border: 1px solid #ddd;
  padding: 1rem 1.2rem;
  border-radius: 10px;
  font-size: 1.25rem;
  color: #333;
  margin-bottom: 1rem;
  min-height: 60px;
  user-select: none;
  word-wrap: break-word;
}

.sentence {
  white-space: pre-wrap;
}

.char {
  display: inline-block;
  padding: 0 1px;
  user-select: none;
  border-radius: 3px;
}

.char.correct {
  background-color: #d4edda;
  color: #155724;
}

.char.incorrect {
  background-color: #f8d7da;
  color: #721c24;
}

.char.pending {
  color: #999;
}

#inputBox {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1.2rem;
  border-radius: 10px;
  border: 1px solid #ccc;
  margin-bottom: 1.5rem;
  transition: border-color 0.3s ease;
}

#inputBox:focus {
  outline: none;
  border-color: #0078d7;
}

.stats {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  font-size: 1rem;
  background: #f4f4f4;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid #ddd;
  margin-bottom: 1rem;
  user-select: none;
}

.stats > div {
  margin: 0.25rem 0;
  min-width: 90px;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #222;
  color: #eee;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  font-size: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease-in-out;
  z-index: 9999;
  max-width: 90vw;
  text-align: center;
}

.toast.show {
  opacity: 1;
}

/* Chart canvas */
#historyChart {
  max-width: 100%;
  margin-top: 1.5rem;
}

/* Responsive */
@media (max-width: 480px) {
  .stats {
    flex-direction: column;
    gap: 0.5rem;
  }

  .stats > div {
    min-width: auto;
    text-align: left;
  }

  .controls {
    flex-direction: column;
    gap: 1rem;
  }
}
