/* ==========================================================================
   DesignBookmark Motion Layer (db-motion.css)
   ウマ娘LP (uma-landing.html) & ポータルサイト (uma.html / keiba.html) 共通
   https://designbookmark.com/motion 準拠のマイクロインタラクション層
   ========================================================================== */

:root {
  --dbm-spring: cubic-bezier(0.22, 1.28, 0.36, 1);
  --dbm-ease: cubic-bezier(0.16, 1, 0.3, 1);
  --dbm-accent: #059669;
  --dbm-accent-soft: rgba(5, 150, 105, 0.14);
  --dbm-glow: rgba(16, 185, 129, 0.25);
}

/* ---- 1. Top Scroll Progress Bar ---- */
#dbm-scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2.5px;
  width: 100%;
  transform-origin: 0 50%;
  transform: scaleX(0);
  background: linear-gradient(90deg, #059669, #0d9488, #0284c7, #f59e0b);
  z-index: 99990;
  pointer-events: none;
  opacity: 0.92;
  transition: opacity 0.2s ease;
}

/* ---- 2. Tab Pill / Segmented Control Sliding Indicator ---- */
[data-dbm-tab-container] {
  position: relative;
}

.dbm-tab-pill-indicator {
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 999px;
  background: rgba(5, 150, 105, 0.12);
  border: 1px solid rgba(5, 150, 105, 0.28);
  box-shadow: 0 2px 8px -2px rgba(5, 150, 105, 0.18);
  pointer-events: none;
  z-index: 0;
  transition:
    transform 0.42s var(--dbm-spring),
    width 0.38s var(--dbm-spring),
    height 0.32s var(--dbm-ease),
    opacity 0.2s ease;
  opacity: 0;
}

.dbm-tab-pill-indicator.is-visible {
  opacity: 1;
}

.dbm-tab-pill-indicator.is-underline {
  border-radius: 3px 3px 0 0;
  background: linear-gradient(90deg, #059669, #0d9488);
  border: none;
  box-shadow: 0 -2px 10px rgba(5, 150, 105, 0.35);
}

[data-dbm-tab-container] .sandbox-tab-btn,
[data-dbm-tab-container] .lp-wiki-cat-pill,
[data-dbm-tab-container] .gnav-item,
[data-dbm-tab-container] .sub-nav-btn,
[data-dbm-tab-container] .gdb-tree-btn {
  position: relative;
  z-index: 1;
}

/* ---- 3. Magnetic Button (LP CTA Only) & Tactile Press ---- */
.dbm-magnetic {
  will-change: transform;
  transition:
    transform 0.32s var(--dbm-spring),
    box-shadow 0.28s var(--dbm-ease),
    filter 0.2s ease;
}

.dbm-magnetic:active {
  transform: translate3d(var(--dbm-mx, 0px), var(--dbm-my, 0px), 0) scale(0.96) !important;
  transition-duration: 0.1s;
}

/* Portal utility buttons stay fixed in position; only subtle tactile press */
.btn:not(.btn-xs):active {
  transform: scale(0.97);
  transition: transform 0.12s ease;
}

/* ---- 4. Roll Links (Nav Hover Vertical Roll) ---- */
.dbm-roll-link {
  position: relative;
  display: inline-flex !important;
  align-items: center;
  overflow: hidden;
  vertical-align: middle;
}

.dbm-roll-inner {
  display: inline-flex;
  flex-direction: column;
  height: 1.35em;
  line-height: 1.35em;
  transition: transform 0.36s var(--dbm-spring);
}

.dbm-roll-link:hover .dbm-roll-inner,
.dbm-roll-link:focus-visible .dbm-roll-inner {
  transform: translateY(-1.35em);
}

.dbm-roll-clone {
  color: var(--dbm-accent);
  font-weight: 700;
}

/* ---- 5. Spotlight Glare & Card Elevation ---- */
.dbm-spotlight-card {
  position: relative;
  overflow: hidden;
  transition:
    transform 0.28s var(--dbm-ease),
    box-shadow 0.28s var(--dbm-ease),
    border-color 0.22s ease;
}

.dbm-spotlight-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  opacity: 0;
  background: radial-gradient(
    300px circle at var(--dbm-gx, 50%) var(--dbm-gy, 50%),
    rgba(16, 185, 129, 0.12),
    rgba(14, 165, 233, 0.05) 40%,
    transparent 75%
  );
  transition: opacity 0.24s ease;
  z-index: 2;
}

.dbm-spotlight-card:hover::after {
  opacity: 1;
}

