/* ============================================================
   kubota-sales-popup.css — Sales PiP popup v2.1 (big + star badge)
   ------------------------------------------------------------
   - Desktop : fixed PiP card 296px, top-right, floating over page
   - Mobile  : video-call SELF-VIEW window (owner's brief 2026-11-01)
               — NO full-screen scrim, page stays fully visible,
               medium size, text readable, floats like your own
               camera during a call
   - Star badge top-right (12-point burst, red-orange gradient)
   - Glow halo, wiggle, LINE button, 10s countdown bar
   - z-index: header 50 / sd-bar 60  ->  popup 80 (always on top,
     but scroll-stop JS keeps it above the footer, never covering)
   ============================================================ */

.ksp-root {
  position: fixed;
  top: 86px;
  right: 18px;
  width: 296px;
  box-sizing: border-box;
  max-width: calc(100vw - 28px);
  z-index: 80;
  opacity: 0;
  transform: translateY(14px) scale(.96);
  transform-origin: top right;
  pointer-events: none;
  transition: opacity .45s cubic-bezier(.2, .8, .2, 1),
              transform .45s cubic-bezier(.2, .8, .2, 1);
  font-family: Prompt, Inter, sans-serif;
}
.ksp-root.ksp-show {
  opacity: 1;
  transform: none;
  pointer-events: auto;
}

/* mobile scrim behind the popup */
.ksp-root::before {
  content: '';
  display: none;
}

/* ---- frame ---- */
.ksp-frame {
  position: relative;
  background: #fff;
  border: 3px solid #ff7a1a;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 18px 44px rgba(10, 14, 20, .35);
  animation: ksp-glow 2.4s ease-in-out infinite;
}

/* ---- seller photo ---- */
.ksp-photo {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.ksp-photo img {
  width: 100%;
  height: 100%;
  object-fit: contain;   /* seller card shown in full, no crop */
  background: #fff;
}
.ksp-calltag {
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(8, 11, 18, .78);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .2px;
  backdrop-filter: blur(4px);
}
.ksp-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2fd46f;
  box-shadow: 0 0 0 3px rgba(47, 212, 111, .25);
  animation: ksp-pulse 1.4s ease-in-out infinite;
}

/* ---- star badge (ฟรีดาวน์) ---- */
.ksp-badge {
  position: absolute;
  top: -16px;
  right: -14px;
  z-index: 3;
  width: 76px;
  height: 76px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #ff4d00, #ff2d55);
  color: #fff;
  clip-path: polygon(50% 0%, 59% 12%, 71% 6%, 76% 19%, 90% 17%, 90% 31%, 100% 38%, 94% 50%, 100% 62%, 90% 69%, 90% 83%, 76% 81%, 71% 94%, 59% 88%, 50% 100%, 41% 88%, 29% 94%, 24% 81%, 10% 83%, 10% 69%, 0% 62%, 6% 50%, 0% 38%, 10% 31%, 10% 17%, 24% 19%, 29% 6%, 41% 12%);
  filter: drop-shadow(0 6px 14px rgba(255, 77, 0, .45));
  animation: ksp-badge-wiggle 1.8s ease-in-out infinite;
  font-family: 'Barlow Condensed', Prompt, sans-serif;
}
.ksp-badge span {
  font-weight: 800;
  font-size: 16px;
  line-height: 1.05;
  letter-spacing: .5px;
  white-space: nowrap;
}
.ksp-badge span:first-child { font-size: 18px; }

