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

body {
  font-family: 'Noto Sans', sans-serif;
  background: #fff;
  color: #222;
  overflow: hidden;
  touch-action: none;
  height: 100vh;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.header {
  padding: 16px;
  background: #f8f8f8;
  border-bottom: 2px solid #e0e0e0;
}

.stats {
  display: flex;
  gap: 24px;
  justify-content: center;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.label {
  font-size: 12px;
  color: #666;
  margin-bottom: 4px;
}

.value {
  font-size: 24px;
  font-weight: bold;
  color: #222;
}

.game-area {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  -webkit-overflow-scrolling: touch;
}

#document-container {
  max-width: 600px;
  margin: 0 auto;
}

.document-content {
  line-height: 1.8;
  font-size: 18px;
  user-select: none;
  -webkit-user-select: none;
  white-space: pre-wrap;
}

.word {
  display: inline;
  padding: 2px 0;
  cursor: pointer;
  transition: background 0.1s;
}

.word:active {
  background: rgba(0, 0, 0, 0.05);
}

.word.selected {
  background: #ffeb3b;
  border-radius: 2px;
}

.word.correct {
  background: #4caf50;
  color: white;
  pointer-events: none;
}

.word.incorrect {
  background: #f44336;
  color: white;
  animation: shake 0.3s;
  pointer-events: none;
}

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

.controls {
  padding: 16px;
  background: #f8f8f8;
  border-top: 2px solid #e0e0e0;
}

.report-btn {
  width: 100%;
  padding: 16px;
  font-size: 18px;
  font-weight: bold;
  background: #222;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.report-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.report-btn:active:not(:disabled) {
  opacity: 0.8;
}

.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  padding: 40px 30px;
  border-radius: 16px;
  text-align: center;
  max-width: 90%;
}

.modal-content h2 {
  font-size: 24px;
  margin-bottom: 24px;
}

.final-score {
  margin-bottom: 32px;
}

.score-label {
  font-size: 14px;
  color: #666;
  margin-bottom: 8px;
}

.score-value {
  font-size: 48px;
  font-weight: bold;
  color: #222;
}

.restart-btn {
  padding: 16px 32px;
  font-size: 16px;
  font-weight: bold;
  background: #222;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.restart-btn:active {
  opacity: 0.8;
}