/* 十萬個為什麼 — component styles. Every value comes from tokens.css; class prefix wy-. */

.wy-focus:focus-visible,
.wy-btn:focus-visible,
.wy-sticker:focus-visible,
.wy-gift:focus-visible,
.wy-listen:focus-visible,
.wy-step:focus-visible,
.wy-egg:focus-visible,
.wy-sound:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

/* Button ------------------------------------------------------------ */
.wy-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  min-height: 52px; padding: 0 var(--space-5);
  font-family: var(--font-round); font-weight: 800; font-size: 18px; line-height: 1;
  color: var(--on-light-sticker); background: var(--tomato);
  border: var(--edge-line) solid var(--sticker-line); border-radius: var(--radius-round);
  box-shadow: var(--shadow-sticker); cursor: pointer;
  transition: transform var(--dur-tap) var(--ease-out), box-shadow var(--dur-tap) var(--ease-out);
}
.wy-btn:hover { transform: translateY(-3px); box-shadow: var(--shadow-lift); }
.wy-btn:active { transform: translateY(4px) scale(0.97); box-shadow: var(--shadow-press); }
.wy-btn-quiet { background: var(--edge); }
.wy-btn-small { min-height: 40px; padding: 0 var(--space-4); font-size: 15px; }
.wy-btn svg { width: 20px; height: 20px; }

/* Sound toggle ------------------------------------------------------ */
.wy-sound {
  display: inline-flex; align-items: center; gap: var(--space-2);
  min-height: 40px; padding: 0 var(--space-4) 0 var(--space-3);
  font-family: var(--font-round); font-weight: 800; font-size: 15px;
  color: var(--on-light-sticker); background: var(--edge);
  border: var(--edge-line) solid var(--sticker-line); border-radius: var(--radius-round);
  box-shadow: var(--shadow-press); cursor: pointer;
}
.wy-sound svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.wy-sound[aria-pressed="false"] { background: var(--card); color: var(--card-soft); }

/* Stamp ------------------------------------------------------------- */
.wy-stamp {
  display: inline-block; padding: 6px 10px;
  font-family: var(--font-round); font-weight: 900; font-size: 13px; line-height: 1; letter-spacing: 0.12em;
  color: var(--ink); border: var(--edge-line) solid currentColor; border-radius: var(--radius-s);
  box-shadow: inset 0 0 0 3px var(--poster), inset 0 0 0 4px currentColor;
  transform: rotate(-6deg);
}

/* Poster ------------------------------------------------------------ */
.wy-poster {
  position: relative; color: var(--ink); background-color: var(--poster);
  background-image: radial-gradient(circle, var(--poster-dot) 2.2px, transparent 2.6px);
  background-size: 18px 18px;
  padding: var(--space-6) var(--space-4) var(--space-8);
  border-radius: var(--radius-l); overflow: hidden;
}
.wy-poster-head { display: grid; gap: var(--space-3); justify-items: start; max-width: 760px; margin-bottom: var(--space-6); }
.wy-poster-kicker { font-family: var(--font-round); font-weight: 800; font-size: 15px; color: var(--ink-soft); letter-spacing: 0.06em; }
.wy-poster-title { margin: 0; font-family: var(--font-round); font-weight: 900; font-size: clamp(40px, 9vw, 64px); line-height: 1.05; letter-spacing: 0.01em; text-wrap: balance; }
.wy-field { display: flex; flex-wrap: wrap; gap: var(--space-6) var(--space-5); align-items: flex-start; justify-content: center; }
.wy-field > :nth-child(3n+1) { --tilt: -5deg; }
.wy-field > :nth-child(3n+2) { --tilt: 4deg; margin-top: var(--space-5); }
.wy-field > :nth-child(3n) { --tilt: -2deg; margin-top: var(--space-2); }
@media (min-width: 720px) { .wy-poster { padding: var(--space-7) var(--space-7) var(--space-8); } }

