/* Friendly Civic — Flat illustration set
   All flat, simple geometry. Brand palette only. */

const C = {
  navy: "#152340",
  coral: "#E5654A",
  coralSoft: "#FAD9CD",
  peach: "#F5A878",
  sand: "#FCC890",
  sandSoft: "#FEF3E2",
  mint: "#7BC4B5",
  mintPale: "#C8E5DD",
  mintSoft: "#E8F2EE",
  cream: "#FFF7E8",
  ink: "#2A2F40",
  paper: "#FFFFFF",
};

/* ============================================================
   Hero scene — high-school student getting off train,
   walking toward the study cafe
   ============================================================ */
function HeroScene({ className = "" }) {
  return (
    <svg viewBox="0 0 600 480" className={className} role="img" aria-label="駅前のスタディスペースへ向かう高校生">
      {/* sky background panel */}
      <defs>
        <linearGradient id="hSky" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="#F4F9F7" />
          <stop offset="1" stopColor="#FEF3E2" />
        </linearGradient>
        <linearGradient id="hRoof" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor={C.coral} />
          <stop offset="1" stopColor="#C84B30" />
        </linearGradient>
      </defs>
      <rect x="0" y="0" width="600" height="480" rx="24" fill="url(#hSky)" />

      {/* sun */}
      <circle cx="500" cy="80" r="36" fill={C.sand} opacity="0.7" />
      {/* clouds */}
      <g fill="#fff" opacity="0.9">
        <ellipse cx="120" cy="70" rx="34" ry="11" />
        <ellipse cx="150" cy="66" rx="22" ry="9" />
        <ellipse cx="380" cy="50" rx="40" ry="12" />
      </g>

      {/* far hills */}
      <path d="M0,260 Q120,210 240,250 T480,240 T600,260 L600,320 L0,320 Z" fill={C.mintPale} />
      <path d="M0,290 Q150,250 320,275 T600,290 L600,330 L0,330 Z" fill={C.mint} opacity="0.55" />

      {/* train track elevated */}
      <rect x="0" y="305" width="600" height="14" fill={C.navy} opacity="0.85" />
      <g fill={C.coral} opacity="0.8">
        {[...Array(15)].map((_, i) => (
          <rect key={i} x={20 + i * 40} y="319" width="20" height="4" rx="1" />
        ))}
      </g>

      {/* train */}
      <g>
        <rect x="60" y="240" width="220" height="64" rx="12" fill="#F4F4EE" />
        <rect x="60" y="240" width="220" height="14" rx="6" fill={C.coral} />
        <rect x="60" y="288" width="220" height="16" rx="4" fill={C.navy} />
        {/* windows */}
        {[0,1,2,3].map(i => (
          <rect key={i} x={78 + i*52} y="262" width="40" height="22" rx="4" fill="#B7DBE9" />
        ))}
        {/* head light */}
        <circle cx="74" cy="276" r="5" fill={C.sand} />
      </g>

      {/* station building */}
      <g>
        <rect x="320" y="200" width="220" height="120" rx="6" fill={C.paper} />
        <rect x="320" y="200" width="220" height="22" rx="6" fill="url(#hRoof)" />
        {/* sign */}
        <rect x="350" y="232" width="160" height="22" rx="4" fill={C.navy} />
        <text x="430" y="248" textAnchor="middle" fontFamily="Zen Maru Gothic, sans-serif"
          fontWeight="700" fontSize="13" fill="#fff">知多半田駅</text>
        {/* window grid */}
        {[0,1,2,3].map(i => (
          <rect key={i} x={340 + i*48} y="266" width="38" height="40" rx="3" fill={C.mintSoft} />
        ))}
        {/* door */}
        <rect x="430" y="280" width="32" height="40" rx="4" fill={C.coralSoft} />
      </g>

      {/* foreground sidewalk */}
      <rect x="0" y="380" width="600" height="100" fill={C.sandSoft} />
      <path d="M0,380 Q300,360 600,380 L600,395 L0,395 Z" fill={C.sand} opacity="0.5" />

      {/* student walking */}
      <g transform="translate(380, 320)">
        {/* shadow */}
        <ellipse cx="20" cy="120" rx="32" ry="6" fill={C.navy} opacity="0.1" />
        {/* legs */}
        <rect x="8" y="78" width="11" height="38" rx="4" fill={C.navy} />
        <rect x="22" y="78" width="11" height="42" rx="4" fill={C.navy} />
        {/* shoes */}
        <ellipse cx="13" cy="118" rx="9" ry="4" fill={C.coral} />
        <ellipse cx="27" cy="122" rx="9" ry="4" fill={C.coral} />
        {/* skirt / shorts */}
        <path d="M2,60 L40,60 L36,82 L6,82 Z" fill={C.navy} />
        {/* torso (uniform shirt) */}
        <rect x="4" y="28" width="34" height="36" rx="6" fill={C.paper} />
        <rect x="4" y="28" width="34" height="6" rx="2" fill={C.mint} />
        {/* tie */}
        <path d="M21,34 L18,46 L21,58 L24,46 Z" fill={C.coral} />
        {/* head */}
        <circle cx="21" cy="14" r="13" fill={C.cream} />
        {/* hair */}
        <path d="M8,12 Q21,-2 34,12 L33,18 Q21,8 9,18 Z" fill={C.navy} />
        {/* backpack */}
        <rect x="-4" y="34" width="12" height="28" rx="4" fill={C.coral} />
        <rect x="-2" y="40" width="8" height="3" rx="1" fill={C.coralSoft} />
      </g>

      {/* second character (parent or friend, walking smaller in distance) */}
      <g transform="translate(280, 350)" opacity="0.85">
        <ellipse cx="12" cy="92" rx="16" ry="3" fill={C.navy} opacity="0.1" />
        <rect x="6" y="56" width="6" height="32" rx="2" fill={C.navy} />
        <rect x="14" y="56" width="6" height="32" rx="2" fill={C.navy} />
        <rect x="4" y="30" width="18" height="28" rx="4" fill={C.mint} />
        <circle cx="13" cy="20" r="9" fill={C.cream} />
        <path d="M5,18 Q13,8 21,18 L20,22 Q13,14 6,22 Z" fill="#3B2A1E" />
      </g>

      {/* tiny bird */}
      <g fill={C.navy} opacity="0.7">
        <path d="M150 130 q5 -6 10 0 q5 -6 10 0" fill="none" stroke={C.navy} strokeWidth="1.6" strokeLinecap="round" />
        <path d="M210 100 q5 -6 10 0 q5 -6 10 0" fill="none" stroke={C.navy} strokeWidth="1.6" strokeLinecap="round" />
      </g>

      {/* signpost arrow toward study cafe */}
      <g transform="translate(60, 360)">
        <rect x="0" y="0" width="6" height="40" rx="2" fill={C.navy} />
        <path d="M-4,8 L40,8 L48,16 L40,24 L-4,24 Z" fill={C.coral} />
        <text x="20" y="20" textAnchor="middle" fontFamily="Zen Maru Gothic, sans-serif"
          fontWeight="700" fontSize="10" fill="#fff">P・SPO</text>
      </g>
    </svg>
  );
}

