/* =========================================================
   Hanjadari UI Polish Phase 1 — shared surfaces & buttons
   Light touch: cards, CTAs, gate, footer, mobile guards
   ========================================================= */

/* ---- Rainbow pastel theme (全站调和) ---- */
:root {
  --brand: #7c3aed;
  --brand-2: #db2777;
  --brand-soft: rgba(124, 58, 237, 0.12);
  --brand-soft-2: rgba(219, 39, 119, 0.14);
  --soft: #faf8ff;
  --line: rgba(167, 139, 250, 0.22);
  --focus: 0 0 0 4px rgba(167, 139, 250, 0.28);
  --btn-a: #60a5fa;
  --btn-b: #a78bfa;
  --btn-c: #f472b6;
  --rainbow-red: #ef4444;
  --rainbow-orange: #f97316;
  --rainbow-yellow: #eab308;
  --rainbow-green: #22c55e;
  --rainbow-cyan: #06b6d4;
  --rainbow-blue: #3b82f6;
  --rainbow-indigo: #6366f1;
  --rainbow-violet: #8b5cf6;
  --rainbow-pink: #ec4899;
}

body {
  background: linear-gradient(180deg, #fdfbff 0%, #fff9fb 45%, #f8fafc 100%);
  background-attachment: fixed;
}

/* ---- Unified buttons ---- */
.btn,
a.btn,
button.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--line, #e2e8f0);
  background: #fff;
  color: var(--text, #0f172a);
  font-family: inherit;
  font-size: 14px;
  font-weight: 800;
  line-height: 1.2;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
  transition:
    transform var(--dur, 0.18s) var(--ease, ease),
    box-shadow var(--dur, 0.18s) var(--ease, ease),
    background var(--dur, 0.18s) var(--ease, ease),
    border-color var(--dur, 0.18s) var(--ease, ease),
    color var(--dur, 0.18s) var(--ease, ease);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm, 0 6px 18px rgba(2, 6, 23, 0.08));
  border-color: rgba(2, 6, 23, 0.12);
}

.btn:disabled,
.btn[aria-disabled="true"] {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn.primary,
.btn--primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--rainbow-indigo) 0%, var(--rainbow-violet) 45%, var(--rainbow-pink) 100%);
  color: #fff;
  box-shadow: 0 10px 24px rgba(139, 92, 246, 0.28);
}

.btn.primary:hover,
.btn--primary:hover {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 45%, #db2777 100%);
  border-color: transparent;
}

