/* ============================================================
   Rapid Response — quickfire quiz
   ============================================================ */

.qshell {
  width: min(860px, 100% - 2.2rem);
  margin-inline: auto;
  padding: clamp(1.4rem, 4vw, 2.8rem) 0 4rem;
}
.screen {
  animation: riseIn 0.55s var(--e-out) both;
}
.screen.hidden {
  display: none;
}

/* ---------- intro ------------------------------------------ */
.intro {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.85rem;
  text-align: center;
  padding: clamp(2rem, 5vw, 3.2rem);
}
.intro__icon {
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
  border-radius: var(--r-lg);
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--stroke-1);
  animation: floatY 5s var(--e-in-out) infinite;
}
.intro__icon img {
  width: 62px;
  height: 62px;
}
.intro h1 {
  font-size: clamp(2rem, 5vw, 3.1rem);
  background: linear-gradient(120deg, #fff, var(--blood-300) 70%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.intro__ready {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--blood-200);
}
.intro__rules {
  max-width: 52ch;
}
.intro__meta {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  justify-content: center;
  margin: 0.4rem 0 0.6rem;
}
.intro__keys {
  margin-top: 0.3rem;
}

/* ---------- HUD -------------------------------------------- */
.hud {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.85rem 1.15rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke-1);
  background: linear-gradient(160deg, var(--surface-1), var(--surface-0));
  backdrop-filter: blur(12px);
  margin-bottom: 0.9rem;
}
.hud__cell {
  display: flex;
  flex-direction: column;
  gap: 0.18rem;
  min-width: 0;
}
.hud__cell--streak {
  margin-inline-start: auto;
  align-items: flex-end;
  text-align: end;
}
.hud__label {
  font-size: 0.66rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--ink-300);
}
.hud__value {
  font-family: var(--font-display);
  font-size: 1.45rem;
  font-weight: 800;
  line-height: 1;
}
#hudScore {
  color: var(--white);
}
.hud__cell--streak.is-hot #hudStreak {
  color: var(--amber-400);
  text-shadow: 0 0 18px rgba(255, 176, 32, 0.75);
}
.hud__cell--streak.is-hot .hud__label::after {
  content: " 🔥";
}

/* timer ring */
.hud__timer {
  position: relative;
  width: 62px;
  height: 62px;
  flex: none;
  display: grid;
  place-items: center;
}
.ring {
  position: absolute;
  inset: 0;
  transform: rotate(-90deg);
}
:root[dir="rtl"] .ring {
  transform: rotate(-90deg) scaleY(-1);
}
.ring__bg,
.ring__fg {
  fill: none;
  stroke-width: 6;
  stroke-linecap: round;
}
.ring__bg {
  stroke: rgba(255, 255, 255, 0.09);
}
.ring__fg {
  stroke: var(--mint-400);
  stroke-dasharray: 169.65;
  stroke-dashoffset: 0;
  transition: stroke 0.4s var(--e-out);
  filter: drop-shadow(0 0 6px var(--mint-glow));
}
.hud__timer.is-warn .ring__fg {
  stroke: var(--amber-400);
  filter: drop-shadow(0 0 6px rgba(255, 176, 32, 0.6));
}
.hud__timer.is-danger .ring__fg {
  stroke: var(--blood-400);
  filter: drop-shadow(0 0 8px rgba(240, 73, 106, 0.8));
}
.hud__timer.is-danger {
  animation: tickPulse 0.9s var(--e-in-out) infinite;
}
@keyframes tickPulse {
  50% {
    transform: scale(1.08);
  }
}
.ring__num {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 800;
  z-index: 1;
}

/* progress dots */
.dots {
  display: flex;
  gap: 0.32rem;
  margin-bottom: 1rem;
  padding-inline: 0.2rem;
}
.dot {
  height: 5px;
  flex: 1;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.11);
  transition: background var(--t-med) var(--e-out), transform var(--t-med) var(--e-spring);
}
.dot.is-current {
  background: var(--blood-300);
  transform: scaleY(2);
}
.dot.is-right {
  background: var(--mint-400);
}
.dot.is-wrong {
  background: var(--blood-600);
}

