/* Twist & Match v2. Direction: sticker-book neo-brutalism. Thick ink outlines, hard offset shadows and loud
   fills on the site's lilac canvas; the board is a holographic "lab glass" window where the Flavor Fam lives.
   Single light look by design (every color set explicitly). */
:root {
  --canvas: #EEEDF4;
  --dots: rgba(22, 19, 31, .07);
  --paper: #FFFDF7;
  --ink: #16131F;
  --muted: #4E4860;
  --lime: #E8FC56;
  --lilac: #BD90FD;
  --mint: #9EE8E0;
  --pink: #FF4FB8;
  --sky: #5B8CFF;
  --orange: #FF7A3D;
  --glass-a: #2D1E68;
  --glass-b: #140F2C;
  --display: "Bricolage Grotesque", system-ui, sans-serif;
  --body: "Instrument Sans", system-ui, sans-serif;
  --mono: "Geist Mono", ui-monospace, monospace;
  --e1: cubic-bezier(.22, .8, .24, 1);
  --pop: cubic-bezier(.34, 1.56, .64, 1);
  --hard: 4px 4px 0 var(--ink);
  color-scheme: light;
}
html, body { background: var(--canvas); color: var(--ink); }
body {
  margin: 0; font-family: var(--body); -webkit-tap-highlight-color: transparent;
  background-image: radial-gradient(var(--dots) 1.2px, transparent 1.3px); background-size: 18px 18px;
}
* { box-sizing: border-box; }
button { font: inherit; color: inherit; cursor: pointer; }
button:focus-visible, a:focus-visible { outline: 3px solid var(--pink); outline-offset: 3px; }

.tm {
  max-width: 520px; margin: 0 auto;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 12px 32px;
  display: flex; flex-direction: column; gap: 14px;
}

/* sticker primitives */
.tm-stk { border: 2.5px solid var(--ink); box-shadow: var(--hard); border-radius: 16px; background: var(--paper); }
.tm-press { transition: transform .12s var(--e1), box-shadow .12s var(--e1); }
.tm-press:active:not([disabled]) { transform: translate(3px, 3px); box-shadow: 1px 1px 0 var(--ink); }

/* top bar */
.tm-bar { display: flex; align-items: center; gap: 8px; min-height: 44px; }
.tm-title { flex: 1; min-width: 0; font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.tm-home { color: var(--ink); text-decoration: none; }
a.tm-home:hover { text-decoration: underline; text-decoration-color: var(--pink); text-underline-offset: 3px; }
.tm-pill { display: inline-flex; align-items: center; gap: 5px; height: 36px; padding: 0 11px; border-radius: 999px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font-family: var(--mono); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tm-pill svg { width: 15px; height: 15px; flex: none; }
.tm-icon-btn { width: 40px; height: 40px; border-radius: 13px; border: 2.5px solid var(--ink); background: var(--paper); box-shadow: 2px 2px 0 var(--ink); display: grid; place-items: center; flex: none; }
.tm-icon-btn svg { width: 18px; height: 18px; }

/* HUD */
.tm-hud { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: stretch; }
.tm-moves { width: 82px; border-radius: 20px; background: var(--ink); color: var(--paper); display: grid; place-items: center; text-align: center; padding: 8px 0; border: 2.5px solid var(--ink); box-shadow: 4px 4px 0 var(--pink); }
.tm-moves b { display: block; font-family: var(--display); font-weight: 800; font-size: 36px; line-height: 1; font-variant-numeric: tabular-nums; color: var(--lime); }
.tm-moves span { font-family: var(--mono); font-size: 10px; letter-spacing: .14em; text-transform: uppercase; opacity: .8; }
.tm-moves.low { animation: tm-throb .9s ease-in-out infinite; box-shadow: 4px 4px 0 var(--orange); }
.tm-moves.low b { color: var(--orange); }
@keyframes tm-throb { 50% { transform: scale(1.05) rotate(-2deg); } }
.tm-goal-wrap { min-width: 0; display: flex; flex-direction: column; justify-content: space-between; gap: 8px; }
.tm-goals { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tm-chip { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 11px 0 4px; border-radius: 999px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 2px 2px 0 var(--ink); font-family: var(--mono); font-weight: 600; font-size: 14px; font-variant-numeric: tabular-nums; }
.tm-chip.score { padding-left: 11px; }
.tm-chip canvas { width: 28px; height: 28px; }
.tm-chip.done { background: var(--lime); }
.tm-vibe { display: inline-flex; align-items: center; gap: 5px; height: 26px; padding: 0 9px; border-radius: 999px; font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; border: 2px solid var(--ink); }
.tm-vibe i { display: inline-flex; gap: 2px; }
.tm-vibe i b { width: 4px; height: 10px; border-radius: 2px; background: rgba(22, 19, 31, .2); }
.tm-vibe i b.on { background: var(--ink); }
.tm-vibe.chill { background: var(--mint); } .tm-vibe.balanced { background: var(--paper); } .tm-vibe.bold { background: var(--lilac); } .tm-vibe.spicy { background: var(--orange); }
.tm-score { display: flex; align-items: center; gap: 10px; }
.tm-score-num { font-family: var(--mono); font-weight: 600; font-size: 13px; font-variant-numeric: tabular-nums; min-width: 62px; }
.tm-meter { position: relative; flex: 1; height: 12px; border-radius: 99px; background: var(--paper); border: 2px solid var(--ink); }
.tm-meter i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--pink), var(--lilac) 45%, var(--mint) 75%, var(--lime)); transition: width .45s var(--e1); }
.tm-meter .tm-star { position: absolute; top: 50%; width: 20px; height: 20px; transform: translate(-50%, -50%); }

