:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --text: #e2e8f0;
  --text-dim: #94a3b8;
  --primary: #f97316;
  --primary-hover: #ea580c;
  --correct: #4ade80;
  --wrong: #f87171;
  --normal: #94a3b8;
  --border: #334155;
}

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

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Hiragino Kaku Gothic ProN', 'Noto Sans JP', 'Meiryo', sans-serif;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
}

#app {
  width: 100%;
  max-width: 720px;
  padding: 24px;
}

.screen.hidden {
  display: none;
}

/* ---- ホーム ---- */
.logo {
  text-align: center;
  font-size: 2.4rem;
  letter-spacing: 0.05em;
  color: var(--primary);
  margin-bottom: 4px;
}

.tagline {
  text-align: center;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.streak {
  text-align: center;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 20px;
  min-height: 1.4em;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
}

.card h2 {
  font-size: 0.95rem;
  color: var(--text-dim);
  margin-bottom: 12px;
}

.chapter-list {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

/* ---- ボタン ---- */
.btn {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.15s, transform 0.05s;
}

.btn:hover {
  background: #334155;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  font-weight: 700;
  width: 100%;
  padding: 14px;
  font-size: 1.05rem;
  animation: pulse 2s infinite;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-icon {
  padding: 8px 12px;
  font-size: 1.1rem;
}

.btn.hidden {
  display: none;
}

.skip-btn {
  position: absolute;
  right: 0;
  top: 0;
  background: transparent;
  border-color: #f59e0b;
  color: #fbbf24;
  font-size: 0.85rem;
  padding: 6px 14px;
}

.ime-note {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-dim);
  margin-bottom: 8px;
}

.footer-note {
  text-align: center;
  font-size: 0.75rem;
  color: var(--text-dim);
  opacity: 0.7;
}

/* ---- 練習 ---- */
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.chapter-label {
  font-weight: 700;
}

.time {
  color: var(--text-dim);
  margin-right: auto;
}

.progress-wrap {
  height: 6px;
  background: var(--bg-card);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 32px;
}

.progress-bar {
  height: 100%;
  width: 0%;
  background: var(--primary);
  transition: width 0.3s;
}

.practice-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
}

.word-display {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 2px;
  margin-bottom: 16px;
}

.letter {
  font-family: 'SF Mono', 'Cascadia Code', Consolas, 'Courier New', monospace;
  font-size: 2.6rem;
  color: var(--normal);
  transition: color 0.1s;
}

.letter.correct {
  color: var(--correct);
}

.letter.wrong {
  color: var(--wrong);
}

.translation {
  font-size: 1.15rem;
  color: var(--text-dim);
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.6);
  backdrop-filter: blur(2px);
  font-size: 1.1rem;
  color: var(--text);
  border-radius: 12px;
}

.overlay.hidden {
  display: none;
}

/* ---- 統計バー ---- */
.stats {
  position: relative;
  display: flex;
  justify-content: center;
  gap: 32px;
  margin-top: 24px;
  padding: 16px;
  background: var(--bg-card);
  border-radius: 12px;
}

.stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-dim);
}

.stat b {
  font-size: 1.3rem;
  color: var(--text);
}

/* ---- 結果 ---- */
.result-title {
  text-align: center;
  font-size: 1.6rem;
  margin-bottom: 24px;
  color: var(--primary);
}

.result-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  margin-bottom: 24px;
}

.result-stats .stat span {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.wrong-words {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
  min-height: 32px;
}

.wrong-word-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.85rem;
}

.wrong-word-chip b {
  color: var(--wrong);
  font-family: 'SF Mono', Consolas, monospace;
  margin-right: 6px;
}

.perfect-note {
  color: var(--correct);
  font-weight: 700;
}

.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(249, 115, 22, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(249, 115, 22, 0);
  }
}

@media (max-width: 480px) {
  .letter {
    font-size: 1.8rem;
  }
  .stats {
    gap: 16px;
  }
}
