/* =========================================================
   Minoh Wildlife Guide — cute pixel-art style
   Change the colours here to restyle the whole site.
   ========================================================= */
:root {
  --sky: #bfe9ff;
  --sky-2: #e8f8ff;
  --sakura: #ffb3c7;
  --cream: #fff6ea;
  --grass: #5cc46a;
  --grass-dark: #2f8f45;
  --ink: #2b2140;
  --paper: #fff8e7;
  --leaf: #ff8a3d;      /* Minoh momiji orange */
  --leaf-dark: #d9531e;
  --good: #3fb36b;
  --bad: #ec4f5c;
  --warn: #ffd23f;
  --px: 4px;            /* size of one "pixel" in borders */
  /* Body: soft rounded Japanese font. Headings/UI: pixel font. */
  --font: "M PLUS Rounded 1c", "Hiragino Maru Gothic ProN", "Mitr", system-ui, sans-serif;
  --font-pixel: "DotGothic16", "Mitr", monospace;
}
html[lang="th"] { --font: "Mitr", "M PLUS Rounded 1c", system-ui, sans-serif; }
h1, h2, h3, h4, .brand, .pixel-btn, .lang-switch button, .sign, .name-tag, .hero-badge, .emg-card .num { font-family: var(--font-pixel); }
html[lang="th"] h1, html[lang="th"] h2, html[lang="th"] h3, html[lang="th"] h4,
html[lang="th"] .sign, html[lang="th"] .name-tag, html[lang="th"] .hero-badge, html[lang="th"] .pixel-btn { font-family: "Mitr", var(--font-pixel); }

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  line-height: 1.7;
  background:
    radial-gradient(circle, rgba(255,179,199,.35) 2px, transparent 2.5px) 0 0 / 28px 28px,
    linear-gradient(to bottom, var(--sky) 0, var(--sky-2) 480px, var(--cream) 480px, var(--cream) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}
img { image-rendering: pixelated; max-width: 100%; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .5em; }
.small { font-size: .85rem; opacity: .8; }

/* ---------- Pixel border helper (stepped corners) ---------- */
.panel, .card, .bubble, .pixel-btn, .modal-inner, .lang-switch button, .emg-card {
  border: none;
  box-shadow:
    0 calc(var(--px) * -1) 0 0 var(--ink),
    0 var(--px) 0 0 var(--ink),
    calc(var(--px) * -1) 0 0 0 var(--ink),
    var(--px) 0 0 0 var(--ink);
}

/* ---------- Sky & clouds ---------- */
.sky { position: absolute; inset: 0 0 auto 0; height: 420px; pointer-events: none; z-index: 0; overflow: hidden; }
.cloud {
  position: absolute; width: 96px; height: 24px; background: #fff;
  box-shadow: 24px -16px 0 #fff, 48px -16px 0 #fff, 72px 0 0 #fff, 16px 8px 0 #fff;
  animation: drift linear infinite;
}
.c1 { top: 70px;  animation-duration: 60s; }
.c2 { top: 150px; animation-duration: 85s; animation-delay: -30s; transform: scale(1.4); }
.c3 { top: 40px;  animation-duration: 110s; animation-delay: -70s; transform: scale(.8); }
@keyframes drift { from { left: -200px; } to { left: 110%; } }

/* ---------- Top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; justify-content: space-between; align-items: center; gap: 1rem;
  padding: .6rem 1.2rem; background: var(--grass-dark); color: #fff;
  border-bottom: var(--px) solid var(--ink);
}
.brand { display: flex; align-items: center; gap: .5rem; color: #fff; text-decoration: none; font-size: 1.1rem; }
.brand-logo { width: 36px; height: 36px; }
.lang-switch { display: flex; gap: .6rem; }
.lang-switch button {
  font: inherit; cursor: pointer; padding: .2rem .7rem; background: var(--paper); color: var(--ink);
}
.lang-switch button.active { background: var(--warn); transform: translateY(2px); }

main { position: relative; z-index: 1; max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.2rem 3rem; }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: 1.1fr 1fr; gap: 2rem; align-items: center; min-height: 380px; }
.hero h1 { font-size: clamp(1.8rem, 4.5vw, 3rem); text-shadow: 3px 3px 0 #fff; }
.hero p { font-size: 1.1rem; }
.hero-guide { position: relative; display: flex; flex-direction: column; align-items: center; }
.guide-img { width: 260px; height: 260px; object-fit: contain; }

.pixel-btn {
  display: inline-block; margin-top: .8rem; padding: .6rem 1.4rem;
  background: var(--leaf); color: #fff; text-decoration: none; font-size: 1.1rem;
  transition: transform .1s;
}
.pixel-btn:hover { transform: translateY(-3px); background: var(--leaf-dark); }
.pixel-btn:active { transform: translateY(2px); }

/* ---------- Speech bubbles ---------- */
.bubble {
  position: relative; background: #fff; padding: .8rem 1rem; margin-bottom: 1.4rem;
  max-width: 320px; min-height: 3.2em; font-size: 1rem;
}
.bubble::after { /* pixel tail */
  content: ""; position: absolute; bottom: -16px; left: 40px; width: 12px; height: 12px;
  background: #fff; box-shadow: 4px 4px 0 var(--ink), -4px 0 0 var(--ink), 0 4px 0 var(--ink);
}
.typed::after { content: "▌"; animation: blink 1s steps(1) infinite; margin-left: 2px; }
.typed.done::after { content: ""; }
@keyframes blink { 50% { opacity: 0; } }

