/* ─── Layout ─────────────────────────────────────────────────────────────────── */
.quiz-main {
  position: relative;
  z-index: 5;
  max-width: 560px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

/* ─── Progress bar ───────────────────────────────────────────────────────────── */
.q-progress-bar {
  height: 10px;
  background: #e8e8e8;
  border-radius: 10px;
  overflow: hidden;
  margin: 16px 0 10px;
}
#progressFill {
  height: 100%;
  background: linear-gradient(90deg, #FF6B6B, #FFD700);
  border-radius: 10px;
  transition: width .5s ease;
  width: 0%;
}

/* ─── Type selection screen ───────────────────────────────────────────────────── */
.type-header {
  text-align: center;
  padding: 28px 0 22px;
}
.type-title { font-size: 2rem; font-weight: 900; color: var(--text); }
.type-sub   { font-size: 1rem; color: var(--text-sub); font-weight: 600; margin-top: 6px; }

.type-grid {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

@keyframes type-card-in {
  from { opacity: 0; transform: translateX(-24px); }
  to   { opacity: 1; transform: translateX(0); }
}

.type-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  border: none;
  border-radius: 24px;
  cursor: pointer;
  font-family: inherit;
  color: #fff;
  box-shadow: var(--shadow-lg);
  transition: transform .2s, box-shadow .2s;
  animation: type-card-in .4s ease both;
}
.type-card:hover {
  transform: translateX(6px) scale(1.01);
  box-shadow: 0 14px 44px rgba(0,0,0,.22);
}

.tc-icon  { font-size: 2.8rem; flex-shrink: 0; }
.tc-text  { flex: 1; text-align: left; }
.tc-label { font-size: 1.3rem; font-weight: 900; }
.tc-desc  { font-size: .88rem; opacity: .88; margin-top: 3px; font-weight: 600; }
.tc-arrow { font-size: 2rem; font-weight: 300; opacity: .7; }

/* ─── Quiz header ────────────────────────────────────────────────────────────── */
.q-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0 12px;
}
.q-stat-left  { font-size: .95rem; font-weight: 700; color: var(--text-sub); }
.q-score-badge {
  font-size: 1.1rem;
  font-weight: 900;
  color: #FF6B6B;
  background: #FFF3F3;
  padding: 4px 14px;
  border-radius: 50px;
  border: 2px solid #FFCDD2;
}

/* ─── Prompt area ────────────────────────────────────────────────────────────── */
.q-prompt-area { text-align: center; margin-bottom: 18px; }

.q-prompt {
  font-size: 1.2rem;
  font-weight: 900;
  color: var(--text);
}

.q-word-hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  background: var(--surface);
  padding: 10px 22px;
  border-radius: 50px;
  box-shadow: var(--shadow);
  border: 2px solid #f0f0f0;
}
.hint-emoji { font-size: 2rem; }
.hint-ja    { font-size: 1.1rem; font-weight: 900; color: var(--text); }

/* ─── Play button ────────────────────────────────────────────────────────────── */
.play-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 148px;
  height: 148px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  border: none;
  cursor: pointer;
  font-family: inherit;
  margin: 0 auto 24px;
  box-shadow: 0 8px 32px rgba(255,107,107,.42);
  animation: play-idle 2.4s ease-in-out infinite;
  transition: transform .18s;
}
.play-btn:hover {
  transform: scale(1.1) !important;
  animation: none;
  box-shadow: 0 12px 40px rgba(255,107,107,.6);
}

@keyframes play-idle {
  0%,100% { transform: scale(1);    box-shadow: 0 8px 32px rgba(255,107,107,.42); }
  50%     { transform: scale(1.06); box-shadow: 0 14px 48px rgba(255,107,107,.62); }
}
@keyframes play-bounce {
  0%,100% { transform: scale(1); }
  35%     { transform: scale(1.18); }
  65%     { transform: scale(.93); }
}

