.scroll-hat {
  --hat-width: 94px;
  position: fixed;
  z-index: 30;
  bottom: 18px;
  left: 16px;
  width: var(--hat-width);
  height: calc(var(--hat-width) * 1.1875);
  pointer-events: none;
}

.scroll-hat[hidden],
.scroll-hat [hidden] { display: none !important; }
.intro-active .scroll-hat { visibility: hidden; }
.has-bottom-hat .footer-bottom { min-height: 132px; padding-left: 72px; flex-wrap: wrap; }
.scroll-hat[data-open="true"] { z-index: 40; }

.scroll-hat-toggle {
  display: block;
  width: 100%;
  height: 100%;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 16px;
  color: inherit;
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
}

.scroll-hat-art { display: block; width: 100%; height: 100%; transform-origin: 50% 82%; }
.scroll-hat-art svg { display: block; width: 100%; height: 100%; overflow: visible; }
.scroll-hat-rabbit {
  transform: translateY(65px);
  opacity: 0;
  transition: transform .48s cubic-bezier(.22, 1.3, .42, 1), opacity .16s ease;
}
.scroll-hat[data-open="true"] .scroll-hat-rabbit { transform: translateY(0); opacity: 1; }
.scroll-hat-toggle:focus-visible { outline: 2px solid var(--foreground, #f9f9f6); outline-offset: 4px; }

.scroll-hat-message {
  position: absolute;
  bottom: calc(100% + 10px);
  left: 0;
  width: min(290px, calc(100vw - 40px));
  max-height: calc(100svh - 160px);
  padding: 10px 18px 18px;
  overflow: auto;
  overscroll-behavior: contain;
  border: 1px solid var(--panel-border, #515151);
  border-radius: 12px;
  color: var(--foreground, #f9f9f6);
  background: var(--panel, #0d0d0d);
  box-shadow: 0 14px 48px rgb(0 0 0 / 20%);
  font-family: Arial, Helvetica, sans-serif;
  text-align: left;
  pointer-events: auto;
}

.scroll-hat[data-bubble-side="left"] .scroll-hat-message { right: 0; left: auto; }
.scroll-hat[data-bubble-position="below"] .scroll-hat-message { top: calc(100% + 10px); bottom: auto; }
.scroll-hat-message-header { position: sticky; z-index: 1; top: 0; display: flex; align-items: center; justify-content: space-between; gap: 12px; background: var(--panel, #0d0d0d); }
.scroll-hat-message-header h2 { margin: 0; color: var(--muted, #aaa); font-size: 10px; font-weight: 400; line-height: 1.5; letter-spacing: .12em; text-transform: uppercase; }
.scroll-hat-close {
  display: inline-grid;
  flex: 0 0 44px;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-right: -10px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--foreground, #f9f9f6);
  background: transparent;
  cursor: pointer;
}
.scroll-hat-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.3; stroke-linecap: round; }
.scroll-hat-close:hover { background: var(--toggle-hover, rgb(255 255 255 / 6%)); }
.scroll-hat-quote { margin: 6px 0 20px; font-size: 15px; font-weight: 400; line-height: 1.65; letter-spacing: -.015em; }
.scroll-hat-contact {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  width: 100%;
  min-height: 46px;
  padding: 11px 14px;
  border: 1px solid var(--foreground, #f9f9f6);
  border-radius: 0;
  color: var(--background, #080808);
  background: var(--foreground, #f9f9f6);
  font: inherit;
  font-size: 13px;
  line-height: 1.5;
  cursor: pointer;
}
.scroll-hat-contact span { font-size: 19px; line-height: 1; }
.scroll-hat-contact:hover { color: var(--foreground, #f9f9f6); background: var(--background, #080808); }
.scroll-hat-close:focus-visible,
.scroll-hat-contact:focus-visible { outline: 2px solid var(--foreground, #f9f9f6); outline-offset: 3px; }
.scroll-hat button:disabled { cursor: default; opacity: .55; }

@media (max-width: 600px), (max-height: 440px) {
  .scroll-hat { --hat-width: 70px; }
  .has-bottom-hat .footer-bottom { min-height: 108px; padding-left: 64px; }
  .scroll-hat-message { max-height: calc(100svh - 130px); padding: 8px 15px 15px; }
  .scroll-hat-quote { font-size: 14px; line-height: 1.6; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-hat-rabbit { transition: none; }
}
