/* ================================================================
   角あつめメーカー (angle-sum-mover) v1.0.0
   多角形の内角の和を「切って・動かして・集める」で体感するツール
   配色：紺 #1e3a5f / 金 #d4af37 / 白ベース

   スコープ方針:
   ・全てのスタイルは .angle-sum-mover-root の中だけに閉じる
   ・html / body / * への全体リセットは行わない（テーマ干渉防止）
   ・タッチ操作の無効化（touch-action:none）は操作エリア（SVG部分）
     のみに限定し、ページ全体のスクロールを妨げないようにする
   ================================================================ */

.angle-sum-mover-root,
.angle-sum-mover-root *{
  box-sizing:border-box;
  -webkit-tap-highlight-color:transparent;
}
.angle-sum-mover-root :where(div,span,header,main,footer,button,input,p){
  margin:0;padding:0;
}

.angle-sum-mover-root{
  --asm-navy:#1e3a5f;
  --asm-navy-light:#2c4f7c;
  --asm-gold:#d4af37;
  --asm-gold-dark:#b8941f;
  --asm-bg:#f7f8fa;

  position:relative;
  display:flex;flex-direction:column;
  width:100%;max-width:1100px;
  height:min(700px, 82vh);
  margin:24px auto;
  border-radius:14px;
  overflow:hidden;
  box-shadow:0 2px 14px rgba(30,58,95,.18);
  background:var(--asm-bg);
  font-family:"BIZ UDGothic","M PLUS Rounded 1c","Hiragino Kaku Gothic ProN","Yu Gothic",sans-serif;
  line-height:1.4;
  user-select:none;-webkit-user-select:none;
}

/* ---------- 上部：タイトル & 切替 ---------- */
.angle-sum-mover-root .asm-header{
  background:var(--asm-navy);
  color:#fff;
  display:flex;align-items:center;justify-content:space-between;
  padding:8px 16px;
  gap:10px;flex-wrap:wrap;
  flex:0 0 auto;
}
.angle-sum-mover-root .asm-title{
  font-size:20px;font-weight:bold;letter-spacing:.06em;
  display:flex;align-items:center;gap:8px;white-space:nowrap;
}
.angle-sum-mover-root .asm-title::before{
  content:"";width:14px;height:14px;background:var(--asm-gold);
  clip-path:polygon(50% 0,100% 100%,0 100%);
  flex:0 0 auto;
}
.angle-sum-mover-root .asm-toggles{display:flex;gap:10px;flex-wrap:wrap;}
.angle-sum-mover-root .asm-modes{display:flex;background:rgba(255,255,255,.14);border-radius:999px;padding:3px;}
.angle-sum-mover-root .asm-mode-btn{
  border:none;background:transparent;color:#fff;
  font-family:inherit;font-size:15px;font-weight:bold;
  padding:8px 16px;border-radius:999px;cursor:pointer;white-space:nowrap;
  line-height:1.4;
}
.angle-sum-mover-root .asm-mode-btn.asm-active{background:var(--asm-gold);color:var(--asm-navy);}
/* 五角形以上ではモード切替・カットボタンを隠す（自動でならべるのみ） */
.angle-sum-mover-root .asm-hidden{display:none !important;}

/* ---------- 中央：操作エリア ---------- */
.angle-sum-mover-root .asm-stage{
  flex:1 1 auto;min-height:0;display:flex;padding:6px;
  /* 操作エリアだけタッチのスクロール／ズームを止める（ページ全体は止めない） */
  touch-action:none;
}
.angle-sum-mover-root .asm-stage svg{width:100%;height:100%;display:block;}

