﻿/* ===========================================
   EQ Ninjas — Badges (fit exactly 6 in view, no scroll)
   =========================================== */

/* Fluid tokens */
:root{
  --ink:#0f172a; --body:#475569; --bg:#fff; --shadow: rgba(255, 211, 44, 0.97);
  --accent:#ffec0b; --focus:#60a5fa;

  /* Base (comfortable devices) */
  --gap: clamp(6px,1.2vmin,12px);
  --radius: clamp(10px,1.6vmin,14px);
  --pad-x: clamp(8px,2vmin,14px);
  --pad-y: clamp(6px,1.6vmin,10px);
  --bar-h: clamp(3px,.6vmin,6px);
  --medal: clamp(32px,9vmin,68px);

  --title: clamp(1rem,2.2vmin,1.25rem);
  --sub:   clamp(.85rem,1.8vmin,.95rem);
  --name:  clamp(.95rem,2.1vmin,1.05rem);
  --desc:  clamp(.8rem,1.8vmin,.9rem);
  --meta:  clamp(.72rem,1.6vmin,.82rem);

  --safe-bottom: calc(env(safe-area-inset-bottom,0px) + clamp(8px,2vmin,20px));
}

/* Checkmark */
.wm-check{
  position:absolute; top:6px; right:6px; width:20px; height:20px;
  display:grid; place-items:center; background:#10b981; border-radius:999px;
  font-size:.9rem; line-height:1; box-shadow:0 2px 6px rgba(0,0,0,.18);
  user-select:none; pointer-events:none;
}

/* Medal */
.bdg-medal{
  position:relative; width:var(--medal); height:var(--medal);
  display:grid; place-items:center; border-radius:999px; flex:0 0 auto;
  margin: auto;
}
.bdg-img{
  width:82%; height:82%; object-fit:contain;
}
.locked .bdg-img{
  filter: grayscale(1) opacity(.9) drop-shadow(0 1px 1px rgba(0,0,0,.06));
}

/* Lock */
.bdg-lock{
  position:absolute;
  bottom: 5px;
  right: -13px;
  font-size:.85rem; background:#0f172a; color:#fff;
  border-radius:999px; padding:2px 6px; box-shadow:0 3px 10px rgba(0,0,0,.18);
}