/* Sticker ----------------------------------------------------------- */
.wy-sticker {
  --c: var(--tomato); --on: var(--on-light-sticker); --size: 136px;
  display: inline-flex; flex-direction: column; align-items: center; gap: var(--space-3);
  padding: 0; border: 0; background: none; color: var(--ink); font: inherit; cursor: pointer;
  perspective: 600px;
}
.wy-sticker-face {
  position: relative; display: grid; place-items: center; overflow: hidden;
  width: var(--size); height: var(--size);
  background: var(--c); color: var(--on);
  border: var(--edge-sticker) solid var(--edge);
  box-shadow: 0 0 0 var(--edge-line) var(--sticker-line), var(--shadow-sticker);
  transform: rotate(var(--tilt, 0deg));
  transition: transform var(--dur-pop) var(--ease-pop), box-shadow var(--dur-pop) var(--ease-out);
}
.wy-sticker[data-idle="true"] .wy-sticker-face { animation: wy-float var(--dur-idle) ease-in-out infinite; animation-delay: var(--delay, 0ms); }
.wy-sticker:hover .wy-sticker-face { transform: rotate(0deg) rotateX(10deg) rotateY(-12deg) translateY(-8px); box-shadow: 0 0 0 var(--edge-line) var(--sticker-line), var(--shadow-lift); }
.wy-sticker-face::after {
  content: ""; position: absolute; inset: -40%;
  background: linear-gradient(115deg, transparent 42%, var(--edge) 50%, transparent 58%);
  opacity: 0; transform: translateX(-60%); pointer-events: none;
}
.wy-sticker:hover .wy-sticker-face::after { opacity: 0.55; transform: translateX(60%); transition: transform var(--dur-unwrap) var(--ease-out), opacity var(--dur-pop) var(--ease-out); }
.wy-sticker.is-pop .wy-sticker-face { animation: wy-pop var(--dur-pop) var(--ease-pop); }
.wy-sticker-face svg { width: 62%; height: 62%; overflow: visible; }
.wy-sticker-label { max-width: 10em; font-family: var(--font-round); font-weight: 800; font-size: 18px; line-height: 1.15; text-align: center; text-wrap: balance; }
.wy-sticker-done { position: absolute; top: 8%; right: 8%; width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--mint); color: var(--on-light-sticker); border: 3px solid var(--edge); }
.wy-sticker-done svg { width: 16px; height: 16px; }
.wy-shape-circle { border-radius: 50%; }
.wy-shape-blob { border-radius: 46% 54% 58% 42% / 52% 44% 56% 48%; }
.wy-shape-square { border-radius: var(--radius-m); }
.wy-shape-pill { border-radius: var(--radius-round); width: calc(var(--size) * 1.5); }
.wy-c-tomato { --c: var(--tomato); --on: var(--on-light-sticker); }
.wy-c-cobalt { --c: var(--cobalt); --on: var(--on-dark-sticker); }
.wy-c-mint { --c: var(--mint); --on: var(--on-light-sticker); }
.wy-c-bubble { --c: var(--bubble); --on: var(--on-light-sticker); }
.wy-c-grape { --c: var(--grape); --on: var(--on-dark-sticker); }
.wy-c-sun { --c: var(--sun); --on: var(--on-light-sticker); }

/* Gift reveal ------------------------------------------------------- */
.wy-reveal { display: grid; justify-items: center; gap: var(--space-5); }
.wy-gift {
  --c: var(--cobalt); --r: var(--tomato);
  position: relative; width: 240px; height: 210px; padding: 0; border: 0; background: none; cursor: pointer;
}
.wy-gift-box, .wy-gift-lid { position: absolute; left: 50%; background: var(--c); border: var(--edge-sticker) solid var(--edge); box-shadow: 0 0 0 var(--edge-line) var(--sticker-line), var(--shadow-sticker); }
.wy-gift-box { bottom: 0; width: 200px; height: 140px; margin-left: -100px; border-radius: 0 0 var(--radius-m) var(--radius-m); transition: transform var(--dur-unwrap) var(--ease-out), opacity var(--dur-unwrap) var(--ease-out); }
.wy-gift-lid { bottom: 128px; width: 228px; height: 52px; margin-left: -114px; border-radius: var(--radius-s); z-index: 2; transition: transform var(--dur-unwrap) var(--ease-out), opacity var(--dur-unwrap) var(--ease-out); }
.wy-gift-band { position: absolute; background: var(--r); }
.wy-gift-box .wy-gift-band, .wy-gift-lid .wy-gift-band { top: 0; bottom: 0; left: 50%; width: 30px; margin-left: -15px; }
.wy-gift-bow { position: absolute; left: 50%; bottom: 172px; z-index: 3; width: 0; height: 0; transition: transform var(--dur-unwrap) var(--ease-out), opacity var(--dur-unwrap) var(--ease-out); }
.wy-gift-bow i { position: absolute; bottom: 0; width: 48px; height: 34px; background: var(--r); border: 4px solid var(--edge); border-radius: 50% 50% 50% 50% / 60% 60% 40% 40%; }
.wy-gift-bow i:first-child { right: 0; transform: rotate(-22deg); transform-origin: right bottom; }
.wy-gift-bow i:last-child { left: 0; transform: rotate(22deg); transform-origin: left bottom; }
.wy-gift:hover .wy-gift-lid { transform: translateY(-6px) rotate(-3deg); }
.wy-gift:hover .wy-gift-bow { transform: translateY(-6px); }
.wy-gift[data-state="opening"] .wy-gift-lid { transform: translate(60px, -180px) rotate(28deg); opacity: 0; }
.wy-gift[data-state="opening"] .wy-gift-bow { transform: translate(-80px, -160px) rotate(-60deg); opacity: 0; }
.wy-gift[data-state="opening"] .wy-gift-box { transform: scale(0.7) translateY(30px); opacity: 0; }
.wy-gift-hint { font-family: var(--font-round); font-weight: 800; font-size: 18px; color: var(--ink); }
.wy-confetti { position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px; border-radius: 50%; border: 3px solid var(--edge); background: var(--c); animation: wy-burst var(--dur-unwrap) var(--ease-out) forwards; pointer-events: none; }
.wy-layers { display: grid; gap: var(--space-5); width: 100%; max-width: 640px; }
.wy-layer { animation: wy-rise var(--dur-unwrap) var(--ease-pop) both; animation-delay: calc(var(--i, 0) * var(--dur-stagger) * 3); }

