.maddy-hair-stage {
  position: fixed;
  z-index: 10040;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  contain: strict;
}

.maddy-hair-lock {
  position: absolute;
  top: -0.15rem;
  left: 0;
  width: var(--lock-width);
  height: var(--lock-height);
  pointer-events: auto;
  cursor: grab;
  touch-action: none;
  user-select: none;
  will-change: transform;
  transform-origin: 50% 0;
}

html.has-smooth-cursor.maddy-mode,
html.has-smooth-cursor.maddy-mode body,
html.has-smooth-cursor.maddy-mode body * {
  cursor: default !important;
}

html.has-smooth-cursor.maddy-mode .maddy-hair-lock {
  cursor: grab !important;
}

html.has-smooth-cursor.maddy-mode .maddy-hair-lock:active,
html.has-smooth-cursor.maddy-mode .maddy-hair-lock.is-dragging {
  cursor: grabbing !important;
}

html.maddy-mode .smooth-cursor {
  display: none !important;
}

.maddy-hair-lock:active,
.maddy-hair-lock.is-dragging {
  z-index: 3;
  cursor: grabbing;
}

.maddy-hair-visual {
  width: 100%;
  height: 100%;
  overflow: visible;
  transform-origin: 50% 0;
  filter: drop-shadow(0 12px 9px rgba(25, 10, 6, 0.2));
  animation: maddy-hair-drop 680ms var(--delay) cubic-bezier(0.16, 1, 0.3, 1) both;
}

.maddy-hair-strands {
  transform-box: fill-box;
  transform-origin: 50% 0;
  animation: maddy-hair-sway var(--sway-duration) var(--sway-delay) ease-in-out infinite alternate;
}

.maddy-hair-lock.is-dragging .maddy-hair-strands {
  animation-play-state: paused;
}

.maddy-hair-lock.is-dragging .maddy-hair-visual {
  filter: drop-shadow(0 18px 13px rgba(25, 10, 6, 0.28));
}

.maddy-hair-path {
  fill: none;
  stroke-linecap: round;
}

.maddy-hair-shadow { stroke: #29150f; }
.maddy-hair-main { stroke: #4b2a1e; }
.maddy-hair-warm { stroke: #6b3c27; }
.maddy-hair-shine { stroke: rgba(190, 121, 76, 0.55); }

.maddy-mode-hint {
  position: fixed;
  z-index: 10060;
  left: 50%;
  bottom: max(1.1rem, env(safe-area-inset-bottom));
  min-width: min(21rem, calc(100vw - 2rem));
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  background: rgba(26, 17, 14, 0.9);
  color: #fff;
  box-shadow: 0 14px 42px rgba(27, 13, 8, 0.28);
  font: 700 0.76rem/1 system-ui, sans-serif;
  letter-spacing: 0.01em;
  text-align: center;
  transform: translateX(-50%);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  animation: maddy-hint-in 280ms ease-out both;
}

.maddy-mode-hint-progress {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #8d5232, #d49a70);
  transform: scaleX(0);
  transform-origin: left;
}

.maddy-mode-hint-copy {
  position: relative;
  display: block;
  padding: 0.72rem 1.15rem;
}

.maddy-mode-hint.is-exiting .maddy-mode-hint-progress {
  animation: maddy-exit-progress 900ms linear forwards;
}

@keyframes maddy-hair-drop {
  from { opacity: 0; transform: scaleY(0.04); }
  to { opacity: 1; transform: scaleY(1); }
}

@keyframes maddy-hair-sway {
  from { transform: rotate(calc(0deg - var(--sway))) translateX(-0.12rem); }
  to { transform: rotate(var(--sway)) translateX(0.12rem); }
}

@keyframes maddy-hint-in {
  from { opacity: 0; transform: translate(-50%, 0.65rem); }
}

@keyframes maddy-exit-progress {
  to { transform: scaleX(1); }
}

@media (prefers-reduced-motion: reduce) {
  .maddy-hair-visual,
  .maddy-hair-strands,
  .maddy-mode-hint { animation: none; }
}