.btn.secondary,
.btn--secondary {
  background: rgba(255, 255, 255, 0.85);
  border-color: rgba(167, 139, 250, 0.35);
  color: var(--text, #0f172a);
}

.btn.secondary:hover,
.btn--secondary:hover {
  background: rgba(237, 233, 254, 0.65);
  border-color: rgba(167, 139, 250, 0.45);
}

.btn.ghost,
.btn--ghost,
.btn--link {
  min-height: auto;
  padding: 6px 10px;
  border: none;
  background: transparent;
  color: var(--brand, #2563eb);
  box-shadow: none;
  font-weight: 700;
}

.btn.ghost:hover,
.btn--ghost:hover,
.btn--link:hover {
  transform: none;
  background: var(--brand-soft, rgba(37, 99, 235, 0.1));
  box-shadow: none;
}

.btn-row,
.ui-btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

/* ---- Welcome wave (顶栏彩虹跳舞字) ---- */
.topbar-welcome {
  justify-self: center;
  text-align: center;
  margin: 0;
  font-family: "Bagel Fat One", "Jua", "Gowun Dodum", sans-serif;
  font-size: clamp(22px, 3.8vw, 34px);
  font-weight: 400;
  line-height: 1.35;
  letter-spacing: 0.04em;
  padding: 2px 6px 6px;
  white-space: nowrap;
}

.topbar-welcome__char {
  display: inline-block;
  transform-origin: center bottom;
  color: var(--char-color, var(--rainbow-violet));
  -webkit-text-fill-color: var(--char-color, var(--rainbow-violet));
  -webkit-text-stroke: 0.75px color-mix(in srgb, var(--char-color, #7c3aed) 55%, #ffffff);
  paint-order: stroke fill;
  text-shadow: 0 2px 0 rgba(255, 255, 255, 0.85);
  animation: topbar-welcome-wave-a 4s ease-in-out infinite;
  animation-delay: calc(var(--wave-i, 0) * -0.15s);
  will-change: transform;
}

.topbar-welcome__char--tilt-a {
  animation-name: topbar-welcome-wave-a;
}

.topbar-welcome__char--tilt-b {
  animation-name: topbar-welcome-wave-b;
}

.topbar-welcome__char--space {
  width: 0.38em;
  animation: none;
  -webkit-text-stroke: 0;
  text-shadow: none;
}

@keyframes topbar-welcome-wave-a {
  0%,
  100% {
    transform: translateY(0.06em) rotate(0deg) scale(1);
  }
  25% {
    transform: translateY(-0.1em) rotate(-2deg) scale(1.05);
  }
  50% {
    transform: translateY(-0.36em) rotate(-4deg) scale(1.12);
  }
  75% {
    transform: translateY(-0.1em) rotate(-1deg) scale(1.05);
  }
}

@keyframes topbar-welcome-wave-b {
  0%,
  100% {
    transform: translateY(0.06em) rotate(0deg) scale(1);
  }
  25% {
    transform: translateY(-0.1em) rotate(2deg) scale(1.05);
  }
  50% {
    transform: translateY(-0.36em) rotate(4deg) scale(1.12);
  }
  75% {
    transform: translateY(-0.1em) rotate(1deg) scale(1.05);
  }
}

@media (prefers-reduced-motion: reduce) {
  .topbar-welcome__char {
    animation: none !important;
  }
}

/* ---- Unified surface cards ---- */
.ui-surface-card,
.card.ui-surface-card {
  background: #fff;
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.06);
  padding: 20px;
}

.ui-surface-card--soft {
  background: linear-gradient(180deg, #fdfbff 0%, #faf8ff 100%);
}

/* ---- Access gate (7/6급) ---- */
.ui-gate-card {
  max-width: 520px;
  margin: 16px auto 0;
  padding: 22px 20px;
  text-align: center;
  background: linear-gradient(180deg, #fff 0%, rgba(237, 233, 254, 0.35) 100%);
  border: 1px solid rgba(167, 139, 250, 0.28);
  border-radius: 16px;
  box-shadow: 0 8px 24px rgba(139, 92, 246, 0.08);
}

.ui-gate-card__title {
  margin: 0 0 8px;
  font-size: 1.05rem;
  font-weight: 900;
  color: var(--text, #0f172a);
  letter-spacing: -0.02em;
}

.ui-gate-card__lead {
  margin: 0 0 6px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text, #334155);
}

.ui-gate-card__hint {
  margin: 0 0 16px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted, #64748b);
}

.ui-gate-card__actions {
  justify-content: center;
  margin-bottom: 12px;
}

.ui-gate-card__foot {
  margin: 0;
  font-size: 13px;
  color: var(--muted, #64748b);
}

.ui-gate-card__foot a {
  color: var(--brand, #2563eb);
  font-weight: 700;
  text-decoration: underline;
}

.ui-gate-card__foot a:hover {
  text-decoration: none;
}

/* ---- Home core value strip (above hero) ---- */
.hanjadari-home .section--featureStrip {
  padding: 12px 0 0;
}

.hanjadari-home .homeFeatureStrip {
  margin: 0 0 18px;
  padding: 14px 18px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(120, 130, 255, 0.12);
  box-shadow: 0 14px 36px rgba(40, 60, 120, 0.08);
}

.hanjadari-home .homeFeatureStripLabel {
  font-size: 13px;
  font-weight: 800;
  color: #4b56a8;
  margin: 0 0 10px;
  letter-spacing: -0.02em;
}

.hanjadari-home .homeFeatureChips {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.hanjadari-home .homeFeatureChip {
  font-size: 14px;
  font-weight: 750;
  line-height: 1.35;
  padding: 9px 13px;
  border-radius: 999px;
  color: #5b21b6;
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(167, 139, 250, 0.3);
  box-shadow: 0 2px 10px rgba(139, 92, 246, 0.06);
}

@media (max-width: 768px) {
  .hanjadari-home .homeFeatureStrip {
    margin-bottom: 14px;
    padding: 12px 14px;
    border-radius: 16px;
  }

  .hanjadari-home .homeFeatureStripLabel {
    font-size: 12px;
    margin-bottom: 8px;
  }

  .hanjadari-home .homeFeatureChip {
    font-size: 13px;
    padding: 8px 11px;
  }
}

/* ---- Home level cards ---- */
.hanjadari-level-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
}

.hanjadari-level-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid rgba(167, 139, 250, 0.18);
  background: #fff;
  box-shadow: 0 8px 22px rgba(139, 92, 246, 0.06);
  text-decoration: none;
  color: inherit;
  transition:
    transform var(--dur, 0.18s) ease,
    box-shadow var(--dur, 0.18s) ease,
    border-color var(--dur, 0.18s) ease;
}

.hanjadari-level-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 32px rgba(139, 92, 246, 0.12);
  border-color: rgba(167, 139, 250, 0.42);
}

.hanjadari-level-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.hanjadari-level-card__name {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.hanjadari-level-card__badge {
  font-size: 11px;
  font-weight: 800;
  padding: 4px 8px;
  border-radius: 999px;
  line-height: 1;
}

.hanjadari-level-card__badge--free {
  color: #0d9488;
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid rgba(20, 184, 166, 0.35);
}

.hanjadari-level-card__badge--paid {
  color: #7c3aed;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(167, 139, 250, 0.4);
}

.hanjadari-level-card__desc {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted, #64748b);
  flex: 1;
}

.hanjadari-level-card__cta {
  margin-top: 4px;
  font-size: 13px;
  font-weight: 800;
  color: var(--brand, #7c3aed);
}

/* ---- Hanja sidebar grade badges ---- */
.hanja-ko-lv-badge {
  margin-left: 6px;
  font-size: 10px;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 999px;
  vertical-align: middle;
}

.hanja-ko-lv-badge--free,
.hanja-ko-lv-badge--free-preview {
  color: #0d9488;
  background: rgba(20, 184, 166, 0.12);
}

/* ---- Hanja Day video ---- */
.hanja-page .hanja-ko-day-video {
  margin: 0 0 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px dashed rgba(148, 163, 184, 0.55);
}

.hanja-page .hanja-ko-day-video__head {
  margin-bottom: 12px;
}

.hanja-page .hanja-ko-day-video__title {
  margin: 0 0 4px;
  font-size: 15px;
  font-weight: 800;
  color: #0f172a;
}

.hanja-page .hanja-ko-day-video__meta {
  margin: 0;
  font-size: 13px;
  color: #64748b;
}

.hanja-page .hanja-ko-day-video__stage {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 18px 12px;
  border-radius: 12px;
  background: linear-gradient(180deg, #f8fafc 0%, #f1f5f9 100%);
}

.hanja-page .hanja-ko-day-video__stage--ready {
  padding: 0;
  overflow: hidden;
  background: #020617;
}

.hanja-page .hanja-ko-day-video__player {
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  border: 0;
  background: #020617;
}

.hanja-page .hanja-ko-day-video__play {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: #94a3b8;
  color: #fff;
  cursor: not-allowed;
  opacity: 0.85;
}

.hanja-page .hanja-ko-day-video__play-icon {
  font-size: 18px;
  margin-left: 3px;
}

.hanja-page .hanja-ko-day-video__play--fallback {
  cursor: default;
  opacity: 0.72;
}

.hanja-page .hanja-ko-day-video__status {
  margin: 0;
  font-size: 12px;
  font-weight: 600;
  color: #64748b;
}

.hanja-page .hanja-ko-day-video--fallback .hanja-ko-day-video__status {
  font-size: 15px;
  font-weight: 850;
  color: #334155;
}

.hanja-page .hanja-ko-day-video__fallback-copy {
  margin: -2px 0 3px;
  font-size: 13px;
  color: #64748b;
}

.hanja-page .hanja-ko-day-video__continue {
  min-height: 42px;
}

.hanja-ko-lv-badge--paid {
  color: #7c3aed;
  background: rgba(139, 92, 246, 0.12);
}

.hanja-page .section-side-nav-item.hanja-ko-lv-stage.is-active {
  background: #eef2ff;
  border-color: #a5b4fc;
  color: #312e81;
  font-weight: 800;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7) inset;
}

/* ---- Hanja lesson cards spacing ---- */
.hanja-page .hanja-ko-card--lesson.hanja-ko-card--dayrow {
  padding: 14px 16px 16px;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.hanja-page .hanja-ko-grid--lesson {
  gap: 12px;
}

.hanja-page .hanja-ko-dayrow__example,
.hanja-page .hanja-ko-beg-examples {
  padding: 10px 12px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid rgba(226, 232, 240, 0.9);
}

/* ---- Pricing ---- */
.hanjadari-pricing .price-card {
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  padding: 20px;
}

.hanjadari-pricing .price-card .btn {
  width: 100%;
  margin-top: auto;
}

.hanjadari-pricing .price-free {
  border-radius: 16px;
  padding: 18px 20px;
}

.hanjadari-pricing .price-policy-links {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted, #64748b);
}

.hanjadari-pricing .price-policy-links a {
  color: var(--brand, #2563eb);
  font-weight: 600;
}

/* ---- Checkout result / my purchases ---- */
.hanjadari-checkout-result .co-card,
.hanjadari-my-purchases .auth-card,
.hanjadari-policy .auth-card {
  border-radius: 16px;
}

.hanjadari-checkout-result .co-btn,
.hanjadari-my-purchases .mp-btn {
  min-height: 44px;
  border-radius: 12px;
}

.hanjadari-my-purchases .mp-card {
  border-radius: 16px;
  padding: 16px 18px;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.04);
}

.hanjadari-my-purchases .mp-empty,
.hanjadari-my-purchases .mp-login {
  padding: 18px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid var(--line, #e2e8f0);
}

.hanjadari-my-purchases .mp-test-badge {
  font-size: 10px;
  font-weight: 700;
  color: #92400e;
  background: #fef9c3;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid #fde68a;
  vertical-align: middle;
}

/* ---- Policy ---- */
.hanjadari-policy .policy-section {
  padding: 14px 16px;
  border-radius: 14px;
  background: #fafafa;
  border: 1px solid rgba(226, 232, 240, 0.85);
}

.hanjadari-policy .policy-nav {
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line, #e2e8f0);
}

.hanjadari-policy .policy-test-note {
  background: #fffbeb;
  border: 1px solid #fde68a;
}

/* ---- Footer (lightweight) ---- */
.hanjadari-site-footer {
  margin-top: 24px;
  padding: 16px 0 20px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--muted, #64748b);
}

.hanjadari-site-footer > div:first-child {
  font-size: 13px;
}

.hanjadari-site-footer__links {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0 6px;
  margin: 6px 0;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.hanjadari-site-footer__links-label {
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: #94a3b8;
  margin-right: 2px;
}

.hanjadari-site-footer a {
  font-size: 12px;
  text-decoration: none;
}

.hanjadari-site-footer a:hover {
  text-decoration: underline;
}

.hanjadari-site-footer__biz {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0 12px;
  margin-top: 10px;
  padding-top: 10px;
  font-size: 11px;
  white-space: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
}

.hanjadari-site-footer__biz-label {
  flex-shrink: 0;
  font-weight: 700;
  color: #94a3b8;
}

.hanjadari-site-footer__biz-item {
  flex-shrink: 0;
  color: #64748b;
}

.hanjadari-site-footer__biz-item[data-preparing="1"] {
  color: #94a3b8;
  font-style: normal;
}

/* ---- Nav mobile ---- */
@media (max-width: 768px) {
  .topbar {
    gap: 10px;
  }

  nav.site-nav {
    gap: 6px;
  }

  nav.site-nav a {
    padding: 8px 11px;
    font-size: 12px;
  }

  .btn-row,
  .ui-btn-row {
    gap: 8px;
  }

  .btn,
  a.btn,
  button.btn {
    white-space: normal;
    text-align: center;
  }
}

@media (max-width: 768px) {
  .hanjadari-level-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .hanjadari-level-card {
    padding: 16px;
  }

  .hanjadari-level-card__name {
    font-size: 1.05rem;
  }

  .hanjadari-level-card__desc {
    font-size: 12px;
  }

  .hanjadari-level-card__cta {
    font-size: 12px;
  }

  .hanjadari-site-footer__links,
  .hanjadari-site-footer__biz {
    font-size: 11px;
    gap: 0 10px;
  }
}

@media (max-width: 430px) {
  .wrap {
    padding-left: 14px;
    padding-right: 14px;
  }

  .ui-gate-card__actions .btn {
    flex: 1 1 calc(50% - 8px);
    min-width: 140px;
  }

  .hanja-page .hanja-ko-dayrow {
    grid-template-columns: 1fr;
  }

  .hanjadari-pricing .price-grid {
    grid-template-columns: 1fr;
  }
}

/* Prevent horizontal overflow on small screens */
body {
  overflow-x: hidden;
}

#app,
.hanja-page,
.hanjadari-home {
  max-width: 100%;
  overflow-x: hidden;
}

/* =========================================================
   UI Polish Phase 2 — Auth / Checkout / States / Mobile detail
   ========================================================= */

/* ---- Unified state surfaces ---- */
.ui-state-card,
.ui-empty-state,
.ui-loading-state,
.ui-error-state {
  border-radius: 14px;
  padding: 16px 18px;
  line-height: 1.55;
  font-size: 14px;
}

.ui-state-card {
  background: #fff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 4px 16px rgba(15, 23, 42, 0.04);
}

.ui-empty-state {
  background: #f8fafc;
  border: 1px solid var(--line, #e2e8f0);
  color: var(--muted, #64748b);
  text-align: center;
}

.ui-empty-state__title {
  margin: 0 0 6px;
  font-size: 1rem;
  font-weight: 800;
  color: var(--text, #0f172a);
}

.ui-loading-state {
  background: #f8fafc;
  border: 1px dashed rgba(148, 163, 184, 0.55);
  color: var(--muted, #64748b);
  display: flex;
  align-items: center;
  gap: 10px;
}

.ui-loading-state::before {
  content: "";
  width: 18px;
  height: 18px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--brand, #2563eb);
  border-radius: 50%;
  animation: ui-spin 0.7s linear infinite;
  flex-shrink: 0;
}

@keyframes ui-spin {
  to {
    transform: rotate(360deg);
  }
}

.ui-error-state {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-weight: 600;
  font-size: 13px;
}

.ui-error-state a {
  color: var(--brand, #2563eb);
  font-weight: 700;
}

.ui-success-state {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  color: #047857;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
}

/* ---- Auth pages ---- */
.auth-page {
  max-width: 440px;
  margin: 0 auto;
  padding: 16px 0 40px;
}

.auth-page .auth-card {
  border-radius: 16px;
  padding: 22px 20px 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.06);
}

.auth-page .auth-form {
  gap: 16px;
}

.auth-page .auth-form input,
.auth-page .auth-form textarea,
.auth-page .auth-form select {
  min-height: 44px;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 15px;
}

.auth-page .auth-submit {
  width: 100%;
  min-height: 44px;
  margin-top: 4px;
}

.auth-page .auth-submit.btn.primary,
.auth-page button.auth-submit:not(.auth-submit--secondary) {
  border: none;
}

.auth-page .auth-submit--secondary,
.auth-page .btn.secondary.auth-submit {
  width: 100%;
  margin-top: 8px;
}

.auth-page .auth-error {
  padding: 10px 12px;
  border-radius: 12px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  font-weight: 600;
  line-height: 1.5;
}

.auth-page .auth-success,
.auth-page .auth-success.ui-success-state {
  margin: 0;
}

.auth-page .auth-footer {
  margin-top: 18px;
}

.auth-page .auth-footer .auth-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 10px;
  font-weight: 700;
}

.auth-page .auth-footer .auth-link:hover {
  background: var(--brand-soft, rgba(37, 99, 235, 0.1));
  text-decoration: none;
}

.auth-page .auth-prod-notice {
  border-radius: 12px;
  font-size: 12px;
}

/* ---- Checkout main page ---- */
.hanjadari-checkout .co-card {
  max-width: 520px;
  margin: 0 auto;
  border-radius: 16px;
}

.hanjadari-checkout .co-product-card {
  margin: 14px 0 16px;
  padding: 16px 18px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid var(--line, #e2e8f0);
}

.hanjadari-checkout .co-product-card__name {
  margin: 0 0 6px;
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.hanjadari-checkout .co-product-card__price {
  margin: 0 0 10px;
  font-size: 1.65rem;
  font-weight: 950;
  color: var(--brand, #2563eb);
}

.hanjadari-checkout .co-product-card__bullets {
  margin: 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted, #64748b);
}

.hanjadari-checkout .co-actions-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.hanjadari-checkout .co-actions-stack .btn {
  width: 100%;
}

.hanjadari-checkout .co-mock-panel {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px dashed #cbd5e1;
  background: #fafafa;
}

.hanjadari-checkout .co-mock-panel__label {
  margin: 0 0 10px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
}

.hanjadari-checkout .co-mock-panel .btn.mock-test {
  font-size: 13px;
  font-weight: 700;
  min-height: 40px;
  background: #f1f5f9;
  border: 1px solid #e2e8f0;
  color: #475569;
  box-shadow: none;
}

.hanjadari-checkout .co-mock-panel .btn.mock-test:hover {
  background: #e2e8f0;
  transform: none;
}

.hanjadari-checkout .co-badge {
  display: inline-block;
  margin-bottom: 4px;
}

.hanjadari-checkout .co-policy-row {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line, #e2e8f0);
  font-size: 13px;
  color: var(--muted, #64748b);
  line-height: 1.6;
}

.hanjadari-checkout .co-policy-row a {
  color: var(--brand, #2563eb);
  font-weight: 600;
}

.hanjadari-checkout .co-foot-nav {
  margin-top: 12px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

/* ---- Router loading / error ---- */
#app .ui-router-state {
  max-width: 480px;
  margin: 0 auto;
}

#app .ui-router-state .ui-router-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

/* ---- Top nav Phase 2 ---- */
#siteNav {
  max-width: 100%;
  overflow-x: hidden;
}

#siteNav .topbar .brand a {
  font-size: clamp(18px, 4.5vw, 24px);
  line-height: 1.2;
  font-family: "Bagel Fat One", "Jua", sans-serif;
  font-weight: 400;
  background: linear-gradient(135deg, var(--rainbow-indigo), var(--rainbow-violet), var(--rainbow-pink));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-fill-color: transparent;
}

#siteNav .topbar .brand small {
  font-size: 11px;
  color: #7c6f9a;
}

#siteNav nav.site-nav {
  border-top-color: rgba(167, 139, 250, 0.15);
}

#siteNav nav.site-nav a {
  border-color: rgba(167, 139, 250, 0.28);
  background: rgba(255, 255, 255, 0.82);
}

#siteNav nav.site-nav a.active {
  font-weight: 900;
  border-color: rgba(124, 58, 237, 0.45);
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.14), rgba(236, 72, 153, 0.12));
  box-shadow: 0 0 0 1px rgba(139, 92, 246, 0.18);
}

#siteNav .joy-auth-link,
#siteNav .joy-auth-logout,
#siteNav .joy-auth-aux {
  border-color: rgba(167, 139, 250, 0.35);
}

#siteNav .joy-auth {
  max-width: min(100%, 18rem);
}

@media (max-width: 768px) {
  #siteNav .topbar {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "brand auth"
      "welcome welcome";
    gap: 8px 10px;
  }

  #siteNav .topbar .brand {
    grid-area: brand;
  }

  #siteNav .topbar-welcome {
    grid-area: welcome;
    justify-self: stretch;
    font-size: clamp(18px, 5vw, 28px);
    padding: 4px 2px 2px;
    white-space: normal;
    line-height: 1.45;
  }

  #siteNav .joy-auth {
    max-width: min(100%, 18rem);
  }

  #siteNav .topbar .right {
    grid-area: auth;
    justify-content: flex-end;
  }

  #siteNav nav.site-nav {
    width: 100%;
    padding-top: 8px;
    border-top: 1px solid rgba(167, 139, 250, 0.15);
  }

  #siteNav .joy-auth-link,
  #siteNav .joy-auth-logout,
  #siteNav .joy-auth-aux {
    padding: 5px 8px;
    font-size: 11px;
  }

  #siteNav .joy-auth-name {
    max-width: 5.5rem;
    font-size: 11px;
  }
}

@media (max-width: 430px) {
  #siteNav nav.site-nav a {
    padding: 7px 9px;
    font-size: 11px;
  }
}

