/* Visual candy shared by every page: the transition cover, parchment checkboxes with kunai, toasts,
   the settings scroll, cursor sparks, button ink, easter-egg props. Behaviour lives in js/fx.js. */

/* ---- page transition ------------------------------------------------------------------------ */
html.fx-cover { background: #05060c !important; }
html.fx-cover body { visibility: hidden; }
#fxTransition {
  position: fixed;
  left: 0;
  top: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2147483600;
  pointer-events: all;
  visibility: visible;
}

/* ---- parchment checkbox with a kunai ---------------------------------------------------------- */
.nc {
  --ang: 0deg;
  --tear: polygon(3% 10%, 11% 2%, 22% 8%, 35% 1%, 50% 7%, 63% 0%, 77% 6%, 90% 1%, 98% 12%, 94% 26%, 100% 40%, 95% 55%, 100% 70%, 94% 84%, 99% 96%, 86% 100%, 72% 94%, 58% 100%, 42% 95%, 28% 100%, 14% 94%, 4% 99%, 0% 86%, 6% 72%, 1% 58%, 7% 43%, 0% 28%);
  position: relative;
  display: inline-block;
  width: 28px;
  height: 28px;
  flex: none;
  vertical-align: middle;
  margin: 0 6px 0 0;
  -webkit-tap-highlight-color: transparent;
}
.nc.t1 { --tear: polygon(0% 6%, 14% 0%, 27% 7%, 41% 2%, 56% 8%, 70% 1%, 85% 6%, 100% 0%, 96% 15%, 100% 30%, 93% 44%, 99% 59%, 94% 73%, 100% 88%, 90% 100%, 76% 93%, 61% 99%, 47% 94%, 33% 100%, 19% 95%, 6% 100%, 2% 88%, 8% 74%, 0% 60%, 5% 46%, 0% 32%, 6% 18%); }
.nc.t2 { --tear: polygon(4% 4%, 18% 9%, 30% 0%, 46% 6%, 60% 1%, 74% 8%, 88% 0%, 100% 7%, 95% 22%, 100% 36%, 96% 50%, 100% 66%, 95% 80%, 100% 93%, 84% 98%, 70% 92%, 55% 100%, 40% 93%, 25% 99%, 10% 92%, 0% 97%, 5% 82%, 0% 68%, 7% 53%, 1% 38%, 6% 24%); }
.nc.t3 { --tear: polygon(0% 12%, 9% 3%, 24% 9%, 38% 0%, 53% 8%, 67% 2%, 82% 9%, 96% 0%, 100% 18%, 95% 33%, 100% 47%, 94% 62%, 100% 77%, 96% 91%, 88% 100%, 73% 95%, 59% 100%, 44% 92%, 30% 99%, 16% 93%, 3% 100%, 0% 85%, 6% 70%, 1% 55%, 7% 40%, 0% 26%); }
.nc > input[type="checkbox"] {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  opacity: 0 !important;
  cursor: pointer;
  z-index: 3;
  -webkit-appearance: none;
  appearance: none;
}
.nc-shadow {
  position: absolute;
  inset: 0;
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
  transition: transform 0.15s ease;
}
.nc:hover .nc-shadow { transform: rotate(-4deg) scale(1.08); }
.nc-paper {
  position: absolute;
  inset: 0;
  clip-path: var(--tear);
  background:
    radial-gradient(circle at 28% 24%, rgba(255, 255, 255, 0.6), transparent 55%),
    radial-gradient(circle at 82% 88%, rgba(120, 78, 28, 0.38), transparent 52%),
    radial-gradient(circle at 12% 80%, rgba(150, 100, 40, 0.22), transparent 40%),
    linear-gradient(135deg, #f4e6bd, #d9bf87 60%, #c8a566);
}
.nc-mark {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  pointer-events: none;
}
.nc-kunai {
  position: absolute;
  left: 50%;
  top: 50%;
  /* size, margin and transform-origin are set by fx.js for the weapon that is in the box (kunai / shuriken / sealed kunai) */
  width: 50px;
  height: 12.5px;
  margin: -6.25px 0 0 -50px;
  transform-origin: 100% 50%;
  transform: rotate(var(--ang)) scale(0);
  opacity: 0;
  pointer-events: none;
  z-index: 2;
  overflow: visible;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55));
}
.nc.on .nc-kunai { transform: rotate(var(--ang)) scale(1); opacity: 1; }
/* the shuriken keeps its own rotation inside (see starHTML in fx.js): the clip must not turn with it */
.nc-kunai.nc-star { transform: scale(0); }
.nc.on .nc-kunai.nc-star { transform: scale(1); opacity: 1; }
.nc.stick .nc-kunai.nc-star { animation: ncWobbleStar 0.4s ease-out; }
.nc-clip, .nc-spin { position: absolute; inset: 0; display: block; }
@keyframes ncWobbleStar {
  0% { transform: rotate(8deg) scale(1); }
  40% { transform: rotate(-5deg) scale(1); }
  70% { transform: rotate(2deg) scale(1); }
  100% { transform: rotate(0) scale(1); }
}
.nc.on .nc-mark { filter: saturate(0.7); }
.nc.stick .nc-shadow { animation: ncShake 0.24s ease-out; }
.nc.stick .nc-kunai { animation: ncWobble 0.4s ease-out; }
@keyframes ncShake {
  0% { transform: translate(0, 0) rotate(0); }
  25% { transform: translate(2px, -1px) rotate(6deg); }
  55% { transform: translate(-1px, 1px) rotate(-4deg); }
  100% { transform: none; }
}
@keyframes ncWobble {
  0% { transform: rotate(calc(var(--ang) + 10deg)) scale(1); }
  40% { transform: rotate(calc(var(--ang) - 6deg)) scale(1); }
  70% { transform: rotate(calc(var(--ang) + 2.5deg)) scale(1); }
  100% { transform: rotate(var(--ang)) scale(1); }
}
.nc:has(input:disabled) { opacity: 0.45; }
.nc:has(input:disabled) > input { cursor: not-allowed; }
.nc:has(input:focus-visible)::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 2px solid var(--accent-2, #29b6f6);
  border-radius: 7px;
  pointer-events: none;
}
/* the kunai that flies in / falls away is a separate fixed element */
.fx-kunai {
  position: fixed;
  left: 0;
  top: 0;
  width: 50px;
  height: 12.5px;
  margin: -6.25px 0 0 -50px;
  transform-origin: 100% 50%;
  z-index: 2147483000;
  pointer-events: none;
  overflow: visible;
  will-change: transform;
  filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55));
}
.fx-speck {
  position: fixed;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: #d9bf87;
  pointer-events: none;
  z-index: 2147483000;
}

