
:root{
  --ink:#172033;
  --muted:#667085;
  --line:#e5e7ef;
  --line2:#d7ddea;
  --brand:#2563eb;
  --brand2:#7c3aed;
  --danger:#ef4444;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:"Microsoft YaHei","PingFang SC",system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif;
  color:var(--ink);
  background:linear-gradient(135deg,#edf3fb 0%,#dfe8f5 45%,#eef4fb 100%);
  overflow:hidden;
}
.app{
  height:100vh;
  display:grid;
  grid-template-columns:292px minmax(0,1fr) 308px;
  grid-template-rows:62px minmax(0,1fr);
}
header{
  grid-column:1/4;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:14px;
  padding:0 16px;
  background:rgba(255,255,255,.88);
  backdrop-filter:blur(18px);
  border-bottom:1px solid rgba(229,231,239,.95);
  z-index:20;
}
.logo{display:flex;align-items:center;gap:12px;min-width:320px}
.logo-mark{
  position:relative;overflow:hidden;
  width:72px;height:36px;border-radius:4px;
  background-size:auto;
  background-position:center;
  background-color: #2563eb;
}
.logo-mark img{height:100%;padding:10px;}

.logo1-mark{
  position:relative;overflow:hidden;
  width:38px;height:38px;border-radius:14px;
  background:linear-gradient(135deg,#f8fbff,#eef4ff);
  border:1px solid rgba(148,163,184,.18);
  box-shadow:0 12px 24px rgba(59,130,246,.10), inset 0 1px 0 rgba(255,255,255,.7);
}
.logo1-mark::before{
  content:"";position:absolute;inset:6px;border-radius:10px;
  background:
    linear-gradient(#ef4444,#ef4444) left top / 10px 10px no-repeat,
    linear-gradient(#3b82f6,#3b82f6) right top / 10px 10px no-repeat,
    linear-gradient(#22c55e,#22c55e) left bottom / 10px 10px no-repeat,
    linear-gradient(#8b5cf6,#8b5cf6) right bottom / 10px 10px no-repeat,
    linear-gradient(#f59e0b,#f59e0b) center / 10px 10px no-repeat;
  filter:drop-shadow(0 1px 1px rgba(15,23,42,.08));
}
.logo1-mark::after{
  content:"";position:absolute;inset:0;border-radius:14px;
  background:
    linear-gradient(135deg, rgba(255,255,255,.65), transparent 42%),
    linear-gradient(180deg, rgba(255,255,255,.24), transparent 55%);
  pointer-events:none;
}
.logo-title{font-size:16px;font-weight:900;letter-spacing:.2px}
.logo small{display:block;font-size:12px;color:var(--muted);margin-top:2px;letter-spacing:.15px}
.header-actions{display:flex;gap:8px;flex-wrap:wrap;justify-content:flex-end}
button,.btn{
  border:1px solid var(--line);
  background:#fff;color:var(--ink);
  border-radius:12px;min-height:34px;padding:7px 11px;
  font-size:13px;cursor:pointer;
  display:inline-flex;align-items:center;justify-content:center;gap:6px;
  transition:.16s ease;white-space:nowrap;font-family:inherit;
}
button:hover,.btn:hover{transform:translateY(-1px);box-shadow:0 10px 22px rgba(20,31,56,.08);border-color:#cbd5e1}
button.primary{
  border-color:transparent;
  background:linear-gradient(135deg,var(--brand),var(--brand2));
  color:#fff;
  box-shadow:0 12px 25px rgba(37,99,235,.22);
}
button.soft{background:#f8fafc}
button.danger{color:#b91c1c;border-color:#fecaca;background:#fff7f7}
.sidebar,.rightbar{
  min-width:0;
  overflow-y:auto;
  overflow-x:hidden;
  padding:12px;
  background:rgba(255,255,255,.82);
  backdrop-filter:blur(18px);
}
.sidebar{border-right:1px solid rgba(229,231,239,.95)}
.rightbar{border-left:1px solid rgba(229,231,239,.95)}
.sidebar::-webkit-scrollbar,.rightbar::-webkit-scrollbar{width:8px}
.sidebar::-webkit-scrollbar-thumb,.rightbar::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:999px}
.section{
  background:rgba(255,255,255,.96);
  border:1px solid rgba(229,231,239,.95);
  border-radius:16px;
  padding:11px;
  margin-bottom:10px;
  box-shadow:0 8px 20px rgba(20,31,56,.04);
}
.section h3{
  margin:0 0 9px;
  font-size:13px;
  display:flex;
  justify-content:space-between;
  align-items:center;
  gap:8px;
}
.section h3 span{color:var(--muted);font-size:12px;font-weight:500}
.mode-card{
  border-radius:16px;
  padding:10px 11px;
  background:linear-gradient(135deg,#eff6ff,#faf5ff);
  border:1px solid #bfdbfe;
  margin-bottom:10px;
}
.mode-title{font-size:12px;color:#475569;margin-bottom:5px}
.mode-name{display:flex;align-items:center;gap:8px;font-weight:900;color:#1d4ed8;font-size:15px}
.mode-dot{width:11px;height:11px;border-radius:50%;background:#2563eb;box-shadow:0 0 0 5px rgba(37,99,235,.12)}
.mode-help{font-size:11px;color:#64748b;line-height:1.45;margin-top:5px}
.tool-grid{
  display:grid;
  grid-template-columns:repeat(4,minmax(0,1fr));
  gap:6px;
}
.tool{
  position:relative;
  height:46px;
  display:flex;
  flex-direction:column;
  justify-content:center;
  align-items:center;
  gap:2px;
  padding:4px 2px;
  font-size:11px;
  font-weight:800;
  background:#fff;
  border:1px solid var(--line);
  border-radius:13px;
}
.tool em{font-style:normal;font-size:17px;line-height:1;display:flex;align-items:center;justify-content:center;height:18px}
.tool em svg{width:16px;height:16px;display:block;fill:currentColor}
.tool.active{
  color:#1d4ed8;
  background:linear-gradient(135deg,#eff6ff 0%,#f5f3ff 100%);
  border:2px solid #3b82f6;
  box-shadow:0 10px 20px rgba(37,99,235,.14), inset 0 0 0 1px rgba(255,255,255,.8);
}
.tool.active::after{
  content:"";
  position:absolute;right:6px;top:6px;
  width:7px;height:7px;border-radius:50%;
  background:linear-gradient(135deg,#2563eb,#7c3aed);
  box-shadow:0 0 0 3px rgba(37,99,235,.14);
}
.style-grid{display:grid;grid-template-columns:1fr 1fr 1fr;gap:7px}
.bubble-style-grid{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.emoji-picker{margin-top:9px;border:1px solid var(--line);border-radius:13px;background:#f8fafc;overflow:hidden}
.emoji-picker summary{
  min-height:38px;padding:7px 10px;cursor:pointer;list-style:none;
  display:flex;align-items:center;justify-content:space-between;
  color:#475569;font-size:12px;font-weight:800;
}
.emoji-picker summary::-webkit-details-marker{display:none}
.emoji-picker summary::before{content:"▸";margin-right:7px;color:#2563eb}
.emoji-picker[open] summary::before{content:"▾"}
.emoji-picker summary span{margin-right:auto}
.emoji-picker summary b{font-size:20px;line-height:1}
.arrow-icon-picker summary b{width:36px;height:24px;display:flex;align-items:center;justify-content:center}
.arrow-icon-picker summary b img{max-width:36px;max-height:24px;display:block}
.sticker-grid{
  display:grid;grid-template-columns:repeat(7,minmax(0,1fr));gap:4px;
  max-height:164px;overflow-y:auto;padding:7px;border-top:1px solid var(--line);
}
.sticker-preset{
  min-height:34px;padding:2px;border-radius:9px;
  display:flex;align-items:center;justify-content:center;
  font-size:22px;background:#fff;
}
.sticker-preset.active{
  border:2px solid #3b82f6;
  background:linear-gradient(135deg,#eff6ff,#fff7ed);
  box-shadow:0 5px 12px rgba(37,99,235,.10);
}
.arrow-icon-grid{
  display:grid;grid-template-columns:repeat(5,minmax(0,1fr));gap:5px;
  max-height:210px;overflow-y:auto;padding:7px;border-top:1px solid var(--line);
  background:
    linear-gradient(45deg,#edf2f7 25%,transparent 25%) 0 0/12px 12px,
    linear-gradient(-45deg,#edf2f7 25%,transparent 25%) 0 6px/12px 12px,
    linear-gradient(45deg,transparent 75%,#edf2f7 75%) 6px -6px/12px 12px,
    linear-gradient(-45deg,transparent 75%,#edf2f7 75%) -6px 0/12px 12px,
    #fff;
}
.arrow-icon-preset{min-height:46px;padding:3px;border-radius:9px;background:rgba(255,255,255,.88)}
.arrow-icon-preset img{display:block;width:100%;height:40px;object-fit:contain}
.arrow-icon-preset.active{border:2px solid #3b82f6;background:#eff6ff;box-shadow:0 5px 12px rgba(37,99,235,.12)}
.bubble-preset{min-height:54px;border:1px solid var(--line);border-radius:13px;padding:8px;background:#fff;cursor:pointer;transition:.16s ease;text-align:left}
.bubble-preset strong{display:block;font-size:12px;line-height:1.2}
.bubble-preset small{display:block;font-size:10px;color:var(--muted);margin-top:3px}
.bubble-preset.active{border:2px solid #3b82f6;background:linear-gradient(135deg,#eff6ff 0%,#f8f5ff 100%);box-shadow:0 10px 18px rgba(37,99,235,.10)}
.bubble-preset i{display:block;height:10px;border-radius:999px;margin-top:7px;background:linear-gradient(90deg,#e5e7eb,#cbd5e1);border:1px solid #e5e7eb}
.style-card{
  min-height:50px;
  border:1px solid var(--line);
  border-radius:13px;
  padding:7px;
  cursor:pointer;
  background:#fff;
  transition:.16s ease;
}
.style-card:hover{transform:translateY(-1px);box-shadow:0 10px 20px rgba(20,31,56,.06)}
.style-card.active{border:2px solid #3b82f6;box-shadow:0 10px 20px rgba(37,99,235,.12)}
.style-card strong{display:block;font-size:12px;line-height:1.2}
.style-chip{
  margin-top:7px;height:9px;border-radius:999px;border:1px solid #dbe2ef;
}
.style-chip.watercolor{background:linear-gradient(90deg,#fecaca,#bfdbfe,#bbf7d0)}
.style-chip.marker{background:linear-gradient(90deg,#f87171,#60a5fa,#4ade80)}
.style-chip.blueprint{background:linear-gradient(90deg,#0f2746,#153d77,#1b5ca8)}
.control{margin-top:9px}
.control:first-child{margin-top:0}
.control-head{
  display:flex;justify-content:space-between;align-items:center;gap:10px;
  margin-bottom:5px;font-size:12px;color:var(--muted);
}
.value-badge{
  color:#334155;background:#f1f5f9;border:1px solid #e2e8f0;
  border-radius:999px;padding:1px 7px;font-size:11px;
}
input[type="range"]{display:block;width:100%;accent-color:#2563eb}
input[type="color"]{width:42px;height:32px;border:0;background:transparent;padding:0;cursor:pointer}
input,select,textarea{
  width:100%;max-width:100%;min-width:0;
  border:1px solid var(--line);
  background:#fff;
  border-radius:11px;
  padding:8px 10px;
  font-family:inherit;
  color:var(--ink);
  outline:none;
}
input:focus,select:focus,textarea:focus{border-color:#93c5fd;box-shadow:0 0 0 4px rgba(59,130,246,.10)}
.inline-controls{display:grid;grid-template-columns:48px minmax(0,1fr);gap:10px;align-items:center}
.color-palette{display:grid;grid-template-columns:repeat(8,minmax(0,1fr));gap:6px}
.swatch{
  width:100%;
  aspect-ratio:1/1;
  min-height:22px;
  max-height:28px;
  border-radius:8px;
  border:2px solid #fff;
  outline:1px solid var(--line2);
  cursor:pointer;
  box-shadow:0 4px 9px rgba(20,31,56,.07);
}
.swatch.active{outline:3px solid rgba(37,99,235,.72);transform:scale(1.04)}
.switch-line{
  display:flex;align-items:center;justify-content:space-between;gap:12px;
  margin-top:8px;font-size:12px;color:#64748b;
}
.switch-line input{width:18px;height:18px;accent-color:#2563eb}
.workspace{
  min-width:0;
  position:relative;
  overflow:hidden;
  background:
    radial-gradient(circle at 20% 8%,rgba(59,130,246,.10),transparent 24%),
    radial-gradient(circle at 84% 82%,rgba(14,165,233,.10),transparent 24%),
    linear-gradient(rgba(71,85,105,.06) 1px,transparent 1px),
    linear-gradient(90deg,rgba(71,85,105,.06) 1px,transparent 1px),
    linear-gradient(rgba(71,85,105,.12) 1px,transparent 1px),
    linear-gradient(90deg,rgba(71,85,105,.12) 1px,transparent 1px),
    linear-gradient(180deg,#eaf0f7 0%,#eef3f8 100%);
  background-size:auto,auto,24px 24px,24px 24px,120px 120px,120px 120px,auto;
}
.canvas-shell{
  position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);
  width:1000px;height:680px;background:#f7fafc;border-radius:22px;
  box-shadow:0 24px 58px rgba(15,23,42,.14), inset 0 1px 0 rgba(255,255,255,.65);
  overflow:hidden;
  border:1px solid rgba(148,163,184,.36);
}
canvas{position:absolute;left:0;top:0;width:100%;height:100%;display:block}
#baseCanvas{z-index:1}
#paintCanvas{z-index:2}
#contourCanvas{z-index:3;pointer-events:none}
#objectCanvas{z-index:4;touch-action:none}
.canvas-toolbar{
  position:absolute;left:50%;bottom:18px;transform:translateX(-50%);
  background:rgba(15,23,42,.82);backdrop-filter:blur(18px);
  border:1px solid rgba(96,165,250,.20);box-shadow:0 18px 40px rgba(15,23,42,.25);
  border-radius:999px;padding:8px;z-index:10;display:flex;gap:6px;
}
.canvas-toolbar button{
  background:rgba(255,255,255,.08);
  border-color:rgba(148,163,184,.24);
  color:#e5eefc;
}
.canvas-toolbar button:hover{
  border-color:rgba(96,165,250,.40);
  background:rgba(59,130,246,.14);
}
.status-float{
  position:absolute;top:18px;left:50%;transform:translateX(-50%);
  background:rgba(15,23,42,.78);backdrop-filter:blur(18px);
  border:1px solid rgba(96,165,250,.22);border-radius:999px;box-shadow:0 14px 34px rgba(15,23,42,.24);
  z-index:11;padding:8px 13px;color:#e5eefc;font-size:13px;
}
.zoom-badge{
  position:absolute;right:18px;bottom:22px;background:rgba(15,23,42,.78);
  border:1px solid rgba(96,165,250,.18);padding:9px 12px;border-radius:999px;z-index:10;color:#dbe7fb;font-size:12px;
}
.object-hint{
  font-size:12px;color:#667085;background:#f8fafc;
  border:1px dashed #cbd5e1;border-radius:13px;padding:10px 11px;line-height:1.68;
}
.two-btn{display:grid;grid-template-columns:1fr 1fr;gap:8px}
.legend-list{display:flex;flex-direction:column;gap:8px}
.legend-item{display:grid;grid-template-columns:40px minmax(0,1fr) 32px;gap:8px;align-items:center}
.kbd{
  display:inline-flex;align-items:center;justify-content:center;min-width:28px;
  border:1px solid #d0d5dd;border-bottom-width:2px;
  border-radius:7px;padding:2px 7px;background:#fff;color:#475467;font-size:11px;font-weight:700;
  box-shadow:0 1px 0 rgba(255,255,255,.7) inset;
}
.help{font-size:12px;color:var(--muted);line-height:1.9}
.key-list{display:flex;flex-direction:column;gap:8px}
.key-row{display:flex;flex-wrap:wrap;gap:8px 14px;align-items:center}
.key-item{display:inline-flex;align-items:center;gap:6px;white-space:nowrap}
.toast{
  position:fixed;top:76px;left:50%;transform:translateX(-50%);
  background:#172033;color:#fff;padding:10px 14px;border-radius:999px;
  box-shadow:0 14px 30px rgba(0,0,0,.18);z-index:100;opacity:0;pointer-events:none;transition:.25s ease;font-size:13px;
}
.toast.show{opacity:1;transform:translateX(-50%) translateY(4px)}
@media(max-width:1180px){
  .app{grid-template-columns:280px minmax(0,1fr) 300px}
  .logo small{display:none}
}

/* ===== V34 增强 ===== */
input[type="range"]{
  -webkit-appearance:none;appearance:none;height:18px;background:transparent;cursor:pointer;
}
input[type="range"]::-webkit-slider-runnable-track{
  height:5px;border-radius:999px;
  background:linear-gradient(90deg,#bfdbfe,#c4b5fd);
}
input[type="range"]::-webkit-slider-thumb{
  -webkit-appearance:none;appearance:none;
  width:15px;height:15px;border-radius:50%;margin-top:-5px;
  background:#fff;border:2px solid #2563eb;
  box-shadow:0 2px 6px rgba(37,99,235,.30);
  transition:transform .12s ease;
}
input[type="range"]:hover::-webkit-slider-thumb{transform:scale(1.15)}
input[type="range"]:active::-webkit-slider-thumb{transform:scale(1.25)}
.export-wrap{position:relative}
.export-menu{
  position:absolute;right:0;top:calc(100% + 8px);
  background:#fff;border:1px solid var(--line);border-radius:14px;
  box-shadow:0 18px 44px rgba(15,23,42,.16);
  padding:6px;z-index:60;display:none;min-width:188px;
}
.export-menu.open{display:block}
.export-menu button{
  width:100%;justify-content:flex-start;border:0;border-radius:10px;background:transparent;
}
.export-menu button:hover{background:#eff6ff;transform:none;box-shadow:none}
.export-menu small{color:var(--muted);font-weight:400;margin-left:auto}
.mini-btn{
  min-height:28px;padding:4px 9px;font-size:12px;border-radius:9px;
}
.two-btn-3{display:grid;grid-template-columns:1fr 1fr;gap:8px;margin-top:9px}
.workspace.panning #objectCanvas{cursor:grab !important}
.workspace.panning-active #objectCanvas{cursor:grabbing !important}
.tool{transition:.15s ease;cursor:pointer}
.tool:hover{transform:translateY(-1px);border-color:#bfdbfe;box-shadow:0 8px 16px rgba(37,99,235,.08)}
.swatch{transition:transform .12s ease, outline-color .12s ease}
.swatch:hover{transform:scale(1.12)}
.canvas-toolbar button{transition:.14s ease}
.zoom-badge{display:flex;gap:8px;align-items:center}
.zoom-badge .kbd{border-color:rgba(148,163,184,.45);background:transparent;color:#cfe0f7;border-bottom-width:1px;min-width:auto}
