/* ============================================================
   T笔记 · 浮动面板 / 对话框 / 浮动球 / 遮罩与提示
   ============================================================ */

/* ---------- 通用浮动面板 ---------- */
.panel{
  position:fixed;z-index:60;background:var(--card);border:1px solid var(--line);
  border-radius:var(--r-l);box-shadow:var(--shadow-l);padding:14px;
}
.panel h4{margin:0 0 10px;font-size:13px;color:var(--muted);font-weight:600;}
.panel-tip{font-size:12.5px;color:var(--muted);line-height:1.6;margin:10px 0 0;max-width:300px;}

/* ---------- 颜色面板 ---------- */
.color-grid{display:grid;grid-template-columns:repeat(6,1fr);gap:9px;}
.color-cell{
  width:38px;height:38px;border-radius:50%;position:relative;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.10);transition:transform .08s;
}
.color-cell:active{transform:scale(.9);}
.color-cell.on{box-shadow:0 0 0 3px var(--brand-soft),inset 0 0 0 1px rgba(0,0,0,.10);}
.color-cell.on::after{content:"";position:absolute;inset:-5px;border-radius:50%;border:2px solid var(--brand);}

/* ---------- 粗细面板 ---------- */
.width-row{display:flex;align-items:center;gap:14px;}
.width-preview{
  width:70px;height:70px;flex:0 0 auto;border-radius:14px;background:#f5f7fb;
  display:flex;align-items:center;justify-content:center;border:1px solid var(--line);
}
.width-preview i{border-radius:50%;background:#1e232b;display:block;transition:width .1s,height .1s;}
.width-side{flex:1;min-width:0;}
.width-num{display:flex;align-items:center;gap:8px;margin-bottom:10px;}
.step-btn{
  width:40px;height:40px;border-radius:11px;flex:0 0 auto;
  background:#f1f4f9;color:#3d4658;
  display:flex;align-items:center;justify-content:center;
}
.step-btn:active{background:#e2e9f5;transform:scale(.95);}
#widthNumber{
  width:66px;height:40px;text-align:center;font-size:17px;font-weight:700;
  border-radius:11px;border:1px solid var(--line);background:#fff;
  -webkit-user-select:text;user-select:text;
}
#widthNumber:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft);}
.width-num .unit{font-size:12.5px;color:var(--muted);}

input[type=range]{
  -webkit-appearance:none;appearance:none;width:100%;height:6px;border-radius:3px;
  background:#e4e8ee;outline:none;
}
input[type=range]::-webkit-slider-thumb{
  -webkit-appearance:none;width:26px;height:26px;border-radius:50%;background:#fff;
  border:3px solid var(--brand);box-shadow:var(--shadow-s);cursor:pointer;
}

/* 刻度尺：一眼看出各档笔尖多大 */
.width-scale{
  display:flex;align-items:flex-end;justify-content:space-between;
  gap:4px;margin-top:12px;padding-top:10px;border-top:1px dashed var(--line);
}
.width-scale button{
  flex:1;display:flex;flex-direction:column;align-items:center;gap:6px;
  padding:4px 0 2px;border-radius:10px;transition:background .12s;
}
.width-scale button:active{background:#f1f4f9;}
.width-scale .dot-box{height:44px;display:flex;align-items:center;justify-content:center;}
.width-scale i{border-radius:50%;background:#1e232b;display:block;}
.width-scale b{font-size:10.5px;color:var(--muted);font-weight:500;font-variant-numeric:tabular-nums;}
.width-scale button.on b{color:var(--brand);font-weight:700;}

/* ---------- 自选颜色面板 ---------- */
.picker-color{
  display:flex;align-items:center;justify-content:space-between;gap:10px;
  margin-top:13px;font-size:13px;color:var(--muted);cursor:pointer;
}
input[type=color]{
  width:60px;height:40px;padding:2px;border:1px solid var(--line);
  border-radius:10px;background:#fff;cursor:pointer;flex:0 0 auto;
}

/* ---------- 对话框 ---------- */
.dlg-mask{
  position:fixed;inset:0;z-index:80;background:rgba(20,26,38,.34);
  display:flex;align-items:center;justify-content:center;padding:20px;
  backdrop-filter:blur(2px);
}
.dlg{
  width:100%;max-width:440px;background:var(--card);border-radius:var(--r-l);
  box-shadow:var(--shadow-l);overflow:hidden;animation:pop .16s ease-out;
}
.dlg-head{display:flex;align-items:center;justify-content:space-between;padding:16px 18px 10px;}
.dlg-head h3{margin:0;font-size:17px;}
.dlg-body{padding:4px 18px 8px;max-height:64vh;overflow:auto;}
.dlg-foot{display:flex;justify-content:flex-end;gap:10px;padding:12px 18px 18px;}

.set-row{
  display:flex;align-items:center;justify-content:space-between;gap:14px;
  padding:13px 2px;border-bottom:1px solid var(--line);
}
.set-row:last-child{border-bottom:0;}
.set-row .lb{font-size:14.5px;}
.set-row .lb small{display:block;color:var(--muted);font-size:12px;margin-top:3px;font-weight:400;}

.switch{position:relative;width:50px;height:30px;flex:0 0 auto;}
.switch input{opacity:0;width:100%;height:100%;margin:0;position:absolute;inset:0;cursor:pointer;z-index:2;}
.switch i{position:absolute;inset:0;border-radius:15px;background:#d8dee8;transition:background .18s;}
.switch i::after{
  content:"";position:absolute;width:24px;height:24px;border-radius:50%;background:#fff;
  top:3px;left:3px;transition:transform .18s;box-shadow:0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + i{background:var(--brand);}
.switch input:checked + i::after{transform:translateX(20px);}

select.sel{
  height:40px;border-radius:10px;border:1px solid var(--line);background:#fff;
  padding:0 10px;font-size:14px;min-width:130px;
}

.radio-list{display:flex;flex-direction:column;gap:8px;margin-bottom:12px;}
.radio-item{
  display:flex;align-items:center;gap:11px;padding:13px 14px;border-radius:12px;
  border:1px solid var(--line);cursor:pointer;font-size:14.5px;background:#fff;
}
.radio-item.on{border-color:var(--brand);background:var(--brand-soft);color:var(--brand-dark);font-weight:600;}
.radio-item .rb{width:18px;height:18px;border-radius:50%;border:2px solid var(--line-strong);flex:0 0 auto;position:relative;}
.radio-item.on .rb{border-color:var(--brand);}
.radio-item.on .rb::after{content:"";position:absolute;inset:3px;border-radius:50%;background:var(--brand);}

.field{margin-bottom:14px;}
.field label{display:block;font-size:13px;color:var(--muted);margin-bottom:7px;}
.field input[type=text],.field input[type=number]{
  width:100%;height:46px;border-radius:12px;border:1px solid var(--line);
  padding:0 13px;font-size:15px;background:#fff;
  -webkit-user-select:text;user-select:text;
}
.field input:focus{outline:none;border-color:var(--brand);box-shadow:0 0 0 3px var(--brand-soft);}

.progress{height:9px;border-radius:5px;background:#e9edf4;overflow:hidden;margin:6px 0 8px;}
.progress i{display:block;height:100%;width:0;background:var(--brand);border-radius:5px;transition:width .15s;}
.progress-text{font-size:12.5px;color:var(--muted);text-align:center;}

.help-body{font-size:14px;line-height:1.95;color:#3a4150;}
.help-body p{margin:0 0 10px;}

/* ---------- 浮动球 ---------- */
#ballWrap{position:fixed;z-index:70;transition:left .22s ease,top .22s ease,right .22s ease,bottom .22s ease;}
#ball{
  width:58px;height:58px;border-radius:50%;background:var(--card);
  box-shadow:var(--shadow-l);border:1px solid var(--line);
  display:flex;align-items:center;justify-content:center;color:var(--brand);
  transition:transform .12s;touch-action:none;
}
#ball:active{transform:scale(.93);}
#ball.dragging{transform:scale(1.06);}
#ballWrap.summon #ball{box-shadow:0 0 0 6px rgba(47,107,255,.18),var(--shadow-l);}
#ballMenu{
  position:absolute;right:0;bottom:70px;width:252px;
  background:var(--card);border:1px solid var(--line);border-radius:16px;
  box-shadow:var(--shadow-l);padding:10px;
  animation:pop .14s ease-out;
}
/* 工具区：四列两行 */
#ballMenu .ball-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:6px;}
#ballMenu .tb{
  display:flex;flex-direction:column;align-items:center;gap:3px;
  padding:8px 2px;border-radius:11px;font-size:11px;color:#4a5364;
}
#ballMenu .tb svg{width:22px;height:22px;}
#ballMenu .tb:active{background:#eef2fa;}
#ballMenu .tb.active{background:var(--brand-soft);color:var(--brand);}
/* 控制盘上的颜色条 */
#ballMenu .ball-colors{
  display:flex;align-items:center;gap:7px;flex-wrap:wrap;
  margin-top:6px;padding-top:9px;border-top:1px dashed var(--line);
}
#ballMenu .bc-label{font-size:11.5px;color:var(--muted);margin-right:1px;}
#ballMenu .bsw{
  width:26px;height:26px;border-radius:50%;flex:0 0 auto;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,.12);
  transition:transform .08s;
}
#ballMenu .bsw:active{transform:scale(.9);}
#ballMenu .bsw.on{box-shadow:0 0 0 2px #fff, 0 0 0 4px var(--brand);}
#ballMenu .bsw-add{
  background:#f1f4f9;color:#5b6474;display:flex;align-items:center;justify-content:center;
}
#ballMenu .bsw-add svg{width:16px;height:16px;}