/* board */
.tm-board {
  position: relative; border-radius: 26px; padding: 8px; border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  background:
    radial-gradient(circle at 12% 8%, rgba(255, 79, 184, .45), transparent 42%),
    radial-gradient(circle at 92% 95%, rgba(158, 232, 224, .4), transparent 45%),
    radial-gradient(circle at 80% 15%, rgba(232, 252, 86, .18), transparent 35%),
    linear-gradient(160deg, var(--glass-a), var(--glass-b));
}
.tm-board canvas { display: block; width: 100%; height: auto; aspect-ratio: 1; touch-action: none; border-radius: 18px; max-width: 100%; }
.tm-board.shake { animation: tm-shake .38s ease-out; }
@keyframes tm-shake { 20% { transform: translate(-5px, 2px) rotate(-.6deg); } 40% { transform: translate(5px, -2px) rotate(.6deg); } 60% { transform: translate(-3px, 1px); } 80% { transform: translate(2px, -1px); } }
.tm-praise {
  position: absolute; left: 50%; top: 46%; pointer-events: none; white-space: nowrap;
  font-family: var(--display); font-weight: 800; font-size: clamp(30px, 10vw, 50px); letter-spacing: -.03em;
  -webkit-text-stroke: 2px var(--ink); paint-order: stroke fill;
  text-shadow: 4px 4px 0 var(--ink);
  opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(var(--rot, -6deg));
}
.tm-praise.show { animation: tm-praise 1s var(--pop) forwards; }
@keyframes tm-praise { 0% { opacity: 0; transform: translate(-50%, -50%) scale(.4) rotate(var(--rot)); } 18% { opacity: 1; transform: translate(-50%, -50%) scale(1.08) rotate(var(--rot)); } 75% { opacity: 1; transform: translate(-50%, -55%) scale(1) rotate(var(--rot)); } 100% { opacity: 0; transform: translate(-50%, -70%) scale(.95) rotate(var(--rot)); } }