/* ---- shuriken flanking the big title ---------------------------------------------------------------- */
h1.title { position: relative; }
h1.title::before,
h1.title::after {
  content: "";
  position: absolute;
  top: 50%;
  width: clamp(26px, 5vw, 50px);
  height: clamp(26px, 5vw, 50px);
  margin-top: calc(clamp(26px, 5vw, 50px) / -2);
  background: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='-50 -50 100 100'><path d='M0-48 L9-14 L46 0 L9 14 L0 48 L-9 14 L-46 0 L-9-14 Z' fill='%23d9e2f0' stroke='%235a6a85' stroke-width='3'/><circle r='9' fill='%231c2130'/></svg>") center / contain no-repeat;
  filter: drop-shadow(0 0 10px rgba(255, 178, 56, 0.55));
  animation: shurikenSpin 6s linear infinite;
  opacity: 0.9;
  pointer-events: none;
}
h1.title::before { left: clamp(0px, 4vw, 40px); }
h1.title::after { right: clamp(0px, 4vw, 40px); animation-direction: reverse; }
@keyframes shurikenSpin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { h1.title::before, h1.title::after { animation: none; } }
@media (max-width: 520px) { h1.title::before, h1.title::after { display: none; } }

/* ---- toasts ------------------------------------------------------------------------------------ */
#fxToasts {
  position: fixed;
  top: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 2147483200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  pointer-events: none;
  width: min(92vw, 420px);
}
.fx-toast {
  --tear: polygon(0% 14%, 4% 2%, 12% 8%, 22% 0%, 35% 7%, 48% 1%, 62% 8%, 75% 0%, 88% 6%, 97% 1%, 100% 20%, 96% 40%, 100% 60%, 97% 82%, 100% 98%, 86% 92%, 72% 100%, 58% 93%, 44% 100%, 30% 94%, 16% 100%, 5% 93%, 0% 100%, 3% 78%, 0% 58%, 4% 38%);
  clip-path: var(--tear);
  background: linear-gradient(135deg, #f4e6bd, #d9bf87 70%, #c8a566);
  color: #3a2410;
  padding: 11px 22px;
  font-weight: 700;
  font-size: 15px;
  text-align: center;
  filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.5));
  animation: toastIn 0.32s cubic-bezier(0.2, 1.2, 0.3, 1) both;
}
.fx-toast.good { color: #17431f; }
.fx-toast.bad { color: #5a1410; }
.fx-toast .ti { margin-right: 8px; }
.fx-toast.out { animation: toastOut 0.3s ease-in both; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-24px) rotate(-3deg) scale(0.8); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-16px) scale(0.9); } }

