.kc-card.has-scene-image {
  padding: 0;
  background: #171412;
  color: #fff;
}

.kc-card.is-dense-page {
  cursor: default;
  aspect-ratio: 2 / 3;
  max-height: none;
  background: #f8f2e6;
}

.kc-card.is-dense-page .kc-card-topline,
.kc-card.is-dense-page .kc-card-footer {
  display: none;
}

.kc-card.is-dense-page .kc-card-scene {
  background: #f8f2e6;
}

.kc-card.is-dense-page .kc-card-scene > img {
  object-fit: contain;
  object-position: center top;
  opacity: 0;
  transition: opacity 220ms ease;
}

.kc-card.is-dense-page.is-image-ready .kc-card-scene > img {
  opacity: 1;
}

.kc-card.is-dense-page.kc-page-turn {
  transform-origin: left center;
  backface-visibility: hidden;
  will-change: transform, opacity;
  animation: kc-dense-page-turn 440ms cubic-bezier(0.22, 0.72, 0.22, 1) both;
}

.kc-image-loading {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 9px;
  overflow: hidden;
  background: #f8f2e6;
  color: #473a32;
  text-align: center;
}

.kc-image-loading::before,
.kc-image-loading::after {
  position: absolute;
  right: 10%;
  left: 10%;
  height: 1px;
  background: rgba(119, 94, 74, 0.16);
  content: '';
}

.kc-image-loading::before {
  top: 24%;
  box-shadow: 0 80px 0 rgba(119, 94, 74, 0.12), 0 160px 0 rgba(119, 94, 74, 0.1);
}

.kc-image-loading::after {
  bottom: 22%;
}

.kc-image-loading-mark {
  width: 58px;
  height: 58px;
  border: 2px solid rgba(192, 50, 42, 0.18);
  border-top-color: var(--pxs-accent);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.72);
  animation: kc-image-loading-spin 900ms linear infinite;
}

.kc-image-loading strong {
  font-size: 15px;
}

.kc-image-loading small {
  color: #7e6e63;
  font-size: 12px;
}

@keyframes kc-dense-page-turn {
  from {
    opacity: 0.35;
    transform: perspective(1200px) translateX(18px) rotateY(-5deg) scale(0.988);
  }
  to {
    opacity: 1;
    transform: perspective(1200px) translateX(0) rotateY(0) scale(1);
  }
}

@keyframes kc-image-loading-spin {
  to {
    transform: rotate(360deg);
  }
}

.kc-page-role {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  border: 1px solid var(--pxs-border-strong);
  border-radius: 999px;
  background: var(--pxs-accent-dim);
  padding: 0 14px;
  color: var(--pxs-accent);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.kc-card.has-scene-image::before {
  z-index: 4;
}

.kc-card.has-scene-image .kc-card-topline,
.kc-card.has-scene-image .kc-card-footer {
  position: absolute;
  right: 18px;
  left: 18px;
  z-index: 5;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: rgba(20, 16, 14, 0.72);
  padding: 8px 12px;
  color: #fff;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
}

.kc-card.has-scene-image .kc-card-topline {
  top: 22px;
}

.kc-card.has-scene-image .kc-card-footer {
  bottom: 18px;
}

.kc-card.has-scene-image .kc-card-footer span:last-child {
  color: #fff;
}

.kc-card-scene {
  position: absolute;
  inset: 0;
  display: block;
  overflow: hidden;
}

.kc-card-scene > img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  transition: filter 180ms ease, transform 180ms ease;
}

.kc-card.has-scene-image.is-flipped .kc-card-scene > img {
  filter: brightness(0.24) blur(2px);
  transform: scale(1.02);
}

.kc-card-answer-overlay {
  position: absolute;
  inset: 72px 28px 70px;
  z-index: 3;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 14px;
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 20px;
  background: rgba(21, 17, 15, 0.88);
  padding: clamp(18px, 4vw, 32px);
  color: #fff;
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(10px);
}

.kc-card-answer-overlay strong {
  color: #ffd5cf;
  font-size: 14px;
  letter-spacing: 0.08em;
}

.kc-card-answer-overlay > span {
  white-space: pre-wrap;
  font-size: clamp(16px, 2.3vw, 22px);
  font-weight: 700;
  line-height: 1.65;
}

.kc-card-answer-overlay small {
  border-top: 1px solid rgba(255, 255, 255, 0.16);
  padding-top: 13px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 13px;
  line-height: 1.55;
}

.kc-generation-progress {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  border: 1px solid var(--pxs-border-strong);
  border-radius: 12px;
  background: var(--pxs-accent-dim);
  padding: 12px 14px;
  color: var(--pxs-fg-secondary);
  font-size: 13px;
  font-weight: 700;
}

.kc-export-actions button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.kc-learning-panel {
  display: grid;
  gap: 14px;
  width: min(880px, 100%);
  margin: 14px auto 0;
  border: 1px solid var(--pxs-border-strong);
  border-radius: 20px;
  background: #fffaf6;
  padding: 18px;
  box-shadow: 0 16px 40px rgba(51, 32, 24, 0.08);
}

.kc-learning-steps {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.kc-learning-steps span {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  border-radius: 14px;
  background: #fff;
  padding: 10px 12px;
  color: var(--pxs-fg-secondary);
  font-size: 13px;
  font-weight: 700;
  line-height: 1.45;
}

.kc-learning-steps b {
  display: grid;
  flex: 0 0 26px;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 50%;
  background: var(--pxs-accent);
  color: #fff;
  font-size: 12px;
}

.kc-learning-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid rgba(91, 69, 58, 0.14);
  padding-top: 14px;
}

.kc-learning-summary strong {
  color: #2f2723;
  font-size: 15px;
}

.kc-learning-summary span {
  color: var(--pxs-fg-secondary);
  font-size: 13px;
  font-weight: 700;
}

.kc-learning-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.kc-learning-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 42px;
  border: 1px solid var(--pxs-border-strong);
  border-radius: 12px;
  background: #fff;
  padding: 0 18px;
  color: #2f2723;
  font-weight: 800;
}

.kc-learning-actions button.primary {
  border-color: var(--pxs-accent);
  background: var(--pxs-accent);
  color: #fff;
}

.kc-learning-actions button.is-selected {
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--pxs-accent) 22%, transparent);
}

.kc-learning-actions button.review-marked {
  border-color: #d99b2b;
  background: #fff4d8;
  color: #825500;
}

.kc-progress-dots button.is-understood {
  background: #3d9a70;
}

.kc-progress-dots button.is-review {
  background: #d99b2b;
}

@media (max-width: 700px) {
  .kc-card.has-scene-image .kc-card-topline,
  .kc-card.has-scene-image .kc-card-footer {
    right: 10px;
    left: 10px;
  }

  .kc-card-answer-overlay {
    inset: 62px 18px 62px;
  }

  .kc-learning-steps {
    grid-template-columns: 1fr;
  }

  .kc-learning-summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .kc-learning-actions button {
    flex: 1 1 140px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .kc-card.is-dense-page.kc-page-turn,
  .kc-image-loading-mark {
    animation: none;
  }

  .kc-card.is-dense-page .kc-card-scene > img {
    transition: none;
  }
}