/* Layer card -------------------------------------------------------- */
.wy-card {
  position: relative; background: var(--card); color: var(--card-ink);
  border: var(--edge-line) solid var(--sticker-line); border-radius: var(--radius-l);
  box-shadow: var(--shadow-sticker); padding: var(--space-5) var(--space-5) var(--space-6);
  transform: rotate(var(--tilt, 0deg));
}
.wy-card-tab { position: absolute; top: -20px; left: var(--space-5); display: inline-flex; align-items: center; gap: var(--space-2); padding: 8px 14px; border-radius: var(--radius-round); background: var(--c, var(--tomato)); color: var(--on, var(--on-light-sticker)); border: 4px solid var(--edge); box-shadow: 0 0 0 var(--edge-line) var(--sticker-line); font-family: var(--font-round); font-weight: 800; font-size: 15px; line-height: 1; transform: rotate(-3deg); }
.wy-card-body { margin-top: var(--space-3); display: grid; gap: var(--space-4); }
.wy-card-kid p { margin: 0; font-family: var(--font-hand); font-size: 22px; line-height: 1.7; }
.wy-card-lab { font-family: var(--font-hand); font-size: 17px; line-height: 1.75; }

/* Listen button ----------------------------------------------------- */
.wy-listen { display: inline-flex; align-items: center; gap: var(--space-3); padding: 0; border: 0; background: none; cursor: pointer; font-family: var(--font-round); font-weight: 800; font-size: 16px; color: inherit; text-align: left; }
.wy-listen-disc { width: 72px; height: 72px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--tomato); color: var(--on-light-sticker); border: var(--edge-sticker) solid var(--edge); box-shadow: 0 0 0 var(--edge-line) var(--sticker-line), var(--shadow-sticker); transition: transform var(--dur-tap) var(--ease-out); }
.wy-listen:active .wy-listen-disc { transform: scale(0.92); }
.wy-listen-disc svg { width: 28px; height: 28px; }
.wy-listen[data-playing="true"] .wy-listen-disc { animation: wy-pulse 900ms ease-in-out infinite; }
.wy-bars { display: inline-flex; align-items: flex-end; gap: 4px; height: 28px; }
.wy-bars i { width: 6px; height: 8px; border-radius: 3px; background: var(--bubble); border: 2px solid var(--sticker-line); }
.wy-listen[data-playing="true"] .wy-bars i { animation: wy-bar 600ms ease-in-out infinite alternate; }
.wy-bars i:nth-child(2) { animation-delay: 120ms !important; }
.wy-bars i:nth-child(3) { animation-delay: 240ms !important; }
.wy-bars i:nth-child(4) { animation-delay: 360ms !important; }
.wy-listen[aria-disabled="true"] { cursor: not-allowed; }
.wy-listen[aria-disabled="true"] .wy-listen-disc { background: var(--card); color: var(--card-soft); }
.wy-listen-note { display: block; font-size: 13px; font-weight: 400; color: var(--card-soft); }

/* Step pops --------------------------------------------------------- */
.wy-steps { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.wy-step { display: grid; grid-template-columns: 36px 1fr; gap: var(--space-3); align-items: start; width: 100%; padding: var(--space-3) var(--space-4); border: var(--edge-line) solid var(--sticker-line); border-radius: var(--radius-s) var(--radius-l) var(--radius-l) var(--radius-l); background: var(--card); color: var(--card-ink); font-family: var(--font-hand); font-size: 17px; line-height: 1.6; text-align: left; cursor: pointer; animation: wy-rise var(--dur-pop) var(--ease-pop) both; }
.wy-step-n { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; background: var(--cobalt); color: var(--on-dark-sticker); border: 3px solid var(--edge); box-shadow: 0 0 0 var(--edge-line) var(--sticker-line); font-family: var(--font-round); font-weight: 900; font-size: 15px; }
.wy-step[aria-pressed="true"] .wy-step-n { background: var(--mint); color: var(--on-light-sticker); animation: wy-pop var(--dur-pop) var(--ease-pop); }
.wy-step[aria-pressed="true"] .wy-step-text { color: var(--card-soft); }
.wy-step-see { display: block; margin-top: 2px; font-size: 15px; color: var(--card-soft); }
.wy-steps-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--space-3); margin-top: var(--space-4); }
.wy-steps-count { font-family: var(--font-round); font-weight: 800; font-size: 14px; color: var(--card-soft); font-variant-numeric: tabular-nums; }