/* ---------- 拖拽遮罩 ---------- */
#dropMask{
  position:fixed;inset:0;z-index:95;background:rgba(47,107,255,.10);
  border:4px dashed var(--brand);border-radius:6px;
  display:flex;align-items:center;justify-content:center;
}
#dropMask .dm-in{
  background:#fff;border-radius:20px;padding:30px 44px;text-align:center;
  box-shadow:var(--shadow-l);color:var(--brand);
}
#dropMask .dm-in b{display:block;font-size:20px;margin-top:12px;}
#dropMask .dm-in span{display:block;font-size:13px;color:var(--muted);margin-top:6px;}

/* ---------- 加载遮罩 ---------- */
#loading{
  position:fixed;inset:0;z-index:96;background:rgba(238,241,245,.72);
  display:flex;flex-direction:column;align-items:center;justify-content:center;gap:14px;
  backdrop-filter:blur(3px);
}
.spinner{
  width:46px;height:46px;border-radius:50%;
  border:4px solid #dbe3f2;border-top-color:var(--brand);
  animation:spin .9s linear infinite;
}
#loadingText{font-size:14px;color:#5b6474;font-weight:500;}
#loadingBarWrap{width:240px;height:6px;border-radius:3px;background:#dde4ef;overflow:hidden;}
#loadingBar{height:100%;width:0;background:var(--brand);border-radius:3px;transition:width .18s;}