/* ============================================================
   Home scene — relaxing at home
   ============================================================ */
function HomeScene({ className = "" }) {
  return (
    <svg viewBox="0 0 480 360" className={className} role="img" aria-label="家でくつろぐシーン">
      <rect x="0" y="0" width="480" height="360" rx="20" fill={C.sandSoft} />
      {/* wall stripe */}
      <rect x="0" y="0" width="480" height="220" fill={C.cream} />
      <rect x="0" y="220" width="480" height="140" fill={C.sand} opacity="0.4" />

      {/* window */}
      <g>
        <rect x="50" y="50" width="120" height="100" rx="6" fill="#B7DBE9" />
        <rect x="50" y="50" width="120" height="100" rx="6" fill="none" stroke={C.navy} strokeWidth="3" />
        <line x1="110" y1="50" x2="110" y2="150" stroke={C.navy} strokeWidth="2" />
        <line x1="50" y1="100" x2="170" y2="100" stroke={C.navy} strokeWidth="2" />
        {/* curtain */}
        <path d="M40 50 q-4 50 0 100 l-6 0 q-4 -50 0 -100 z" fill={C.coralSoft} />
        <path d="M180 50 q4 50 0 100 l6 0 q4 -50 0 -100 z" fill={C.coralSoft} />
      </g>
      {/* lamp */}
      <g>
        <line x1="240" y1="0" x2="240" y2="60" stroke={C.navy} strokeWidth="2" />
        <path d="M212,60 L268,60 L258,90 L222,90 Z" fill={C.coral} />
        <ellipse cx="240" cy="110" rx="40" ry="6" fill={C.sand} opacity="0.5" />
      </g>
      {/* shelf */}
      <g>
        <rect x="320" y="80" width="120" height="6" fill={C.navy} />
        <rect x="330" y="50" width="14" height="30" fill={C.mint} />
        <rect x="348" y="58" width="12" height="22" fill={C.coral} />
        <rect x="364" y="46" width="14" height="34" fill={C.peach} />
        <rect x="382" y="60" width="10" height="20" fill={C.navy} />
        <circle cx="410" cy="68" r="12" fill={C.sand} />
      </g>

      {/* sofa */}
      <g>
        <rect x="60" y="220" width="240" height="80" rx="20" fill={C.coral} />
        <rect x="60" y="240" width="240" height="60" rx="14" fill="#C84B30" />
        <rect x="68" y="260" width="60" height="40" rx="12" fill={C.coralSoft} opacity="0.6" />
        <rect x="220" y="260" width="60" height="40" rx="12" fill={C.coralSoft} opacity="0.6" />
      </g>

      {/* parent reading */}
      <g transform="translate(110, 165)">
        <circle cx="20" cy="12" r="14" fill={C.cream} />
        <path d="M5,12 Q20,-3 35,12 L33,18 Q20,8 7,18 Z" fill="#3B2A1E" />
        <rect x="2" y="24" width="36" height="40" rx="8" fill={C.mint} />
        {/* book */}
        <path d="M-4,46 L20,40 L44,46 L44,58 L20,52 L-4,58 Z" fill={C.paper} />
        <line x1="20" y1="40" x2="20" y2="52" stroke={C.navy} strokeWidth="1" />
      </g>

      {/* child */}
      <g transform="translate(200, 200)">
        <circle cx="20" cy="10" r="11" fill={C.cream} />
        <path d="M9,12 Q20,-2 31,12 L29,15 Q20,7 11,15 Z" fill={C.navy} />
        <rect x="6" y="20" width="28" height="30" rx="6" fill={C.peach} />
      </g>

      {/* mug on table */}
      <g transform="translate(330, 220)">
        <rect x="0" y="0" width="80" height="14" fill={C.navy} />
        <rect x="20" y="-22" width="20" height="22" rx="4" fill={C.paper} />
        <path d="M40,-18 q8,4 0,12" fill="none" stroke={C.paper} strokeWidth="3" />
        <ellipse cx="30" cy="-22" rx="10" ry="3" fill={C.coral} />
      </g>

      {/* steam */}
      <g stroke={C.navy} strokeWidth="1.4" fill="none" opacity="0.5" strokeLinecap="round">
        <path d="M348 188 q4 -8 0 -16 q-4 -8 0 -16" />
        <path d="M358 188 q4 -8 0 -16 q-4 -8 0 -16" />
      </g>
    </svg>
  );
}

/* ============================================================
   Study scene — at P・SPO desk
   ============================================================ */
