
.salesmap-mascot {
  position: fixed;
  left: 0;
  top: 0;
  z-index: 6900; /* Ordinary pages: 2000; scroll hint: 6800. Critical UI also suppresses the mascot. */
  width: 72px;
  height: 72px;
  min-width: 0;
  min-height: 0;
  display: grid;
  place-items: center;
  /* Safe areas plus animation travel; drag bounds read these resolved margins once. */
  margin: calc(12px + var(--safe-top, 0px)) calc(12px + env(safe-area-inset-right, 0px))
    calc(12px + var(--safe-bottom, 0px)) calc(12px + env(safe-area-inset-left, 0px));
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  overflow: visible;
  appearance: none;
  -webkit-appearance: none;
  cursor: grab;
  touch-action: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.salesmap-mascot[hidden] { display: none !important; }

.salesmap-mascot > img {
  width: 64px;
  height: 64px;
  max-width: none;
  display: block;
  object-fit: contain;
  image-rendering: pixelated;
  -webkit-user-drag: none;
  pointer-events: none;
  transform-origin: 50% 88%;
}

.salesmap-mascot:focus-visible {
  outline: 2px solid var(--theme-primary);
  outline-offset: 2px;
}

.salesmap-mascot-cue {
  position: absolute;
  right: 0;
  top: 0;
  color: var(--theme-primary-dark);
  font: bold 11px/1 monospace;
  pointer-events: none;
  display: none;
}

.salesmap-mascot[data-state="sleep"] .salesmap-mascot-sleep,
.salesmap-mascot[data-state="celebrate"] .salesmap-mascot-celebrate { display: block; }
.salesmap-mascot[data-state="celebrate"] .salesmap-mascot-celebrate { color: var(--theme-success); }
.salesmap-mascot[data-state="idle"] > img { animation: salesmap-mascot-idle 3200ms ease-in-out infinite; }
.salesmap-mascot[data-state="sleep"] > img { animation: salesmap-mascot-sleep 4800ms ease-in-out infinite; }
.salesmap-mascot[data-state="tap"] > img { animation: salesmap-mascot-tap 600ms steps(4, end) both; }
.salesmap-mascot[data-state="happy"] > img { animation: salesmap-mascot-happy 1400ms ease-out both; }
.salesmap-mascot[data-state="celebrate"] > img { animation: salesmap-mascot-celebrate 1800ms ease-out both; }
.salesmap-mascot[data-dragging="true"] { cursor: grabbing; }
.salesmap-mascot[data-dragging="true"] > img { animation: none; }

body.app-booting .salesmap-mascot,
body:has(#loginOverlay.open) .salesmap-mascot,
body:has(#runtimePolicyOverlay:not([hidden])) .salesmap-mascot,
body:has(#messageSheet.open, #dsrDeleteSheet.open, #overnightDsrSheet.open) .salesmap-mascot,
body:has(.dsr-photo-p2p-viewer:not([hidden])) .salesmap-mascot,
body:has(dialog[open]) .salesmap-mascot,
body.map-pick-active .salesmap-mascot {
  visibility: hidden;
  pointer-events: none;
}

.salesmap-mascot[hidden] > img { animation: none; }

@keyframes salesmap-mascot-idle {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}
@keyframes salesmap-mascot-sleep {
  0%, 100% { transform: scale(1, 1); }
  50% { transform: scale(1.02, .97); }
}
@keyframes salesmap-mascot-tap {
  0%, 100% { transform: translateY(0) scale(1); }
  45% { transform: translateY(2px) scale(1.04, .9); }
  70% { transform: translateY(-4px) scale(.98, 1.02); }
}
@keyframes salesmap-mascot-happy {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  28% { transform: translateY(-5px) rotate(-4deg); }
  55% { transform: translateY(0) rotate(4deg); }
  78% { transform: translateY(-3px) rotate(-2deg); }
}
@keyframes salesmap-mascot-celebrate {
  0%, 100% { transform: translateY(0) scale(1); }
  20% { transform: translateY(-8px) scale(1.04); }
  42% { transform: translateY(0) scale(1.03, .94); }
  62% { transform: translateY(-6px) scale(1.03); }
  82% { transform: translateY(0) scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  .salesmap-mascot > img { animation: none !important; }
}

.my-mascot-details[hidden],
#selectMascotBtn[hidden] {
  display: none !important;
}

/* My Mascot is a real independent Sheet; Settings footer/content never shares its DOM. */
.my-mascot-sheet {
  font-family: var(--salesmap-ds-font-family-sans);
}

.my-mascot-content {
  display: grid;
  gap: var(--salesmap-ds-spacing-section-gap);
}

.my-mascot-switch-row {
  min-height: var(--salesmap-ds-density-touch-target);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--salesmap-ds-spacing-section-gap);
  margin: 0;
  color: var(--salesmap-ds-color-text);
}

.my-mascot-switch-label,
.my-mascot-section-title,
.my-mascot-level-value {
  font-size: var(--salesmap-ds-type-body-size);
  font-weight: var(--salesmap-ds-font-weight-semibold);
  line-height: var(--salesmap-ds-type-body-line-height);
}

.my-mascot-switch-control {
  position: relative;
  width: 44px;
  height: 26px;
  flex: 0 0 44px;
}

.my-mascot-switch-control input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.my-mascot-switch-track {
  position: absolute;
  inset: 0;
  border-radius: var(--salesmap-ds-radius-pill);
  background: var(--salesmap-ds-action-secondary-bg);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--salesmap-ds-color-text) 14%, transparent);
  pointer-events: none;
  transition: background 160ms ease;
}

.my-mascot-switch-control input:not(:checked) + .my-mascot-switch-track {
  box-shadow: inset 0 0 0 2px var(--theme-muted);
}

.my-mascot-switch-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--salesmap-ds-primitive-neutral-0);
  box-shadow: 0 1px 3px rgba(28, 38, 48, 0.28);
  transition: transform 160ms ease;
}