/* ---------- question card ---------------------------------- */
.qcard {
  padding: clamp(1.3rem, 3vw, 2rem);
  border-radius: var(--r-xl);
  border: 1px solid var(--stroke-1);
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.022));
  backdrop-filter: blur(16px);
  box-shadow: var(--sh-md);
}
.qcard.is-entering {
  animation: cardIn 0.5s var(--e-out) both;
}
.qcard.is-leaving {
  animation: cardOut 0.28s var(--e-in-out) both;
}
@keyframes cardIn {
  from {
    opacity: 0;
    transform: translateY(26px) rotateX(6deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@keyframes cardOut {
  to {
    opacity: 0;
    transform: translateY(-16px) scale(0.985);
  }
}

.qcard__meta {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.qcard__prompt {
  font-size: clamp(1.25rem, 3vw, 1.75rem);
  line-height: 1.28;
  margin-bottom: 1.35rem;
}

/* options */
.opts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}
.opt {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.95rem 1.05rem;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke-2);
  background: rgba(0, 0, 0, 0.3);
  text-align: start;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.35;
  overflow: hidden;
  transition: transform var(--t-fast) var(--e-spring), border-color var(--t-med) var(--e-out),
    background var(--t-med) var(--e-out), box-shadow var(--t-med) var(--e-out), opacity var(--t-med) linear;
}
.opt:hover:not(:disabled) {
  transform: translateY(-2px);
  border-color: var(--stroke-hot);
  background: rgba(210, 30, 60, 0.14);
}
.opt:active:not(:disabled) {
  transform: scale(0.985);
}
.opt__key {
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  flex: none;
  border-radius: 8px;
  border: 1px solid var(--stroke-2);
  background: rgba(255, 255, 255, 0.07);
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 800;
  color: var(--ink-200);
  transition: background var(--t-med) var(--e-out), color var(--t-med) var(--e-out);
}
.opt__text {
  flex: 1;
  min-width: 0;
}
.opt__mark {
  font-size: 1.15rem;
  opacity: 0;
  transform: scale(0.4);
  transition: opacity var(--t-med) var(--e-out), transform var(--t-med) var(--e-spring);
}

.opt.is-right {
  border-color: rgba(52, 233, 176, 0.7);
  background: rgba(31, 211, 156, 0.18);
  box-shadow: var(--glow-mint);
}
.opt.is-right .opt__key {
  background: var(--mint-400);
  color: #04231b;
}
.opt.is-wrong {
  border-color: rgba(240, 73, 106, 0.7);
  background: rgba(210, 30, 60, 0.2);
  box-shadow: var(--glow-blood);
}
.opt.is-wrong .opt__key {
  background: var(--blood-500);
  color: #fff;
}
.opt.is-right .opt__mark,
.opt.is-wrong .opt__mark {
  opacity: 1;
  transform: none;
}
.opt.is-dimmed {
  opacity: 0.32;
}
.opt.is-removed {
  opacity: 0.18;
  filter: grayscale(1);
  pointer-events: none;
  text-decoration: line-through;
}
.opt:disabled {
  cursor: default;
}

.qcard__tools {
  display: flex;
  justify-content: flex-end;
  margin-top: 1.1rem;
}
.hintcount {
  padding: 0.05rem 0.4rem;
  border-radius: var(--r-pill);
  background: rgba(255, 176, 32, 0.2);
  color: var(--amber-400);
  font-size: 0.75rem;
  font-weight: 800;
}

/* ---------- feedback bar ----------------------------------- */
.feedback {
  position: sticky;
  bottom: 1rem;
  margin-top: 1rem;
  z-index: 20;
}
.feedback[hidden] {
  display: none;
}
.feedback__bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.15rem;
  border-radius: var(--r-lg);
  border: 1px solid var(--stroke-2);
  background: rgba(22, 11, 16, 0.94);
  backdrop-filter: blur(16px);
  box-shadow: var(--sh-lg);
  animation: fbIn 0.42s var(--e-spring) both;
}
@keyframes fbIn {
  from {
    opacity: 0;
    transform: translateY(22px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.feedback--right .feedback__bar {
  border-color: rgba(52, 233, 176, 0.55);
}
.feedback--wrong .feedback__bar {
  border-color: rgba(240, 73, 106, 0.55);
}
.feedback__icon {
  display: grid;
  place-items: center;
  width: 2.6rem;
  height: 2.6rem;
  flex: none;
  border-radius: 50%;
  font-size: 1.3rem;
  font-weight: 800;
  background: rgba(255, 255, 255, 0.09);
}
.feedback--right .feedback__icon {
  background: var(--mint-400);
  color: #04231b;
}
.feedback--wrong .feedback__icon {
  background: var(--blood-500);
  color: #fff;
}
.feedback__text {
  flex: 1;
  min-width: 0;
}
.feedback__text strong {
  display: block;
  font-size: 1.05rem;
  margin-bottom: 0.12rem;
}

/* ---------- results ---------------------------------------- */
.result {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.7rem;
  text-align: center;
  padding: clamp(2rem, 5vw, 3rem);
}
.result__badge {
  width: 118px;
  height: 118px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 194, 71, 0.28), transparent 68%);
  animation: badgePop 0.8s var(--e-spring) both;
}
.result__badge img {
  width: 82px;
  height: 82px;
  filter: drop-shadow(0 8px 22px rgba(255, 194, 71, 0.5));
}
.result--sad .result__badge {
  background: radial-gradient(circle, rgba(240, 73, 106, 0.28), transparent 68%);
}
.result--sad .result__badge img {
  filter: grayscale(0.75) drop-shadow(0 8px 22px rgba(240, 73, 106, 0.45));
}
@keyframes badgePop {
  from {
    opacity: 0;
    transform: scale(0.4) rotate(-22deg);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
.result h1 {
  font-size: clamp(1.8rem, 4.4vw, 2.7rem);
}
.result__rank {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--amber-400);
  letter-spacing: 0.01em;
}
.result__score {
  font-family: var(--font-display);
  font-size: clamp(3.4rem, 11vw, 5.4rem);
  font-weight: 800;
  line-height: 1;
  margin: 0.6rem 0 0.2rem;
  background: linear-gradient(120deg, #fff, var(--blood-300) 62%, var(--blood-500));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 6px 30px rgba(210, 30, 60, 0.45));
}
.result__grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.7rem;
  width: 100%;
  margin: 0.8rem 0 0.4rem;
}
.rstat {
  padding: 0.9rem 0.6rem;
  border-radius: var(--r-md);
  border: 1px solid var(--stroke-1);
  background: rgba(0, 0, 0, 0.26);
}
.rstat__v {
  display: block;
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
}
.rstat__l {
  display: block;
  margin-top: 0.35rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-300);
}
.result__save {
  display: flex;
  gap: 0.5rem;
  width: min(460px, 100%);
  margin-top: 0.9rem;
}
.result__save .input {
  flex: 1;
  min-width: 0;
}
.result__save .btn {
  flex: none;
}
.result__save.is-done {
  display: none;
}
.result__actions {
  display: flex;
  gap: 0.6rem;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 1.1rem;
}

/* ---------- responsive ------------------------------------- */
@media (max-width: 640px) {
  .opts {
    grid-template-columns: 1fr;
  }
  .hud {
    gap: 0.7rem;
    padding: 0.7rem 0.85rem;
  }
  .hud__value {
    font-size: 1.15rem;
  }
  .feedback__bar {
    flex-wrap: wrap;
  }
  .feedback__text {
    order: 3;
    flex-basis: 100%;
  }
  .result__grid {
    grid-template-columns: 1fr;
  }
  .result__save {
    flex-direction: column;
  }
}