function StudyScene({ className = "" }) {
  return (
    <svg viewBox="0 0 480 360" className={className} role="img" aria-label="駅前スタディスペースで集中するシーン">
      <rect x="0" y="0" width="480" height="360" rx="20" fill={C.mintSoft} />
      <rect x="0" y="0" width="480" height="220" fill="#F1F8F5" />

      {/* window with cityscape */}
      <g>
        <rect x="40" y="40" width="180" height="110" rx="6" fill="#D8EBE5" />
        <rect x="40" y="40" width="180" height="110" rx="6" fill="none" stroke={C.navy} strokeWidth="3" />
        {/* buildings outside */}
        <rect x="55" y="80" width="20" height="60" fill={C.mint} />
        <rect x="80" y="60" width="22" height="80" fill={C.peach} />
        <rect x="108" y="90" width="18" height="50" fill={C.coral} />
        <rect x="132" y="70" width="24" height="70" fill={C.navy} />
        <rect x="162" y="100" width="20" height="40" fill={C.sand} />
        <rect x="186" y="80" width="22" height="60" fill={C.mint} />
      </g>

      {/* shelf with books */}
      <g transform="translate(290, 40)">
        <rect x="0" y="0" width="160" height="6" fill={C.navy} />
        <rect x="6" y="6" width="148" height="46" fill={C.mintPale} opacity="0.4" />
        <rect x="0" y="48" width="160" height="6" fill={C.navy} />
        {[
          [10, C.coral, 32], [20, C.navy, 38], [38, C.peach, 30],
          [54, C.mint, 36], [72, C.sand, 40], [92, C.coralSoft, 34],
          [108, C.navy, 38], [124, C.coral, 32], [140, C.mint, 40],
        ].map(([x, fill, h], i) => (
          <rect key={i} x={6 + x} y={48 - h} width="10" height={h} fill={fill} />
        ))}
      </g>

      {/* desk */}
      <rect x="40" y="240" width="400" height="14" rx="2" fill={C.navy} />
      <rect x="60" y="254" width="10" height="80" fill={C.navy} />
      <rect x="410" y="254" width="10" height="80" fill={C.navy} />

      {/* lamp */}
      <g transform="translate(80, 170)">
        <rect x="0" y="60" width="28" height="6" rx="2" fill={C.navy} />
        <rect x="12" y="20" width="4" height="44" fill={C.navy} />
        <path d="M-6 14 L34 14 L24 36 L4 36 Z" fill={C.coral} />
        <ellipse cx="14" cy="60" rx="20" ry="3" fill={C.sand} opacity="0.5" />
      </g>

      {/* laptop */}
      <g transform="translate(140, 200)">
        <path d="M0 40 L80 40 L70 0 L10 0 Z" fill={C.navy} />
        <path d="M10 4 L70 4 L66 36 L14 36 Z" fill={C.mintSoft} />
        <rect x="-6" y="40" width="92" height="6" rx="2" fill="#0A1530" />
      </g>

      {/* notebook */}
      <g transform="translate(250, 220)">
        <rect x="0" y="0" width="90" height="20" rx="2" fill={C.paper} />
        <line x1="6" y1="6" x2="84" y2="6" stroke={C.text} strokeOpacity="0.3" strokeWidth="1" />
        <line x1="6" y1="11" x2="84" y2="11" stroke={C.text} strokeOpacity="0.3" strokeWidth="1" />
        <line x1="6" y1="16" x2="60" y2="16" stroke={C.text} strokeOpacity="0.3" strokeWidth="1" />
      </g>
      {/* pen */}
      <g transform="translate(320, 215) rotate(20)">
        <rect x="0" y="0" width="40" height="4" rx="2" fill={C.coral} />
        <rect x="38" y="0" width="6" height="4" fill={C.navy} />
      </g>

      {/* mug */}
      <g transform="translate(370, 210)">
        <rect x="0" y="0" width="22" height="26" rx="4" fill={C.paper} />
        <path d="M22 6 q8 4 0 14" fill="none" stroke={C.paper} strokeWidth="3" />
        <rect x="2" y="0" width="18" height="6" fill={C.coral} />
      </g>

      {/* student studying */}
      <g transform="translate(180, 110)">
        <circle cx="20" cy="40" r="18" fill={C.cream} />
        <path d="M2,40 Q20,16 38,40 L37,46 Q20,32 3,46 Z" fill={C.navy} />
        <rect x="2" y="58" width="36" height="50" rx="6" fill={C.paper} />
        <rect x="2" y="58" width="36" height="6" rx="2" fill={C.mint} />
        <path d="M21,64 L18,80 L21,96 L24,80 Z" fill={C.coral} />
      </g>
    </svg>
  );
}

/* ============================================================
   Family dinner scene
   ============================================================ */
