/* 数の発見ツール（倍数・約数さがし） - number-discovery.css
   修正: すべてのクラスに ndt- プレフィックスを付与。
   .left / .right / .common / .active / .grid / .card / .icon / .action / .tab / .panel /
   .small / .list / .color / .point / .add / .merge のような一般的な名前は、
   Cocoonテーマなど他のCSSと衝突し、うまく表示されない（ベン図が出ない等）原因になっていました。
   さらにベン図関連はレイアウトに直結する重要プロパティに !important を付与し、
   テーマ側のCSSに負けないようにしています。
   機能・見た目・操作の流れは元のバージョンから変更していません。 */

.ndt-root{--ink:#263238;--green:#176f61;--paper:#fff;--bg:#eef8f5;--line:#3c4b50}
.ndt-root,.ndt-root *{box-sizing:border-box;-webkit-tap-highlight-color:transparent}
.ndt-root{margin:0;min-height:100vh;font-family:"Yu Gothic",Meiryo,sans-serif;color:var(--ink);background:linear-gradient(145deg,#eaf7f2,#f7fbff 60%,#fff7d8)}
.ndt-root button{font:inherit;touch-action:manipulation}
.ndt-root{width:min(1500px,100%);margin:auto;padding:clamp(8px,1.5vw,20px);display:flex;flex-direction:column;gap:10px}
.ndt-root header{display:flex;align-items:center;justify-content:space-between;gap:10px}
.ndt-root h1{font-size:clamp(21px,2.7vw,36px);margin:0;color:#174c47}
.ndt-root .ndt-small{border:2px solid #bfd3ce;background:#fff;border-radius:13px;padding:7px 11px;font-weight:900;color:#3f5b56;cursor:pointer}
.ndt-root .ndt-tabs{display:flex;gap:7px;overflow-x:auto;padding-bottom:2px}
.ndt-root .ndt-tab{flex:1;min-width:112px;border:3px solid #bddbd3;background:#fff;color:#355b55;border-radius:15px;padding:9px 13px;font-weight:900;cursor:pointer;white-space:nowrap}
.ndt-root .ndt-tab.ndt-active{background:var(--green);border-color:var(--green);color:#fff}
.ndt-root .ndt-panel{display:none;min-height:0}
.ndt-root .ndt-panel.ndt-active{display:block}
.ndt-root .ndt-card{background:rgba(255,255,255,.96);border:3px solid #cce8df;border-radius:20px;box-shadow:0 7px 18px rgba(30,75,65,.09)}
.ndt-root .ndt-list{display:flex;flex-direction:column;gap:9px}
.ndt-root .ndt-carousel{display:flex;gap:14px;overflow-x:auto;scroll-snap-type:x mandatory;padding:4px 3px 14px}
.ndt-root .ndt-carousel .ndt-layer{flex:0 0 calc((100% - 14px)/2);min-width:0;scroll-snap-align:start}
.ndt-root .ndt-layer{padding:9px;border-color:var(--layer);transition:.18s}
.ndt-root .ndt-layer.ndt-selected{box-shadow:0 0 0 5px color-mix(in srgb,var(--layer) 48%,transparent),0 8px 20px rgba(0,0,0,.1)}
.ndt-root .ndt-layer-head{display:flex;align-items:center;gap:8px;margin-bottom:5px}
.ndt-root .ndt-pick{width:38px;height:38px;border:3px solid var(--layer);border-radius:50%;background:#fff;cursor:pointer;display:grid;place-items:center}
.ndt-root .ndt-selected .ndt-pick{background:var(--layer);color:#fff}
.ndt-root .ndt-color{width:24px;height:24px;border-radius:50%;background:var(--layer);box-shadow:inset 0 0 0 3px rgba(255,255,255,.55)}
.ndt-root .ndt-spacer{flex:1}
.ndt-root .ndt-icon{width:38px;height:38px;border:0;border-radius:11px;background:#edf3f2;font-weight:900;color:#455a5f;cursor:pointer}
.ndt-root .ndt-delete{color:#b33b3b}
.ndt-root .ndt-line-scroll{overflow-x:auto;padding:16px 6px 8px}
.ndt-root .ndt-number-line{position:relative;min-width:1050px;height:76px;display:grid;grid-template-columns:repeat(31,1fr);padding:0 8px;align-items:end}
.ndt-root .ndt-axis{position:absolute;left:2.1%;right:2.1%;bottom:22px;height:5px;background:var(--line);border-radius:4px}
.ndt-root .ndt-point{border:0;background:transparent;padding:0;z-index:1;display:flex;flex-direction:column;align-items:center;cursor:pointer}
.ndt-root .ndt-num{position:relative;min-width:40px;height:40px;display:grid;place-items:center;font-weight:900;font-size:clamp(20px,2.4vw,30px);color:var(--ink)}
.ndt-root .ndt-num::before{content:"";position:absolute;inset:-8px -10px;border-radius:50%;border:5px solid transparent;transition:border-color .12s,transform .12s}
.ndt-root .ndt-point.ndt-marked .ndt-num::before{border-color:var(--layer);transform:scale(1.05);animation:ndt-pop .18s}
.ndt-root .ndt-point.ndt-merged-marked .ndt-num::before{border-color:transparent;box-shadow:var(--merged-shadow);animation:ndt-pop .18s}
.ndt-root .ndt-tick{width:3px;height:22px;background:var(--line);margin-bottom:15px}
.ndt-root .ndt-grid{width:min(100%,560px);margin:auto;display:grid;grid-template-columns:repeat(10,1fr);gap:2px;padding:3px;background:#405055}
.ndt-root .ndt-cell{aspect-ratio:1;border:0;background:#fff;color:#34464b;font-size:clamp(12px,1.5vw,20px);font-weight:900;display:grid;place-items:center;cursor:pointer}
.ndt-root .ndt-cell.ndt-paint{background:var(--layer);color:#fff}
.ndt-root .ndt-cell:active{transform:scale(.88)}
.ndt-root .ndt-circle-wrap{width:min(88vw,520px);aspect-ratio:1;margin:auto;position:relative}
.ndt-root .ndt-circle-svg{width:100%;height:100%;display:block}
.ndt-root .ndt-ray{stroke:var(--layer);stroke-width:5;stroke-linecap:round;opacity:.78;animation:ndt-ray-draw .22s}
.ndt-root .ndt-ring{fill:#fff;stroke:#8ca19d;stroke-width:2}
.ndt-root .ndt-circle-num{cursor:pointer}
.ndt-root .ndt-circle-num circle{fill:#fff;stroke:#c8d5d2;stroke-width:1.5}
.ndt-root .ndt-circle-num text{font-size:13px;font-weight:900;text-anchor:middle;dominant-baseline:central;fill:#33474b}
.ndt-root .ndt-circle-num.ndt-paint circle{fill:var(--layer);stroke:var(--layer)}
.ndt-root .ndt-circle-num.ndt-paint text,.ndt-root .ndt-circle-num.ndt-merged-paint text{fill:#fff}
.ndt-root .ndt-circle-sector{stroke:none}
.ndt-root .ndt-toolbar{position:sticky;bottom:6px;display:flex;justify-content:center;flex-wrap:wrap;gap:8px;margin-top:9px;z-index:8}
.ndt-root .ndt-action{border:0;border-radius:15px;padding:11px 20px;font-size:clamp(16px,1.7vw,20px);font-weight:900;cursor:pointer;box-shadow:0 4px 0 rgba(0,0,0,.18)}
.ndt-root .ndt-add{background:#fff;color:#176f61;border:2px solid #86c5b7}
.ndt-root .ndt-merge{background:#ffd54f;color:#534100}
.ndt-root .ndt-clearall{background:#fff;color:#59676b;border:2px solid #c9d4d5}
.ndt-root .ndt-merge:disabled{filter:grayscale(1);opacity:.42;cursor:not-allowed}
.ndt-root .ndt-result{margin-top:10px;padding:10px;display:none}
.ndt-root .ndt-result.ndt-show{display:block;animation:ndt-open .35s}
.ndt-root .ndt-result-head{display:flex;justify-content:flex-end;gap:8px}
.ndt-root .ndt-result-filter{border:0;background:#e8eef7;color:var(--main);border-radius:10px;padding:8px 14px;font-weight:900;cursor:pointer}
.ndt-root .ndt-result-filter.ndt-active{background:var(--accent);color:var(--main-dark)}
.ndt-root .ndt-close-result{border:0;background:#e9efee;border-radius:10px;width:38px;height:38px;font-weight:900;cursor:pointer}
.ndt-root .ndt-merged-line{--layer:#666}
.ndt-root .ndt-merged-cell{background:var(--mix,#fff);color:var(--text,#34464b)}
.ndt-root .ndt-selected-table{width:min(100%,1100px);margin:auto;display:flex;flex-direction:column}
.ndt-root .ndt-selected-row{min-height:58px}
.ndt-root .ndt-selected-values{min-height:58px;padding:7px;display:flex;align-items:center;flex-wrap:wrap;gap:5px;border:3px solid var(--c);border-radius:12px;background:#fff}
.ndt-root .ndt-selected-table.ndt-joined .ndt-selected-row+.ndt-selected-row .ndt-selected-values{border-top:0}
.ndt-root .ndt-selected-table.ndt-joined .ndt-selected-row:not(:first-child):not(:last-child) .ndt-selected-values{border-radius:0}
.ndt-root .ndt-selected-table.ndt-joined .ndt-selected-row:first-child .ndt-selected-values{border-radius:12px 12px 0 0}
.ndt-root .ndt-selected-table.ndt-joined .ndt-selected-row:last-child .ndt-selected-values{border-radius:0 0 12px 12px}
.ndt-root .ndt-selected-number{min-width:42px;height:42px;padding:0 8px;border-radius:5px;background:color-mix(in srgb,var(--c) 13%,#fff);border:2px solid color-mix(in srgb,var(--c) 55%,#fff);display:grid;place-items:center;font-weight:900}
.ndt-root .ndt-selected-number.ndt-common-number{border-color:var(--accent);box-shadow:inset 0 0 0 2px var(--accent);background:#fff8cf}

/* ===== ベン図（表示不具合の修正箇所）: レイアウトに直結するプロパティは !important で保護 ===== */
.ndt-root .ndt-venn-single{width:min(90%,360px)!important;aspect-ratio:1!important;margin:auto!important;border:6px solid var(--layer)!important;border-radius:50%!important;background:color-mix(in srgb,var(--layer) 15%,#fff)!important;padding:14%!important;display:flex!important;align-content:center;justify-content:center;flex-wrap:wrap;gap:6px}
.ndt-root .ndt-venn-number{min-width:39px;height:39px;padding:0 7px;border-radius:999px;background:#fff;border:2px solid var(--c);display:grid;place-items:center;font-weight:900}
.ndt-root .ndt-venn-merge{position:relative!important;width:min(100%,900px,calc((100vh - 180px)*1.75))!important;aspect-ratio:1.75!important;margin:auto!important;overflow:hidden!important;display:block!important;float:none!important}
.ndt-root .ndt-venn-circle{position:absolute!important;top:3%!important;width:54%!important;aspect-ratio:1!important;border:6px solid var(--c)!important;border-radius:50%!important;background:color-mix(in srgb,var(--c) 17%,transparent)!important;float:none!important;display:block!important}
.ndt-root .ndt-venn-circle.ndt-left{left:8%!important;right:auto!important}
.ndt-root .ndt-venn-circle.ndt-right{right:8%!important;left:auto!important}
.ndt-root .ndt-venn-zone{position:absolute!important;top:24%!important;bottom:20%!important;display:flex!important;align-content:center;justify-content:center;flex-wrap:wrap;gap:6px;overflow:auto;padding:8px;float:none!important}
.ndt-root .ndt-venn-zone.ndt-left-only{left:10%!important;width:27%!important;right:auto!important}
.ndt-root .ndt-venn-zone.ndt-common{left:37%!important;width:26%!important;right:auto!important;z-index:3}
.ndt-root .ndt-venn-zone.ndt-right-only{right:10%!important;width:27%!important;left:auto!important}
.ndt-root .ndt-venn-zone .ndt-venn-number{background:rgba(255,255,255,.94)}
.ndt-root .ndt-venn-zone.ndt-common .ndt-venn-number{border-color:var(--accent);box-shadow:inset 0 0 0 2px var(--accent)}
/* ===== ここまで ===== */

.ndt-root .ndt-toolbar-limit-value{width:56px;height:42px;border-radius:999px;background:var(--main);color:var(--accent-light);display:grid;place-items:center;font-size:18px;font-weight:900;box-shadow:0 4px 14px rgba(0,0,0,.24)}
.ndt-root .ndt-limit-step{font-size:21px!important}

@keyframes ndt-pop{from{transform:scale(.2)}to{transform:scale(1)}}
@keyframes ndt-ray-draw{from{stroke-dasharray:0 300}to{stroke-dasharray:300 0}}
@keyframes ndt-open{from{opacity:0;transform:translateY(14px)}}
@keyframes ndt-drop{from{transform:translateY(-35px);opacity:0}}

@media(max-width:650px){
  .ndt-root{gap:7px}
  .ndt-root .ndt-card{border-radius:16px}
  .ndt-root .ndt-layer{padding:6px}
  .ndt-root .ndt-number-line{height:64px}
  .ndt-root .ndt-axis{bottom:18px}
  .ndt-root .ndt-num{min-width:32px;height:32px}
  .ndt-root .ndt-tick{height:18px;margin-bottom:12px}
  .ndt-root .ndt-grid{gap:1px;padding:2px}
  .ndt-root .ndt-cell{font-size:12px}
  .ndt-root .ndt-action{padding:9px 12px}
  .ndt-root .ndt-tab{padding:8px 9px}
}
@media(prefers-reduced-motion:reduce){
  .ndt-root,.ndt-root *{animation-duration:.01ms!important;transition-duration:.01ms!important}
}

/* 円を描こうアプリに合わせた共通UI（フルスクリーン・ダーク基調のツールバー等） */
.ndt-root{--main:#1e3a5f;--main-light:#2d5a8f;--main-dark:#0f1e3a;--accent:#d4af37;--accent-light:#f4cf5f}
.ndt-root{position:relative;z-index:999999;height:100vh!important;min-height:0;overflow:hidden!important;width:100%;padding:0;gap:0;background:#fdfefe}
.ndt-root header{height:66px;flex-shrink:0;padding:10px 20px;background:var(--main);color:#fff;box-shadow:0 2px 10px rgba(0,0,0,.18);z-index:20}
.ndt-root h1{flex-shrink:0;font-size:18px;color:#fff;letter-spacing:.02em}
.ndt-root .ndt-small{flex-shrink:0;width:42px;height:42px;padding:0;border:0;border-radius:999px;background:rgba(255,255,255,.14);color:#fff;font-size:20px}
.ndt-root .ndt-tabs{flex:1;justify-content:center;overflow-x:auto;gap:7px;padding:0;background:transparent}
.ndt-root .ndt-tab{flex:0 0 auto;min-width:112px;border:0;border-radius:999px;padding:8px 18px;background:rgba(255,255,255,.13);color:#fff;box-shadow:none}
.ndt-root .ndt-tab.ndt-active{background:var(--accent);color:var(--main-dark)}
.ndt-root .ndt-panel{height:calc(100vh - 66px)!important;overflow:auto!important;padding:18px 90px 24px 18px;position:relative}
.ndt-root .ndt-panel.ndt-active{display:block}
.ndt-root .ndt-card{border:0;border-radius:0;background:transparent;box-shadow:none}
.ndt-root .ndt-layer{border:0;border-top:4px solid var(--layer)}
.ndt-root .ndt-layer.ndt-selected{box-shadow:0 0 0 4px var(--accent),0 10px 28px rgba(0,0,0,.2)}
.ndt-root .ndt-pick{border:2px solid var(--layer)}
.ndt-root .ndt-selected .ndt-pick{box-shadow:0 0 0 3px color-mix(in srgb,var(--layer) 25%,transparent)}
.ndt-root .ndt-icon{background:#f1f5f9;color:var(--main)}
.ndt-root .ndt-icon:hover{background:#e2e8f0}
.ndt-root .ndt-grid,.ndt-root .ndt-circle-wrap{background:linear-gradient(135deg,#fff 0%,#fafafa 60%,#f5f5f5 100%)}
.ndt-root .ndt-grid{background:#d9e0e2}
.ndt-root .ndt-result{border-top:4px solid var(--accent)}
.ndt-root .ndt-toolbar{position:fixed!important;right:20px;bottom:20px;display:flex;flex-direction:column;flex-wrap:nowrap;gap:14px;margin:0;z-index:50}
.ndt-root .ndt-action,.ndt-root .ndt-toolbar .ndt-clearall{width:56px;height:56px;padding:0;border:0;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:25px;background:#fff;color:var(--main);box-shadow:0 4px 14px rgba(0,0,0,.24);transition:transform .15s,box-shadow .15s}
.ndt-root .ndt-action:hover,.ndt-root .ndt-toolbar .ndt-clearall:hover{transform:translateY(-2px);box-shadow:0 6px 18px rgba(0,0,0,.3)}
.ndt-root .ndt-action:active,.ndt-root .ndt-toolbar .ndt-clearall:active{transform:none}
.ndt-root .ndt-action.ndt-merge{background:var(--accent);color:var(--main-dark)}
.ndt-root .ndt-action.ndt-add{background:#fff;color:var(--main)}
.ndt-root .ndt-toolbar .ndt-clearall{background:#fff;color:#b43e3e}
.ndt-root .ndt-action.ndt-merge:disabled{opacity:.45}

/* ===== 全パネル共通：カードで囲まず、白背景に開放的に表示（参考画像に合わせる） ===== */
.ndt-root .ndt-list>.ndt-layer{border-bottom:1px solid #eef1f3;padding:10px 0 20px;margin-bottom:2px}
.ndt-root .ndt-list>.ndt-layer:last-child{border-bottom:0}
.ndt-root .ndt-carousel>.ndt-layer{padding:10px 0}
.ndt-root .ndt-result.ndt-card{border-top:2px solid #eef1f3;padding-top:16px}
/* ===== ここまで ===== */

@media(max-width:650px){
  .ndt-root header{height:58px;padding:8px 9px;gap:7px}
  .ndt-root h1{font-size:14px}
  .ndt-root .ndt-tabs{justify-content:flex-start}
  .ndt-root .ndt-tab{min-width:82px;padding:7px 9px;font-size:13px}
  .ndt-root .ndt-small{width:38px;height:38px}
  .ndt-root .ndt-panel{height:calc(100vh - 58px)!important;padding:10px 72px 18px 10px}
  .ndt-root .ndt-toolbar{right:12px;bottom:12px;gap:10px}
  .ndt-root .ndt-action,.ndt-root .ndt-toolbar .ndt-clearall{width:50px;height:50px;font-size:22px}
  .ndt-root .ndt-carousel{padding-left:3px;padding-right:3px}
}
