:root {
  --bg: #ffffff;
  --sky: #3b9eff;
  --sky-deep: #1e78d4;
  --yellow: #ffd93d;
  --ink: #1a1a2e;
  --sub: #f0f9ff;
  --line: #0f1a2e;
  --pink: #ff8ab6;
  --green: #06c755; /* LINE */
  --shadow: 4px 4px 0 var(--line);
  --shadow-sm: 2px 2px 0 var(--line);
  --shadow-lg: 6px 6px 0 var(--line);
  --radius: 18px;
  --radius-lg: 26px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "M PLUS Rounded 1c", "Zen Kaku Gothic New", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-weight: 500;
}

/* Hatched / dotted backgrounds */
.bg-dots {
  background-image: radial-gradient(var(--sky) 1.4px, transparent 1.4px);
  background-size: 18px 18px;
  background-position: 0 0;
}
.bg-grid {
  background-image:
    linear-gradient(to right, rgba(15,26,46,.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,26,46,.06) 1px, transparent 1px);
  background-size: 24px 24px;
}
.bg-sub { background: var(--sub); }
.bg-yellow { background: var(--yellow); }
.bg-sky { background: var(--sky); }
.bg-ink { background: var(--ink); color: #fff; }

/* Comic/chunky card */
.chunky {
  border: 2.5px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  transition: transform .15s ease, box-shadow .15s ease;
}
.chunky:hover {
  transform: translate(-2px, -2px);
  box-shadow: var(--shadow-lg);
}
.chunky-lg {
  border: 3px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 2.5px solid var(--line);
  border-radius: 999px;
  padding: 12px 22px;
  font-weight: 800;
  font-size: 15px;
  cursor: pointer;
  background: #fff;
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  transition: transform .12s ease, box-shadow .12s ease;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover { transform: translate(-1.5px,-1.5px); box-shadow: var(--shadow); }
.btn:active { transform: translate(1px,1px); box-shadow: 0 0 0 var(--line); }
.btn-line { background: var(--green); color: #fff; }
.btn-yellow { background: var(--yellow); }
.btn-sky { background: var(--sky); color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; }
.btn-ghost:hover { background: var(--sub); box-shadow: none; transform: none; }
.btn-lg { padding: 16px 30px; font-size: 17px; }

/* Tags */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  border: 2px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  background: #fff;
  line-height: 1.4;
}
.tag-sky { background: var(--sky); color: #fff; }
.tag-yellow { background: var(--yellow); }
.tag-pink { background: var(--pink); color: var(--ink); }
.tag-green { background: #c8f5d5; }

/* Character placeholder frame */
.char-ph {
  position: relative;
  border: 2.5px dashed var(--line);
  border-radius: 20px;
  background:
    repeating-linear-gradient(45deg, rgba(59,158,255,.08) 0 8px, transparent 8px 16px),
    #fff;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 12px;
  font-family: "IBM Plex Mono", ui-monospace, monospace;
  font-size: 11px;
  color: var(--line);
  text-align: center;
  letter-spacing: .02em;
}
.char-ph::before {
  content: attr(data-char);
  position: absolute;
  top: 10px;
  left: 10px;
  background: var(--yellow);
  border: 2px solid var(--line);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 10px;
  font-weight: 800;
  font-family: "M PLUS Rounded 1c", sans-serif;
}
.char-ph .char-silhouette {
  width: 65%;
  aspect-ratio: 3/4;
  border: 2px solid var(--line);
  border-radius: 50% 50% 18px 18px / 55% 55% 18px 18px;
  background: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--line);
  font-weight: 800;
  font-size: 13px;
  margin-bottom: 4px;
}

/* Speech bubble */
.bubble {
  position: relative;
  background: #fff;
  border: 2.5px solid var(--line);
  border-radius: 18px;
  padding: 12px 16px;
  font-weight: 700;
  box-shadow: var(--shadow-sm);
}
.bubble::after {
  content: '';
  position: absolute;
  bottom: -14px;
  left: 30px;
  width: 22px;
  height: 16px;
  background: #fff;
  border-right: 2.5px solid var(--line);
  border-bottom: 2.5px solid var(--line);
  transform: skewX(-20deg);
}
.bubble-up::after { top: -14px; bottom: auto; transform: skewX(20deg) rotate(180deg); }

/* Section heading */
.sect-title {
  display: inline-flex;
  align-items: baseline;
  gap: 12px;
  font-weight: 900;
  font-size: 28px;
  letter-spacing: .02em;
  position: relative;
}
.sect-title .en {
  font-family: "IBM Plex Mono", monospace;
  font-size: 13px;
  font-weight: 600;
  color: var(--sky-deep);
  letter-spacing: .1em;
}
.sect-title .mark {
  display: inline-block;
  background: var(--yellow);
  height: 10px;
  width: 60px;
  border: 2px solid var(--line);
  border-radius: 4px;
}

/* Wiggle on load for characters */
@keyframes wiggle {
  0%, 100% { transform: rotate(-1deg); }
  50% { transform: rotate(1.2deg); }
}
.wiggle { animation: wiggle 3.2s ease-in-out infinite; }
.wiggle-2 { animation: wiggle 2.6s ease-in-out infinite; animation-delay: -1s; }
.wiggle-3 { animation: wiggle 3.8s ease-in-out infinite; animation-delay: -2s; }

@keyframes bounce-soft {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}
.bounce { animation: bounce-soft 2.2s ease-in-out infinite; }

@keyframes float-penlight {
  0%, 100% { transform: rotate(-12deg); }
  50% { transform: rotate(12deg); }
}
.penlight { animation: float-penlight 1.4s ease-in-out infinite; transform-origin: bottom center; }

@keyframes dash {
  to { stroke-dashoffset: -40; }
}
.dash-line { stroke-dasharray: 6 6; animation: dash 1.6s linear infinite; }

/* Scroll reveal */
.reveal { opacity: 0; transform: translateY(20px); transition: opacity .6s ease, transform .6s ease; }
.reveal.in { opacity: 1; transform: none; }

/* Marquee */
.marquee {
  overflow: hidden;
  border-top: 2.5px solid var(--line);
  border-bottom: 2.5px solid var(--line);
  background: var(--yellow);
}
.marquee-track {
  display: flex;
  gap: 40px;
  white-space: nowrap;
  animation: marquee 28s linear infinite;
  padding: 10px 0;
  font-weight: 800;
  font-size: 15px;
}
@keyframes marquee {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* Sticky header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 2.5px solid var(--line);
}

/* LINE floating bubble */
.line-float {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 60;
}

/* Utility */
.container { max-width: 1180px; margin: 0 auto; padding: 0 24px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 12px; }
.grid { display: grid; gap: 20px; }

/* Rounded tag icon square */
.icon-sq {
  width: 44px; height: 44px;
  border: 2.5px solid var(--line);
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  font-weight: 800;
  font-size: 18px;
  flex-shrink: 0;
}

/* Page transition */
.page-enter {
  animation: pageIn .35s ease-out;
}
@keyframes pageIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 26, 46, .5);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal-body {
  max-width: 460px;
  width: 100%;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
  animation: popIn .3s cubic-bezier(.3, 1.6, .6, 1);
}
@keyframes popIn { from { transform: scale(.8); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* Dark mode (tweak) */
body.dark {
  --bg: #0b1020;
  --ink: #f3f7ff;
  --sub: #152038;
  --line: #f3f7ff;
  background: var(--bg);
  color: var(--ink);
}
body.dark .chunky, body.dark .bubble, body.dark .btn, body.dark .modal-body { background: #152038; color: var(--ink); }
body.dark .char-ph { background: repeating-linear-gradient(45deg, rgba(59,158,255,.15) 0 8px, transparent 8px 16px), #152038; }
body.dark .site-header { background: #0b1020; }
body.dark .bg-sub { background: #152038; }

/* Tweaks panel */
.tweaks-panel {
  position: fixed;
  right: 20px;
  top: 80px;
  width: 280px;
  background: #fff;
  border: 3px solid var(--line);
  border-radius: 18px;
  padding: 18px;
  z-index: 70;
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  display: none;
}
.tweaks-panel.open { display: block; }
.tweaks-panel h4 { margin: 0 0 12px; font-size: 15px; font-weight: 900; }
.tweaks-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.tweaks-row label { font-weight: 700; }

/* Hover lift (non-chunky) */
.lift { transition: transform .15s ease; }
.lift:hover { transform: translateY(-3px); }

/* Focus ring */
:focus-visible { outline: 3px solid var(--sky); outline-offset: 3px; }
