.mascot-guide {
  --oak-size: 74px;
  --oak-bottom: calc(86px + env(safe-area-inset-bottom, 0px));
  --oak-gap: 14px;
  --oak-side-space: calc(max(16px, env(safe-area-inset-right, 0px)) + max(16px, env(safe-area-inset-left, 0px)));
  position: fixed;
  right: max(16px, env(safe-area-inset-right, 0px));
  bottom: var(--oak-bottom);
  z-index: 8;
}
/* Em telas baixas o cabeçalho pode se sobrepor ao painel. */
.mascot-guide:has(.mascot[aria-expanded="true"]) { z-index: 21; }
.mascot {
  display: block;
  position: relative;
  width: var(--oak-size);
  height: var(--oak-size);
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: none;
  cursor: pointer;
  animation: oakFloat 3.2s ease-in-out infinite;
}
.mascot .body {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #FFF9F0;
  border: 1px solid #B6AA96;
  box-shadow: 0 10px 24px rgba(33, 24, 21, .18);
  display: grid;
  place-items: center;
}
.mascot svg { width: 62%; height: auto; overflow: visible; }
.mascot .oakleaf {
  transform-box: view-box;
  transform-origin: 32px 56px;
  animation: leafSway 2.4s ease-in-out infinite;
}
.mascot .eyes {
  transform-box: fill-box;
  transform-origin: center;
  animation: oakBlink 4.2s infinite;
}
.mascot .arm {
  transform-box: view-box;
  transform-origin: 40px 38px;
  animation: oakWave 6s ease-in-out infinite;
}
.mascot .say {
  position: absolute;
  right: calc(100% + 10px);
  bottom: 22px;
  width: max-content;
  max-width: min(230px, 60vw);
  padding: 8px 12px;
  border-radius: 14px 14px 4px 14px;
  background: #fff;
  color: var(--ink);
  font: 700 .85rem/1.3 var(--body);
  text-align: left;
  box-shadow: 0 8px 20px rgba(33, 24, 21, .15);
  opacity: 0;
  pointer-events: none;
  animation: oakSay 14s 4s infinite;
}
.mascot:hover .say, .mascot:focus-visible .say {
  opacity: 1;
  animation: none;
}
.mascot:hover .oakleaf { animation-duration: 1.1s; }
a.mascot .say, .mascot[aria-expanded="true"] .say, html.near-foot .mascot .say { display: none; }
.mascot:focus-visible, .oak-guide-panel button:focus-visible {
  outline: 2px solid var(--o);
  outline-offset: 3px;
}
.oak-guide-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + var(--oak-gap));
  width: min(20rem, calc(100vw - var(--oak-side-space)));
  max-height: calc(100vh - var(--oak-bottom) - var(--oak-size) - var(--oak-gap) - 92px - env(safe-area-inset-top, 0px));
  max-height: calc(100dvh - var(--oak-bottom) - var(--oak-size) - var(--oak-gap) - 92px - env(safe-area-inset-top, 0px));
  overflow-y: auto;
  overscroll-behavior: contain;
  overflow-wrap: anywhere;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(33, 24, 21, .18);
  background: var(--bg);
  color: var(--ink);
}
.oak-guide-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
}
.oak-guide-head h2 { font-size: 1.2rem; }
.oak-guide-panel p {
  margin: 6px 0 12px;
  color: var(--muted);
  font-size: .875rem;
}
.oak-guide-panel button {
  display: block;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 6px 10px;
  font: 650 .875rem/1.3 var(--body);
  background: #fff;
  color: var(--ink);
  cursor: pointer;
}
.oak-guide-panel button:hover { background: var(--soft); }
.oak-guide-actions {
  display: grid;
  gap: 8px;
}
.oak-guide-actions button { min-height: 40px; text-align: left; }

@keyframes oakFloat { 0%, 100% { transform: none; } 50% { transform: translateY(-9px); } }
@keyframes oakBlink { 0%, 90%, 100% { transform: scaleY(1); } 93% { transform: scaleY(.1); } }
@keyframes oakWave {
  0%, 60%, 100% { transform: rotate(0); }
  66% { transform: rotate(-28deg); }
  72% { transform: rotate(8deg); }
  78% { transform: rotate(-24deg); }
  84% { transform: rotate(4deg); }
}
@keyframes oakSay {
  0%, 4% { opacity: 0; transform: translateY(6px); }
  8%, 40% { opacity: 1; transform: none; }
  46%, 100% { opacity: 0; transform: translateY(6px); }
}

@media (max-width: 480px), (max-height: 450px) {
  .mascot-guide { --oak-size: 58px; }
}
@media (max-width: 820px), (max-height: 450px) {
  .mascot .say { display: none; }
}
@media (orientation: landscape) and (max-height: 450px) and (min-width: 420px) {
  .oak-guide-panel {
    right: calc(100% + var(--oak-gap));
    bottom: 0;
    width: min(20rem, calc(100vw - var(--oak-side-space) - var(--oak-size) - var(--oak-gap)));
    max-height: calc(100vh - var(--oak-bottom) - 92px - env(safe-area-inset-top, 0px));
    max-height: calc(100dvh - var(--oak-bottom) - 92px - env(safe-area-inset-top, 0px));
  }
}
@media (prefers-reduced-motion: reduce) {
  .mascot, .mascot * { animation: none !important; }
}
