* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #ffffff;
}

body {
  min-width: 320px;
}

#bubble-stage {
  display: block;
  width: 100vw;
  height: 100vh;
  cursor: default;
  touch-action: none;
  user-select: none;
}

#bubble-stage.can-grab {
  cursor: grab;
}

#bubble-stage.is-grabbing {
  cursor: grabbing;
}

#bubble-stage.is-drawing {
  cursor: crosshair;
}

#kanji-layer {
  position: fixed;
  inset: 0;
  z-index: 2147483647;
  pointer-events: none;
  overflow: hidden;
}

#kanji-drawing-layer {
  position: absolute;
  inset: 0;
  z-index: 3;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.kanji-label {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 1;
  min-width: 1em;
  height: 1em;
  padding: 0 0.06em;
  display: grid;
  place-items: center;
  white-space: nowrap;
  color: rgba(0, 0, 0, 0.92);
  font-family:
    "Hiragino Mincho ProN",
    "Yu Mincho",
    "Noto Serif CJK KR",
    "Noto Serif CJK JP",
    serif;
  font-weight: 650;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  text-shadow: none;
  filter: none;
  opacity: 0;
  will-change: transform, opacity, font-size;
}

.kanji-label::before,
.kanji-label::after {
  content: attr(data-kanji);
  position: absolute;
  inset: 0 0.06em;
  display: grid;
  place-items: center;
  pointer-events: none;
}

.kanji-label::before {
  color: rgba(0, 0, 0, 0.07);
  transform: translate(-0.014em, 0.016em) scale(1.014);
  filter: blur(0.018em);
}

.kanji-label::after {
  color: rgba(0, 0, 0, 0.055);
  transform: translate(0.012em, -0.010em) scale(0.992);
}

#bubble-glossary {
  position: absolute;
  left: 0;
  top: 0;
  z-index: 9999;
  max-width: min(280px, 54vw);
  min-width: 112px;
  padding: 10px 14px 11px;
  border: 2px solid rgba(16, 18, 17, 0.92);
  border-radius: 27px 23px 31px 25px / 24px 30px 22px 28px;
  background:
    radial-gradient(circle at 21% 18%, rgba(255, 255, 255, 0.96), transparent 38%),
    rgba(255, 255, 255, 0.82);
  box-shadow:
    1.4px 0.8px 0 rgba(16, 18, 17, 0.50),
    -0.9px 1.6px 0 rgba(16, 18, 17, 0.28),
    0 0 0 1px rgba(16, 18, 17, 0.18),
    0 9px 24px rgba(46, 72, 78, 0.14),
    inset 0 0 18px rgba(255, 255, 255, 0.56);
  color: rgba(18, 22, 22, 0.92);
  font-family:
    "Hiragino Sans",
    "Noto Sans CJK JP",
    "Noto Sans CJK KR",
    "Apple SD Gothic Neo",
    sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  line-height: 1.32;
  letter-spacing: 0;
  text-align: left;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(7px) saturate(1.08);
  isolation: isolate;
  will-change: transform, opacity, left, top;
}

#bubble-glossary::before,
#bubble-glossary::after {
  content: "";
  position: absolute;
  display: block;
  border: 2px solid rgba(16, 18, 17, 0.88);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.78);
  box-shadow:
    0.8px 1.1px 0 rgba(16, 18, 17, 0.28),
    inset 0 0 10px rgba(255, 255, 255, 0.46);
}

#bubble-glossary::before {
  left: 18px;
  bottom: -10px;
  width: 16px;
  height: 13px;
  transform: rotate(-9deg);
}

#bubble-glossary::after {
  left: 5px;
  bottom: -20px;
  width: 8px;
  height: 7px;
  transform: rotate(12deg);
}
