~ knotless Search/
โ†‘โ†“ moveโ†ต openโ‡งโ†ต all results

larissaboard.bsky.social/fortune-cookie

Anime-style fortune cookie landing page. Tap the cookie, get a fortune.

0
1
main
468 lines ยท 19.3 KB Raw History
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fortune Cookie-chan</title>
<link href="https://fonts.googleapis.com/css2?family=M+PLUS+Rounded+1c:wght@400;700;800&family=Zen+Maru+Gothic:wght@500;700&display=swap" rel="stylesheet">
<style>
  :root {
    --bg1: #fff4f8;
    --bg2: #eef4ff;
    --ink: #3b2f4a;
    --muted: #8a7f99;
    --pink: #ff8fb8;
    --cookie: #f6c26b;
    --cookie-dark: #d9963a;
    --aura: #ffd6e7;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; }
  body {
    font-family: "M PLUS Rounded 1c", system-ui, sans-serif;
    color: var(--ink);
    background:
      radial-gradient(circle at 15% 20%, #ffe3ef 0, transparent 40%),
      radial-gradient(circle at 85% 80%, #dfe9ff 0, transparent 45%),
      linear-gradient(160deg, var(--bg1), var(--bg2));
    min-height: 100vh;
    overflow-x: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* Background petals */
  .petal {
    position: fixed;
    top: -30px;
    width: 14px; height: 10px;
    background: #ffc2d9;
    border-radius: 14px 0 14px 0;
    opacity: .75;
    pointer-events: none;
    animation: fall linear forwards;
    z-index: 0;
  }
  @keyframes fall {
    to { transform: translate(var(--drift), 110vh) rotate(720deg); }
  }

  /* Halftone sparkle pattern band */
  .speedlines {
    position: fixed; inset: 0;
    background: repeating-conic-gradient(from 0deg at 50% 45%, rgba(255,143,184,.06) 0deg 4deg, transparent 4deg 12deg);
    pointer-events: none;
    opacity: 0;
    transition: opacity .4s;
    z-index: 0;
  }
  .speedlines.on { opacity: 1; }

  header {
    position: relative; z-index: 2;
    width: 100%;
    max-width: 960px;
    padding: 24px 20px 0;
    display: flex; justify-content: space-between; align-items: center;
  }
  .logo {
    font-weight: 800; font-size: 1.15rem;
    display: flex; align-items: center; gap: 8px;
  }
  .logo span.jp { font-family: "Zen Maru Gothic"; color: var(--pink); font-size: .9rem; }
  .counter {
    background: #fff; border-radius: 999px; padding: 6px 14px;
    font-size: .85rem; font-weight: 700;
    box-shadow: 0 3px 0 #f1d6e3;
  }

  main {
    position: relative; z-index: 2;
    flex: 1;
    width: 100%; max-width: 720px;
    padding: 24px 16px 48px;
    display: flex; flex-direction: column; align-items: center; text-align: center;
  }
  h1 {
    font-size: clamp(2rem, 6vw, 3.4rem);
    font-weight: 800;
    line-height: 1.05;
    letter-spacing: -.01em;
  }
  h1 .hl {
    background: linear-gradient(transparent 60%, #ffd1e3 60%);
    padding: 0 6px;
  }
  .sub {
    margin-top: 10px; color: var(--muted); font-size: 1rem;
  }

  /* Stage */
  .stage {
    position: relative;
    width: 300px; height: 260px;
    margin-top: 28px;
    display: grid; place-items: center;
  }
  .aura {
    position: absolute; width: 230px; height: 230px; border-radius: 50%;
    background: radial-gradient(circle, var(--aura) 0, transparent 70%);
    animation: pulse 2.4s ease-in-out infinite;
    transition: background .5s;
  }
  @keyframes pulse { 50% { transform: scale(1.12); opacity: .7; } }

  .cookie-btn {
    position: relative;
    background: none; border: 0; cursor: pointer;
    width: 260px; height: 200px;
    animation: bob 3s ease-in-out infinite;
    -webkit-tap-highlight-color: transparent;
  }
  .cookie-btn:focus-visible { outline: 3px dashed var(--pink); outline-offset: 6px; border-radius: 20px; }
  .cookie-btn:hover svg { transform: rotate(-4deg) scale(1.04); }
  .cookie-btn svg { width: 100%; height: 100%; overflow: visible; transition: transform .25s; }
  @keyframes bob { 50% { transform: translateY(-10px); } }

  .half { transition: transform .7s cubic-bezier(.2,1.6,.4,1), opacity .5s; transform-box: fill-box; }
  .half path.body { fill: var(--cookie); stroke: var(--cookie-dark); stroke-width: 4; transition: fill .5s, stroke .5s; }
  .half path.fold { fill: none; stroke: var(--cookie-dark); stroke-width: 3; stroke-linecap: round; opacity: .55; transition: stroke .5s; }
  .left { transform-origin: 100% 80%; }
  .right { transform-origin: 0% 80%; }

  .shake { animation: shake .45s linear; }
  @keyframes shake {
    0%,100% { transform: translateX(0); }
    20% { transform: translateX(-10px) rotate(-6deg); }
    40% { transform: translateX(10px) rotate(6deg); }
    60% { transform: translateX(-7px) rotate(-4deg); }
    80% { transform: translateX(7px) rotate(4deg); }
  }

  .broken .left { transform: translate(-46px, 24px) rotate(-28deg); }
  .broken .right { transform: translate(46px, 24px) rotate(28deg); }
  .broken .face-closed { opacity: 0; }
  .face-open { opacity: 0; transition: opacity .3s .2s; }
  .broken .face-open { opacity: 1; }
  .face-closed { transition: opacity .2s; }

  /* Break variants */
  .v-spin.broken svg { animation: spinout .9s ease; }
  @keyframes spinout { 0% { transform: rotate(0); } 100% { transform: rotate(360deg); } }
  .v-jelly.broken svg { animation: jelly .8s ease; }
  @keyframes jelly {
    30% { transform: scale(1.25, .75); } 50% { transform: scale(.8, 1.2); }
    70% { transform: scale(1.1, .9); } 100% { transform: scale(1); }
  }
  .v-zoom.broken svg { animation: zoom .7s ease; }
  @keyframes zoom { 40% { transform: scale(1.4); } 100% { transform: scale(1); } }
  .v-glitch.broken svg { animation: glitch .6s steps(2) 2; }
  @keyframes glitch {
    0% { transform: translate(0); filter: none; }
    25% { transform: translate(-6px, 3px); filter: hue-rotate(90deg); }
    50% { transform: translate(5px, -4px); filter: hue-rotate(200deg); }
    75% { transform: translate(-3px, -2px); filter: hue-rotate(300deg); }
  }
  .v-float.broken { animation: floaty 2s ease-in-out infinite; }
  @keyframes floaty { 50% { transform: translateY(-22px) rotate(3deg); } }
  .v-flip.broken svg { animation: flip .9s ease; }
  @keyframes flip { 100% { transform: rotateY(720deg); } }

  .hint {
    margin-top: 6px; font-weight: 700; color: var(--pink); font-size: .95rem;
    animation: blink 1.6s ease-in-out infinite;
  }
  @keyframes blink { 50% { opacity: .4; } }

  /* Fortune card */
  .card {
    position: relative;
    margin-top: 10px;
    width: min(520px, 100%);
    background: #fff;
    border-radius: 20px;
    padding: 26px 24px 20px;
    box-shadow: 0 6px 0 #f3dbe6, 0 20px 40px rgba(120, 80, 140, .12);
    transform: scale(.2) translateY(-140px) rotate(-8deg);
    opacity: 0;
    pointer-events: none;
    transition: transform .6s cubic-bezier(.2,1.5,.4,1), opacity .3s;
  }
  .card.show { transform: none; opacity: 1; pointer-events: auto; }
  .card::before {
    content: ""; position: absolute; left: 18px; right: 18px; top: 10px; height: 4px;
    border-top: 2px dashed #f2c9d9;
  }
  .tag {
    display: inline-block; font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
    padding: 4px 10px; border-radius: 999px; color: #fff;
    background: var(--cookie-dark);
  }
  .fortune {
    margin-top: 12px;
    font-family: "Zen Maru Gothic", sans-serif;
    font-weight: 700;
    font-size: clamp(1.1rem, 3.4vw, 1.4rem);
    line-height: 1.45;
  }
  .lucky { margin-top: 14px; font-size: .82rem; color: var(--muted); }
  .lucky b { color: var(--ink); }

  .again {
    margin-top: 18px;
    font-family: inherit; font-weight: 800; font-size: 1rem;
    border: 0; cursor: pointer;
    padding: 12px 24px; border-radius: 999px;
    color: #fff; background: var(--pink);
    box-shadow: 0 5px 0 #e0678f;
    transition: transform .1s, box-shadow .1s;
  }
  .again:active { transform: translateY(4px); box-shadow: 0 1px 0 #e0678f; }

  /* Particles */
  .particle {
    position: absolute; left: 50%; top: 45%;
    font-size: 22px; pointer-events: none;
    animation: burst 1.1s ease-out forwards;
    z-index: 5;
  }
  @keyframes burst {
    0% { transform: translate(-50%, -50%) scale(.3); opacity: 1; }
    100% { transform: translate(calc(-50% + var(--x)), calc(-50% + var(--y))) scale(1.2) rotate(var(--r)); opacity: 0; }
  }

  /* Sticker-y footer chips */
  .chips { margin-top: 36px; display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
  .chip {
    background: #fff; border-radius: 14px; padding: 10px 14px; font-size: .85rem; font-weight: 700;
    box-shadow: 0 3px 0 #ead6e6;
  }
  footer { position: relative; z-index: 2; padding: 0 0 24px; font-size: .8rem; color: var(--muted); }

  @media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; }
  }
</style>
</head>
<body>
  <div class="speedlines" id="lines"></div>

  <header>
    <div class="logo">๐Ÿฅ  Cookie-chan <span class="jp">ใŠใฟใใ˜</span></div>
    <div class="counter">Opened: <span id="count">0</span></div>
  </header>

  <main>
    <h1>Your destiny is <span class="hl">crunchy</span>.</h1>
    <p class="sub">Tap the cookie. Receive wisdom. Some of it is even useful.</p>

    <div class="stage" id="stage">
      <div class="aura" id="aura"></div>
      <button class="cookie-btn" id="cookie" aria-label="Break the fortune cookie">
        <svg viewBox="0 0 260 200" aria-hidden="true">
          <g class="half left">
            <path class="body" d="M130 34 C 80 30, 22 64, 26 116 C 30 154, 88 162, 130 140 Z"/>
            <path class="fold" d="M70 120 C 90 104, 112 104, 128 112"/>
            <!-- left eye + blush -->
            <g class="face-closed">
              <ellipse cx="96" cy="84" rx="8" ry="11" fill="#3b2f4a"/>
              <circle cx="99" cy="80" r="3" fill="#fff"/>
              <ellipse cx="78" cy="102" rx="10" ry="5" fill="#ff9dbd" opacity=".7"/>
              <path d="M118 104 q6 6 12 0" fill="none" stroke="#3b2f4a" stroke-width="3" stroke-linecap="round"/>
            </g>
            <g class="face-open">
              <path d="M86 84 l10 -6 l-10 -6" fill="none" stroke="#3b2f4a" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" transform="translate(4 6)"/>
              <ellipse cx="78" cy="102" rx="10" ry="5" fill="#ff9dbd" opacity=".7"/>
            </g>
          </g>
          <g class="half right">
            <path class="body" d="M130 34 C 180 30, 238 64, 234 116 C 230 154, 172 162, 130 140 Z"/>
            <path class="fold" d="M190 120 C 170 104, 148 104, 132 112"/>
            <g class="face-closed">
              <ellipse cx="164" cy="84" rx="8" ry="11" fill="#3b2f4a"/>
              <circle cx="167" cy="80" r="3" fill="#fff"/>
              <ellipse cx="182" cy="102" rx="10" ry="5" fill="#ff9dbd" opacity=".7"/>
              <path d="M130 104 q6 6 12 0" fill="none" stroke="#3b2f4a" stroke-width="3" stroke-linecap="round"/>
            </g>
            <g class="face-open">
              <path d="M174 84 l-10 -6 l10 -6" fill="none" stroke="#3b2f4a" stroke-width="3.5" stroke-linecap="round" stroke-linejoin="round" transform="translate(-4 6)"/>
              <ellipse cx="182" cy="102" rx="10" ry="5" fill="#ff9dbd" opacity=".7"/>
            </g>
          </g>
        </svg>
      </button>
    </div>

    <p class="hint" id="hint">โœฆ tap me โœฆ</p>

    <div class="card" id="card" aria-live="polite">
      <span class="tag" id="tag">Fortune</span>
      <p class="fortune" id="fortune"></p>
      <p class="lucky">Lucky numbers: <b id="nums"></b> ยท Lucky item: <b id="item"></b></p>
      <button class="again" id="again">Another cookie โœฟ</button>
    </div>

    <div class="chips">
      <div class="chip">๐Ÿ”ง Car care</div>
      <div class="chip">๐ŸŒ™ Meaning of life</div>
      <div class="chip">๐Ÿฆ† Pure nonsense</div>
      <div class="chip">๐Ÿ’– Vibes</div>
    </div>
  </main>

  <footer>Made with crumbs. No cookies were harmed. Okay, some were.</footer>

<script>
const CATS = {
  car:   { label: "Garage Oracle",   particles: ["๐Ÿ”ง","โš™๏ธ","๐Ÿš—","๐Ÿ›ž","๐Ÿ”ฉ"] },
  deep:  { label: "Cosmic Truth",    particles: ["โœจ","๐ŸŒ™","โญ","๐Ÿช","๐Ÿ’ซ"] },
  silly: { label: "Pure Nonsense",   particles: ["๐Ÿฆ†","๐ŸŒ","๐Ÿง€","๐Ÿธ","๐Ÿฅ„"] },
  heart: { label: "Soft Wisdom",     particles: ["๐Ÿ’–","๐ŸŒธ","๐ŸŽ€","๐Ÿ’•","๐Ÿก"] },
  life:  { label: "Practical Magic", particles: ["๐Ÿ™","โ˜•","๐Ÿ“š","๐Ÿงฆ","๐ŸŒฑ"] }
};

const FORTUNES = [
  // Car
  { cat:"car", text:"Check your tire pressure when the tires are cold. Warm tires lie, just like warm feelings.", color:"#7cc4ff", dark:"#3c8ed1", fx:"spin" },
  { cat:"car", text:"That squeal when you brake is not a bird. Replace your brake pads this month.", color:"#9be3c4", dark:"#3fae80", fx:"glitch" },
  { cat:"car", text:"Change your oil before the little light asks. Be the driver who anticipates.", color:"#ffb36b", dark:"#d67a26", fx:"jelly" },
  { cat:"car", text:"A clean air filter adds horsepower to your engine and peace to your soul.", color:"#b7e36b", dark:"#7aa82a", fx:"zoom" },
  { cat:"car", text:"Rotate your tires every 5,000 miles. Rotate your perspective more often.", color:"#7ce0e8", dark:"#2fa8b3", fx:"spin" },
  { cat:"car", text:"Your timing belt is older than you think. So is that sandwich in the glovebox.", color:"#ffd36b", dark:"#c99a1f", fx:"flip" },

  // Deep
  { cat:"deep", text:"Meaning is not found. It is made, one small ordinary choice at a time.", color:"#b9a6ff", dark:"#7a5ee0", fx:"float" },
  { cat:"deep", text:"The version of you that you're waiting to become is built by the version of you reading this.", color:"#a6c8ff", dark:"#5a84d9", fx:"float" },
  { cat:"deep", text:"You are not behind. There is no schedule. There never was.", color:"#d7b3ff", dark:"#9a62de", fx:"zoom" },
  { cat:"deep", text:"Most of what you fear never arrives. The rest, you will survive.", color:"#8fd0ff", dark:"#3b8fcf", fx:"float" },
  { cat:"deep", text:"Anxiety is a smoke alarm that can't tell toast from fire. Check the kitchen, then thank it and move on.", color:"#c2b6ff", dark:"#6c5bd1", fx:"jelly" },
  { cat:"deep", text:"The people who love you are not grading you. Stop handing them tests.", color:"#ffb3d1", dark:"#d9638f", fx:"float" },
  { cat:"deep", text:"Everything ends. That is exactly why it matters.", color:"#9aa8ff", dark:"#4e5cc9", fx:"flip" },

  // Silly
  { cat:"silly", text:"The duck knows. Do not ask the duck what it knows.", color:"#fff27a", dark:"#c9b71b", fx:"glitch" },
  { cat:"silly", text:"Tomorrow, wear one sock with conviction.", color:"#ff9ad5", dark:"#d14f9c", fx:"jelly" },
  { cat:"silly", text:"A banana is just a spoon that gave up. Respect it anyway.", color:"#ffe066", dark:"#cfa600", fx:"spin" },
  { cat:"silly", text:"Your next great idea is hiding behind the refrigerator with 3 grapes and a Lego.", color:"#9cf2b0", dark:"#3fbf60", fx:"zoom" },
  { cat:"silly", text:"The moon called. It said 'no thank you' and hung up. Unrelated: buy cheese.", color:"#ffc89a", dark:"#d6833a", fx:"glitch" },
  { cat:"silly", text:"Frogs do not pay rent. Consider becoming a frog.", color:"#a8f07a", dark:"#5fb52a", fx:"jelly" },
  { cat:"silly", text:"Today the soup is louder than usual. Stay hydrated.", color:"#ff8f8f", dark:"#d14a4a", fx:"flip" },
  { cat:"silly", text:"Fold a napkin into a swan. Name it Gerald. Gerald will remember this.", color:"#b2f5ea", dark:"#38b2a0", fx:"spin" },

  // Heart
  { cat:"heart", text:"Text the friend you've been thinking about. They have been thinking about you too.", color:"#ffb3c7", dark:"#e0628a", fx:"float" },
  { cat:"heart", text:"Be as patient with yourself as you are with a cat who knocks things off tables.", color:"#ffc6e0", dark:"#e07aa8", fx:"jelly" },
  { cat:"heart", text:"Someone is grateful you exist and hasn't said it today. Consider this the receipt.", color:"#ffd1dc", dark:"#de7a92", fx:"zoom" },

  // Practical life
  { cat:"life", text:"Drink a glass of water before you decide anything important.", color:"#9fe0ff", dark:"#3aa5d6", fx:"jelly" },
  { cat:"life", text:"The task you're avoiding takes eleven minutes. Set a timer for twelve.", color:"#c8f08f", dark:"#86b83a", fx:"spin" },
  { cat:"life", text:"Go to bed. The internet will still be weird tomorrow.", color:"#b0b8ff", dark:"#5d68d6", fx:"float" },
  { cat:"life", text:"Put your keys in the same place every single time. Future you is begging.", color:"#ffd59a", dark:"#d6993a", fx:"zoom" }
];

const ITEMS = ["a red umbrella","onigiri","a rubber duck","socks with stars","a spare fuse","a paper crane","matcha","a tiny wrench","a lucky pebble","a cat sticker","a torque wrench","a ramen spoon"];

const $ = id => document.getElementById(id);
const cookie = $("cookie"), card = $("card"), hint = $("hint"), stage = $("stage"), lines = $("lines");
const root = document.documentElement;

let bag = [], current = null, broken = false, busy = false, count = 0;

function draw() {
  if (!bag.length) bag = [...FORTUNES].sort(() => Math.random() - .5);
  return bag.pop();
}

function prep() {
  current = draw();
  // The next cookie already wears its fortune's color
  root.style.setProperty("--cookie", current.color);
  root.style.setProperty("--cookie-dark", current.dark);
  root.style.setProperty("--aura", current.color + "66");
}

function burst(set, n = 16) {
  for (let i = 0; i < n; i++) {
    const p = document.createElement("span");
    p.className = "particle";
    p.textContent = set[Math.floor(Math.random() * set.length)];
    const a = (Math.PI * 2 * i) / n + Math.random() * .4;
    const d = 90 + Math.random() * 90;
    p.style.setProperty("--x", Math.cos(a) * d + "px");
    p.style.setProperty("--y", Math.sin(a) * d + "px");
    p.style.setProperty("--r", (Math.random() * 360 - 180) + "deg");
    p.style.animationDelay = Math.random() * .08 + "s";
    stage.appendChild(p);
    setTimeout(() => p.remove(), 1300);
  }
}

function luckyNums() {
  const s = new Set();
  while (s.size < 4) s.add(Math.floor(Math.random() * 99) + 1);
  return [...s].join(" ยท ");
}

function breakCookie() {
  if (broken) return reset();
  if (busy) return;
  busy = true;
  cookie.classList.add("shake");
  setTimeout(() => {
    cookie.classList.remove("shake");
    cookie.classList.add("broken", "v-" + current.fx);
    lines.classList.add("on");
    burst(CATS[current.cat].particles);

    $("tag").textContent = CATS[current.cat].label;
    $("tag").style.background = current.dark;
    $("fortune").textContent = current.text;
    $("nums").textContent = luckyNums();
    $("item").textContent = ITEMS[Math.floor(Math.random() * ITEMS.length)];
    card.classList.add("show");
    hint.style.visibility = "hidden";
    $("count").textContent = ++count;
    broken = true; busy = false;
    cookie.setAttribute("aria-label", "Get another fortune cookie");
  }, 450);
}

function reset() {
  card.classList.remove("show");
  lines.classList.remove("on");
  cookie.className = "cookie-btn";
  setTimeout(() => {
    prep();
    broken = false;
    hint.style.visibility = "visible";
    cookie.setAttribute("aria-label", "Break the fortune cookie");
  }, 250);
}

cookie.addEventListener("click", breakCookie);
$("again").addEventListener("click", reset);

// Sakura petals
function petal() {
  const el = document.createElement("div");
  el.className = "petal";
  el.style.left = Math.random() * 100 + "vw";
  el.style.setProperty("--drift", (Math.random() * 200 - 100) + "px");
  const dur = 8 + Math.random() * 7;
  el.style.animationDuration = dur + "s";
  const s = .6 + Math.random() * .8;
  el.style.transform = `scale(${s})`;
  document.body.appendChild(el);
  setTimeout(() => el.remove(), dur * 1000);
}
if (!matchMedia("(prefers-reduced-motion: reduce)").matches) {
  setInterval(petal, 700);
  for (let i = 0; i < 6; i++) setTimeout(petal, i * 200);
}

prep();
</script>
</body>
</html>