/* boosters */
.tm-boosters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.tm-boost { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 3px; padding: 8px 9px 10px; text-align: left; min-width: 0; }
.tm-boost canvas { width: 40px; height: 40px; margin-bottom: 2px; }
.tm-boost b { font-family: var(--display); font-weight: 800; font-size: 14px; line-height: 1.1; }
.tm-boost small { font-size: 12px; color: var(--muted); line-height: 1.25; }
.tm-boost .tm-count { position: absolute; top: -9px; right: -7px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 99px; background: var(--pink); color: var(--paper); border: 2.5px solid var(--ink); font-family: var(--mono); font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.tm-boost.b-longevity { background: #FFF1C9; } .tm-boost.b-sport { background: #DDE7FF; } .tm-boost.b-sleep { background: #EBDDFF; }
.tm-boost[disabled] { opacity: .5; cursor: default; box-shadow: 2px 2px 0 var(--ink); }

/* map */
.tm-hero { position: relative; display: flex; flex-direction: column; gap: 6px; padding-top: 6px; }
.tm-hero h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: clamp(46px, 15vw, 70px); line-height: .86; letter-spacing: -.05em; }
.tm-hero h1 span { display: inline-block; }
.tm-hero h1 .amp { color: var(--pink); -webkit-text-stroke: 2.5px var(--ink); paint-order: stroke fill; transform: rotate(-8deg); }
.tm-hero h1 .hl { background: var(--lime); padding: 0 .1em .04em; border: 3px solid var(--ink); border-radius: .16em; box-shadow: 5px 5px 0 var(--ink); transform: rotate(-2deg); margin-top: 6px; }
.tm-hero p { margin: 10px 0 0; color: var(--muted); font-size: 15.5px; line-height: 1.45; max-width: 34ch; }
.tm-sticker { position: absolute; display: grid; place-items: center; text-align: center; border: 2.5px solid var(--ink); border-radius: 50%; box-shadow: 3px 3px 0 var(--ink); font-family: var(--display); font-weight: 800; line-height: .95; }
.tm-sticker.s1 { right: 2%; top: 0; width: 82px; height: 82px; background: var(--pink); color: var(--paper); font-size: 15px; transform: rotate(12deg); animation: tm-spin 14s linear infinite; }
.tm-sticker.s1 em { font-style: normal; display: block; font-size: 26px; }
.tm-sticker.s2 { right: 24%; top: 58px; width: 54px; height: 54px; background: var(--lime); font-size: 18px; transform: rotate(-10deg); }
@keyframes tm-spin { to { transform: rotate(372deg); } }
.tm-status { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tm-world {
  border-radius: 28px; color: var(--paper); padding: 18px 16px 24px; display: flex; flex-direction: column; gap: 6px; border: 3px solid var(--ink); box-shadow: 6px 6px 0 var(--ink);
  background:
    radial-gradient(circle at 90% 0%, rgba(158, 232, 224, .45), transparent 40%),
    radial-gradient(circle at 0% 60%, rgba(255, 79, 184, .35), transparent 40%),
    linear-gradient(170deg, var(--glass-a), var(--glass-b));
}
.tm-world header { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.tm-world h2 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -.03em; }
.tm-eyebrow { font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.tm-world .tm-eyebrow { color: var(--lime); }
.tm-world p { margin: 0; font-size: 14px; line-height: 1.45; color: rgba(255, 253, 247, .78); max-width: 38ch; }
.tm-path { display: flex; flex-direction: column; gap: 10px; margin-top: 16px; }
.tm-node-row { display: flex; }
.tm-node { width: 66px; height: 66px; border-radius: 50%; border: 3px solid var(--ink); background: #3A2D73; color: rgba(255, 253, 247, .7); display: grid; place-items: center; position: relative; box-shadow: 3px 3px 0 var(--ink); }
.tm-node b { font-family: var(--display); font-weight: 800; font-size: 22px; }
.tm-node.open { background: var(--lilac); color: var(--ink); }
.tm-node.next { background: var(--lime); color: var(--ink); animation: tm-bob 1.5s ease-in-out infinite; }
.tm-node.next::after { content: "you"; position: absolute; top: -14px; right: -18px; padding: 2px 7px; border-radius: 99px; background: var(--pink); color: var(--paper); border: 2px solid var(--ink); font-family: var(--mono); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; transform: rotate(10deg); }
.tm-node[disabled] { cursor: default; }
.tm-node svg.lock { width: 22px; height: 22px; }
.tm-node .tm-stars { position: absolute; bottom: -10px; left: 50%; transform: translateX(-50%); display: flex; gap: 0; }
.tm-node .tm-stars svg { width: 18px; height: 18px; }
@keyframes tm-bob { 50% { transform: translateY(-5px) rotate(-3deg); } }
.tm-soon { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tm-soon div { padding: 12px; min-width: 0; }
.tm-soon div:first-child { background: #FFF1C9; transform: rotate(-1.2deg); }
.tm-soon div:last-child { background: #D8F6F1; transform: rotate(1.2deg); }
.tm-soon b { display: block; font-family: var(--display); font-weight: 800; font-size: 17px; }
.tm-soon span { font-size: 12.5px; color: var(--muted); }
.tm-cta { display: flex; flex-direction: column; gap: 10px; padding: 16px; }
.tm-cta p { margin: 0; font-size: 14px; line-height: 1.45; color: var(--muted); }
.tm-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 52px; padding: 0 20px; border-radius: 16px; border: 2.5px solid var(--ink); box-shadow: var(--hard); background: var(--ink); color: var(--paper); font-family: var(--display); font-weight: 800; font-size: 17px; text-decoration: none; }
.tm-btn.lime { background: var(--lime); color: var(--ink); }
.tm-btn.pink { background: var(--pink); color: var(--paper); }
.tm-btn.ghost { background: var(--paper); color: var(--ink); }
.tm-link { color: var(--ink); font-weight: 700; text-decoration-color: var(--pink); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.tm-foot { font-family: var(--mono); font-size: 11px; color: var(--muted); text-align: center; letter-spacing: .04em; }

/* modal */
.tm-modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 20px max(16px, env(safe-area-inset-left, 0px)); background: rgba(22, 19, 31, .6); backdrop-filter: blur(3px); }
.tm-card { width: min(100%, 400px); max-height: calc(100dvh - 40px); overflow: auto; border-radius: 28px; background: var(--paper); border: 3px solid var(--ink); box-shadow: 7px 7px 0 var(--ink); padding: 22px 20px 20px; display: flex; flex-direction: column; gap: 12px; animation: tm-pop .4s var(--pop); }
.tm-card h3 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: -.035em; line-height: .98; text-wrap: balance; }
.tm-card p { margin: 0; color: var(--muted); font-size: 15px; line-height: 1.45; }
.tm-card .tm-eyebrow { color: var(--muted); }
.tm-card .tm-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 6px; }
.tm-card .tm-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.tm-bigstars { display: flex; gap: 4px; }
.tm-bigstars svg { width: 54px; height: 54px; }
.tm-bigstars svg:nth-child(2) { transform: translateY(-8px); }
.tm-bigstars svg.on { animation: tm-pop .5s var(--pop) both; }
.tm-bigstars svg.on:nth-child(2) { animation-delay: .15s; } .tm-bigstars svg.on:nth-child(3) { animation-delay: .3s; }
.tm-legend { display: grid; grid-template-columns: 40px 1fr; gap: 8px 10px; align-items: center; font-size: 14px; line-height: 1.3; padding: 10px; border-radius: 16px; background: #F3EEFF; border: 2px solid var(--ink); }
.tm-legend canvas { width: 40px; height: 40px; }
.tm-legend b { font-family: var(--display); font-weight: 800; }
.tm-gift { padding: 10px 12px; border-radius: 14px; background: var(--lime); border: 2.5px solid var(--ink); font-size: 14px; font-weight: 700; transform: rotate(-1deg); }
.tm-note { font-size: 13px !important; }
@keyframes tm-pop { from { transform: scale(.82) rotate(-3deg); opacity: 0; } }
.tm-confetti { position: fixed; inset: 0; z-index: 30; pointer-events: none; width: 100%; height: 100%; }
@media (prefers-reduced-motion: reduce) {
  .tm-node.next, .tm-card, .tm-bigstars svg.on, .tm-sticker.s1, .tm-moves.low, .tm-board.shake { animation: none; }
  .tm-praise.show { animation-duration: .01s; opacity: 1; }
}