.my-mascot-switch-control input:checked + .my-mascot-switch-track {
  background: var(--salesmap-ds-color-primary);
}

.my-mascot-switch-control input:checked + .my-mascot-switch-track::after {
  transform: translateX(18px);
}

.my-mascot-switch-control input:focus-visible + .my-mascot-switch-track {
  outline: 2px solid var(--salesmap-ds-control-focus);
  outline-offset: 3px;
}

.my-mascot-details {
  display: grid;
  gap: var(--salesmap-ds-spacing-section-gap);
}

.my-mascot-section {
  display: grid;
  gap: var(--salesmap-ds-spacing-control-gap);
}

.my-mascot-level-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--salesmap-ds-spacing-section-gap);
}

.my-mascot-level-value {
  color: var(--salesmap-ds-color-primary);
}

.my-mascot-exp-bar {
  width: 100%;
  height: 10px;
  border-radius: var(--salesmap-ds-radius-pill);
  overflow: hidden;
  background: color-mix(in srgb, var(--salesmap-ds-color-primary) 14%, var(--salesmap-ds-color-surface));
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--salesmap-ds-color-primary) 10%, transparent);
}

.my-mascot-exp-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: var(--salesmap-ds-color-primary);
}

.my-mascot-collection-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: var(--salesmap-ds-spacing-control-gap);
}

.my-mascot-collection-cell {
  aspect-ratio: 1;
  min-width: 0;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid rgba(83, 51, 24, 0.32);
  border-radius: var(--salesmap-ds-radius-lg);
  background: linear-gradient(180deg, #c89761 0%, #9b6738 100%);
  box-shadow: inset 0 1px 0 rgba(255, 247, 229, 0.2);
  overflow: hidden;
}

button.my-mascot-collection-cell {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.my-mascot-collection-owned[aria-pressed="true"] {
  border-color: #6f4725;
  box-shadow:
    0 0 0 2px #6f4725,
    inset 0 1px 0 rgba(255, 247, 229, 0.2);
}

.my-mascot-collection-owned img {
  width: min(60px, 96%);
  height: auto;
  display: block;
  image-rendering: pixelated;
  transform-origin: center bottom;
  animation: my-mascot-owned-preview 1.35s ease-in-out infinite;
}

@keyframes my-mascot-owned-preview {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.04); }
}

.my-mascot-question-mark {
  width: 4px;
  height: 4px;
  background: #fff0d1;
  transform: translate(-8px, -12px);
  box-shadow:
    4px 0 #fff0d1, 8px 0 #fff0d1,
    -4px 4px #fff0d1, 12px 4px #fff0d1,
    12px 8px #fff0d1,
    8px 12px #fff0d1,
    4px 16px #fff0d1,
    4px 24px #fff0d1;
  filter: drop-shadow(1px 1px 0 #6f4725);
}

.my-mascot-actions {
  margin-top: calc(var(--salesmap-ds-spacing-section-gap) + var(--salesmap-ds-spacing-control-gap));
}

@media (prefers-reduced-motion: reduce) {
  .my-mascot-collection-owned img { animation: none !important; }
}