function FamilyScene({ className = "" }) {
  return (
    <svg viewBox="0 0 520 360" className={className} role="img" aria-label="家族での夕食シーン">
      <rect x="0" y="0" width="520" height="360" rx="20" fill={C.sandSoft} />
      <rect x="0" y="0" width="520" height="200" fill={C.cream} />
      {/* hanging lamp */}
      <line x1="260" y1="0" x2="260" y2="40" stroke={C.navy} strokeWidth="2" />
      <path d="M232 40 L288 40 L278 70 L242 70 Z" fill={C.coral} />
      <ellipse cx="260" cy="100" rx="80" ry="8" fill={C.sand} opacity="0.4" />

      {/* dining table */}
      <ellipse cx="260" cy="270" rx="220" ry="40" fill="#C8956A" />
      <ellipse cx="260" cy="262" rx="220" ry="36" fill="#E0B589" />

      {/* plates */}
      <g>
        <ellipse cx="120" cy="262" rx="36" ry="10" fill={C.paper} />
        <ellipse cx="260" cy="252" rx="42" ry="11" fill={C.paper} />
        <ellipse cx="400" cy="262" rx="36" ry="10" fill={C.paper} />
        <circle cx="260" cy="248" r="22" fill={C.coralSoft} />
      </g>

      {/* parents */}
      <g transform="translate(60, 130)">
        <rect x="0" y="60" width="60" height="80" rx="14" fill={C.mint} />
        <circle cx="30" cy="40" r="22" fill={C.cream} />
        <path d="M8 38 Q30 12 52 38 L51 46 Q30 28 9 46 Z" fill="#3B2A1E" />
      </g>
      <g transform="translate(400, 130)">
        <rect x="0" y="60" width="60" height="80" rx="14" fill={C.coral} />
        <circle cx="30" cy="40" r="22" fill={C.cream} />
        <path d="M6 30 Q30 6 54 30 L52 50 Q30 36 8 50 Z" fill={C.navy} />
      </g>

      {/* student */}
      <g transform="translate(220, 110)">
        <rect x="0" y="74" width="80" height="80" rx="14" fill={C.paper} />
        <rect x="0" y="74" width="80" height="10" rx="3" fill={C.mint} />
        <path d="M40,80 L36,108 L40,134 L44,108 Z" fill={C.coral} />
        <circle cx="40" cy="46" r="26" fill={C.cream} />
        <path d="M14 46 Q40 14 66 46 L65 54 Q40 36 15 54 Z" fill={C.navy} />
      </g>

      {/* small steam from food */}
      <g stroke={C.navy} strokeWidth="1.5" fill="none" opacity="0.45" strokeLinecap="round">
        <path d="M250 230 q4 -10 0 -20 q-4 -10 0 -20" />
        <path d="M260 230 q4 -10 0 -20 q-4 -10 0 -20" />
        <path d="M270 230 q4 -10 0 -20 q-4 -10 0 -20" />
      </g>
    </svg>
  );
}

/* ============================================================
   Tiny icons (illustrative, not stroke iconography)
   Each ~88px viewBox, brand colored, flat
   ============================================================ */

function IconStation() {
  return (
    <svg viewBox="0 0 88 88" width="72" height="72">
      <rect x="6" y="48" width="76" height="32" rx="4" fill={C.mintSoft} />
      <rect x="6" y="42" width="76" height="10" rx="3" fill={C.coral} />
      {[0,1,2].map(i => <rect key={i} x={14 + i*22} y="56" width="16" height="14" rx="2" fill="#B7DBE9" />)}
      <rect x="38" y="14" width="12" height="32" fill={C.navy} />
      <circle cx="44" cy="14" r="8" fill={C.sand} />
      <text x="44" y="17" textAnchor="middle" fontSize="9" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fill={C.navy}>60</text>
    </svg>
  );
}

function IconClock() {
  return (
    <svg viewBox="0 0 88 88" width="72" height="72">
      <circle cx="44" cy="48" r="30" fill={C.mintPale} />
      <circle cx="44" cy="48" r="22" fill={C.paper} />
      <line x1="44" y1="48" x2="44" y2="32" stroke={C.navy} strokeWidth="3" strokeLinecap="round" />
      <line x1="44" y1="48" x2="58" y2="48" stroke={C.coral} strokeWidth="3" strokeLinecap="round" />
      <circle cx="44" cy="48" r="3" fill={C.navy} />
      {/* sun + moon corners */}
      <circle cx="14" cy="20" r="8" fill={C.sand} />
      <path d="M76 20 a8 8 0 1 0 -10 6 a6 6 0 0 1 10 -6 z" fill={C.navy} />
    </svg>
  );
}

function IconShield() {
  return (
    <svg viewBox="0 0 88 88" width="72" height="72">
      <path d="M44 8 L72 18 L72 46 Q72 70 44 80 Q16 70 16 46 L16 18 Z" fill={C.coralSoft} />
      <path d="M44 16 L66 24 L66 46 Q66 64 44 72 Q22 64 22 46 L22 24 Z" fill={C.coral} />
      {/* face */}
      <circle cx="44" cy="40" r="10" fill={C.cream} />
      <circle cx="40" cy="38" r="1.6" fill={C.navy} />
      <circle cx="48" cy="38" r="1.6" fill={C.navy} />
      <path d="M40 44 q4 3 8 0" fill="none" stroke={C.navy} strokeWidth="1.6" strokeLinecap="round" />
      <rect x="34" y="52" width="20" height="14" rx="3" fill={C.paper} />
      {/* check */}
      <path d="M37 60 l4 3 l7 -7" fill="none" stroke={C.mint} strokeWidth="2.4" strokeLinecap="round" strokeLinejoin="round" />
    </svg>
  );
}

function IconWifi() {
  return (
    <svg viewBox="0 0 88 88" width="64" height="64">
      <circle cx="44" cy="48" r="30" fill={C.mintPale} />
      <path d="M22 42 q22 -22 44 0" fill="none" stroke={C.navy} strokeWidth="4" strokeLinecap="round" />
      <path d="M30 50 q14 -14 28 0" fill="none" stroke={C.navy} strokeWidth="4" strokeLinecap="round" />
      <path d="M38 58 q6 -6 12 0" fill="none" stroke={C.coral} strokeWidth="4" strokeLinecap="round" />
      <circle cx="44" cy="64" r="3" fill={C.coral} />
    </svg>
  );
}

function IconCoffee() {
  return (
    <svg viewBox="0 0 88 88" width="64" height="64">
      <rect x="20" y="32" width="42" height="36" rx="6" fill={C.paper} />
      <rect x="20" y="32" width="42" height="10" rx="3" fill={C.coral} />
      <path d="M62 40 q14 6 0 22" fill="none" stroke={C.paper} strokeWidth="6" />
      <path d="M62 40 q14 6 0 22" fill="none" stroke={C.coral} strokeWidth="3" />
      <g stroke={C.navy} strokeWidth="2" fill="none" strokeLinecap="round" opacity="0.6">
        <path d="M30 28 q4 -6 0 -12" />
        <path d="M40 28 q4 -6 0 -12" />
        <path d="M50 28 q4 -6 0 -12" />
      </g>
      <rect x="14" y="68" width="54" height="6" rx="2" fill={C.navy} />
    </svg>
  );
}

