*{box-sizing:border-box}
body{
    margin:0;
    font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Arial;
    background:#f5f5f5;
    -webkit-text-size-adjust: 100%;
}
.container{
    max-width:1200px;
    margin:0 auto;
    padding:16px;
}

.style2{
    margin-top:-180px;
    position: relative;
    z-index: 10;
}

/* ===============================
   顶部布局：左预览 + 右操作（桌面）
   =============================== */
.top-wrap{
    display:flex;
    gap:14px;
    align-items:flex-start;
    margin-bottom:14px;
}

/* 左侧预览固定占宽（你后端改成 720 就写 720；没改就先写 720） */
.top-wrap .preview-box{
    flex: 0 0 min(720px, 100%);
    margin-bottom:0; /* 顶部布局里不需要预览区再额外下边距 */
}

/* 右侧操作面板 */
.right-panel{
    flex:1;
    background:#fff;
    border:1px solid #ddd;
    padding:14px;
    border-radius:12px;
}


h2{
    margin:8px 0 16px;
}

/* ===== 预览区：桌面端视觉优化 ===== */
.preview-box{
    border-radius:12px;
    background:#fff;
    border:1px solid #ddd;
    margin-bottom:14px;

    /* 新增 */
    min-height: 288px;          /* 核心：小内容也不塌 */
    display: flex;
    align-items: center;        /* 垂直居中 */
    justify-content: center;    /* 水平居中 */
}



/* ===== 透明背景棋盘（只在透明时使用）===== */
.preview-box.is-transparent{
    background-color: #eee;
    background-image:
        linear-gradient(45deg, #ccc 25%, transparent 25%),
        linear-gradient(-45deg, #ccc 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, #ccc 75%),
        linear-gradient(-45deg, transparent 75%, #ccc 75%);
    background-size: 20px 20px;
    background-position: 0 0, 0 10px, 10px -10px, -10px 0;
}

.preview-box img{
    display:block;
    max-width:100%;
    height:auto;
    max-height: 100%;
}


/* ===== 控制区 ===== */
.controls{
    background:#fff;
    border:1px solid #ddd;
    padding:14px;
    border-radius:12px;
}

/* 分类导航 */
.categories{
    display:flex;
    gap:10px;
    overflow-x:auto;
    margin-bottom:14px;
}
.category{
    flex-shrink:0;
    padding:8px 14px;
    background:#333;
    color:#fff;
    border-radius:4px;
    text-decoration:none;
    font-size:14px;
    white-space:nowrap;
}
.category.active{
    background:#ffcc00;
    color:#000;
}

/* 输入框 */
.form-box{
    display:flex;
    gap:10px;
    margin-bottom:14px;
}
.form-box input{
    flex:1;
    height:40px;
    padding:0 10px;
    font-size:14px;
}
.form-box button{
    height:40px;
    padding:0 16px;
    cursor:pointer;
}
/* ===== 多行输入框样式（图2风格） ===== */
.form-box-textarea{
    align-items: stretch;
}

.form-box-textarea textarea{
    flex: 1;
    min-height: 140px;
    resize: vertical;
    padding: 10px;
    font-size: 14px;
    line-height: 1.6;
    border: 1px solid #ccc;
    border-radius: 4px;
    outline: none;
    font-family: inherit;
}

.form-box-textarea textarea:focus{
    border-color: #999;
}

/* 让“生成”按钮在右侧居中 */
.form-box-textarea button{
    height: 40px;
    align-self: flex-end;
}


/* ===== 新增：编辑控件行（只加不改你原来的结构）===== */
.edit-row{
    display:flex;
    flex-wrap:wrap;
    gap:10px;
    align-items:center;
    margin-bottom:14px;
}
.edit-item{
    display:flex;
    align-items:center;
    gap:6px;
    font-size:14px;
}
.edit-item label{
    color:#333;
}
.edit-item select,
.edit-item input[type="text"]{
    height:32px;
    padding:0 8px;
    border:1px solid #ccc;
    border-radius:2px;
    font-size:14px;
    width:120px;
}
.edit-item input[type="checkbox"]{
    transform:translateY(1px);
}

/* Pickr 容器，让它看起来像“可点的颜色块” */
.pkr-box{
    width:34px;
    height:34px;
    border:1px solid #ccc;
    border-radius:2px;
    background:#fff;
    display:flex;
    align-items:center;
    justify-content:center;
}

/* 修正 pickr 默认按钮在容器内铺满 */
.pkr-box .pickr{
    width:100%;
    height:100%;
}
.pkr-box .pcr-button{
    width:100% !important;
    height:100% !important;
    border-radius:0 !important;
    border:0 !important;
    padding:0 !important;
}

/* 字体列表 */
.fonts{
    display:grid;
    grid-template-columns:repeat(4,1fr);
    gap:14px;
     width: 100%;
}
.font{
    background:#fff;
    border:1px solid #ddd;
    padding:10px;
    min-width:0;  /* 🔴关键：允许卡片本体变窄 */
}

.font-link{ 
    min-width:0;
    display:block;
}
.font{
}
.font.active{
    border-color:#000;
    background:#f0f0f0;
}
.font-name{
  font-size:13px;
    font-weight:bold;
    margin-bottom:6px;

    white-space:nowrap;
    overflow:hidden;
    text-overflow:ellipsis;
}
.font img{
  display: block;
    width: 100%;
    height: auto;
}

/* 响应式 */
@media (max-width:1024px){

    /* 顶部两列 → 单列 */
    .top-wrap{
        flex-direction: column;
    }

    .top-wrap .preview-box{
        flex: none;
        width: 100%;
    }

    .right-panel{
        width: 100%;
    }

    .fonts{grid-template-columns:repeat(2,1fr);}
    
    .form-box-textarea textarea{
        font-size: 16px;
    }
}

@media (max-width:640px){
    .container{
        padding:12px;
    }
    .fonts{
        grid-template-columns:repeat(2, minmax(0, 1fr)); /* 🔴关键：允许列继续变窄 */
        gap:10px;               /* 可选：手机端卡片稍微紧凑点 */
    }

    .form-box{flex-direction:column;}
    .form-box button{width:100%;}
    .edit-item select,
    .edit-item input[type="text"]{
        width:140px;
    }

    .preview-box{
        min-height: 130px;
        padding: 16px;
    }
}

.crop-modal{
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.6);
  display:flex;
  align-items:center;
  justify-content:center;
  z-index:9999;
}
.crop-modal.hidden{
  display:none;
}
.crop-panel{
  background:#fff;
  padding:12px;
  max-width:90vw;
  max-height:90vh;
}
.crop-panel img{
  max-width:80vw;
  max-height:70vh;
  display:block;
}
.crop-actions{
  display:flex;
  justify-content:flex-end;
  gap:10px;
  margin-top:10px;
}

.cropper-modal {
  pointer-events: none !important;
}

.category-desc {
  margin: 0px;
  padding: 16px;
  background: #ffffff;
  border-radius: 8px;
  color: #555;
  font-size: 14px;
  line-height: 1.8;
}
.category-desc h2 {
  font-size: 16px;
  margin-bottom: 8px;
  color: #333;
}
.font:hover {
  border-color: #000000;
}