/* ---- settings scroll ----------------------------------------------------------------------------- */
#fxGear {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 2147483100;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 2px solid var(--gold, #ffb238);
  background: radial-gradient(circle at 35% 30%, #2b4a66, #10202f);
  color: var(--gold, #ffb238);
  font-size: 19px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 0 14px rgba(255, 178, 56, 0.35);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  padding: 0;
}
#fxGear:hover { transform: rotate(90deg) scale(1.08); box-shadow: 0 0 22px rgba(255, 178, 56, 0.6); }
#fxPanel {
  --tear: polygon(0% 3%, 7% 0%, 15% 2%, 26% 0%, 40% 2%, 55% 0%, 70% 2%, 84% 0%, 94% 2%, 100% 0%, 99% 14%, 100% 30%, 98% 48%, 100% 66%, 99% 84%, 100% 100%, 88% 98%, 74% 100%, 60% 98%, 46% 100%, 32% 98%, 18% 100%, 6% 98%, 0% 100%, 1% 82%, 0% 64%, 2% 46%, 0% 28%, 1% 12%);
  width: min(92vw, 330px);
  padding: 20px 22px 18px;
  clip-path: var(--tear);
  background:
    radial-gradient(circle at 20% 10%, rgba(255, 255, 255, 0.5), transparent 50%),
    radial-gradient(circle at 90% 90%, rgba(120, 78, 28, 0.3), transparent 55%),
    linear-gradient(135deg, #f4e6bd, #d9bf87 70%, #c8a566);
  color: #3a2410;
  display: none;
  transform-origin: 100% 0;
}
#fxPanel.open { display: block; animation: panelUnroll 0.28s cubic-bezier(0.2, 1, 0.3, 1) both; }
@keyframes panelUnroll { from { opacity: 0; transform: scaleY(0.2) rotate(2deg); } to { opacity: 1; transform: none; } }
#fxPanel h3 { margin: 0 0 12px; font-size: 14px; letter-spacing: 3px; text-transform: uppercase; color: #6a3a14; }
#fxPanel .row2 { display: flex; align-items: center; gap: 8px; margin: 9px 0; font-weight: 700; font-size: 14px; }
#fxPanel label { cursor: pointer; display: flex; align-items: center; gap: 4px; flex: 1; }
#fxPanel input[type="range"] { flex: 1; accent-color: #b3361f; }
#fxPanel select {
  background: #f8edc9;
  border: 1px solid #a07a3a;
  border-radius: 4px;
  color: #3a2410;
  font: inherit;
  padding: 2px 6px;
}
#fxPanel .hint { font-size: 12px; font-weight: 600; opacity: 0.7; margin-top: 10px; line-height: 1.4; }

/* ---- cursor sparks / click / button ink -------------------------------------------------------- */
#fxCursor {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 2147483050;
  pointer-events: none;
}
.fx-ripple {
  position: absolute;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.55), rgba(255, 178, 56, 0.25) 60%, transparent 70%);
  transform: scale(0);
  animation: rippleOut 0.6s ease-out forwards;
  pointer-events: none;
}
@keyframes rippleOut { to { transform: scale(1); opacity: 0; } }

/* ---- hand-cursor scroll edges ------------------------------------------------------------------ */
.fx-scroll-edge {
  position: fixed;
  left: 0;
  right: 0;
  height: 90px;
  z-index: 9990;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.12s linear;
  display: flex;
  justify-content: center;
  font-size: 30px;
  color: #ffd166;
  text-shadow: 0 0 16px rgba(255, 178, 56, 0.9);
}
.fx-scroll-edge.top { top: 0; align-items: flex-start; background: linear-gradient(180deg, rgba(255, 178, 56, 0.45), transparent); }
.fx-scroll-edge.bottom { bottom: 0; align-items: flex-end; background: linear-gradient(0deg, rgba(255, 178, 56, 0.45), transparent); }
.fx-scroll-edge span { animation: edgeBob 0.7s ease-in-out infinite alternate; }
.fx-scroll-edge.top span { margin-top: 6px; }
.fx-scroll-edge.bottom span { margin-bottom: 6px; }
@keyframes edgeBob { from { transform: translateY(-5px); } to { transform: translateY(5px); } }