/* ---------- 下部：ボタン ---------- */
.angle-sum-mover-root .asm-footer{
  display:flex;flex-direction:column;gap:8px;
  padding:10px 12px 14px;
  background:#fff;border-top:2px solid var(--asm-navy);
  flex:0 0 auto;
}
/* 再生スライダー（シークバー）の行 */
.angle-sum-mover-root .asm-scrub-row{
  display:flex;align-items:center;gap:12px;
  padding:0 4px;
}
.angle-sum-mover-root .asm-scrub-label{
  font-size:14px;font-weight:bold;color:var(--asm-navy);
  white-space:nowrap;opacity:.75;
}
.angle-sum-mover-root .asm-scrub{
  flex:1;height:34px;
  -webkit-appearance:none;appearance:none;
  background:transparent;cursor:pointer;
}
.angle-sum-mover-root .asm-scrub:disabled{opacity:.35;cursor:default;}
.angle-sum-mover-root .asm-scrub::-webkit-slider-runnable-track{
  height:8px;border-radius:999px;
  background:linear-gradient(to right, var(--asm-navy) 0%, var(--asm-navy) var(--asm-scrub-pct,0%), #dfe4ea var(--asm-scrub-pct,0%), #dfe4ea 100%);
}
.angle-sum-mover-root .asm-scrub::-moz-range-track{
  height:8px;border-radius:999px;background:#dfe4ea;
}
.angle-sum-mover-root .asm-scrub::-moz-range-progress{
  height:8px;border-radius:999px;background:var(--asm-navy);
}
.angle-sum-mover-root .asm-scrub::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;
  width:30px;height:30px;border-radius:50%;
  background:var(--asm-gold);border:3px solid var(--asm-gold-dark);
  margin-top:-11px;
  box-shadow:0 1px 3px rgba(0,0,0,.3);
}
.angle-sum-mover-root .asm-scrub::-moz-range-thumb{
  width:30px;height:30px;border-radius:50%;border:3px solid var(--asm-gold-dark);
  background:var(--asm-gold);box-shadow:0 1px 3px rgba(0,0,0,.3);
}
.angle-sum-mover-root .asm-btn-row{
  display:flex;justify-content:center;gap:12px;flex-wrap:wrap;
}
.angle-sum-mover-root .asm-btn{
  font-family:inherit;font-size:17px;font-weight:bold;
  padding:12px 30px;border-radius:999px;cursor:pointer;
  border:2px solid var(--asm-navy);
  background:#fff;color:var(--asm-navy);
  min-width:130px;
  transition:transform .1s;
  line-height:1.4;
}
.angle-sum-mover-root .asm-btn:active{transform:scale(.96);}
.angle-sum-mover-root .asm-btn.asm-primary{background:var(--asm-navy);color:#fff;}
.angle-sum-mover-root .asm-btn.asm-gold{background:var(--asm-gold);border-color:var(--asm-gold-dark);color:var(--asm-navy);}
.angle-sum-mover-root .asm-btn:disabled{opacity:.35;cursor:default;transform:none;}

/* ---------- SVG内 ---------- */
.angle-sum-mover-root .asm-shape-body{fill:#eef2f7;stroke:var(--asm-navy);stroke-width:3;stroke-linejoin:round;}
/* カット後に残す元の図形の点線アウトライン */
.angle-sum-mover-root .asm-origin-outline{fill:none;stroke:var(--asm-navy);stroke-width:2;stroke-dasharray:7 6;opacity:.45;}
/* カット前に見せる切り取り予定の領域（うすい色分け＋白い切り線） */
.angle-sum-mover-root .asm-mark{opacity:.35;stroke:#fff;stroke-width:2;}
/* 各パーツの頂点に付ける角マーク（白い弧） */
.angle-sum-mover-root .asm-angle-arc{fill:none;stroke:#fff;stroke-width:3;opacity:.9;}
.angle-sum-mover-root .asm-guide-line{stroke:var(--asm-navy);stroke-width:4;stroke-linecap:round;}
.angle-sum-mover-root .asm-guide-line.asm-done{stroke:var(--asm-gold-dark);stroke-width:6;}
.angle-sum-mover-root .asm-apex{fill:var(--asm-gold);stroke:var(--asm-gold-dark);stroke-width:2;}
.angle-sum-mover-root .asm-ghost{fill-opacity:.10;stroke-width:2;stroke-dasharray:6 5;stroke-opacity:.55;}
.angle-sum-mover-root .asm-ghost.asm-near{fill-opacity:.30;stroke-opacity:1;stroke-width:3;}
.angle-sum-mover-root .asm-piece-path{stroke-width:2.5;cursor:grab;fill-opacity:.85;}
.angle-sum-mover-root .asm-piece.asm-placed .asm-piece-path{cursor:default;}
.angle-sum-mover-root .asm-knob{fill:#fff;stroke:var(--asm-navy);stroke-width:2.5;cursor:grab;}
.angle-sum-mover-root .asm-knob-line{stroke:var(--asm-navy);stroke-width:1.5;stroke-dasharray:3 3;opacity:.6;}
.angle-sum-mover-root .asm-result-text{
  font-family:inherit;font-weight:bold;fill:var(--asm-gold-dark);
  text-anchor:middle;
}
.angle-sum-mover-root .asm-done-badge{
  font-family:inherit;font-weight:bold;fill:#fff;text-anchor:middle;
}
.angle-sum-mover-root .asm-arc-done{fill:none;stroke:var(--asm-gold);stroke-width:6;stroke-linecap:round;}

/* ---------- レスポンシブ（タブレット・スマホ） ---------- */
@media (max-width: 640px){
  .angle-sum-mover-root{ height:min(620px, 88vh); margin:12px auto; border-radius:10px; }
  .angle-sum-mover-root .asm-title{ font-size:17px; }
  .angle-sum-mover-root .asm-mode-btn{ font-size:13px; padding:7px 12px; }
  .angle-sum-mover-root .asm-btn{ font-size:15px; padding:10px 20px; min-width:0; flex:1 1 auto; }
}
