/* ========================================
   逢魔時の寄り道 - Secret Feature Styles
   ======================================== */

/* --- Fuura Cat Container --- */
.fuura-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 9999;
  cursor: pointer;
  transition: left 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              bottom 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94),
              right 0.8s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.fuura-sprite {
  display: block;
  width: 160px;
  height: auto;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  pointer-events: none;
  filter: drop-shadow(0 2px 8px rgba(0,0,0,0.25));
}

@media (min-width: 768px) {
  .fuura-sprite { width: 168px; }
}

/* Hint bounce to catch attention */
.fuura-hint {
  animation: fuura-hint-bounce 0.6s ease-out;
}

@keyframes fuura-hint-bounce {
  0%   { transform: translateY(0); }
  30%  { transform: translateY(-12px); }
  50%  { transform: translateY(-4px); }
  70%  { transform: translateY(-8px); }
  100% { transform: translateY(0); }
}

/* Tap bounce */
.fuura-tapped {
  animation: fuura-tap-bounce 0.3s ease-out;
}

@keyframes fuura-tap-bounce {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.15); }
  100% { transform: scale(1); }
}

/* Final position: center bottom */
.fuura-final {
  right: auto !important;
  left: 50% !important;
  bottom: 80px !important;
  transform: translateX(-50%) !important;
  cursor: default;
  pointer-events: none;
  transition: all 1.2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* --- Speech Bubble --- */
.fuura-bubble {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) scale(0.7);
  background: #fff;
  color: #4a4a4a;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.8rem;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: 16px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  box-shadow: 0 2px 12px rgba(0,0,0,0.12);
}

.fuura-bubble::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 6px solid transparent;
  border-top-color: #fff;
}

.fuura-bubble.visible {
  opacity: 1;
  transform: translateX(-50%) scale(1);
}

/* --- Oumagadoki Twilight Transition --- */
body.oumagadoki-transition {
  transition: background-color 2s ease;
}

body.oumagadoki-mode {
  background-color: #1a0e2e !important;
  transition: background-color 2.5s ease;
}

body.oumagadoki-mode .container {
  position: relative;
}

/* Twilight overlay that fades in */
.oumagadoki-overlay {
  position: fixed;
  inset: 0;
  z-index: 9990;
  pointer-events: none;
  opacity: 0;
  transition: opacity 2.5s ease;
  background: linear-gradient(
    180deg,
    rgba(26, 14, 46, 0.0) 0%,
    rgba(26, 14, 46, 0.3) 30%,
    rgba(120, 50, 30, 0.2) 60%,
    rgba(200, 100, 50, 0.15) 80%,
    rgba(245, 180, 100, 0.1) 100%
  );
}

body.oumagadoki-mode .oumagadoki-overlay {
  opacity: 1;
}

/* Particles (floating lights) */
.oumagadoki-particles {
  position: fixed;
  inset: 0;
  z-index: 9991;
  pointer-events: none;
  opacity: 0;
  transition: opacity 3s ease 1s;
}

body.oumagadoki-mode .oumagadoki-particles {
  opacity: 1;
}

.oumagadoki-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(245, 200, 120, 0.6);
  animation: particle-float 6s ease-in-out infinite;
}

.oumagadoki-particle:nth-child(2) { animation-delay: -1.5s; animation-duration: 7s; }
.oumagadoki-particle:nth-child(3) { animation-delay: -3s; animation-duration: 5s; }
.oumagadoki-particle:nth-child(4) { animation-delay: -4.5s; animation-duration: 8s; }
.oumagadoki-particle:nth-child(5) { animation-delay: -2s; animation-duration: 6.5s; }

@keyframes particle-float {
  0%   { transform: translateY(0) translateX(0); opacity: 0; }
  20%  { opacity: 0.8; }
  80%  { opacity: 0.6; }
  100% { transform: translateY(-100vh) translateX(30px); opacity: 0; }
}

/* --- Secret Player --- */
.secret-player-wrap {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 9998;
  display: flex;
  justify-content: center;
  padding: 0 16px 24px;
  pointer-events: none;
  opacity: 0;
  transform: translateY(30px);
  transition: opacity 0.8s ease, transform 0.8s ease;
}

.secret-player-wrap.visible {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.secret-player {
  background: rgba(20, 10, 35, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(200, 160, 100, 0.2);
  border-radius: 20px;
  padding: 20px 24px;
  max-width: 400px;
  width: 100%;
  color: #e8dcc8;
  font-family: 'Zen Maru Gothic', sans-serif;
  box-shadow: 0 8px 40px rgba(0,0,0,0.4);
}

.secret-player-title {
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  color: rgba(200, 160, 100, 0.6);
  margin-bottom: 4px;
  text-align: center;
}

.secret-player-track {
  font-size: 1.1rem;
  font-weight: 500;
  text-align: center;
  margin-bottom: 12px;
  color: #f5deb3;
}

/* Progress */
.secret-progress-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

.secret-time {
  font-size: 0.7rem;
  color: rgba(200, 160, 100, 0.5);
  min-width: 36px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.secret-progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(200, 160, 100, 0.15);
  border-radius: 2px;
  cursor: pointer;
  position: relative;
}

.secret-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #c8a064, #f5c87a);
  border-radius: 2px;
  width: 0%;
  transition: width 0.1s linear;
}

/* Controls */
.secret-controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
}

