:root {
  --bg: #fff8f0;
  --surface: #ffffff;
  --accent: #ff8c69;
  --accent-dark: #e56b4a;
  --accent-soft: #ffe8df;
  --green: #66bb6a;
  --text: #3d3d3d;
  --muted: #8b7355;
  --shadow: 0 8px 24px rgba(61, 61, 61, 0.08);
  --radius: 20px;
  --font: "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  background: linear-gradient(180deg, #fff8f0 0%, #ffe8df 100%);
  color: var(--text);
}

#app {
  max-width: 720px;
  margin: 0 auto;
  padding: 16px 16px 40px;
}

.header { text-align: center; margin-bottom: 20px; }

.badge {
  display: inline-block;
  margin: 0 0 8px;
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
}

.header h1 {
  margin: 0;
  font-size: clamp(1.8rem, 6vw, 2.4rem);
}

.subtitle {
  margin: 8px 0 0;
  color: var(--muted);
}

.screen { display: none; }
.screen.active { display: block; }

.panel {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.panel h2 { margin: 0 0 8px; font-size: 1.15rem; }
.help { margin: 0 0 16px; color: var(--muted); font-size: 0.9rem; }

.hero {
  border: 2px solid #ffd0b8;
  background: #fff4ec;
}

.hero-label {
  margin: 0 0 8px;
  font-weight: 700;
  color: var(--accent-dark);
}

.hero-text { margin: 0; line-height: 1.6; }

.dan-picker {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.dan-card {
  border: 2px solid #f0e0d0;
  border-radius: 16px;
  padding: 18px 12px;
  background: #fffaf5;
  font-size: 1.2rem;
  font-weight: 700;
  cursor: pointer;
}

.dan-card.selected {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.btn {
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.btn-wide { width: 100%; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-secondary { background: #fff; border: 2px solid var(--accent); color: var(--accent-dark); }
.btn-ghost { background: transparent; color: var(--muted); }

.step-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.progress-meta { margin: 0; color: var(--muted); font-weight: 700; }

.step-label {
  display: inline-block;
  margin: 0 0 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 0.85rem;
  font-weight: 700;
}

.quiz-image {
  display: block;
  width: min(100%, 320px);
  height: auto;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: #fff8f0;
  object-fit: contain;
  aspect-ratio: 1;
}

.quiz-prompt {
  margin: 0 0 16px;
  font-size: 1.25rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.5;
}

.choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.choice-card {
  border: 2px solid #f0e0d0;
  border-radius: 16px;
  padding: 18px 12px;
  background: #fffaf5;
  font-size: 1.15rem;
  font-weight: 700;
  cursor: pointer;
  font-family: inherit;
}

.choice-card.choice-correct {
  border-color: var(--green);
  background: #e8f5e9;
}

.choice-card.choice-wrong {
  border-color: #e57373;
  background: #ffebee;
}

.result { text-align: center; }
.result-label { color: var(--muted); font-weight: 700; }
.result-scoreline { margin: 8px 0 16px; }
.result-score { font-size: 3rem; font-weight: 800; color: var(--accent-dark); }
.result-message { margin: 0 0 20px; line-height: 1.6; }
.result .btn { margin-bottom: 10px; }

.feedback-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 61, 61, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  z-index: 20;
}

.feedback-overlay.hidden { display: none; }

.feedback-popup {
  width: min(100%, 360px);
  background: #fff;
  border-radius: 20px;
  padding: 24px;
  box-shadow: var(--shadow);
  text-align: center;
}

.feedback-text {
  margin: 0 0 16px;
  font-size: 1.3rem;
  font-weight: 800;
}
