public/lib/wardrobe.js

衣装・帽子・石スキンのデータ/描画

1003行 · 59,103 bytes · SHA-256 215bc7c69944497987aa8e600d49517e397535d564bad08da10683d1b209cfae

分割 1/7 分割 2/7 分割 3/7 分割 4/7 分割 5/7 分割 6/7 分割 7/7
/* ===== ショップの品を描く部品(絵は1枚も使わない) =====
   ここに入っているのは3つの棚。
     COSTUMES … 特別衣装 51種(1つ目は「そのまま」=何も描かない)
     HATS     … 帽子・頭装備 21種(1つ目は「なし」=何も描かない)
     STONES   … 石の見た目 10種(1つ目は今の石そのもの)
   全部見た目だけ。強さ・当たり判定は一切変わらない。

   衣装の描き方:
     draw(g, x, shY, bot, r, col, dir)
       x   … 体の真ん中の横位置
       shY … 肩の高さ / bot … 体の下端
       r   … 頭の半径(大きさは全部これ基準。r を変えれば丸ごと伸び縮みする)
       col … その人の服の色 / dir … 向き(+1で右・-1で左)
     人の胴は上が狭く下が広い台形。その上から描くので、台形が透けないよう必ず塗りつぶす。
     裾は下へ r*0.9、横へ r*1.7 まで出してよい。

   帽子の描き方:
     draw(g, x, yHead, r, dir, hairCol)
     髪はもう描かれているので、頭のてっぺんをきちんと隠す形にする。上へは r*2.2 まで。

   石の描き方:
     draw(g, r, rot)   原点(0,0)が石の真ん中。r*1.3 の外へはみ出さない。 */
