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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #333;
  min-height: 100vh;
  padding: 16px;
}

.container {
  max-width: 720px;
  margin: 0 auto;
  background: #fff;
  border-radius: 12px;
  padding: 24px 20px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.08);
}

h1 {
  text-align: center;
  font-size: 1.4rem;
  margin-bottom: 20px;
  color: #4a90d9;
}

/* ステータスバー */
.stats-bar {
  display: flex;
  justify-content: space-around;
  background: #f0f6ff;
  border-radius: 8px;
  padding: 12px 8px;
  margin-bottom: 20px;
}

.stat {
  text-align: center;
}

.stat-label {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 2px;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: bold;
  color: #4a90d9;
}

.stat-unit {
  font-size: 0.8rem;
  color: #888;
  margin-left: 2px;
}

/* お題テキスト表示 */
.text-display {
  background: #fafafa;
  border: 1px solid #ddd;
  border-radius: 8px;
  padding: 16px;
  min-height: 90px;
  font-size: 1rem;
  line-height: 1.8;
  margin-bottom: 14px;
  letter-spacing: 0.03em;
  word-break: break-all;
}

.text-display .char {
  display: inline;
}

.text-display .char.correct {
  color: #27ae60;
  background: #eafaf1;
  border-radius: 2px;
}

.text-display .char.incorrect {
  color: #e74c3c;
  background: #fdecea;
  border-radius: 2px;
}

.text-display .char.current {
  background: #4a90d9;
  color: #fff;
  border-radius: 2px;
}

/* 入力エリア */
.input-area {
  width: 100%;
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
  resize: none;
  height: 80px;
  transition: border-color 0.2s;
  outline: none;
  margin-bottom: 14px;
}

.input-area:focus {
  border-color: #4a90d9;
}

.input-area:disabled {
  background: #f5f5f5;
  color: #aaa;
}

/* ボタン */
.btn-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-bottom: 20px;
}

.btn {
  padding: 10px 28px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: #4a90d9;
  color: #fff;
}

.btn-primary:hover {
  opacity: 0.85;
}

.btn-secondary {
  background: #e0e0e0;
  color: #555;
}

.btn-secondary:hover {
  opacity: 0.8;
}

/* 結果パネル */
.result-panel {
  background: #f0f6ff;
  border-radius: 10px;
  padding: 20px;
  margin-top: 8px;
}

.result-panel h2 {
  text-align: center;
  font-size: 1.1rem;
  color: #4a90d9;
  margin-bottom: 16px;
}

.result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 14px;
}

.result-item {
  background: #fff;
  border-radius: 8px;
  padding: 12px;
  text-align: center;
}

.result-label {
  display: block;
  font-size: 0.75rem;
  color: #888;
  margin-bottom: 4px;
}

.result-value {
  font-size: 1.4rem;
  font-weight: bold;
  color: #333;
}

.highscore-box {
  text-align: center;
  font-size: 0.95rem;
  color: #555;
}

.highscore-value {
  font-weight: bold;
  color: #e67e22;
  font-size: 1.1rem;
}

/* タイマー警告色 */
.timer-warning {
  color: #e74c3c !important;
}

/* レスポンシブ */
@media (max-width: 480px) {
  h1 {
    font-size: 1.2rem;
  }

  .stat-value {
    font-size: 1.3rem;
  }

  .text-display {
    font-size: 0.95rem;
    min-height: 80px;
  }

  .btn {
    padding: 10px 20px;
    font-size: 0.95rem;
  }
}
