/* miedodev: styles for the interactive jokes (toasts, dialogs, the ladybug, effects). */

/* Notifications panel */
.notifs { position: relative; display: flex; align-items: center; }
.notifs__badge {
  position: absolute; top: 0.25rem; right: 0.5rem;
  display: flex; align-items: center; justify-content: center;
  min-width: 1.25rem; height: 1.25rem; padding: 0 0.25rem;
  border-radius: 999px; background: #f87171; color: #fff; font-size: 9px; font-weight: 700;
  animation: pop 0.3s ease-out;
}
.notifs__panel {
  position: fixed; top: 4.5rem; right: 0.5rem; left: 0.5rem; z-index: 1100;
  max-height: 60vh; overflow-y: auto;
  border-radius: 1rem; border: 1px solid var(--border-light);
  background: var(--bg-elevated); box-shadow: 0 24px 60px -20px rgba(0, 0, 0, 0.7);
  animation: fade-in 0.12s ease-out;
}
@media (min-width: 640px) {
  .notifs__panel { position: absolute; left: auto; top: calc(100% + 0.5rem); right: -1rem; width: 25rem; }
}
.notifs__head { position: relative; overflow: hidden; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border-light); }
.notifs__head h3 { position: relative; font-size: 1.125rem; font-weight: 600; }
.notifs__glow { position: absolute; left: 50%; top: -3rem; width: 6rem; height: 6rem; transform: translateX(-50%); border-radius: 999px; background: rgba(0, 153, 255, 0.2); filter: blur(40px); }
.notifs__item { display: flex; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); transition: opacity 0.3s; }
.notifs__item p { font-size: 0.875rem; }
.notifs__item time { font-size: 0.75rem; color: var(--text-3); }
.notifs__item.is-read { opacity: 0.35; text-decoration: line-through; }
.notifs__dot { flex: none; width: 0.5rem; height: 0.5rem; margin-top: 0.4rem; border-radius: 999px; background: var(--blue); }
.notifs__foot { padding: 0.75rem 1rem; }
.link-btn { font-size: 0.875rem; font-weight: 600; color: var(--blue); }
.link-btn:hover { text-decoration: underline; }

/* Toasts */
.toasts {
  position: fixed; right: 1rem; bottom: 1rem; left: 1rem; z-index: 3000;
  display: flex; flex-direction: column; align-items: flex-end; gap: 0.75rem;
  pointer-events: none;
}
@media (min-width: 640px) { .toasts { left: auto; right: 1.5rem; bottom: 1.5rem; } }
.toast {
  position: relative; pointer-events: auto;
  display: flex; gap: 0.75rem; width: min(22rem, 100%);
  padding: 1rem 1rem 1rem 1.125rem;
  border-radius: 20px; border: 1px solid var(--border-light);
  background: radial-gradient(var(--surface) 2px, var(--bg-elevated) 0) 0 0 / 20px 20px;
  box-shadow: 0 20px 50px -20px rgba(0, 0, 0, 0.8), 0 0 60px -30px rgba(0, 153, 255, 0.5);
  animation: toast-in 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast.is-leaving { animation: toast-out 0.26s ease-in forwards; }
.toast__body { flex: 1; min-width: 0; }
.toast__title { font-weight: 700; }
.toast__text { padding-top: 0.25rem; font-size: 0.875rem; color: var(--text-2); }
.toast__close { flex: none; align-self: flex-start; width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; font-size: 1.25rem; line-height: 1; color: var(--text-2); }
.toast__close:hover { background: var(--surface-hover); color: var(--text); }
.toast__action { margin-top: 0.75rem; padding: 0.375rem 0.75rem; border-radius: 0.5rem; border: 1px solid #ef233c; color: #ff8fa0; font-size: 0.8125rem; font-weight: 600; }
.toast__action:hover { background: rgba(239, 35, 60, 0.15); }
@keyframes toast-in { from { opacity: 0; transform: translateX(24px) scale(0.98); } }
@keyframes toast-out { to { opacity: 0; transform: translateX(24px) scale(0.98); } }

/* Bug counter */
.bug-counter {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 1500;
  max-width: calc(100vw - 2rem); overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding: 0.5rem 0.875rem; border-radius: 999px;
  border: 1px solid rgba(239, 35, 60, 0.45); background: rgba(11, 20, 34, 0.92);
  font-size: 0.8125rem; font-weight: 600; color: var(--text);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.8);
}
.bug-counter.is-bumping { animation: bump 0.35s ease-out; }
:root[data-theme='light'] .bug-counter { background: rgba(255, 255, 255, 0.95); }
@keyframes bump { 40% { transform: scale(1.12); } }

/* Ladybug pet */
.pet {
  position: fixed; left: 0; top: 0; z-index: 2500;
  width: 44px; height: 44px; padding: 0;
  cursor: pointer; touch-action: none;
  filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55));
  will-change: transform;
}
.pet svg { width: 44px; height: 44px; }
.pet.is-walking .ladybug__legs { animation: legs 0.18s steps(2) infinite; transform-origin: 24px 26px; }
.pet.is-caught { filter: drop-shadow(0 0 14px rgba(239, 35, 60, 0.9)); }
.pet.is-leaving { transition: transform 0.9s cubic-bezier(0.5, 0, 0.75, 0); transform: translate3d(50vw, -120px, 0) rotate(-30deg) !important; }
.pet__label {
  position: fixed; left: 0; top: 0; z-index: 2500; pointer-events: none;
  padding: 0.125rem 0.5rem; border-radius: 999px;
  background: #ef233c; color: #fff; font-size: 0.75rem; font-weight: 700; white-space: nowrap;
  box-shadow: 0 4px 12px -4px rgba(0, 0, 0, 0.7);
  will-change: transform;
}
@keyframes legs { 50% { transform: scaleY(0.75) rotate(6deg); } }