.secret-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 2px solid rgba(200, 160, 100, 0.4);
  background: rgba(200, 160, 100, 0.1);
  color: #f5deb3;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.secret-play-btn:hover {
  background: rgba(200, 160, 100, 0.2);
  border-color: rgba(200, 160, 100, 0.6);
}

.secret-play-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

/* --- Rating Section --- */
.secret-rating {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(200, 160, 100, 0.1);
  text-align: center;
  opacity: 0;
  transition: opacity 0.6s ease;
}

.secret-rating.visible {
  opacity: 1;
}

.secret-rating-label {
  font-size: 0.8rem;
  color: rgba(200, 160, 100, 0.5);
  margin-bottom: 10px;
}

.secret-rating-btns {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.secret-rating-btn {
  padding: 6px 16px;
  border-radius: 20px;
  border: 1px solid rgba(200, 160, 100, 0.25);
  background: transparent;
  color: #e8dcc8;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.8rem;
  cursor: pointer;
  transition: background 0.2s, border-color 0.2s;
}

.secret-rating-btn:hover {
  background: rgba(200, 160, 100, 0.15);
  border-color: rgba(200, 160, 100, 0.5);
}

.secret-rating-btn.selected {
  background: rgba(200, 160, 100, 0.25);
  border-color: rgba(245, 200, 120, 0.6);
  color: #f5deb3;
}

.secret-rating-thanks {
  font-size: 0.8rem;
  color: rgba(200, 160, 100, 0.6);
  margin-bottom: 8px;
  display: none;
}

.secret-rating-thanks.visible {
  display: block;
}

/* Contact & Continue links */
.secret-links {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.secret-link {
  font-size: 0.75rem;
  color: rgba(200, 160, 100, 0.5);
  text-decoration: none;
  transition: color 0.2s;
}

.secret-link:hover {
  color: #f5deb3;
}

/* --- Responsive --- */
@media (max-width: 480px) {
  .secret-player {
    border-radius: 16px 16px 0 0;
    padding: 16px;
  }
  .secret-player-wrap {
    padding: 0;
  }
  .fuura-sprite {
    width: 140px;
  }
}

/* --- Reduce motion --- */
@media (prefers-reduced-motion: reduce) {
  .fuura-hint,
  .fuura-tapped,
  .oumagadoki-particle {
    animation: none !important;
  }
  .fuura-container,
  .oumagadoki-overlay,
  .secret-player-wrap {
    transition-duration: 0.01s !important;
  }
}


/* --- Page-based secret cat quest positioning --- */
.fuura-container.fuura-round-home {
  right: min(8vw, 88px);
  bottom: auto;
  top: 190px;
}

.fuura-container.fuura-round-tracks {
  right: -118px;
  bottom: 32vh;
}

.fuura-container.fuura-round-blog {
  right: 72px;
  bottom: -24px;
}

.fuura-container.fuura-round-about {
  left: 8vw;
  right: auto;
  bottom: 32vh;
  opacity: 0.62;
  animation: fuura-about-drift 10s ease-in-out infinite alternate;
}

.fuura-container.fuura-round-contact {
  right: auto;
  left: 50%;
  bottom: 88px;
  transform: translateX(-50%);
}

.fuura-container.fuura-leaving {
  pointer-events: none;
  transition: transform 1.1s ease, opacity 1.1s ease, right 1.1s ease, left 1.1s ease;
  opacity: 0;
}

.fuura-container.fuura-leaving-right {
  transform: translateX(180px);
}

.fuura-container.fuura-leaving-left {
  transform: translateX(-180px);
}

@keyframes fuura-about-drift {
  from { transform: translateX(0); }
  to { transform: translateX(90px); }
}

.fuura-next-toast {
  position: fixed;
  right: 20px;
  bottom: 22px;
  z-index: 10000;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(34, 24, 48, 0.92);
  color: #f8e8c8;
  font-family: 'Zen Maru Gothic', sans-serif;
  font-size: 0.82rem;
  box-shadow: 0 8px 24px rgba(0,0,0,0.24);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.fuura-next-toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.fuura-next-toast a {
  color: #ffe1a3;
  text-decoration: none;
  font-weight: 700;
}

@media (max-width: 480px) {
  .fuura-container.fuura-round-home {
    right: 12px;
    top: 155px;
  }
  .fuura-container.fuura-round-tracks {
    right: -102px;
    bottom: 30vh;
  }
  .fuura-container.fuura-round-blog {
    right: 32px;
  }
  .fuura-container.fuura-round-about {
    left: 4vw;
    bottom: 28vh;
  }
  .fuura-next-toast {
    left: 12px;
    right: 12px;
    bottom: 16px;
    text-align: center;
  }
}
