@import url("https://fonts.googleapis.com/css2?family=Noto+Sans+JP:wght@400;700;900&family=Fira+Sans:wght@400;500;700&display=swap");
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: #f6f1e7;
  color: #1f1b16;
  font: 1rem "Fira Sans", sans-serif;
}

p,
label {
  font: 1rem "Fira Sans", sans-serif;
}

[hidden] {
  display: none !important;
}

.kc {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 0 16px;
}

.kc-header {
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 0;
}

.kc-logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: #1f1b16;
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.kc-logo__mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: #d1452c;
  color: #fff;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 900;
}

.kc-stage {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding-bottom: 48px;
}

.kc-screen {
  width: 100%;
  max-width: 520px;
  text-align: center;
  animation: kc-fade 0.25s ease-out;
}

@keyframes kc-fade {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.kc-title,
.kc-result__title {
  margin: 0;
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 900;
  font-size: clamp(3.5rem, 14vw, 6rem);
  line-height: 1;
}

.kc-subtitle {
  margin: 12px 0 32px;
  color: #6b6257;
}

.kc-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 14px;
  margin-bottom: 16px;
}

.kc-option {
  cursor: pointer;
}
.kc-option input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.kc-option__card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 22px 12px;
  border: 2px solid #d9cfbc;
  border-radius: 14px;
  background: #fffdf8;
  transition: border-color 0.15s, transform 0.15s, box-shadow 0.15s;
}

.kc-option:hover .kc-option__card {
  transform: translateY(-2px);
}

.kc-option input:checked + .kc-option__card {
  border-color: #d1452c;
  box-shadow: 0 0 0 3px rgba(209, 69, 44, 0.15);
}

.kc-option input:focus-visible + .kc-option__card {
  outline: 2px solid #1f1b16;
  outline-offset: 2px;
}

.kc-option__glyph {
  font-family: "Noto Sans JP", sans-serif;
  font-size: 2.6rem;
  font-weight: 700;
  line-height: 1.1;
}

.kc-option__name {
  color: #6b6257;
  font-weight: 500;
}

.kc-error {
  margin: 0 0 16px;
  color: #d1452c;
}

.kc-button {
  width: 100%;
  margin-top: 8px;
  padding: 16px;
  border: 0;
  border-radius: 14px;
  background: #d1452c;
  color: #fff;
  font: 700 1.1rem "Fira Sans", sans-serif;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}
.kc-button:hover {
  background: #b23722;
}
.kc-button:active {
  transform: scale(0.98);
}
.kc-button:disabled {
  opacity: 0.6;
  cursor: progress;
}

.kc-hud {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.kc-hud__item {
  display: flex;
  flex-direction: column;
  padding: 10px;
  border-radius: 10px;
  background: #ece4d3;
}

.kc-hud__label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6b6257;
}

.kc-hud__value {
  font-size: 1.4rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.timer {
  margin: 0;
}

.kc-progress {
  height: 6px;
  margin-bottom: 24px;
  border-radius: 3px;
  background: #ece4d3;
  overflow: hidden;
}

.kc-progress__bar {
  width: 0;
  height: 100%;
  background: #d1452c;
  transition: width 0.25s ease;
}

.kc-card {
  display: grid;
  place-items: center;
  aspect-ratio: 4/3;
  max-height: 300px;
  width: 100%;
  margin-bottom: 20px;
  border: 2px solid #d9cfbc;
  border-radius: 20px;
  background: #fffdf8;
  box-shadow: 0 10px 30px rgba(31, 27, 22, 0.06);
}
.kc-card.is-correct {
  animation: kc-pop 0.3s;
  border-color: #4f7a3a;
}
.kc-card.is-wrong {
  animation: kc-shake 0.3s;
  border-color: #d1452c;
}

@keyframes kc-pop {
  50% {
    transform: scale(1.03);
  }
}
@keyframes kc-shake {
  25% {
    transform: translateX(-6px);
  }
  75% {
    transform: translateX(6px);
  }
}
.current_kana {
  margin: 0;
  font-family: "Noto Sans JP", sans-serif;
  font-optical-sizing: auto;
  font-style: normal;
  font-weight: 700;
  font-size: clamp(5rem, 24vw, 9rem);
  line-height: 1;
}

.kc-answer {
  position: relative;
}

#input_kana {
  width: 100%;
  margin: 0;
  padding: 16px 20px;
  border: 2px solid #d9cfbc;
  border-radius: 14px;
  background: #fff;
  color: #1f1b16;
  font: 500 1.5rem "Fira Sans", sans-serif;
  text-align: center;
  outline: none;
  transition: border-color 0.15s;
}
#input_kana:focus {
  border-color: #1f1b16;
}

.kc-hint {
  display: block;
  margin-top: 8px;
  font-size: 0.85rem;
  color: #6b6257;
}

.kc-feedback {
  min-height: 1.5em;
  margin: 12px 0 0;
  font-weight: 500;
}
.kc-feedback.is-correct {
  color: #4f7a3a;
}
.kc-feedback.is-wrong {
  color: #d1452c;
}

.kc-score {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: -12px 0 24px;
}

.kc-score__value {
  font-size: clamp(3rem, 12vw, 4.5rem);
  font-weight: 700;
  line-height: 1.1;
  color: #d1452c;
  font-variant-numeric: tabular-nums;
}

.kc-score__label {
  color: #6b6257;
}

.kc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

.kc-stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 18px 8px;
  border: 2px solid #d9cfbc;
  border-radius: 14px;
  background: #fffdf8;
}

.kc-stat__value {
  font-size: 1.6rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.kc-stat__label {
  font-size: 0.8rem;
  color: #6b6257;
}

.kc-mistakes {
  margin-bottom: 16px;
  text-align: left;
}

.kc-mistakes__title {
  margin: 0 0 10px;
  font-size: 1rem;
}

.kc-mistakes__list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}
.kc-mistakes__list li {
  padding: 6px 12px;
  border-radius: 999px;
  background: #ece4d3;
  font-size: 0.9rem;
}
.kc-mistakes__list .kc-mistakes__kana {
  font-family: "Noto Sans JP", sans-serif;
  font-weight: 700;
  margin-right: 6px;
}
.kc-mistakes__list s {
  color: #d1452c;
  margin-right: 6px;
}

@media (max-width: 420px) {
  .kc-hud__value {
    font-size: 1.15rem;
  }
  .kc-stat__value {
    font-size: 1.3rem;
  }
}
