*{box-sizing:border-box}
html,body{height:100%;margin:0;padding:0;overflow:hidden}
body{
  font:13px/1.5 "Meiryo UI","Yu Gothic UI","Hiragino Sans",'Segoe UI',system-ui,sans-serif;
  background:#ffffff;color:#1b1f27;
  -webkit-user-select:none;user-select:none;
}
#app{display:flex;flex-direction:column;height:100vh;height:100dvh;background:#ffffff}
.hide{display:none !important}

/* ---------- 共通パーツ ---------- */
.btn{
  display:inline-flex;align-items:center;gap:5px;height:28px;padding:0 10px;
  border:1px solid #ccd3e0;border-radius:6px;background:#ffffff;color:#1b1f27;
  font:inherit;font-size:12px;cursor:pointer;white-space:nowrap;
}
.btn:hover:not(:disabled){background:#eef3fb;border-color:#9fb2d4}
.btn:active:not(:disabled){background:#e2eaf8}
.btn:disabled{opacity:.4;cursor:default}
.btn.on,.btn.tog.on{background:#1f5fd0;border-color:#1f5fd0;color:#fff}
.btn.primary{background:#1f5fd0;border-color:#1f5fd0;color:#fff;font-weight:700}
.btn.primary:hover:not(:disabled){background:#1a54bb;border-color:#1a54bb}
.btn.danger{color:#c0392b;border-color:#e4b6b0}
.btn.tog{min-width:30px;justify-content:center;padding:0 7px}
.btn svg{width:15px;height:15px;flex:0 0 auto}
.sep{width:1px;height:20px;background:#dde3ee;margin:0 3px;flex:0 0 auto}
.lbl{font-size:11px;color:#5a6579;white-space:nowrap}
input[type=number],input[type=text],select{
  height:26px;border:1px solid #ccd3e0;border-radius:5px;background:#fff;color:#1b1f27;
  font:inherit;font-size:12px;padding:0 6px;
}
input[type=number]{width:62px;text-align:right;font-variant-numeric:tabular-nums}
input[type=text]{padding:0 8px}
select{padding:0 4px;cursor:pointer}
select:disabled{background:#f1f5f9;color:#94a3b8;cursor:not-allowed}
input,textarea,[contenteditable]{-webkit-user-select:text;user-select:text}
input:focus-visible,select:focus-visible,.btn:focus-visible,.tool:focus-visible{
  outline:2px solid #1f5fd0;outline-offset:1px
}
input[type=range]{width:96px;accent-color:#1f5fd0;cursor:pointer}
input[type=checkbox]{accent-color:#1f5fd0;cursor:pointer;width:14px;height:14px}
.num{font-variant-numeric:tabular-nums;font-size:11px;color:#5a6579;min-width:34px;text-align:right}
/* ゲージの左右に置く小さな送りボタン */
.spin{
  width:17px;height:22px;padding:0;flex:0 0 auto;
  border:1px solid #ccd3e0;border-radius:4px;background:#fff;color:#5a6579;
  font:inherit;font-size:9px;line-height:1;cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;touch-action:none;
}
.spin:hover{background:#eef3fb;border-color:#9fb2d4}
.spin:active{background:#dbe6f8}
kbd{
  font:600 11px/1 ui-monospace,Consolas,monospace;background:#fff;border:1px solid #c9d2e0;
  border-bottom-width:2px;border-radius:5px;padding:3px 5px;color:#39415a;
}
.grp{
  display:flex;flex-wrap:wrap;align-items:center;gap:5px;row-gap:5px;
  flex:0 1 auto;max-width:100%;
}
.grp.hide{display:none}
.ctl{display:flex;flex-wrap:nowrap;align-items:center;gap:5px;flex:0 0 auto}

/* ---------- ヘッダー ---------- */
#hdr{
  display:flex;flex-wrap:wrap;align-items:center;gap:5px;row-gap:6px;
  padding:6px 10px;flex:0 0 auto;
  border-bottom:1px solid #e2e6ee;background:#f7f9fc;
}
#hdr .btn{flex:0 0 auto}
#hdr select{flex:0 0 auto;height:28px}
#hdr .btn.zbtn{min-width:30px;padding:0 7px;justify-content:center}
#hdr .zlbl{margin-left:2px}
#hdr .hdr-right{margin-left:auto;flex:0 1 auto;gap:6px}
#hdr .bgname{
  display:inline-block;max-width:150px;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;
  font-size:12px;font-weight:600;color:#475569;margin:0 2px;
}
/* 用紙・出力のまとまり（SnapDraw の出力グループ） */
#hdr .outgrp{background:#eef1f6;border-radius:8px;padding:3px 6px;gap:4px;flex-wrap:nowrap}
#hdr .outgrp .sep{background:#cfd6e2}
#hdr .copybtn{background:#fef9c3;border-color:#fde047;color:#a16207}
#hdr .copybtn:hover:not(:disabled){background:#fef08a;border-color:#facc15}
#hdr .btn.primary{background:#16a34a;border-color:#16a34a}
#hdr .btn.primary:hover:not(:disabled){background:#15803d;border-color:#15803d}

/* 背景の角度調整（SnapDraw） */
.lw-ctrl{display:flex;align-items:center;gap:2px;background:#fff;border:1px solid #ccd3e0;border-radius:6px;padding:0 2px;height:28px}
.lw-btn{height:22px;min-width:22px;padding:0 4px;border:none;background:transparent;font-weight:bold;font-size:14px;color:#475569;border-radius:4px;cursor:pointer;display:inline-flex;align-items:center;justify-content:center}
.lw-btn:hover{background:#e2e8f0;color:#0f172a}
.lw-btn.icon svg{width:16px;height:16px}
.lw-btn.on{background:#1f5fd0;color:#fff}
.lw-ctrl .angle{min-width:38px;text-align:center;font-weight:700;font-size:12px;font-variant-numeric:tabular-nums}

/* 幅が足りないときはアイコンだけにする */
@media (max-width:1500px){
  #hdr .btn:not(.primary):not(.zbtn) span{display:none}
  #hdr .btn:not(.primary):not(.zbtn){padding:0 7px}
}
@media (max-width:900px){
  #hdr .zlbl{display:none}
  #hdr{gap:3px}
  #hdr .bgname{max-width:90px}
}

/* ---------- ツールバー ---------- */
#tools{
  display:flex;flex-wrap:wrap;align-items:center;gap:3px;row-gap:4px;
  padding:5px 10px;flex:0 0 auto;
  border-bottom:1px solid #e2e6ee;background:#ffffff;
}
.tool{
  position:relative;display:flex;align-items:center;justify-content:center;
  width:34px;height:32px;border:1px solid transparent;border-radius:6px;
  background:transparent;color:#39415a;cursor:pointer;flex:0 0 auto;padding:0;
}
.tool:hover{background:#eef3fb;border-color:#cfdcf2}
.tool.on{background:#1f5fd0;border-color:#1f5fd0;color:#ffffff}
.tool.repeat-on{background:#f3e8ff;border-color:#d8b4fe;color:#7e22ce}
.tool svg{width:19px;height:19px;pointer-events:none}

/* ---------- プロパティバー（フロートメニュー） ---------- */
#props-float{
  position:fixed;left:10px;top:120px;z-index:120;width:560px;
  display:flex;flex-direction:column;
  background:#f7f9fc;border:1px solid #c3cddd;border-radius:10px;
  box-shadow:0 8px 26px rgba(20,30,50,.20);
}
#props-head{
  display:flex;align-items:center;gap:6px;flex:0 0 auto;height:22px;padding:0 6px;
  background:#eaeef6;border-bottom:1px solid #dde3ee;border-radius:9px 9px 0 0;
  cursor:move;touch-action:none;
}
.pf-grip{
  width:16px;height:10px;flex:0 0 auto;
  background-image:radial-gradient(#9aa7bd 1px,transparent 1px);
  background-size:4px 4px;background-position:0 1px;
}
.pf-title{font-size:11px;font-weight:700;color:#5a6579;letter-spacing:.03em;white-space:nowrap}
#props-head .pf-btn{
  margin-left:auto;width:20px;height:16px;padding:0;line-height:1;
  border:1px solid #ccd3e0;border-radius:4px;background:#fff;color:#5a6579;
  font:inherit;font-size:11px;cursor:pointer;display:flex;align-items:center;justify-content:center;
}
#props-head .pf-btn:hover{background:#eef3fb;border-color:#9fb2d4}
#props{
  display:flex;flex-wrap:wrap;align-items:center;align-content:flex-start;gap:8px;row-gap:6px;
  padding:6px 10px;flex:1 1 auto;min-height:28px;
  overflow-x:hidden;overflow-y:auto;background:transparent;
}
#props::-webkit-scrollbar{width:6px}
#props::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}
/* 折り返し表示では、区切りは横いっぱいの線にする（縦線だと空の行ができてしまう） */
#props .sep{
  flex:1 0 100%;width:100%;height:0;margin:1px 0;
  background:none;border-top:1px solid #dde3ee;
}
#props-float.collapsed{width:auto !important}
#props-float.collapsed #props,#props-float.collapsed .pf-edge{display:none}
#props-float.collapsed #props-head{border-bottom:0;border-radius:9px}
/* 表示範囲を変えるつまみ */
.pf-edge{position:absolute;touch-action:none}
.pf-edge-r{top:6px;right:-3px;width:8px;bottom:10px;cursor:ew-resize}
.pf-edge-b{left:6px;right:10px;bottom:-3px;height:8px;cursor:ns-resize}
.pf-edge-br{right:0;bottom:0;width:14px;height:14px;cursor:nwse-resize}
.pf-edge-br::after{
  content:'';position:absolute;right:3px;bottom:3px;width:7px;height:7px;
  border-right:2px solid #aeb9cc;border-bottom:2px solid #aeb9cc;border-radius:0 0 3px 0;
}
.seg{
  display:inline-flex;flex:0 0 auto;background:#fff;
  border:1px solid #ccd3e0;border-radius:6px;overflow:hidden;
}
.seg button{
  width:30px;height:26px;padding:0;border:0;border-left:1px solid #e2e6ee;
  background:#fff;color:#39415a;cursor:pointer;
  display:flex;align-items:center;justify-content:center;
}
.seg button:first-child{border-left:0}
.seg button:hover:not(.on){background:#eef3fb}
.seg button.on{background:#1f5fd0;color:#ffffff}
.seg svg{width:16px;height:16px;display:block}
#propEmpty{color:#7b8699;font-size:12px}

/* 色ボタン */
.colorbtn{
  width:26px;height:26px;border:1px solid #ccd3e0;border-radius:5px;cursor:pointer;
  padding:2px;background:#fff;flex:0 0 auto;
}
.colorbtn i{display:block;width:100%;height:100%;border-radius:3px;border:1px solid rgba(0,0,0,.14)}
.colorinput{width:44px;height:26px;padding:2px;border:1px solid #ccd3e0;border-radius:5px;background:#fff;cursor:pointer}

/* 色の選択（標準の色・最近使った色・その他の色） */
.pop{
  position:fixed;z-index:40000;background:#fff;border:1px solid #ccd3e0;border-radius:10px;
  box-shadow:0 8px 26px rgba(20,30,50,.18);padding:10px 12px;display:none;width:236px;
}
.pop.on{display:block}
.poptitle{font-size:11px;font-weight:700;color:#64748b;margin:2px 0 6px;letter-spacing:.03em}
.swatches{display:grid;grid-template-columns:repeat(7,24px);gap:5px;margin-bottom:8px}
.sw{width:24px;height:24px;border-radius:4px;border:1px solid rgba(0,0,0,.16);cursor:pointer}
.sw:hover{outline:2px solid #1f5fd0;outline-offset:1px}
.sw.empty{background:#fafafa;border:1px dashed #cbd5e1;cursor:default}
.sw.empty:hover{outline:none}
.poprow{display:flex;align-items:center;gap:6px;border-top:1px solid #eef1f6;padding-top:8px}

/* ---------- ステージ ---------- */
#stage{
  position:relative;flex:1 1 auto;min-height:0;overflow:hidden;background:#e8ecf2;
  cursor:default;
}
#view{position:absolute;inset:0;display:block;touch-action:none}
#hint{
  position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;
  justify-content:center;gap:8px;pointer-events:none;color:#64748b;text-align:center;padding:0 16px;
}
#hint.hide{display:none}
.placeholder-icons{display:flex;gap:26px;margin-bottom:10px;color:#94a3b8}
.placeholder-icons svg{width:44px;height:44px}
.placeholder-text-main{font-size:16px;font-weight:bold;color:#475569}
.placeholder-text-sub{font-size:12.5px;color:#64748b;margin-top:4px}
#stage.dragover{outline:3px dashed #1f5fd0;outline-offset:-8px}
#editor{
  position:absolute;left:0;top:0;display:none;margin:0;padding:0;border:1px dashed #1f5fd0;
  background:rgba(255,255,255,.86);color:#000;resize:none;overflow:hidden;
  transform-origin:0 0;outline:none;white-space:pre-wrap;word-break:break-word;z-index:5;
}
#editor.on{display:block}

/* 切り抜き・トリミングのバー（フロート：つまんで移動できる） */
#cropbar{
  position:absolute;left:50%;bottom:16px;transform:translateX(-50%);z-index:30;
  display:none;align-items:center;gap:8px;background:#fff;border:1px solid #ccd3e0;
  border-radius:9px;box-shadow:0 6px 22px rgba(20,30,50,.2);padding:8px 12px;
  max-width:calc(100% - 24px);flex-wrap:wrap;
  cursor:move;touch-action:none;
}
#cropbar.on{display:flex}
#cropbar.floating{left:0;top:0;bottom:auto;transform:none}
#cropbar .btn,#cropbar select,#cropbar input{cursor:pointer}
#cropbar .lbl:first-child{font-weight:700;color:#1b1f27;font-size:12px}

/* ---------- ステータスバー ---------- */
#status{
  display:flex;align-items:center;gap:14px;padding:4px 12px;flex:0 0 auto;
  border-top:1px solid #e2e6ee;background:#f7f9fc;font-size:11.5px;color:#5a6579;
  font-variant-numeric:tabular-nums;white-space:nowrap;overflow:hidden;
}
#status .grow{flex:1}
@media (max-width:767px){
  #stPos{display:none}
}

/* ロゴ（PC: 高さ40px / スマホ: 高さ20px） */
#app-logo{
  position:fixed;bottom:36px;right:12px;height:40px;width:auto;z-index:20;
  pointer-events:none;filter:drop-shadow(0 2px 4px rgba(0,0,0,.1));
}
@media (max-width:767px){
  #app-logo{height:20px}
}

/* ---------- 通知・ツールチップ・処理中 ---------- */
#toast{
  position:fixed;left:50%;bottom:60px;transform:translateX(-50%);
  background:#2c3444;color:#fff;font-size:12.5px;padding:9px 16px;border-radius:7px;
  box-shadow:0 6px 20px rgba(16,24,40,.28);z-index:60000;opacity:0;transition:opacity .18s;
  pointer-events:none;max-width:80vw;text-align:center
}
#tipbox{
  position:fixed;z-index:70000;background:#2c3444;color:#fff;font-size:11.5px;
  padding:5px 9px;border-radius:5px;white-space:nowrap;pointer-events:none;
  opacity:0;transition:opacity .12s;box-shadow:0 4px 14px rgba(16,24,40,.24)
}
#busy{position:fixed;inset:0;z-index:50000;background:rgba(15,23,42,.25);display:none;align-items:center;justify-content:center}
#busy.on{display:flex}
.busy-card{display:flex;align-items:center;gap:10px;background:#fff;border-radius:10px;padding:14px 20px;box-shadow:0 10px 30px rgba(16,24,40,.25);font-size:13px;color:#334155}
.spinner{width:18px;height:18px;border:3px solid #dbe4f3;border-top-color:#1f5fd0;border-radius:50%;animation:spin .8s linear infinite}
@keyframes spin{to{transform:rotate(360deg)}}

/* ---------- 右クリックメニュー ---------- */
#context-menu{
  position:fixed;display:none;z-index:45000;background:#fff;border:1px solid #cbd5e1;border-radius:8px;
  box-shadow:0 8px 24px rgba(0,0,0,.14);padding:4px 0;min-width:190px;
}
.ctx-item{display:flex;justify-content:space-between;align-items:center;gap:18px;padding:7px 14px;cursor:pointer;font-size:13px;color:#334155}
.ctx-item:hover{background:#f1f5f9}
.ctx-item.danger{color:#dc2626}
.ctx-item kbd{border:0;background:transparent;color:#94a3b8;font-weight:500;padding:0}
.ctx-sep{height:1px;background:#eef1f6;margin:4px 0}

/* ---------- 簡易モーダル（リサイズ・余白・初期化など） ---------- */
#veil{position:fixed;inset:0;background:rgba(22,28,40,.34);display:none;z-index:25000}
#veil.on{display:flex;align-items:center;justify-content:center}
.modal{background:#fff;border-radius:10px;box-shadow:0 20px 50px rgba(16,24,40,.3);width:340px;max-width:calc(100vw - 24px);overflow:hidden}
.modal h3{margin:0;padding:13px 16px;font-size:13.5px;border-bottom:1px solid #e8ecf3;background:#f7f9fc}
.modal .body{padding:14px 16px;display:flex;flex-direction:column;gap:10px}
.modal .row{display:flex;align-items:center;gap:8px;justify-content:space-between}
.modal .row .lbl{min-width:74px}
.modal .foot{display:flex;justify-content:flex-end;gap:8px;padding:12px 16px;border-top:1px solid #e8ecf3;background:#fafbfd}
.modal .note{font-size:11px;color:#7b8699;line-height:1.6;margin:0}

/* ---------- 書式詳細（リッチテキスト編集） ---------- */
#text-editor-modal{
  display:none;position:fixed;top:50%;left:50%;transform:translate(-50%,-50%);
  background:#fff;padding:20px;border-radius:12px;box-shadow:0 10px 25px rgba(0,0,0,.15);
  border:1px solid #e2e8f0;z-index:30000;width:92%;max-width:760px;
}
.rt-toolbar{display:flex;gap:6px;margin-bottom:12px;align-items:center;flex-wrap:wrap}
.rt-toolbar select{height:32px;font-size:13px;border-radius:6px;border-color:#cbd5e1;color:#334155}
#modal-font-family{width:150px}
#modal-font-size,#modal-line-height{width:96px}
.rt-btn{height:32px;min-width:32px;border:1px solid #cbd5e1;border-radius:6px;background:#fff;cursor:pointer;color:#334155;font-size:14px;display:inline-flex;align-items:center;justify-content:center;gap:4px;padding:0 6px}
.rt-btn:hover{background:#f1f5f9}
.rt-btn.on{background:#e2e8f0;border-color:#94a3b8}
#modal-text-color-preview{display:inline-block;width:14px;height:14px;border:1px solid #cbd5e1;border-radius:2px;background:#000}
.rt-sep{width:0;height:20px;border-left:1px solid #cbd5e1;margin:0 2px}
.rt-label{font-size:13px;color:#475569;font-weight:bold}
#modal-editor-area{
  width:100%;height:150px;padding:12px;font-size:16px;border:1px solid #cbd5e1;border-radius:8px;
  overflow-y:auto;outline:none;background:#fff;white-space:pre-wrap;word-break:break-all;cursor:text;
}
#modal-editor-area:focus{border-color:#93c5fd;box-shadow:0 0 0 3px rgba(59,130,246,.12)}
.rt-note{font-size:11px;color:#7b8699;margin-top:6px}
.modal-btns{display:flex;justify-content:space-between;align-items:center;margin-top:12px}
.modal-btns-right{display:flex;gap:10px}
.modal-btns button{height:34px;padding:0 16px;border-radius:6px;font-size:13px;cursor:pointer}
.rt-reset{display:none;background:#f8fafc;color:#475569;border:1px solid #cbd5e1;font-weight:600}
.rt-cancel{background:#f1f5f9;color:#334155;border:1px solid #cbd5e1}
.rt-ok{background:#3b82f6;color:#fff;border:1px solid #2563eb;font-weight:600}
.rt-ok:hover{background:#2563eb}

/* ---------- SnapDraw のモダンモーダル ---------- */
.custom-modal-overlay{
  display:none;position:fixed;top:0;left:0;width:100%;height:100%;
  background:rgba(15,23,42,.4);backdrop-filter:blur(4px);z-index:20000;
  justify-content:center;align-items:center;
}
.custom-modal-card{
  background:#ffffff;border-radius:16px;padding:24px;width:90%;max-width:380px;
  box-shadow:0 20px 25px -5px rgba(0,0,0,.1),0 8px 10px -6px rgba(0,0,0,.05);
  text-align:center;border:1px solid #e2e8f0;animation:modalFadeIn .2s ease-out;
}
@keyframes modalFadeIn{from{opacity:0;transform:scale(.95)}to{opacity:1;transform:scale(1)}}
.custom-modal-title{font-size:17px;font-weight:700;color:#0f172a;margin-bottom:8px}
.custom-modal-msg{font-size:13.5px;color:#64748b;margin-bottom:20px;line-height:1.5}
.custom-modal-btns{display:flex;flex-direction:column;gap:8px}
.custom-modal-btn{
  height:38px;border-radius:8px;font-size:14px;font-weight:600;cursor:pointer;
  transition:all .15s ease;border:1px solid transparent;display:inline-flex;
  justify-content:center;align-items:center;font-family:inherit;padding:0 12px;
}
.custom-modal-btn-primary{background:#2563eb;color:#ffffff;border-color:#2563eb}
.custom-modal-btn-primary:hover{background:#1d4ed8;border-color:#1d4ed8}
.custom-modal-btn-success{background:#16a34a;color:#ffffff;border-color:#16a34a}
.custom-modal-btn-success:hover{background:#15803d;border-color:#15803d}
.custom-modal-btn-secondary{background:#f8fafc;color:#334155;border-color:#cbd5e1}
.custom-modal-btn-secondary:hover{background:#e2e8f0;color:#0f172a;border-color:#94a3b8}
.custom-modal-btn-danger{background:#fef2f2;color:#dc2626;border-color:#fca5a5}
.custom-modal-btn-danger:hover{background:#fee2e2;color:#991b1b;border-color:#f87171}
.custom-modal-btn-cancel{background:transparent;color:#64748b;font-weight:500;font-size:13px;height:30px;border-color:transparent}
.custom-modal-btn-cancel:hover{background:#f1f5f9;color:#334155}

.dpi-box{margin-bottom:16px;display:flex;flex-direction:column;align-items:center;gap:8px}
#pdf-dpi-select{height:36px;padding:0 8px;width:100%;max-width:240px;border-radius:6px;border:1px solid #cbd5e1;font-size:14px}
#pdf-custom-dpi-box{display:none;align-items:center;gap:6px;margin-top:4px}
#pdf-custom-dpi-val{width:100px;height:32px;text-align:center;font-size:14px}
#pdf-custom-dpi-box span{font-size:14px;color:#475569;font-weight:600}
.range-box{display:flex;justify-content:center;align-items:center;gap:8px;margin-bottom:20px}
.range-box select{height:36px;padding:0 8px;font-size:14px}
.range-box span{color:#64748b;font-weight:bold}

/* ページ一覧 */
.page-list-card{max-width:96vw;width:96%;height:92vh;max-height:92vh;display:flex;flex-direction:column;padding:20px;text-align:left}
.page-list-title{display:flex;justify-content:space-between;align-items:center;border-bottom:1px solid #e2e8f0;padding-bottom:12px;margin-bottom:12px}
.page-list-close{border:none;background:transparent;font-size:20px;cursor:pointer;color:#64748b;padding:0 6px}
#page-thumbnails-container{
  display:grid;grid-template-columns:repeat(auto-fill,minmax(160px,1fr));grid-auto-rows:min-content;
  align-items:start;gap:16px;overflow-y:auto;flex:1;padding:16px;margin-bottom:16px;min-height:200px;
}
.page-list-foot{display:flex;justify-content:space-between;align-items:center;border-top:1px solid #e2e8f0;padding-top:12px;margin-top:auto}
.page-list-foot-right{display:flex;gap:8px}
.page-add-btn{height:36px;padding:0 16px;font-size:14px;cursor:pointer}
.page-apply-btn{height:36px;padding:0 20px}

.thumb-card{
  background:#ffffff;border:2px solid #e2e8f0;border-radius:10px;padding:6px;
  display:flex;flex-direction:column;align-items:center;gap:6px;position:relative;
  cursor:grab;transition:transform .15s ease,box-shadow .15s ease;box-shadow:0 2px 4px rgba(0,0,0,.02);
  user-select:none;height:auto;align-self:start;
}
.thumb-card:hover{border-color:#93c5fd;transform:translateY(-2px);box-shadow:0 4px 12px rgba(0,0,0,.08)}
.thumb-card.dragging{opacity:.3;border-style:dashed;border-color:#2563eb}
.thumb-card.drag-target-left{box-shadow:-8px 0 0 0 #2563eb !important;border-left-color:#2563eb !important}
.thumb-card.drag-target-right{box-shadow:8px 0 0 0 #2563eb !important;border-right-color:#2563eb !important}
.thumb-card-preview{
  width:100%;height:120px;background:#f8fafc;border-radius:6px;border:1px solid #cbd5e1;
  display:flex;justify-content:center;align-items:center;overflow:hidden;position:relative;
}
.thumb-card-preview img{max-width:100%;max-height:100%;object-fit:contain;pointer-events:none}
.thumb-blank{font-size:12px;color:#94a3b8;text-align:center;line-height:1.5}
.thumb-badge{position:absolute;left:4px;bottom:4px;background:rgba(31,95,208,.85);color:#fff;font-size:10px;padding:1px 6px;border-radius:8px}
.thumb-card-num{font-size:13px;font-weight:700;color:#475569;margin-bottom:2px}
.thumb-del-top{
  position:absolute;top:-6px;right:-6px;width:22px;height:22px;padding:0;
  border-radius:50%;background:#ffffff;border:1px solid #fca5a5;color:#ef4444;
  font-size:11px;font-weight:bold;display:flex;align-items:center;justify-content:center;
  cursor:pointer;box-shadow:0 2px 5px rgba(0,0,0,.15);z-index:10;transition:all .15s ease;
}
.thumb-del-top:hover{background:#ef4444;color:#ffffff;border-color:#ef4444}
.thumb-drop-zone{border:2px dashed #cbd5e1;border-radius:10px;background:#f8fafc;transition:all .2s ease}
.thumb-drop-zone.drag-over{border-color:#2563eb;background:#eff6ff}

/* ---------- スマホ幅 ----------
   バーは折り返さず1行にして、横スクロールで操作する（描画領域を広く取るため）。
   通常のルールより後ろに置かないと上書きされるので、必ずファイルの末尾に置く */
@media (max-width:767px){
  #hdr,#tools{flex-wrap:nowrap;overflow-x:auto;overflow-y:hidden;-webkit-overflow-scrolling:touch;scrollbar-width:thin}
  #hdr .grp{flex-wrap:nowrap;flex:0 0 auto;max-width:none}
  #hdr .hdr-right{margin-left:0}
  #hdr::-webkit-scrollbar,#tools::-webkit-scrollbar{height:4px}
  #hdr::-webkit-scrollbar-thumb,#tools::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:4px}
  /* フロートの詳細ツールバーは折り返して表示する（横スクロールにしない） */
  #props .grp{max-width:100%}
}