/* ---- body ---- */
.ksp-body {
  padding: 12px 12px 14px;
  background: #fff;
}
.ksp-pitch {
  margin: 0 0 10px;
  font-size: 12.5px;
  line-height: 1.55;
  color: #4a4a4a;
}
.ksp-pitch b { color: #ff5a00; }

.ksp-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 0 0 10px;
}
.ksp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 7px 10px;
  border-radius: 10px;
  background: #fff4ec;
  border: 1px solid #ffd9c0;
  font-size: 12.5px;
}
.ksp-row-k { color: #8a5a3a; font-weight: 600; white-space: nowrap; }
.ksp-row-v { color: #ff5a00; font-weight: 800; }

.ksp-name {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  color: #17222e;
}
.ksp-avatar {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #ff7a1a;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex: none;
}

.ksp-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 10px;
  border-radius: 12px;
  background: #06c755;
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  transition: filter .2s;
}
.ksp-btn:hover { filter: brightness(1.06); }
.ksp-btn svg { width: 18px; height: 18px; }

/* ---- countdown bar ---- */
.ksp-count {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: rgba(10, 14, 20, .08);
  z-index: 2;
}
.ksp-count i {
  display: block;
  height: 100%;
  width: 100%;
  background: linear-gradient(90deg, #ff8a3c, #ff4d00);
  animation: ksp-count 10s linear forwards;
}

/* ---- animations ---- */
@keyframes ksp-badge-wiggle {
  0%, 100% { transform: rotate(-6deg) scale(1); }
  50%      { transform: rotate(6deg)  scale(1.07); }
}
@keyframes ksp-glow {
  0%, 100% { box-shadow: 0 18px 44px rgba(10,14,20,.35), 0 0 0 0 rgba(255,122,26,.40); }
  50%      { box-shadow: 0 18px 44px rgba(10,14,20,.35), 0 0 0 14px rgba(255,122,26,0); }
}
@keyframes ksp-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: .45; }
}
@keyframes ksp-count {
  from { width: 100%; }
  to   { width: 0%; }
}

/* ============================================================
   Mobile ≤820px — video-call self-view window (no scrim,
   compact: ~45% width + short body — never blocks the page)
   ============================================================ */
@media (max-width: 820px) {
  /* ---- video-call self-view (owner's brief 2026-11-01):
     floats over the page like your own camera in a video call —
     NO scrim, page stays fully visible & touchable.
     COMPACT (~45% width, short body) per owner's screenshot:
     must never block the product info behind it.
     MOBILE ONLY — desktop (296px) stays untouched.
     Scroll-follow + rest above footer: unchanged. ---- */
  .ksp-root {
    top: 70px;
    right: max(14px, env(safe-area-inset-right));
    width: min(140px, 36vw, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
  }
  .ksp-root::before { display: none; } /* no page-dimming */
  .ksp-frame {
    border-width: 2px;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(10, 14, 20, .30);
  }
  .ksp-badge {
    top: -7px;
    right: -4px;
    width: 40px;
    height: 40px;
  }
  .ksp-badge span { font-size: 9px; }
  .ksp-badge span:first-child { font-size: 10px; }
  .ksp-photo { aspect-ratio: 1.12 / 1; }
  .ksp-calltag { top: 5px; left: 5px; padding: 2px 5px; font-size: 8px; gap: 4px; }
  .ksp-dot { width: 5px; height: 5px; box-shadow: 0 0 0 2px rgba(47, 212, 111, .25); }
  .ksp-body { padding: 6px 6px 8px; }
  .ksp-pitch {
    font-size: 9.5px;
    line-height: 1.4;
    margin-bottom: 5px;
    display: -webkit-box;
    -webkit-line-clamp: 2;   /* keep the card short on mobile */
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .ksp-rows { gap: 3px; margin-bottom: 5px; }
  .ksp-row { font-size: 9.5px; padding: 3px 5px; border-radius: 6px; }
  .ksp-name { font-size: 10px; gap: 5px; margin-bottom: 5px; }
  .ksp-avatar { width: 16px; height: 16px; font-size: 8px; }
  .ksp-btn { padding: 6px; gap: 5px; font-size: 10.5px; border-radius: 7px; }
  .ksp-btn svg { width: 13px; height: 13px; }
  .ksp-count { height: 3px; }
}