/* ---------- 轻提示 ---------- */
#toast{
  position:fixed;left:50%;bottom:var(--toast-bottom);transform:translateX(-50%);
  z-index:99;background:rgba(30,35,43,.92);color:#fff;font-size:14px;
  padding:11px 20px;border-radius:12px;box-shadow:var(--shadow-l);
  opacity:0;pointer-events:none;transition:opacity .2s,transform .2s,bottom .2s;
  max-width:80vw;text-align:center;
}
#toast.on{opacity:1;transform:translateX(-50%) translateY(-6px);}

#palmBadge{
  position:fixed;left:50%;top:14px;transform:translateX(-50%);z-index:65;
  background:rgba(47,107,255,.94);color:#fff;font-size:13.5px;font-weight:500;
  padding:9px 18px;border-radius:12px;display:flex;align-items:center;gap:8px;
  box-shadow:0 8px 24px rgba(47,107,255,.35);
}
#shapeTip{
  position:fixed;left:50%;transform:translateX(-50%);bottom:calc(var(--toast-bottom) + 46px);
  z-index:64;background:#fff;border:1px solid #c8daff;color:var(--brand);
  font-size:13.5px;font-weight:600;padding:9px 16px;border-radius:11px;
  box-shadow:var(--shadow-m);display:flex;align-items:center;gap:8px;
}

/* ---------- 小屏适配 ---------- */
@media (max-width:760px){
  .tool-btn{min-width:54px;}
  .tb-name span{display:none;}
}
