* {
  box-sizing: border-box;
}

:root {
  font-family: "BIZ UDPGothic", "Yu Gothic", "Meiryo", sans-serif;
  color: #1f2937;
  background: #eef6fb;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button,
input {
  font: inherit;
}

.app {
  width: min(760px, calc(100% - 24px));
  margin: 24px auto 12px;
  flex: 1;
}

.screen {
  display: none;
  background: #ffffff;
  border-radius: 24px;
  padding: clamp(24px, 5vw, 48px);
  box-shadow: 0 10px 30px rgba(31, 41, 55, 0.12);
  text-align: center;
}

.screen.active {
  display: block;
}

.title-icon {
  font-size: 72px;
  line-height: 1;
  margin-bottom: 12px;
}

h1 {
  margin: 0 0 18px;
  font-size: clamp(32px, 7vw, 52px);
}

h2 {
  font-size: clamp(23px, 4.5vw, 34px);
  margin: 16px 0 18px;
}

.lead,
.result-message {
  font-size: clamp(19px, 3.5vw, 26px);
  line-height: 1.7;
}

.mode-box {
  margin: 28px auto;
  padding: 18px;
  max-width: 440px;
  border: 2px solid #b7d8eb;
  border-radius: 16px;
  background: #f5fbff;
  font-size: 19px;
}

.mode-box input {
  width: 22px;
  height: 22px;
  vertical-align: middle;
}

.primary-button,
.secondary-button,
.speak-button {
  min-height: 58px;
  border: none;
  border-radius: 16px;
  padding: 14px 28px;
  cursor: pointer;
  font-weight: 700;
  transition: transform 0.1s ease, opacity 0.2s ease;
}

.primary-button {
  background: #1769aa;
  color: white;
  font-size: 22px;
  min-width: 220px;
}

.secondary-button {
  background: #e5e7eb;
  color: #1f2937;
  font-size: 20px;
  min-width: 220px;
}

.speak-button {
  background: #e8f4fb;
  color: #145985;
  font-size: 18px;
  margin-bottom: 20px;
}

button:hover {
  opacity: 0.9;
}

button:active {
  transform: scale(0.98);
}

button:focus-visible,
input:focus-visible {
  outline: 4px solid #f59e0b;
  outline-offset: 4px;
}

.note {
  margin-top: 18px;
  color: #4b5563;
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 19px;
  font-weight: 700;
}

.progress-track {
  height: 14px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 20px;
}

.progress-bar {
  width: 10%;
  height: 100%;
  background: #2f855a;
  transition: width 0.25s ease;
}

.category-label {
  display: inline-block;
  margin: 4px 0 0;
  padding: 8px 16px;
  border-radius: 999px;
  background: #fff3cd;
  font-weight: 700;
  font-size: 18px;
}

.symbol-card {
  width: min(300px, 72vw);
  aspect-ratio: 1.35;
  margin: 0 auto 14px;
  border: 4px solid #dbe4ea;
  border-radius: 22px;
  display: grid;
  place-items: center;
  background: #ffffff;
}

.symbol-card svg {
  width: 82%;
  height: 82%;
}

.choices {
  display: grid;
  gap: 14px;
  margin: 4px auto 18px;
  max-width: 620px;
}

.choice-button {
  min-height: 68px;
  width: 100%;
  border: 3px solid #8ebbd3;
  border-radius: 16px;
  background: #ffffff;
  color: #1f2937;
  padding: 12px 18px;
  font-size: clamp(18px, 3.4vw, 23px);
  font-weight: 700;
  cursor: pointer;
  line-height: 1.5;
}

.choice-button.correct {
  border-color: #238636;
  background: #dff5e3;
}

.choice-button.incorrect {
  border-color: #c62828;
  background: #ffe3e3;
}

.choice-button:disabled {
  cursor: default;
  opacity: 1;
}

.feedback {
  min-height: 72px;
  margin: 8px auto 10px;
  font-size: clamp(20px, 3.8vw, 26px);
  font-weight: 700;
  line-height: 1.5;
}

.feedback.good {
  color: #176b2c;
}

.feedback.bad {
  color: #a61b1b;
}

.hidden {
  display: none;
}

.result-score {
  font-size: clamp(30px, 6vw, 46px);
  font-weight: 800;
  color: #1769aa;
  margin: 18px 0;
}

.result-buttons {
  display: grid;
  gap: 14px;
  justify-content: center;
  margin-top: 28px;
}

footer {
  text-align: center;
  color: #4b5563;
  padding: 10px 16px 20px;
}

@media (max-width: 520px) {
  .app {
    margin-top: 12px;
  }

  .screen {
    border-radius: 18px;
    padding: 22px 16px;
  }

  .quiz-header {
    font-size: 17px;
  }

  .choice-button {
    min-height: 62px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    transition: none !important;
  }
}