.bug-prompt {
  position: fixed; z-index: 5000;
  padding: 1rem; border-radius: 1rem;
  border: 1px solid rgba(239, 35, 60, 0.5); background: var(--bg-elevated);
  box-shadow: 0 24px 60px -18px rgba(0, 0, 0, 0.85);
  animation: pop 0.2s ease-out;
}
.bug-prompt__x { position: absolute; top: 0.5rem; right: 0.5rem; width: 1.75rem; height: 1.75rem; border-radius: 0.5rem; font-size: 1.25rem; color: var(--text-2); }
.bug-prompt__title { padding-right: 1.5rem; font-weight: 700; }
.bug-prompt__text { margin-top: 0.25rem; font-size: 0.8125rem; color: var(--text-2); }
.bug-prompt__input {
  width: 100%; margin-top: 0.75rem; padding: 0.5rem 0.75rem;
  border-radius: 0.5rem; border: 1px solid var(--border-light); background: var(--bg);
  color: var(--text); font: inherit; font-size: 1rem;
}
.bug-prompt__input:focus { outline: 2px solid #ef233c; outline-offset: 1px; }
.bug-prompt__actions { display: flex; gap: 0.5rem; margin-top: 0.75rem; }
.bug-prompt__actions button { flex: 1; padding: 0.5rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600; }
.bug-prompt__save { background: #ef233c; color: #fff; }
.bug-prompt__save:hover { filter: brightness(1.1); }
.bug-prompt__free { border: 1px solid var(--border-light); color: var(--text-2); }
.bug-prompt__free:hover { color: var(--text); background: var(--surface-hover); }

/* Generic dialog */
.modal {
  position: fixed; inset: 0; z-index: 4000;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem; background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  animation: fade-in 0.18s ease-out;
}
.modal.is-leaving { pointer-events: none; animation: fade-out 0.2s ease-in forwards; }
.modal__dialog {
  position: relative; width: min(30rem, 100%); max-height: calc(100vh - 2rem); overflow-y: auto;
  padding: 1.5rem; border-radius: 1.25rem; border: 1px solid var(--border-light);
  background: var(--bg-elevated); box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9);
  animation: pop 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.modal__x { position: absolute; top: 0.75rem; right: 0.75rem; z-index: 2; width: 2rem; height: 2rem; border-radius: 0.5rem; font-size: 1.375rem; line-height: 1; color: var(--text-2); }
.modal__x:hover { background: var(--surface-hover); color: var(--text); }
.modal__title { padding-right: 2rem; font-size: 1.25rem; font-weight: 600; text-wrap: balance; }
.modal__text { margin-top: 0.5rem; font-size: 0.9375rem; color: var(--text-2); }
.modal__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.5rem; margin-top: 1.25rem; }
.modal__btn { padding: 0.625rem 1rem; border-radius: 0.625rem; border: 1px solid var(--border-light); font-size: 0.875rem; font-weight: 600; transition: background-color 0.15s, border-color 0.15s; }
.modal__btn:hover { background: var(--surface-hover); }
.modal__btn--primary { border-color: transparent; background: var(--blue); color: #fff; }
.modal__btn--primary:hover { background: var(--blue-dark); }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(0.96) translateY(6px); } }