/* ---- Hanja mobile detail ---- */
@media (max-width: 768px) {
  .hanja-page.page-shell,
  .hanja-page .page-shell {
    flex-direction: column;
    gap: 12px;
    padding-left: 0;
    padding-right: 0;
  }

  .hanja-page .section-side-nav {
    width: 100%;
    flex: none;
    position: static;
    max-height: min(42vh, 320px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .hanja-page .section-main-panel {
    width: 100%;
    min-width: 0;
  }

  .hanja-page .section-main-panel-inner {
    min-width: 0;
  }

  .hanja-page .hanja-ko-dayrow__glyph {
    font-size: clamp(2rem, 14vw, 2.75rem);
    line-height: 1.1;
    overflow-wrap: anywhere;
  }

  .hanja-page .hanja-ko-dayrow__example-zh,
  .hanja-page .hanja-ko-beg-line__zh,
  .hanja-page .hanja-ko-word-zh {
    overflow-wrap: anywhere;
    word-break: keep-all;
  }

  .hanja-page .hanja-ko-toolbar,
  .hanja-page .hanja-ko-toolbar--dayrow {
    flex-wrap: wrap;
  }

  .hanja-page .ui-gate-card {
    margin-left: 0;
    margin-right: 0;
  }
}

@media (max-width: 375px) {
  .auth-page {
    padding-left: 0;
    padding-right: 0;
  }

  .ui-gate-card__actions .btn {
    flex: 1 1 100%;
    min-width: 0;
  }
}

.hanjadari-my-purchases .mp-empty,
.hanjadari-my-purchases .mp-login,
.hanjadari-my-purchases .ui-empty-state {
  text-align: left;
}

.hanjadari-policy .ui-error-state {
  margin-top: 12px;
}

/* —— Favorites (Phase 1) —— */
.hanja-main-char-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
  min-width: 0;
}

.favorite-star {
  border: none;
  background: transparent;
  font-size: 30px;
  line-height: 1;
  color: #cbd5e1;
  cursor: pointer;
  padding: 0;
  flex: 0 0 auto;
  transition: transform 0.15s ease, color 0.15s ease;
}

.favorite-star:hover {
  transform: scale(1.08);
}

.favorite-star.is-active {
  color: #ef4444;
}

.hanjadari-favorite-toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 9999;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.92);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 10px 30px rgba(15, 23, 42, 0.18);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.hanjadari-favorite-toast.is-visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 768px) {
  .hanja-main-char-row {
    gap: 8px;
  }

  .favorite-star {
    font-size: 26px;
  }
}

.hanja-page .hanja-ko-card--dayrow.is-char-target {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.22), 0 8px 22px rgba(139, 92, 246, 0.08);
}

/* —— Day quiz answer feedback —— */
.hanja-day-quiz__opt.is-wrong,
.quiz-option.is-wrong {
  background: #fecaca;
  border: 2px solid #dc2626;
  color: #7f1d1d;
}

.hanja-day-quiz__opt.is-correct,
.quiz-option.is-correct {
  background: #bbf7d0;
  border: 2px solid #16a34a;
  color: #14532d;
}

.hanja-day-quiz__feedback.is-correct,
.quiz-feedback.is-correct {
  color: #166534;
}

.hanja-day-quiz__feedback.is-wrong,
.quiz-feedback.is-wrong {
  color: #991b1b;
}

.hanja-day-quiz__next,
.quiz-next-btn {
  margin-top: 12px;
  padding: 10px 16px;
  border: none;
  border-radius: 12px;
  background: #2563eb;
  color: #fff;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
}

.hanja-day-quiz__next:hover,
.quiz-next-btn:hover {
  background: #1d4ed8;
}