/* ---------- Animations ---------- */
.bob { animation: bob 2.2s steps(4) infinite; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
.wiggle { animation: wiggle 1.6s steps(2) infinite; }
@keyframes wiggle { 0%,100% { transform: rotate(-3deg); } 50% { transform: rotate(3deg); } }
.pop-in { animation: pop .35s steps(5) both; }
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------- Panels ---------- */
.panel { background: var(--paper); padding: 1.4rem 1.6rem; margin: 2.5rem 0; }
.rule-list { margin: 0; padding-left: 1.4rem; }
.rule-list li { margin: .4rem 0; }
.rule-list li::marker { color: var(--leaf-dark); font-weight: bold; }

.section-title { text-align: center; font-size: 1.8rem; margin-top: 2rem; }
.section-sub { text-align: center; margin-top: 0; }

/* ---------- Animal cards ---------- */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); grid-auto-rows: 1fr; gap: 1.6rem; margin-top: 1.2rem; }
.card {
  background: #fff; padding: 1rem; text-align: center; cursor: pointer; font: inherit; color: inherit;
  transition: transform .12s;
}
.card:hover, .card:focus-visible { transform: translateY(-6px) rotate(-1deg); outline: none; }
.card-img { width: 140px; height: 140px; object-fit: contain; margin: 0 auto; display: block; }
.card h3 { margin: .5rem 0 .2rem; font-size: 1.25rem; }
.card .danger { margin: 0; }
.card .tap { font-size: .85rem; color: var(--leaf-dark); }

.danger { letter-spacing: 2px; }

/* Placeholder shown when an image file is not in assets/images yet */
.img-placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: repeating-conic-gradient(#eee 0 25%, #fafafa 0 50%) 0 0 / 16px 16px;
  border: 3px dashed #aaa; color: #888; font-size: .7rem; text-align: center; margin: 0 auto;
}
.img-placeholder .emoji { font-size: 3rem; line-height: 1; }