/* The ladybug alert. On close the box is sucked into the ladybug, which stays still on top.
   The durations match BUG_VANISH_MS in miedo.js. */
.bug-alert .modal__dialog {
  width: min(22rem, 100%); padding: 1.75rem 1.5rem 1.5rem; text-align: center;
  border-color: rgba(239, 35, 60, 0.5);
  box-shadow: 0 30px 80px -30px rgba(0, 0, 0, 0.9), 0 0 70px -28px rgba(239, 35, 60, 0.7);
}
.bug-alert .modal__title { padding: 0 1rem; }
.bug-alert .modal__actions { justify-content: center; }
.bug-alert__icon {
  display: flex; align-items: center; justify-content: center;
  width: 4.5rem; height: 4.5rem; margin: 0 auto 1rem;
  border-radius: 999px; background: rgba(239, 35, 60, 0.14); box-shadow: inset 0 0 0 1px rgba(239, 35, 60, 0.35);
}
.bug-alert__bug { display: block; width: 44px; height: 44px; filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.55)); }
.bug-alert__bug svg { display: block; width: 44px; height: 44px; }
.bug-alert__bug.is-lifted { position: fixed; z-index: 4500; pointer-events: none; animation: bug-gulp 0.6s ease-in-out; }
.bug-alert__ok { min-width: 8rem; border-color: transparent; background: #ef233c; color: #fff; }
.bug-alert__ok:hover { background: #d90429; }
/* Only the backdrop fades, so the box stays solid while it shrinks into the ladybug. */
.bug-alert.is-leaving { animation: bug-backdrop-out 0.6s ease-in forwards; }
.bug-alert.is-leaving .modal__dialog { animation: bug-vanish 0.6s ease-in forwards; }
@keyframes bug-backdrop-out { to { background-color: transparent; backdrop-filter: blur(0); -webkit-backdrop-filter: blur(0); } }
@keyframes bug-vanish {
  15% { transform: scale(1.03); }
  80% { opacity: 1; }
  to { opacity: 0; transform: scale(0.02) rotate(-24deg); }
}
@keyframes bug-gulp { 70% { transform: scale(1.22); } }
@media (prefers-reduced-motion: reduce) {
  .bug-alert__bug.is-lifted { animation: none; }
  .bug-alert.is-leaving, .bug-alert.is-leaving .modal__dialog { animation: fade-out 0.25s ease-out forwards; }
}

/* Progress bar shared by the course player and npm install */
.progress { height: 0.5rem; margin-top: 1.25rem; overflow: hidden; border-radius: 999px; background: var(--surface); }
.progress__bar { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--blue), var(--green)); transition: width 2.2s cubic-bezier(0.2, 0.8, 0.2, 1); }

