@charset "UTF-8";
:root {
  --stage-color: #00c8ff;
}

/* ===================== LAYOUT ===================== */
.quiz-main {
  max-width: 600px;
  margin: 0 auto;
  padding: 20px 16px 60px;
  position: relative;
  min-height: 80vh;
}

/* ===================== OVERLAYS ===================== */
.q-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(6, 9, 18, 0.96);
  padding: 32px 24px;
  text-align: center;
}
.q-overlay[hidden] {
  display: none;
}

.q-stage-title {
  font-size: 1rem;
  color: var(--stage-color);
  letter-spacing: 0.2em;
  margin-bottom: 8px;
}

.q-stage-name {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ddeeff;
  text-shadow: 0 0 20px var(--stage-color);
  margin-bottom: 16px;
}

.q-stage-desc {
  color: #4e6a8e;
  font-size: 0.9rem;
  line-height: 1.7;
  margin-bottom: 32px;
}

.q-btn-start, .q-btn-retry, .q-btn-next {
  display: inline-block;
  padding: 14px 40px;
  font-size: 1.1rem;
  font-weight: 700;
  background: var(--stage-color);
  color: #060912;
  border: none;
  cursor: pointer;
  letter-spacing: 0.1em;
  text-decoration: none;
  margin-bottom: 16px;
  clip-path: polygon(8px 0%, 100% 0%, calc(100% - 8px) 100%, 0% 100%);
  transition: opacity 0.2s;
}
.q-btn-start:hover, .q-btn-retry:hover, .q-btn-next:hover {
  opacity: 0.85;
}

.q-btn-retry {
  background: #ff1e3c;
}

.q-back-link {
  display: block;
  font-size: 0.8rem;
  color: #4e6a8e;
  margin-top: 4px;
  text-decoration: none;
}
.q-back-link:hover {
  color: var(--stage-color);
}

/* gameover */
.q-go-monster {
  font-size: 5rem;
  margin-bottom: 12px;
  animation: monsterThreaten 0.6s ease-in-out infinite alternate;
}

.q-go-title {
  font-size: 2.4rem;
  font-weight: 900;
  color: #ff1e3c;
  text-shadow: 0 0 30px #ff1e3c;
  margin-bottom: 12px;
}

.q-go-msg {
  color: #ddeeff;
  margin-bottom: 8px;
}

.q-go-reached {
  color: #4e6a8e;
  font-size: 0.85rem;
  margin-bottom: 28px;
}

/* stage clear */
.q-clear-title {
  font-size: 2.2rem;
  font-weight: 900;
  color: #ffcc00;
  text-shadow: 0 0 30px #ffcc00;
  margin-bottom: 16px;
}

.q-clear-msg {
  color: #ddeeff;
  margin-bottom: 8px;
}

.q-clear-time {
  color: var(--stage-color);
  font-size: 1.1rem;
  margin-bottom: 28px;
}

/* section transition */
.q-sec-badge {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.25em;
  padding: 4px 14px;
  border: 1px solid currentColor;
  margin-bottom: 16px;
}

.q-sec-monster {
  font-size: 6rem;
  margin-bottom: 12px;
  animation: monsterAppear 0.5s cubic-bezier(0, 0.8, 0.3, 1.2) both;
}

.q-sec-name {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ddeeff;
  margin-bottom: 8px;
}

.q-sec-msg {
  color: #4e6a8e;
  font-size: 0.85rem;
}

/* ===================== GAME AREA ===================== */
.q-game {
  visibility: hidden;
}

/* Progress header */
.q-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.q-progress-dots {
  display: flex;
  gap: 6px;
}

.q-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: rgba(0, 200, 255, 0.12);
  border: 1px solid rgba(0, 200, 255, 0.25);
  transition: background 0.3s;
}
.q-dot--done {
  background: var(--stage-color);
  box-shadow: 0 0 6px var(--stage-color);
}
.q-dot--active {
  background: rgba(0, 200, 255, 0.4);
  animation: pulse 0.8s ease-in-out infinite;
}

.q-qnum {
  font-size: 0.8rem;
  color: #4e6a8e;
  letter-spacing: 0.1em;
}

/* Timer */
.q-timer-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  background: rgba(0, 200, 255, 0.06);
  border: 1px solid rgba(0, 200, 255, 0.1);
  padding: 8px 12px;
}

.q-timer-bar-track {
  flex: 1;
  height: 8px;
  background: rgba(0, 200, 255, 0.08);
  overflow: hidden;
}

.q-timer-bar {
  width: 100%;
  height: 100%;
  background: var(--stage-color);
  box-shadow: 0 0 8px var(--stage-color);
  transform-origin: left center;
  transform: scaleX(1);
  transition: transform 0.1s linear, background 0.3s;
}

.q-timer-num {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ddeeff;
  min-width: 26px;
  text-align: right;
}