.play-btn.playing    { animation: play-bounce .5s ease; }
.play-btn.was-played { animation: none; background: linear-gradient(135deg,#42A5F5,#64B5F6); }
.play-btn.was-played:hover { transform: scale(1.1) !important; }

.play-icon { font-size: 3.4rem; line-height: 1; }
.play-text {
  font-size: .72rem;
  font-weight: 800;
  color: rgba(255,255,255,.92);
  margin-top: 6px;
  text-align: center;
  line-height: 1.3;
}

/* ─── Choice grid ────────────────────────────────────────────────────────────── */
.choice-grid { display: grid; gap: 12px; }
.layout-4col { grid-template-columns: repeat(4, 1fr); }
.layout-2x2  { grid-template-columns: 1fr 1fr; }

.choice-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 14px 6px;
  border: 3px solid #e8e8e8;
  border-radius: 20px;
  background: var(--surface);
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow);
  transition: transform .18s, border-color .18s, box-shadow .18s, background .18s;
  min-height: 88px;
  position: relative;
  overflow: hidden;
}
/* top colour bar */
.choice-btn::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--cc, #9C27B0);
  opacity: 0;
  transition: opacity .18s;
}
.choice-btn:not(:disabled):hover {
  transform: translateY(-5px);
  border-color: var(--cc, #9C27B0);
  box-shadow: var(--shadow-lg);
}
.choice-btn:not(:disabled):hover::before { opacity: 1; }

/* Correct */
@keyframes choice-pop {
  0%,100% { transform: scale(1); }
  45%     { transform: scale(1.12); }
  70%     { transform: scale(.95); }
}
.choice-btn.correct {
  background: #E8F5E9;
  border-color: #43A047;
  box-shadow: 0 0 0 3px rgba(67,160,71,.25);
  animation: choice-pop .45s ease;
}
.choice-btn.correct::before { background: #43A047; opacity: 1; }

/* Wrong */
@keyframes choice-shake {
  0%,100% { transform: translateX(0); }
  25%     { transform: translateX(-7px); }
  75%     { transform: translateX(7px); }
}
.choice-btn.wrong {
  background: #FFEBEE;
  border-color: #EF5350;
  animation: choice-shake .4s ease;
  opacity: .65;
}
.choice-btn.wrong::before { background: #EF5350; opacity: 1; }

/* Letter choices */
.ch-upper { font-size: 2.1rem; font-weight: 900; color: var(--cc, #333); line-height: 1; }
.ch-lower { font-size: 1.1rem; font-weight: 700; color: var(--cc, #666); opacity: .7; }

/* Word choices */
.ch-emoji { font-size: 2.6rem; line-height: 1; }
.ch-word  { font-size: .95rem; font-weight: 900; color: var(--text); }
.ch-ja    { font-size: .72rem; color: var(--text-sub); font-weight: 600; }

/* ─── Feedback ───────────────────────────────────────────────────────────────── */
.q-feedback {
  text-align: center;
  font-size: 1.3rem;
  font-weight: 900;
  padding: 11px 26px;
  border-radius: 50px;
  margin-top: 14px;
  animation: pop .28s ease;
}
.q-feedback.ok { background: #FFF9C4; color: #E65100; }
.q-feedback.ng { background: #FCE4EC; color: #AD1457; }

/* ─── Result card ────────────────────────────────────────────────────────────── */
.result-card {
  text-align: center;
  padding: 44px 24px;
  background: var(--surface);
  border-radius: 28px;
  box-shadow: var(--shadow-lg);
  margin-top: 20px;
}
.result-stars  { font-size: 3.2rem; margin-bottom: 10px; animation: pop .5s ease; }
.result-title  { font-size: 2.2rem; font-weight: 900; margin-bottom: 14px; }
.result-score  { font-size: 4rem; font-weight: 900; color: #FF6B6B; line-height: 1; }
.result-pct    { font-size: 1.2rem; color: var(--text-sub); margin: 4px 0 28px; font-weight: 700; }
.result-btns   { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.btn-retry {
  padding: 14px 30px;
  background: linear-gradient(135deg, #FF6B6B, #FF8E53);
  color: #fff;
  border: none;
  border-radius: 50px;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(255,107,107,.4);
  transition: transform .18s;
}
.btn-retry:hover { transform: translateY(-2px); }

.btn-back {
  padding: 14px 30px;
  background: #f0f0f0;
  color: var(--text);
  border: none;
  border-radius: 50px;
  font-size: 1.05rem;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: background .18s;
}
.btn-back:hover { background: #e0e0e0; }

/* ─── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .layout-4col { grid-template-columns: 1fr 1fr; }
  .play-btn  { width: 122px; height: 122px; }
  .play-icon { font-size: 2.8rem; }
  .ch-upper  { font-size: 1.7rem; }
  .ch-emoji  { font-size: 2rem; }
}
