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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f0f4f8;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

#app {
  width: 100%;
  max-width: 420px;
}

/* ---- 画面共通 ---- */
.screen {
  background: #fff;
  border-radius: 16px;
  padding: 32px 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.screen.hidden {
  display: none;
}

h1 {
  font-size: 1.6rem;
  color: #1a202c;
  margin-bottom: 8px;
}

h2 {
  font-size: 1.3rem;
  color: #2d3748;
  margin-bottom: 24px;
}

.subtitle {
  color: #718096;
  margin-bottom: 28px;
  font-size: 0.95rem;
}

/* ---- 設定グループ ---- */
.setting-group {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #f7fafc;
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 12px;
}

.setting-group label {
  font-size: 0.95rem;
  color: #4a5568;
  font-weight: 600;
}

.setting-group select {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.95rem;
  background: #fff;
  color: #2d3748;
  cursor: pointer;
  outline: none;
}

.setting-group select:focus {
  border-color: #4299e1;
}

/* ---- ハイスコア ---- */
.highscore-box {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 6px;
  margin: 20px 0 24px;
  background: #ebf8ff;
  border-radius: 10px;
  padding: 12px 20px;
}

.hs-label {
  color: #2b6cb0;
  font-size: 0.85rem;
}

.hs-value {
  font-size: 2rem;
  font-weight: 700;
  color: #2b6cb0;
}

.hs-unit {
  color: #2b6cb0;
  font-size: 0.85rem;
}

/* ---- ボタン ---- */
.btn-primary {
  display: block;
  width: 100%;
  padding: 14px;
  background: #4299e1;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 1.05rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 12px;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: #3182ce;
}

.btn-primary:active {
  background: #2b6cb0;
}

.btn-secondary {
  display: block;
  width: 100%;
  padding: 12px;
  background: transparent;
  color: #718096;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  margin-top: 8px;
  transition: background 0.15s;
}

.btn-secondary:hover {
  background: #f7fafc;
}

/* ---- 数字表示 ---- */
.number-display {
  font-size: 3.5rem;
  font-weight: 700;
  letter-spacing: 0.15em;
  color: #2d3748;
  background: #f7fafc;
  border-radius: 12px;
  padding: 24px 16px;
  margin-bottom: 20px;
  min-height: 96px;
  display: flex;
  align-items: center;
  justify-content: center;
  word-break: break-all;
}

/* ---- タイマーバー ---- */
.timer-wrap {
  background: #e2e8f0;
  border-radius: 8px;
  height: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}

.timer-bar {
  height: 100%;
  background: #4299e1;
  border-radius: 8px;
  width: 100%;
  transition: width linear;
}

.countdown-text {
  color: #718096;
  font-size: 0.9rem;
  margin-bottom: 8px;
}

/* ---- 入力 ---- */
.answer-input {
  display: block;
  width: 100%;
  padding: 14px;
  font-size: 1.4rem;
  text-align: center;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  margin-bottom: 12px;
  outline: none;
  letter-spacing: 0.1em;
  color: #2d3748;
}

.answer-input:focus {
  border-color: #4299e1;
}

/* ---- 結果 ---- */
.result-icon {
  font-size: 4rem;
  margin-bottom: 8px;
  line-height: 1;
}

.result-label {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 16px;
}

.result-label.correct {
  color: #38a169;
}

.result-label.wrong {
  color: #e53e3e;
}

.correct-answer {
  color: #718096;
  font-size: 0.9rem;
  margin-bottom: 20px;
  min-height: 20px;
}

.score-row {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

.score-item {
  flex: 1;
  background: #f7fafc;
  border-radius: 10px;
  padding: 14px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.score-item.best {
  background: #ebf8ff;
}

.score-num {
  font-size: 2rem;
  font-weight: 700;
  color: #2d3748;
}

.score-item.best .score-num {
  color: #2b6cb0;
}

.score-label {
  font-size: 0.75rem;
  color: #718096;
}

/* ---- レスポンシブ ---- */
@media (max-width: 374px) {
  .number-display {
    font-size: 2.5rem;
  }
  h1 {
    font-size: 1.4rem;
  }
}