/* Arena */
.q-arena {
  text-align: center;
  padding: 20px 0 16px;
  position: relative;
}

.q-section-badge {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  padding: 3px 12px;
  border: 1px solid;
  margin-bottom: 10px;
}

.q-monster {
  font-size: 5.5rem;
  display: block;
  margin: 0 auto 8px;
  filter: drop-shadow(0 0 12px var(--stage-color));
  animation: monsterIdle 2.5s ease-in-out infinite;
  transition: transform 0.2s;
}
.q-monster.monster-hit {
  animation: monsterHit 0.4s ease;
}
.q-monster.monster-dead {
  animation: monsterDie 0.8s ease forwards;
}

.q-monster-name {
  font-size: 0.85rem;
  color: #4e6a8e;
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.q-monster-hp {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.hp-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(0, 200, 255, 0.1);
  border: 1.5px solid rgba(0, 200, 255, 0.25);
  transition: background 0.3s, box-shadow 0.3s;
}
.hp-dot--full {
  background: #ff1e3c;
  border-color: #ff1e3c;
  box-shadow: 0 0 8px #ff1e3c;
}

/* Question box */
.q-question-box {
  background: rgba(0, 200, 255, 0.04);
  border: 1px solid rgba(0, 200, 255, 0.12);
  padding: 18px 20px;
  margin-bottom: 18px;
}

.q-question-text {
  font-size: 1.05rem;
  color: #ddeeff;
  line-height: 1.6;
  text-align: center;
}

/* Choices grid */
.q-choices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.choice-btn {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  background: rgba(0, 200, 255, 0.05);
  border: 1px solid rgba(0, 200, 255, 0.18);
  color: #ccdcee;
  cursor: pointer;
  text-align: left;
  line-height: 1.4;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.choice-btn:hover {
  background: rgba(0, 200, 255, 0.12);
  border-color: rgba(0, 200, 255, 0.4);
  transform: translateY(-1px);
}
.choice-btn--correct {
  background: rgba(0, 200, 80, 0.18) !important;
  border-color: #00ff88 !important;
  color: #00ff88 !important;
  animation: flashGreen 0.5s;
}
.choice-btn--wrong {
  background: rgba(255, 30, 60, 0.18) !important;
  border-color: #ff1e3c !important;
  color: #ff1e3c !important;
  animation: flashRed 0.5s;
}

.choice-label {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--stage-color);
  opacity: 0.8;
  padding-top: 1px;
}

/* ===================== DANGER STATE ===================== */
.q-danger .q-timer-bar {
  box-shadow: 0 0 14px #ff1e3c;
}
.q-danger .q-timer-num {
  color: #ff1e3c;
}

.q-danger-bg {
  position: fixed;
  inset: 0;
  z-index: 69;
  pointer-events: none;
  opacity: 0;
  background: #ff1e3c;
}
.q-danger .q-danger-bg {
  animation: dangerFlash 0.42s ease-in-out infinite;
}

/* ===================== QUIZ INDEX ===================== */
.stage-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
  padding: 0 16px 60px;
}

.stage-card {
  display: block;
  text-decoration: none;
  padding: 24px 20px;
  background: rgba(0, 200, 255, 0.04);
  border: 1px solid rgba(0, 200, 255, 0.14);
  transition: background 0.2s, border-color 0.2s, transform 0.15s;
  position: relative;
}
.stage-card:hover {
  background: rgba(0, 200, 255, 0.09);
  border-color: rgba(0, 200, 255, 0.35);
  transform: translateY(-3px);
}
.stage-card.is-cleared::after {
  content: "✓ CLEARED";
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 0.6rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: #00ff88;
  border: 1px solid #00ff88;
  padding: 2px 6px;
}

.stage-card-num {
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--stage-color);
  margin-bottom: 6px;
}

.stage-card-icon {
  font-size: 2.6rem;
  display: block;
  margin-bottom: 10px;
}

.stage-card-name {
  font-size: 1.1rem;
  font-weight: 700;
  color: #ddeeff;
  margin-bottom: 6px;
}

.stage-card-desc {
  font-size: 0.78rem;
  color: #4e6a8e;
  line-height: 1.5;
}

.stage-card-cta {
  margin-top: 14px;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: var(--stage-color);
}

/* ===================== ANSWER FEEDBACK ===================== */
.q-feedback {
  position: fixed;
  inset: 0;
  z-index: 80;
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
}
.q-feedback.fb-correct {
  animation: fbCorrectBg 1s ease-out forwards;
}
.q-feedback.fb-wrong {
  animation: fbWrongBg 1.2s ease-out forwards;
}