function IconBooth() {
  return (
    <svg viewBox="0 0 88 88" width="64" height="64">
      <rect x="14" y="20" width="60" height="48" rx="6" fill={C.mintSoft} />
      <rect x="14" y="20" width="60" height="10" fill={C.mint} />
      <rect x="20" y="36" width="22" height="22" fill={C.paper} />
      <rect x="46" y="36" width="22" height="22" fill={C.paper} />
      <rect x="42" y="36" width="4" height="22" fill={C.navy} />
      <rect x="14" y="68" width="60" height="6" rx="2" fill={C.navy} />
      <rect x="22" y="42" width="14" height="10" fill={C.sand} />
      <rect x="48" y="42" width="14" height="10" fill={C.coralSoft} />
    </svg>
  );
}

function IconLounge() {
  return (
    <svg viewBox="0 0 88 88" width="64" height="64">
      <rect x="10" y="44" width="68" height="24" rx="10" fill={C.coral} />
      <rect x="10" y="40" width="68" height="14" rx="6" fill={C.coralSoft} />
      <circle cx="22" cy="26" r="8" fill={C.cream} />
      <path d="M14 26 q8 -10 16 0 l-1 4 q-7 -7 -14 0 z" fill={C.navy} />
      <rect x="16" y="32" width="14" height="14" rx="3" fill={C.mint} />
      <rect x="60" y="22" width="20" height="6" fill={C.navy} />
      <rect x="62" y="14" width="6" height="14" fill={C.peach} />
      <rect x="70" y="18" width="6" height="10" fill={C.sand} />
    </svg>
  );
}

function IconLockKey() {
  return (
    <svg viewBox="0 0 88 88" width="64" height="64">
      <rect x="20" y="38" width="48" height="36" rx="6" fill={C.coral} />
      <path d="M30 38 v-8 a14 14 0 0 1 28 0 v8" fill="none" stroke={C.navy} strokeWidth="4" />
      <circle cx="44" cy="54" r="6" fill={C.cream} />
      <rect x="42" y="58" width="4" height="10" fill={C.cream} />
    </svg>
  );
}

function IconBird() {
  return (
    <svg viewBox="0 0 88 88" width="64" height="64">
      <circle cx="44" cy="48" r="20" fill={C.mint} />
      <circle cx="36" cy="42" r="3" fill={C.navy} />
      <path d="M50 48 l16 -4 l-12 8 z" fill={C.coral} />
      <path d="M44 68 q4 12 -2 18" fill="none" stroke={C.navy} strokeWidth="3" strokeLinecap="round" />
    </svg>
  );
}

function IconRabbit() {
  return (
    <svg viewBox="0 0 88 88" width="64" height="64">
      <ellipse cx="44" cy="60" rx="22" ry="16" fill={C.paper} />
      <circle cx="44" cy="44" r="14" fill={C.paper} />
      <ellipse cx="36" cy="22" rx="5" ry="14" fill={C.paper} />
      <ellipse cx="52" cy="22" rx="5" ry="14" fill={C.paper} />
      <ellipse cx="36" cy="22" rx="2" ry="10" fill={C.coralSoft} />
      <ellipse cx="52" cy="22" rx="2" ry="10" fill={C.coralSoft} />
      <circle cx="40" cy="44" r="1.6" fill={C.navy} />
      <circle cx="48" cy="44" r="1.6" fill={C.navy} />
      <path d="M42 48 q2 2 4 0" fill="none" stroke={C.coral} strokeWidth="1.6" strokeLinecap="round" />
    </svg>
  );
}

/* ============================================================
   Background ambient — birds, clouds, train silhouette
   used in §03 REFRAME
   ============================================================ */
function ReframeBackdrop() {
  return (
    <svg viewBox="0 0 1200 400" preserveAspectRatio="xMidYMid slice"
      style={{ position: "absolute", inset: 0, width: "100%", height: "100%", zIndex: 0 }}>
      {/* clouds */}
      <g fill={C.paper} opacity="0.85">
        <ellipse cx="180" cy="80" rx="60" ry="14" />
        <ellipse cx="220" cy="74" rx="36" ry="10" />
        <ellipse cx="900" cy="60" rx="50" ry="12" />
      </g>
      {/* hills */}
      <path d="M0,300 Q200,260 400,280 T800,280 T1200,300 L1200,400 L0,400 Z" fill={C.mintPale} opacity="0.7" />
      {/* train silhouette */}
      <g transform="translate(60, 230)" opacity="0.55">
        <rect x="0" y="0" width="180" height="42" rx="8" fill={C.navy} />
        <rect x="0" y="0" width="180" height="8" rx="3" fill={C.coral} />
        {[0,1,2].map(i => <rect key={i} x={14 + i*48} y="14" width="36" height="18" rx="3" fill={C.mintSoft} />)}
      </g>
      {/* tracks */}
      <line x1="0" y1="282" x2="1200" y2="282" stroke={C.navy} strokeOpacity="0.25" strokeWidth="2" />
      {/* birds */}
      <g stroke={C.navy} strokeWidth="2" fill="none" strokeLinecap="round" opacity="0.6">
        <path d="M520 120 q8 -10 16 0 q8 -10 16 0" />
        <path d="M700 90 q6 -8 12 0 q6 -8 12 0" />
        <path d="M820 140 q6 -8 12 0 q6 -8 12 0" />
      </g>
    </svg>
  );
}

/* ============================================================
   Map — knowledge of Chita peninsula. Stylized, not literal.
   ============================================================ */