/* Course player */
.player .modal__dialog { width: min(36rem, 100%); }
.player__screen { position: relative; overflow: hidden; aspect-ratio: 16 / 9; margin: 0.5rem 0 1rem; border-radius: 0.75rem; border: 1px solid var(--border); isolation: isolate; }
.player__screen .course-card__art { z-index: 0; }
.player__spinner { position: absolute; left: 50%; top: 50%; z-index: 1; width: 3rem; height: 3rem; margin: -1.5rem 0 0 -1.5rem; border-radius: 999px; border: 4px solid rgba(255, 255, 255, 0.25); border-top-color: #fff; animation: spin 0.9s linear infinite; }
.player__lesson { font-size: 0.8125rem; font-weight: 600; color: var(--blue); }
.player__status { margin-top: 0.5rem; font-size: 0.8125rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Captcha */
.captcha .modal__dialog { width: min(24rem, 100%); padding: 0.75rem; border-radius: 0.5rem; background: #fff; color: #111827; }
.captcha__head { padding: 1.25rem 1.25rem 1.5rem; background: #1a73e8; color: #fff; }
.captcha__head p { font-size: 0.875rem; }
.captcha__head strong { display: block; font-size: 1.75rem; line-height: 1.2; }
.captcha__head span { display: block; margin-top: 0.25rem; font-size: 0.8125rem; opacity: 0.9; }
.captcha .modal__x { color: #fff; }
.captcha .modal__x:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.captcha__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; margin-top: 4px; }
.captcha__tile { position: relative; aspect-ratio: 1; display: flex; align-items: center; justify-content: center; padding: 0.375rem; background: #0f172a; color: #e2e8f0; transition: transform 0.15s; }
.captcha__tile code { font-size: 0.8125rem; line-height: 1.3; word-break: break-word; }
.captcha__tile:nth-child(3n + 1) { background: #1e1b4b; }
.captcha__tile:nth-child(3n + 2) { background: #172554; }
.captcha__tile.is-selected { transform: scale(0.86); outline: 3px solid #1a73e8; }
.captcha__tile.is-selected::after { content: '✓'; position: absolute; top: 4px; left: 4px; width: 1.25rem; height: 1.25rem; border-radius: 999px; background: #1a73e8; color: #fff; font-size: 0.75rem; display: flex; align-items: center; justify-content: center; }
.captcha__result { min-height: 1.25rem; margin-top: 0.75rem; padding: 0 0.25rem; font-size: 0.875rem; font-weight: 600; color: #b91c1c; }
.captcha .modal__actions { margin-top: 0.5rem; }
.captcha .modal__btn { border-color: #d1d5db; color: #374151; }
.captcha .modal__btn:hover { background: #f3f4f6; }
.captcha .modal__btn--primary { background: #1a73e8; border-color: #1a73e8; color: #fff; }
.captcha .modal__btn--primary:hover { background: #1557b0; }

/* Center the div */
.center-game {
  position: relative; height: 13rem; margin-top: 1.25rem; overflow: hidden;
  border-radius: 0.75rem; border: 1px dashed var(--border-light);
  background: radial-gradient(var(--surface) 1.5px, transparent 0) 0 0 / 16px 16px;
  touch-action: none;
}
.center-game__cross { position: absolute; left: 50%; top: 50%; width: 1.5rem; height: 1.5rem; transform: translate(-50%, -50%); }
.center-game__cross::before, .center-game__cross::after { content: ''; position: absolute; background: rgba(239, 35, 60, 0.6); }
.center-game__cross::before { left: 50%; top: 0; bottom: 0; width: 1px; }
.center-game__cross::after { top: 50%; left: 0; right: 0; height: 1px; }
.center-game__box {
  position: absolute; left: 0; top: 0;
  display: flex; align-items: center; justify-content: center;
  width: 5rem; height: 3rem; border-radius: 0.5rem;
  background: var(--blue); color: #fff; font-family: ui-monospace, Menlo, monospace; font-weight: 700;
  cursor: grab; user-select: none; touch-action: none;
  box-shadow: 0 8px 20px -8px rgba(0, 153, 255, 0.8);
}
.center-game__box:active { cursor: grabbing; }
.center-game__box.is-sliding { transition: transform 0.6s cubic-bezier(0.16, 1, 0.3, 1); }
.center-game__box.is-centered { background: var(--green); color: #020617; }
.center-game__status { margin-top: 0.75rem; font-size: 0.875rem; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }

/* Terminal and npm install */
.terminal .modal__dialog, .npm .modal__dialog { width: min(40rem, 100%); padding: 0; overflow: hidden; background: #0a0f1c; border-color: #1e293b; }
.term { display: flex; flex-direction: column; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; color: #e2e8f0; }
.term__bar { position: relative; display: flex; align-items: center; gap: 0.375rem; padding: 0.625rem 0.75rem; background: #111827; border-bottom: 1px solid #1e293b; }
.term__bar i { width: 0.75rem; height: 0.75rem; border-radius: 999px; background: #ef4444; }
.term__bar i:nth-child(2) { background: #f59e0b; }
.term__bar i:nth-child(3) { background: #22c55e; }
.term__bar p { position: absolute; left: 50%; transform: translateX(-50%); font-size: 0.75rem; color: #94a3b8; }
.term__x { margin-left: auto; width: 1.5rem; height: 1.5rem; border-radius: 0.375rem; color: #94a3b8; font-size: 1.125rem; line-height: 1; }
.term__x:hover { background: #1e293b; color: #fff; }
.term__out { height: 16rem; overflow-y: auto; padding: 0.75rem 1rem; font-size: 0.8125rem; line-height: 1.6; }
.term__line { white-space: pre-wrap; word-break: break-word; }
.term__line--cmd { color: #60baff; }
.term__line--warn { color: #facc15; }
.term__line--err { color: #f87171; }
.term__line--info { color: #cbd5e1; }
.term__input { display: flex; align-items: center; gap: 0.5rem; padding: 0.625rem 1rem; border-top: 1px solid #1e293b; font-size: 0.8125rem; }
.term__input span { color: var(--green); white-space: nowrap; }
.term__input input { flex: 1; min-width: 0; background: none; border: 0; color: #fff; font: inherit; font-size: 16px; outline: none; caret-color: var(--green); }
.npm__out { height: 13rem; }
.npm__progress { padding: 0 1rem 0.5rem; }
.npm__progress .progress { margin-top: 0.25rem; }
.npm__pct { margin-top: 0.375rem; font-size: 0.75rem; color: #94a3b8; }
.term__actions { display: flex; justify-content: flex-end; padding: 0 1rem 1rem; }
.term__actions .modal__btn { border-color: #334155; }

/* Vim */
.vim { padding: 0; background: #000; backdrop-filter: none; }
.vim .modal__dialog { width: 100%; height: 100%; max-height: none; padding: 0; border: 0; border-radius: 0; background: #0c0c0c; animation: none; }
.vim__screen { display: flex; flex-direction: column; height: 100%; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 0.875rem; color: #d4d4d4; }
.vim__text { flex: 1; margin: 0; padding: 0.5rem 0.75rem; overflow: hidden; white-space: pre-wrap; word-break: break-word; line-height: 1.45; color: #5b8def; }
.vim__file, .vim__typed { color: #d4d4d4; }
.vim__cursor { color: #d4d4d4; animation: blink-caret 1s steps(1) infinite; }
.vim__status { display: flex; justify-content: space-between; gap: 1rem; padding: 0.125rem 0.75rem; background: #d4d4d4; color: #0c0c0c; font-weight: 700; }
.vim__mode { white-space: nowrap; }
.vim__status span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vim__cmd { min-height: 1.6rem; padding: 0.25rem 0.75rem; color: #f87171; }
.vim__help { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; padding: 0.75rem; border-top: 1px solid #262626; }
.vim__help p { width: 100%; color: #a3a3a3; }
.vim__help button { padding: 0.5rem 0.75rem; border: 1px solid #525252; border-radius: 0.375rem; color: #fafafa; }
.vim__help button:hover { background: #262626; }
@keyframes blink-caret { 50% { opacity: 0; } }

/* 500 page */
.server-error { background: #020617; backdrop-filter: none; flex-direction: column; text-align: center; }
.server-error .modal__dialog { width: min(34rem, 100%); background: none; border: 0; box-shadow: none; display: flex; flex-direction: column; align-items: center; }
.big-ghost { width: 9rem; height: auto; animation: float 2.4s ease-in-out infinite; }
.server-error__code { margin-top: 1rem; font-size: 5rem; line-height: 1; font-weight: 800; letter-spacing: -0.05em; color: #f87171; text-shadow: 0 0 40px rgba(248, 113, 113, 0.5); }
.server-error__title { margin-top: 0.5rem; font-size: 1.75rem; font-weight: 700; }
.server-error__text { margin-top: 0.75rem; color: var(--text-2); }
.server-error__rollback { margin-top: 1.5rem; padding: 0.5rem 1rem; border-radius: 999px; border: 1px solid var(--border-light); font-family: ui-monospace, Menlo, monospace; font-size: 0.875rem; }
.server-error__rollback strong { color: var(--yellow); }
:root[data-theme='light'] .server-error { background: #020617; color: #fff; }
@keyframes float { 50% { transform: translateY(-12px) rotate(-3deg); } }

/* Fake runtime error */
.error-overlay { background: rgba(10, 0, 0, 0.8); }
.error-overlay .modal__dialog { width: min(40rem, 100%); border-color: #7f1d1d; background: #180808; border-top: 4px solid #ef4444; }
.error-overlay__kind { font-size: 0.8125rem; font-weight: 700; color: #f87171; text-transform: uppercase; letter-spacing: 0.06em; }
.error-overlay__title { margin-top: 0.5rem; font-family: ui-monospace, Menlo, monospace; font-size: 1.125rem; color: #fecaca; word-break: break-word; }
.error-overlay__stack { margin: 1rem 0 0; padding: 0.75rem; overflow-x: auto; border-radius: 0.5rem; background: #0c0303; color: #fca5a5; font-size: 0.8125rem; line-height: 1.6; }
.error-overlay__hint { margin: 1rem 0; font-size: 0.875rem; color: #fecaca; }

/* Konami finale */
.finale { overflow: hidden; background: radial-gradient(circle at 50% 40%, #1e0b3a, #020617 70%); }
.finale .modal__dialog { width: min(30rem, 100%); background: none; border: 0; box-shadow: none; overflow: visible; }
.finale__rain { position: fixed; inset: 0; pointer-events: none; }
.finale__drop { position: absolute; top: -3rem; animation: drop linear infinite; }
.finale__card { position: relative; display: flex; flex-direction: column; align-items: center; padding: 2rem 1.5rem; border-radius: 1.5rem; border: 1px solid rgba(139, 92, 246, 0.5); background: rgba(11, 20, 34, 0.85); text-align: center; box-shadow: 0 0 90px -20px rgba(139, 92, 246, 0.8); }
.finale__eyebrow { margin-top: 1rem; font-size: 0.8125rem; font-weight: 600; color: var(--green); }
.finale__title { margin-top: 0.25rem; font-size: clamp(2rem, 8vw, 3rem); line-height: 1.05; font-weight: 800; letter-spacing: -0.04em; background: linear-gradient(90deg, #f0abfc, var(--yellow), var(--green)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.finale__text { margin-top: 0.75rem; color: var(--text-2); }
.finale__text strong { color: var(--text); }
.finale__stats { margin: 1rem 0 1.25rem; font-family: ui-monospace, Menlo, monospace; font-size: 0.875rem; color: var(--yellow); }
@keyframes drop { to { transform: translateY(calc(100vh + 6rem)) rotate(360deg); } }
body.is-terror .page, body.is-terror .site-header { filter: hue-rotate(250deg) saturate(1.6); }

/* Page effects */
#cta-run { transition: transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1), filter 0.2s, box-shadow 0.2s; }
#cta-run.is-tired { background: #475569; box-shadow: none; }
.hero__chip:hover { transform: rotate(-4deg) scale(1.05); }
.hero__code.is-burning .hero__gradient { background-image: linear-gradient(90deg, #f97316, #ef4444, #facc15); animation: flicker 0.25s infinite alternate; }
.hero__code.is-burning .hero__underglow { background: rgba(239, 68, 68, 0.7); }
@keyframes flicker { to { filter: brightness(1.35) drop-shadow(0 -4px 12px rgba(249, 115, 22, 0.8)); } }

.is-shaking { animation: shake 0.4s; }
@keyframes shake { 20% { transform: translateX(-6px) rotate(-1deg); } 40% { transform: translateX(6px) rotate(1deg); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
body.is-quaking .page, body.is-quaking .site-header, body.is-quaking .footer { animation: quake 0.12s linear 6; }
@keyframes quake { 25% { transform: translate(-6px, 3px) rotate(-0.4deg); } 50% { transform: translate(5px, -4px) rotate(0.3deg); } 75% { transform: translate(-3px, -2px); } }

.flashbang { position: fixed; inset: 0; z-index: 7000; pointer-events: none; background: #fff; animation: flashbang 1.25s ease-out forwards; }
@keyframes flashbang { 0% { opacity: 0; } 8% { opacity: 1; } 35% { opacity: 1; } 100% { opacity: 0; } }

.is-glitching { color: #f87171 !important; font-family: ui-monospace, Menlo, monospace; animation: glitch 0.12s steps(2) infinite; }
@keyframes glitch { 50% { transform: translateX(2px) skewX(-6deg); text-shadow: -2px 0 #0ff, 2px 0 #f0f; } }
body.chaos-2 .course-card:nth-child(4n + 1):hover { transform: rotate(-1.5deg); }
body.chaos-2 .course-card:nth-child(4n + 3):hover { transform: rotate(1.2deg) translateY(4px); }
body.chaos-2 .plan:hover { transform: rotate(-0.8deg) translateY(-2px); }
body.chaos-2 .faq__item summary:hover h3 { letter-spacing: 0.04em; }

.ghost-trail { position: fixed; z-index: 2400; pointer-events: none; font-size: 1.125rem; transform: translate(-50%, -50%); animation: ghost-up 0.8s ease-out forwards; }
@keyframes ghost-up { to { opacity: 0; transform: translate(-50%, -160%) scale(0.6); } }

.art-caret { animation: blink-caret 1s steps(1) infinite; }

@media (prefers-reduced-motion: reduce) {
  .is-shaking, body.is-quaking .page, body.is-quaking .site-header, body.is-quaking .footer, .is-glitching, .big-ghost { animation: none; }
  .flashbang { animation-duration: 0.6s; }
}

/* A resting ladybug breathes with CSS only, so it does not touch the DOM every frame. */
.pet:not(.is-walking) .ladybug__svg { animation: pet-idle 2.6s ease-in-out infinite; }
@keyframes pet-idle { 50% { transform: rotate(6deg) scale(1.04); } }
