/* Messager D.Majin — discret, bas de page (salle des quêtes uniquement) */

.quest-hall-page .section-quest-hall {
  padding-bottom: calc(var(--space-2xl) + 3.5rem);
}

.crew-mascot-wrap {
  position: fixed;
  right: max(0.65rem, env(safe-area-inset-right));
  bottom: max(0.75rem, env(safe-area-inset-bottom));
  z-index: 800;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  pointer-events: none;
}

.crew-mascot-wrap * {
  pointer-events: auto;
}

.crew-mascot-bubble {
  position: relative;
  max-width: min(11.5rem, 42vw);
  padding: 0.45rem 0.6rem;
  border-radius: 10px;
  border: 1px solid rgba(0, 245, 212, 0.35);
  background: rgba(12, 16, 22, 0.92);
  color: #e5e7eb;
  font-size: 0.72rem;
  line-height: 1.35;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.45);
  opacity: 0;
  transform: translateY(6px) scale(0.96);
  animation: crew-bubble-in 0.5s ease 1.8s forwards, crew-bubble-float 3.2s ease-in-out 2.4s infinite;
}

.crew-mascot-bubble::after {
  content: '';
  position: absolute;
  right: 1.1rem;
  bottom: -6px;
  width: 10px;
  height: 10px;
  background: rgba(12, 16, 22, 0.92);
  border-right: 1px solid rgba(0, 245, 212, 0.35);
  border-bottom: 1px solid rgba(0, 245, 212, 0.35);
  transform: rotate(45deg);
}

.crew-mascot-wrap.is-panel-open .crew-mascot-bubble,
.crew-mascot-wrap.is-dismissed .crew-mascot-bubble {
  animation: none;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

@keyframes crew-bubble-in {
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes crew-bubble-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-3px); }
}

.crew-mascot-btn {
  display: block;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: 50%;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

.crew-mascot-btn:focus-visible {
  outline: 2px solid var(--turquoise);
  outline-offset: 3px;
}

.crew-mascot-logo {
  display: block;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid rgba(0, 245, 212, 0.45);
  box-shadow:
    0 0 16px rgba(0, 245, 212, 0.2),
    0 4px 12px rgba(0, 0, 0, 0.5);
  animation: crew-logo-bob 2.8s ease-in-out infinite;
}

.crew-mascot-wrap.is-panel-open .crew-mascot-logo {
  animation: crew-logo-bob 4s ease-in-out infinite;
  border-color: rgba(254, 228, 64, 0.55);
}

@keyframes crew-logo-bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-5px) rotate(2deg); }
}

.crew-mascot-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.5rem);
  width: min(18.5rem, calc(100vw - 1.5rem));
  padding: 0;
  border: 1px solid rgba(0, 245, 212, 0.35);
  border-radius: 12px;
  background: linear-gradient(165deg, #141820 0%, #0a0c10 100%);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.65);
  opacity: 0;
  visibility: hidden;
  transform: translateY(12px) scale(0.95);
  transition:
    opacity 0.28s ease,
    transform 0.32s cubic-bezier(0.22, 1, 0.36, 1),
    visibility 0s linear 0.32s;
  overflow: hidden;
}

.crew-mascot-wrap.is-panel-open .crew-mascot-panel {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
  transition-delay: 0s;
}

.crew-mascot-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.75rem 0.85rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.crew-mascot-panel-title {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.05rem;
  letter-spacing: 0.06em;
  color: var(--turquoise);
}

.crew-mascot-panel-kicker {
  margin: 0.15rem 0 0;
  font-size: 0.68rem;
  color: var(--gris);
  line-height: 1.35;
}

.crew-mascot-close {
  flex-shrink: 0;
  width: 1.75rem;
  height: 1.75rem;
  border: none;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--gris);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
}

.crew-mascot-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}

.crew-mascot-form {
  padding: 0.65rem 0.85rem 0.85rem;
}

.crew-mascot-form label {
  display: block;
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gris);
  margin-bottom: 0.35rem;
}

.crew-mascot-form textarea {
  width: 100%;
  min-height: 5.5rem;
  max-height: 8rem;
  padding: 0.55rem 0.6rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.35);
  color: #f3f4f6;
  font-family: var(--font-body);
  font-size: 0.85rem;
  line-height: 1.45;
  resize: vertical;
}

.crew-mascot-form textarea:focus {
  outline: none;
  border-color: rgba(0, 245, 212, 0.5);
  box-shadow: 0 0 0 2px rgba(0, 245, 212, 0.15);
}

.crew-mascot-form textarea::placeholder {
  color: #6b7280;
}

.crew-mascot-from {
  margin: 0.45rem 0 0.55rem;
  font-size: 0.75rem;
  color: #9ca3af;
}

.crew-mascot-from strong {
  color: #fde047;
  font-weight: 500;
}

.crew-mascot-submit {
  width: 100%;
  margin-top: 0.25rem;
}

.crew-mascot-note {
  margin: 0.5rem 0 0;
  font-size: 0.65rem;
  color: #6b7280;
  line-height: 1.35;
}

.crew-mascot-status {
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  min-height: 1.1em;
}

.crew-mascot-status.is-ok {
  color: #6ee7b7;
}

.crew-mascot-status.is-err {
  color: #fca5a5;
}

.crew-mascot-thanks {
  padding: 1.25rem 0.85rem;
  text-align: center;
}

.crew-mascot-thanks p {
  margin: 0 0 0.5rem;
  font-size: 0.88rem;
  color: #e5e7eb;
}

.crew-mascot-thanks .crew-mascot-note {
  margin-top: 0.35rem;
}

@media (max-width: 768px) {
  .crew-mascot-wrap {
    right: max(0.5rem, env(safe-area-inset-right));
    bottom: max(0.5rem, env(safe-area-inset-bottom));
  }

  .crew-mascot-logo {
    width: 46px;
    height: 46px;
  }

  .crew-mascot-panel {
    width: min(17rem, calc(100vw - 1rem));
  }
}

@media (prefers-reduced-motion: reduce) {
  .crew-mascot-bubble,
  .crew-mascot-logo {
    animation: none !important;
  }

  .crew-mascot-bubble {
    opacity: 1;
    transform: none;
  }
}