function CatchmentMap() {
  const containerRef = React.useRef(null);
  const mapRef = React.useRef(null);

  React.useEffect(() => {
    if (!window.L || !containerRef.current || mapRef.current) return;
    const L = window.L;

    const map = L.map(containerRef.current, {
      center: [34.99, 136.93],
      zoom: 11,
      zoomControl: true,
      scrollWheelZoom: false,
      attributionControl: true,
    });
    mapRef.current = map;

    // CartoDB Positron — soft monotone tiles
    L.tileLayer('https://{s}.basemaps.cartocdn.com/light_all/{z}/{x}/{y}{r}.png', {
      attribution: '&copy; <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> &copy; <a href="https://carto.com/attributions">CARTO</a>',
      subdomains: 'abcd',
      maxZoom: 19,
    }).addTo(map);

    const NAVY = '#152340';
    const CORAL = '#E5654A';
    const MINT = '#7BC4B5';

    // P・SPO 拠点
    const pspo = [
      { name: '知多半田駅前店', latlng: [34.8878, 136.9285], main: true },
      { name: '住吉店', latlng: [34.9020, 136.9415] },
      { name: '清城店', latlng: [34.8930, 136.9335] },
    ];
    pspo.forEach(s => {
      const size = s.main ? 30 : 18;
      const ring = s.main ? `<div style="position:absolute;inset:-10px;border-radius:50%;background:rgba(229,101,74,0.18);"></div>` : '';
      const star = s.main ? `<span style="color:#fff;font-weight:900;font-size:14px;line-height:1;">★</span>` : '';
      const label = s.main
        ? `<div style="position:absolute;left:50%;top:${size + 12}px;transform:translateX(-50%);background:${NAVY};color:#fff;padding:4px 10px;border-radius:8px;font-size:11px;font-weight:700;white-space:nowrap;font-family:'Zen Maru Gothic','Noto Sans JP',sans-serif;box-shadow:0 4px 12px rgba(15,23,38,0.18);">${s.name} <span style="color:${CORAL};">★</span></div>`
        : '';
      const html = `<div style="position:relative;width:${size}px;height:${size}px;">
        ${ring}
        <div style="width:${size}px;height:${size}px;border-radius:50%;background:${CORAL};border:3px solid #fff;box-shadow:0 4px 12px rgba(229,101,74,0.4);display:flex;align-items:center;justify-content:center;">${star}</div>
        ${label}
      </div>`;
      const icon = L.divIcon({ html, className: 'pspo-marker', iconSize: [size, size], iconAnchor: [size/2, size/2] });
      L.marker(s.latlng, { icon, zIndexOffset: s.main ? 1000 : 500 }).addTo(map).bindPopup(`<strong>P・SPO ${s.name}</strong>`);
    });

    // 主要駅・主要都市
    const cities = [
      { name: '名古屋', latlng: [35.1709, 136.8815], size: 16 },
      { name: '大府', latlng: [35.0151, 136.9612], size: 11 },
      { name: '東海', latlng: [35.0218, 136.9019], size: 11 },
      { name: '武豊', latlng: [34.8455, 136.9203], size: 10 },
      { name: '河和', latlng: [34.7705, 136.9244], size: 10 },
      { name: '常滑', latlng: [34.8839, 136.8367], size: 10 },
      { name: '阿久比', latlng: [34.9527, 136.9242], size: 10 },
    ];
    cities.forEach(c => {
      const html = `<div style="display:flex;flex-direction:column;align-items:center;pointer-events:auto;">
        <div style="width:${c.size}px;height:${c.size}px;border-radius:50%;background:${NAVY};border:2px solid #fff;box-shadow:0 1px 4px rgba(0,0,0,0.2);"></div>
        <div style="margin-top:3px;background:rgba(255,255,255,0.95);padding:2px 7px;border-radius:5px;font-size:11px;font-weight:700;font-family:'Zen Maru Gothic','Noto Sans JP',sans-serif;color:${NAVY};white-space:nowrap;box-shadow:0 1px 3px rgba(0,0,0,0.08);">${c.name}</div>
      </div>`;
      const icon = L.divIcon({ html, className: '', iconSize: [c.size, c.size + 24], iconAnchor: [c.size/2, c.size/2] });
      L.marker(c.latlng, { icon }).addTo(map);
    });

    // 主要高校
    const schools = [
      { name: '半田高校', latlng: [34.8945, 136.9389] },
      { name: '半田東高校', latlng: [34.9106, 136.9525] },
      { name: '武豊高校', latlng: [34.8421, 136.9181] },
      { name: '阿久比高校', latlng: [34.9530, 136.9264] },
      { name: '横須賀高校', latlng: [35.0309, 136.9078] },
      { name: '東海高校', latlng: [35.1610, 136.9170] },
      { name: '旭丘高校', latlng: [35.1798, 136.9132] },
      { name: '愛工大名電', latlng: [35.1671, 136.9326] },
      { name: '東邦高校', latlng: [35.1716, 136.9711] },
      { name: '名城大附属', latlng: [35.1703, 136.8721] },
      { name: '南山高校', latlng: [35.1488, 136.9492] },
      { name: '中部大春日丘', latlng: [35.2517, 136.9740] },
    ];
    schools.forEach(s => {
      const html = `<div style="width:10px;height:10px;border-radius:50%;background:${MINT};border:2px solid #fff;box-shadow:0 1px 3px rgba(0,0,0,0.15);"></div>`;
      const icon = L.divIcon({ html, className: '', iconSize: [10, 10], iconAnchor: [5, 5] });
      L.marker(s.latlng, { icon }).addTo(map).bindPopup(`<strong>${s.name}</strong>`);
    });

    return () => {
      if (mapRef.current) {
        mapRef.current.remove();
        mapRef.current = null;
      }
    };
  }, []);

  return (
    <div style={{ width: '100%', borderRadius: 20, overflow: 'hidden', boxShadow: '0 12px 40px rgba(15,23,38,0.10)', position: 'relative', background: '#F4F1EA' }}>
      <div ref={containerRef} style={{ width: '100%', height: 480 }} />
      <div style={{ position: 'absolute', top: 14, left: 14, background: 'rgba(255,255,255,0.92)', padding: '10px 14px', borderRadius: 10, fontSize: 11, fontWeight: 700, fontFamily: 'Zen Maru Gothic, Noto Sans JP, sans-serif', color: '#152340', display: 'flex', flexDirection: 'column', gap: 6, boxShadow: '0 4px 12px rgba(15,23,38,0.10)', zIndex: 1000, pointerEvents: 'none' }}>
        <span style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 10, height: 10, borderRadius: '50%', background: '#E5654A', border: '2px solid #fff', boxShadow: '0 1px 3px rgba(0,0,0,0.2)' }} /> P・SPO 拠点</span>
        <span style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 8, height: 8, borderRadius: '50%', background: '#152340', border: '2px solid #fff' }} /> 主要駅</span>
        <span style={{ display: 'flex', alignItems: 'center', gap: 8 }}><span style={{ width: 8, height: 8, borderRadius: '50%', background: '#7BC4B5', border: '2px solid #fff' }} /> 対応高校</span>
      </div>
    </div>
  );
}

