/* Hobbywrld loyalty bar — Naruto ranks. Dark-gallery palette, desktop + mobile. */
:root {
  --khc-loy-cyan: #22d3ee;
  --khc-loy-gold: #f59e0b;
  --khc-loy-bg: #12141c;
  --khc-loy-bg2: #0c0d13;
  --khc-loy-line: #2a2e3d;
  --khc-loy-txt: #e7e9f0;
  --khc-loy-dim: #9aa0b4;
}

/* ───────────────── full bar (cart + checkout) ───────────────── */
.khc-loy {
  background: linear-gradient(180deg, var(--khc-loy-bg), var(--khc-loy-bg2));
  border: 1px solid var(--khc-loy-line);
  border-radius: 14px;
  padding: 16px 18px 16px;
  margin: 0 0 18px;
  color: var(--khc-loy-txt);
  box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
}
.khc-loy__head { display: flex; align-items: center; justify-content: space-between; gap: 6px 12px; margin-bottom: 16px; flex-wrap: wrap; }
.khc-loy__title { font-weight: 700; font-size: 16px; letter-spacing: .3px; }
.khc-loy__badge {
  font-size: 12.5px; font-weight: 600; color: #04222a;
  background: linear-gradient(90deg, var(--khc-loy-cyan), #67e8f9);
  padding: 4px 12px; border-radius: 999px; white-space: normal; max-width: 100%;
}

/* milestone row: equal flex columns, never overflow */
.khc-loy__ranks { display: flex; gap: 6px; margin-bottom: 16px; }
.khc-loy__rank { flex: 1 1 0; min-width: 0; text-align: center; }
.khc-loy__icon {
  width: 42px; height: 42px; margin: 0 auto 6px; border-radius: 50%;
  background: #1c1f2b; border: 2px solid var(--khc-loy-line);
  display: flex; align-items: center; justify-content: center; overflow: hidden;
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
.khc-loy__art { width: 100%; height: 100%; object-fit: cover; }
.khc-loy__swirl::before { content: '🌀'; font-size: 20px; }
.khc-loy__rank.is-reached .khc-loy__icon { border-color: var(--khc-loy-cyan); }
.khc-loy__rank.is-current .khc-loy__icon { border-color: var(--khc-loy-gold); box-shadow: 0 0 0 4px rgba(245, 158, 11, .2); transform: scale(1.1); }
.khc-loy__rname { font-size: 12px; font-weight: 600; line-height: 1.15; overflow-wrap: anywhere; }
.khc-loy__rank.is-reached .khc-loy__rname { color: var(--khc-loy-cyan); }
.khc-loy__rank.is-current .khc-loy__rname { color: var(--khc-loy-gold); }
.khc-loy__rperk { font-size: 10.5px; color: var(--khc-loy-dim); line-height: 1.2; margin-top: 1px; }

/* current-step progress bar (full width, fills within the current step) */
.khc-loy__ptrack { height: 10px; background: #1c1f2b; border-radius: 999px; overflow: hidden; margin-bottom: 10px; }
.khc-loy__pfill {
  height: 100%; border-radius: 999px; min-width: 2px;
  background: linear-gradient(90deg, var(--khc-loy-cyan), var(--khc-loy-gold));
  box-shadow: 0 0 12px rgba(34, 211, 238, .5);
  transition: width .8s cubic-bezier(.2, .8, .2, 1);
}
.khc-loy__msg { font-size: 14px; color: var(--khc-loy-txt); text-align: center; }
.khc-loy__msg b { color: var(--khc-loy-gold); }
.khc-loy__msg--max { color: var(--khc-loy-gold); font-weight: 700; }

@media (max-width: 600px) {
  .khc-loy { padding: 13px 13px 14px; }
  .khc-loy__ranks { gap: 4px; margin-bottom: 14px; }
  .khc-loy__icon { width: 36px; height: 36px; }
  .khc-loy__swirl::before { font-size: 17px; }
  .khc-loy__rname { font-size: 11px; }
  .khc-loy__rperk { font-size: 9.5px; }
  .khc-loy__msg { font-size: 13px; }
  .khc-loy__badge { font-size: 11px; }
  .khc-loy__title { font-size: 15px; }
}

/* ───────────────── inside the add-to-cart popup (compact mini strip) ───────────────── */
.khc-loy-modal:empty { display: none; }
.khc-loy-modal { padding: 8px 16px 2px; }
.khc-loy-modal .khc-loy-mini__in {
  background: linear-gradient(180deg, var(--khc-loy-bg), var(--khc-loy-bg2));
  border: 1px solid var(--khc-loy-line); border-radius: 12px;
  padding: 9px 14px; max-width: none; margin: 0;
  flex-wrap: wrap; gap: 6px 10px; row-gap: 8px;
}
.khc-loy-modal .khc-loy-mini__rank { order: 1; }
.khc-loy-modal .khc-loy-mini__msg { order: 2; white-space: normal; margin-left: auto; }
.khc-loy-modal .khc-loy-mini__bar { order: 3; flex: 1 1 100%; height: 6px; }
@media (max-width: 600px) { .khc-loy-modal { padding: 8px 12px 2px; } }

/* ───────────────── mini strip (all pages except cart/checkout) ───────────────── */
.khc-loy-mini {
  background: var(--khc-loy-bg2); border-bottom: 1px solid var(--khc-loy-line);
  color: var(--khc-loy-txt); font-size: 13px;
}
.khc-loy-mini[hidden] { display: none; }
.khc-loy-mini__in {
  max-width: 1320px; margin: 0 auto; padding: 7px 16px;
  display: flex; align-items: center; gap: 12px; flex-wrap: nowrap;
}
.khc-loy-mini__rank { font-weight: 700; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.khc-loy-mini__rank img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
.khc-loy-mini__bar { flex: 1 1 auto; height: 5px; background: #1c1f2b; border-radius: 999px; min-width: 40px; overflow: hidden; }
.khc-loy-mini__fill { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--khc-loy-cyan), var(--khc-loy-gold)); transition: width .8s ease; }
.khc-loy-mini__msg { color: var(--khc-loy-dim); white-space: nowrap; }
.khc-loy-mini__msg b { color: var(--khc-loy-gold); }
@media (max-width: 600px) {
  .khc-loy-mini { font-size: 12px; }
  .khc-loy-mini__in { padding: 6px 12px; gap: 8px; }
  .khc-loy-mini__rank img { width: 18px; height: 18px; }
}

/* ───────────────── congrats modal + confetti ───────────────── */
.khc-loy-congrats {
  position: fixed; inset: 0; z-index: 3200; display: flex; align-items: center; justify-content: center;
  background: rgba(4, 6, 12, .72); opacity: 0; transition: opacity .3s; padding: 16px;
}
.khc-loy-congrats.is-open { opacity: 1; }
.khc-loy-congrats__card {
  position: relative; width: 360px; max-width: 100%; text-align: center;
  background: linear-gradient(180deg, #161925, #0c0d13);
  border: 1px solid var(--khc-loy-gold); border-radius: 18px; padding: 26px 22px 22px;
  color: var(--khc-loy-txt); transform: scale(.85); transition: transform .3s cubic-bezier(.2, 1.2, .3, 1);
  box-shadow: 0 18px 60px rgba(0, 0, 0, .6);
}
.khc-loy-congrats.is-open .khc-loy-congrats__card { transform: scale(1); }
.khc-loy-congrats__x { position: absolute; top: 8px; right: 12px; background: none; border: 0; color: var(--khc-loy-dim); font-size: 24px; line-height: 1; cursor: pointer; }
.khc-loy-congrats__art { width: 130px; height: 130px; object-fit: cover; border-radius: 50%; border: 3px solid var(--khc-loy-gold); margin-bottom: 12px; }
.khc-loy-congrats__swirl { font-size: 72px; margin-bottom: 8px; }
.khc-loy-congrats__rank { font-size: 24px; font-weight: 800; letter-spacing: .5px; color: var(--khc-loy-gold); margin-bottom: 8px; }
.khc-loy-congrats__text { font-size: 15px; color: var(--khc-loy-txt); margin-bottom: 18px; line-height: 1.45; }
.khc-loy-congrats__ok {
  background: linear-gradient(90deg, var(--khc-loy-cyan), #67e8f9); color: #04222a; font-weight: 700;
  border: 0; border-radius: 999px; padding: 9px 28px; cursor: pointer; font-size: 15px;
}
.khc-loy-confetti { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.khc-loy-confetti i {
  position: absolute; top: -14px; width: 9px; height: 14px; border-radius: 2px;
  animation: khcConfetti linear forwards;
}
@keyframes khcConfetti {
  0% { transform: translateY(-10px) rotate(0); opacity: 1; }
  100% { transform: translateY(102vh) rotate(540deg); opacity: .9; }
}
@media (prefers-reduced-motion: reduce) {
  .khc-loy__fill, .khc-loy-mini__fill { transition: none; }
  .khc-loy-confetti { display: none; }
}
