/* ============================================================
   paragraf.tools - Practical help panel
   Desktop: right-side panel
   Mobile: bottom help panel
   ============================================================ */

.mascot {
  position: fixed;
  top: 108px;
  right: 20px;
  z-index: 1180;
  width: min(340px, calc(100vw - 40px));
  max-height: calc(100vh - 132px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 16px 16px 14px;
  border-radius: 22px;
  border: 1px solid rgba(249, 115, 22, 0.22);
  border-left: 4px solid var(--orange-500, #f97316);
  background:
    linear-gradient(180deg, rgba(255, 250, 245, 0.97) 0%, rgba(255, 255, 255, 0.98) 100%);
  box-shadow:
    0 20px 50px rgba(45, 27, 78, 0.14),
    0 4px 14px rgba(249, 115, 22, 0.08);
  backdrop-filter: blur(12px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.mascot--bye {
  opacity: 0;
  transform: translateX(14px) scale(0.98);
  pointer-events: none;
}

.mascot__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.mascot__eyebrow {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--purple-800, #4a2d7a);
}

.mascot__body {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 14px;
  min-height: 0;
}

.mascot__symbol-btn {
  align-self: start;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  cursor: pointer;
}

.mascot__symbol-shell {
  position: relative;
  display: grid;
  place-items: center;
  width: 88px;
  height: 88px;
  border-radius: 24px;
  background:
    radial-gradient(circle at 28% 22%, rgba(251, 146, 60, 0.16), transparent 38%),
    linear-gradient(160deg, var(--purple-900, #2d1b4e), #5f3c94);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 12px 28px rgba(45, 27, 78, 0.24);
  overflow: hidden;
}

.mascot__symbol-shell::before {
  content: '';
  position: absolute;
  inset: 10px;
  border-radius: 18px;
  border: 1px solid rgba(243, 239, 250, 0.12);
}

.mascot__symbol {
  position: relative;
  width: 54px;
  height: 54px;
  transition: transform 0.75s cubic-bezier(0.22, 1, 0.36, 1), filter 0.75s ease;
}

.mascot__glyph {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 3rem;
  font-weight: 700;
  line-height: 1;
  color: #fff7ee;
  text-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  transition:
    opacity 0.78s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.78s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.78s ease;
}

.mascot__glyph--ask {
  opacity: 0;
  transform: translateY(8%) scale(0.74) rotate(10deg);
  filter: blur(5px);
}

.mascot__glyph--law {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
}

.mascot--question .mascot__glyph--law {
  opacity: 0;
  transform: translateY(-8%) scale(0.76) rotate(-10deg);
  filter: blur(5px);
}

.mascot--question .mascot__glyph--ask {
  opacity: 1;
  transform: translateY(0) scale(1) rotate(0deg);
  filter: blur(0);
}

.mascot--question .mascot__symbol {
  transform: rotate(2deg) scale(1.015);
}

.mascot--surprise .mascot__symbol {
  transform: rotate(8deg) scale(1.04);
  filter: saturate(1.08);
}

.mascot--pulse .mascot__symbol-shell {
  animation: mascotPulse 0.9s ease;
}

@keyframes mascotPulse {
  0% { transform: scale(1); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 12px 28px rgba(45,27,78,0.24); }
  45% { transform: scale(1.04); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 18px 32px rgba(45,27,78,0.3); }
  100% { transform: scale(1); box-shadow: inset 0 1px 0 rgba(255,255,255,0.08), 0 12px 28px rgba(45,27,78,0.24); }
}

.mascot__content {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.mascot__label {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--orange-600, #ea580c);
  margin-bottom: 6px;
}

.mascot__text {
  font-size: 0.84rem;
  line-height: 1.58;
  color: var(--text-dark, #22192d);
  overflow: auto;
  max-height: min(34vh, 280px);
  padding-right: 2px;
}

.mascot__text strong {
  color: var(--purple-900, #2d1b4e);
}

.mascot__text code {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(112, 71, 176, 0.08);
  color: var(--purple-900, #2d1b4e);
  font-size: 0.8rem;
}

.mascot__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(112, 71, 176, 0.1);
  flex-wrap: wrap;
}

.mascot__counter {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--neutral-500, #7a7482);
  min-width: 38px;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

.mascot__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(112, 71, 176, 0.14);
  background: rgba(112, 71, 176, 0.04);
  color: var(--purple-800, #4a2d7a);
  border-radius: 999px;
  min-width: 34px;
  height: 34px;
  padding: 0 10px;
  font-family: var(--font-sans);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.mascot__btn:hover {
  background: rgba(112, 71, 176, 0.08);
  border-color: rgba(112, 71, 176, 0.24);
  transform: translateY(-1px);
}

.mascot__btn--ghost {
  width: 34px;
  padding: 0;
}

.mascot__btn--target {
  margin-left: auto;
  background: rgba(249, 115, 22, 0.08);
  border-color: rgba(249, 115, 22, 0.22);
  color: var(--orange-700, #c2410c);
}

.mascot__btn--target:hover {
  background: rgba(249, 115, 22, 0.14);
  border-color: rgba(249, 115, 22, 0.3);
}

.mascot__btn--close {
  width: 32px;
  min-width: 32px;
  height: 32px;
  padding: 0;
  border-color: transparent;
  background: rgba(45, 27, 78, 0.04);
  color: var(--neutral-500, #7a7482);
  font-size: 1rem;
}

.mascot__btn--close:hover {
  background: rgba(45, 27, 78, 0.08);
  color: var(--text-dark, #22192d);
}

.mascot-highlight {
  outline: 2px solid var(--orange-400, #fb923c) !important;
  outline-offset: 3px;
  border-radius: 8px;
  animation: mascotHighlight 2.2s ease;
}

@keyframes mascotHighlight {
  0%, 100% { outline-color: transparent; box-shadow: none; }
  18%, 82% { outline-color: var(--orange-400, #fb923c); box-shadow: 0 0 0 6px rgba(251,146,60,0.08); }
}

@media (max-width: 1200px) {
  .mascot {
    width: min(300px, calc(100vw - 32px));
    top: 92px;
    right: 16px;
    max-height: calc(100vh - 112px);
  }
}

@media (max-width: 1040px) {
  .mascot {
    top: auto;
    right: 12px;
    left: 12px;
    bottom: calc(max(12px, env(safe-area-inset-bottom)) + var(--pt-consent-offset, 0px));
    width: auto;
    max-height: min(42vh, 320px);
    border-left-width: 1px;
    border-top: 4px solid var(--orange-500, #f97316);
    border-radius: 18px;
    padding: 14px 14px 12px;
  }

  .mascot__body {
    grid-template-columns: 72px minmax(0, 1fr);
    gap: 12px;
  }

  .mascot__symbol-shell {
    width: 72px;
    height: 72px;
    border-radius: 20px;
  }

  .mascot__symbol {
    width: 46px;
    height: 46px;
  }

  .mascot__glyph {
    font-size: 2.55rem;
  }

  .mascot__text {
    max-height: min(24vh, 150px);
    font-size: 0.8rem;
  }
}

@media (max-width: 1040px) {
  body.has-mascot-mobile {
    padding-bottom: calc(230px + var(--pt-consent-offset, 0px));
  }
}

@media (max-width: 480px) {
  .mascot__actions {
    gap: 6px;
  }

  .mascot__btn--target {
    margin-left: 0;
    width: 100%;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mascot,
  .mascot__symbol,
  .mascot__glyph,
  .mascot__btn,
  .mascot__symbol-shell,
  .mascot-highlight {
    transition: none !important;
    animation: none !important;
  }
}
