/* ==========================================================================
   HALAMEEN — SIGNATURE MINI-GAME & FOOTER BUTTERFLY EASTER EGG
   "HALAMEEN — The Little Yarn Catch"
   Isolated Stylesheet: preserves all existing site layouts & components
   ========================================================================== */

/* --------------------------------------------------------------------------
   1. HIDDEN EASTER EGG TRIGGER (Subtle Decorative Footer Butterfly)
   -------------------------------------------------------------------------- */
.footer-butterfly-trigger {
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 10px;
  margin: -10px -6px -10px -2px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  vertical-align: middle;
  cursor: pointer;
  color: rgba(232, 196, 196, 0.72);
  opacity: 0.78;
  border-radius: 50%;
  line-height: 0;
  transition: color 0.35s ease, opacity 0.35s ease, transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  -webkit-tap-highlight-color: transparent;
}

.footer-butterfly-trigger:hover,
.footer-butterfly-trigger:focus-visible {
  color: #FFF8F2;
  opacity: 1;
  transform: translateY(-2px) rotate(6deg) scale(1.12);
}

.footer-butterfly-trigger:active {
  transform: translateY(-1px) scale(0.96);
}

.footer-butterfly-trigger:focus-visible {
  outline: 1.5px dashed rgba(232, 196, 196, 0.75);
  outline-offset: -3px;
}

.footer-butterfly-svg {
  width: 20px;
  height: 18px;
  display: block;
  overflow: visible;
  pointer-events: none;
}

.footer-butterfly-wing-left {
  transform-box: fill-box;
  transform-origin: 100% 55%;
  animation: halameenFooterWingLeft 4.8s ease-in-out infinite;
}

.footer-butterfly-wing-right {
  transform-box: fill-box;
  transform-origin: 0% 55%;
  animation: halameenFooterWingRight 4.8s ease-in-out infinite;
}

.footer-butterfly-trigger:hover .footer-butterfly-wing-left,
.footer-butterfly-trigger:focus-visible .footer-butterfly-wing-left {
  animation: halameenFooterWingLeftHover 0.9s ease-in-out infinite;
}

.footer-butterfly-trigger:hover .footer-butterfly-wing-right,
.footer-butterfly-trigger:focus-visible .footer-butterfly-wing-right {
  animation: halameenFooterWingRightHover 0.9s ease-in-out infinite;
}

/* Natural resting pauses interspersed with delicate double flutters */
@keyframes halameenFooterWingLeft {
  0%, 58%, 100% { transform: scaleX(1) rotate(0deg); }
  66% { transform: scaleX(0.45) rotate(-6deg); }
  74% { transform: scaleX(1) rotate(0deg); }
  82% { transform: scaleX(0.55) rotate(-4deg); }
  90% { transform: scaleX(1) rotate(0deg); }
}

@keyframes halameenFooterWingRight {
  0%, 58%, 100% { transform: scaleX(1) rotate(0deg); }
  66% { transform: scaleX(0.45) rotate(6deg); }
  74% { transform: scaleX(1) rotate(0deg); }
  82% { transform: scaleX(0.55) rotate(4deg); }
  90% { transform: scaleX(1) rotate(0deg); }
}

@keyframes halameenFooterWingLeftHover {
  0%, 100% { transform: scaleX(1) rotate(0deg); }
  50% { transform: scaleX(0.4) rotate(-8deg); }
}

@keyframes halameenFooterWingRightHover {
  0%, 100% { transform: scaleX(1) rotate(0deg); }
  50% { transform: scaleX(0.4) rotate(8deg); }
}

/* --------------------------------------------------------------------------
   2. MINI-GAME MODAL & BACKDROP LOCK
   -------------------------------------------------------------------------- */
html.halameen-game-open,
body.halameen-game-open {
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none !important;
}

.hyc-modal {
  position: fixed;
  inset: 0;
  z-index: 950000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top, 12px)) max(12px, env(safe-area-inset-right, 12px)) max(12px, env(safe-area-inset-bottom, 12px)) max(12px, env(safe-area-inset-left, 12px));
  background: rgba(45, 7, 8, 0.84);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.28s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.28s ease;
  overscroll-behavior: none;
}

.hyc-modal.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.hyc-card {
  position: relative;
  width: 100%;
  max-width: 480px;
  max-height: calc(100dvh - 24px - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  background: #FFF8F2;
  color: #382323;
  border-radius: 20px;
  border: 1.5px solid rgba(200, 141, 145, 0.65);
  box-shadow: 0 24px 60px rgba(25, 4, 5, 0.48), inset 0 0 0 6px #FFF8F2, inset 0 0 0 7px rgba(200, 141, 145, 0.32);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateY(10px) scale(0.97);
  transition: transform 0.32s cubic-bezier(0.16, 1, 0.3, 1);
}

.hyc-modal.is-open .hyc-card {
  transform: translateY(0) scale(1);
}

/* Header Bar inside Game Card */
.hyc-top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.hyc-brand-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 6px;
  border-radius: 9999px;
  background: #F5EADF;
  border: 1px solid rgba(200, 141, 145, 0.45);
}