/* Easter egg -------------------------------------------------------- */
.wy-eggwrap { display: grid; justify-items: center; gap: var(--space-3); margin-top: var(--space-8); }
.wy-egg { position: relative; width: 92px; height: 116px; padding: 0; border: 0; background: none; cursor: pointer; }
.wy-egg-top, .wy-egg-bottom { position: absolute; left: 0; right: 0; background: var(--card); border: 4px solid var(--edge); box-shadow: 0 0 0 var(--edge-line) var(--sticker-line); }
.wy-egg-top { top: 0; height: 58px; border-radius: 46px 46px 0 0 / 58px 58px 0 0; border-bottom: 0; clip-path: polygon(0 0, 100% 0, 100% 100%, 84% 82%, 66% 100%, 50% 80%, 34% 100%, 16% 82%, 0 100%); transition: transform var(--dur-unwrap) var(--ease-pop), opacity var(--dur-unwrap) var(--ease-out); z-index: 2; }
.wy-egg-bottom { bottom: 0; height: 64px; border-radius: 0 0 46px 46px / 0 0 52px 52px; border-top: 0; }
.wy-egg-band { position: absolute; left: 6px; right: 6px; bottom: 34px; height: 12px; background: repeating-linear-gradient(135deg, var(--grape) 0 8px, transparent 8px 14px); border-radius: 6px; }
.wy-egg.is-wobble { animation: wy-wobble 520ms var(--ease-wobble); }
.wy-egg[aria-expanded="true"] .wy-egg-top { transform: translate(-26px, -52px) rotate(-34deg); }
.wy-egg-label { font-family: var(--font-round); font-weight: 800; font-size: 14px; color: var(--ink-soft); }
.wy-egg-panel { display: grid; grid-template-rows: 0fr; width: 100%; max-width: 680px; transition: grid-template-rows var(--dur-unwrap) var(--ease-out); }
.wy-egg-panel[data-open="true"] { grid-template-rows: 1fr; }
.wy-egg-inner { overflow: hidden; }
.wy-egg-card { margin-top: var(--space-4); background: var(--card); color: var(--card-ink); border: var(--edge-line) dashed var(--sticker-line); border-radius: var(--radius-l); padding: var(--space-5); font-family: var(--font-round); font-size: 15px; line-height: 1.75; }
.wy-egg-card ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.wy-egg-card b { font-weight: 800; color: var(--card-ink); margin-right: var(--space-2); }
.wy-egg-card a { color: var(--card-soft); }

/* Motion ------------------------------------------------------------ */
@keyframes wy-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -7px; } }
@keyframes wy-pop { 0% { scale: 1; } 35% { scale: 0.86; } 70% { scale: 1.12; } 100% { scale: 1; } }
@keyframes wy-rise { from { opacity: 0; translate: 0 36px; scale: 0.7; } to { opacity: 1; translate: 0 0; scale: 1; } }
@keyframes wy-burst { from { transform: translate(0, 0) scale(0.4); opacity: 1; } to { transform: translate(var(--dx), var(--dy)) scale(1); opacity: 0; } }
@keyframes wy-pulse { 0%, 100% { scale: 1; } 50% { scale: 1.08; } }
@keyframes wy-bar { from { height: 8px; } to { height: 28px; } }
@keyframes wy-wobble { 0%, 100% { rotate: 0deg; } 20% { rotate: -14deg; } 40% { rotate: 12deg; } 60% { rotate: -8deg; } 80% { rotate: 4deg; } }

@media (prefers-reduced-motion: reduce) {
  .wy-sticker-face, .wy-gift-lid, .wy-gift-box, .wy-gift-bow, .wy-egg-top, .wy-btn { transition-duration: 1ms !important; }
  .wy-sticker[data-idle="true"] .wy-sticker-face, .wy-listen[data-playing="true"] .wy-listen-disc, .wy-egg.is-wobble, .wy-sticker.is-pop .wy-sticker-face { animation: none; }
  .wy-layer, .wy-step { animation: wy-fade var(--dur-pop) linear both; animation-delay: 0ms; }
  .wy-confetti { display: none; }
  .wy-sticker:hover .wy-sticker-face { transform: rotate(var(--tilt, 0deg)); }
}
@keyframes wy-fade { from { opacity: 0; } to { opacity: 1; } }