/* Lift on hover only for LP showcase cards, keep Portal cards steady */
.dbm-is-lp .dbm-spotlight-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 12px 28px -10px rgba(15, 23, 42, 0.14), 0 0 0 1px rgba(5, 150, 105, 0.2);
}

/* ---- 6. Springy Inputs ---- */
input[type="text"].dbm-spring-input,
input[type="search"].dbm-spring-input,
textarea.dbm-spring-input,
select.dbm-spring-input {
  transition:
    box-shadow 0.22s var(--dbm-ease),
    border-color 0.2s ease;
}

input[type="text"].dbm-spring-input:focus,
input[type="search"].dbm-spring-input:focus,
textarea.dbm-spring-input:focus,
select.dbm-spring-input:focus {
  box-shadow: 0 0 0 3px var(--dbm-glow);
  border-color: var(--dbm-accent) !important;
}

/* ---- 7. Like Burst Particles ---- */
.dbm-burst-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 99995;
  overflow: hidden;
}

.dbm-particle {
  position: fixed;
  pointer-events: none;
  font-size: 13px;
  line-height: 1;
  user-select: none;
  will-change: transform, opacity;
}

.dbm-like-pop {
  animation: dbmLikePop 0.44s var(--dbm-spring);
}

@keyframes dbmLikePop {
  0%   { transform: scale(1); }
  35%  { transform: scale(1.16); }
  70%  { transform: scale(0.96); }
  100% { transform: scale(1); }
}

/* ---- 8. Copy Button Floating Feedback Pill ---- */
.dbm-copy-toast {
  position: fixed;
  pointer-events: none;
  z-index: 99996;
  background: #065f46;
  color: #ecfdf5;
  font-size: 11.5px;
  font-weight: 700;
  padding: 5px 11px;
  border-radius: 999px;
  box-shadow: 0 8px 20px -4px rgba(6, 95, 70, 0.45);
  display: inline-flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
  transform: translate(-50%, -100%) scale(0.88);
  opacity: 0;
  transition: transform 0.3s var(--dbm-spring), opacity 0.22s ease;
}

.dbm-copy-toast.is-error {
  background: #991b1b;
  color: #fef2f2;
  box-shadow: 0 8px 20px -4px rgba(153, 27, 27, 0.45);
}

.dbm-copy-toast.is-shown {
  transform: translate(-50%, calc(-100% - 8px)) scale(1);
  opacity: 1;
}

.dbm-copy-flash {
  box-shadow: 0 0 0 2px #10b981, 0 4px 12px rgba(16, 185, 129, 0.3) !important;
}

/* ---- 9. Morph Island Back-to-Top Pill ---- */
#dbm-morph-top {
  position: fixed;
  right: 18px;
  bottom: 22px;
  z-index: 9990;
  height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border: 1px solid rgba(5, 150, 105, 0.28);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #065f46;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-shadow: 0 10px 26px -8px rgba(15, 23, 42, 0.22);
  opacity: 0;
  transform: translateY(16px) scale(0.88);
  pointer-events: none;
  transition:
    opacity 0.26s ease,
    transform 0.38s var(--dbm-spring),
    background 0.2s ease,
    box-shadow 0.2s ease;
}

#dbm-morph-top.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

#dbm-morph-top:hover {
  background: #ecfdf5;
  transform: translateY(-2px) scale(1.03);
  box-shadow: 0 14px 30px -8px rgba(5, 150, 105, 0.28);
}

@media (max-width: 768px) {
  #dbm-morph-top {
    bottom: 72px;
    right: 12px;
    height: 34px;
    padding: 0 11px;
    font-size: 11px;
  }
}

/* ---- 10. Spring Modal Pop-in ---- */
.dbm-modal-pop {
  animation: dbmModalPop 0.24s var(--dbm-spring) both;
}

@keyframes dbmModalPop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---- Reduced Motion Safety ---- */
@media (prefers-reduced-motion: reduce) {
  #dbm-scroll-progress,
  .dbm-tab-pill-indicator,
  .dbm-magnetic,
  .dbm-roll-inner,
  .dbm-spotlight-card,
  .dbm-spotlight-card::after,
  .dbm-spring-input,
  #dbm-morph-top,
  .dbm-like-pop,
  .dbm-modal-pop,
  .btn:not(.btn-xs):active {
    transition: none !important;
    animation: none !important;
    transform: none !important;
  }
  /* Keep copy result text visible even with reduced motion */
  .dbm-copy-toast {
    transition: opacity 0.15s ease !important;
    transform: translate(-50%, calc(-100% - 8px)) !important;
  }
}