.hyc-brand-pill img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.hyc-brand-pill span {
  font-family: var(--font-serif, 'Fraunces', Georgia, serif);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  color: #4F0D0E;
}

.hyc-top-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.hyc-icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  border: 1px solid rgba(200, 141, 145, 0.55);
  background: #FFFDF9;
  color: #4F0D0E;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background-color 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.hyc-icon-btn:hover,
.hyc-icon-btn:focus-visible {
  background: #F9EBEB;
  border-color: #4F0D0E;
  transform: translateY(-1px);
}

.hyc-icon-btn:focus-visible {
  outline: 2px solid #4F0D0E;
  outline-offset: 2px;
}

.hyc-icon-btn svg {
  width: 17px;
  height: 17px;
}

/* Screens Container */
.hyc-screen {
  display: none;
  flex-direction: column;
  align-items: center;
  text-align: center;
  width: 100%;
}

.hyc-screen.is-visible {
  display: flex;
}

/* --------------------------------------------------------------------------
   3. INTRO SCREEN
   -------------------------------------------------------------------------- */
.hyc-intro {
  padding: 6px 6px 8px;
}

.hyc-intro-logo {
  width: 68px;
  height: 68px;
  object-fit: contain;
  margin-bottom: 6px;
}

.hyc-script-eyebrow {
  font-family: var(--font-script, 'Caveat', cursive);
  font-size: 1.25rem;
  color: #8A4A4F;
  line-height: 1.1;
  margin-bottom: 2px;
}

.hyc-title {
  font-family: var(--font-serif, 'Fraunces', Georgia, serif);
  font-size: clamp(1.32rem, 4.2vw, 1.68rem);
  font-weight: 600;
  color: #4F0D0E;
  line-height: 1.2;
  margin-bottom: 6px;
}

.hyc-subtitle {
  font-family: var(--font-sans, 'Nunito', sans-serif);
  font-size: 0.9rem;
  color: #6B4E4E;
  line-height: 1.45;
  max-width: 360px;
  margin-bottom: 14px;
}

.hyc-legend {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  background: #F5EADF;
  border: 1px dashed rgba(200, 141, 145, 0.7);
  border-radius: 14px;
  padding: 10px 8px;
  margin-bottom: 14px;
}

.hyc-legend-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.hyc-legend-item svg {
  width: 26px;
  height: 26px;
}

.hyc-legend-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: #382323;
  line-height: 1.1;
}

.hyc-legend-pts {
  font-size: 0.7rem;
  font-weight: 700;
  color: #4F0D0E;
}

.hyc-highscore-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 9999px;
  background: #F9EBEB;
  border: 1px solid #C88D91;
  color: #4F0D0E;
  font-size: 0.86rem;
  font-weight: 700;
  margin-bottom: 14px;
}

.hyc-controls-hint {
  font-size: 0.76rem;
  color: #6B4E4E;
  margin-top: 10px;
}

/* Primary & Secondary Atelier Buttons */
.hyc-btn-primary {
  appearance: none;
  border: 1.5px solid #4F0D0E;
  background: #4F0D0E;
  color: #FFFDF9;
  font-family: var(--font-sans, 'Nunito', sans-serif);
  font-size: 0.96rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  padding: 11px 28px;
  min-height: 44px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 6px 18px rgba(79, 13, 14, 0.22);
  transition: transform 0.2s ease, background-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.hyc-btn-primary:hover,
.hyc-btn-primary:focus-visible {
  background: #6A181A;
  transform: translateY(-1px);
  box-shadow: 0 9px 22px rgba(79, 13, 14, 0.28);
}

.hyc-btn-secondary {
  appearance: none;
  border: 1.5px solid #C88D91;
  background: #FFFDF9;
  color: #4F0D0E;
  font-family: var(--font-sans, 'Nunito', sans-serif);
  font-size: 0.9rem;
  font-weight: 700;
  padding: 10px 22px;
  min-height: 42px;
  border-radius: 9999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background-color 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
  -webkit-tap-highlight-color: transparent;
}

.hyc-btn-secondary:hover,
.hyc-btn-secondary:focus-visible {
  background: #F9EBEB;
  border-color: #4F0D0E;
  transform: translateY(-1px);
}

.hyc-btn-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   4. PLAYSCREEN HUD, CANVAS & MOBILE TOUCH CONTROLS
   -------------------------------------------------------------------------- */
.hyc-hud {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  background: #F5EADF;
  border: 1px solid rgba(200, 141, 145, 0.45);
  border-radius: 12px;
  margin-bottom: 10px;
  flex-shrink: 0;
}

.hyc-hud-stat {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.15;
}

.hyc-hud-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6B4E4E;
  font-weight: 700;
}