.q-feedback-mark {
  font-size: 9rem;
  font-weight: 900;
  line-height: 1;
  opacity: 0;
}
.fb-correct .q-feedback-mark {
  color: #ff1e3c;
  text-shadow: 0 0 40px #ff1e3c, 0 0 100px rgba(255, 30, 60, 0.6);
  animation: fbMarkCorrect 0.7s cubic-bezier(0.2, 1.5, 0.4, 1) forwards;
}
.fb-wrong .q-feedback-mark {
  color: #ff1e3c;
  text-shadow: 0 0 30px #ff1e3c;
  animation: fbMarkWrong 0.5s cubic-bezier(0.2, 1.4, 0.4, 1) forwards;
}

@keyframes fbCorrectBg {
  0% {
    opacity: 1;
    background: rgba(255, 30, 60, 0);
  }
  8% {
    opacity: 1;
    background: rgba(255, 30, 60, 0.3);
  }
  25% {
    opacity: 1;
    background: rgba(255, 30, 60, 0.08);
  }
  45% {
    opacity: 1;
    background: rgba(255, 30, 60, 0.22);
  }
  70% {
    opacity: 1;
    background: rgba(255, 30, 60, 0.06);
  }
  100% {
    opacity: 0;
    background: rgba(255, 30, 60, 0);
  }
}
@keyframes fbWrongBg {
  0% {
    opacity: 0;
    background: rgba(0, 0, 0, 0);
  }
  8% {
    opacity: 1;
    background: rgba(0, 0, 0, 0.88);
  }
  65% {
    opacity: 1;
    background: rgba(0, 0, 0, 0.8);
  }
  100% {
    opacity: 0;
    background: rgba(0, 0, 0, 0);
  }
}
@keyframes fbMarkCorrect {
  0% {
    transform: scale(0.2) rotate(-10deg);
    opacity: 0;
  }
  55% {
    transform: scale(1.25) rotate(4deg);
    opacity: 1;
  }
  75% {
    transform: scale(0.95) rotate(-2deg);
    opacity: 1;
  }
  100% {
    transform: scale(1.05) rotate(0);
    opacity: 0.9;
  }
}
@keyframes fbMarkWrong {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.15);
    opacity: 1;
  }
  100% {
    transform: scale(1);
    opacity: 0.9;
  }
}
/* ===================== ANIMATIONS ===================== */
@keyframes monsterIdle {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-8px);
  }
}
@keyframes monsterHit {
  0% {
    transform: translateX(0) scale(1);
    filter: brightness(3) drop-shadow(0 0 20px #ff1e3c);
  }
  25% {
    transform: translateX(-12px) scale(0.95);
  }
  50% {
    transform: translateX(10px) scale(0.95);
  }
  75% {
    transform: translateX(-6px);
  }
  100% {
    transform: translateX(0) scale(1);
    filter: drop-shadow(0 0 12px var(--stage-color));
  }
}
@keyframes monsterDie {
  0% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
  40% {
    transform: scale(1.2) rotate(-10deg);
    opacity: 0.8;
    filter: brightness(3);
  }
  100% {
    transform: scale(0) rotate(30deg) translateY(40px);
    opacity: 0;
  }
}
@keyframes monsterAppear {
  0% {
    transform: scale(0) rotate(-20deg);
    opacity: 0;
  }
  100% {
    transform: scale(1) rotate(0);
    opacity: 1;
  }
}
@keyframes monsterThreaten {
  from {
    transform: scale(1) rotate(-5deg);
  }
  to {
    transform: scale(1.15) rotate(5deg);
    filter: brightness(1.5);
  }
}
@keyframes dangerFlash {
  0%, 100% {
    opacity: 0;
  }
  50% {
    opacity: 0.22;
  }
}
@keyframes flashGreen {
  0% {
    box-shadow: 0 0 20px #00ff88;
  }
  100% {
    box-shadow: none;
  }
}
@keyframes flashRed {
  0% {
    box-shadow: 0 0 20px #ff1e3c;
  }
  100% {
    box-shadow: none;
  }
}
@keyframes pulse {
  0%, 100% {
    opacity: 0.5;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.3);
  }
}
/* ===================== SOUND CONTROLS ===================== */
.q-sound-ctrl {
  position: fixed;
  bottom: 20px;
  right: 16px;
  z-index: 120;
  display: flex;
  gap: 6px;
}

.q-sound-btn {
  width: 36px;
  height: 36px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  background: rgba(6, 9, 18, 0.85);
  border: 1px solid rgba(0, 200, 255, 0.25);
  color: #ddeeff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s, border-color 0.15s, opacity 0.15s;
  backdrop-filter: blur(4px);
}
.q-sound-btn:hover {
  background: rgba(0, 200, 255, 0.15);
  border-color: rgba(0, 200, 255, 0.5);
}
.q-sound-btn--off {
  opacity: 0.4;
}

/* ===================== RESPONSIVE ===================== */
@media (max-width: 420px) {
  .q-choices {
    grid-template-columns: 1fr;
  }
  .q-monster {
    font-size: 4rem;
  }
}
