/* Study mode selection */
.study-setup-intro {
  color: var(--muted);
  margin-bottom: 24px;
}
.study-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.study-mode-tile {
  display: flex;
  flex-direction: column;
  padding: 28px;
  border: 1px solid var(--mode-accent);
  border-radius: 20px;
  background: var(--mode-background);
}
.study-mode-mint { --mode-background: #e4f3e9; --mode-accent: #256449; }
.study-mode-blue { --mode-background: #e6f0fc; --mode-accent: #285b91; }
.study-mode-peach { --mode-background: #fff0df; --mode-accent: #8c4a1d; }
.study-mode-lavender { --mode-background: #f0e9fb; --mode-accent: #694294; }
.study-mode-tile h3 {
  margin: 0;
  color: var(--mode-accent);
  font-size: 24px;
}
.study-mode-tile p {
  margin: 12px 0 24px;
  line-height: 1.6;
}
.study-mode-tile .primary {
  margin-top: auto;
  align-self: flex-start;
  min-width: 110px;
  background: var(--mode-accent);
}
.study-mode-tile .primary:hover { filter: brightness(0.9); }
.study-mode-tile .primary:focus-visible {
  outline: 3px solid var(--mode-accent);
  outline-offset: 4px;
}
@media (max-width: 650px) {
  .study-mode-grid { grid-template-columns: 1fr; }
  .study-mode-tile { padding: 22px; }
}

/* Two-sided practice card */
.flip-scene {
  height: 330px;
  position: relative;
  perspective: 1200px;
  cursor: pointer;
  outline: none;
  margin-top: 8px;
  margin-bottom: 24px;
  isolation: isolate;
}
.flip-scene::before,
.flip-scene::after {
  content: "";
  position: absolute;
  inset: 0;
  border: 1px solid #d5ddcf;
  border-radius: 17px;
  background: #edf1e7;
  pointer-events: none;
  z-index: 1;
  transform: translateY(16px) scale(0.96);
}
.flip-scene::after {
  z-index: 2;
  background: #f7f8f1;
  transform: translateY(8px) scale(0.98);
}
.practice-card-motion {
  position: relative;
  height: 100%;
  z-index: 3;
}
.practice-card-motion.requeueing {
  pointer-events: none;
  animation: practice-to-bottom 700ms ease-in-out both;
}
@keyframes practice-to-bottom {
  0% { transform: translate(0, 0) rotate(0); z-index: 3; }
  45% { transform: translate(24%, -42px) rotate(9deg) scale(0.98); z-index: 3; }
  55% { transform: translate(24%, 22px) rotate(9deg) scale(0.94); z-index: 0; }
  100% { transform: translate(0, 16px) rotate(0) scale(0.96); z-index: 0; }
}
.flip-scene:focus-visible {
  border-radius: 17px;
  box-shadow: 0 0 0 4px #176b5540;
}
.flip-card {
  height: 100%;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.2, 0.75, 0.25, 1);
}
.flip-scene.flipped .flip-card {
  transform: rotateY(180deg);
}
.flip-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  margin: 0;
}
.flip-back {
  transform: rotateY(180deg);
  background: linear-gradient(145deg, #fffefa, #edf3db);
}
.answer-content {
  width: 100%;
  min-height: 0;
  overflow: auto;
  overflow-wrap: anywhere;
}
.answer-content .answer {
  margin: 12px 0;
}
.flip-hint {
  position: absolute;
  bottom: 18px;
  color: var(--muted);
  font-size: 13px;
}

/* First-use spotlight and instruction */
.guide-legend {
  position: absolute;
  z-index: 52;
  right: 0;
  bottom: 98px;
  background: #fffefa;
  color: var(--ink);
  padding: 13px 19px;
  border-radius: 999px;
  font-weight: 700;
  white-space: nowrap;
  box-shadow: 0 8px 30px #0005;
  animation: guide-in 0.3s ease-out;
}
.guide-legend:after {
  content: "";
  position: absolute;
  right: 38px;
  top: 100%;
  border: 9px solid transparent;
  border-top-color: #fffefa;
}
.guide-target {
  position: absolute;
  z-index: 51;
  right: 18px;
  bottom: 18px;
  width: 64px;
  height: 64px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  font-size: 26px;
  isolation: isolate;
  animation: guide-pulse 1.35s ease-in-out infinite;
}
.guide-target:before {
  content: "";
  position: absolute;
  z-index: -1;
  left: 50%;
  top: 50%;
  width: 200vmax;
  height: 200vmax;
  transform: translate(-50%, -50%);
  pointer-events: none;
  background: radial-gradient(
    circle at center,
    transparent 0,
    rgba(10, 18, 16, 0.03) 28px,
    rgba(10, 18, 16, 0.12) 43px,
    rgba(10, 18, 16, 0.3) 62px,
    rgba(10, 18, 16, 0.55) 84px,
    rgba(10, 18, 16, 0.65) 110px,
    rgba(10, 18, 16, 0.7) 145px
  );
}
.guide-target span {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: transparent;
  text-shadow: 0 1px 3px #fff;
}
@keyframes guide-pulse {
  50% {
    transform: scale(1.04);
  }
}
@keyframes guide-in {
  from {
    opacity: 0;
    transform: translateY(-12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@media (prefers-reduced-motion: reduce) {
  .practice-card-motion.requeueing {
    animation-duration: 0.01ms;
  }
  .flip-card {
    transition: none;
  }
  .guide-target,
  .guide-legend {
    animation: none;
  }
}
@media (max-width: 650px) {
  .flip-scene {
    height: 360px;
  }
  .guide-legend {
    right: 0;
    bottom: 92px;
    font-size: 14px;
  }
  .guide-target {
    width: 58px;
    height: 58px;
  }
}
