/* ============================================================
   E-計算！ Math — 点の外周（凸包）と面積（convex-hull.html）だけで使う見た目
   色はすべて共通のトークン（--accent, --ink, --muted, --grid, --page, --surface ほか）
   ============================================================ */

/* ---- 座標の入力欄（1行に1点） ---- */
.ch-pts, .ch-out {
  display: block; width: 100%; min-width: 0; padding: 10px 12px; resize: vertical;
  white-space: pre; overflow-x: auto;
  font: 15px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, "BIZ UDGothic", monospace; font-variant-numeric: tabular-nums;
  color: var(--ink); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
}
.ch-pts { min-height: 12.5em; }
.ch-out { min-height: 7em; background: var(--page); font-size: 13.5px; }
.ch-pts:focus, .ch-out:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.ch-pts[aria-invalid="true"] { border: 2px solid var(--s2); }
@media (max-width: 600px) { .ch-pts { font-size: 16px; } }   /* iOS で入力時に拡大されないように */
.ch-unit select { max-width: 14em; }

/* ---- 結果 ---- */
/* 結果の数字の欄の高さを先に確保する（点を足したときに、下の図が動かないように） */
#result { min-height: 272px; display: flow-root; }
@media (max-width: 600px) { #result { min-height: 300px; } }
#result .res-mini .v, #result .res-mini .s { overflow-wrap: anywhere; }
#result .res-hero .big .ch-long { font-size: clamp(22px, 6vw, 32px); overflow-wrap: anywhere; word-break: break-all; }
#resultPanel [hidden] { display: none !important; }   /* エラーや空のときに、表・コピー用の一覧などの空の枠を残さない */
.ch-h3 { margin: 22px 0 4px; font-size: 15px; }
.ch-tbl { max-height: 320px; overflow: auto; }
.ch-tbl table.data td.k { color: var(--muted); font-size: 12.5px; white-space: nowrap; }
.ch-copy { margin-top: 14px; }
.ch-copy > label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.ch-btns { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 8px; font-size: 13px; }
.ch-btns .hint { color: var(--muted); font-size: 12.5px; }
.ch-list { margin: 6px 0 0; padding-left: 1.4em; max-height: 240px; overflow: auto; font-size: 13px; font-variant-numeric: tabular-nums; }
.ch-counts { margin: 10px 0 0; font-size: 13.5px; }

/* ---- 図（SVG）。y は上が大きい（数学の向き） ---- */
.ch-fig { margin: 18px 0 0; padding: 12px; border: 1px solid var(--grid); border-radius: var(--r); background: var(--surface); min-width: 0; }
.ch-fig figcaption { font-size: 14px; font-weight: 700; color: var(--ink); margin: 0 0 8px; line-height: 1.6; }
.ch-fig svg.ch-plot { display: block; width: 100%; height: auto; aspect-ratio: 640 / 420; background: var(--surface); -webkit-user-select: none; user-select: none; }
.ch-fig svg.ch-plot.editing { cursor: crosshair; touch-action: none; }
.ch-fig svg.ch-plot:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ch-fig .g-grid { stroke: var(--grid); stroke-width: 1; }
.ch-fig .g-zero { stroke: var(--line-strong); stroke-width: 1; }
.ch-fig .g-tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch-fig .g-ytick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.ch-fig .g-hull { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.ch-fig .g-seg { fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; }
.ch-fig .g-ref { fill: none; stroke: var(--muted); stroke-width: 1.3; stroke-dasharray: 5 4; }
.ch-fig .g-poly { fill: var(--accent-soft); stroke: var(--accent); stroke-width: 2.2; stroke-linejoin: round; }
.ch-fig .g-poly.bad { fill: none; }
.ch-fig .g-cross { fill: none; stroke: var(--s2); stroke-width: 4; stroke-linecap: round; stroke-dasharray: 7 5; }
.ch-fig .p-v { fill: var(--accent); stroke: var(--surface); stroke-width: 1.5; }
.ch-fig .p-e { fill: var(--surface); stroke: var(--accent); stroke-width: 2; }
.ch-fig .p-i { fill: var(--surface); stroke: var(--ink-2); stroke-width: 1.6; }
.ch-fig .d-v { fill: none; stroke: var(--accent); stroke-width: 6; stroke-linecap: round; }
.ch-fig .d-e { fill: none; stroke: var(--accent); stroke-width: 4; stroke-linecap: square; }
.ch-fig .d-i { fill: none; stroke: var(--ink-2); stroke-width: 2.6; stroke-linecap: round; }
.ch-fig .g-num { fill: var(--ink); font-size: 12px; font-weight: 700; paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round; }
.ch-fig .g-lead { stroke: var(--ink-2); stroke-width: 1; }   /* 近い頂点の数字を離して置いたときの引き出し線 */
.ch-fig .g-sel { fill: none; stroke: var(--s2); stroke-width: 2.5; }
.ch-fig .g-empty { fill: var(--muted); font-size: 14px; }
.ch-tools { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 10px; font-size: 13px; }
.ch-edit { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; color: var(--ink-2); }
.ch-edit input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; }
.ch-sel { margin: 6px 0 0; font-size: 12.5px; color: var(--ink-2); line-height: 1.7; min-height: 1.7em; }
.ch-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; padding: 0; margin: 8px 0 0; font-size: 12px; color: var(--ink-2); }
.ch-legend li { display: flex; align-items: center; gap: 6px; }
.ch-legend svg { width: 16px; height: 16px; flex: none; }
.ch-legend [hidden] { display: none; }
.ch-note { font-size: 11.5px; color: var(--ink-2); line-height: 1.8; padding-top: 10px; margin: 8px 0 0; border-top: 1px solid var(--grid); }

/* ---- 解説の早わかり ---- */
.ch-quick { margin: 0; padding-left: 1.3em; }
.ch-quick li + li { margin-top: 6px; }
