/* Critterhill styles: cozy storybook look */
:root {
  --ink: #3a2c45;
  --ink-soft: #6e5c7c;
  --cream: #fff8ec;
  --paper: #fffdf6;
  --sky: #d6ecff;
  --pink: #ff9fb2;
  --mint: #a6e3b4;
  --butter: #ffe08a;
  --lav: #cdbdff;
  --peach: #ffcfae;
  --up: #2f9e5b;
  --down: #d6486b;
  --shadow: 3px 4px 0 var(--ink);
  --r: 18px;
  --font-head: 'Fredoka', 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
  --font-body: 'Nunito', 'Trebuchet MS', system-ui, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink); font-family: var(--font-body); font-size: 16px; line-height: 1.5;
  background: linear-gradient(180deg, #ffeedd 0%, var(--cream) 220px, #f4f9ff 100%);
  min-height: 100vh; overflow-x: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 600; margin: 0 0 .4em; line-height: 1.15; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
.wrap { width: min(1280px, 100% - 32px); margin-inline: auto; }

/* header */
.top { position: sticky; top: 0; z-index: 30; background: rgba(255, 248, 236, .93); backdrop-filter: blur(6px); border-bottom: 3px solid var(--ink); }
.top .wrap { display: flex; align-items: center; gap: 14px; padding: 8px 0; flex-wrap: wrap; }
.logo { display: flex; align-items: center; gap: 8px; font-family: var(--font-head); font-size: 24px; font-weight: 700; text-decoration: none; }
.logo svg { width: 34px; height: 34px; }
.logo small { font-family: var(--font-body); font-size: 12px; font-weight: 700; color: var(--ink-soft); }
.nav { display: flex; gap: 4px; margin-left: 6px; }
.nav a { text-decoration: none; font-weight: 800; padding: 6px 12px; border-radius: 999px; }
.nav a:hover, .nav a.on { background: var(--butter); }
.sp { flex: 1; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { border: 2px solid var(--ink); border-radius: 999px; padding: 2px 10px; font-size: 13px; font-weight: 800; background: var(--paper); white-space: nowrap; }
.chip b { font-family: var(--font-head); }
.chip.demo { background: var(--lav); }

/* hero */
.hero { padding: 22px 0 14px; display: flex; gap: 20px; align-items: center; flex-wrap: wrap; }
.hero h1 { font-size: clamp(26px, 4vw, 40px); margin-bottom: 6px; }
.hero p { margin: 0; max-width: 640px; color: var(--ink-soft); font-weight: 600; }
.hero .cta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.btn { border: 3px solid var(--ink); background: var(--butter); border-radius: 14px; padding: 7px 14px; font-weight: 800; box-shadow: 2px 3px 0 var(--ink); text-decoration: none; display: inline-block; transition: transform .1s, box-shadow .1s; }
.btn:hover { transform: translate(-1px, -1px); box-shadow: 3px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 3px); box-shadow: 0 0 0 var(--ink); }
.btn.alt { background: var(--paper); }
.btn.pink { background: var(--pink); }
.btn.sm { padding: 3px 10px; font-size: 14px; border-width: 2px; border-radius: 11px; box-shadow: 1px 2px 0 var(--ink); }

/* app */
.app { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; height: clamp(540px, calc(100vh - 150px), 800px); margin-bottom: 40px; }
.stage { position: relative; border: 3px solid var(--ink); border-radius: 22px; overflow: hidden; box-shadow: var(--shadow); background: #bfe3ff; display: flex; flex-direction: column; min-height: 0; }
.view { position: relative; flex: 1; min-height: 0; }
#hill { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
#hill.pointer { cursor: pointer; }
#hill.dragging { cursor: grabbing; }
.strip { background: var(--ink); color: #fff; height: 30px; overflow: hidden; position: relative; border-bottom: 3px solid var(--ink); flex: none; }
.strip-track { display: flex; white-space: nowrap; will-change: transform; height: 100%; align-items: center; }
.tk { padding-right: 26px; font-size: 13px; font-weight: 800; display: inline-flex; gap: 7px; align-items: center; cursor: pointer; flex: none; }
.tk .t { color: var(--butter); font-family: var(--font-head); }
.tk .m { opacity: .75; }
.tk .up { color: #8ff0b0; } .tk .dn { color: #ff9db3; }
.ctrl { position: absolute; top: 10px; right: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; z-index: 4; }
.ctrl .row { display: flex; gap: 6px; }
.zoom { display: flex; flex-direction: column; gap: 4px; position: absolute; right: 10px; bottom: 12px; z-index: 4; }
.zoom button { width: 34px; height: 34px; border: 3px solid var(--ink); background: var(--paper); border-radius: 12px; font-weight: 900; font-size: 18px; line-height: 1; box-shadow: 1px 2px 0 var(--ink); padding: 0; }
.legend { position: absolute; left: 10px; bottom: 12px; z-index: 4; background: rgba(255, 253, 246, .94); border: 3px solid var(--ink); border-radius: 16px; padding: 8px 12px; font-size: 12.5px; font-weight: 700; max-width: 250px; box-shadow: 2px 3px 0 var(--ink); }
.legend h4 { font-size: 14px; margin: 0 0 4px; }
.legend ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.legend li::before { content: ''; display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; border: 2px solid var(--ink); vertical-align: -1px; background: var(--mint); }
.legend li.s::before { background: var(--butter); } .legend li.t::before { background: var(--pink); } .legend li.f::before { background: #ddd; }
.legend-btn { display: none; position: absolute; left: 10px; bottom: 12px; z-index: 5; }
#toasts { position: absolute; left: 50%; transform: translateX(-50%); top: 46px; display: grid; gap: 6px; z-index: 6; pointer-events: none; width: max-content; max-width: 90%; }
.toast { background: var(--paper); border: 3px solid var(--ink); border-radius: 14px; padding: 4px 12px; font-weight: 800; font-size: 14px; box-shadow: 2px 3px 0 var(--ink); animation: pop .3s ease-out; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: none; opacity: 1; } }

/* card */
.card { position: absolute; left: 10px; top: 10px; width: 292px; z-index: 5; background: var(--paper); border: 3px solid var(--ink); border-radius: 18px; box-shadow: 3px 4px 0 var(--ink); padding: 10px 12px 12px; animation: pop .2s ease-out; }
.card[hidden] { display: none; }
.card .hd { display: flex; gap: 10px; align-items: center; }
.card canvas.spr { width: 64px; height: 75px; flex: none; background: radial-gradient(circle at 50% 80%, #fff 0 30%, transparent 70%); }
.card h3 { font-size: 20px; margin: 0; }
.card .nm { font-size: 13px; color: var(--ink-soft); font-weight: 700; }
.pill { display: inline-block; border: 2px solid var(--ink); border-radius: 999px; padding: 0 8px; font-size: 12px; font-weight: 800; background: var(--mint); }
.pill.slide { background: #ffc2cf; } .pill.faded { background: #ddd; } .pill.summit { background: var(--butter); } .pill.egg { background: var(--lav); }
.card .x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 22px; font-weight: 900; line-height: 1; padding: 2px 6px; }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 8px 0; font-size: 13px; font-weight: 700; }
.stats span { color: var(--ink-soft); display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .04em; }
.stats b { font-family: var(--font-head); font-size: 16px; }
.bar { position: relative; height: 14px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; overflow: hidden; margin: 4px 0; }
.bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--mint), var(--butter)); border-right: 2px solid var(--ink); transition: width .4s; }
.bar u { position: absolute; top: 0; bottom: 0; width: 0; border-left: 2px dashed rgba(58, 44, 69, .5); }
.card canvas.spark { width: 100%; height: 56px; display: block; border-radius: 10px; background: #f4fbff; border: 2px solid var(--ink); }
.card .acts { display: flex; gap: 8px; margin-top: 8px; }

/* side */
.side { border: 3px solid var(--ink); border-radius: 22px; background: var(--paper); box-shadow: var(--shadow); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.tabs { display: flex; gap: 4px; padding: 8px 8px 0; overflow-x: auto; flex: none; border-bottom: 3px solid var(--ink); background: var(--cream); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { border: 3px solid var(--ink); border-bottom: 0; border-radius: 12px 12px 0 0; background: #f3e8d6; padding: 4px 10px; font-weight: 800; font-size: 14px; white-space: nowrap; margin-bottom: -3px; }
.tabs button.on { background: var(--paper); padding-bottom: 7px; }
.tabs b { font-size: 11px; background: var(--pink); border-radius: 99px; padding: 0 6px; margin-left: 3px; border: 2px solid var(--ink); }
.panel { display: none; flex: 1; overflow-y: auto; padding: 8px 10px; min-height: 0; }
.panel.on { display: block; }
.empty { color: var(--ink-soft); font-weight: 700; padding: 16px 4px; text-align: center; }
.msg, .story, .row-i { display: flex; gap: 8px; padding: 7px 0; border-bottom: 2px dotted rgba(58, 44, 69, .25); font-size: 14px; align-items: flex-start; }
.msg p, .story p { margin: 1px 0 0; }
.msg .dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--ink); flex: none; margin-top: 4px; }
.msg > div, .story > div { flex: 1; min-width: 0; }
time { font-size: 11px; color: var(--ink-soft); font-weight: 700; flex: none; }
[data-coin] { cursor: pointer; }
b[data-coin] { font-family: var(--font-head); font-weight: 600; background: rgba(255, 224, 138, .55); border-radius: 6px; padding: 0 4px; }
b[data-coin]:hover { background: var(--butter); }
.story .ic { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--ink); display: grid; place-items: center; font-size: 12px; flex: none; background: var(--mint); }
.story.k-fade .ic { background: #ddd; } .story.k-slide .ic { background: #ffc2cf; } .story.k-summit .ic { background: var(--butter); } .story.k-sky .ic { background: var(--lav); } .story.k-hatch .ic { background: var(--peach); }
.row-i { align-items: center; cursor: pointer; }
.row-i:hover { background: rgba(255, 224, 138, .25); }
.row-i canvas { width: 38px; height: 44px; flex: none; }
.row-i .gr { flex: 1; min-width: 0; line-height: 1.25; }
.row-i .gr small { color: var(--ink-soft); font-weight: 700; display: block; }
.row-i .rt { text-align: right; font-weight: 800; font-size: 13px; }
.cen-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 10px; }
.cen-grid div { border: 2px solid var(--ink); border-radius: 12px; padding: 4px 8px; background: #fff; }
.cen-grid span { font-size: 11px; font-weight: 800; color: var(--ink-soft); text-transform: uppercase; display: block; }
.cen-grid b { font-family: var(--font-head); font-size: 20px; }
.panel h4 { font-size: 15px; margin: 12px 0 4px; }
.hist { display: flex; align-items: flex-end; gap: 3px; height: 86px; border-bottom: 3px solid var(--ink); padding: 0 2px; }
.hist i { flex: 1; background: var(--mint); border: 2px solid var(--ink); border-bottom: 0; border-radius: 6px 6px 0 0; min-height: 2px; position: relative; }
.hist i:nth-child(n+3):nth-child(-n+5) { background: #bfe3a0; } .hist i:nth-child(n+6) { background: var(--butter); } .hist i:last-child { background: var(--pink); }
.hist-l { display: flex; justify-content: space-between; font-size: 11px; font-weight: 800; color: var(--ink-soft); }
.hb { display: grid; grid-template-columns: 74px 1fr 30px; gap: 6px; align-items: center; font-size: 13px; font-weight: 700; margin: 3px 0; }
.hb div { height: 12px; border: 2px solid var(--ink); border-radius: 99px; background: #fff; overflow: hidden; }
.hb i { display: block; height: 100%; background: var(--lav); }
#cenPop { width: 100%; height: 70px; display: block; border: 2px solid var(--ink); border-radius: 10px; background: #f4fbff; }
.x-btn { border: 0; background: none; font-weight: 900; font-size: 18px; padding: 0 4px; }

/* landing sections */
.section { padding: 34px 0; }
.section h2 { font-size: clamp(24px, 3.5vw, 34px); text-align: center; }
.section .lead { text-align: center; color: var(--ink-soft); font-weight: 700; max-width: 620px; margin: 0 auto 22px; }
.grid3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.tile { border: 3px solid var(--ink); border-radius: var(--r); background: var(--paper); padding: 16px; box-shadow: var(--shadow); }
.tile .n { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--ink); display: grid; place-items: center; font-family: var(--font-head); font-weight: 700; background: var(--pink); margin-bottom: 8px; }
.tile:nth-child(2) .n { background: var(--mint); } .tile:nth-child(3) .n { background: var(--butter); } .tile:nth-child(4) .n { background: var(--lav); }
.tile h3 { font-size: 19px; }
.tile p { margin: 0; color: var(--ink-soft); font-weight: 600; font-size: 15px; }
.faq { max-width: 760px; margin: 0 auto; display: grid; gap: 10px; }
details { border: 3px solid var(--ink); border-radius: 14px; background: var(--paper); padding: 8px 14px; box-shadow: 2px 3px 0 var(--ink); }
summary { font-weight: 800; cursor: pointer; font-family: var(--font-head); font-size: 17px; }
details p { margin: 6px 0 2px; color: var(--ink-soft); font-weight: 600; }
.foot { border-top: 3px solid var(--ink); background: var(--ink); color: #f3e9ff; padding: 22px 0 28px; margin-top: 30px; font-size: 14px; }
.foot .wrap { display: flex; gap: 18px; flex-wrap: wrap; justify-content: space-between; align-items: center; }
.foot a { color: var(--butter); }
.foot .chip { color: var(--ink); }
.prose { max-width: 800px; margin: 0 auto; padding: 24px 0; }
.prose h1 { font-size: clamp(30px, 5vw, 44px); }
.prose h2 { font-size: 26px; margin-top: 28px; text-align: left; }
.prose p, .prose li { color: #55446a; font-weight: 600; }
table.map { width: 100%; border-collapse: separate; border-spacing: 0; border: 3px solid var(--ink); border-radius: 14px; overflow: hidden; background: var(--paper); font-size: 15px; }
table.map th, table.map td { padding: 8px 12px; text-align: left; border-bottom: 2px dotted rgba(58, 44, 69, .3); vertical-align: top; }
table.map th { background: var(--butter); font-family: var(--font-head); }
.demo-box { border: 3px solid var(--ink); border-radius: var(--r); background: var(--paper); box-shadow: var(--shadow); padding: 14px; display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.demo-box input { font: inherit; font-weight: 800; border: 3px solid var(--ink); border-radius: 12px; padding: 6px 12px; width: 170px; text-transform: uppercase; background: #fff; }
.demo-box canvas { width: 120px; height: 140px; }

/* responsive */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; height: auto; }
  .stage { height: 64vh; min-height: 400px; }
  .side { height: 460px; }
  .legend { display: none; }
  .legend.open { display: block; bottom: 56px; }
  .legend-btn { display: inline-block; }
  .card { left: 8px; right: 8px; top: auto; bottom: 8px; width: auto; }
  .zoom { bottom: auto; top: 134px; }
  .chips .chip.opt { display: none; }
}
@media (max-width: 520px) {
  .logo small { display: none; }
  .nav a { padding: 4px 8px; font-size: 14px; }
  .ctrl .btn { font-size: 13px; padding: 3px 8px; }
  .hero { padding-top: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }

/* wallet + adopt */
#wallet-slot { display: inline-flex; align-items: center; }
#wallet-slot .ws-btn { border: 2px solid var(--ink); box-shadow: 2px 3px 0 var(--ink); padding: 4px 12px; font-weight: 800; }
.pill.adopted { background: #ffd0da; }
.card .acts .btn:disabled { opacity: .55; cursor: default; }
@media (max-width: 520px) { .top .wrap { gap: 8px; } #wallet-slot .ws-btn { padding: 3px 8px; font-size: 13px; } }
.pill[hidden] { display: none; }
