/* ===== AI Text Layer (Namespaced) ===== */
#ai_text_layer { font-family: µ¸¿ò, µ¸¿òÃ¼, sans-serif; }

/* overlay */
#ai_text_layer #ai_screen_disabled{
  display:none; position:fixed; inset:0;
  background:#000; opacity:0.18; z-index:96;
}

/* arrow */
#ai_text_layer #ai_panel_arrow{
  display:none;
  position:absolute;
  z-index:97;
  width:0;height:0;
  border-top:10px solid transparent;
  border-bottom:10px solid transparent;
  border-right:10px solid #fff;
  filter: drop-shadow(-1px 0 0 rgba(0,0,0,.18));
}

/* panel */
#ai_text_layer #ai_panel{
  display:none;
  position:absolute;
  z-index:98;
  width:400px;
  background:#fff;
  border:1px solid #bbb;
  border-radius:12px;
  box-shadow:0 10px 30px rgba(0,0,0,.18);
  padding:14px;
}

/* header */
#ai_text_layer #ai_panel_head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin:0 0 8px;
}
#ai_text_layer #ai_panel_title{ font:bold 14px sans-serif; margin:0; }
#ai_text_layer #ai_panel_close{
  border:none;
  background:transparent;
  font:700 16px/1 sans-serif;
  cursor:pointer;
  color:#666;
  padding:2px 6px;
  border-radius:6px;
}
#ai_text_layer #ai_panel_close:hover{ background:#f2f2f2; color:#111; }

#ai_text_layer #ai_panel_status{
  font-size:12px; color:#666; margin:6px 0 6px; min-height:16px;
}

/* sections */
#ai_text_layer .ai_section{
  border:1px solid #e6e6e6;
  border-radius:10px;
  padding:10px;
  margin-top:10px;
}
#ai_text_layer .ai_section.orig{
  background:#fbfbfb;
  border-style:dashed;
}
#ai_text_layer .ai_section.revised{
  background:#f6fbff;
  border-color:#dbeeff;
}

#ai_text_layer .ai_text_head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin:0 0 6px;
}
#ai_text_layer .ai_text_label{
  font:700 11px µ¸¿ò, µ¸¿òÃ¼, sans-serif;
  color:#333;
  margin:0;
}

/* sync pair: always visible */
#ai_text_layer .ai_sync_pair{
  display:flex;
  align-items:center;
  gap:6px;
}
#ai_text_layer .ai_sync_pair input[type="checkbox"]{
  transform:translateY(1px);
  cursor:pointer;
}

/* counts always readable */
#ai_text_layer .ai_count{
  font:11px µ¸¿ò, µ¸¿òÃ¼, sans-serif;
  color:#555;
  white-space:nowrap;
}

/* textarea */
#ai_text_layer .ai_textarea{
  width:100%;
  height:110px;
  font:12px µ¸¿òÃ¼;
  border:1px solid #ddd;
  word-break:break-all;
  resize:none;
  padding:8px;
  box-sizing:border-box;
  border-radius:8px;
}
#ai_text_layer #ai_panel_original{
  background:#F4F4F4;
  border-color:#d9d9d9;
}
#ai_text_layer #ai_panel_result{
  background:#ffffff;
  border-color:#bfe0ff;
}

/* summary */
#ai_text_layer #ai_panel_summary_wrap{
  display:none;
  margin-top:5px;
  padding-top:6px;
}
#ai_text_layer #ai_panel_summary_label{
  font:700 11px µ¸¿ò, µ¸¿òÃ¼, sans-serif;
  color:#444;
  margin-bottom:4px;
}
#ai_text_layer #ai_panel_summary{
  font:11px µ¸¿ò, µ¸¿òÃ¼, sans-serif;
  color:#666;
  line-height:1.45;
  white-space:pre-wrap;
  word-break:break-word;
}

/* buttons */
#ai_text_layer .btn{
  font-size:12px;
  padding:7px 10px;
  border:1px solid #ccc;
  background:#fff;
  cursor:pointer;
  border-radius:8px;
}
#ai_text_layer .btn.primary{
  border-color:#111;
  background:#111;
  color:#fff;
}
#ai_text_layer .btn:disabled{
  opacity:.45;
  cursor:not-allowed;
}
#ai_text_layer .ai_btn_row{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  margin-top:12px;
}

/* spinner overlay inside panel */
#ai_text_layer #ai_spinner{
  display:none;
  position:absolute;
  inset:0;
  background:rgba(255,255,255,0.60);
  border-radius:12px;
  z-index:99;
}
#ai_text_layer #ai_spinner .spin_box{
  position:absolute;
  left:50%;
  top:50%;
  transform:translate(-50%,-50%);
  text-align:center;
}
#ai_text_layer #ai_spinner .spin_icon{
  width:34px; height:34px;
  border:4px solid #ddd;
  border-top-color:#333;
  border-radius:50%;
  animation:aiSpin 0.9s linear infinite;
  margin:0 auto 8px;
}
#ai_text_layer #ai_spinner .spin_text{
  font:12px µ¸¿ò, µ¸¿òÃ¼, sans-serif;
  color:#444;
}
@keyframes aiSpin { to { transform:rotate(360deg); } }
