/* Feedback overlay */

.hsk-feedback {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.hsk-feedback__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  backdrop-filter: blur(4px);
  animation: hsk-fade-in 0.2s var(--hsk-ease-out) both;
}

.hsk-feedback__card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
  padding: 24px;
  border-radius: var(--hsk-radius-lg);
  background: var(--qmf-bg-primary);
  border: 1px solid var(--qmf-border);
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.18);
  text-align: center;
  animation: hsk-fade-in 0.28s var(--hsk-ease-out) both;
}

.hsk-feedback__card--correct {
  border-color: color-mix(in srgb, var(--hsk-success) 40%, var(--qmf-border));
}

.hsk-feedback__card--wrong {
  border-color: color-mix(in srgb, var(--hsk-error) 40%, var(--qmf-border));
}

.hsk-feedback__icon-wrap {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  margin-bottom: 12px;
}

.hsk-feedback__card--correct .hsk-feedback__icon-wrap {
  background: color-mix(in srgb, var(--hsk-success) 15%, transparent);
  color: var(--hsk-success);
}

.hsk-feedback__card--wrong .hsk-feedback__icon-wrap {
  background: color-mix(in srgb, var(--hsk-error) 12%, transparent);
  color: var(--hsk-error);
}

.hsk-feedback__icon-wrap .hsk-icon {
  width: 28px;
  height: 28px;
}

.hsk-feedback__title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  font-weight: 700;
}

.hsk-feedback__subtitle {
  margin: 0 0 16px;
  font-size: 0.85rem;
  color: var(--qmf-text-muted);
  line-height: 1.45;
}

.hsk-feedback__body {
  text-align: left;
  margin-bottom: 18px;
  font-size: 0.88rem;
}

.hsk-feedback__score {
  text-align: center;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--hsk-success);
  margin-bottom: 12px;
}

.hsk-feedback__score--zero {
  color: var(--hsk-error);
  font-size: 1rem;
}

.hsk-feedback__note {
  margin: 0;
  line-height: 1.5;
  color: var(--hsk-text-secondary);
}

.hsk-feedback__answer {
  padding: 10px 12px;
  border-radius: var(--hsk-radius-sm);
  background: var(--qmf-bg-secondary);
  margin-bottom: 10px;
}

.hsk-feedback__hanzi {
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--hsk-text-primary);
  letter-spacing: 0.02em;
}

.hsk-feedback__explanation {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hsk-feedback__exp-row {
  padding: 8px 10px;
  border-radius: 8px;
  background: var(--qmf-bg-secondary);
  font-size: 0.82rem;
  line-height: 1.45;
}

.hsk-feedback__exp-tag {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--qmf-text-muted);
  margin-bottom: 4px;
}

.hsk-feedback__btn {
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: var(--hsk-radius-md);
  background: var(--qmf-accent-primary);
  color: #fff;
  font-size: 0.92rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s;
}

.hsk-feedback__btn:active { transform: scale(0.98); }

/* Navigator */

.hsk-nav-root--active .hsk-nav__toggle {
  display: flex;
}

.hsk-nav__toggle {
  display: none;
  position: fixed;
  right: 16px;
  bottom: calc(80px + env(safe-area-inset-bottom));
  z-index: 90;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  border: 1px solid var(--qmf-border);
  background: var(--qmf-bg-primary);
  color: var(--qmf-text-primary);
  box-shadow: var(--hsk-shadow-card);
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.hsk-nav__toggle .hsk-icon { width: 20px; height: 20px; }

.hsk-nav {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 200;
  width: min(300px, 88vw);
  height: 100dvh;
  background: var(--qmf-bg-primary);
  border-left: 1px solid var(--qmf-border);
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.1);
  display: flex;
  flex-direction: column;
  animation: hsk-slide-in-right 0.28s var(--hsk-ease-out) both;
}

.hsk-nav__backdrop {
  position: fixed;
  inset: 0;
  z-index: 199;
  background: rgba(15, 23, 42, 0.35);
}

.hsk-nav__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--qmf-border);
}

.hsk-nav__title {
  font-weight: 700;
  font-size: 0.92rem;
}

.hsk-nav__close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: var(--qmf-bg-secondary);
  cursor: pointer;
}

.hsk-nav__body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

.hsk-nav__section { margin-bottom: 16px; }

.hsk-nav__section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--qmf-text-muted);
  margin-bottom: 8px;
}

.hsk-nav__grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}

.hsk-nav__cell {
  aspect-ratio: 1;
  border: 1.5px solid var(--qmf-border);
  border-radius: 8px;
  background: var(--qmf-bg-primary);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}

.hsk-nav__cell:hover {
  border-color: var(--qmf-accent-primary);
}

.hsk-nav__cell--answered {
  background: color-mix(in srgb, var(--hsk-success) 12%, var(--qmf-bg-primary));
  border-color: color-mix(in srgb, var(--hsk-success) 40%, var(--qmf-border));
}

.hsk-nav__cell--current {
  background: var(--qmf-accent-primary);
  color: #fff;
  border-color: var(--qmf-accent-primary);
}

@keyframes hsk-slide-in-right {
  from { transform: translateX(100%); }
  to { transform: translateX(0); }
}

@media (min-width: 900px) {
  .hsk-nav-root--active .hsk-nav {
    position: sticky;
    top: calc(var(--qmf-header-height, 72px) + 16px);
    height: calc(100dvh - var(--qmf-header-height, 72px) - 32px);
    border-radius: var(--hsk-radius-lg);
    border: 1px solid var(--qmf-border);
    box-shadow: var(--hsk-shadow-soft);
    animation: none;
  }

  .hsk-nav-root--active .hsk-nav:not(.hidden) {
    display: flex;
  }

  .hsk-nav-root--active .hsk-nav__toggle,
  .hsk-nav-root--active .hsk-nav__backdrop,
  .hsk-nav-root--active .hsk-nav__close {
    display: none;
  }
}