.hyc-hud-value {
  font-family: var(--font-serif, 'Fraunces', Georgia, serif);
  font-size: 1.15rem;
  font-weight: 600;
  color: #4F0D0E;
}

.hyc-hud-value.is-record {
  color: #8E4B10;
}

.hyc-lives {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hyc-life-pip {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: #4F0D0E;
  border: 1.5px solid #C88D91;
  transition: opacity 0.25s ease, transform 0.25s ease, background-color 0.25s ease;
}

.hyc-life-pip.is-lost {
  background: transparent;
  opacity: 0.35;
  transform: scale(0.85);
}

.hyc-stage-wrap {
  position: relative;
  width: 100%;
  aspect-ratio: 4 / 4.2;
  max-height: min(410px, calc(100dvh - 235px));
  background: #FFFDF9;
  border: 1.5px solid rgba(200, 141, 145, 0.55);
  border-radius: 14px;
  overflow: hidden;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.hyc-canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.hyc-canvas:active {
  cursor: grabbing;
}

/* Pause Veil inside Playfield */
.hyc-pause-overlay {
  position: absolute;
  inset: 0;
  background: rgba(255, 248, 242, 0.92);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 20px;
  z-index: 5;
}

.hyc-pause-overlay.is-visible {
  display: flex;
}

.hyc-pause-title {
  font-family: var(--font-serif, 'Fraunces', Georgia, serif);
  font-size: 1.45rem;
  color: #4F0D0E;
}

.hyc-touch-pad {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 10px;
  flex-shrink: 0;
}

.hyc-touch-btn {
  flex: 1;
  height: 46px;
  border-radius: 12px;
  border: 1.5px solid rgba(200, 141, 145, 0.6);
  background: #F5EADF;
  color: #4F0D0E;
  font-size: 1rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  cursor: pointer;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color 0.15s ease, transform 0.1s ease;
}

.hyc-touch-btn:active,
.hyc-touch-btn.is-pressed {
  background: #F4BAC0;
  transform: scale(0.98);
}

/* --------------------------------------------------------------------------
   5. GAME OVER SCREEN
   -------------------------------------------------------------------------- */
.hyc-gameover {
  padding: 14px 8px 10px;
}

.hyc-record-banner {
  display: none;
  align-items: center;
  gap: 6px;
  padding: 5px 14px;
  border-radius: 9999px;
  background: #F4BAC0;
  color: #4F0D0E;
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin-bottom: 10px;
}

.hyc-record-banner.is-visible {
  display: inline-flex;
}

.hyc-score-summary {
  width: 100%;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  background: #F5EADF;
  border: 1px dashed rgba(200, 141, 145, 0.7);
  border-radius: 14px;
  padding: 14px 8px;
  margin: 12px 0 18px;
}

.hyc-summary-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.hyc-summary-val {
  font-family: var(--font-serif, 'Fraunces', Georgia, serif);
  font-size: 1.45rem;
  font-weight: 600;
  color: #4F0D0E;
}

.hyc-summary-lbl {
  font-size: 0.72rem;
  color: #6B4E4E;
  font-weight: 700;
}

/* Landscape Mobile & Compact Viewport Adaptation */
@media (max-height: 600px) and (orientation: landscape) {
  .hyc-card {
    max-width: 560px;
    padding: 12px 14px;
  }
  .hyc-top-bar {
    margin-bottom: 6px;
  }
  .hyc-intro-logo {
    width: 44px;
    height: 44px;
  }
  .hyc-legend {
    padding: 6px;
    margin-bottom: 8px;
  }
  .hyc-stage-wrap {
    max-height: calc(100dvh - 165px);
    aspect-ratio: 16 / 9;
  }
  .hyc-touch-pad {
    margin-top: 6px;
  }
  .hyc-touch-btn {
    height: 38px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .footer-butterfly-wing-left,
  .footer-butterfly-wing-right,
  .footer-butterfly-trigger:hover .footer-butterfly-wing-left,
  .footer-butterfly-trigger:hover .footer-butterfly-wing-right {
    animation: none !important;
  }
  .hyc-modal,
  .hyc-card {
    transition: none !important;
  }
}