/* === legacy SVG map (kept for reference, replaced by Leaflet above) === */
function CatchmentMapSVG() {
  return (
    <svg viewBox="0 0 720 560" role="img" aria-label="知多半島と名古屋エリアの地図">
      <defs>
        <linearGradient id="seaBg" x1="0" y1="0" x2="0" y2="1">
          <stop offset="0" stopColor="#E8F2EE" />
          <stop offset="1" stopColor="#C8E5DD" stopOpacity="0.5" />
        </linearGradient>
      </defs>

      {/* Ise Bay / Mikawa Bay (sea background) */}
      <rect x="0" y="0" width="720" height="560" rx="20" fill="url(#seaBg)" />

      {/* 北側陸地（名古屋・大府方面、半島の付け根） */}
      <path d="M0 0 H720 V160 Q670 145 600 150 Q520 158 460 150 Q420 145 400 130 Q385 118 370 110 Q345 105 320 110 Q280 118 240 110 Q190 100 130 110 Q70 118 0 110 Z"
        fill={C.cream} stroke={C.coralSoft} strokeWidth="1.5" />

      {/* 知多半島（縦長、東岸に半田・武豊／西岸に常滑） */}
      <path d="M310 110
               Q340 115 360 125
               Q380 138 386 160
               Q392 200 392 240
               Q394 290 388 340
               Q380 390 368 430
               Q358 470 348 500
               Q340 525 322 535
               Q302 540 285 528
               Q272 510 270 480
               Q266 440 270 400
               Q272 360 274 320
               Q278 280 282 240
               Q286 200 292 165
               Q298 135 310 110 Z"
        fill={C.sandSoft} stroke={C.coralSoft} strokeWidth="2" />

      {/* セントレア空港島（西海岸の沖） */}
      <ellipse cx="200" cy="450" rx="26" ry="13" fill={C.cream} stroke={C.coralSoft} strokeWidth="1" />
      <text x="200" y="453" textAnchor="middle" fontFamily="Zen Maru Gothic, sans-serif" fontSize="9" fill={C.textMuted} fontWeight="700">セントレア</text>

      {/* 海域ラベル */}
      <text x="100" y="320" fontFamily="Zen Maru Gothic, sans-serif" fontSize="13" fill={C.mint} fontWeight="700" opacity="0.55" letterSpacing="2">伊 勢 湾</text>
      <text x="540" y="380" fontFamily="Zen Maru Gothic, sans-serif" fontSize="13" fill={C.mint} fontWeight="700" opacity="0.55" letterSpacing="2">三 河 湾</text>

      {/* JR武豊線（東海岸を南北に走る） */}
      <path d="M460 100 Q420 130 400 170 Q392 220 388 270 Q386 320 384 370 Q382 400 380 420"
        fill="none" stroke={C.coral} strokeWidth="2.5" strokeDasharray="5 4" opacity="0.65" />
      <text x="430" y="240" fontFamily="Manrope, sans-serif" fontSize="9" fill={C.coral} fontWeight="700" letterSpacing="1.5">JR 武豊線</text>

      {/* 名鉄河和線（半島中央を南北、河和まで） */}
      <path d="M340 100 Q330 150 322 200 Q318 260 322 320 Q326 380 320 440 Q310 480 300 510"
        fill="none" stroke={C.navy} strokeWidth="2.5" strokeDasharray="5 4" opacity="0.55" />
      <text x="225" y="225" fontFamily="Manrope, sans-serif" fontSize="9" fill={C.navy} fontWeight="700" letterSpacing="1.5">名鉄 河和線</text>

      {/* === 名古屋 === */}
      <g transform="translate(360, 65)">
        <circle r="16" fill={C.navy} />
        <text y="5" textAnchor="middle" fill="#fff" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="11">名</text>
        <text y="-25" textAnchor="middle" fill={C.navy} fontFamily="Zen Maru Gothic, sans-serif" fontWeight="900" fontSize="15">名古屋</text>
      </g>

      {/* 大府（北東、武豊線起点） */}
      <g transform="translate(460, 100)">
        <circle r="6" fill={C.peach} />
        <text x="11" y="4" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="11" fill={C.navy}>大府</text>
      </g>

      {/* 東海（北、河和線起点近く） */}
      <g transform="translate(340, 102)">
        <circle r="6" fill={C.peach} />
        <text x="-44" y="4" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="11" fill={C.navy}>東海</text>
      </g>

      {/* 阿久比（半島中央北寄り、河和線） */}
      <g transform="translate(322, 195)">
        <circle r="5" fill={C.mint} />
        <text x="-44" y="3" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="10" fill={C.navy}>阿久比</text>
      </g>

      {/* 横須賀（東海市内、北の方） */}
      <g transform="translate(395, 145)">
        <circle r="4" fill={C.mintPale} />
        <text x="10" y="3" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="9" fill={C.textMuted}>横須賀</text>
      </g>

      {/* 半田駅(JR) - 半田駅エリア */}
      <g transform="translate(388, 290)">
        <circle r="4" fill={C.mintPale} />
        <text x="10" y="3" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="9" fill={C.textMuted}>半田</text>
      </g>

      {/* === 知多半田駅 (メインピン) === */}
      <g transform="translate(335, 305)">
        <circle r="24" fill={C.coral} opacity="0.18" />
        <circle r="18" fill={C.coral} />
        <circle r="11" fill="#fff" />
        <text y="-32" textAnchor="middle" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="900" fontSize="14" fill={C.navy}>知多半田</text>
        <text y="4" textAnchor="middle" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="900" fontSize="13" fill={C.coral}>★</text>
        <text y="42" textAnchor="middle" fontFamily="Manrope, sans-serif" fontWeight="700" fontSize="9" letterSpacing="2" fill={C.coral}>P・SPO</text>
      </g>

      {/* 亀崎（東海岸北、JR武豊線の駅、半田東高校近く） */}
      <g transform="translate(395, 270)">
        <circle r="3" fill={C.mintPale} opacity="0.7" />
        <text x="9" y="3" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="8" fill={C.textMuted}>亀崎</text>
      </g>

      {/* 武豊（半島南東、JR武豊線終点） */}
      <g transform="translate(380, 410)">
        <circle r="5" fill={C.mint} />
        <text x="11" y="3" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="10" fill={C.navy}>武豊</text>
      </g>

      {/* 河和（南端、河和線終点） */}
      <g transform="translate(305, 500)">
        <circle r="4" fill={C.mintPale} />
        <text x="-30" y="3" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="9" fill={C.textMuted}>河和</text>
      </g>

      {/* 常滑（西海岸） */}
      <g transform="translate(232, 380)">
        <circle r="4" fill={C.mintPale} />
        <text x="-32" y="3" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="9" fill={C.textMuted}>常滑</text>
      </g>

      {/* 鳥（装飾、南東の空に） */}
      <g stroke={C.navy} strokeWidth="1.5" fill="none" strokeLinecap="round" opacity="0.4">
        <path d="M540 100 q6 -8 12 0 q6 -8 12 0" />
        <path d="M580 130 q5 -7 10 0 q5 -7 10 0" />
        <path d="M620 90 q4 -6 8 0 q4 -6 8 0" />
      </g>

      {/* 雲 */}
      <g fill={C.paper} opacity="0.6">
        <ellipse cx="120" cy="80" rx="32" ry="8" />
        <ellipse cx="600" cy="220" rx="28" ry="7" />
      </g>
    </svg>
  );
}