/* ---------- Modal ---------- */
.modal { border: none; padding: 0; background: transparent; max-width: 720px; width: calc(100% - 2rem); }
.modal::backdrop { background: rgba(43, 33, 64, .6); }
.modal-inner { position: relative; background: var(--paper); padding: 1.6rem; max-height: 85vh; overflow-y: auto; }
.close-btn {
  position: absolute; top: .6rem; right: .6rem; font: inherit; font-size: 1.2rem; cursor: pointer;
  background: var(--bad); color: #fff; border: 3px solid var(--ink); width: 2.2rem; height: 2.2rem;
}
.modal-head { display: flex; align-items: flex-end; gap: 1rem; flex-wrap: wrap; }
.modal-img { width: 150px; height: 150px; object-fit: contain; }
.modal-bubble { flex: 1; min-width: 200px; }
.modal-bubble::after { left: -12px; bottom: 16px; box-shadow: -4px 4px 0 var(--ink), 0 -4px 0 var(--ink), 0 4px 0 var(--ink); }
.modal h3 { font-size: 1.6rem; margin-top: 1rem; }
.where { background: #e9fbe0; padding: .5rem .8rem; border-left: 6px solid var(--grass); }
.dodont { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; margin-top: 1rem; }
.do-box, .dont-box, .sos-box { padding: .8rem 1rem; border: 3px solid var(--ink); }
.do-box { background: #e3f8ea; }
.dont-box { background: #ffe5e7; }
.do-box h4 { color: var(--good); }
.dont-box h4 { color: var(--bad); }
.do-box ul, .dont-box ul { margin: 0; padding-left: 1.2rem; }
.do-box li::marker { content: "✔ "; color: var(--good); }
.dont-box li::marker { content: "✘ "; color: var(--bad); }
.sos-box { margin-top: 1rem; background: #fff6cc; }

/* ---------- Emergency ---------- */
.emergency { background: #ffe5e7; }
.emg-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.2rem; margin-bottom: 1rem; }
.emg-card { background: #fff; padding: .8rem 1rem; text-align: center; text-decoration: none; color: inherit; }
.emg-card .num { display: block; font-size: 2rem; color: var(--bad); }

/* ---------- Footer ---------- */
.footer { background: var(--grass-dark); color: #fff; text-align: center; padding: 1.5rem 1rem; border-top: var(--px) solid var(--ink); }
.footer p { max-width: 800px; margin: .3rem auto; }

/* ---------- Mobile ---------- */
@media (max-width: 720px) {
  .hero { grid-template-columns: 1fr; text-align: center; }
  .hero .bubble { margin-left: auto; margin-right: auto; }
  .guide-img { width: 200px; height: 200px; }
  .dodont { grid-template-columns: 1fr; }
  .brand span { font-size: .9rem; }
}

/* Respect people who turn off motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* =========================================================
   Japanese "kawaii" touches
   ========================================================= */
/* Falling pixel momiji (Minoh is famous for autumn maple leaves) */
.leaves { position: fixed; inset: 0; pointer-events: none; z-index: 0; overflow: hidden; }
.leaf {
  position: absolute; top: -40px; width: var(--size); height: var(--size); opacity: .85;
  animation-name: leafFall, leafSway; animation-timing-function: linear, ease-in-out;
  animation-iteration-count: infinite, infinite; animation-direction: normal, alternate;
}
.leaf svg { width: 100%; height: 100%; display: block; }
@keyframes leafFall { from { top: -40px; transform: rotate(0); } to { top: 105vh; transform: rotate(540deg); } }
@keyframes leafSway { from { margin-left: -30px; } to { margin-left: 30px; } }

/* Small label above the hero title */
.hero-badge {
  display: inline-block; margin: 0 0 .6rem; padding: .1rem .8rem; font-size: .9rem;
  background: var(--sakura); color: var(--ink); border: 3px solid var(--ink); border-radius: 999px;
}
.hero h1 { color: var(--ink); text-shadow: 3px 3px 0 #fff, -1px -1px 0 #fff; }

/* Mascot name plate (yuru-chara style) */
.name-tag {
  margin: .4rem 0 0; padding: .15rem 1rem; background: var(--grass-dark); color: #fff;
  border: 3px solid var(--ink); border-radius: 6px; font-size: 1rem;
}

/* Decorated headings: ＼ title ／ with maple leaves */
.deco-title { text-align: center; }
.deco-title::before { content: "🍁 ＼ "; }
.deco-title::after  { content: " ／ 🍁"; }
.rules .deco-title { color: var(--leaf-dark); }

/* Cards */
.card { border-radius: 0; background: #fff; }
.card .season, .modal .season { font-size: .85rem; margin: .2rem 0 0; color: #5a4e70; }
.meta { margin: .2rem 0; display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; justify-content: center; }
.modal .meta { justify-content: flex-start; }

/* Japanese road-sign style danger badge with hazard stripes */
.sign {
  display: inline-block; padding: .15rem .7rem; font-size: .95rem; color: var(--ink);
  border: 3px solid var(--ink);
  background: repeating-linear-gradient(-45deg, var(--bg1) 0 8px, var(--bg2) 8px 16px);
  text-shadow: 1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff;
}
.sign.lv1 { --bg1: #ffe86b; --bg2: #fff3a8; }
.sign.lv2 { --bg1: #ffb35c; --bg2: #ffd39e; }
.sign.lv3 { --bg1: #ff7a85; --bg2: #ffb3ba; }

/* Rules as numbered stamps */
.rule-list { list-style: none; padding-left: 0; counter-reset: r; }
.rule-list li { counter-increment: r; display: flex; gap: .7rem; align-items: flex-start; }
.rule-list li::before {
  content: counter(r); flex: 0 0 2rem; height: 2rem; display: grid; place-items: center;
  background: var(--leaf); color: #fff; border: 3px solid var(--ink); border-radius: 50%;
  font-family: var(--font-pixel);
}

/* Break Japanese headings at natural phrase boundaries (avoids "会/ったら") */
h1, h2, h3, .hero p { word-break: auto-phrase; text-wrap: balance; }
.hero h1 { white-space: pre-line; }

/* ---------- Forest background behind the hero (assets/images/bg-forest.jpg) ---------- */
.sky {
  height: 620px;
  background: url("../assets/images/bg-forest.jpg") center bottom / cover no-repeat;
}
.sky::after { /* fade the bottom of the picture into the page colour */
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 90px;
  background: linear-gradient(to bottom, transparent, var(--cream));
}
.cloud { opacity: .85; }
.hero { min-height: 560px; }
.hero-text {
  background: rgba(255, 246, 234, .88); padding: 1.2rem 1.4rem;
  box-shadow: 0 -4px 0 0 var(--ink), 0 4px 0 0 var(--ink), -4px 0 0 0 var(--ink), 4px 0 0 0 var(--ink);
}
.hero h1 { text-shadow: none; }

/* Guide "stop!" pose next to the emergency numbers */
.emg-head { display: flex; align-items: center; gap: 1rem; margin-bottom: .6rem; }
.emg-head h2 { margin: 0; }
.emg-guide { width: 110px; height: 110px; object-fit: contain; }
@media (max-width: 720px) {
  .sky { height: 760px; }
}


/* =========================================================
   Card layout: every part sits at the same height in every card
   ========================================================= */
.card {
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
  gap: .35rem; padding: 1.1rem 1rem 1rem;
}
.card .sprite { height: 150px; display: flex; align-items: flex-end; justify-content: center; }
.card .card-img { width: 140px; height: 140px; }
.card h3 { margin: .3rem 0 0; white-space: nowrap; }
.card .meta { margin: 0; }
.card .season {
  margin: 0; min-height: 3.2em; display: flex; flex-direction: column; align-items: center;
  line-height: 1.5; font-size: .85rem;
}
.card .season-label { font-size: .75rem; opacity: .75; }
.card .tap { margin: auto 0 0; padding-top: .3rem; }

/* =========================================================
   Cartoon motion
   ========================================================= */
/* Each animal has its own idle loop (on the wrapper, so hover/jump can stack on the image) */
.sprite, .modal-sprite { transform-origin: 50% 100%; }
.idle-monkey { animation: sway 2.4s ease-in-out infinite; }
.idle-boar   { animation: trot .9s steps(3) infinite; }
.idle-deer   { animation: deerHop 2.6s ease-in-out infinite; }
.idle-bear   { animation: breathe 3s ease-in-out infinite; }
.idle-snake  { animation: slither 1.8s ease-in-out infinite; }
.idle-hornet { animation: buzz 1.6s linear infinite; }

@keyframes sway    { 0%,100% { transform: rotate(-4deg); } 50% { transform: rotate(4deg); } }
@keyframes trot    { 0%,100% { transform: translate(0,0); } 33% { transform: translate(-3px,-4px); } 66% { transform: translate(3px,-2px); } }
@keyframes deerHop {
  0%, 55%, 100% { transform: translateY(0) scale(1, 1); }
  60% { transform: translateY(0) scale(1.08, .9); }      /* crouch */
  72% { transform: translateY(-16px) scale(.94, 1.08); } /* jump  */
  86% { transform: translateY(0) scale(1.06, .94); }     /* land  */
}
@keyframes breathe { 0%,100% { transform: scale(1, 1); } 50% { transform: scale(1.03, .97); } }
@keyframes slither { 0%,100% { transform: skewX(-6deg); } 50% { transform: skewX(6deg); } }
@keyframes buzz {
  0%   { transform: translate(0, 0) rotate(-3deg); }
  25%  { transform: translate(6px, -6px) rotate(3deg); }
  50%  { transform: translate(0, -10px) rotate(-3deg); }
  75%  { transform: translate(-6px, -4px) rotate(3deg); }
  100% { transform: translate(0, 0) rotate(-3deg); }
}

/* Hover: big rubbery jump with squash & stretch */
.card:hover .card-img, .card:focus-visible .card-img { animation: boing .7s cubic-bezier(.3,1.6,.5,1) infinite; transform-origin: 50% 100%; }
@keyframes boing {
  0%   { transform: scale(1, 1); }
  15%  { transform: scale(1.15, .85); }
  45%  { transform: translateY(-22px) scale(.9, 1.12); }
  75%  { transform: translateY(0) scale(1.1, .9); }
  100% { transform: scale(1, 1); }
}
/* Click: card squishes before the popup opens */
.card.squish { animation: squish .22s ease-out; }
@keyframes squish { 50% { transform: scale(.92, 1.06); } }

/* Guide hops every time a new speech line starts */
.guide-img.hop { animation: hop .6s cubic-bezier(.3,1.5,.5,1), bob 2.2s steps(4) .6s infinite; transform-origin: 50% 100%; }
@keyframes hop {
  0% { transform: scale(1,1); } 20% { transform: scale(1.12,.88); }
  50% { transform: translateY(-24px) scale(.92,1.1); } 80% { transform: scale(1.06,.94); } 100% { transform: scale(1,1); }
}
/* Speech bubbles pop like a comic panel */
.bubble { animation: bubblePop .45s cubic-bezier(.3,1.7,.5,1) both; transform-origin: 30% 100%; }
@keyframes bubblePop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
@keyframes bubblePop2 { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.bubble.repop { animation-name: bubblePop2; }

/* Scroll reveal: things bounce in when they come into view */
.reveal:not(.in) { opacity: 0; transform: translateY(30px) scale(.9); }
.reveal.in { animation: popUp .55s cubic-bezier(.3,1.6,.5,1) var(--delay, 0s) backwards; }
@keyframes popUp {
  from { opacity: 0; transform: translateY(30px) scale(.9); }
  to   { opacity: 1; transform: none; }
}
.rules.in .rule-list li { animation: slideIn .45s cubic-bezier(.3,1.5,.5,1) both; }
.rules.in .rule-list li:nth-child(2) { animation-delay: .08s; }
.rules.in .rule-list li:nth-child(3) { animation-delay: .16s; }
.rules.in .rule-list li:nth-child(4) { animation-delay: .24s; }
.rules.in .rule-list li:nth-child(5) { animation-delay: .32s; }
@keyframes slideIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: none; } }
.rules.in .rule-list li::before { animation: stamp .4s cubic-bezier(.3,2,.5,1) both; animation-delay: inherit; }
@keyframes stamp { from { transform: scale(2.2) rotate(-20deg); opacity: 0; } to { transform: none; opacity: 1; } }

/* Popup: bounces open */
.modal[open] .modal-inner { animation: modalIn .45s cubic-bezier(.3,1.5,.5,1); }
@keyframes modalIn { from { transform: scale(.6) translateY(40px); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-sprite { width: 150px; height: 150px; }

/* Boar dashing across the hero, with dust puffs */
.hero { position: relative; }
.runner {
  position: absolute; left: -160px; bottom: 6px; width: 110px; height: 110px;
  pointer-events: none; z-index: 2; visibility: hidden;
}
.runner img { width: 100%; height: 100%; object-fit: contain; animation: trot .3s steps(2) infinite; }
.runner.go { visibility: visible; animation: dash 3.6s linear forwards; }
@keyframes dash { from { left: -160px; } to { left: calc(100% + 60px); } }
.dust { position: absolute; bottom: 4px; width: 12px; height: 12px; background: #fff; opacity: 0;
  box-shadow: 8px 4px 0 #f1e6d3, -6px 6px 0 #fff; }
.runner.go .dust { animation: puff .6s steps(3) infinite; }
.d1 { left: -10px; } .d2 { left: -26px; animation-delay: .2s !important; } .d3 { left: -40px; animation-delay: .4s !important; }
@keyframes puff { 0% { opacity: .9; transform: scale(.6); } 100% { opacity: 0; transform: translate(-14px,-10px) scale(1.4); } }

/* Hornet card: wings blur a little faster on hover */
.card:hover .idle-hornet { animation-duration: .5s; }

@media (prefers-reduced-motion: reduce) {
  .reveal:not(.in) { opacity: 1; transform: none; }
  .runner { display: none; }
}


/* ---------- News & sightings ---------- */
.official-links { display: flex; flex-wrap: wrap; gap: .8rem; }
.official-link {
  display: inline-block; padding: .4rem .8rem; background: #fff; color: var(--ink); text-decoration: none;
  border: 3px solid var(--ink); font-size: .9rem; transition: transform .1s;
}
.official-link:hover { transform: translateY(-3px); background: var(--warn); }


/* =========================================================
   Responsive: tablet & phone
   ========================================================= */
.lang-switch button { white-space: nowrap; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand { min-width: 0; }

@media (max-width: 900px) {            /* tablet */
  main { padding: 1.2rem 1rem 2.5rem; }
  .hero { gap: 1.2rem; }
  .guide-img { width: 220px; height: 220px; }
  .card-grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 1.2rem; }
}

@media (max-width: 720px) {            /* phone */
  .topbar { padding: .5rem .7rem; gap: .5rem; }
  .brand { font-size: .9rem; gap: .35rem; }
  .brand-logo { width: 28px; height: 28px; }
  .lang-switch { gap: .45rem; }
  .lang-switch button { padding: .1rem .45rem; font-size: .8rem; }

  .hero { min-height: 0; }
  .hero-text { text-align: left; padding: 1rem; }
  .hero h1 { font-size: 1.7rem; }
  .hero p { font-size: 1rem; }
  .hero .bubble { max-width: 90%; }
  .guide-img { width: 170px; height: 170px; }
  .sky { height: 100vh; max-height: 900px; }

  .panel { padding: 1.1rem 1rem; margin: 1.8rem 0; }
  .section-title { font-size: 1.35rem; }
  .deco-title::before { content: "🍁 "; }
  .deco-title::after  { content: " 🍁"; }

  /* two small cards per row on phones */
  .card-grid { grid-template-columns: 1fr 1fr; gap: .9rem; }
  .card { padding: .8rem .5rem; }
  .card .sprite { height: 110px; }
  .card .card-img { width: 100px; height: 100px; }
  .card h3 { font-size: 1rem; white-space: normal; }
  .card .season { font-size: .75rem; }
  .sign { font-size: .8rem; padding: .1rem .5rem; }

  .modal { width: calc(100% - 1rem); }
  .modal-inner { padding: 1.2rem 1rem; max-height: 90vh; }
  .modal-head { flex-direction: column; align-items: center; }
  .modal-bubble { min-width: 0; width: 100%; }
  .modal-bubble::after { left: 50%; bottom: auto; top: -12px;
    box-shadow: -4px -4px 0 var(--ink), 4px 0 0 var(--ink), 0 -4px 0 var(--ink); }
  .modal-head { flex-direction: column-reverse; }
  .modal-sprite, .modal-img { width: 120px; height: 120px; }

  .emg-head { flex-direction: row; }
  .emg-guide { width: 80px; height: 80px; }
  .runner { width: 80px; height: 80px; }
}

@media (max-width: 360px) {
  .brand span { display: none; }
}


/* ---------- Quick links under the hero button ---------- */
.quick-links { display: flex; gap: 1rem; margin-top: .8rem; flex-wrap: wrap; }
.quick-links a { color: var(--ink); font-weight: 700; text-decoration: none; border-bottom: 3px dotted var(--leaf); }
.quick-links a::before { content: "▶ "; color: var(--leaf); }

/* ---------- Trail map ---------- */
.trail-map {
  position: relative; width: 100%; aspect-ratio: 16 / 10; margin: 1rem 0;
  border: 4px solid var(--ink); background: #a8dc8c; overflow: hidden;
}
.trail-map svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.map-pin {
  position: absolute; transform: translate(-50%, -50%); border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; font: inherit; color: var(--ink); padding: 0;
}
.pin-icon {
  display: grid; place-items: center; width: 2.4rem; height: 2.4rem; font-size: 1.3rem;
  background: #fff; border: 3px solid var(--ink); border-radius: 50%;
  animation: pinBob 1.8s ease-in-out infinite;
}
.map-pin.risk .pin-icon { border-radius: 4px; }
.map-pin.lv2 .pin-icon { background: #ffd39e; }
.map-pin.lv3 .pin-icon { background: #ffb3ba; }
.map-pin:nth-child(odd) .pin-icon { animation-delay: -.9s; }
.pin-label {
  margin-top: 2px; font-size: .7rem; background: rgba(255,255,255,.9); padding: 0 .3rem;
  border: 2px solid var(--ink); white-space: nowrap;
}
.map-pin.active .pin-icon { background: var(--warn); transform: scale(1.2); animation: none; }
.map-pin:hover .pin-icon { animation: boing .7s cubic-bezier(.3,1.6,.5,1) infinite; }
@keyframes pinBob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }
.map-info { max-width: none; margin: .4rem 0 1.4rem; display: flex; flex-direction: column; gap: .2rem; }
.map-info strong { font-family: var(--font-pixel); }
.map-info::after { left: 50%; }
@media (max-width: 720px) {
  .trail-map { aspect-ratio: 4 / 5; }
  .pin-icon { width: 2rem; height: 2rem; font-size: 1rem; }
  .pin-label { display: none; }
  .map-pin.active .pin-label { display: block; }
}

/* ---------- Quiz ---------- */
.quiz { max-width: 640px; margin: 0 auto; }
.quiz-count { font-family: var(--font-pixel); color: var(--leaf-dark); margin: 0; }
.quiz-q { font-size: 1.15rem; font-weight: 700; margin: .3rem 0 1rem; }
.quiz-choices { display: grid; gap: .7rem; }
.choice {
  display: flex; align-items: center; gap: .7rem; text-align: left; font: inherit; color: var(--ink);
  background: #fff; border: 3px solid var(--ink); padding: .6rem .8rem; cursor: pointer;
  box-shadow: 0 4px 0 var(--ink); transition: transform .08s;
}
.choice:hover:not(:disabled) { transform: translateY(-2px); background: #fffbe0; }
.choice:active:not(:disabled) { transform: translateY(3px); box-shadow: 0 1px 0 var(--ink); }
.choice:disabled { cursor: default; opacity: .75; }
.choice.right { background: #c9f2d4; opacity: 1; }
.choice.wrong { background: #ffc9cd; opacity: 1; }
.abc {
  flex: 0 0 1.8rem; height: 1.8rem; display: grid; place-items: center; font-family: var(--font-pixel);
  background: var(--leaf); color: #fff; border: 2px solid var(--ink);
}
.quiz-feedback { display: grid; grid-template-columns: 90px 1fr; gap: .8rem 1rem; align-items: center; margin-top: 1.2rem; }
.quiz-feedback .bubble { margin: 0; max-width: none; }
.quiz-feedback .bubble::after { left: -12px; bottom: 20px; box-shadow: -4px 4px 0 var(--ink), 0 -4px 0 var(--ink), 0 4px 0 var(--ink); }
.quiz-feedback .bubble.ok strong { color: var(--good); }
.quiz-feedback .bubble.ng strong { color: var(--bad); }
.quiz-feedback .quiz-next { grid-column: 1 / -1; justify-self: end; margin: 0; }
.quiz-guide { width: 90px; height: 90px; object-fit: contain; transform-origin: 50% 100%; }
.quiz-guide.hop { animation: hop .6s cubic-bezier(.3,1.5,.5,1); }
.quiz-end { text-align: center; }
.quiz-end .quiz-guide { width: 130px; height: 130px; }
.quiz-score { font-family: var(--font-pixel); font-size: 1.6rem; color: var(--leaf-dark); margin: .3rem 0; }
.choice.shake { animation: shake .4s steps(4); }
@keyframes shake { 25% { transform: translateX(-6px); } 50% { transform: translateX(6px); } 75% { transform: translateX(-4px); } }
@media (max-width: 720px) {
  .quiz-feedback { grid-template-columns: 64px 1fr; }
  .quiz-guide { width: 64px; height: 64px; }
  .quiz-q { font-size: 1.05rem; }
}

/* ---------- Footer link ---------- */
.footer-link { color: #fff; }

/* ---------- Terms page ---------- */
.terms-page main { max-width: 820px; }
.terms h1 { font-size: 1.6rem; white-space: normal; }
.terms h2 { font-size: 1.15rem; margin-top: 1.6rem; padding-left: .6rem; border-left: 6px solid var(--leaf); }
.terms .pixel-btn { margin-top: 1.6rem; }


/* =========================================================
   Round 2 artwork: emotes, guide frames, runners, rule pictures, map picture
   ========================================================= */
/* Emote icons (! ? ♥ …) that pop above a character */
.guide-wrap, .modal-sprite-wrap, .quiz-guide-wrap { position: relative; }
.emote {
  position: absolute; top: -8px; right: -6px; width: 56px; height: 56px; pointer-events: none;
  opacity: 0; transform: scale(.3);
}
.emote.show { animation: emotePop 1.8s cubic-bezier(.3,1.8,.5,1) forwards; }
@keyframes emotePop {
  0% { opacity: 0; transform: scale(.3) translateY(10px); }
  15% { opacity: 1; transform: scale(1.15) translateY(-6px); }
  25%, 80% { opacity: 1; transform: scale(1) translateY(0); }
  100% { opacity: 0; transform: scale(.9) translateY(-10px); }
}
.guide-wrap .emote { top: 0; right: 10px; width: 64px; height: 64px; }
.modal-sprite-wrap .emote { top: -10px; right: -16px; }
.quiz-guide-wrap .emote { width: 40px; height: 40px; top: -14px; right: -14px; animation-duration: 2.4s; }

/* Card: emote bounces in when you point at the card */
.card .sprite { position: relative; }
.card-emote { top: -6px; right: -18px; width: 44px; height: 44px; }
.card:hover .card-emote, .card:focus-visible .card-emote { animation: emoteHover .5s cubic-bezier(.3,1.8,.5,1) forwards; }
@keyframes emoteHover { from { opacity: 0; transform: scale(.3) translateY(10px); } to { opacity: 1; transform: none; } }

/* Hero runner: two frames flip-book (boar runs, monkey walks) */
.runner img { position: absolute; inset: 0; animation: none; }
.runner .f2 { visibility: hidden; }
.runner.go .f1 { animation: frameA .24s steps(1) infinite; }
.runner.go .f2 { animation: frameB .24s steps(1) infinite; }
.runner.walk.go { animation-duration: 7s; }
.runner.walk.go .f1 { animation-duration: .45s; }
.runner.walk.go .f2 { animation-duration: .45s; }
.runner.walk .dust { display: none; }
@keyframes frameA { 0% { visibility: visible; } 50% { visibility: hidden; } }
@keyframes frameB { 0% { visibility: hidden; } 50% { visibility: visible; } }

/* Rules with pictures */
.rule-list { display: grid; grid-template-columns: repeat(5, 1fr); gap: 1rem; }
.rule-list li {
  flex-direction: column; align-items: center; text-align: center; gap: .4rem;
  background: #fff; border: 3px solid var(--ink); padding: .8rem .6rem 1rem; position: relative; margin: 0;
}
.rule-list li::before { position: absolute; top: -12px; left: -12px; }
.rule-img { width: 110px; height: 110px; object-fit: contain; transition: transform .2s; }
.rule-list li:hover .rule-img { animation: boing .7s cubic-bezier(.3,1.6,.5,1); }
.rule-list li span { font-size: .9rem; line-height: 1.6; }
@media (max-width: 900px) { .rule-list { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 720px) {
  .rule-list { grid-template-columns: 1fr 1fr; gap: .9rem; }
  .rule-img { width: 84px; height: 84px; }
  .rule-list li span { font-size: .82rem; }
}

/* Map picture */
.trail-map { aspect-ratio: 1586 / 992; }
.map-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; image-rendering: auto; }
@media (max-width: 720px) {
  .trail-map { aspect-ratio: 1586 / 992; }
  .pin-icon { width: 1.7rem; height: 1.7rem; font-size: .85rem; border-width: 2px; }
}
html { overflow-x: hidden; }
@supports (overflow: clip) { html, body { overflow-x: clip; } }
.rule-list li::before { width: 2.2rem; height: 2.2rem; flex: none; z-index: 1; }

/* ---------- Calmer hover (feedback: bounce was too much) ---------- */
.card:hover, .card:focus-visible { transform: translateY(-4px); }
.card:hover .card-img, .card:focus-visible .card-img {
  animation: none; transform: scale(1.05); transition: transform .25s ease;
}
.card .card-img { transition: transform .25s ease; }
.rule-list li { transition: transform .2s ease; }
.rule-list li:hover { transform: translateY(-3px); }
.rule-list li:hover .rule-img { animation: none; }
.map-pin:hover .pin-icon { animation: none; transform: scale(1.12); }
.card:hover .idle-hornet { animation-duration: 1.6s; }

/* ---------- Popup: no scrollbars flashing while it bounces open ---------- */
.modal { overflow: visible; max-height: none; }
.modal-inner { overflow-x: hidden; overflow-y: auto; overscroll-behavior: contain; }
.modal-head { overflow: visible; padding-top: 12px; }
body:has(.modal[open]) { overflow: hidden; } /* page behind doesn't scroll */

/* ---------- Popup header: animal on the left, bubble pointing at it, X always clear ---------- */
.close-btn { z-index: 5; }
.modal-head { padding-right: 2.6rem; }
@media (max-width: 720px) {
  .modal-head { flex-direction: row; align-items: center; gap: .8rem; flex-wrap: nowrap; padding-top: 2.4rem; padding-right: 0; }
  .modal-sprite-wrap { flex: 0 0 96px; }
  .modal-sprite, .modal-img { width: 96px; height: 96px; }
  .modal-sprite-wrap .emote { width: 40px; height: 40px; top: -14px; right: -12px; }
  .modal-bubble { flex: 1; min-width: 0; width: auto; margin: 0; font-size: .92rem; padding: .6rem .8rem; }
  .modal-bubble::after { left: -12px; right: auto; top: auto; bottom: 50%; transform: translateY(50%);
    box-shadow: -4px 4px 0 var(--ink), 0 -4px 0 var(--ink), 0 4px 0 var(--ink); }
  .modal h3 { margin-top: .8rem; }
}

/* ---------- Guide bubble keeps a steady size (no layout jump between lines) ---------- */
#guideBubble { display: grid; width: min(320px, 100%); }
#guideBubble > .typed, #guideBubble > .sizer { grid-area: 1 / 1; }
#guideBubble > .sizer { visibility: hidden; }
#guideBubble > .sizer::after { content: "▌"; } /* room for the cursor */
@media (max-width: 720px) { #guideBubble { width: min(320px, 90%); } }