/* Info */
.bdg-info{
  min-width:0; display:grid; gap: clamp(2px,.6vmin,4px); /* flexible text stack */

  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  text-align: center;
  background: inherit;
  border-radius: 8px;
  padding: 1.5px 3px;
}
.map-item-edge-left .bdg-info{
  transform: translateX(-38%);
}
.map-item-edge-right .bdg-info{
  transform: translateX(-62%);
}
.bdg-label{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:2px;
  min-width:0;
}
.bdg-order{
  width:.95rem;
  height:.95rem;
  display:inline-grid;
  place-items:center;
  flex:0 0 auto;
  border-radius:999px;
  background:#ffffff;
  color:#0f172a;
  border:1px solid rgba(15,23,42,.18);
  box-shadow:0 1px 3px rgba(0,0,0,.16);
  font-size:.64rem;
  font-weight:900;
  line-height:1;
}
.bdg-name{
  margin:0; font-weight:800; color:var(--ink); font-size:var(--name);
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}
.bdg-desc{
  margin:0; color:var(--body); line-height:1.2; font-size:var(--desc);
  display:-webkit-box; -webkit-box-orient:vertical; -webkit-line-clamp:2; overflow:hidden;
}
.bdg-progress{
  margin-top: clamp(2px,.5vmin,4px);
  width:100%; height:var(--bar-h); background:#e6eef7;
  border-radius:999px; overflow:hidden;
}
.bdg-progress-bar{
  height:100%; background:var(--accent); border-radius:999px; transition:width .2s ease;
}
.bdg-progress-label{
  font-size:var(--meta); color:#0f172a; opacity:.8;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* Pulse (no scale to avoid clipping in fixed rows) */
.bdg-card.pulse{
  animation: bdgPulse 1.2s ease-out infinite;
  box-shadow:
    0 0 0 4px color-mix(in srgb, var(--accent) 35%, transparent),
    0 8px 20px rgba(0,0,0,.18);
  transform: none;
  border-color: var(--accent);
}
@keyframes bdgPulse{
  0%{   box-shadow:0 0 0 0   color-mix(in srgb, var(--accent) 75%, transparent); }
  70%{  box-shadow:0 0 0 35px color-mix(in srgb, var(--accent) 0%,  transparent); }
  100%{ box-shadow:0 0 0 0   color-mix(in srgb, var(--accent) 0%,  transparent); }
}

/* Motion reduction */
@media (prefers-reduced-motion: reduce){
  .bdg-card,.bdg-progress-bar{ transition:none!important; }
  .bdg-card.pulse{ animation:none!important; }
}

/* =========================================================
   COMPACT "FIT MODE" — progressively shrink on short heights
   ========================================================= */

/* Step 1: hide secondary text (subtitle, desc, progress label) */


/* Step 2: tighten tokens */
@media (max-height: 700px){
  :root{
    --gap: 6px;
    --pad-x: 8px;
    --pad-y: 6px;
    --medal: 56px;
    --title: 1rem;
    --name: .95rem;
    --meta: .74rem;
  }
  .bdg-card{ box-shadow:0 4px 12px var(--shadow); }
}

/* Step 3: extra compact for small phones */
@media (max-height: 660px){
  :root{
    --gap: 5px;
    --pad-x: 6px;
    --pad-y: 5px;
    --medal: 48px;
    --title: .95rem;
    --name: .9rem;
    --bar-h: 3px;
  }
  .bdg-logo{ width:72%; max-width:260px; }
}

/* Step 4: extreme compact (last resort to prevent overlap) */
@media (max-height: 600px){
  :root{
    --gap: 4px;
    --pad-x: 6px;
    --pad-y: 4px;
    --medal: 42px;
    --title: .9rem;
    --name: .85rem;
  }
  .wm-check{ width:18px; height:18px; font-size:.8rem; }
  .bdg-order{ width:.88rem; height:.88rem; font-size:.58rem; }
  .bdg-lock{ font-size:.75rem; padding:2px 5px; }
}

/* Keep the top row positioned */
.bdg-hero-top {
    position: relative;
}

.world-map-badge-bar {
    min-height: 0;
    height: clamp(54px, 9svh, 68px);
    padding: 4px 10px calc(env(safe-area-inset-bottom, 0px) + 4px) !important;
    gap: clamp(8px, 3vw, 18px);
}

.world-map-badge-button {
    display: grid;
    place-items: center;
    flex: 1 1 0;
    min-width: 0;
    height: 100%;
    padding: 2px !important;
}

.world-map-badge-button > img {
    width: auto;
    max-width: 100%;
    height: auto;
    max-height: clamp(38px, 7svh, 50px);
    object-fit: contain;
}

.workbook-email-button {
    position: absolute;
    top: clamp(8px, 1.8vmin, 14px);
    right: clamp(8px, 2.2vmin, 16px);
    z-index: 5;
    min-height: clamp(44px, 10vmin, 58px);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(7px, 1.8vmin, 11px);
    width: auto;
    padding: 7px clamp(13px, 3.2vmin, 20px);
    margin: 0;
    box-sizing: border-box;
    border: 2px solid rgba(202, 213, 225, .95);
    border-radius: 13px;
    background: rgba(255, 255, 255, .94);
    color: #07152e;
    box-shadow: 0 4px 11px rgba(15, 23, 42, .22), inset 0 1px 0 rgba(255, 255, 255, .9);
    font: inherit;
    line-height: 1;
    cursor: pointer;
    appearance: none;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.workbook-email-icon {
    width: clamp(22px, 5.8vmin, 30px);
    height: clamp(22px, 5.8vmin, 30px);
    flex: 0 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.85;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.workbook-email-copy {
    display: block;
    white-space: nowrap;
    font-size: clamp(.82rem, 3.2vmin, 1.05rem);
    font-weight: 900;
    letter-spacing: -.015em;
}

.workbook-email-button:hover,
.workbook-email-button:focus-visible {
    background: #fff;
    box-shadow: 0 5px 14px rgba(15, 23, 42, .32);
    transform: translateY(-1px);
}

.workbook-email-button:focus-visible {
    outline: 3px solid rgba(37, 99, 235, .88);
    outline-offset: 2px;
}

.workbook-email-button:disabled {
    cursor: wait;
    opacity: .72;
    transform: none;
}

/* Belt printable delivery dialog */
.swal2-container.workbook-delivery-modal-container {
    padding: clamp(14px, 4vmin, 30px);
    background: rgba(3, 18, 39, .46) !important;
    -webkit-backdrop-filter: blur(6px);
    backdrop-filter: blur(6px);
}

.swal2-popup.workbook-delivery-modal {
    width: min(calc(100% - 8px), 540px);
    padding: clamp(32px, 7vmin, 54px) clamp(24px, 6vmin, 44px) clamp(22px, 5vmin, 36px);
    border: 1px solid rgba(255, 255, 255, .94);
    border-radius: clamp(24px, 6vmin, 32px);
    overflow: hidden;
    color: #07152e;
    background-color: #fff;
    background-image:
        radial-gradient(circle at -1% 104%, #edf8ff 0 48px, transparent 49px),
        radial-gradient(circle at 101% 104%, #edf8ff 0 55px, transparent 56px),
        radial-gradient(circle at 7% 105%, #e5f4ff 0 35px, transparent 36px),
        radial-gradient(circle at 93% 105%, #e5f4ff 0 38px, transparent 39px);
    box-shadow: 0 24px 70px rgba(2, 12, 27, .34);
}

.workbook-delivery-modal-content.swal2-html-container {
    z-index: 1;
    margin: 0;
    padding: 0;
    color: inherit;
    overflow: visible;
}

.workbook-delivery-illustration {
    position: relative;
    width: clamp(130px, 33vmin, 168px);
    height: clamp(130px, 33vmin, 168px);
    margin: 0 auto clamp(18px, 4vmin, 28px);
    color: #548bc4;
}

.workbook-delivery-illustration > svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.workbook-delivery-illustration-halo {
    fill: #e9f6ff;
    stroke: #d7edff;
    stroke-width: 8;
}

.workbook-delivery-illustration-envelope,
.workbook-delivery-illustration-paper {
    fill: #fff;
    stroke: currentColor;
    stroke-width: 5;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.workbook-delivery-illustration-paper {
    stroke-width: 4.5;
}

.workbook-delivery-sparkle {
    position: absolute;
    font-size: clamp(18px, 4.5vmin, 25px);
    line-height: 1;
    color: #ffc400;
    text-shadow: 0 1px 1px rgba(128, 81, 0, .08);
}

.workbook-delivery-sparkle.sparkle-one { top: 32%; left: -1%; }
.workbook-delivery-sparkle.sparkle-two { top: 59%; left: 2%; color: #8acb67; font-size: clamp(13px, 3.5vmin, 19px); }
.workbook-delivery-sparkle.sparkle-three { top: 39%; right: -1%; color: #68abe4; font-size: clamp(13px, 3.5vmin, 19px); }
.workbook-delivery-sparkle.sparkle-four { top: 55%; right: 2%; font-size: clamp(10px, 3vmin, 15px); }

.workbook-delivery-title {
    margin: 0;
    color: #07152e;
    font-family: inherit;
    font-size: clamp(2rem, 8vmin, 3rem);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -.035em;
}

.workbook-delivery-description {
    max-width: 440px;
    margin: clamp(18px, 4.5vmin, 28px) auto 0;
    color: #515761;
    font-size: clamp(1rem, 4vmin, 1.35rem);
    font-weight: 500;
    line-height: 1.42;
}

.workbook-delivery-close.swal2-close {
    top: clamp(15px, 4vmin, 24px);
    right: clamp(15px, 4vmin, 24px);
    width: clamp(42px, 10vmin, 54px);
    height: clamp(42px, 10vmin, 54px);
    border: 4px solid #d4dae2;
    border-radius: 50%;
    color: #bdc7d3;
    font-size: clamp(2rem, 8vmin, 2.8rem);
    font-weight: 400;
    line-height: .85;
    transition: border-color .15s ease, color .15s ease, background .15s ease;
}

.workbook-delivery-close.swal2-close:hover,
.workbook-delivery-close.swal2-close:focus-visible {
    border-color: #99a8b8;
    color: #718096;
    background: #f4f8fb;
}

.workbook-delivery-actions.swal2-actions {
    z-index: 1;
    display: grid !important;
    grid-template-columns: minmax(0, .9fr) minmax(0, 1.18fr);
    gap: clamp(11px, 3vmin, 17px);
    width: 100%;
    margin: clamp(24px, 6vmin, 38px) 0 0;
}

.workbook-delivery-actions .swal2-confirm,
.workbook-delivery-actions .swal2-cancel {
    min-width: 0;
    min-height: clamp(56px, 13vmin, 68px);
    margin: 0;
    padding: 10px clamp(12px, 3vmin, 22px);
    border-radius: clamp(15px, 4vmin, 20px);
    font: inherit;
    font-size: clamp(1rem, 4.2vmin, 1.35rem);
    font-weight: 850;
    line-height: 1.1;
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, background .15s ease;
}

.workbook-delivery-cancel.swal2-cancel {
    border: 3px solid #68a4df;
    color: #07152e;
    background: rgba(255, 255, 255, .9);
    box-shadow: 0 3px 7px rgba(15, 23, 42, .14);
}

.workbook-delivery-send.swal2-confirm {
    border: 3px solid #5f9de2;
    color: #fff;
    background: linear-gradient(135deg, #087fe6, #006bd1);
    box-shadow: 0 4px 9px rgba(0, 91, 181, .28), inset 0 0 0 1px rgba(255, 255, 255, .45);
}

.workbook-delivery-actions .swal2-confirm:hover,
.workbook-delivery-actions .swal2-cancel:hover,
.workbook-delivery-actions .swal2-confirm:focus-visible,
.workbook-delivery-actions .swal2-cancel:focus-visible {
    transform: translateY(-1px);
    box-shadow: 0 7px 14px rgba(15, 23, 42, .2);
}

.workbook-delivery-actions .swal2-confirm:focus-visible,
.workbook-delivery-actions .swal2-cancel:focus-visible {
    outline: 3px solid rgba(255, 196, 0, .82);
    outline-offset: 3px;
}

.workbook-delivery-send-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: clamp(8px, 2.4vmin, 13px);
    white-space: nowrap;
}

.workbook-delivery-send-label svg {
    width: clamp(23px, 6vmin, 31px);
    height: clamp(23px, 6vmin, 31px);
    fill: currentColor;
    stroke: #fff;
    stroke-width: 1.7;
    stroke-linecap: round;
    stroke-linejoin: round;
    transform: rotate(-4deg);
}

@media (max-width: 360px) {
    .swal2-popup.workbook-delivery-modal {
        padding-inline: 18px;
    }

    .workbook-delivery-actions .swal2-confirm,
    .workbook-delivery-actions .swal2-cancel {
        padding-inline: 8px;
        font-size: .94rem;
    }
}

/* Back to Belts button (top-left) */
.belts-button-hero {
    position: absolute;
    left: 16px;
    top: 16px;
    padding: 8px 12px;
    border-radius: 999px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    line-height: 1;
    background: rgba(255,255,255,0.9);
    color: #0f172a; /* dark text */
    border: 1px solid rgba(15,23,42,0.1);
    box-shadow: 0 1px 2px rgba(15,23,42,0.06);
    z-index: 2;
}

    .belts-button-hero:hover {
        background: #ffffff;
        box-shadow: 0 4px 12px rgba(15,23,42,0.12);
    }