/* ---- easter-egg props ------------------------------------------------------------------------------ */
.fx-emoji { position: fixed; z-index: 2147483000; pointer-events: none; font-size: 34px; will-change: transform; user-select: none; }
.fx-stuck { position: absolute; z-index: 2147482000; pointer-events: none; overflow: visible; filter: drop-shadow(0 1px 1.5px rgba(0, 0, 0, 0.55)); }
.fx-flash { position: fixed; inset: 0; z-index: 2147483300; pointer-events: none; background: #fff; opacity: 0; animation: flashAnim 0.5s ease-out; }
@keyframes flashAnim { 0% { opacity: 0.85; } 100% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
  .fx-toast, #fxPanel.open, .nc.stick .nc-shadow, .nc.stick .nc-kunai { animation: none !important; }
  .fx-scroll-edge span { animation: none; }
}

/* ---- settings panel on the home page ---------------------------------------------------------------- */
.prefs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.pref-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border-radius: 10px; background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.pref-row:hover { border-color: var(--gold, #ffb238); background: rgba(255,178,56,0.07); }
.pref-row b { display: block; font-size: 14px; }
.pref-row small { display: block; color: var(--ink-dim, #b9d4ea); font-size: 12px; margin-top: 2px; line-height: 1.35; }

/* ---- arsenal editor ---------------------------------------------------------------------------------- */
.wp-stage { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 12px; }
.wp-card { border-radius: 12px; border: 1px solid rgba(255,255,255,0.14); background: rgba(0,0,0,0.25); padding: 8px; text-align: center; }
.wp-card canvas { width: 100%; height: auto; border-radius: 8px; display: block; }
.wp-card-name { font-weight: 800; margin: 6px 0 2px; }
.wp-mix { font-size: 13px; color: var(--ink-dim, #b9d4ea); display: inline-flex; align-items: center; cursor: pointer; }
.wp-presets { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 14px; }
.wp-controls { align-items: flex-start; }
.wp-h { font-weight: 800; letter-spacing: 2px; text-transform: uppercase; font-size: 12px; color: var(--gold, #ffb238); margin-bottom: 8px; }
.wp-check { display: flex; align-items: center; margin: 6px 0; cursor: pointer; font-size: 14px; }
.wp-glyphs { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.wp-glyph { padding: 4px 0; font-size: 18px; line-height: 1.2; border-radius: 6px; border: 1px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.05); color: var(--ink, #fff); cursor: pointer; }
.wp-glyph.active { background: linear-gradient(180deg, #ff9a3e, #d9490f); color: #1a0f06; border-color: var(--gold, #ffb238); }
.wp-glow { display: flex; align-items: center; gap: 12px; margin: 10px 0; }
.wp-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 10px; }
@media (max-width: 640px) { .wp-stage { grid-template-columns: 1fr; } }

/* ---- chakra sense: "MediaPipe found your hands" ------------------------------------------------------ */
.hs-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 6; }
.hs-chip { position: absolute; left: 6px; bottom: 6px; z-index: 7; display: flex; align-items: center; gap: 6px; padding: 3px 9px 3px 6px; border-radius: 999px; font: 700 11px "Segoe UI", sans-serif; letter-spacing: .3px; color: #cfe9ff; background: rgba(8, 16, 30, 0.78); border: 1px solid rgba(120, 200, 255, 0.35); backdrop-filter: blur(4px); pointer-events: none; transition: border-color .2s, color .2s, box-shadow .2s; }
.hs-eye { width: 20px; height: 13px; }
.hs-lid { fill: rgba(8, 16, 30, 0.9); stroke: currentColor; stroke-width: 1.4; transform-origin: 16px 10px; transform: scaleY(0.08); transition: transform .25s ease; }
.hs-iris { fill: #4ad0ff; opacity: 0; transition: opacity .2s; }
.hs-pupil { fill: #05101c; opacity: 0; }
.hs-chip:not([data-state="none"]) .hs-lid { transform: scaleY(1); }
.hs-chip:not([data-state="none"]) .hs-iris, .hs-chip:not([data-state="none"]) .hs-pupil { opacity: 1; }
.hs-chip[data-state="both"] { color: #7ff0c0; border-color: rgba(100, 240, 190, 0.7); box-shadow: 0 0 10px rgba(80, 230, 180, 0.4); }
.hs-chip[data-state="both"] .hs-iris { fill: #4af0b0; }
.hs-chip[data-state="one"], .hs-chip[data-state="weak"] { color: #ffd166; border-color: rgba(255, 209, 102, 0.7); }
.hs-chip[data-state="one"] .hs-iris, .hs-chip[data-state="weak"] .hs-iris { fill: #ffd166; }
.hs-chip[data-state="rescue"], .hs-chip[data-state="bridge"] { color: #ffb066; border-color: rgba(255, 150, 60, 0.8); box-shadow: 0 0 10px rgba(255, 140, 50, 0.4); }
.hs-chip[data-state="rescue"] .hs-iris, .hs-chip[data-state="bridge"] .hs-iris { fill: #ff9a3e; }
.hs-chip.hs-pop { animation: hsPop .45s ease-out; }
@keyframes hsPop { 0% { transform: scale(0.7); } 55% { transform: scale(1.12); } 100% { transform: scale(1); } }
.hs-found { box-shadow: 0 0 0 2px rgba(110, 230, 255, 0.35), 0 0 18px rgba(80, 200, 255, 0.35) !important; }
@media (prefers-reduced-motion: reduce) { .hs-chip.hs-pop { animation: none; } }