(function () {

  /* ---- 色を作る小道具(その人の服の色から明るい色・暗い色を作る) ---- */
  function hx(c) {
    c = String(c).replace('#', '');
    if (c.length === 3) c = c[0] + c[0] + c[1] + c[1] + c[2] + c[2];
    return [parseInt(c.slice(0, 2), 16), parseInt(c.slice(2, 4), 16), parseInt(c.slice(4, 6), 16)];
  }
  function rgb(a) { return 'rgb(' + (a[0] | 0) + ',' + (a[1] | 0) + ',' + (a[2] | 0) + ')'; }
  function lite(c, f) { var a = hx(c); return rgb([a[0] + (255 - a[0]) * f, a[1] + (255 - a[1]) * f, a[2] + (255 - a[2]) * f]); }
  function dark(c, f) { var a = hx(c); return rgb([a[0] * (1 - f), a[1] * (1 - f), a[2] * (1 - f)]); }

  /* ---- 決め打ちの差し色(人ごとに変わらない) ---- */
  var WH = '#f3f0e7', CR = '#e7e0cc', BK = '#2b2b31', GD = '#e0b24a', PK = '#e58aa8',
      RD = '#c4443a', DN = '#4a6f9a', KH = '#8a8256', SV = '#b9bcc2', BR = '#8a6240', GR = '#5f8f63';

  /* ---- 胴の形を測る小道具 ----
     台形の上辺は幅 0.74r、下辺は 1.16r。t=0で肩、t=1で下端。 */
  function T(shY, bot, t) { return shY + (bot - shY) * t; }
  function HW(r, t) { return r * (0.74 + 0.42 * t); }

  /* 胴をまるごと塗る(下の服を完全に隠す。どの衣装も最初にこれを呼ぶ) */
  function base(g, x, shY, bot, r, col) {
    g.fillStyle = col;
    g.beginPath();
    g.moveTo(x - r * 0.74, shY); g.lineTo(x + r * 0.74, shY);
    g.lineTo(x + r * 1.16, bot); g.lineTo(x - r * 1.16, bot);
    g.closePath(); g.fill();
  }
  /* 胴の横一段ぶんを別の色で塗る(胸の切り替え・帯・ベルトに使う) */
  function panel(g, x, shY, bot, r, t0, t1, col) {
    var y0 = T(shY, bot, t0), y1 = T(shY, bot, t1), w0 = HW(r, t0), w1 = HW(r, t1);
    g.fillStyle = col;
    g.beginPath(); g.moveTo(x - w0, y0); g.lineTo(x + w0, y0);
    g.lineTo(x + w1, y1); g.lineTo(x - w1, y1); g.closePath(); g.fill();
  }
  /* 腰から下を広がるスカートにする(flare=下辺の広さ・drop=下端より下へ出す量) */
  function skirt(g, x, shY, bot, r, t, col, flare, drop) {
    var y0 = T(shY, bot, t), y1 = bot + r * (drop == null ? 0.5 : drop);
    var w0 = HW(r, t), w1 = r * (flare == null ? 1.45 : flare);
    g.fillStyle = col;
    g.beginPath(); g.moveTo(x - w0, y0); g.lineTo(x + w0, y0);
    g.lineTo(x + w1, y1); g.lineTo(x - w1, y1); g.closePath(); g.fill();
  }
  /* ふわふわの縁(丸を横に並べる) */
  function frill(g, x, y, halfW, rad, col, n) {
    g.fillStyle = col;
    for (var i = 0; i < n; i++) {
      g.beginPath(); g.arc(x - halfW + (i + 0.5) * (halfW * 2 / n), y, rad, 0, 7); g.fill();
    }
  }
  /* たての筋(プリーツ) */
  function pleat(g, x, y0, y1, hw0, hw1, n, col, w) {
    g.strokeStyle = col; g.lineWidth = w || 0.9;
    for (var i = 1; i < n; i++) {
      var f = i / n * 2 - 1;
      g.beginPath(); g.moveTo(x + hw0 * f, y0); g.lineTo(x + hw1 * f, y1); g.stroke();
    }
  }
  /* よこの筋(編み目・ダウンの段) */
  function rib(g, x, shY, bot, r, t0, t1, n, col, w) {
    g.strokeStyle = col; g.lineWidth = w || 0.9;
    for (var i = 0; i < n; i++) {
      var t = t0 + (t1 - t0) * (i + 0.5) / n, y = T(shY, bot, t), hw = HW(r, t);
      g.beginPath(); g.moveTo(x - hw, y); g.lineTo(x + hw, y); g.stroke();
    }
  }
  /* リボン */
  function bow(g, cx, cy, s, col) {
    g.fillStyle = col;
    g.beginPath(); g.moveTo(cx, cy); g.lineTo(cx - s, cy - s * 0.72); g.lineTo(cx - s, cy + s * 0.72); g.closePath(); g.fill();
    g.beginPath(); g.moveTo(cx, cy); g.lineTo(cx + s, cy - s * 0.72); g.lineTo(cx + s, cy + s * 0.72); g.closePath(); g.fill();
    g.beginPath(); g.arc(cx, cy, s * 0.36, 0, 7); g.fill();
  }
  /* Vに開いた胸元 */
  function vneck(g, x, shY, r, col, dep) {
    g.fillStyle = col;
    g.beginPath(); g.moveTo(x - r * 0.42, shY); g.lineTo(x + r * 0.42, shY);
    g.lineTo(x, shY + r * (dep || 0.62)); g.closePath(); g.fill();
  }
  /* 丸い襟 */
  function rcollar(g, x, shY, r, col) {
    g.fillStyle = col;
    g.beginPath(); g.arc(x - r * 0.30, shY + r * 0.02, r * 0.30, 0, 7); g.fill();
    g.beginPath(); g.arc(x + r * 0.30, shY + r * 0.02, r * 0.30, 0, 7); g.fill();
  }
  /* 合わせの襟(着物・道着) */
  function xcollar(g, x, shY, bot, r, col) {
    var yb = T(shY, bot, 0.42);
    g.fillStyle = col;
    g.beginPath(); g.moveTo(x - r * 0.66, shY); g.lineTo(x - r * 0.34, shY); g.lineTo(x + r * 0.16, yb); g.lineTo(x - r * 0.10, yb); g.closePath(); g.fill();
    g.beginPath(); g.moveTo(x + r * 0.66, shY); g.lineTo(x + r * 0.34, shY); g.lineTo(x - r * 0.16, yb); g.lineTo(x + r * 0.10, yb); g.closePath(); g.fill();
  }
  /* 前を留めるボタン */
  function buttons(g, x, shY, bot, r, col, n, t0, t1) {
    g.fillStyle = col;
    for (var i = 0; i < n; i++) {
      var t = (t0 == null ? 0.28 : t0) + ((t1 == null ? 0.9 : t1) - (t0 == null ? 0.28 : t0)) * (n === 1 ? 0.5 : i / (n - 1));
      g.beginPath(); g.arc(x, T(shY, bot, t), r * 0.075, 0, 7); g.fill();
    }
  }
  /* ポケット */
  function pocket(g, cx, cy, w, h, col) {
    g.fillStyle = col; g.fillRect(cx - w / 2, cy, w, h);
  }
  /* パーカーのフード(首の後ろのふくらみ) */
  function hood(g, x, shY, r, col) {
    g.fillStyle = col;
    g.beginPath(); g.ellipse(x, shY + r * 0.24, r * 1.00, r * 0.66, 0, Math.PI, Math.PI * 2); g.closePath(); g.fill();
    g.fillStyle = dark(col, 0.18);
    g.beginPath(); g.ellipse(x, shY + r * 0.26, r * 0.66, r * 0.44, 0, Math.PI, Math.PI * 2); g.closePath(); g.fill();
  }
  /* 肩から吊る紐(サロペット・キャミ) */
  function straps(g, x, shY, bot, r, col, w) {
    g.strokeStyle = col; g.lineWidth = w || r * 0.13;
    g.beginPath(); g.moveTo(x - r * 0.55, shY); g.lineTo(x - r * 0.34, T(shY, bot, 0.36)); g.stroke();
    g.beginPath(); g.moveTo(x + r * 0.55, shY); g.lineTo(x + r * 0.34, T(shY, bot, 0.36)); g.stroke();
  }
  /* 前を開けた上着(中が見える) */
  function openFront(g, x, shY, bot, r, outer, inner) {
    base(g, x, shY, bot, r, inner);
    g.fillStyle = outer;
    g.beginPath(); g.moveTo(x - r * 0.74, shY); g.lineTo(x - r * 0.14, shY);
    g.lineTo(x - r * 0.30, bot); g.lineTo(x - r * 1.16, bot); g.closePath(); g.fill();
    g.beginPath(); g.moveTo(x + r * 0.74, shY); g.lineTo(x + r * 0.14, shY);
    g.lineTo(x + r * 0.30, bot); g.lineTo(x + r * 1.16, bot); g.closePath(); g.fill();
  }

  /* ================= 特別衣装 51種 ================= */
  var COSTUMES = [
    /* 何も着せない(買う前の姿) */
    { id: 'plain', nm: 'そのまま', price: 0, tone: 'neutral', draw: function () { } },

    /* ---- かわいい・女性向け寄り(35種) ---- */
    { id: 'frill', nm: 'フリル', price: 180, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      skirt(g, x, shY, bot, r, 0.44, col, 1.42, 0.42);
      var f = lite(col, 0.55);
      /* 下半分に明るい布を重ね、その縁を丸く波打たせる */
      g.fillStyle = f;
      g.beginPath();
      g.moveTo(x - r * 1.16, T(shY, bot, 0.74)); g.lineTo(x + r * 1.16, T(shY, bot, 0.74));
      g.lineTo(x + r * 1.42, bot + r * 0.42); g.lineTo(x - r * 1.42, bot + r * 0.42); g.closePath(); g.fill();
      frill(g, x, T(shY, bot, 0.74), r * 1.16, r * 0.15, f, 5);
      frill(g, x, bot + r * 0.42, r * 1.42, r * 0.17, f, 7);
      frill(g, x, T(shY, bot, 0.10), HW(r, 0.10), r * 0.11, lite(col, 0.78), 5);
    } },
    { id: 'maid', nm: 'メイド服風', price: 320, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, dark(col, 0.62));
      skirt(g, x, shY, bot, r, 0.50, dark(col, 0.62), 1.48, 0.46);
      /* 白いエプロン */
      g.fillStyle = WH;
      g.beginPath(); g.moveTo(x - r * 0.34, T(shY, bot, 0.16)); g.lineTo(x + r * 0.34, T(shY, bot, 0.16));
      g.lineTo(x + r * 0.86, bot + r * 0.36); g.lineTo(x - r * 0.86, bot + r * 0.36); g.closePath(); g.fill();
      rcollar(g, x, shY, r, WH);
      frill(g, x, bot + r * 0.46, r * 1.44, r * 0.16, WH, 7);
      panel(g, x, shY, bot, r, 0.50, 0.58, WH);
      bow(g, x, T(shY, bot, 0.20), r * 0.26, PK);
    } },
    { id: 'idol', nm: 'アイドル風', price: 360, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.42));
      skirt(g, x, shY, bot, r, 0.52, WH, 1.52, 0.30);
      pleat(g, x, T(shY, bot, 0.52), bot + r * 0.30, HW(r, 0.52), r * 1.52, 6, '#c9c4b4', 1);
      panel(g, x, shY, bot, r, 0.48, 0.56, GD);
      /* 肩のふくらみ */
      g.fillStyle = WH;
      g.beginPath(); g.arc(x - r * 0.72, shY + r * 0.06, r * 0.24, 0, 7); g.fill();
      g.beginPath(); g.arc(x + r * 0.72, shY + r * 0.06, r * 0.24, 0, 7); g.fill();
      /* 胸の星 */
      g.fillStyle = GD;
      g.beginPath();
      for (var i = 0; i < 10; i++) {
        var a = -Math.PI / 2 + i * Math.PI / 5, rr = r * (i % 2 ? 0.10 : 0.24);
        if (i === 0) g.moveTo(x + Math.cos(a) * rr, T(shY, bot, 0.26) + Math.sin(a) * rr);
        else g.lineTo(x + Math.cos(a) * rr, T(shY, bot, 0.26) + Math.sin(a) * rr);
      }
      g.closePath(); g.fill();
    } },
    { id: 'ribbondress', nm: 'リボンドレス', price: 240, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      skirt(g, x, shY, bot, r, 0.46, col, 1.50, 0.52);
      panel(g, x, shY, bot, r, 0.44, 0.52, WH);
      bow(g, x, T(shY, bot, 0.24), r * 0.40, WH);
      g.strokeStyle = WH; g.lineWidth = r * 0.09;
      g.beginPath(); g.moveTo(x - r * 1.46, bot + r * 0.42); g.lineTo(x + r * 1.46, bot + r * 0.42); g.stroke();
    } },
    { id: 'onepiece', nm: 'ワンピース風', price: 140, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      skirt(g, x, shY, bot, r, 0.38, col, 1.40, 0.55);
      panel(g, x, shY, bot, r, 0, 0.34, lite(col, 0.32));
      g.strokeStyle = dark(col, 0.25); g.lineWidth = 1;
      var y = T(shY, bot, 0.36); g.beginPath(); g.moveTo(x - HW(r, 0.36), y); g.lineTo(x + HW(r, 0.36), y); g.stroke();
    } },
    { id: 'sailor', nm: 'セーラー風', price: 260, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      skirt(g, x, shY, bot, r, 0.54, col, 1.46, 0.34);
      pleat(g, x, T(shY, bot, 0.54), bot + r * 0.34, HW(r, 0.54), r * 1.46, 6, dark(col, 0.25), 1);
      /* 大きな襟 */
      g.fillStyle = col;
      g.beginPath(); g.moveTo(x - r * 0.74, shY); g.lineTo(x + r * 0.74, shY);
      g.lineTo(x + r * 0.66, T(shY, bot, 0.30)); g.lineTo(x - r * 0.66, T(shY, bot, 0.30)); g.closePath(); g.fill();
      g.strokeStyle = WH; g.lineWidth = 1;
      g.beginPath(); g.moveTo(x - r * 0.70, T(shY, bot, 0.20)); g.lineTo(x + r * 0.70, T(shY, bot, 0.20)); g.stroke();
      g.beginPath(); g.moveTo(x - r * 0.68, T(shY, bot, 0.26)); g.lineTo(x + r * 0.68, T(shY, bot, 0.26)); g.stroke();
      /* 胸のスカーフ */
      g.fillStyle = RD;
      g.beginPath(); g.moveTo(x, T(shY, bot, 0.14)); g.lineTo(x + r * 0.18, T(shY, bot, 0.42));
      g.lineTo(x - r * 0.18, T(shY, bot, 0.42)); g.closePath(); g.fill();
    } },
    { id: 'blouse', nm: 'ブラウス', price: 120, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.74));
      rcollar(g, x, shY, r, WH);
      buttons(g, x, shY, bot, r, dark(col, 0.4), 4, 0.28, 0.92);
      frill(g, x, bot, r * 1.16, r * 0.13, lite(col, 0.86), 6);
    } },
    { id: 'sundress', nm: 'サンドレス', price: 150, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.30));
      skirt(g, x, shY, bot, r, 0.42, lite(col, 0.30), 1.55, 0.56);
      panel(g, x, shY, bot, r, 0, 0.12, WH);
      straps(g, x, shY, bot, r, WH, r * 0.10);
      g.fillStyle = WH;
      for (var i = 0; i < 5; i++) {
        g.beginPath(); g.arc(x + (i - 2) * r * 0.46, T(shY, bot, 0.62 + (i % 2) * 0.22), r * 0.09, 0, 7); g.fill();
      }
    } },
    { id: 'camisole', nm: 'キャミソール', price: 100, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.52));
      panel(g, x, shY, bot, r, 0, 0.10, lite(col, 0.80));
      straps(g, x, shY, bot, r, lite(col, 0.52), r * 0.09);
      frill(g, x, T(shY, bot, 0.12), HW(r, 0.12), r * 0.10, WH, 5);
    } },
    { id: 'knitdress', nm: 'ニットワンピ', price: 170, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.22));
      skirt(g, x, shY, bot, r, 0.60, lite(col, 0.22), 1.24, 0.62);
      rib(g, x, shY, bot, r, 0.05, 0.95, 8, dark(col, 0.20), 1);
      panel(g, x, shY, bot, r, 0, 0.08, dark(col, 0.15));
    } },
    { id: 'cardigan', nm: 'カーディガン', price: 190, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      openFront(g, x, shY, bot, r, lite(col, 0.20), WH);
      buttons(g, x, shY, bot, r, GD, 3, 0.24, 0.70);
      rib(g, x, shY, bot, r, 0.92, 0.99, 2, dark(col, 0.3), 1);
    } },
    { id: 'bolero', nm: 'ボレロ', price: 200, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      skirt(g, x, shY, bot, r, 0.40, WH, 1.44, 0.54);
      /* 短い上着だけ肩に乗る */
      g.fillStyle = col;
      g.beginPath(); g.moveTo(x - r * 0.74, shY); g.lineTo(x - r * 0.20, shY);
      g.lineTo(x - r * 0.40, T(shY, bot, 0.34)); g.lineTo(x - r * 0.90, T(shY, bot, 0.34)); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.74, shY); g.lineTo(x + r * 0.20, shY);
      g.lineTo(x + r * 0.40, T(shY, bot, 0.34)); g.lineTo(x + r * 0.90, T(shY, bot, 0.34)); g.closePath(); g.fill();
      bow(g, x, T(shY, bot, 0.44), r * 0.24, col);
    } },
    { id: 'tutu', nm: 'チュチュ', price: 260, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, dark(col, 0.15));
      /* 腰から下を薄い布にして、その上に横へ張り出す層を重ねる
         (張り出しだけ描くと、盆を持っているように見えてしまう) */
      var y = T(shY, bot, 0.54), f = lite(col, 0.70);
      g.fillStyle = lite(col, 0.42);
      g.beginPath(); g.moveTo(x - HW(r, 0.54), y); g.lineTo(x + HW(r, 0.54), y);
      g.lineTo(x + r * 1.30, bot + r * 0.24); g.lineTo(x - r * 1.30, bot + r * 0.24); g.closePath(); g.fill();
      g.fillStyle = f;
      g.beginPath(); g.ellipse(x, y, r * 1.52, r * 0.60, 0, 0, Math.PI); g.closePath(); g.fill();
      panel(g, x, shY, bot, r, 0.46, 0.54, PK);
      frill(g, x, T(shY, bot, 0.10), HW(r, 0.10), r * 0.11, f, 5);
    } },
    { id: 'yukata', nm: '浴衣風', price: 300, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.55));
      panel(g, x, shY, bot, r, 0.95, 1.16, lite(col, 0.55));   /* 裾を少し伸ばす */
      xcollar(g, x, shY, bot, r, WH);
      panel(g, x, shY, bot, r, 0.50, 0.66, dark(col, 0.45));   /* 帯 */
      g.strokeStyle = GD; g.lineWidth = 1;
      var y = T(shY, bot, 0.58); g.beginPath(); g.moveTo(x - HW(r, 0.58), y); g.lineTo(x + HW(r, 0.58), y); g.stroke();
      g.fillStyle = WH;
      for (var i = 0; i < 4; i++) { g.beginPath(); g.arc(x + (i % 2 ? 0.5 : -0.6) * r, T(shY, bot, 0.74 + i * 0.10), r * 0.08, 0, 7); g.fill(); }
    } },
    { id: 'hakama', nm: '袴風', price: 330, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.62));
      xcollar(g, x, shY, bot, r, WH);
      /* 下は幅広の袴 */
      skirt(g, x, shY, bot, r, 0.44, dark(col, 0.42), 1.34, 0.70);
      pleat(g, x, T(shY, bot, 0.46), bot + r * 0.70, HW(r, 0.46), r * 1.34, 5, dark(col, 0.62), 1);
      g.strokeStyle = WH; g.lineWidth = r * 0.10;
      g.beginPath(); g.moveTo(x - HW(r, 0.44), T(shY, bot, 0.44)); g.lineTo(x + HW(r, 0.44), T(shY, bot, 0.44)); g.stroke();
    } },
    { id: 'cheer', nm: 'チア風', price: 280, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      skirt(g, x, shY, bot, r, 0.56, col, 1.50, 0.26);
      pleat(g, x, T(shY, bot, 0.56), bot + r * 0.26, HW(r, 0.56), r * 1.50, 7, WH, 1.2);
      g.fillStyle = WH;
      g.beginPath(); g.moveTo(x - r * 0.74, shY); g.lineTo(x - r * 0.40, shY);
      g.lineTo(x, T(shY, bot, 0.34)); g.lineTo(x + r * 0.40, shY); g.lineTo(x + r * 0.74, shY);
      g.lineTo(x, T(shY, bot, 0.50)); g.closePath(); g.fill();
      panel(g, x, shY, bot, r, 0.52, 0.58, WH);
    } },
    { id: 'apron', nm: 'エプロン', price: 130, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      g.fillStyle = lite(col, 0.88);
      g.beginPath(); g.moveTo(x - r * 0.32, T(shY, bot, 0.14)); g.lineTo(x + r * 0.32, T(shY, bot, 0.14));
      g.lineTo(x + r * 0.78, bot); g.lineTo(x - r * 0.78, bot); g.closePath(); g.fill();
      g.strokeStyle = lite(col, 0.88); g.lineWidth = r * 0.09;
      g.beginPath(); g.moveTo(x - r * 0.30, T(shY, bot, 0.14)); g.lineTo(x - r * 0.52, shY); g.stroke();
      g.beginPath(); g.moveTo(x + r * 0.30, T(shY, bot, 0.14)); g.lineTo(x + r * 0.52, shY); g.stroke();
      pocket(g, x, T(shY, bot, 0.62), r * 0.44, r * 0.30, dark(col, 0.10));
    } },
    { id: 'lolita', nm: 'ロリータ風', price: 400, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, dark(col, 0.55));
      skirt(g, x, shY, bot, r, 0.48, dark(col, 0.55), 1.48, 0.48);
      frill(g, x, T(shY, bot, 0.74), r * 1.24, r * 0.17, WH, 6);
      frill(g, x, bot + r * 0.46, r * 1.48, r * 0.19, WH, 8);
      frill(g, x, T(shY, bot, 0.12), HW(r, 0.12), r * 0.12, WH, 5);
      /* 胸の紐編み */
      g.strokeStyle = WH; g.lineWidth = 1;
      for (var i = 0; i < 3; i++) {
        var y0 = T(shY, bot, 0.20 + i * 0.09), y1 = T(shY, bot, 0.29 + i * 0.09);
        g.beginPath(); g.moveTo(x - r * 0.22, y0); g.lineTo(x + r * 0.22, y1); g.stroke();
        g.beginPath(); g.moveTo(x + r * 0.22, y0); g.lineTo(x - r * 0.22, y1); g.stroke();
      }
      bow(g, x, T(shY, bot, 0.50), r * 0.30, PK);
    } },
    { id: 'nurse', nm: 'ナース風', price: 210, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      skirt(g, x, shY, bot, r, 0.62, WH, 1.30, 0.34);
      vneck(g, x, shY, r, lite(col, 0.30), 0.70);
      g.fillStyle = dark(col, 0.22);
      g.beginPath(); g.moveTo(x - r * 0.74, shY); g.lineTo(x - r * 0.42, shY); g.lineTo(x - r * 0.20, T(shY, bot, 0.26)); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.74, shY); g.lineTo(x + r * 0.42, shY); g.lineTo(x + r * 0.20, T(shY, bot, 0.26)); g.closePath(); g.fill();
      pocket(g, x + r * 0.60, T(shY, bot, 0.56), r * 0.36, r * 0.26, lite(col, 0.55));
      panel(g, x, shY, bot, r, 0.58, 0.64, lite(col, 0.35));
    } },
    { id: 'waitress', nm: 'ウェイトレス風', price: 250, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, dark(col, 0.50));
      skirt(g, x, shY, bot, r, 0.54, dark(col, 0.50), 1.44, 0.40);
      rcollar(g, x, shY, r, WH);
      /* 腰の小さな白エプロン */
      g.fillStyle = WH;
      g.beginPath(); g.moveTo(x - r * 0.62, T(shY, bot, 0.58)); g.lineTo(x + r * 0.62, T(shY, bot, 0.58));
      g.lineTo(x + r * 0.78, bot + r * 0.30); g.lineTo(x - r * 0.78, bot + r * 0.30); g.closePath(); g.fill();
      panel(g, x, shY, bot, r, 0.54, 0.60, WH);
      bow(g, x - r * 0.70, T(shY, bot, 0.58), r * 0.22, WH);
    } },
    { id: 'pinafore', nm: 'ジャンパースカート', price: 220, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      skirt(g, x, shY, bot, r, 0.40, dark(col, 0.25), 1.48, 0.50);
      g.fillStyle = dark(col, 0.25);
      g.beginPath(); g.moveTo(x - r * 0.40, T(shY, bot, 0.16)); g.lineTo(x + r * 0.40, T(shY, bot, 0.16));
      g.lineTo(x + HW(r, 0.44), T(shY, bot, 0.44)); g.lineTo(x - HW(r, 0.44), T(shY, bot, 0.44)); g.closePath(); g.fill();
      straps(g, x, shY, bot, r, dark(col, 0.25), r * 0.14);
      buttons(g, x - r * 0.30, shY, bot, r, GD, 1, 0.18, 0.18);
      buttons(g, x + r * 0.30, shY, bot, r, GD, 1, 0.18, 0.18);
    } },
    { id: 'tiered', nm: '三段スカート', price: 230, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.35));
      var y0 = T(shY, bot, 0.40);
      var cs = [lite(col, 0.35), lite(col, 0.18), col];
      for (var i = 0; i < 3; i++) {
        var ya = y0 + (bot + r * 0.52 - y0) * (i / 3), yb = y0 + (bot + r * 0.52 - y0) * ((i + 1) / 3);
        var wa = r * (0.90 + i * 0.26), wb = r * (0.90 + (i + 1) * 0.26);
        g.fillStyle = cs[i];
        g.beginPath(); g.moveTo(x - wa, ya); g.lineTo(x + wa, ya); g.lineTo(x + wb, yb); g.lineTo(x - wb, yb); g.closePath(); g.fill();
      }
      panel(g, x, shY, bot, r, 0.36, 0.42, WH);
    } },
    { id: 'wrap', nm: 'カシュクール', price: 200, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      skirt(g, x, shY, bot, r, 0.56, col, 1.34, 0.48);
      /* 斜めの合わせ */
      g.fillStyle = lite(col, 0.28);
      g.beginPath(); g.moveTo(x - r * 0.74, shY); g.lineTo(x + r * 0.30, shY);
      g.lineTo(x + HW(r, 0.56), T(shY, bot, 0.56)); g.lineTo(x - HW(r, 0.56), T(shY, bot, 0.56)); g.closePath(); g.fill();
      g.strokeStyle = dark(col, 0.35); g.lineWidth = 1.2;
      g.beginPath(); g.moveTo(x + r * 0.30, shY); g.lineTo(x - r * 0.30, T(shY, bot, 0.56)); g.stroke();
      bow(g, x + r * 0.50, T(shY, bot, 0.54), r * 0.20, dark(col, 0.35));
    } },
    { id: 'peplum', nm: 'ペプラム', price: 240, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      panel(g, x, shY, bot, r, 0.46, 0.54, BK);
      /* 腰のひらひら */
      g.fillStyle = lite(col, 0.35);
      g.beginPath(); g.moveTo(x - HW(r, 0.54), T(shY, bot, 0.54)); g.lineTo(x + HW(r, 0.54), T(shY, bot, 0.54));
      g.lineTo(x + r * 1.46, T(shY, bot, 0.82)); g.lineTo(x - r * 1.46, T(shY, bot, 0.82)); g.closePath(); g.fill();
      frill(g, x, T(shY, bot, 0.82), r * 1.46, r * 0.14, lite(col, 0.55), 7);
      vneck(g, x, shY, r, lite(col, 0.60), 0.58);
    } },
    { id: 'hoodiedress', nm: 'パーカーワンピ', price: 190, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.20));
      skirt(g, x, shY, bot, r, 0.66, lite(col, 0.20), 1.32, 0.66);
      hood(g, x, shY, r, dark(col, 0.10));
      g.strokeStyle = WH; g.lineWidth = 1.4;
      g.beginPath(); g.moveTo(x - r * 0.16, T(shY, bot, 0.18)); g.lineTo(x - r * 0.20, T(shY, bot, 0.42)); g.stroke();
      g.beginPath(); g.moveTo(x + r * 0.16, T(shY, bot, 0.18)); g.lineTo(x + r * 0.20, T(shY, bot, 0.42)); g.stroke();
      pocket(g, x, T(shY, bot, 0.68), r * 0.90, r * 0.28, dark(col, 0.14));
    } },
    { id: 'blazer_f', nm: 'ブレザー', price: 290, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      skirt(g, x, shY, bot, r, 0.58, dark(col, 0.40), 1.46, 0.32);
      pleat(g, x, T(shY, bot, 0.58), bot + r * 0.32, HW(r, 0.58), r * 1.46, 6, dark(col, 0.60), 1);
      g.fillStyle = dark(col, 0.55);
      g.beginPath(); g.moveTo(x - r * 0.74, shY); g.lineTo(x - r * 0.22, shY);
      g.lineTo(x - r * 0.34, T(shY, bot, 0.60)); g.lineTo(x - HW(r, 0.60), T(shY, bot, 0.60)); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.74, shY); g.lineTo(x + r * 0.22, shY);
      g.lineTo(x + r * 0.34, T(shY, bot, 0.60)); g.lineTo(x + HW(r, 0.60), T(shY, bot, 0.60)); g.closePath(); g.fill();
      bow(g, x, T(shY, bot, 0.24), r * 0.26, RD);
    } },
    { id: 'vestskirt', nm: 'ベストとスカート', price: 210, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      skirt(g, x, shY, bot, r, 0.60, dark(col, 0.30), 1.36, 0.40);
      g.fillStyle = col;
      g.beginPath(); g.moveTo(x - r * 0.70, shY); g.lineTo(x - r * 0.26, shY); g.lineTo(x, T(shY, bot, 0.34));
      g.lineTo(x + r * 0.26, shY); g.lineTo(x + r * 0.70, shY);
      g.lineTo(x + HW(r, 0.60), T(shY, bot, 0.60)); g.lineTo(x - HW(r, 0.60), T(shY, bot, 0.60)); g.closePath(); g.fill();
      buttons(g, x, shY, bot, r, GD, 2, 0.42, 0.54);
      panel(g, x, shY, bot, r, 0.58, 0.64, BK);
    } },
    { id: 'miko', nm: '巫女風', price: 310, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      skirt(g, x, shY, bot, r, 0.42, RD, 1.36, 0.72);
      xcollar(g, x, shY, bot, r, CR);
      g.strokeStyle = WH; g.lineWidth = r * 0.11;
      g.beginPath(); g.moveTo(x - HW(r, 0.42), T(shY, bot, 0.42)); g.lineTo(x + HW(r, 0.42), T(shY, bot, 0.42)); g.stroke();
      pleat(g, x, T(shY, bot, 0.46), bot + r * 0.70, HW(r, 0.46), r * 1.36, 4, '#a33429', 1);
    } },
    { id: 'gothic', nm: 'ゴシック風', price: 380, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, dark(col, 0.78));
      skirt(g, x, shY, bot, r, 0.44, dark(col, 0.78), 1.48, 0.62);
      frill(g, x, T(shY, bot, 0.06), HW(r, 0.06), r * 0.13, CR, 5);
      frill(g, x, bot + r * 0.60, r * 1.48, r * 0.16, CR, 8);
      /* 前で締める紐 */
      g.strokeStyle = CR; g.lineWidth = 1;
      for (var i = 0; i < 4; i++) {
        var y0 = T(shY, bot, 0.16 + i * 0.08), y1 = T(shY, bot, 0.24 + i * 0.08);
        g.beginPath(); g.moveTo(x - r * 0.24, y0); g.lineTo(x + r * 0.24, y1); g.stroke();
        g.beginPath(); g.moveTo(x + r * 0.24, y0); g.lineTo(x - r * 0.24, y1); g.stroke();
      }
      panel(g, x, shY, bot, r, 0.46, 0.52, '#6b2f46');
    } },
    { id: 'leotard', nm: 'レオタード', price: 230, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, dark(col, 0.10));
      /* 脚の付け根が高い形(切り抜くと下着に見えるので、線で示すだけ) */
      g.strokeStyle = lite(col, 0.55); g.lineWidth = Math.max(1, r * 0.09);
      g.beginPath(); g.arc(x - r * 1.04, bot + r * 0.14, r * 0.58, Math.PI * 1.5, Math.PI * 2); g.stroke();
      g.beginPath(); g.arc(x + r * 1.04, bot + r * 0.14, r * 0.58, Math.PI, Math.PI * 1.5); g.stroke();
      panel(g, x, shY, bot, r, 0.44, 0.50, WH);
      vneck(g, x, shY, r, lite(col, 0.42), 0.52);
    } },
    { id: 'poncho', nm: 'ポンチョ', price: 200, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, dark(col, 0.30));
      /* 三角に広がる1枚布 */
      g.fillStyle = col;
      g.beginPath(); g.moveTo(x - r * 0.50, shY - r * 0.04); g.lineTo(x + r * 0.50, shY - r * 0.04);
      g.lineTo(x + r * 1.56, T(shY, bot, 0.88)); g.lineTo(x - r * 1.56, T(shY, bot, 0.88)); g.closePath(); g.fill();
      g.strokeStyle = lite(col, 0.55); g.lineWidth = 1;
      g.beginPath(); g.moveTo(x - r * 1.40, T(shY, bot, 0.70)); g.lineTo(x + r * 1.40, T(shY, bot, 0.70)); g.stroke();
      /* 房 */
      g.strokeStyle = lite(col, 0.70); g.lineWidth = 1.2;
      for (var i = 0; i < 7; i++) {
        var px = x - r * 1.44 + i * r * 0.48;
        g.beginPath(); g.moveTo(px, T(shY, bot, 0.88)); g.lineTo(px, T(shY, bot, 0.98)); g.stroke();
      }
    } },
    { id: 'highwaist', nm: 'ハイウエスト', price: 160, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.72));
      skirt(g, x, shY, bot, r, 0.30, col, 1.44, 0.56);
      panel(g, x, shY, bot, r, 0.28, 0.36, dark(col, 0.40));
      buttons(g, x, shY, bot, r, GD, 2, 0.30, 0.34);
      rcollar(g, x, shY, r, lite(col, 0.88));
    } },
    { id: 'kappougi', nm: '割烹着風', price: 170, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      g.fillStyle = lite(col, 0.90);
      g.beginPath(); g.moveTo(x - r * 0.64, shY + r * 0.10); g.lineTo(x + r * 0.64, shY + r * 0.10);
      g.lineTo(x + r * 1.06, bot + r * 0.20); g.lineTo(x - r * 1.06, bot + r * 0.20); g.closePath(); g.fill();
      g.strokeStyle = lite(col, 0.60); g.lineWidth = r * 0.10;
      g.beginPath(); g.moveTo(x - r * 1.00, T(shY, bot, 0.60)); g.lineTo(x + r * 1.00, T(shY, bot, 0.60)); g.stroke();
      bow(g, x, T(shY, bot, 0.60), r * 0.22, lite(col, 0.40));
    } },
    { id: 'cape', nm: 'ケープドレス', price: 300, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.40));
      skirt(g, x, shY, bot, r, 0.48, lite(col, 0.40), 1.48, 0.62);
      /* 肩に丸いケープ */
      g.fillStyle = dark(col, 0.30);
      g.beginPath(); g.ellipse(x, shY + r * 0.02, r * 1.00, r * 0.70, 0, 0, Math.PI); g.closePath(); g.fill();
      g.fillStyle = GD;
      g.beginPath(); g.arc(x, shY + r * 0.06, r * 0.13, 0, 7); g.fill();
      frill(g, x, bot + r * 0.58, r * 1.48, r * 0.15, WH, 7);
    } },
    { id: 'whitedress', nm: '白いドレス', price: 400, tone: 'cute', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.86));
      /* 長く引きずる裾 */
      g.fillStyle = lite(col, 0.86);
      g.beginPath(); g.moveTo(x - HW(r, 0.40), T(shY, bot, 0.40)); g.lineTo(x + HW(r, 0.40), T(shY, bot, 0.40));
      g.lineTo(x + r * 1.68, bot + r * 0.86); g.lineTo(x - r * 1.68, bot + r * 0.86); g.closePath(); g.fill();
      frill(g, x, T(shY, bot, 0.10), HW(r, 0.10), r * 0.12, WH, 5);
      panel(g, x, shY, bot, r, 0.38, 0.44, lite(col, 0.55));
      g.strokeStyle = lite(col, 0.60); g.lineWidth = 1;
      g.beginPath(); g.moveTo(x - r * 1.60, bot + r * 0.70); g.lineTo(x + r * 1.60, bot + r * 0.70); g.stroke();
    } },

    /* ---- 男性向け・中性的(15種) ---- */
    { id: 'hoodie', nm: 'パーカー', price: 140, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      hood(g, x, shY, r, dark(col, 0.18));
      g.strokeStyle = WH; g.lineWidth = 1.4;
      g.beginPath(); g.moveTo(x - r * 0.14, T(shY, bot, 0.20)); g.lineTo(x - r * 0.18, T(shY, bot, 0.46)); g.stroke();
      g.beginPath(); g.moveTo(x + r * 0.14, T(shY, bot, 0.20)); g.lineTo(x + r * 0.18, T(shY, bot, 0.46)); g.stroke();
      pocket(g, x, T(shY, bot, 0.62), r * 1.00, r * 0.30, dark(col, 0.14));
    } },
    { id: 'workwear', nm: '作業着', price: 160, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, dark(col, 0.20));
      g.strokeStyle = dark(col, 0.50); g.lineWidth = 1.2;
      g.beginPath(); g.moveTo(x, shY); g.lineTo(x, bot); g.stroke();
      pocket(g, x - r * 0.46, T(shY, bot, 0.22), r * 0.40, r * 0.26, dark(col, 0.38));
      pocket(g, x + r * 0.46, T(shY, bot, 0.22), r * 0.40, r * 0.26, dark(col, 0.38));
      panel(g, x, shY, bot, r, 0.56, 0.64, dark(col, 0.45));
      g.fillStyle = GD; g.fillRect(x - r * 0.10, T(shY, bot, 0.57), r * 0.20, r * 0.11);
    } },
    { id: 'suit', nm: 'スーツ', price: 340, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      var d = dark(col, 0.68);
      g.fillStyle = d;
      g.beginPath(); g.moveTo(x - r * 0.74, shY); g.lineTo(x - r * 0.16, shY);
      g.lineTo(x - r * 0.34, bot); g.lineTo(x - r * 1.16, bot); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.74, shY); g.lineTo(x + r * 0.16, shY);
      g.lineTo(x + r * 0.34, bot); g.lineTo(x + r * 1.16, bot); g.closePath(); g.fill();
      /* 襟 */
      g.fillStyle = dark(col, 0.50);
      g.beginPath(); g.moveTo(x - r * 0.58, shY); g.lineTo(x - r * 0.16, shY); g.lineTo(x - r * 0.26, T(shY, bot, 0.40)); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.58, shY); g.lineTo(x + r * 0.16, shY); g.lineTo(x + r * 0.26, T(shY, bot, 0.40)); g.closePath(); g.fill();
      /* ネクタイ */
      g.fillStyle = RD;
      g.beginPath(); g.moveTo(x, shY + r * 0.04); g.lineTo(x + r * 0.11, T(shY, bot, 0.50));
      g.lineTo(x, T(shY, bot, 0.58)); g.lineTo(x - r * 0.11, T(shY, bot, 0.50)); g.closePath(); g.fill();
      buttons(g, x - r * 0.30, shY, bot, r, BK, 2, 0.58, 0.74);
    } },
    { id: 'sports', nm: 'スポーツユニフォーム', price: 180, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      g.fillStyle = WH;
      g.fillRect(x - r * 0.74, shY, r * 0.18, (bot - shY) * 0.30);
      g.fillRect(x + r * 0.56, shY, r * 0.18, (bot - shY) * 0.30);
      vneck(g, x, shY, r, WH, 0.50);
      g.fillStyle = WH;
      g.beginPath(); g.arc(x, T(shY, bot, 0.48), r * 0.28, 0, 7); g.fill();
      g.fillStyle = col;
      g.fillRect(x - r * 0.06, T(shY, bot, 0.36), r * 0.12, r * 0.36);
      panel(g, x, shY, bot, r, 0.82, 0.90, WH);
    } },
    { id: 'overall', nm: 'オーバーオール', price: 200, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.66));
      g.fillStyle = DN;
      g.beginPath(); g.moveTo(x - r * 0.44, T(shY, bot, 0.24)); g.lineTo(x + r * 0.44, T(shY, bot, 0.24));
      g.lineTo(x + r * 1.16, bot); g.lineTo(x - r * 1.16, bot); g.closePath(); g.fill();
      g.strokeStyle = DN; g.lineWidth = r * 0.16;
      g.beginPath(); g.moveTo(x - r * 0.58, shY); g.lineTo(x - r * 0.36, T(shY, bot, 0.26)); g.stroke();
      g.beginPath(); g.moveTo(x + r * 0.58, shY); g.lineTo(x + r * 0.36, T(shY, bot, 0.26)); g.stroke();
      g.fillStyle = GD;
      g.beginPath(); g.arc(x - r * 0.40, T(shY, bot, 0.26), r * 0.08, 0, 7); g.fill();
      g.beginPath(); g.arc(x + r * 0.40, T(shY, bot, 0.26), r * 0.08, 0, 7); g.fill();
      pocket(g, x, T(shY, bot, 0.42), r * 0.46, r * 0.30, '#3d5d82');
    } },
    { id: 'jacket', nm: 'ジャケット', price: 250, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      openFront(g, x, shY, bot, r, dark(col, 0.42), lite(col, 0.70));
      g.fillStyle = dark(col, 0.60);
      g.beginPath(); g.moveTo(x - r * 0.62, shY); g.lineTo(x - r * 0.14, shY); g.lineTo(x - r * 0.30, T(shY, bot, 0.44)); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.62, shY); g.lineTo(x + r * 0.14, shY); g.lineTo(x + r * 0.30, T(shY, bot, 0.44)); g.closePath(); g.fill();
      pocket(g, x - r * 0.66, T(shY, bot, 0.62), r * 0.34, r * 0.10, dark(col, 0.62));
      pocket(g, x + r * 0.66, T(shY, bot, 0.62), r * 0.34, r * 0.10, dark(col, 0.62));
    } },
    { id: 'tshirt', nm: 'Tシャツ', price: 60, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.10));
      g.strokeStyle = lite(col, 0.55); g.lineWidth = r * 0.10;
      g.beginPath(); g.arc(x, shY - r * 0.10, r * 0.32, 0.2, Math.PI - 0.2); g.stroke();
      g.strokeStyle = dark(col, 0.20); g.lineWidth = 1;
      g.beginPath(); g.moveTo(x - r * 1.10, T(shY, bot, 0.92)); g.lineTo(x + r * 1.10, T(shY, bot, 0.92)); g.stroke();
    } },
    { id: 'jersey', nm: 'ジャージ', price: 150, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, dark(col, 0.25));
      g.fillStyle = WH;
      g.beginPath(); g.moveTo(x - r * 0.70, shY); g.lineTo(x - r * 0.56, shY); g.lineTo(x - r * 0.96, bot); g.lineTo(x - r * 1.12, bot); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.70, shY); g.lineTo(x + r * 0.56, shY); g.lineTo(x + r * 0.96, bot); g.lineTo(x + r * 1.12, bot); g.closePath(); g.fill();
      g.strokeStyle = SV; g.lineWidth = 1.2;
      g.beginPath(); g.moveTo(x, shY); g.lineTo(x, T(shY, bot, 0.90)); g.stroke();
      panel(g, x, shY, bot, r, 0, 0.08, dark(col, 0.50));
    } },
    { id: 'tanktop', nm: 'タンクトップ', price: 90, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, lite(col, 0.14));
      g.fillStyle = dark(col, 0.45);
      g.beginPath(); g.moveTo(x - r * 0.78, shY - r * 0.04); g.lineTo(x - r * 0.34, shY - r * 0.04);
      g.lineTo(x - r * 0.72, T(shY, bot, 0.42)); g.lineTo(x - r * 0.98, T(shY, bot, 0.42)); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.78, shY - r * 0.04); g.lineTo(x + r * 0.34, shY - r * 0.04);
      g.lineTo(x + r * 0.72, T(shY, bot, 0.42)); g.lineTo(x + r * 0.98, T(shY, bot, 0.42)); g.closePath(); g.fill();
      g.strokeStyle = WH; g.lineWidth = 1.2;
      g.beginPath(); g.moveTo(x - r * 0.34, shY); g.lineTo(x + r * 0.34, shY); g.stroke();
    } },
    { id: 'shirttie', nm: 'ワイシャツ', price: 190, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      g.fillStyle = CR;
      g.beginPath(); g.moveTo(x - r * 0.52, shY - r * 0.02); g.lineTo(x - r * 0.10, shY); g.lineTo(x - r * 0.22, T(shY, bot, 0.24)); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.52, shY - r * 0.02); g.lineTo(x + r * 0.10, shY); g.lineTo(x + r * 0.22, T(shY, bot, 0.24)); g.closePath(); g.fill();
      g.fillStyle = dark(col, 0.30);
      g.beginPath(); g.moveTo(x, shY + r * 0.02); g.lineTo(x + r * 0.12, T(shY, bot, 0.56));
      g.lineTo(x, T(shY, bot, 0.64)); g.lineTo(x - r * 0.12, T(shY, bot, 0.56)); g.closePath(); g.fill();
      buttons(g, x, shY, bot, r, '#cdc8bb', 3, 0.70, 0.94);
    } },
    { id: 'labcoat', nm: '白衣', price: 240, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, col);
      g.fillStyle = WH;
      g.beginPath(); g.moveTo(x - r * 0.74, shY); g.lineTo(x - r * 0.20, shY);
      g.lineTo(x - r * 0.24, bot + r * 0.34); g.lineTo(x - r * 1.24, bot + r * 0.34); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.74, shY); g.lineTo(x + r * 0.20, shY);
      g.lineTo(x + r * 0.24, bot + r * 0.34); g.lineTo(x + r * 1.24, bot + r * 0.34); g.closePath(); g.fill();
      pocket(g, x - r * 0.72, T(shY, bot, 0.64), r * 0.38, r * 0.28, '#e2ddd0');
      pocket(g, x + r * 0.72, T(shY, bot, 0.64), r * 0.38, r * 0.28, '#e2ddd0');
      pocket(g, x - r * 0.48, T(shY, bot, 0.20), r * 0.30, r * 0.20, '#e2ddd0');
    } },
    { id: 'denim', nm: 'デニムジャケット', price: 260, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      openFront(g, x, shY, bot, r, DN, lite(col, 0.40));
      g.strokeStyle = '#d9c9a2'; g.lineWidth = 1;
      g.beginPath(); g.moveTo(x - r * 1.02, T(shY, bot, 0.30)); g.lineTo(x - r * 0.28, T(shY, bot, 0.30)); g.stroke();
      g.beginPath(); g.moveTo(x + r * 1.02, T(shY, bot, 0.30)); g.lineTo(x + r * 0.28, T(shY, bot, 0.30)); g.stroke();
      g.fillStyle = '#d9c9a2';
      g.beginPath(); g.arc(x - r * 0.56, T(shY, bot, 0.40), r * 0.07, 0, 7); g.fill();
      g.beginPath(); g.arc(x + r * 0.56, T(shY, bot, 0.40), r * 0.07, 0, 7); g.fill();
      panel(g, x, shY, bot, r, 0.92, 1.00, '#3b5c80');
    } },
    { id: 'downvest', nm: 'ダウンベスト', price: 220, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, BK);
      g.fillStyle = col;
      g.beginPath(); g.moveTo(x - r * 0.70, shY); g.lineTo(x - r * 0.20, shY);
      g.lineTo(x - r * 0.24, bot); g.lineTo(x - r * 1.16, bot); g.closePath(); g.fill();
      g.beginPath(); g.moveTo(x + r * 0.70, shY); g.lineTo(x + r * 0.20, shY);
      g.lineTo(x + r * 0.24, bot); g.lineTo(x + r * 1.16, bot); g.closePath(); g.fill();
      rib(g, x, shY, bot, r, 0.18, 0.92, 4, dark(col, 0.35), 1.2);
      g.strokeStyle = SV; g.lineWidth = 1.2;
      g.beginPath(); g.moveTo(x, shY); g.lineTo(x, bot); g.stroke();
    } },
    { id: 'dogi', nm: '道着', price: 230, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, CR);
      xcollar(g, x, shY, bot, r, lite(col, 0.30));
      panel(g, x, shY, bot, r, 0.54, 0.66, BK);
      g.strokeStyle = BK; g.lineWidth = r * 0.08;
      g.beginPath(); g.moveTo(x - r * 0.10, T(shY, bot, 0.66)); g.lineTo(x - r * 0.16, T(shY, bot, 0.86)); g.stroke();
      g.beginPath(); g.moveTo(x + r * 0.10, T(shY, bot, 0.66)); g.lineTo(x + r * 0.16, T(shY, bot, 0.86)); g.stroke();
    } },
    { id: 'chef', nm: 'コックコート', price: 250, tone: 'neutral', draw: function (g, x, shY, bot, r, col) {
      base(g, x, shY, bot, r, WH);
      g.fillStyle = CR;
      g.beginPath(); g.moveTo(x - r * 0.40, shY); g.lineTo(x + r * 0.40, shY);
      g.lineTo(x + r * 0.30, T(shY, bot, 0.18)); g.lineTo(x - r * 0.30, T(shY, bot, 0.18)); g.closePath(); g.fill();
      buttons(g, x - r * 0.30, shY, bot, r, '#cdc8bb', 3, 0.28, 0.72);
      buttons(g, x + r * 0.30, shY, bot, r, '#cdc8bb', 3, 0.28, 0.72);
      /* 首元のスカーフ(白い服に埋もれないよう濃いめ) */
      g.fillStyle = dark(col, 0.30);
      g.beginPath(); g.moveTo(x - r * 0.34, shY - r * 0.04); g.lineTo(x + r * 0.34, shY - r * 0.04);
      g.lineTo(x, T(shY, bot, 0.16)); g.closePath(); g.fill();
      panel(g, x, shY, bot, r, 0.76, 0.84, '#5a5a60');
    } }
  ];

  /* ================= 帽子・頭装備 21種 ================= */
  /* 頭のてっぺんを隠すお椀。y をずらして髪ごと覆う */
  function dome(g, x, y, rx, ry, col) {
    g.fillStyle = col;
    g.beginPath(); g.ellipse(x, y, rx, ry, 0, Math.PI, Math.PI * 2); g.closePath(); g.fill();
  }
  /* つば(横に長い楕円) */
  function brim(g, x, y, rx, ry, col) {
    g.fillStyle = col;
    g.beginPath(); g.ellipse(x, y, rx, ry, 0, 0, 7); g.fill();
  }
  /* 前に突き出すつば */
  function peak(g, x, y, r, dir, col, len) {
    g.fillStyle = col;
    g.beginPath(); g.ellipse(x + dir * r * (len || 0.62), y, r * (len || 0.62), r * 0.18, 0, 0, 7); g.fill();
  }

  /* どの帽子も、眉の少し上(yHead-0.34r あたり)を縁にして、
     そこから上を丸ごと覆う。こうすると顔が隠れず、髪型が何であっても
     てっぺんが出てこない(アフロの膨らみまで入るよう上は 1.3r まで取る)。 */
  var HATS = [
    { id: 'none', nm: 'なし', price: 0, draw: function () { } },

    { id: 'cap', nm: 'キャップ', price: 90, draw: function (g, x, yHead, r, dir) {
      peak(g, x + dir * r * 0.10, yHead - r * 0.46, r, dir, '#2f4f7a', 0.62);
      dome(g, x, yHead - r * 0.34, r * 1.24, r * 1.04, '#3f6fa8');
      g.fillStyle = '#2f4f7a';
      g.fillRect(x - r * 1.24, yHead - r * 0.50, r * 2.48, r * 0.16);
      g.fillStyle = WH;
      g.beginPath(); g.arc(x, yHead - r * 1.18, r * 0.10, 0, 7); g.fill();
    } },
    { id: 'knit', nm: 'ニット帽', price: 100, draw: function (g, x, yHead, r) {
      dome(g, x, yHead - r * 0.30, r * 1.26, r * 1.12, '#7a5aa0');
      g.fillStyle = '#6a4b8e';
      g.fillRect(x - r * 1.26, yHead - r * 0.52, r * 2.52, r * 0.26);
      g.strokeStyle = '#8d6cb5'; g.lineWidth = 1;
      for (var i = -2; i <= 2; i++) {
        /* 編み目の縦線。お椀の縁からはみ出さないよう端ほど短くする */
        g.beginPath(); g.moveTo(x + i * r * 0.42, yHead - r * 0.52);
        g.lineTo(x + i * r * 0.46, yHead - r * (1.28 - Math.abs(i) * 0.18)); g.stroke();
      }
      g.fillStyle = CR;
      g.beginPath(); g.arc(x, yHead - r * 1.56, r * 0.26, 0, 7); g.fill();
    } },
    { id: 'straw', nm: '麦わら帽子', price: 140, draw: function (g, x, yHead, r) {
      brim(g, x, yHead - r * 0.48, r * 1.48, r * 0.30, '#e3c67c');
      dome(g, x, yHead - r * 0.50, r * 1.00, r * 0.92, '#d9b96a');
      g.fillStyle = RD;
      g.fillRect(x - r * 1.00, yHead - r * 0.74, r * 2.00, r * 0.18);
      g.strokeStyle = '#c0a055'; g.lineWidth = 1;
      g.beginPath(); g.ellipse(x, yHead - r * 0.48, r * 1.26, r * 0.24, 0, 0, 7); g.stroke();
    } },
    { id: 'hat', nm: 'ハット', price: 170, draw: function (g, x, yHead, r) {
      brim(g, x, yHead - r * 0.54, r * 1.40, r * 0.26, '#4a4038');
      dome(g, x, yHead - r * 0.52, r * 0.96, r * 1.14, '#5a4e44');
      g.fillStyle = '#3b332d';
      g.fillRect(x - r * 0.96, yHead - r * 0.78, r * 1.92, r * 0.22);
      g.strokeStyle = '#41382f'; g.lineWidth = 1.4;
      g.beginPath(); g.moveTo(x - r * 0.28, yHead - r * 1.60); g.lineTo(x + r * 0.28, yHead - r * 1.60); g.stroke();
    } },
    { id: 'beret', nm: 'ベレー帽', price: 110, draw: function (g, x, yHead, r, dir) {
      dome(g, x, yHead - r * 0.40, r * 1.18, r * 0.88, '#c4443a');
      g.fillStyle = '#c4443a';
      g.beginPath(); g.ellipse(x - dir * r * 0.10, yHead - r * 0.92, r * 1.20, r * 0.56, -dir * 0.18, 0, 7); g.fill();
      g.fillStyle = '#a3362e';
      g.beginPath(); g.arc(x + dir * r * 0.60, yHead - r * 1.28, r * 0.14, 0, 7); g.fill();
    } },
    { id: 'ribbon', nm: 'リボン帽', price: 130, draw: function (g, x, yHead, r, dir) {
      dome(g, x, yHead - r * 0.32, r * 1.24, r * 1.04, PK);
      g.fillStyle = '#d1769a';
      g.fillRect(x - r * 1.24, yHead - r * 0.46, r * 2.48, r * 0.14);
      bow(g, x + dir * r * 1.06, yHead - r * 0.64, r * 0.40, '#f4b3c6');
    } },
    { id: 'catear', nm: '猫耳風', price: 160, draw: function (g, x, yHead, r) {
      dome(g, x, yHead - r * 0.34, r * 1.24, r * 1.04, '#3b3640');
      var ear = function (sx) {
        g.fillStyle = '#3b3640';
        g.beginPath(); g.moveTo(x + sx * r * 0.28, yHead - r * 1.06);
        g.lineTo(x + sx * r * 0.64, yHead - r * 1.96); g.lineTo(x + sx * r * 0.96, yHead - r * 0.96); g.closePath(); g.fill();
        g.fillStyle = PK;
        g.beginPath(); g.moveTo(x + sx * r * 0.46, yHead - r * 1.10);
        g.lineTo(x + sx * r * 0.64, yHead - r * 1.62); g.lineTo(x + sx * r * 0.80, yHead - r * 1.04); g.closePath(); g.fill();
      };
      ear(-1); ear(1);
    } },
    { id: 'crown', nm: '王冠風', price: 220, draw: function (g, x, yHead, r) {
      dome(g, x, yHead - r * 0.46, r * 1.16, r * 0.90, '#c99a34');
      g.fillStyle = GD;
      g.beginPath();
      g.moveTo(x - r * 1.04, yHead - r * 1.10);
      for (var i = 0; i < 3; i++) {
        var x0 = x - r * 1.04 + i * r * 0.693;
        g.lineTo(x0 + r * 0.346, yHead - r * 1.98);
        g.lineTo(x0 + r * 0.693, yHead - r * 1.10);
      }
      g.lineTo(x + r * 1.04, yHead - r * 0.64); g.lineTo(x - r * 1.04, yHead - r * 0.64);
      g.closePath(); g.fill();
      g.fillStyle = RD;
      g.beginPath(); g.arc(x, yHead - r * 0.86, r * 0.14, 0, 7); g.fill();
      g.fillStyle = '#5fa8c4';
      g.beginPath(); g.arc(x - r * 0.60, yHead - r * 0.84, r * 0.09, 0, 7); g.fill();
      g.beginPath(); g.arc(x + r * 0.60, yHead - r * 0.84, r * 0.09, 0, 7); g.fill();
    } },
    { id: 'helmet', nm: 'ヘルメット', price: 150, draw: function (g, x, yHead, r) {
      dome(g, x, yHead - r * 0.40, r * 1.28, r * 1.10, '#e0b24a');
      brim(g, x, yHead - r * 0.44, r * 1.40, r * 0.16, '#c9982f');
      g.fillStyle = '#c9982f';
      g.fillRect(x - r * 0.10, yHead - r * 1.48, r * 0.20, r * 1.04);
      g.strokeStyle = '#8d7327'; g.lineWidth = 1;
      g.beginPath(); g.ellipse(x, yHead - r * 0.48, r * 1.24, r * 0.30, 0, Math.PI, Math.PI * 2); g.stroke();
    } },
    { id: 'bucket', nm: 'バケットハット', price: 120, draw: function (g, x, yHead, r) {
      dome(g, x, yHead - r * 0.40, r * 1.18, r * 1.04, '#8a8256');
      g.fillStyle = '#77704a';
      g.beginPath();
      g.moveTo(x - r * 1.18, yHead - r * 0.44); g.lineTo(x + r * 1.18, yHead - r * 0.44);
      g.lineTo(x + r * 1.42, yHead - r * 0.06); g.lineTo(x - r * 1.42, yHead - r * 0.06);
      g.closePath(); g.fill();
      g.strokeStyle = '#5f5a3a'; g.lineWidth = 1;
      g.beginPath(); g.moveTo(x - r * 1.00, yHead - r * 0.66); g.lineTo(x + r * 1.00, yHead - r * 0.66); g.stroke();
    } },
    { id: 'cowboy', nm: 'つば広帽', price: 190, draw: function (g, x, yHead, r) {
      g.fillStyle = '#7a5a3c';
      g.beginPath();
      g.moveTo(x - r * 1.52, yHead - r * 0.54);
      g.quadraticCurveTo(x, yHead - r * 0.22, x + r * 1.52, yHead - r * 0.54);
      g.quadraticCurveTo(x, yHead - r * 0.86, x - r * 1.52, yHead - r * 0.54);
      g.closePath(); g.fill();
      dome(g, x, yHead - r * 0.56, r * 0.94, r * 1.14, '#8f6b47');
      g.fillStyle = '#5d4630';
      g.fillRect(x - r * 0.94, yHead - r * 0.84, r * 1.88, r * 0.22);
      g.strokeStyle = '#6d5136'; g.lineWidth = 1.4;
      g.beginPath(); g.moveTo(x, yHead - r * 1.70); g.lineTo(x, yHead - r * 1.30); g.stroke();
    } },
    { id: 'witch', nm: 'とんがり帽子', price: 200, draw: function (g, x, yHead, r, dir) {
      brim(g, x, yHead - r * 0.52, r * 1.50, r * 0.28, '#3a3450');
      g.fillStyle = '#4a4368';
      g.beginPath(); g.moveTo(x - r * 0.90, yHead - r * 0.56);
      g.lineTo(x + r * 0.90, yHead - r * 0.56);
      g.lineTo(x + dir * r * 0.34, yHead - r * 2.16); g.closePath(); g.fill();
      g.fillStyle = GD;
      g.fillRect(x - r * 0.84, yHead - r * 0.80, r * 1.68, r * 0.20);
      g.beginPath(); g.arc(x + dir * r * 0.34, yHead - r * 2.10, r * 0.10, 0, 7); g.fill();
    } },
    { id: 'nightcap', nm: 'ナイトキャップ', price: 100, draw: function (g, x, yHead, r, dir) {
      dome(g, x, yHead - r * 0.32, r * 1.24, r * 1.06, '#cfd6e2');
      /* てっぺんから後ろへ垂れる先っぽ */
      g.fillStyle = '#cfd6e2';
      g.beginPath();
      g.moveTo(x - dir * r * 0.10, yHead - r * 1.36);
      g.quadraticCurveTo(x - dir * r * 1.10, yHead - r * 1.52, x - dir * r * 1.34, yHead - r * 0.94);
      g.quadraticCurveTo(x - dir * r * 0.90, yHead - r * 1.02, x - dir * r * 0.66, yHead - r * 1.14);
      g.closePath(); g.fill();
      g.fillStyle = WH;
      g.beginPath(); g.arc(x - dir * r * 1.34, yHead - r * 0.92, r * 0.22, 0, 7); g.fill();
      g.fillStyle = '#b6bfd0';
      g.fillRect(x - r * 1.24, yHead - r * 0.48, r * 2.48, r * 0.16);
    } },
    { id: 'hachimaki', nm: 'はちまき', price: 70, draw: function (g, x, yHead, r, dir) {
      dome(g, x, yHead - r * 0.36, r * 1.22, r * 1.02, '#e8e3d6');
      g.fillStyle = WH;
      g.fillRect(x - r * 1.24, yHead - r * 0.58, r * 2.48, r * 0.26);
      g.fillStyle = RD;
      g.beginPath(); g.arc(x + dir * r * 0.30, yHead - r * 0.45, r * 0.13, 0, 7); g.fill();
      g.strokeStyle = WH; g.lineWidth = r * 0.12;
      g.beginPath(); g.moveTo(x - dir * r * 1.08, yHead - r * 0.50);
      g.lineTo(x - dir * r * 1.46, yHead - r * 0.02); g.stroke();
    } },
    { id: 'bandana', nm: 'バンダナ', price: 80, draw: function (g, x, yHead, r, dir) {
      dome(g, x, yHead - r * 0.34, r * 1.24, r * 1.04, '#c4443a');
      g.fillStyle = WH;
      for (var i = -2; i <= 2; i++) {
        g.beginPath(); g.arc(x + i * r * 0.42, yHead - r * (0.72 + (i % 2 ? 0.22 : 0)), r * 0.08, 0, 7); g.fill();
      }
      g.fillStyle = '#a3362e';
      g.beginPath(); g.moveTo(x - dir * r * 1.00, yHead - r * 0.52);
      g.lineTo(x - dir * r * 1.50, yHead - r * 0.18); g.lineTo(x - dir * r * 1.00, yHead - r * 0.10);
      g.closePath(); g.fill();
    } },
    { id: 'mobcap', nm: 'ふんわり帽', price: 140, draw: function (g, x, yHead, r) {
      dome(g, x, yHead - r * 0.26, r * 1.22, r * 1.16, WH);
      frill(g, x, yHead - r * 0.34, r * 1.24, r * 0.19, CR, 6);
      dome(g, x, yHead - r * 0.44, r * 1.14, r * 0.98, WH);
      g.fillStyle = PK;
      g.beginPath(); g.arc(x, yHead - r * 1.26, r * 0.12, 0, 7); g.fill();
    } },
    { id: 'usagi', nm: 'うさ耳風', price: 170, draw: function (g, x, yHead, r) {
      dome(g, x, yHead - r * 0.34, r * 1.24, r * 1.02, '#f0ece2');
      var ear = function (sx) {
        g.fillStyle = '#f0ece2';
        g.beginPath(); g.ellipse(x + sx * r * 0.48, yHead - r * 1.42, r * 0.32, r * 0.72, sx * 0.16, 0, 7); g.fill();
        g.strokeStyle = '#d6cfbe'; g.lineWidth = 1;
        g.beginPath(); g.ellipse(x + sx * r * 0.48, yHead - r * 1.42, r * 0.32, r * 0.72, sx * 0.16, 0, 7); g.stroke();
        g.fillStyle = PK;
        g.beginPath(); g.ellipse(x + sx * r * 0.48, yHead - r * 1.44, r * 0.13, r * 0.42, sx * 0.16, 0, 7); g.fill();
      };
      ear(-1); ear(1);
    } },
    { id: 'casquette', nm: 'ハンチング', price: 120, draw: function (g, x, yHead, r, dir) {
      peak(g, x + dir * r * 0.40, yHead - r * 0.44, r, dir, '#6a6350', 0.50);
      g.fillStyle = '#7d7560';
      g.beginPath(); g.ellipse(x - dir * r * 0.08, yHead - r * 0.56, r * 1.12, r * 0.80, -dir * 0.10, Math.PI, Math.PI * 2); g.closePath(); g.fill();
      g.fillRect(x - r * 1.04, yHead - r * 0.60, r * 2.08, r * 0.24);
      g.strokeStyle = '#5e5849'; g.lineWidth = 1;
      g.beginPath(); g.moveTo(x - r * 0.58, yHead - r * 1.24); g.lineTo(x + r * 0.68, yHead - r * 0.86); g.stroke();
    } },
    { id: 'chefhat', nm: 'コック帽', price: 130, draw: function (g, x, yHead, r) {
      g.fillStyle = WH;
      g.fillRect(x - r * 1.00, yHead - r * 1.20, r * 2.00, r * 0.86);
      g.beginPath(); g.ellipse(x, yHead - r * 1.52, r * 1.12, r * 0.60, 0, 0, 7); g.fill();
      g.beginPath(); g.ellipse(x - r * 0.54, yHead - r * 1.72, r * 0.50, r * 0.44, 0, 0, 7); g.fill();
      g.beginPath(); g.ellipse(x + r * 0.54, yHead - r * 1.72, r * 0.50, r * 0.44, 0, 0, 7); g.fill();
      g.fillStyle = '#dcd6c6';
      g.fillRect(x - r * 1.00, yHead - r * 0.60, r * 2.00, r * 0.26);
    } },
    { id: 'hood', nm: 'フード', price: 110, draw: function (g, x, yHead, r, dir) {
      g.fillStyle = '#4f5a68';
      g.beginPath(); g.ellipse(x - dir * r * 0.10, yHead - r * 0.06, r * 1.32, r * 1.34, 0, Math.PI, Math.PI * 2); g.closePath(); g.fill();
      g.fillStyle = '#5d6a7a';
      g.beginPath(); g.ellipse(x + dir * r * 0.14, yHead - r * 0.34, r * 1.02, r * 1.06, 0, Math.PI, Math.PI * 2); g.closePath(); g.fill();
      g.fillStyle = '#3f4854';
      g.beginPath(); g.ellipse(x - dir * r * 0.78, yHead - r * 0.34, r * 0.40, r * 0.60, 0, 0, 7); g.fill();
    } }
  ];

  /* ================= 石の見た目 10種 ================= */
  /* でこぼこの多角形(今の石と同じ作り) */
  function chunk(g, r, n, lo, hi, col) {
    g.fillStyle = col;
    g.beginPath();
    for (var i = 0; i < n; i++) {
      var a = i / n * Math.PI * 2, rr = r * (lo + ((i * 5) % 3) * hi);
      if (i === 0) g.moveTo(Math.cos(a) * rr, Math.sin(a) * rr); else g.lineTo(Math.cos(a) * rr, Math.sin(a) * rr);
    }
    g.closePath(); g.fill();
  }
  /* 左上の照り返し */
  function gloss(g, r, col, sz) {
    g.fillStyle = col;
    g.beginPath(); g.arc(-r * 0.28, -r * 0.30, r * (sz || 0.34), 0, 7); g.fill();
  }

  var STONES = [
    /* 今の石そのまま(本編の drawStoneAt と同じ形・同じ色) */
    { id: 'plain', nm: 'ふつうの石', price: 0, draw: function (g, r) {
      chunk(g, r, 7, 0.82, 0.13, '#8d8e86');
      gloss(g, r, 'rgba(255,255,240,.30)');
    } },
    { id: 'blue', nm: '青い石', price: 30, draw: function (g, r) {
      chunk(g, r, 7, 0.82, 0.13, '#5f7f9e');
      gloss(g, r, 'rgba(230,245,255,.40)');
    } },
    { id: 'heart', nm: 'ハートの石', price: 120, draw: function (g, r) {
      g.fillStyle = '#d4607e';
      g.beginPath();
      g.moveTo(0, r * 1.05);
      g.bezierCurveTo(-r * 1.30, r * 0.10, -r * 0.62, -r * 1.10, 0, -r * 0.34);
      g.bezierCurveTo(r * 0.62, -r * 1.10, r * 1.30, r * 0.10, 0, r * 1.05);
      g.closePath(); g.fill();
      gloss(g, r, 'rgba(255,255,255,.35)', 0.24);
    } },
    { id: 'shiny', nm: '光る石', price: 150, draw: function (g, r) {
      g.fillStyle = 'rgba(255,240,170,.28)';
      g.beginPath(); g.arc(0, 0, r * 1.28, 0, 7); g.fill();
      chunk(g, r, 7, 0.80, 0.14, '#c8b465');
      gloss(g, r, 'rgba(255,255,220,.70)', 0.30);
      g.strokeStyle = 'rgba(255,250,200,.85)'; g.lineWidth = Math.max(0.6, r * 0.10);
      g.beginPath(); g.moveTo(-r * 0.9, -r * 0.9); g.lineTo(-r * 0.5, -r * 0.5); g.stroke();
    } },
    { id: 'round', nm: 'つるつるの丸石', price: 60, draw: function (g, r) {
      g.fillStyle = '#9a958c';
      g.beginPath(); g.arc(0, 0, r * 1.00, 0, 7); g.fill();
      gloss(g, r, 'rgba(255,255,250,.45)', 0.32);
    } },
    { id: 'angular', nm: '角張った石', price: 70, draw: function (g, r) {
      g.fillStyle = '#79776f';
      g.beginPath();
      g.moveTo(-r * 1.10, -r * 0.30); g.lineTo(-r * 0.20, -r * 1.10); g.lineTo(r * 1.05, -r * 0.45);
      g.lineTo(r * 0.70, r * 0.95); g.lineTo(-r * 0.60, r * 1.05);
      g.closePath(); g.fill();
      g.fillStyle = 'rgba(255,255,240,.22)';
      g.beginPath(); g.moveTo(-r * 0.20, -r * 1.05); g.lineTo(r * 0.95, -r * 0.42); g.lineTo(r * 0.10, -r * 0.10); g.closePath(); g.fill();
    } },
    { id: 'striped', nm: '模様入りの石', price: 90, draw: function (g, r) {
      chunk(g, r, 7, 0.82, 0.13, '#8a7f6d');
      g.save();
      g.beginPath(); g.arc(0, 0, r * 0.98, 0, 7); g.clip();
      g.strokeStyle = '#e6ddc6'; g.lineWidth = Math.max(0.8, r * 0.20);
      for (var i = -1; i <= 1; i++) {
        g.beginPath(); g.moveTo(-r * 1.2, i * r * 0.62 - r * 0.20); g.lineTo(r * 1.2, i * r * 0.62 + r * 0.20); g.stroke();
      }
      g.restore();
    } },
    { id: 'brick', nm: 'レンガのかけら', price: 80, draw: function (g, r) {
      g.fillStyle = '#a85b46';
      g.beginPath(); g.moveTo(-r * 1.15, -r * 0.72); g.lineTo(r * 1.10, -r * 0.80);
      g.lineTo(r * 1.15, r * 0.78); g.lineTo(-r * 1.05, r * 0.72); g.closePath(); g.fill();
      g.fillStyle = 'rgba(255,240,230,.30)';
      g.fillRect(-r * 1.05, -r * 0.70, r * 2.05, r * 0.26);
      g.fillStyle = 'rgba(60,30,20,.25)';
      g.fillRect(-r * 1.00, r * 0.34, r * 2.00, r * 0.30);
    } },
    { id: 'gold', nm: '金の石', price: 150, draw: function (g, r) {
      chunk(g, r, 8, 0.80, 0.15, '#d3a33c');
      g.fillStyle = 'rgba(255,245,190,.55)';
      g.beginPath(); g.moveTo(-r * 0.70, -r * 0.70); g.lineTo(r * 0.20, -r * 0.90);
      g.lineTo(-r * 0.10, -r * 0.05); g.closePath(); g.fill();
      gloss(g, r, 'rgba(255,255,225,.50)', 0.22);
    } },
    { id: 'star', nm: '星の石', price: 140, draw: function (g, r) {
      g.fillStyle = '#e6c84f';
      g.beginPath();
      for (var i = 0; i < 10; i++) {
        var a = -Math.PI / 2 + i * Math.PI / 5, rr = r * (i % 2 ? 0.50 : 1.22);
        if (i === 0) g.moveTo(Math.cos(a) * rr, Math.sin(a) * rr); else g.lineTo(Math.cos(a) * rr, Math.sin(a) * rr);
      }
      g.closePath(); g.fill();
      gloss(g, r, 'rgba(255,255,220,.40)', 0.22);
    } }
  ];

  window.WARDROBE = { COSTUMES: COSTUMES, HATS: HATS, STONES: STONES };
})();