/* ============================================================
   Step illustrations
   ============================================================ */
function StepLineUp() {
  return (
    <svg viewBox="0 0 200 120" width="180">
      <rect x="0" y="0" width="200" height="120" rx="14" fill={C.mintSoft} />
      <rect x="20" y="60" width="160" height="40" rx="8" fill={C.paper} />
      <rect x="30" y="72" width="40" height="6" rx="2" fill={C.coral} />
      <rect x="30" y="84" width="80" height="6" rx="2" fill={C.navy} opacity="0.4" />
      {/* finger / cursor */}
      <circle cx="150" cy="90" r="18" fill={C.coralSoft} />
      <text x="150" y="94" textAnchor="middle" fontSize="14">👆</text>
      <text x="100" y="32" textAnchor="middle" fill={C.navy} fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="14">予約フォーム</text>
    </svg>
  );
}

function StepTour() {
  return (
    <svg viewBox="0 0 200 120" width="180">
      <rect x="0" y="0" width="200" height="120" rx="14" fill={C.sandSoft} />
      {/* building */}
      <rect x="40" y="36" width="120" height="64" rx="6" fill={C.paper} />
      <rect x="40" y="36" width="120" height="14" rx="6" fill={C.coral} />
      <rect x="60" y="62" width="22" height="20" fill={C.mintSoft} />
      <rect x="92" y="62" width="22" height="20" fill={C.mintSoft} />
      <rect x="124" y="62" width="22" height="20" fill={C.coralSoft} />
      {/* people */}
      <g transform="translate(20, 76)">
        <rect x="2" y="12" width="14" height="22" rx="4" fill={C.mint} />
        <circle cx="9" cy="8" r="6" fill={C.cream} />
      </g>
      <g transform="translate(170, 76)">
        <rect x="2" y="12" width="14" height="22" rx="4" fill={C.coral} />
        <circle cx="9" cy="8" r="6" fill={C.cream} />
      </g>
    </svg>
  );
}

function StepCardKey() {
  return (
    <svg viewBox="0 0 200 120" width="180">
      <rect x="0" y="0" width="200" height="120" rx="14" fill={C.coralSoft} />
      <rect x="50" y="32" width="100" height="60" rx="8" fill={C.paper} />
      <rect x="50" y="32" width="100" height="16" rx="8" fill={C.navy} />
      <rect x="60" y="56" width="40" height="6" rx="2" fill={C.navy} opacity="0.4" />
      <rect x="60" y="68" width="60" height="6" rx="2" fill={C.coral} />
      <circle cx="135" cy="74" r="10" fill={C.mint} />
      <text x="135" y="78" textAnchor="middle" fill="#fff" fontFamily="Zen Maru Gothic, sans-serif" fontWeight="700" fontSize="11">★</text>
    </svg>
  );
}

/* expose */
Object.assign(window, {
  HeroScene, HomeScene, StudyScene, FamilyScene,
  IconStation, IconClock, IconShield, IconWifi, IconCoffee, IconBooth, IconLounge, IconLockKey, IconBird, IconRabbit,
  ReframeBackdrop, CatchmentMap,
  StepLineUp, StepTour, StepCardKey,
  FCColors: C,
});
