/* NPC on Canton · v2, drawn in ms paint */
:root {
  --sky: #89f5ff;
  --grey: #a4a4a4;
  --ink: #0c0d10;
  --paper: #ffffff;
  --gold: #ffc93a;
  --gut: clamp(16px, 4vw, 56px);
  --f: "Gaegu", "Comic Sans MS", "Chalkboard SE", cursive;
  /* hand drawn box corners */
  --wob1: 255px 15px 225px 15px / 15px 225px 15px 255px;
  --wob2: 15px 225px 15px 255px / 255px 15px 225px 15px;
  --wob3: 225px 20px 245px 18px / 22px 245px 18px 225px;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font: 700 21px/1.3 var(--f);
  overflow-x: hidden;
}
h1, h2, p, ul, figure { margin: 0; }
ul { padding: 0; list-style: none; }
a { color: inherit; }
button { font: inherit; color: inherit; cursor: pointer; }
svg { display: block; }
:focus-visible { outline: 3px dashed var(--ink); outline-offset: 4px; }

/* line boil: swap the noise seed on drawn things */
.boil { animation: boil .42s steps(1) infinite; }
@keyframes boil {
  0% { filter: url(#boil1); }
  33% { filter: url(#boil2); }
  66% { filter: url(#boil3); }
}

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 52px; padding: 6px 22px 8px;
  background: var(--paper); color: var(--ink);
  border: 3px solid var(--ink); border-radius: var(--wob1);
  box-shadow: 4px 5px 0 var(--ink);
  font: 700 24px/1 var(--f); text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn:hover { transform: translate(-2px, -2px) rotate(-1deg); box-shadow: 6px 7px 0 var(--ink); }
.btn:active { transform: translate(3px, 4px); box-shadow: 1px 1px 0 var(--ink); }
.btn--gold { background: var(--gold); }
.btn--sm { min-height: 42px; padding: 4px 16px 6px; font-size: 21px; box-shadow: 3px 4px 0 var(--ink); }
.btn--xl { min-height: 70px; padding: 8px 34px 10px; font-size: 34px; border-radius: var(--wob2); }

/* ---------- nav ---------- */
.nav {
  position: absolute; inset: 0 0 auto; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--gut);
}
.nav-brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-size: 30px; }
.nav-brand svg { width: 46px; height: 46px; }
.nav-links { display: flex; align-items: center; gap: 22px; font-size: 24px; }
.nav-links a:not(.btn) { text-decoration: none; background-image: linear-gradient(var(--ink), var(--ink)); background-size: 100% 3px; background-position: 0 92%; background-repeat: no-repeat; padding-bottom: 2px; }
.nav-links a:not(.btn):hover { background-size: 100% 9px; background-image: linear-gradient(rgba(255, 255, 255, .9), rgba(255, 255, 255, .9)); }

/* ---------- hero ---------- */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  padding: 110px var(--gut) 0;
  overflow: hidden;
}
.hero-copy { position: relative; z-index: 3; padding-bottom: 60px; }
.mark { width: min(100%, 640px); }
.mark-svg { width: 100%; height: auto; overflow: visible; }
.mark-l { fill: var(--grey); stroke: var(--ink); stroke-width: 7; stroke-linejoin: round; }
.mark-on { margin-top: 6px; font-size: clamp(28px, 3vw, 42px); letter-spacing: .32em; padding-left: .3em; }
.tag { margin: 14px 0 34px; font-size: clamp(30px, 3.4vw, 50px); line-height: 1.02; max-width: 15ch; }
.cta { display: flex; flex-wrap: wrap; align-items: center; gap: 18px 24px; }
.cta-note { display: flex; align-items: center; gap: 8px; font-size: 22px; }
.cta-note svg { width: 54px; height: 28px; flex: none; }

.hero-npc { position: relative; align-self: stretch; min-height: 640px; }
.face {
  position: absolute; right: -2%; bottom: 0;
  width: min(100%, 64vh, 600px); aspect-ratio: 1;
  padding: 0; border: 0; background: none;
  transform-origin: 50% 100%;
}
.face-svg { width: 100%; height: 100%; overflow: visible; }
.face:hover .face-svg, .face:focus-visible .face-svg { transform: rotate(-1.2deg); }
.face.is-poked { animation: poke .3s ease; }
@keyframes poke { 30% { transform: translateY(6px) scaleY(.98); } 60% { transform: translateY(-4px); } }

.bubble {
  position: absolute; z-index: 4; left: 0; top: 4%;
  width: min(88%, 440px);
  padding: 22px 24px 20px;
  background: var(--paper);
  border: 3px solid var(--ink); border-radius: var(--wob3);
}
.bubble-text { font-size: 28px; line-height: 1.2; min-height: 2.4em; }
.bubble-text .caret { display: inline-block; width: 3px; height: .9em; margin-left: 3px; background: var(--ink); vertical-align: -2px; animation: blink .7s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
.bubble-extra:empty { display: none; }
.bubble-extra { margin-top: 14px; }
.bubble-tail { position: absolute; right: 22%; bottom: -46px; width: 60px; height: 50px; }
.opts {
  display: flex; flex-wrap: wrap; gap: 10px;
  margin-top: 16px; padding-top: 14px;
  border-top: 3px dashed var(--ink);
}
.opt {
  min-height: 44px; padding: 3px 16px 6px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--wob2);
  font-size: 22px;
  transition: transform .12s ease, background .12s;
}
.opt:hover { background: var(--gold); transform: rotate(-2deg) scale(1.04); }
.opt:nth-child(2n):hover { transform: rotate(2deg) scale(1.04); }
.opt[disabled] { opacity: .45; pointer-events: none; }
.opt--locked { display: inline-flex; align-items: center; gap: 6px; background: #d9d9d9; color: #555; border-style: dashed; }
.opt--locked svg { width: 16px; height: 16px; }
.opt--free { background: #3dff8b; }
.opt.is-shake { animation: shake .35s; }
@keyframes shake { 25%, 75% { transform: translateX(-5px); } 50% { transform: translateX(5px); } }

/* ---------- section titles ---------- */
.h2 { font-size: clamp(44px, 6vw, 88px); line-height: .95; }
.h2 span { font-size: .5em; font-weight: 400; }

/* ---------- lore strip ---------- */
.lore { padding: clamp(80px, 10vw, 140px) var(--gut) clamp(60px, 8vw, 110px); background: var(--paper); border-top: 4px solid var(--ink); border-bottom: 4px solid var(--ink); }
.lore .h2 { max-width: 1400px; margin: 0 auto 34px; }
.strip { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: clamp(18px, 2.4vw, 34px); }
.panel {
  position: relative;
  border: 4px solid var(--ink); border-radius: 6px 10px 5px 12px;
  background: var(--sky);
  overflow: hidden;
  transform: rotate(var(--r, 0deg));
}
.panel figcaption {
  position: absolute; z-index: 2; left: 12px; top: 12px; right: 30%;
  padding: 6px 12px 8px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--wob1);
  font-size: clamp(18px, 1.7vw, 24px); line-height: 1.12;
}
.panel--night figcaption { right: 12px; }
.panel--capbr figcaption { top: auto; bottom: 12px; left: 42%; right: 12px; }
.panel-svg { width: 100%; height: auto; aspect-ratio: 4 / 3; }
.lore-foot { max-width: 1400px; margin: 34px auto 0; font-size: clamp(24px, 2.4vw, 34px); text-align: center; }

/* ---------- crowd ---------- */
.crowd { padding: clamp(80px, 10vw, 130px) 0 0; overflow: hidden; }
.crowd-head { max-width: 1400px; margin: 0 auto; padding: 0 var(--gut); }
.crowd-sub { margin-top: 10px; font-size: clamp(24px, 2.4vw, 32px); display: flex; flex-wrap: wrap; gap: 8px 20px; align-items: baseline; }
.crowd-count { font-size: .8em; padding: 2px 14px 4px; background: var(--paper); border: 3px solid var(--ink); border-radius: var(--wob1); }
.crowd-field { position: relative; height: clamp(420px, 44vw, 620px); margin-top: 24px; touch-action: manipulation; }
.cn {
  position: absolute; bottom: 0; padding: 0; border: 0; background: none;
  transform-origin: 50% 100%;
  animation: idle var(--d, 3s) ease-in-out var(--dl, 0s) infinite alternate;
  -webkit-tap-highlight-color: transparent;
}
.cn svg { width: 100%; height: 100%; overflow: visible; }
.cn:focus-visible { outline: none; }
.cn:focus-visible svg { filter: drop-shadow(0 0 0 var(--ink)) drop-shadow(0 0 6px #fff); }
.cn.is-nudge { animation: nudge .35s; }
.cn.is-found svg { filter: drop-shadow(0 0 12px var(--gold)); }
@keyframes idle { to { transform: translateY(-1.5%) rotate(var(--r, .6deg)); } }
@keyframes nudge { 30% { transform: rotate(-7deg); } 65% { transform: rotate(6deg); } }
.say {
  position: absolute; z-index: 400; transform: translate(-50%, -100%);
  max-width: 240px; padding: 10px 14px 12px;
  background: var(--paper); border: 3px solid var(--ink); border-radius: var(--wob3);
  font-size: 20px; line-height: 1.15; text-align: center; pointer-events: none;
  animation: pop .2s ease;
}
.say.is-gold { background: var(--gold); }
@keyframes pop { from { opacity: 0; transform: translate(-50%, -88%) scale(.9); } }

/* ---------- join ---------- */
.join { background: var(--paper); border-top: 4px solid var(--ink); padding: clamp(80px, 10vw, 130px) var(--gut); }
.join .h2 { max-width: 1400px; margin: 0 auto 40px; }
.join-grid { max-width: 1400px; margin: 0 auto; display: grid; grid-template-columns: minmax(0, 440px) minmax(0, 1fr); gap: clamp(30px, 5vw, 80px); align-items: start; }
.card {
  background: var(--sky);
  border: 4px solid var(--ink); border-radius: var(--wob3);
  padding: 24px 26px 22px;
  transform: rotate(-2deg);
  box-shadow: 8px 9px 0 var(--ink);
}
.card-top { display: flex; gap: 16px; align-items: center; padding-bottom: 14px; border-bottom: 3px dashed var(--ink); }
.card-pic { width: 96px; height: 96px; flex: none; background: var(--paper); border: 3px solid var(--ink); border-radius: 12px; }
.card-k { font-size: 20px; font-weight: 400; }
.card-id { font-size: 46px; line-height: 1; }
.card-stats { padding: 12px 0; border-bottom: 3px dashed var(--ink); }
.card-stats li { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 22px; }
.card-stats span { font-weight: 400; }
.card-sign { padding-top: 12px; font-size: 22px; font-weight: 400; }
.card-sign i { font-weight: 700; }
.join-sub { font-size: clamp(26px, 2.6vw, 36px); line-height: 1.15; max-width: 24ch; margin-bottom: 30px; }
.facts { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }
.facts li { padding: 3px 14px 6px; border: 3px solid var(--ink); border-radius: var(--wob2); background: var(--sky); font-size: 21px; }
.ca { display: flex; align-items: center; gap: 14px; margin-top: 24px; max-width: 640px; }
.ca p { min-width: 0; flex: 1; }
.ca small { display: block; font-size: 18px; font-weight: 400; }
.ca code { display: block; font: 700 22px/1.1 var(--f); overflow-wrap: anywhere; }

/* ---------- footer ---------- */
.foot { border-top: 4px solid var(--ink); padding: 26px var(--gut) 34px; font-size: 17px; font-weight: 400; line-height: 1.4; }
.foot p { max-width: 1400px; margin: 0 auto; }
.foot-c { margin-bottom: 12px !important; font-size: 24px; font-weight: 700; }
.foot-c a { text-decoration-thickness: 3px; text-underline-offset: 4px; }
.foot-c a:hover { background: var(--gold); }

/* ---------- error dialog ---------- */
.err {
  position: fixed; z-index: 100; left: 50%; top: 50%; transform: translate(-50%, -50%) rotate(-1.5deg);
  width: min(420px, calc(100% - 32px));
  background: #e6e6e6; border: 4px solid var(--ink); border-radius: 6px;
  box-shadow: 10px 11px 0 var(--ink);
}
.err[hidden] { display: none; }
.err-bar { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 6px 14px; background: #2a5bd7; color: #fff; border-bottom: 4px solid var(--ink); font-size: 22px; }
.err-x { width: 32px; height: 30px; border: 3px solid var(--ink); background: #e6e6e6; color: var(--ink); font-size: 20px; line-height: 1; padding: 0 0 3px; }
.err-body { display: flex; gap: 14px; align-items: center; padding: 20px 18px 10px; font-size: 22px; line-height: 1.2; }
.err-body svg { width: 44px; height: 44px; flex: none; }
.err-actions { display: flex; justify-content: flex-end; padding: 8px 18px 18px; }

/* ---------- responsive ---------- */
@media (max-width: 1000px) {
  .join-grid { grid-template-columns: 1fr; }
  .card { max-width: 440px; }
}
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding-top: 96px; align-items: start; }
  .hero-copy { padding-bottom: 20px; }
  .mark { width: min(100%, 460px); }
  .hero-npc { min-height: 640px; }
  .face { right: 50%; transform: translateX(50%); width: min(96%, 460px); }
  .face:hover .face-svg { transform: none; }
  .bubble { top: 0; width: min(100%, 420px); }
  .hero-npc { display: flex; flex-direction: column; }
  .bubble { position: relative; }
  .bubble-tail { right: 30%; }
}
@media (max-width: 640px) {
  body { font-size: 19px; }
  .nav-brand { font-size: 24px; }
  .nav-brand svg { width: 38px; height: 38px; }
  .nav-links { gap: 14px; font-size: 20px; }
  .tag { margin-bottom: 26px; }
  .btn--xl { font-size: 28px; min-height: 62px; padding: 6px 26px 9px; }
  .strip { grid-template-columns: 1fr; }
  .panel figcaption { right: 12px; }
  .panel--capbr figcaption { left: 30%; }
  .hero-npc { min-height: 600px; }
  .bubble-text { font-size: 24px; }
  .crowd-field { height: 400px; }
  .say { font-size: 17px; max-width: 180px; }
}
@media (max-width: 380px) {
  .nav-links a:not(.btn) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .boil { animation: none; }
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
